Skip to content

Commit

Permalink
Tailored Flows: Remove redirect to launchpad for removed flows
Browse files Browse the repository at this point in the history
  • Loading branch information
mmtr committed Oct 24, 2024
1 parent 3f6d739 commit 971645e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 9 additions & 7 deletions client/landing/stepper/utils/flow-redirect-handler.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { recordTracksEvent } from 'calypso/lib/analytics/tracks';

// Flows to redirect
const redirectRoutes = [
{ from: '/setup/blog/', to: '/start:lang?' },
{ from: '/setup/free/', to: '/start/free:lang?' },
{ from: '/setup/link-in-bio/', to: '/start:lang?' },
{ from: '/setup/videopress/', to: '/start:lang?' },
{ from: '/setup/sensei/', to: ':lang?/plugins/sensei-pro/' },
export const REMOVED_TAILORED_FLOWS = [
{ flow: 'blog', to: '/start:lang?' },
{ flow: 'free', to: '/start/free:lang?' },
{ flow: 'link-in-bio', to: '/start:lang?' },
{ flow: 'videopress', to: '/start:lang?' },
{ flow: 'sensei', to: ':lang?/plugins/sensei-pro/' },
];

// Regex pattern for the optional language code in the format xx or xx-yy
Expand All @@ -18,7 +18,9 @@ const redirectPathIfNecessary = ( pathname: string, search: string ) => {
pathname = pathname.endsWith( '/' ) ? pathname : pathname + '/';

// Find the matching redirect route
const route = redirectRoutes.find( ( redirect ) => pathname.startsWith( redirect.from ) );
const route = REMOVED_TAILORED_FLOWS.find( ( { flow } ) =>
pathname.startsWith( `/setup/${ flow }/` )
);

// If no route is found we don't redirect and return false
if ( ! route ) {
Expand Down
4 changes: 3 additions & 1 deletion client/my-sites/customer-home/controller.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import page from '@automattic/calypso-router';
import { fetchLaunchpad } from '@automattic/data-stores';
import { areLaunchpadTasksCompleted } from 'calypso/landing/stepper/declarative-flow/internals/steps-repository/launchpad/task-helper';
import { REMOVED_TAILORED_FLOWS } from 'calypso/landing/stepper/utils/flow-redirect-handler';
import { getQueryArgs } from 'calypso/lib/query-args';
import { fetchModuleList } from 'calypso/state/jetpack/modules/actions';
import { fetchSitePlugins } from 'calypso/state/plugins/installed/actions';
Expand Down Expand Up @@ -67,7 +68,8 @@ export async function maybeRedirect( context, next ) {
checklist: launchpadChecklist,
} = await fetchLaunchpad( slug );

const shouldShowLaunchpad = true;
const isRemovedFlow = REMOVED_TAILORED_FLOWS.find( ( { flow } ) => flow === siteIntentOption );
const shouldShowLaunchpad = ! isRemovedFlow;

if (
shouldShowLaunchpad &&
Expand Down

0 comments on commit 971645e

Please sign in to comment.