Skip to content

Commit a38e4b1

Browse files
paulopmt1p-jackson
andauthored
Allow users to change their minds about Big Sky on the plans page (#99128)
* Allow users to change their minds about Big Sky selection on plans page * Showing Big Sky subheader even with free domains * Added a custom modal copy for Big Sky + Paid domain * Moved Big Sky changes from PAID_PLAN_PAID_DOMAIN_DIALOG to PAID_PLAN_IS_REQUIRED_DIALOG Changes needed to be made to the useModalResolutionCallback hook anyway to ensure the dialog appeared when the user had a free domain. So switching to the PAID_PLAN_IS_REQUIRED_DIALOG dialog was better for us anyway, since it doesn't include the green "free for a year" text that sometimes appears. --------- Co-authored-by: Philip Jackson <[email protected]>
1 parent 6f474fa commit a38e4b1

File tree

4 files changed

+66
-4
lines changed

4 files changed

+66
-4
lines changed

client/my-sites/plans-features-main/components/plan-upsell-modal/hooks/use-modal-resolution-callback.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Props = {
1616
paidDomainName?: string | null;
1717
intent?: string | null;
1818
selectedThemeType?: string;
19+
createWithBigSky?: boolean;
1920
};
2021

2122
/**
@@ -27,6 +28,7 @@ export function useModalResolutionCallback( {
2728
paidDomainName,
2829
intent,
2930
selectedThemeType,
31+
createWithBigSky,
3032
}: Props ) {
3133
return useCallback(
3234
( currentSelectedPlan?: string | null ): ModalType | null => {
@@ -45,6 +47,10 @@ export function useModalResolutionCallback( {
4547
return FREE_PLAN_FREE_DOMAIN_DIALOG;
4648
}
4749

50+
if ( createWithBigSky && ONBOARDING_FLOW === flowName ) {
51+
return PAID_PLAN_IS_REQUIRED_DIALOG;
52+
}
53+
4854
// TODO: look into decoupling the flowName from here as well.
4955
if (
5056
paidDomainName &&
@@ -58,6 +64,13 @@ export function useModalResolutionCallback( {
5864

5965
return null;
6066
},
61-
[ isCustomDomainAllowedOnFreePlan, flowName, paidDomainName, intent, selectedThemeType ]
67+
[
68+
isCustomDomainAllowedOnFreePlan,
69+
flowName,
70+
paidDomainName,
71+
intent,
72+
selectedThemeType,
73+
createWithBigSky,
74+
]
6275
);
6376
}

client/my-sites/plans-features-main/components/plan-upsell-modal/paid-plan-is-required-dialog.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { LoadingPlaceholder } from '@automattic/components';
2+
import { type OnboardSelect } from '@automattic/data-stores';
23
import { FREE_THEME } from '@automattic/design-picker';
34
import { PlanButton } from '@automattic/plans-grid-next';
5+
import { useDispatch, useSelect } from '@wordpress/data';
46
import { useEffect, useState } from '@wordpress/element';
57
import { useTranslate } from 'i18n-calypso';
8+
import { ONBOARD_STORE } from 'calypso/landing/stepper/stores';
69
import { recordTracksEvent } from 'calypso/lib/analytics/tracks';
710
import { getHidePlanPropsBasedOnThemeType } from '../utils/utils';
811
import { ButtonContainer, DialogContainer, Heading, Row } from './components';
@@ -21,6 +24,11 @@ export const PaidPlanIsRequiredDialog = ( {
2124
const [ isBusy, setIsBusy ] = useState( false );
2225
const isPaidTheme = selectedThemeType && selectedThemeType !== FREE_THEME;
2326
const hidePlanProps = getHidePlanPropsBasedOnThemeType( selectedThemeType || '' );
27+
const { setCreateWithBigSky } = useDispatch( ONBOARD_STORE );
28+
const createWithBigSky = useSelect( ( select: ( key: string ) => OnboardSelect ) => {
29+
const { getCreateWithBigSky } = select( ONBOARD_STORE );
30+
return getCreateWithBigSky();
31+
}, [] );
2432

2533
const getUpsellTitle = () => {
2634
if ( isPaidTheme && paidDomainName ) {
@@ -31,12 +39,24 @@ export const PaidPlanIsRequiredDialog = ( {
3139
return translate( 'Premium themes are only available with a paid plan' );
3240
}
3341

42+
if ( createWithBigSky && paidDomainName ) {
43+
return translate( 'Domains and our AI Website Builder are only available with a paid plan' );
44+
}
45+
46+
if ( createWithBigSky ) {
47+
return translate( 'Our AI Website Builder is only available with a paid plan' );
48+
}
49+
3450
return translate( 'Custom domains are only available with a paid plan' );
3551
};
3652

3753
const handleFreeDomainClick = () => {
3854
setIsBusy( true );
3955
onFreePlanSelected();
56+
57+
if ( createWithBigSky ) {
58+
setCreateWithBigSky( false );
59+
}
4060
};
4161

4262
useEffect( () => {

client/my-sites/plans-features-main/components/plans-page-subheader.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { Button, Gridicon } from '@automattic/components';
2+
import { OnboardSelect } from '@automattic/data-stores';
23
import styled from '@emotion/styled';
4+
import { useSelect } from '@wordpress/data';
35
import { useTranslate } from 'i18n-calypso';
46
import FormattedHeader from 'calypso/components/formatted-header';
7+
import { ONBOARD_STORE } from 'calypso/landing/stepper/stores';
58

69
const Subheader = styled.p`
710
margin: -32px 0 40px 0;
@@ -113,9 +116,26 @@ const PlansPageSubheader = ( {
113116
} ) => {
114117
const translate = useTranslate();
115118

119+
const createWithBigSky = useSelect( ( select: ( key: string ) => OnboardSelect ) => {
120+
const { getCreateWithBigSky } = select( ONBOARD_STORE );
121+
return getCreateWithBigSky();
122+
}, [] );
123+
116124
return (
117125
<>
118-
{ deemphasizeFreePlan && offeringFreePlan ? (
126+
{ createWithBigSky && (
127+
<Subheader>
128+
{ translate(
129+
`Build your site quickly with our AI Website Builder or {{link}}start with a free plan{{/link}}.`,
130+
{
131+
components: {
132+
link: <Button onClick={ onFreePlanCTAClick } borderless />,
133+
},
134+
}
135+
) }
136+
</Subheader>
137+
) }
138+
{ ! createWithBigSky && deemphasizeFreePlan && offeringFreePlan ? (
119139
<Subheader>
120140
{ translate(
121141
`Unlock a powerful bundle of features. Or {{link}}start with a free plan{{/link}}.`,

client/my-sites/plans-features-main/index.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from '@automattic/calypso-products';
2121
import page from '@automattic/calypso-router';
2222
import { Button, Spinner } from '@automattic/components';
23-
import { WpcomPlansUI, AddOns, Plans } from '@automattic/data-stores';
23+
import { WpcomPlansUI, AddOns, Plans, OnboardSelect } from '@automattic/data-stores';
2424
import { isAnyHostingFlow, isOnboardingGuidedFlow } from '@automattic/onboarding';
2525
import {
2626
FeaturesGrid,
@@ -32,7 +32,7 @@ import {
3232
} from '@automattic/plans-grid-next';
3333
import { useMobileBreakpoint } from '@automattic/viewport-react';
3434
import styled from '@emotion/styled';
35-
import { useDispatch } from '@wordpress/data';
35+
import { useDispatch, useSelect } from '@wordpress/data';
3636
import {
3737
useCallback,
3838
useEffect,
@@ -50,6 +50,7 @@ import QueryActivePromotions from 'calypso/components/data/query-active-promotio
5050
import QueryProductsList from 'calypso/components/data/query-products-list';
5151
import QuerySitePlans from 'calypso/components/data/query-site-plans';
5252
import QuerySites from 'calypso/components/data/query-sites';
53+
import { ONBOARD_STORE } from 'calypso/landing/stepper/stores';
5354
import { retargetViewPlans } from 'calypso/lib/analytics/ad-tracking';
5455
import { recordTracksEvent } from 'calypso/lib/analytics/tracks';
5556
import { planItem as getCartItemForPlan } from 'calypso/lib/cart-values/cart-items';
@@ -248,12 +249,20 @@ const PlansFeaturesMain = ( {
248249

249250
const longerPlanTermDefaultExperiment = useLongerPlanTermDefaultExperiment( flowName );
250251

252+
const { createWithBigSky } = useSelect(
253+
( select ) => ( {
254+
createWithBigSky: ( select( ONBOARD_STORE ) as OnboardSelect ).getCreateWithBigSky(),
255+
} ),
256+
[]
257+
);
258+
251259
const resolveModal = useModalResolutionCallback( {
252260
isCustomDomainAllowedOnFreePlan,
253261
flowName,
254262
paidDomainName,
255263
intent: intentFromProps,
256264
selectedThemeType,
265+
createWithBigSky,
257266
} );
258267

259268
const toggleShowPlansComparisonGrid = () => {

0 commit comments

Comments
 (0)