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

IAP: Disable all links & buttons that add upgrade to the cart #2523

Merged
merged 2 commits into from
Jan 19, 2016
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
2 changes: 1 addition & 1 deletion client/me/billing-history/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = React.createClass( {
</Card>
</div> }

{ config.isEnabled( 'me/credit-cards' ) &&
{ config.isEnabled( 'upgrades/credit-cards' ) &&
<CreditCards cards={ storedCards } /> }

</div>
Expand Down
29 changes: 20 additions & 9 deletions client/me/purchases/manage-purchase/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import analytics from 'analytics';
import Button from 'components/button';
import Card from 'components/card';
import { cartItems } from 'lib/cart-values';
import config from 'config';
import { domainManagementEdit } from 'my-sites/upgrades/paths';
import { googleAppsSettingsUrl } from 'lib/google-apps';
import HeaderCake from 'components/header-cake';
Expand Down Expand Up @@ -48,7 +49,7 @@ import { getPurchase, getSelectedSite, goToList, isDataLoading, recordPageView }
import { isDomainProduct, isGoogleApps, isPlan, isSiteRedirect, isTheme } from 'lib/products-values';

function canEditPaymentDetails( purchase ) {
return ! isExpired( purchase ) && ! isOneTimePurchase( purchase ) && ! isIncludedWithPlan( purchase );
return config.isEnabled( 'upgrades/credit-cards' ) && ! isExpired( purchase ) && ! isOneTimePurchase( purchase ) && ! isIncludedWithPlan( purchase );
}

const ManagePurchase = React.createClass( {
Expand Down Expand Up @@ -125,13 +126,23 @@ const ManagePurchase = React.createClass( {
}
}
) }>
<NoticeAction onClick={ this.handleRenew }>
{ this.translate( 'Renew Now' ) }
</NoticeAction>
{ this.renderRenewNoticeAction() }
</Notice>
);
},

renderRenewNoticeAction() {
if ( ! config.isEnabled( 'upgrades/checkout' ) ) {
return null;
}

return (
<NoticeAction onClick={ this.handleRenew }>
{ this.translate( 'Renew Now' ) }
</NoticeAction>
);
},

