From d9abc67b054c4a721dfb63faeefdcbfe65453566 Mon Sep 17 00:00:00 2001 From: robertsreberski Date: Mon, 26 Aug 2024 12:38:03 +0200 Subject: [PATCH 1/3] Don't consider user lifecycle status when repeating evaluation --- .../_inc/components/welcome-flow/index.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx b/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx index 94719828bcb2e..0d13696ede185 100644 --- a/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx +++ b/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx @@ -23,7 +23,8 @@ export type WelcomeFlowExperiment = { const WelcomeFlow: FC< PropsWithChildren > = ( { children } ) => { const { recordEvent } = useAnalytics(); const { dismissWelcomeBanner } = useWelcomeBanner(); - const { submitEvaluation, saveEvaluationResult } = useEvaluationRecommendations(); + const { recommendedModules, submitEvaluation, saveEvaluationResult } = + useEvaluationRecommendations(); const { siteIsRegistered, siteIsRegistering, @@ -44,15 +45,26 @@ const WelcomeFlow: FC< PropsWithChildren > = ( { children } ) => { if ( ! siteIsRegistered || welcomeFlowExperiment.isLoading ) { return 'connection'; } else if ( ! isProcessingEvaluation ) { - if ( ! isJetpackUserNew() || welcomeFlowExperiment.variation !== 'treatment' ) { - // If the user is not new, we don't show the evaluation step + if ( welcomeFlowExperiment.variation === 'control' ) { return null; } + if ( ! recommendedModules && ! isJetpackUserNew() ) { + // If user is not new but doesn't have recommendations, we skip evaluation + return null; + } + + // Otherwise, it means user is either new or just repeats the recommendation return 'evaluation'; } return 'evaluation-processing'; - }, [ isProcessingEvaluation, siteIsRegistered, welcomeFlowExperiment ] ); + }, [ + isProcessingEvaluation, + recommendedModules, + siteIsRegistered, + welcomeFlowExperiment.isLoading, + welcomeFlowExperiment.variation, + ] ); useEffect( () => { if ( prevStep !== currentStep ) { From 20729fbed8ebb80c286c2aad2adaa37115ff21d2 Mon Sep 17 00:00:00 2001 From: robertsreberski Date: Mon, 26 Aug 2024 12:38:46 +0200 Subject: [PATCH 2/3] changelog --- projects/packages/my-jetpack/changelog/fix-welcome-flow-redo | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/packages/my-jetpack/changelog/fix-welcome-flow-redo diff --git a/projects/packages/my-jetpack/changelog/fix-welcome-flow-redo b/projects/packages/my-jetpack/changelog/fix-welcome-flow-redo new file mode 100644 index 0000000000000..82e0ddf5687a7 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/fix-welcome-flow-redo @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Don't consider user lifecycle status when repeating evaluation From bd0ca0651797ef31baf2bbc1741a5364118f9beb Mon Sep 17 00:00:00 2001 From: robertsreberski Date: Wed, 28 Aug 2024 17:30:21 +0200 Subject: [PATCH 3/3] Improve conditions to assume user is in treatment group when having recommendations --- .../my-jetpack/_inc/components/welcome-flow/index.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx b/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx index 0d13696ede185..deb312653e88f 100644 --- a/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx +++ b/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx @@ -45,11 +45,12 @@ const WelcomeFlow: FC< PropsWithChildren > = ( { children } ) => { if ( ! siteIsRegistered || welcomeFlowExperiment.isLoading ) { return 'connection'; } else if ( ! isProcessingEvaluation ) { - if ( welcomeFlowExperiment.variation === 'control' ) { - return null; - } - if ( ! recommendedModules && ! isJetpackUserNew() ) { + if ( + ! recommendedModules && + ( welcomeFlowExperiment.variation === 'control' || ! isJetpackUserNew() ) + ) { // If user is not new but doesn't have recommendations, we skip evaluation + // If user has recommendations, it means they were already in treatment group and they redo the evaluation return null; }