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

Plans: Introduce and hook up Jetpack product installer #31684

Merged
merged 49 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
48348de
State: Introduce Jetpack product install action types
tyxla Mar 22, 2019
67d5d9c
State: Introduce Jetpack product install action creators
tyxla Mar 22, 2019
8da150e
State: Add data layer for Jetpack product install
tyxla Mar 22, 2019
952cca3
State: Add data layer for Jetpack product install status
tyxla Mar 22, 2019
29ee6a8
State: Hook up Jetpack product install data layer
tyxla Mar 22, 2019
217664c
State: Introduce Jetpack product install reducer
tyxla Mar 22, 2019
9160318
State: Hook up Jetpack product install reducer
tyxla Mar 22, 2019
76a59fe
State: Introduce selector for Jetpack product install status
tyxla Mar 22, 2019
ceccb16
State: Introduce getPluginKeys selector
tyxla Mar 22, 2019
a46c822
Plans: Introduce Jetpack product installer component
tyxla Mar 22, 2019
f5cb9ec
Current plan: Implement Jetpack product installer in thank you card
tyxla Mar 22, 2019
5bc0dd1
Retry only if there are no installation errors
tyxla Mar 25, 2019
6a2065e
State: Introduce getJetpackProductInstallProgress selector
tyxla Mar 25, 2019
3893e36
State: Fix getJetpackProductInstallStatus docs
tyxla Mar 25, 2019
41f58de
Plans: Separate UI bits from Jetpack product install component
tyxla Mar 25, 2019
dd85419
Plans: Split thank you card to setup and success
tyxla Mar 25, 2019
ea759c9
Plans: Remove prettier pragma from CurrentPlanThankYouCard
tyxla Mar 25, 2019
d7cb573
Plans: Simplify current plan sentence in CurrentPlanThankYouCard
tyxla Mar 25, 2019
be6dacf
Plans: Thank you card success page
tyxla Mar 25, 2019
5f95a61
Plans: Fix continue/skip link
tyxla Mar 25, 2019
45a2c0f
Checkout: Direct Jetpack plans to new plan setup
tyxla Mar 25, 2019
c8141eb
Plans: Use install progress to remove false in progress state
tyxla Mar 25, 2019
adf4cfb
Plans: JetpackProductInstall - a retry mechanism
tyxla Mar 25, 2019
def7b66
Plans: JetpackProductInstall - fix constants naming
tyxla Mar 25, 2019
9ad4cdb
Plans: Increase number of max retries
tyxla Mar 26, 2019
bb926b6
Plans: Rename JetpackProductInstall install method
tyxla Mar 26, 2019
11d3681
Plans: Polish Jetpack product installer retry mechanism
tyxla Mar 26, 2019
6803def
Plans: Implement error handling for JetpackProductInstall
tyxla Mar 26, 2019
a214d14
Plans: Document JetpackProductInstall with inline code
tyxla Mar 26, 2019
06d1dcc
Plans: More JetpackProductInstall inline docs
tyxla Mar 26, 2019
0d6ae6a
State: Fix inline docs for product install data layer
tyxla Mar 26, 2019
6341719
State: Fix memoization of getPluginKeys selector
tyxla Mar 26, 2019
eb9ddd5
State: Fix data handling of getPluginKeys selector
tyxla Mar 26, 2019
9080534
State: Clean up premium plugin selector tests
tyxla Mar 26, 2019
210930d
State: Add tests for getPluginKeys selector
tyxla Mar 26, 2019
ae276d5
State: Add tests for product install reducer
tyxla Mar 26, 2019
fa38e34
State: Add tests for getJetpackProductInstallStatus selector
tyxla Mar 26, 2019
f2372a8
State: Add tests for getJetpackProductInstallProgress selector
tyxla Mar 26, 2019
696083b
Plans: Fix a typo in JetpackProductInstall
ockham Mar 27, 2019
3f482a5
Plans: Fix another typo in JetpackProductInstall
tyxla Mar 27, 2019
f90cf7b
JetpackProductInstall: _.includes instead of .indexOf
tyxla Mar 28, 2019
3b27ec2
JetpackProductInstall: Simplify arePluginsInState
tyxla Mar 28, 2019
be76b80
State: Avoid mutation in getPluginKeys
tyxla Mar 28, 2019
04e53cd
State: Remove get defaults from getPluginKeys
tyxla Mar 28, 2019
a025a10
State: Remove an empty line from premium plugin selectors
tyxla Mar 28, 2019
1e24571
State: Add schema validation to product install status data layer
tyxla Mar 28, 2019
7bea25c
Plans: Shorten CurrentPlanThankYouCard copy
tyxla Mar 28, 2019
f909774
Plans: Keep JSX in CurrentPlanThankYouCard in render()
tyxla Mar 28, 2019
ae588e7
State: Add a test to ensure cache works in getPluginKeys
tyxla Mar 28, 2019
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
13 changes: 3 additions & 10 deletions client/my-sites/checkout/checkout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ import { abtest } from 'lib/abtest';
*/
import './style.scss';


