Skip to content

Commit

Permalink
/start/onboarding always redirects to /setup/onboarding (#97958)
Browse files Browse the repository at this point in the history
* /start/onboarding always redirects to /setup/onboarding

* Remove unused calypso_signup_onboarding_aa_test assignment

* Remove double-redirect checks now that /start isn't redirecting back to /start

* fix query params on redirect

---------

Co-authored-by: Candy Tsai <[email protected]>
  • Loading branch information
p-jackson and candy02058912 authored Jan 6, 2025
1 parent 11e1260 commit c26ead4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 38 deletions.
27 changes: 4 additions & 23 deletions client/signup/controller.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import config from '@automattic/calypso-config';
import page from '@automattic/calypso-router';
import { isOnboardingFlow } from '@automattic/onboarding';
import { isEmpty } from 'lodash';
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 +32,6 @@ import {
clearSignupDestinationCookie,
getSignupCompleteFlowName,
wasSignupCheckoutPageUnloaded,
setHasRedirectedForExperiment,
getHasRedirectedForExperiment,
} from './storageUtils';
import {
getStepUrl,
Expand Down Expand Up @@ -241,23 +239,7 @@ 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( flowName ) ) {
setReferrerPolicy();
let url =
getStepUrl(
Expand All @@ -266,10 +248,9 @@ export default {
getStepSectionName( context.params ),
localeFromParams ?? localeFromStore,
null,
stepperOnboardingExperimentAssignment.variationName === 'stepper' ? '/setup' : '/start'
'/setup'
) +
'?redirected_1220=true' +
( context.querystring ? '&' + context.querystring : '' ) +
( context.querystring ? '?' + context.querystring : '' ) +
( context.hashstring ? '#' + context.hashstring : '' );

if ( document.referrer ) {
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'
)
);

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

0 comments on commit c26ead4

Please sign in to comment.