From 2537c2d5095c9b5f70814ec6e413babc1f24b510 Mon Sep 17 00:00:00 2001 From: johnHackworth Date: Thu, 2 Mar 2017 11:08:01 +0100 Subject: [PATCH 1/5] Jetpack: abtest -> remove monthly plans --- client/lib/abtest/active-tests.js | 21 +++++++++++---------- client/my-sites/plan-features/header.jsx | 13 ++++++++----- client/my-sites/plan-features/index.jsx | 7 ++++++- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/client/lib/abtest/active-tests.js b/client/lib/abtest/active-tests.js index 304b57a598d1b6..0329d1a229e79a 100644 --- a/client/lib/abtest/active-tests.js +++ b/client/lib/abtest/active-tests.js @@ -74,16 +74,6 @@ module.exports = { allowExistingUsers: false }, - jetpackConnectPlansFirst: { - datestamp: '20161024', - variations: { - showPlansBeforeAuth: 50, - showPlansAfterAuth: 50 - }, - defaultVariation: 'showPlansAfterAuth', - allowExistingUsers: true - }, - siteTitleTour: { datestamp: '20161207', variations: { @@ -113,4 +103,15 @@ module.exports = { defaultVariation: 'withoutMarketingCopy', allowExistingUsers: true }, + + jetpackPlansNoMonthly: { + datestamp: '20170302', + variations: { + showMonthy: 50, + hideMonthly: 50 + }, + defaultVariation: 'showMonthy', + allowExistingUsers: true + }, + }; diff --git a/client/my-sites/plan-features/header.jsx b/client/my-sites/plan-features/header.jsx index 7743a390754e89..ec510b2c061ce2 100644 --- a/client/my-sites/plan-features/header.jsx +++ b/client/my-sites/plan-features/header.jsx @@ -73,12 +73,14 @@ class PlanFeaturesHeader extends Component { getBillingTimeframe() { const { + hideMonthly, billingTimeFrame, discountPrice, isPlaceholder, site, translate, - isSiteAT + isSiteAT, + currentSitePlan } = this.props; const isDiscounted = !! discountPrice; @@ -90,7 +92,8 @@ class PlanFeaturesHeader extends Component { if ( isSiteAT || ! site.jetpack || - this.props.planType === PLAN_JETPACK_FREE + this.props.planType === PLAN_JETPACK_FREE || + ( hideMonthly && ( ! currentSitePlan || currentSitePlan.productSlug === PLAN_JETPACK_FREE ) ) ) { return (

@@ -165,6 +168,7 @@ class PlanFeaturesHeader extends Component { getPlanFeaturesPrices() { const { + hideMonthly, currencyCode, discountPrice, rawPrice, @@ -185,7 +189,7 @@ class PlanFeaturesHeader extends Component { ); } - if ( discountPrice ) { + if ( discountPrice && ! hideMonthly ) { return ( @@ -194,7 +198,7 @@ class PlanFeaturesHeader extends Component { ); } - if ( relatedMonthlyPlan ) { + if ( relatedMonthlyPlan && ! hideMonthly ) { const originalPrice = relatedMonthlyPlan.raw_price * 12; return ( @@ -260,7 +264,6 @@ export default connect( ( state, ownProps ) => { const { isInSignup } = ownProps; const selectedSiteId = isInSignup ? null : getSelectedSiteId( state ); const currentSitePlan = getCurrentPlan( state, selectedSiteId ); - return Object.assign( {}, ownProps, { diff --git a/client/my-sites/plan-features/index.jsx b/client/my-sites/plan-features/index.jsx index fa94ccb35a0ddb..7acac755321cb8 100644 --- a/client/my-sites/plan-features/index.jsx +++ b/client/my-sites/plan-features/index.jsx @@ -157,6 +157,7 @@ class PlanFeatures extends Component { intervalType={ intervalType } site={ site } basePlansPath={ basePlansPath } + hideMonthly={ abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' } relatedMonthlyPlan={ relatedMonthlyPlan } />

@@ -225,6 +226,7 @@ class PlanFeatures extends Component { site={ site } basePlansPath={ basePlansPath } relatedMonthlyPlan={ relatedMonthlyPlan } + hideMonthly={ abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' } /> ); @@ -467,6 +469,9 @@ export default connect( const popular = isPopular( plan ) && ! isPaid; const newPlan = isNew( plan ) && ! isPaid; const currentPlan = sitePlan && sitePlan.product_slug; + const showMonthyPrice = abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' + ? true + : ! relatedMonthlyPlan && showMonthly; if ( placeholder || ! planObject || isLoadingSitePlans ) { isPlaceholder = true; @@ -505,7 +510,7 @@ export default connect( popular, newPlan ), - rawPrice: getPlanRawPrice( state, planProductId, ! relatedMonthlyPlan && showMonthly ), + rawPrice: getPlanRawPrice( state, planProductId, showMonthyPrice ), relatedMonthlyPlan: relatedMonthlyPlan }; } ) From d2e123648f12cf3c065903c9e07c0ea2a59edf14 Mon Sep 17 00:00:00 2001 From: johnHackworth Date: Thu, 2 Mar 2017 11:43:12 +0100 Subject: [PATCH 2/5] Jetpack: Monthly plans removal test -> add the discounted price --- client/my-sites/plan-features/header.jsx | 3 +-- client/my-sites/plan-features/index.jsx | 24 ++++++++++++++++++------ client/state/sites/plans/selectors.js | 1 - 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/client/my-sites/plan-features/header.jsx b/client/my-sites/plan-features/header.jsx index ec510b2c061ce2..7848010eb8ac11 100644 --- a/client/my-sites/plan-features/header.jsx +++ b/client/my-sites/plan-features/header.jsx @@ -188,8 +188,7 @@ class PlanFeaturesHeader extends Component {

); } - - if ( discountPrice && ! hideMonthly ) { + if ( discountPrice ) { return ( diff --git a/client/my-sites/plan-features/index.jsx b/client/my-sites/plan-features/index.jsx index 7acac755321cb8..e094bd0ed14f46 100644 --- a/client/my-sites/plan-features/index.jsx +++ b/client/my-sites/plan-features/index.jsx @@ -129,18 +129,20 @@ class PlanFeatures extends Component { currencyCode, current, features, - discountPrice, onUpgradeClick, planConstantObj, planName, popular, newPlan, - rawPrice, relatedMonthlyPlan, primaryUpgrade, isPlaceholder } = properties; - + let { rawPrice, discountPrice } = properties; + if ( abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && relatedMonthlyPlan && relatedMonthlyPlan.raw_price ) { + discountPrice = rawPrice; + rawPrice = relatedMonthlyPlan.raw_price; + } return (
{ diff --git a/client/state/sites/plans/selectors.js b/client/state/sites/plans/selectors.js index dcdbb941c595f1..e909749dd1ecd2 100644 --- a/client/state/sites/plans/selectors.js +++ b/client/state/sites/plans/selectors.js @@ -111,7 +111,6 @@ export function getPlanDiscountedRawPrice( if ( get( plan, 'rawPrice', -1 ) < 0 || ! isSitePlanDiscounted( state, siteId, productSlug ) ) { return null; } - const discountPrice = plan.rawPrice; return isMonthly ? parseFloat( ( discountPrice / 12 ).toFixed( 2 ) ) : discountPrice; From 7fe4d5da870a4a5c3dad094af02aef0bdc259248 Mon Sep 17 00:00:00 2001 From: johnHackworth Date: Thu, 2 Mar 2017 12:33:12 +0100 Subject: [PATCH 3/5] Jetpack: monthly plans test -> avoid applying it to users who already have a plan --- client/my-sites/plan-features/index.jsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/client/my-sites/plan-features/index.jsx b/client/my-sites/plan-features/index.jsx index e094bd0ed14f46..2c872ec96300ef 100644 --- a/client/my-sites/plan-features/index.jsx +++ b/client/my-sites/plan-features/index.jsx @@ -106,7 +106,7 @@ class PlanFeatures extends Component { renderMobileView() { const { - canPurchase, translate, planProperties, isInSignup, isLandingPage, intervalType, site, basePlansPath + isCurrentPlanPaid, canPurchase, translate, planProperties, isInSignup, isLandingPage, intervalType, site, basePlansPath } = this.props; // move any free plan to last place in mobile view @@ -139,7 +139,7 @@ class PlanFeatures extends Component { isPlaceholder } = properties; let { rawPrice, discountPrice } = properties; - if ( abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && relatedMonthlyPlan && relatedMonthlyPlan.raw_price ) { + if ( abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isCurrentPlanPaid && relatedMonthlyPlan && relatedMonthlyPlan.raw_price ) { discountPrice = rawPrice; rawPrice = relatedMonthlyPlan.raw_price; } @@ -159,7 +159,7 @@ class PlanFeatures extends Component { intervalType={ intervalType } site={ site } basePlansPath={ basePlansPath } - hideMonthly={ abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' } + hideMonthly={ abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isCurrentPlanPaid } relatedMonthlyPlan={ relatedMonthlyPlan } />

@@ -195,7 +195,7 @@ class PlanFeatures extends Component { } renderPlanHeaders() { - const { planProperties, intervalType, site, basePlansPath } = this.props; + const { isCurrentPlanPaid, planProperties, intervalType, site, basePlansPath } = this.props; return map( planProperties, ( properties ) => { const { @@ -210,7 +210,7 @@ class PlanFeatures extends Component { } = properties; let { rawPrice, discountPrice } = properties; const classes = classNames( 'plan-features__table-item', 'has-border-top' ); - if ( abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && relatedMonthlyPlan && relatedMonthlyPlan.raw_price ) { + if ( abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isCurrentPlanPaid && relatedMonthlyPlan && relatedMonthlyPlan.raw_price ) { discountPrice = rawPrice; rawPrice = relatedMonthlyPlan.raw_price; } @@ -231,7 +231,7 @@ class PlanFeatures extends Component { site={ site } basePlansPath={ basePlansPath } relatedMonthlyPlan={ relatedMonthlyPlan } - hideMonthly={ abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' } + hideMonthly={ abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isCurrentPlanPaid } /> ); @@ -474,7 +474,7 @@ export default connect( const popular = isPopular( plan ) && ! isPaid; const newPlan = isNew( plan ) && ! isPaid; const currentPlan = sitePlan && sitePlan.product_slug; - const showMonthyPrice = abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' + const showMonthyPrice = abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isPaid ? true : ! relatedMonthlyPlan && showMonthly; @@ -492,7 +492,7 @@ export default connect( selectedSiteId, plan, { - isMonthly: abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' + isMonthly: abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isPaid ? true : showMonthly } ), @@ -530,7 +530,8 @@ export default connect( return { canPurchase, - planProperties: planProperties + planProperties: planProperties, + isCurrentPlanPaid: isPaid }; }, { From ec60901a91171ad993e889b3345221ccc50ce3be Mon Sep 17 00:00:00 2001 From: johnHackworth Date: Mon, 6 Mar 2017 12:46:09 +0100 Subject: [PATCH 4/5] Jetpack: Fix typo --- client/lib/abtest/active-tests.js | 4 ++-- client/my-sites/plan-features/index.jsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/lib/abtest/active-tests.js b/client/lib/abtest/active-tests.js index 0329d1a229e79a..0400935114c968 100644 --- a/client/lib/abtest/active-tests.js +++ b/client/lib/abtest/active-tests.js @@ -107,10 +107,10 @@ module.exports = { jetpackPlansNoMonthly: { datestamp: '20170302', variations: { - showMonthy: 50, + showMonthly: 50, hideMonthly: 50 }, - defaultVariation: 'showMonthy', + defaultVariation: 'showMonthly', allowExistingUsers: true }, diff --git a/client/my-sites/plan-features/index.jsx b/client/my-sites/plan-features/index.jsx index 2c872ec96300ef..feb17109ff11b2 100644 --- a/client/my-sites/plan-features/index.jsx +++ b/client/my-sites/plan-features/index.jsx @@ -474,7 +474,7 @@ export default connect( const popular = isPopular( plan ) && ! isPaid; const newPlan = isNew( plan ) && ! isPaid; const currentPlan = sitePlan && sitePlan.product_slug; - const showMonthyPrice = abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isPaid + const showMonthlyPrice = abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isPaid ? true : ! relatedMonthlyPlan && showMonthly; @@ -522,7 +522,7 @@ export default connect( popular, newPlan ), - rawPrice: getPlanRawPrice( state, planProductId, showMonthyPrice ), + rawPrice: getPlanRawPrice( state, planProductId, showMonthlyPrice ), relatedMonthlyPlan: relatedMonthlyPlan }; } ) From 42bb559f696979a6f635ac9414a2d8d078e8e797 Mon Sep 17 00:00:00 2001 From: johnHackworth Date: Mon, 6 Mar 2017 13:45:02 +0100 Subject: [PATCH 5/5] Jetpack plans: Make the /monthly path return the same data than the yearly one in the no-monthly side of the test --- client/lib/plans/index.js | 3 ++- client/my-sites/plan-features/index.jsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/lib/plans/index.js b/client/lib/plans/index.js index 970aa8075db6c8..e85ad2c601f61f 100644 --- a/client/lib/plans/index.js +++ b/client/lib/plans/index.js @@ -26,6 +26,7 @@ import { PLAN_PERSONAL } from 'lib/plans/constants'; import SitesList from 'lib/sites-list'; +import { abtest } from 'lib/abtest'; /** * Module vars @@ -134,7 +135,7 @@ export function filterPlansBySiteAndProps( plans, site, hideFreePlan, intervalTy return plans.filter( function( plan ) { if ( site && site.jetpack ) { - if ( 'monthly' === intervalType ) { + if ( 'monthly' === intervalType && abtest( 'jetpackPlansNoMonthly' ) !== 'hideMonthly' ) { if ( showJetpackFreePlan ) { return isJetpackPlan( plan ) && isMonthly( plan ); } diff --git a/client/my-sites/plan-features/index.jsx b/client/my-sites/plan-features/index.jsx index feb17109ff11b2..4b0a70c905cc18 100644 --- a/client/my-sites/plan-features/index.jsx +++ b/client/my-sites/plan-features/index.jsx @@ -475,7 +475,7 @@ export default connect( const newPlan = isNew( plan ) && ! isPaid; const currentPlan = sitePlan && sitePlan.product_slug; const showMonthlyPrice = abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isPaid - ? true + ? showMonthly : ! relatedMonthlyPlan && showMonthly; if ( placeholder || ! planObject || isLoadingSitePlans ) {