Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site Migration: Remove automated-migration/collect-credentials feature flag and references to SOURCE_URL step #97661

Merged
merged 4 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const ImporterMigrateMessage: Step = ( { navigation } ) => {
useEffect( () => {
recordTracksEvent( 'wpcom_support_free_migration_request_click', {
path: window.location.pathname,
automated_migration: config.isEnabled( 'automated-migration/collect-credentials' ),
automated_migration: true,
prevent_ticket_creation: shouldPreventTicketCreation,
} );
if ( ! shouldPreventTicketCreation ) {
Expand All @@ -81,10 +81,7 @@ const ImporterMigrateMessage: Step = ( { navigation } ) => {
}, [ shouldPreventTicketCreation, config, fromUrl, siteSlug ] );
let whatToExpect: WhatToExpectProps[] = [];

if (
shouldPreventTicketCreation &&
config.isEnabled( 'automated-migration/collect-credentials' )
) {
if ( shouldPreventTicketCreation ) {
whatToExpect = [
{
icon: group,
Expand Down
22 changes: 2 additions & 20 deletions client/landing/stepper/declarative-flow/migration/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import config from '@automattic/calypso-config';
import {
PLAN_MIGRATION_TRIAL_MONTHLY,
PLAN_BUSINESS,
Expand Down Expand Up @@ -30,7 +29,6 @@ const {
SITE_CREATION_STEP,
MIGRATION_UPGRADE_PLAN,
MIGRATION_HOW_TO_MIGRATE,
MIGRATION_SOURCE_URL,
SITE_MIGRATION_INSTRUCTIONS,
SITE_MIGRATION_STARTED,
SITE_MIGRATION_ASSISTED_MIGRATION,
Expand All @@ -46,7 +44,6 @@ const steps = [
PROCESSING,
MIGRATION_UPGRADE_PLAN,
MIGRATION_HOW_TO_MIGRATE,
MIGRATION_SOURCE_URL,
SITE_MIGRATION_INSTRUCTIONS,
SITE_MIGRATION_STARTED,
SITE_MIGRATION_ASSISTED_MIGRATION,
Expand Down Expand Up @@ -225,7 +222,7 @@ const useCreateStepHandlers = ( navigate: Navigate< StepperStep[] >, flowObject:
}

const destinationStep = migrationDealAccepted
? MIGRATION_SOURCE_URL
? SITE_MIGRATION_CREDENTIALS
: MIGRATION_HOW_TO_MIGRATE;

return navigateToCheckout( { siteId, siteSlug, plan, from, props, destinationStep } );
Expand All @@ -248,12 +245,7 @@ const useCreateStepHandlers = ( navigate: Navigate< StepperStep[] >, flowObject:
return navigateWithQueryParams( SITE_MIGRATION_INSTRUCTIONS, [], props );
}

// @deprecated Remove the MIGRATION_SOURCE_URL when SITE_MIGRATION_CREDENTIALS is considered stable.
const SOURCE_STEP = config.isEnabled( 'automated-migration/collect-credentials' )
? SITE_MIGRATION_CREDENTIALS
: MIGRATION_SOURCE_URL;

return navigateWithQueryParams( SOURCE_STEP, [], props );
return navigateWithQueryParams( SITE_MIGRATION_CREDENTIALS, [], props );
},
},
[ SITE_MIGRATION_INSTRUCTIONS.slug ]: {
Expand All @@ -262,16 +254,6 @@ const useCreateStepHandlers = ( navigate: Navigate< StepperStep[] >, flowObject:
},
},

// @deprecated Remove the MIGRATION_SOURCE_URL when SITE_MIGRATION_CREDENTIALS is considered stable.
[ MIGRATION_SOURCE_URL.slug ]: {
submit: ( props?: ProvidedDependencies ) => {
return navigateWithQueryParams( SITE_MIGRATION_ASSISTED_MIGRATION, [], props );
},
goBack: ( props?: ProvidedDependencies ) => {
return navigateWithQueryParams( MIGRATION_HOW_TO_MIGRATE, [], props );
},
},

[ SITE_MIGRATION_CREDENTIALS.slug ]: {
submit: ( props?: ProvidedDependencies ) => {
const action = getFromPropsOrUrl( 'action', props ) as
Expand Down
52 changes: 2 additions & 50 deletions client/landing/stepper/declarative-flow/migration/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* @jest-environment jsdom
*/
import { URLSearchParams } from 'url';
import config from '@automattic/calypso-config';
import { isCurrentUserLoggedIn } from '@automattic/data-stores/src/user/selectors';
import { useIsSiteOwner } from 'calypso/landing/stepper/hooks/use-is-site-owner';
import { goToCheckout } from 'calypso/landing/stepper/utils/checkout';
Expand Down Expand Up @@ -321,15 +320,15 @@ describe( `${ flow.name }`, () => {
);
} );

it( 'redirects user from MIGRATION_UPGRADE_PLAN using SOURCE_URL_STEP as destination when they accept the offer', () => {
it( 'redirects user from MIGRATION_UPGRADE_PLAN using SITE_MIGRATION_CREDENTIALS as destination when they accept the offer', () => {
runNavigation( {
from: STEPS.MIGRATION_UPGRADE_PLAN,
query: { siteId: 123, siteSlug: 'example.wordpress.com' },
dependencies: { goToCheckout: true, plan: 'business', userAcceptedDeal: true },
} );

expect( goToCheckout ).toHaveBeenCalledWith( {
destination: `/setup/migration/migration-source-url?siteId=123&siteSlug=example.wordpress.com`,
destination: `/setup/migration/site-migration-credentials?siteId=123&siteSlug=example.wordpress.com`,
extraQueryParams: undefined,
flowName: 'migration',
siteSlug: 'example.wordpress.com',
Expand All @@ -354,23 +353,7 @@ describe( `${ flow.name }`, () => {
} );
} );

it( 'redirects user from How To Migrate to MIGRATION_SOURCE_URL when they selects the option "do it for me"', () => {
config.disable( 'automated-migration/collect-credentials' );

const destination = runNavigation( {
from: STEPS.MIGRATION_HOW_TO_MIGRATE,
query: { siteId: 123, siteSlug: 'example.wordpress.com' },
dependencies: { how: HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME },
} );

expect( destination ).toMatchDestination( {
step: STEPS.MIGRATION_SOURCE_URL,
query: { siteId: 123, siteSlug: 'example.wordpress.com' },
} );
} );

it( 'redirects user from How To Migrate > SITE_MIGRATION_CREDENTIALS when they selects the option "do it for me"', () => {
config.enable( 'automated-migration/collect-credentials' );
const destination = runNavigation( {
from: STEPS.MIGRATION_HOW_TO_MIGRATE,
query: { siteId: 123, siteSlug: 'example.wordpress.com' },
Expand Down Expand Up @@ -495,25 +478,6 @@ describe( `${ flow.name }`, () => {
} );
} );

describe( 'MIGRATION_SOURCE_URL', () => {
it( 'redirects users from Capture Source URL to Migration assisted', () => {
const destination = runNavigation( {
from: STEPS.MIGRATION_SOURCE_URL,
query: { siteId: 123, siteSlug: 'example.wordpress.com' },
dependencies: { from: 'http://oldsite.example.com' },
} );

expect( destination ).toMatchDestination( {
step: STEPS.SITE_MIGRATION_ASSISTED_MIGRATION,
query: {
siteId: 123,
siteSlug: 'example.wordpress.com',
from: 'http://oldsite.example.com',
},
} );
} );
} );

describe( 'SITE_MIGRATION_OTHER_PLATFORM_DETECTED_IMPORT STEP', () => {
it( 'redirects users from SITE_MIGRATION_OTHER_PLATFORM_DETECTED_IMPORT to SITE_MIGRATION_ASSISTED_MIGRATION', () => {
runNavigation( {
Expand Down Expand Up @@ -542,18 +506,6 @@ describe( `${ flow.name }`, () => {
} );

describe( 'useStepNavigation > goBack', () => {
it( 'redirects back user from SOURCE URL > HOW TO MIGRATE', () => {
const destination = runNavigationBack( {
from: STEPS.MIGRATION_SOURCE_URL,
query: { siteId: 123, siteSlug: 'example.wordpress.com' },
} );

expect( destination ).toMatchDestination( {
step: STEPS.MIGRATION_HOW_TO_MIGRATE,
query: { siteId: 123, siteSlug: 'example.wordpress.com' },
} );
} );

it( 'retain user on the step and set the assisted migration modal query param when the modal query param is not set', () => {
const destination = runNavigationBack( {
from: STEPS.MIGRATION_UPGRADE_PLAN,
Expand Down
36 changes: 11 additions & 25 deletions client/landing/stepper/declarative-flow/site-migration-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,23 +301,16 @@ const siteMigration: Flow = {

// Do it for me option.
if ( providedDependencies?.how === HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME ) {
if ( config.isEnabled( 'automated-migration/collect-credentials' ) ) {
return navigate(
addQueryArgs(
{
siteSlug,
from: fromQueryParam,
siteId,
},
STEPS.SITE_MIGRATION_CREDENTIALS.slug
)
);
}

return navigate( STEPS.SITE_MIGRATION_ASSISTED_MIGRATION.slug, {
siteId,
siteSlug,
} );
return navigate(
addQueryArgs(
{
siteSlug,
from: fromQueryParam,
siteId,
},
STEPS.SITE_MIGRATION_CREDENTIALS.slug
)
);
}

// Continue with the migration flow.
Expand Down Expand Up @@ -346,14 +339,7 @@ const siteMigration: Flow = {
providedDependencies?.userAcceptedDeal ||
urlQueryParams.get( 'how' ) === HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME
) {
if ( config.isEnabled( 'automated-migration/collect-credentials' ) ) {
redirectAfterCheckout = STEPS.SITE_MIGRATION_CREDENTIALS.slug;
} else if ( ! fromQueryParam ) {
// If the user selected "Do it for me" but has not given us a source site, we should take them to the source URL step.
redirectAfterCheckout = STEPS.SITE_MIGRATION_SOURCE_URL.slug;
} else {
redirectAfterCheckout = STEPS.SITE_MIGRATION_ASSISTED_MIGRATION.slug;
}
redirectAfterCheckout = STEPS.SITE_MIGRATION_CREDENTIALS.slug;
}

const destination = addQueryArgs(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* @jest-environment jsdom
*/
import config from '@automattic/calypso-config';
import { PLAN_MIGRATION_TRIAL_MONTHLY } from '@automattic/calypso-products';
import { isCurrentUserLoggedIn } from '@automattic/data-stores/src/user/selectors';
import { waitFor } from '@testing-library/react';
Expand Down Expand Up @@ -180,27 +179,6 @@ describe( 'Hosted site Migration Flow', () => {
} );
} );

it( 'migrate redirects from the how-to-migrate (do it for me) page to assisted migration page', () => {
config.disable( 'automated-migration/collect-credentials' );
const { runUseStepNavigationSubmit } = renderFlow( hostedSiteMigrationFlow );

runUseStepNavigationSubmit( {
currentStep: STEPS.SITE_MIGRATION_HOW_TO_MIGRATE.slug,
dependencies: {
destination: 'migrate',
how: HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME,
},
} );

expect( getFlowLocation() ).toEqual( {
path: `/${ STEPS.SITE_MIGRATION_ASSISTED_MIGRATION.slug }`,
state: {
siteSlug: 'example.wordpress.com',
},
} );
config.enable( 'automated-migration/collect-credentials' );
} );

it( 'migrate redirects from the how-to-migrate (do it for me) page to credential collection step', () => {
const { runUseStepNavigationSubmit } = renderFlow( hostedSiteMigrationFlow );

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* @jest-environment jsdom
*/
import config from '@automattic/calypso-config';
import { PLAN_MIGRATION_TRIAL_MONTHLY } from '@automattic/calypso-products';
import { isCurrentUserLoggedIn } from '@automattic/data-stores/src/user/selectors';
import { waitFor } from '@testing-library/react';
Expand Down Expand Up @@ -223,27 +222,6 @@ describe( 'Site Migration Flow', () => {
} );
} );

it( 'migrate redirects from the how-to-migrate (do it for me) page to assisted migration page', () => {
config.disable( 'automated-migration/collect-credentials' );
const { runUseStepNavigationSubmit } = renderFlow( siteMigrationFlow );

runUseStepNavigationSubmit( {
currentStep: STEPS.SITE_MIGRATION_HOW_TO_MIGRATE.slug,
dependencies: {
destination: 'migrate',
how: HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME,
},
} );

expect( getFlowLocation() ).toEqual( {
path: `/${ STEPS.SITE_MIGRATION_ASSISTED_MIGRATION.slug }`,
state: {
siteSlug: 'example.wordpress.com',
},
} );
config.enable( 'automated-migration/collect-credentials' );
} );

it( 'migrate redirects from the how-to-migrate (do it for me) page to credential collection step', () => {
const { runUseStepNavigationSubmit } = renderFlow( siteMigrationFlow );

Expand Down Expand Up @@ -302,33 +280,6 @@ describe( 'Site Migration Flow', () => {
} );
} );

it( 'redirects the user to the checkout page with the credentials step as success destination', () => {
config.enable( 'automated-migration/collect-credentials' );
const { runUseStepNavigationSubmit } = renderFlow( siteMigrationFlow );

runUseStepNavigationSubmit( {
currentURL: `/setup/${ STEPS.SITE_MIGRATION_UPGRADE_PLAN.slug }?siteSlug=example.wordpress.com&from=https://site-to-be-migrated.com&how=${ HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME }`,
currentStep: STEPS.SITE_MIGRATION_UPGRADE_PLAN.slug,
dependencies: {
goToCheckout: true,
plan: PLAN_MIGRATION_TRIAL_MONTHLY,
sendIntentWhenCreatingTrial: true,
},
cancelDestination: `/setup/site-migration/${ STEPS.SITE_MIGRATION_UPGRADE_PLAN.slug }?siteSlug=example.wordpress.com&from=https://site-to-be-migrated.com&how=${ HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME }`,
} );

expect( goToCheckout ).toHaveBeenCalledWith( {
destination: `/setup/site-migration/${ STEPS.SITE_MIGRATION_CREDENTIALS.slug }?siteSlug=example.wordpress.com&from=https%3A%2F%2Fsite-to-be-migrated.com`,
extraQueryParams: { hosting_intent: HOSTING_INTENT_MIGRATE },
flowName: 'site-migration',
siteSlug: 'example.wordpress.com',
stepName: STEPS.SITE_MIGRATION_UPGRADE_PLAN.slug,
cancelDestination: `/setup/site-migration/${ STEPS.SITE_MIGRATION_UPGRADE_PLAN.slug }?siteSlug=example.wordpress.com&from=https%3A%2F%2Fsite-to-be-migrated.com&how=${ HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME }`,
plan: PLAN_MIGRATION_TRIAL_MONTHLY,
} );
config.disable( 'automated-migration/collect-credentials' );
} );

it( 'redirects back to the credentials step when failing to create the ticket', () => {
const { runUseStepNavigationSubmit } = renderFlow( siteMigrationFlow );

Expand Down
1 change: 0 additions & 1 deletion config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"a4a-dev-sites": true,
"akismet/checkout-quantity-dropdown": true,
"automated-migration/application-password": true,
"automated-migration/collect-credentials": true,
"automated-migration/pending-status": true,
"bulk-plugin-management": true,
"calypso/ai-blogging-prompts": true,
Expand Down
1 change: 0 additions & 1 deletion config/horizon.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"ad-tracking": false,
"a4a-dev-sites": true,
"automated-migration/application-password": true,
"automated-migration/collect-credentials": true,
"automated-migration/pending-status": true,
"calypso/ai-blogging-prompts": false,
"calypso/ai-assembler": true,
Expand Down
1 change: 0 additions & 1 deletion config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"a4a-dev-sites": true,
"akismet/checkout-quantity-dropdown": true,
"automated-migration/application-password": true,
"automated-migration/collect-credentials": true,
"automated-migration/pending-status": true,
"bulk-plugin-management": true,
"calypso/ai-blogging-prompts": false,
Expand Down
1 change: 0 additions & 1 deletion config/stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"a4a-dev-sites": true,
"akismet/checkout-quantity-dropdown": true,
"automated-migration/application-password": true,
"automated-migration/collect-credentials": true,
"automated-migration/pending-status": true,
"bulk-plugin-management": true,
"calypso/ai-blogging-prompts": false,
Expand Down
1 change: 0 additions & 1 deletion config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"a4a-dev-sites": true,
"akismet/checkout-quantity-dropdown": true,
"automated-migration/application-password": true,
"automated-migration/collect-credentials": true,
"automated-migration/pending-status": true,
"calypso/all-domain-management": false,
"calypsoify/plugins": true,
Expand Down
1 change: 0 additions & 1 deletion config/wpcalypso.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"a4a-dev-sites": true,
"akismet/checkout-quantity-dropdown": true,
"automated-migration/application-password": true,
"automated-migration/collect-credentials": true,
"automated-migration/pending-status": true,
"bulk-plugin-management": true,
"calypso/ai-blogging-prompts": true,
Expand Down
Loading