Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetpack: monthly plans test #11704

Merged
merged 5 commits into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions client/lib/abtest/active-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,6 @@ module.exports = {
allowExistingUsers: false
},

jetpackConnectPlansFirst: {
datestamp: '20161024',
variations: {
showPlansBeforeAuth: 50,
showPlansAfterAuth: 50
},
defaultVariation: 'showPlansAfterAuth',
allowExistingUsers: true
},

siteTitleTour: {
datestamp: '20161207',
variations: {
Expand Down Expand Up @@ -113,4 +103,15 @@ module.exports = {
defaultVariation: 'withoutMarketingCopy',
allowExistingUsers: true
},

jetpackPlansNoMonthly: {
datestamp: '20170302',
variations: {
showMonthly: 50,
hideMonthly: 50
},
defaultVariation: 'showMonthly',
allowExistingUsers: true
},

};
3 changes: 2 additions & 1 deletion client/lib/plans/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
PLAN_PERSONAL
} from 'lib/plans/constants';
import SitesList from 'lib/sites-list';
import { abtest } from 'lib/abtest';

/**
* Module vars
Expand Down Expand Up @@ -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 );
}
Expand Down
12 changes: 7 additions & 5 deletions client/my-sites/plan-features/header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ class PlanFeaturesHeader extends Component {

getBillingTimeframe() {
const {
hideMonthly,
billingTimeFrame,
discountPrice,
isPlaceholder,
site,
translate,
isSiteAT
isSiteAT,
currentSitePlan
} = this.props;

const isDiscounted = !! discountPrice;
Expand All @@ -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 (
<p className={ timeframeClasses }>
Expand Down Expand Up @@ -165,6 +168,7 @@ class PlanFeaturesHeader extends Component {

getPlanFeaturesPrices() {
const {
hideMonthly,
currencyCode,
discountPrice,
rawPrice,
Expand All @@ -184,7 +188,6 @@ class PlanFeaturesHeader extends Component {
<div className={ classes } ></div>
);
}

if ( discountPrice ) {
return (
<span className="plan-features__header-price-group">
Expand All @@ -194,7 +197,7 @@ class PlanFeaturesHeader extends Component {
);
}

if ( relatedMonthlyPlan ) {
if ( relatedMonthlyPlan && ! hideMonthly ) {
const originalPrice = relatedMonthlyPlan.raw_price * 12;
return (
<span className="plan-features__header-price-group">
Expand Down Expand Up @@ -260,7 +263,6 @@ export default connect( ( state, ownProps ) => {
const { isInSignup } = ownProps;
const selectedSiteId = isInSignup ? null : getSelectedSiteId( state );
const currentSitePlan = getCurrentPlan( state, selectedSiteId );

return Object.assign( {},
ownProps,
{
Expand Down
38 changes: 28 additions & 10 deletions client/my-sites/plan-features/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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' && ! isCurrentPlanPaid && relatedMonthlyPlan && relatedMonthlyPlan.raw_price ) {
discountPrice = rawPrice;
rawPrice = relatedMonthlyPlan.raw_price;
}
return (
<div className="plan-features__mobile-plan" key={ planName }>
<PlanFeaturesHeader
Expand All @@ -157,6 +159,7 @@ class PlanFeatures extends Component {
intervalType={ intervalType }
site={ site }
basePlansPath={ basePlansPath }
hideMonthly={ abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isCurrentPlanPaid }
relatedMonthlyPlan={ relatedMonthlyPlan }
/>
<p className="plan-features__description">
Expand Down Expand Up @@ -192,22 +195,25 @@ 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 {
currencyCode,
current,
discountPrice,
planConstantObj,
planName,
popular,
newPlan,
rawPrice,
relatedMonthlyPlan,
isPlaceholder
} = properties;
let { rawPrice, discountPrice } = properties;
const classes = classNames( 'plan-features__table-item', 'has-border-top' );
if ( abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isCurrentPlanPaid && relatedMonthlyPlan && relatedMonthlyPlan.raw_price ) {
discountPrice = rawPrice;
rawPrice = relatedMonthlyPlan.raw_price;
}
return (
<td key={ planName } className={ classes }>
<PlanFeaturesHeader
Expand All @@ -225,6 +231,7 @@ class PlanFeatures extends Component {
site={ site }
basePlansPath={ basePlansPath }
relatedMonthlyPlan={ relatedMonthlyPlan }
hideMonthly={ abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isCurrentPlanPaid }
/>
</td>
);
Expand Down Expand Up @@ -467,6 +474,9 @@ export default connect(
const popular = isPopular( plan ) && ! isPaid;
const newPlan = isNew( plan ) && ! isPaid;
const currentPlan = sitePlan && sitePlan.product_slug;
const showMonthlyPrice = abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isPaid
? showMonthly
: ! relatedMonthlyPlan && showMonthly;

if ( placeholder || ! planObject || isLoadingSitePlans ) {
isPlaceholder = true;
Expand All @@ -478,7 +488,14 @@ export default connect(
available: available,
currencyCode: getCurrentUserCurrencyCode( state ),
current: isCurrentSitePlan( state, selectedSiteId, planProductId ),
discountPrice: getPlanDiscountedRawPrice( state, selectedSiteId, plan, { isMonthly: showMonthly } ),
discountPrice: getPlanDiscountedRawPrice( state,
selectedSiteId,
plan,
{
isMonthly: abtest( 'jetpackPlansNoMonthly' ) === 'hideMonthly' && ! isPaid
? true
: showMonthly
} ),
features: getPlanFeaturesObject( planConstantObj.getFeatures( abtest ) ),
onUpgradeClick: onUpgradeClick
? () => {
Expand All @@ -505,15 +522,16 @@ export default connect(
popular,
newPlan
),
rawPrice: getPlanRawPrice( state, planProductId, ! relatedMonthlyPlan && showMonthly ),
rawPrice: getPlanRawPrice( state, planProductId, showMonthlyPrice ),
relatedMonthlyPlan: relatedMonthlyPlan
};
} )
);

return {
canPurchase,
planProperties: planProperties
planProperties: planProperties,
isCurrentPlanPaid: isPaid
};
},
{
Expand Down
1 change: 0 additions & 1 deletion client/state/sites/plans/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down