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

Reinstate: Signup: Free trials: Only show free trials on signup in the dev environment #1526

Merged
Merged
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
48 changes: 19 additions & 29 deletions client/components/plans/plan-actions/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = React.createClass( {
}

if ( this.props.isInSignup ) {
return this.signUpActions();
return config.isEnabled( 'upgrades/free-trials' ) ? this.freeTrialActions() : this.upgradeActions();
}

if ( this.siteHasThisPlan() ) {
Expand All @@ -53,10 +53,25 @@ module.exports = React.createClass( {

const canStartTrial = config.isEnabled( 'upgrades/free-trials' ) ? this.props.siteSpecificPlansDetails.can_start_trial : false;

return canStartTrial ? this.newPlanActions() : this.upgradeActions();
return canStartTrial ? this.freeTrialActions() : this.upgradeActions();
},

freePlanButton: function() {
return (
<div>
<button className="button is-primary plan-actions__upgrade-button"
onClick={ this.handleAddToCart.bind( null, null, 'button' ) }>
{ this.translate( 'Select Free Plan' ) }
</button>
</div>
);
},

upgradeActions: function() {
if ( isFreePlan( this.props.plan ) ) {
return this.freePlanButton();
}

return (
<div>
<button className="button is-primary plan-actions__upgrade-button"
Expand Down Expand Up @@ -147,34 +162,9 @@ module.exports = React.createClass( {
);
},

signUpActions: function() {
freeTrialActions: function() {
if ( isFreePlan( this.props.plan ) ) {
return <div>
<button className="button is-primary plan-actions__upgrade-button"
onClick={ this.handleAddToCart.bind( null, null, 'button' ) }>
{ this.translate( 'Select Free Plan' ) }
</button>
</div>;
}

return (
<div>
<button className="button is-primary plan-actions__upgrade-button"
onClick={ this.handleAddToCart.bind( null, this.cartItem( { isFreeTrial: false } ), 'button' ) }>
{ this.translate( 'Upgrade Now', { context: 'Store action' } ) }
</button>
</div>
);
},

newPlanActions: function() {
if ( isFreePlan( this.props.plan ) ) {
return <div>
<button className="button is-primary plan-actions__upgrade-button"
onClick={ this.handleAddToCart.bind( null, null, 'button' ) }>
{ this.translate( 'Select Free Plan' ) }
</button>
</div>;
return this.freePlanButton();
}

return (
Expand Down