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

Tailored Flows: Remove redirect to launchpad for removed flows #95669

Merged
merged 5 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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/' },
mmtr marked this conversation as resolved.
Show resolved Hide resolved
mmtr marked this conversation as resolved.
Show resolved Hide resolved
];

// 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;
mmtr marked this conversation as resolved.
Show resolved Hide resolved

if (
shouldShowLaunchpad &&
Expand Down
Loading