export class Checkout extends React.Component {
static propTypes = {
cards: PropTypes.array.isRequired,
Expand Down Expand Up @@ -454,15 +453,9 @@ export class Checkout extends React.Component {
return `/${ destination }/${ selectedSiteSlug }`;
}

/**
* @TODO Enable when plan setup is completed on the My Plan page
*
* This route skips the checkout thank you page where plan setup currently
* occurs. That's undesireable until the plans can be set up correctly on My Plan.
*/
// if ( this.props.isJetpackNotAtomic && isEnabled( 'jetpack/checklist' ) ) {
// return `/plans/my-plan/${ selectedSiteSlug }?thank-you`;
// }
if ( this.props.isJetpackNotAtomic && config.isEnabled( 'jetpack/checklist' ) ) {
return `/plans/my-plan/${ selectedSiteSlug }?thank-you`;
}

return this.props.selectedFeature && isValidFeatureKey( this.props.selectedFeature )
? `/checkout/thank-you/features/${
Expand Down
Original file line number Diff line number Diff line change
@@ -1,91 +1,98 @@
/** @format */
/**
* External dependencies
*/
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import React, { Component, Fragment } from 'react';
import { connect } from 'react-redux';
import { get, invoke, isFinite } from 'lodash';
import { localize } from 'i18n-calypso';

/**
* Internal dependencies
*/
import Button from 'components/button';
import Card from 'components/card';
import getCurrentPlanPurchase from 'state/selectors/get-current-plan-purchase';
import getJetpackProductInstallProgress from 'state/selectors/get-jetpack-product-install-progress';
import JetpackProductInstall from 'my-sites/plans/current-plan/jetpack-product-install';
import ProgressBar from 'components/progress-bar';
import QuerySitePurchases from 'components/data/query-site-purchases';
import { getPlan } from 'lib/plans';
import { getSelectedSiteId } from 'state/ui/selectors';
import { getSitePlanSlug } from 'state/sites/selectors';
import { getSelectedSiteId, getSelectedSiteSlug } from 'state/ui/selectors';

export class CurrentPlanThankYouCard extends Component {
static propTypes = {
progressComplete: PropTypes.number,
progressTotal: PropTypes.number,
};
getMyPlanRoute() {
const { siteSlug } = this.props;

return `/plans/my-plan/${ siteSlug }`;
}

render() {
const { moment, planName, purchaseExpiryDate, siteId, translate } = this.props;
const duration = purchaseExpiryDate
? moment.duration( moment().diff( purchaseExpiryDate ) ).humanize()
: null;
const { progressComplete, translate } = this.props;

return (
<Card className="current-plan-thank-you-card">
<QuerySitePurchases siteId={ siteId } />
<div className="current-plan-thank-you-card__content">
<img
className="current-plan-thank-you-card__illustration"
alt=""
aria-hidden="true"
src="/calypso/images/illustrations/fireworks.svg"
/>
<h1 className="current-plan-thank-you-card__title">
{ translate( 'Thank you for your purchase!' ) }
</h1>
<p>
{ duration && planName
? translate(
'Your website is on a %(planName)s plan for %(duration)s. That means it has lots of useful security tools — let’s walk through a short checklist of the essentials so Jetpack can start monitoring things for you.',
{
args: { duration, planName },
}
)
: ' ' /* &nbsp; maintain some space */ }
</p>
<p>
{ translate(
'We’ve taken the liberty of starting the first two items, since they’re key to your site’s safety: we’re configuring spam filtering and backups for you now. Once that’s done, we can work through the rest of the checklist.'
) }
</p>
{ /* can be 0 */ isFinite( this.props.progressComplete ) &&
/* shouldn't be 0 */ this.props.progressTotal && (
<ProgressBar
isPulsing
total={ this.props.progressTotal }
value={ this.props.progressComplete }
/>
) }
<p>
<a
className="current-plan-thank-you-card__skip-setup"
href={ /* @TODO (sirreal) fix this */ document.location.pathname }
>
{ translate( 'Skip setup. I’ll do this later.' ) }
</a>
</p>
</div>
</Card>
<Fragment>
<JetpackProductInstall />

{ progressComplete !== null && (
<Card className="current-plan-thank-you-card__main">
<div className="current-plan-thank-you-card__content">
{ progressComplete === 100 ? (
<Fragment>
<img
className="current-plan-thank-you-card__illustration"
alt=""
aria-hidden="true"
src="/calypso/images/illustrations/security.svg"
/>
<h1 className="current-plan-thank-you-card__title">
{ translate( 'So long spam, hello backups!' ) }
</h1>
<p>
{ translate( 'We’ve finished setting up spam filtering and backups for you.' ) }
<br />
{ translate( "You're now ready to finish the rest of the checklist." ) }
</p>
<Button primary href={ this.getMyPlanRoute() }>
{ translate( 'Continue' ) }
</Button>
</Fragment>
) : (
<Fragment>
<img
className="current-plan-thank-you-card__illustration"
alt=""
aria-hidden="true"
src="/calypso/images/illustrations/fireworks.svg"
/>
<h1 className="current-plan-thank-you-card__title">
{ translate( 'Thank you for your purchase!' ) }
</h1>
<p>{ translate( "Now let's make sure your site is protected." ) }</p>
<p>
{ translate(
"We're setting up spam filters and site backups for you first. Once that's done, our security checklist will guide you through the next steps."
) }
</p>

<ProgressBar isPulsing total={ 100 } value={ progressComplete || 0 } />

<p>
<a href={ this.getMyPlanRoute() }>
{ translate( 'Skip setup. I’ll do this later.' ) }
</a>
</p>
</Fragment>
) }
</div>
</Card>
) }
</Fragment>
);
}
}

export default connect( state => {
const siteId = getSelectedSiteId( state );
const planSlug = getSitePlanSlug( state, siteId );

return {
planName: invoke( getPlan( planSlug ), [ 'getTitle' ] ),
purchaseExpiryDate: get( getCurrentPlanPurchase( state, siteId ), [ 'expiryDate' ] ),
progressComplete: getJetpackProductInstallProgress( state, siteId ),
siteId,
siteSlug: getSelectedSiteSlug( state ),
};
} )( localize( CurrentPlanThankYouCard ) );
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
.current-plan-thank-you-card {
.current-plan-thank-you-card__main {
box-shadow: none;
text-align: center;

@include breakpoint( '>800px' ) {
font-size: 16px;
margin-bottom: 40px;

a {
font-size: 14px;
}
}

.progress-bar {
Expand Down Expand Up @@ -32,7 +36,3 @@
font-size: 24px;
margin: 18px 0 14px;
}

.current-plan-thank-you-card__skip-setup {
font-size: 14px;
}
5 changes: 1 addition & 4 deletions client/my-sites/plans/current-plan/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ class CurrentPlan extends Component {
) }

{ this.props.showThankYou ? (
<CurrentPlanThankYouCard
progressComplete={ /* @TODO (sirreal) hook up progress reporting */ 10 }
progressTotal={ 100 }
/>
<CurrentPlanThankYouCard />
) : (
<CurrentPlanHeader
isPlaceholder={ isLoading }
Expand Down
Loading