From 3e0923d6a2851c28a9f6a8a3f73312f0f9c9996b Mon Sep 17 00:00:00 2001 From: Philip Jackson Date: Sun, 8 Dec 2024 16:50:38 +1300 Subject: [PATCH] Remove `calypso_onboarding_goals_step_added_goals` experiment (#97203) * Remove calypso_onboarding_goals_step_added_goals experiment Removes code for assigning experiment participants, and any code that used the old control variant. * Remove unnecessary variable --- .../design-setup/categories.ts | 57 ++-------------- .../design-setup/unified-design-picker.tsx | 9 +-- .../steps-repository/goals/goals.tsx | 50 +------------- .../steps-repository/goals/index.tsx | 68 +++++++------------ .../steps-repository/goals/select-goals.tsx | 10 +-- 5 files changed, 35 insertions(+), 159 deletions(-) diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/categories.ts b/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/categories.ts index 9a3f78ad0f32f..902013581530e 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/categories.ts +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/categories.ts @@ -73,62 +73,13 @@ function makeSortCategoryToTop( slugs: string[] ) { }; } -const sortBlogToTop = makeSortCategoryToTop( [ CATEGORIES.BLOG ] ); -const sortStoreToTop = makeSortCategoryToTop( [ CATEGORIES.STORE ] ); -const sortBusinessToTop = makeSortCategoryToTop( [ CATEGORIES.BUSINESS ] ); - -export function getCategorizationOptions( - intent: string, - goals: Onboard.SiteGoal[], - options: { - useGoals?: boolean; - isMultiSelection?: boolean; - } = {} -) { - if ( options.useGoals ) { - return getCategorizationFromGoals( goals, options.isMultiSelection ); - } - return getCategorizationFromIntent( intent ); +interface CategorizationOptions { + isMultiSelection?: boolean; } -function getCategorizationFromIntent( intent: string ) { - const result = { - defaultSelections: [] as string[], - } as { - defaultSelections: string[]; - sort: ( a: Category, b: Category ) => 0 | 1 | -1; - }; - - switch ( intent ) { - case 'write': - return { - ...result, - defaultSelections: [ CATEGORIES.BLOG ], - sort: sortBlogToTop, - }; - case 'sell': - return { - ...result, - defaultSelections: [ CATEGORIES.STORE ], - sort: sortStoreToTop, - }; - case 'build': - return { - ...result, - defaultSelections: [ CATEGORIES.BUSINESS ], - sort: sortBusinessToTop, - }; - default: - return { - ...result, - sort: sortBlogToTop, - }; - } -} - -function getCategorizationFromGoals( +export function getCategorizationOptions( goals: Onboard.SiteGoal[], - isMultiSelection: boolean = false + { isMultiSelection = false }: CategorizationOptions = {} ) { const defaultSelections = Array.from( new Set( diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker.tsx index 59d8ed8564dce..83c0245bbcf63 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/design-setup/unified-design-picker.tsx @@ -116,10 +116,6 @@ const UnifiedDesignPickerStep: Step = ( { navigation, flow, stepName } ) => { const variantName = experimentAssignment?.variationName; const oldHighResImageLoading = ! isLoadingExperiment && variantName === 'treatment'; - const [ isAddedGoalsExpLoading, addedGoalsExpAssignment ] = useExperiment( - 'calypso_onboarding_goals_step_added_goals' - ); - const isGoalsHoldout = useIsGoalsHoldout( stepName ); const isGoalCentricFeature = isEnabled( 'design-picker/goal-centric' ) && ! isGoalsHoldout; @@ -232,8 +228,7 @@ const UnifiedDesignPickerStep: Step = ( { navigation, flow, stepName } ) => { } }, [ hasTrackedView, designs ] ); - const categorizationOptions = getCategorizationOptions( intent, goals, { - useGoals: addedGoalsExpAssignment?.variationName === 'treatment', + const categorizationOptions = getCategorizationOptions( goals, { isMultiSelection: isGoalCentricFeature, } ); const categorization = useCategorization( allDesigns?.filters?.subject || EMPTY_OBJECT, { @@ -812,7 +807,7 @@ const UnifiedDesignPickerStep: Step = ( { navigation, flow, stepName } ) => { // ********** Main render logic // Don't render until we've done fetching all the data needed for initial render. - if ( ! site || isLoadingDesigns || isAddedGoalsExpLoading ) { + if ( ! site || isLoadingDesigns ) { return ; } diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/goals/goals.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/goals/goals.tsx index 34b8006473900..0b7924754c601 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/goals/goals.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/goals/goals.tsx @@ -1,5 +1,4 @@ import { Onboard } from '@automattic/data-stores'; -import { useLocale, isLocaleRtl } from '@automattic/i18n-utils'; import { useTranslate } from 'i18n-calypso'; import { useMemo } from 'react'; import { loadExperimentAssignment } from 'calypso/lib/explat'; @@ -8,13 +7,12 @@ import type { Goal } from './types'; const SiteGoal = Onboard.SiteGoal; -export const useGoals = ( isAddedGoalsExp: boolean ): Goal[] => { +export const useGoals = (): Goal[] => { loadExperimentAssignment( 'calypso_design_picker_image_optimization_202406' ); // Temporary for A/B test. const translate = useTranslate(); - const locale = useLocale(); - const addedGoalsExpResult = useMemo( () => { + return useMemo( () => { const goals = [ { key: SiteGoal.Write, @@ -76,48 +74,4 @@ export const useGoals = ( isAddedGoalsExp: boolean ): Goal[] => { return shuffleArray( goals ); }, [ translate ] ); - - const goals = [ - { - key: SiteGoal.Write, - title: translate( 'Write & Publish' ), - }, - { - key: SiteGoal.Sell, - title: translate( 'Sell online' ), - }, - { - key: SiteGoal.Promote, - title: translate( 'Promote myself or business' ), - }, - { - key: SiteGoal.DIFM, - title: translate( 'Let us build your site in 4 days' ), - isPremium: true, - }, - { - key: SiteGoal.Import, - title: translate( 'Import existing content or website' ), - }, - { - key: SiteGoal.Other, - title: translate( 'Other' ), - }, - ]; - - /** - * Hides the DIFM goal for RTL locales. - */ - const hideDIFMGoalForUnsupportedLocales = ( { key }: Goal ) => { - if ( key === SiteGoal.DIFM && isLocaleRtl( locale ) ) { - return false; - } - return true; - }; - - if ( isAddedGoalsExp ) { - return addedGoalsExpResult; - } - - return goals.filter( hideDIFMGoalForUnsupportedLocales ); }; diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/goals/index.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/goals/index.tsx index e539a8bb60183..b997c7a744bd7 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/goals/index.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/goals/index.tsx @@ -8,7 +8,6 @@ import DocumentHead from 'calypso/components/data/document-head'; import { isGoalsBigSkyEligible } from 'calypso/landing/stepper/hooks/use-is-site-big-sky-eligible'; import { ONBOARD_STORE } from 'calypso/landing/stepper/stores'; import { recordTracksEvent } from 'calypso/lib/analytics/tracks'; -import { useExperiment } from 'calypso/lib/explat'; import { getQueryArgs } from 'calypso/lib/query-args'; import DashboardIcon from './dashboard-icon'; import { GoalsCaptureContainer } from './goals-capture-container'; @@ -44,18 +43,11 @@ const refGoals: Record< string, Onboard.SiteGoal[] > = { * The goals capture step */ const GoalsStep: Step = ( { navigation } ) => { - const [ isAddedGoalsExpLoading, addedGoalsExpAssignment ] = useExperiment( - 'calypso_onboarding_goals_step_added_goals' - ); - const isAddedGoalsExp = addedGoalsExpAssignment?.variationName === 'treatment'; - const translate = useTranslate(); - const whatAreYourGoalsText = isAddedGoalsExp - ? translate( 'What would you like to do?' ) - : translate( 'What are your goals?' ); - const subHeaderText = isAddedGoalsExp - ? translate( 'Pick one or more goals and we’ll tailor the setup experience for you.' ) - : translate( 'Tell us what would you like to accomplish with your website.' ); + const whatAreYourGoalsText = translate( 'What would you like to do?' ); + const subHeaderText = translate( + 'Pick one or more goals and we’ll tailor the setup experience for you.' + ); const goals = useSelect( ( select ) => ( select( ONBOARD_STORE ) as OnboardSelect ).getGoals(), @@ -161,10 +153,6 @@ const GoalsStep: Step = ( { navigation } ) => { const isMediumOrBiggerScreen = useViewportMatch( 'small', '>=' ); - if ( isAddedGoalsExpLoading ) { - return null; - } - return ( <> @@ -173,18 +161,14 @@ const GoalsStep: Step = ( { navigation } ) => { whatAreYourGoalsText={ whatAreYourGoalsText } subHeaderText={ subHeaderText } stepName="goals-step" - onSkip={ isAddedGoalsExp ? handleSkip : handleDashboardClick } + onSkip={ handleSkip } goNext={ handleNext } nextLabelText={ translate( 'Next' ) } - skipLabelText={ isAddedGoalsExp ? translate( 'Skip' ) : translate( 'Skip to dashboard' ) } + skipLabelText={ translate( 'Skip' ) } recordTracksEvent={ recordTracksEvent } stepContent={ <> - + { isMediumOrBiggerScreen && ( ) } - { isAddedGoalsExp && ( -
- - - - -
- ) } +
+ + + + +
} /> diff --git a/client/landing/stepper/declarative-flow/internals/steps-repository/goals/select-goals.tsx b/client/landing/stepper/declarative-flow/internals/steps-repository/goals/select-goals.tsx index 1a75423881915..b787f745139b8 100644 --- a/client/landing/stepper/declarative-flow/internals/steps-repository/goals/select-goals.tsx +++ b/client/landing/stepper/declarative-flow/internals/steps-repository/goals/select-goals.tsx @@ -2,13 +2,11 @@ import { PremiumBadge } from '@automattic/components'; import { Onboard } from '@automattic/data-stores'; import { SelectCardCheckbox } from '@automattic/onboarding'; import styled from '@emotion/styled'; -import { useTranslate } from 'i18n-calypso'; import { useGoals } from './goals'; type SelectGoalsProps = { onChange: ( selectedGoals: Onboard.SiteGoal[] ) => void; selectedGoals: Onboard.SiteGoal[]; - isAddedGoalsExp: boolean; }; const Placeholder = styled.div` @@ -33,9 +31,8 @@ const Placeholder = styled.div` const SiteGoal = Onboard.SiteGoal; -export const SelectGoals = ( { onChange, selectedGoals, isAddedGoalsExp }: SelectGoalsProps ) => { - const translate = useTranslate(); - const goalOptions = useGoals( isAddedGoalsExp ); +export const SelectGoals = ( { onChange, selectedGoals }: SelectGoalsProps ) => { + const goalOptions = useGoals(); // ******************************************************************************* // **** Experiment skeleton left in for future BBE (Goal) copy change tests **** @@ -69,9 +66,6 @@ export const SelectGoals = ( { onChange, selectedGoals, isAddedGoalsExp }: Selec return ( <>
- { ! isAddedGoalsExp && ( -
{ translate( 'Select all that apply' ) }
- ) } { /* We only need to show the goal loader only if the BBE goal will be displayed */ } { hasBuiltByExpressGoal && isBuiltByExpressExperimentLoading ? goalOptions.map( ( { key } ) => (