renderCreditCardExpiringNotice() {
const purchase = getPurchase( this.props ),
{ id, payment: { creditCard } } = purchase;
Expand All @@ -155,7 +166,9 @@ const ManagePurchase = React.createClass( {
cardExpiry: creditCard.expiryMoment.format( 'MMMM YYYY' )
},
components: {
a: <a href={ paths.editCardDetails( this.props.selectedSite.slug, id, creditCard.id ) } />
a: canEditPaymentDetails() ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function throws an error if it isn't passed a purchase object.

<a href={ paths.editCardDetails( this.props.selectedSite.slug, id, creditCard.id ) } /> :
<span />
}
}
)
Expand Down Expand Up @@ -378,7 +391,7 @@ const ManagePurchase = React.createClass( {
renderRenewButton() {
const purchase = getPurchase( this.props );

if ( ! isRenewable( purchase ) || isExpired( purchase ) || isExpiring( purchase ) ) {
if ( ! config.isEnabled( 'upgrades/checkout' ) || ! isRenewable( purchase ) || isExpired( purchase ) || isExpiring( purchase ) ) {
return null;
}

Expand All @@ -403,9 +416,7 @@ const ManagePurchase = React.createClass( {
showDismiss={ false }
status="is-error"
text={ this.translate( 'This purchase has expired and is no longer in use.' ) }>
<NoticeAction onClick={ this.handleRenew }>
{ this.translate( 'Renew Now' ) }
</NoticeAction>
{ this.renderRenewNoticeAction() }
</Notice>
);
},
Expand Down
2 changes: 1 addition & 1 deletion client/my-sites/sidebar/sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ module.exports = React.createClass( {
return null;
}

if ( abtest( 'domainsAddButton' ) === 'button' ) {
if ( config.isEnabled( 'upgrades/domain-search' ) && abtest( 'domainsAddButton' ) === 'button' ) {
addDomainButton = <a onClick={ this.onNavigate } href={ addDomainLink } className="add-new">{ this.translate( 'Add' ) }</a>;
}

Expand Down
5 changes: 1 addition & 4 deletions client/my-sites/site-settings/delete-site-options/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ module.exports = React.createClass( {
changeAddressLink = '/domains/manage/' + selectedSite.slug,
startOverLink = '/settings/start-over/' + selectedSite.slug,
deleteSiteLink = '/settings/delete-site/' + selectedSite.slug,
changeAddressLinkExternal = false,
changeAddressLinkText = this.translate( 'Register a new domain or change your site\'s address.' ),
strings, dialogButtons;

Expand All @@ -73,8 +72,6 @@ module.exports = React.createClass( {
}

if ( ! config.isEnabled( 'upgrades/domain-search' ) ) {
changeAddressLink = `https://${ selectedSite.domain }/wp-admin/index.php?page=my-blogs#blog_row_${ selectedSite.ID }`;
changeAddressLinkExternal = true;
changeAddressLinkText = this.translate( 'Change your site\'s address.' );
}

Expand All @@ -87,7 +84,7 @@ module.exports = React.createClass( {

return (
<div className="delete-site-options">
<CompactCard href={ changeAddressLink } className="delete-site-options__link" target={ changeAddressLinkExternal ? '_blank' : null }>
<CompactCard href={ changeAddressLink } className="delete-site-options__link">
<div className="delete-site-options__content">
<h2 className="delete-site-options__section-title">{ strings.changeSiteAddress }</h2>
<p className="delete-site-options__section-desc">{ changeAddressLinkText }</p>
Expand Down
31 changes: 20 additions & 11 deletions client/my-sites/upgrades/domain-management/email/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const React = require( 'react' ),
/**
* Internal dependencies
*/
const Main = require( 'components/main' ),
const config = require( 'config' ),
Main = require( 'components/main' ),
Header = require( 'my-sites/upgrades/domain-management/components/header' ),
SidebarNavigation = require( 'my-sites/sidebar-navigation' ),
AddGoogleAppsCard = require( './add-google-apps-card' ),
Expand Down Expand Up @@ -95,17 +96,25 @@ const Email = React.createClass( {
},

emptyContent() {
let props = {
title: this.translate( "You don't have any domains yet." ),
line: this.translate(
'Add a domain to your site to make it easier ' +
'to remember and easier to share, and get access to email ' +
'forwarding, Google Apps for Work, and other email services.'
),
illustration: '/calypso/images/drake/drake-whoops.svg'
};

if ( config.isEnabled( 'upgrades/domain-search' ) ) {
props = Object.assign( props, {
action: this.translate( 'Add a Custom Domain' ),
actionURL: '/domains/add/' + this.props.selectedSite.domain
} );
}

return (
<EmptyContent
title={ this.translate( "You don't have any domains {{em}}yet{{/em}}.", {
components: { em: <em /> }
} ) }
line={ this.translate( 'Add a domain to your site to make it easier ' +
'to remember and easier to share, and get access to email ' +
'forwarding, Google Apps for Work, and other email services.' ) }
action={ this.translate( 'Add a Custom Domain' ) }
actionURL={ '/domains/add/' + this.props.selectedSite.domain }
illustration="/calypso/images/drake/drake-whoops.svg" />
<EmptyContent { ...props } />
);
},

Expand Down
5 changes: 5 additions & 0 deletions client/my-sites/upgrades/domain-management/list/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import times from 'lodash/utility/times';
* Internal dependencies
*/
import analyticsMixin from 'lib/mixins/analytics';
import config from 'config';
import DomainWarnings from 'my-sites/upgrades/components/domain-warnings';
import ListItem from './item';
import ListItemPlaceholder from './item-placeholder';
Expand Down Expand Up @@ -66,6 +67,10 @@ const List = React.createClass( {
},

addDomainButton() {
if ( ! config.isEnabled( 'upgrades/domain-search' ) ) {
return null;
}

return (
<Button
primary
Expand Down
7 changes: 6 additions & 1 deletion client/my-sites/upgrades/navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ var React = require( 'react' ),
/**
* Internal dependencies
*/
var SectionNav = require( 'components/section-nav' ),
var config = require( 'config' ),
SectionNav = require( 'components/section-nav' ),
NavTabs = require( 'components/section-nav/tabs' ),
NavItem = require( 'components/section-nav/item' ),
upgradesPaths = require( 'my-sites/upgrades/paths' ),
Expand Down Expand Up @@ -171,6 +172,10 @@ var UpgradesNavigation = React.createClass( {
},

cartToggleButton: function() {
if ( ! config.isEnabled( 'upgrades/checkout' ) ) {
return null;
}

return (
<PopoverCart
cart={ this.props.cart }
Expand Down
12 changes: 6 additions & 6 deletions config/desktop-mac-app-store.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@
"reader/discover": true,

"upgrades/checkout": false,
"upgrades/domain-management/contacts-privacy": false,
"upgrades/domain-management/email": false,
"upgrades/domain-management/list": false,
"upgrades/domain-management/name-servers": false,
"upgrades/domain-management/site-redirect": false,
"upgrades/credit-cards": false,
"upgrades/domain-management/contacts-privacy": true,
"upgrades/domain-management/email": true,
"upgrades/domain-management/list": true,
"upgrades/domain-management/name-servers": true,
"upgrades/domain-management/site-redirect": true,
"upgrades/domain-management/transfer": false,
"upgrades/domain-search": false,

Expand All @@ -88,7 +89,6 @@
"me/security/checkup": true,
"me/notifications": true,
"me/next-steps": false,
"me/credit-cards": false,
"me/find-friends": false,
"me/trophies": false,
"help": false,
Expand Down
2 changes: 1 addition & 1 deletion config/desktop.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"manage/themes": true,
"me/account": true,
"me/billing-history": true,
"me/credit-cards": true,
"me/find-friends": false,
"me/my-profile": true,
"me/next-steps": true,
Expand Down Expand Up @@ -76,6 +75,7 @@
"reader/teams": true,
"settings/security/monitor": true,
"upgrades/checkout": true,
"upgrades/credit-cards": true,
"upgrades/domain-management/contacts-privacy": true,
"upgrades/domain-management/email": true,
"upgrades/domain-management/list": true,
Expand Down
2 changes: 1 addition & 1 deletion config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"manage/jetpack-plans": true,

"upgrades/checkout": true,
"upgrades/credit-cards": true,
"upgrades/domain-management/contacts-privacy": true,
"upgrades/domain-management/email": true,
"upgrades/domain-management/list": true,
Expand Down Expand Up @@ -117,7 +118,6 @@
"me/security/checkup": true,
"me/notifications": true,
"me/next-steps": true,
"me/credit-cards": true,
"me/find-friends": false,
"me/trophies": false,

Expand Down
2 changes: 1 addition & 1 deletion config/horizon.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"reader/recommendations": true,

"upgrades/checkout": true,
"upgrades/credit-cards": true,

"notifications2beta": true,
"muse": true,
Expand All @@ -75,7 +76,6 @@
"me/security": true,
"me/notifications": true,
"me/next-steps": true,
"me/credit-cards": true,
"me/find-friends": false,
"me/trophies": false,
"help": true,
Expand Down
2 changes: 1 addition & 1 deletion config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"manage/option_sync_non_public_post_stati": false,
"manage/stats": true,
"me/billing-history": true,
"me/credit-cards": true,
"me/find-friends": false,
"me/next-steps": true,
"me/trophies": false,
Expand All @@ -57,6 +56,7 @@
"post-editor/pages": true,
"help": true,
"upgrades/checkout": true,
"upgrades/credit-cards": true,
"upgrades/domain-management/contacts-privacy": true,
"upgrades/domain-management/email": true,
"upgrades/domain-management/list": true,
Expand Down
2 changes: 1 addition & 1 deletion config/stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"manage/site-settings/analytics" : true,
"manage/site-settings/delete-site": true,
"me/billing-history": true,
"me/credit-cards": true,
"me/find-friends": false,
"me/next-steps": true,
"me/trophies": false,
Expand All @@ -57,6 +56,7 @@
"help": true,
"me/notifications": true,
"upgrades/checkout": true,
"upgrades/credit-cards": true,
"upgrades/domain-management/contacts-privacy": true,
"upgrades/domain-management/email": true,
"upgrades/domain-management/list": true,
Expand Down
2 changes: 1 addition & 1 deletion config/wpcalypso.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"reader/discover": true,

"upgrades/checkout": true,
"upgrades/credit-cards": true,
"upgrades/domain-management/contacts-privacy": true,
"upgrades/domain-management/email": true,
"upgrades/domain-management/list": true,
Expand All @@ -85,7 +86,6 @@
"me/security/checkup": true,
"me/notifications": true,
"me/next-steps": true,
"me/credit-cards": true,
"me/find-friends": false,
"me/trophies": false,
"help": true,
Expand Down