From cd1dedf3a8b6394893399c6cfc6060c90378e857 Mon Sep 17 00:00:00 2001
From: Ian Ramos <5714212+IanRamosC@users.noreply.github.com>
Date: Tue, 29 Oct 2024 17:20:45 -0300
Subject: [PATCH] My Jetpack: post experiment clean up (#39928)
* Chore: post-ab test cleanup
* changelog
* Remove condition for experiment
---
.../evaluation-recommendations/index.tsx | 91 +++----------------
.../components/my-jetpack-screen/index.jsx | 6 +-
.../_inc/components/welcome-flow/index.tsx | 50 +---------
.../remove-my-jetpack-ab-test-cleanup | 4 +
4 files changed, 22 insertions(+), 129 deletions(-)
create mode 100644 projects/packages/my-jetpack/changelog/remove-my-jetpack-ab-test-cleanup
diff --git a/projects/packages/my-jetpack/_inc/components/evaluation-recommendations/index.tsx b/projects/packages/my-jetpack/_inc/components/evaluation-recommendations/index.tsx
index b9e2a3eada598..ed5625662be1e 100644
--- a/projects/packages/my-jetpack/_inc/components/evaluation-recommendations/index.tsx
+++ b/projects/packages/my-jetpack/_inc/components/evaluation-recommendations/index.tsx
@@ -1,30 +1,18 @@
import { Container, Col, Text } from '@automattic/jetpack-components';
-import { Flex, FlexItem, DropdownMenu, Button } from '@wordpress/components';
-import { createInterpolateElement } from '@wordpress/element';
+import { Flex, FlexItem, DropdownMenu } from '@wordpress/components';
import { __, _n } from '@wordpress/i18n';
import { moreHorizontalMobile } from '@wordpress/icons';
-import { useEffect, useCallback } from 'react';
+import { useEffect } from 'react';
import useEvaluationRecommendations from '../../data/evaluation-recommendations/use-evaluation-recommendations';
import useAnalytics from '../../hooks/use-analytics';
-import getPurchasePlanUrl from '../../utils/get-purchase-plan-url';
import { JetpackModuleToProductCard } from '../product-cards-section/all';
import styles from './style.module.scss';
-import type { WelcomeFlowExperiment } from '../welcome-flow';
import type { FC } from 'react';
-interface Props {
- welcomeFlowExperimentVariation: WelcomeFlowExperiment[ 'variation' ];
-}
-
-const EvaluationRecommendations: FC< Props > = ( { welcomeFlowExperimentVariation } ) => {
+const EvaluationRecommendations: FC = () => {
const { recordEvent } = useAnalytics();
- const { recommendedModules, isFirstRun, redoEvaluation, removeEvaluationResult } =
+ const { recommendedModules, redoEvaluation, removeEvaluationResult } =
useEvaluationRecommendations();
- const isTreatmentVariation = welcomeFlowExperimentVariation === 'treatment';
-
- const handleExploreAllPlansLinkClick = useCallback( () => {
- recordEvent( 'jetpack_myjetpack_evaluation_recommendations_explore_all_plans_click' );
- }, [ recordEvent ] );
// We're defining each of these translations in separate variables here, otherwise optimizations in
// the build step end up breaking the translations and causing error.
@@ -34,19 +22,8 @@ const EvaluationRecommendations: FC< Props > = ( { welcomeFlowExperimentVariatio
recommendedModules.length,
'jetpack-my-jetpack'
);
- const recommendationsHeadlineTreatment = __( 'Recommended for your site', 'jetpack-my-jetpack' );
const menuRedoTitle = __( 'Redo', 'jetpack-my-jetpack' );
- const menuRedoTitleTreatment = __( 'Customize recommendations', 'jetpack-my-jetpack' );
const menuDismissTitle = __( 'Dismiss', 'jetpack-my-jetpack' );
- const menuDismissTitleTreatment = __( 'Close', 'jetpack-my-jetpack' );
- const recommendationsRedoLink = __(
- 'Start over? Analyze again for fresh recommendations!',
- 'jetpack-my-jetpack'
- );
- const recommendationsRedoLinkTreatment = __(
- 'Find your perfect match by letting us know what you’re looking for!',
- 'jetpack-my-jetpack'
- );
useEffect( () => {
recordEvent( 'jetpack_myjetpack_evaluation_recommendations_view', {
@@ -60,18 +37,14 @@ const EvaluationRecommendations: FC< Props > = ( { welcomeFlowExperimentVariatio
- { isTreatmentVariation && isFirstRun
- ? recommendationsHeadlineTreatment
- : recommendationsHeadline }
+ { recommendationsHeadline }
+
+
+ { __(
+ 'Here are the tools that we think will help you reach your website goals:',
+ 'jetpack-my-jetpack'
+ ) }
- { ! isTreatmentVariation && (
-
- { __(
- 'Here are the tools that we think will help you reach your website goals:',
- 'jetpack-my-jetpack'
- ) }
-
- ) }
= ( { welcomeFlowExperimentVariatio
label={ __( 'Recommendations menu', 'jetpack-my-jetpack' ) }
controls={ [
{
- title:
- isTreatmentVariation && isFirstRun ? menuRedoTitleTreatment : menuRedoTitle,
+ title: menuRedoTitle,
onClick: redoEvaluation,
},
{
- title:
- isTreatmentVariation && isFirstRun
- ? menuDismissTitleTreatment
- : menuDismissTitle,
+ title: menuDismissTitle,
onClick: removeEvaluationResult,
},
] }
@@ -117,40 +86,6 @@ const EvaluationRecommendations: FC< Props > = ( { welcomeFlowExperimentVariatio
} ) }
- { isTreatmentVariation && (
-
-
-
-
- { createInterpolateElement(
- isFirstRun ? recommendationsRedoLinkTreatment : recommendationsRedoLink,
- {
- link: (
-
- ),
- }
- ) }
-
-
-
-
-
-
-
-
-
- ) }
);
};
diff --git a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx
index edb46dc369200..57cb7b1858d71 100644
--- a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx
+++ b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx
@@ -172,11 +172,7 @@ export default function MyJetpackScreen() {
)
) }
- { ! isWelcomeBannerVisible && isSectionVisible && (
-
- ) }
+ { ! isWelcomeBannerVisible && isSectionVisible && }
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 9d76c4fb31186..430c426c9514d 100644
--- a/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx
+++ b/projects/packages/my-jetpack/_inc/components/welcome-flow/index.tsx
@@ -32,7 +32,7 @@ const WelcomeFlow: FC< Props > = ( {
} ) => {
const { recordEvent } = useAnalytics();
const { dismissWelcomeBanner } = useWelcomeBanner();
- const { recommendedModules, isFirstRun, submitEvaluation, saveEvaluationResult } =
+ const { recommendedModules, submitEvaluation, saveEvaluationResult } =
useEvaluationRecommendations();
const {
siteIsRegistered,
@@ -47,7 +47,7 @@ const WelcomeFlow: FC< Props > = ( {
const [ prevStep, setPrevStep ] = useState( '' );
const currentStep = useMemo( () => {
- if ( ! siteIsRegistered || welcomeFlowExperiment.isLoading ) {
+ if ( ! siteIsRegistered ) {
return 'connection';
} else if ( ! isProcessingEvaluation ) {
if ( ! recommendedModules && ! isJetpackUserNew() ) {
@@ -55,27 +55,13 @@ const WelcomeFlow: FC< Props > = ( {
// If user has recommendations, it means they redo the evaluation
return null;
}
- // For the "treatment" experiment we immediately jump to the 'evaluation-processing' step if
- // there are no `recommendedModules` loaded yet.
- if (
- 'treatment' === welcomeFlowExperiment.variation &&
- ! recommendedModules &&
- isJetpackUserNew()
- ) {
- return 'evaluation-processing';
- }
+
// Otherwise, it means user is either new or just repeats the recommendation
return 'evaluation';
}
return 'evaluation-processing';
- }, [
- isProcessingEvaluation,
- recommendedModules,
- siteIsRegistered,
- welcomeFlowExperiment.isLoading,
- welcomeFlowExperiment.variation,
- ] );
+ }, [ isProcessingEvaluation, recommendedModules, siteIsRegistered ] );
useEffect( () => {
if ( prevStep !== currentStep ) {
@@ -117,34 +103,6 @@ const WelcomeFlow: FC< Props > = ( {
[ dismissWelcomeBanner, recordEvent, saveEvaluationResult, submitEvaluation ]
);
- useEffect( () => {
- // For the "treatment" experiment, when there are no `recommendedModules` loaded yet,
- // we immediately submit some default evaluation data (when we change from connection
- // step to evaluation-processing step).
- if (
- 'treatment' === welcomeFlowExperiment.variation &&
- ! recommendedModules &&
- isFirstRun &&
- prevStep === 'connection' &&
- currentStep === 'evaluation-processing'
- ) {
- handleEvaluation( {
- protect: true,
- performance: true,
- audience: true,
- content: true,
- unsure: false,
- } );
- }
- }, [
- currentStep,
- prevStep,
- recommendedModules,
- welcomeFlowExperiment.variation,
- handleEvaluation,
- isFirstRun,
- ] );
-
useEffect( () => {
if ( ! currentStep ) {
dismissWelcomeBanner();
diff --git a/projects/packages/my-jetpack/changelog/remove-my-jetpack-ab-test-cleanup b/projects/packages/my-jetpack/changelog/remove-my-jetpack-ab-test-cleanup
new file mode 100644
index 0000000000000..ca685feeead4e
--- /dev/null
+++ b/projects/packages/my-jetpack/changelog/remove-my-jetpack-ab-test-cleanup
@@ -0,0 +1,4 @@
+Significance: minor
+Type: removed
+
+My Jetpack: remove A/B test code in My Jetpack