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

/start/onboarding always redirects to /setup/onboarding #97958

Merged
merged 4 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
22 changes: 2 additions & 20 deletions client/signup/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { createElement } from 'react';
import store from 'store';
import { notFound } from 'calypso/controller';
import { recordPageView } from 'calypso/lib/analytics/page-view';
import { loadExperimentAssignment } from 'calypso/lib/explat';
import { isWooOAuth2Client } from 'calypso/lib/oauth2-clients';
import { login } from 'calypso/lib/paths';
import { sectionify } from 'calypso/lib/route';
Expand All @@ -32,8 +31,6 @@ import {
clearSignupDestinationCookie,
getSignupCompleteFlowName,
wasSignupCheckoutPageUnloaded,
setHasRedirectedForExperiment,
getHasRedirectedForExperiment,
} from './storageUtils';
import {
getStepUrl,
Expand Down Expand Up @@ -241,23 +238,9 @@ export default {

store.set( 'signup-locale', localeFromParams );

const hasRedirected =
context.querystring?.includes( 'redirected_1220=true' ) ||
// Check the URL as well because sometimes the context.querystring lags behind the URL.
new URLSearchParams( window.location.search ).has( 'redirected_1220' ) ||
// Check session storage in case the query parma was omitted.
getHasRedirectedForExperiment();

const isOnboardingFlow = flowName === 'onboarding';

if ( isOnboardingFlow && ! hasRedirected ) {
await loadExperimentAssignment( 'calypso_signup_onboarding_aa_test' );
setHasRedirectedForExperiment();

const stepperOnboardingExperimentAssignment = await loadExperimentAssignment(
'calypso_signup_onboarding_stepper_flow_confidence_check_3'
);

if ( isOnboardingFlow ) {
setReferrerPolicy();
let url =
getStepUrl(
Expand All @@ -266,9 +249,8 @@ export default {
getStepSectionName( context.params ),
localeFromParams ?? localeFromStore,
null,
stepperOnboardingExperimentAssignment.variationName === 'stepper' ? '/setup' : '/start'
'/setup'
) +
'?redirected_1220=true' +
( context.querystring ? '&' + context.querystring : '' ) +
( context.hashstring ? '#' + context.hashstring : '' );

Expand Down
15 changes: 0 additions & 15 deletions client/signup/storageUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,6 @@ export const setSignupCheckoutPageUnloaded = ( value ) =>
export const getSignupCompleteFlowName = () =>
ignoreFatalsForStorage( () => sessionStorage?.getItem( 'wpcom_signup_complete_flow_name' ) );

export const getHasRedirectedForExperiment = () =>
ignoreFatalsForStorage( () =>
sessionStorage?.getItem(
'wpcom_redirected_calypso_signup_onboarding_stepper_flow_confidence_check_2'
)
);

export const setHasRedirectedForExperiment = () =>
ignoreFatalsForStorage( () =>
sessionStorage?.setItem(
'wpcom_redirected_calypso_signup_onboarding_stepper_flow_confidence_check_2',
'1'
)
);

Comment on lines -64 to -78
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♥️

export const setSignupCompleteFlowName = ( value ) =>
ignoreFatalsForStorage( () =>
sessionStorage?.setItem( 'wpcom_signup_complete_flow_name', value )
Expand Down
Loading