Skip to content

Commit

Permalink
Rename customized action query string (#93785)
Browse files Browse the repository at this point in the history
  • Loading branch information
renatho authored Aug 21, 2024
1 parent 4984b3a commit b4064fe
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function getFinalImporterUrl(
fromSite: string,
platform: ImporterPlatform,
backToFlow?: string,
migrateEntireSiteFlow?: string
customizedActionGoToFlow?: string
) {
let importerUrl;
const encodedFromSite = encodeURIComponent( fromSite );
Expand Down Expand Up @@ -46,9 +46,9 @@ export function getFinalImporterUrl(
} );
}

if ( migrateEntireSiteFlow ) {
if ( customizedActionGoToFlow ) {
importerUrl = addQueryArgs( importerUrl, {
migrateEntireSiteFlow,
customizedActionGoToFlow,
} );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,20 @@ const ImporterWordpress: FC< Props > = function ( props ) {
);

let customizedActionButtons;
if ( queryParams.get( 'ref' ) === MIGRATION_FLOW ) {
customizedActionButtons = (
<StepNavigationLink
direction="forward"
handleClick={ () => {
props.navigation.submit?.( { action: 'customized-action-flow' } );
} }
label={ translate( 'I want to migrate my entire site' ) }
cssClass={ clsx( 'step-container__navigation-link', 'forward', 'has-underline' ) }
borderless
/>
);
switch ( queryParams.get( 'ref' ) ) {
case MIGRATION_FLOW:
customizedActionButtons = (
<StepNavigationLink
direction="forward"
handleClick={ () => {
props.navigation.submit?.( { action: 'customized-action-go-to-flow' } );
} }
label={ translate( 'I want to migrate my entire site' ) }
cssClass={ clsx( 'step-container__navigation-link', 'forward', 'has-underline' ) }
borderless
/>
);
break;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export const goToImporter = ( {
replaceHistory = false,
}: GoToImporterParams ) => {
const backToFlow = backToStep ? getFlowPath( backToStep?.slug ) : undefined;
const migrateEntireSiteFlow = migrateEntireSiteStep
const customizedActionGoToFlow = migrateEntireSiteStep
? getFlowPath( migrateEntireSiteStep?.slug )
: undefined;
const path = getFinalImporterUrl( siteSlug, '', platform, backToFlow, migrateEntireSiteFlow );
const path = getFinalImporterUrl( siteSlug, '', platform, backToFlow, customizedActionGoToFlow );

if ( isWpAdminImporter( path ) ) {
return goTo( path, replaceHistory );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ describe( `${ flow.name }`, () => {
from: '',
option: 'content',
backToFlow: '/migration/platform-identification',
migrateEntireSiteFlow: '/migration/migration-upgrade-plan',
customizedActionGoToFlow: '/migration/migration-upgrade-plan',
siteId: 123,
ref: 'migration',
},
Expand Down
8 changes: 4 additions & 4 deletions client/landing/stepper/declarative-flow/site-setup-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,10 @@ const siteSetupFlow: Flow = {
return navigate( `verifyEmail?${ urlQueryParams.toString() }` );
case 'checkout':
return exitFlow( providedDependencies?.checkoutUrl as string );
case 'customized-action-flow': {
const migrateEntireSiteFlow = urlQueryParams.get( 'migrateEntireSiteFlow' );
if ( migrateEntireSiteFlow ) {
return goToFlow( migrateEntireSiteFlow );
case 'customized-action-go-to-flow': {
const customizedActionGoToFlow = urlQueryParams.get( 'customizedActionGoToFlow' );
if ( customizedActionGoToFlow ) {
return goToFlow( customizedActionGoToFlow );
}
}
default:
Expand Down

0 comments on commit b4064fe

Please sign in to comment.