Skip to content

Commit

Permalink
We now take the plan length into consideration
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrdortiz committed Nov 28, 2024
1 parent 06524c4 commit 9e723d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
14 changes: 1 addition & 13 deletions client/landing/stepper/declarative-flow/copy-site.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@ const COPY_SITE_STEPS = [
{ slug: 'resuming', component: ProcessingStep }, // Needs siteSlug param
];

const getValidCopyPlanFromSearchParams = ( urlQueryParams: URLSearchParams ) => {
const plan = urlQueryParams.get( 'plan' );
switch ( plan ) {
case 'ecommerce-bundle':
return 'ecommerce';
case 'business-bundle':
return 'business';
default:
return 'business';
}
};

const copySite: Flow = {
name: COPY_SITE_FLOW,

Expand Down Expand Up @@ -141,7 +129,7 @@ const copySite: Flow = {
setSignupCompleteSlug( siteSlug );
setSignupCompleteFlowName( flowName );
const returnUrl = encodeURIComponent( destination );
const plan = getValidCopyPlanFromSearchParams( urlQueryParams );
const plan = urlQueryParams.get( 'plan' );
return window.location.assign(
`/checkout/${ plan }/${ encodeURIComponent(
( siteSlug as string ) ?? ''
Expand Down
10 changes: 5 additions & 5 deletions client/sites/components/sites-dataviews/actions.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { FEATURE_SFTP, WPCOM_FEATURES_COPY_SITE } from '@automattic/calypso-products';
import { FEATURE_SFTP, getPlanPath, WPCOM_FEATURES_COPY_SITE } from '@automattic/calypso-products';
import page from '@automattic/calypso-router';
import { useLocalizeUrl } from '@automattic/i18n-utils';
import {
SiteExcerptData,
SITE_EXCERPT_REQUEST_FIELDS,
SITE_EXCERPT_REQUEST_OPTIONS,
SiteExcerptData,
} from '@automattic/sites';
import { useQueryClient } from '@tanstack/react-query';
import { drawerLeft, wordpress, external } from '@wordpress/icons';
import { drawerLeft, external, wordpress } from '@wordpress/icons';
import { useI18n } from '@wordpress/react-i18n';
import { addQueryArgs } from '@wordpress/url';
import { useMemo } from 'react';
Expand All @@ -20,10 +20,10 @@ import {
getSiteAdminUrl,
getSiteMonitoringUrl,
isCustomDomain,
isDisconnectedJetpackAndNotAtomic,
isNotAtomicJetpack,
isP2Site,
isSimpleSite,
isDisconnectedJetpackAndNotAtomic,
} from 'calypso/sites-dashboard/utils';
import { useDispatch as useReduxDispatch, useSelector } from 'calypso/state';
import { recordTracksEvent } from 'calypso/state/analytics/actions';
Expand Down Expand Up @@ -454,7 +454,7 @@ export function useActions( {
page(
addQueryArgs( `/setup/copy-site`, {
sourceSlug: site.slug,
plan: site.plan?.product_slug,
plan: getPlanPath( site.plan?.product_slug ?? 'business' ),
} )
);
dispatch( recordTracksEvent( 'calypso_sites_dashboard_site_action_copy_site_click' ) );
Expand Down

0 comments on commit 9e723d8

Please sign in to comment.