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

Checklist: rollout to other goal types. #26721

Merged
merged 1 commit into from
Aug 24, 2018
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
5 changes: 3 additions & 2 deletions client/my-sites/checklist/checklist-show/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getSelectedSiteId } from 'state/ui/selectors';
import getSiteChecklist from 'state/selectors/get-site-checklist';
import { getSiteSlug } from 'state/sites/selectors';
import QuerySiteChecklist from 'components/data/query-site-checklist';
import { getTaskUrls, launchTask, tasks } from '../onboardingChecklist';
import { getTaskUrls, launchTask, getTasks } from '../onboardingChecklist';
import { recordTracksEvent } from 'state/analytics/actions';
import { createNotice } from 'state/notices/actions';
import { requestGuidedTour } from 'state/ui/guided-tours/actions';
Expand Down Expand Up @@ -55,7 +55,7 @@ class ChecklistShow extends PureComponent {
};

render() {
const { siteId, taskStatuses } = this.props;
const { siteId, taskStatuses, tasks } = this.props;

return (
<Fragment>
Expand Down Expand Up @@ -96,6 +96,7 @@ const mapStateToProps = state => {
siteSlug: getSiteSlug( state, siteId ),
taskStatuses: get( getSiteChecklist( state, siteId ), [ 'tasks' ] ),
taskUrls: getTaskUrls( getSitePosts( state, siteId ) ),
tasks: getTasks( state, siteId ),
};
};

Expand Down
13 changes: 13 additions & 0 deletions client/my-sites/checklist/onboardingChecklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import page from 'page';
import { isDesktop } from 'lib/viewport';
import { translate } from 'i18n-calypso';
import { find } from 'lodash';
import { getSiteOption } from 'state/sites/selectors';

export const tasks = [
{
Expand Down Expand Up @@ -110,6 +111,18 @@ export const tasks = [
},
];

export function getTasks( state, siteId ) {
const designType = getSiteOption( state, siteId, 'design_type' );

if ( designType === 'blog' ) {
return tasks;
}

return tasks.filter( task => {
return task.id !== 'avatar_uploaded' && task.id !== 'post_published';
} );
}

export function launchTask( { task, location, requestTour, siteSlug, track } ) {
const checklist_name = 'new_blog';
const url = task.url && task.url.replace( '$siteSlug', siteSlug );
Expand Down
2 changes: 1 addition & 1 deletion client/my-sites/checkout/checkout/checkout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export class Checkout extends React.Component {
const hasGoogleAppsInCart = cartItems.hasGoogleApps( cart );

// The onboarding checklist currently supports the blog type only.
if ( hasGoogleAppsInCart && domainReceiptId && 'blog' === siteDesignType ) {
if ( hasGoogleAppsInCart && domainReceiptId && 'store' !== siteDesignType ) {
analytics.tracks.recordEvent( 'calypso_checklist_assign', {
site: selectedSiteSlug,
plan: 'paid',
Expand Down
15 changes: 8 additions & 7 deletions client/my-sites/stats/checklist-banner/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import Gauge from 'components/gauge';
import ProgressBar from 'components/progress-bar';
import QuerySiteChecklist from 'components/data/query-site-checklist';
import getSiteChecklist from 'state/selectors/get-site-checklist';
import { getSite, getSiteSlug } from 'state/sites/selectors';
import { getTaskUrls, launchTask, tasks } from 'my-sites/checklist/onboardingChecklist';
import { getSiteOption, getSiteSlug } from 'state/sites/selectors';
import { getTaskUrls, launchTask, getTasks } from 'my-sites/checklist/onboardingChecklist';
import ChecklistShowShare from 'my-sites/checklist/share';
import { recordTracksEvent } from 'state/analytics/actions';
import { requestGuidedTour } from 'state/ui/guided-tours/actions';
Expand Down Expand Up @@ -76,7 +76,7 @@ export class ChecklistBanner extends Component {

getTask() {
const task = find(
tasks,
this.props.tasks,
( { id, completed } ) => ! completed && ! get( this.props.taskStatuses, [ id, 'completed' ] )
);
return (
Expand All @@ -101,7 +101,7 @@ export class ChecklistBanner extends Component {
return false;
}

if ( this.props.siteDesignType !== 'blog' ) {
if ( this.props.siteDesignType === 'store' ) {
return false;
}

Expand Down Expand Up @@ -133,7 +133,7 @@ export class ChecklistBanner extends Component {
}

render() {
const { siteId, taskStatuses, translate } = this.props;
const { siteId, taskStatuses, translate, tasks } = this.props;
const total = tasks.length;
const completed = reduce(
tasks,
Expand Down Expand Up @@ -205,15 +205,16 @@ export class ChecklistBanner extends Component {
}

const mapStateToProps = ( state, { siteId } ) => {
const taskStatuses = get( getSiteChecklist( state, siteId ), [ 'tasks' ] );
const siteSlug = getSiteSlug( state, siteId );
const siteDesignType = get( getSite( state, siteId ), [ 'options', 'design_type' ] );
const taskStatuses = get( getSiteChecklist( state, siteId ), [ 'tasks' ] );
const siteDesignType = getSiteOption( state, siteId, 'design_type' );

return {
siteDesignType,
siteSlug,
taskStatuses,
taskUrls: getTaskUrls( getSitePosts( state, siteId ) ),
tasks: getTasks( state, siteId ),
};
};

Expand Down
4 changes: 2 additions & 2 deletions client/signup/processing-screen/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ export class SignupProcessingScreen extends Component {

return (
config.isEnabled( 'onboarding-checklist' ) &&
'blog' === designType &&
[ 'personal', 'premium', 'business' ].indexOf( this.props.flowName ) === -1
'store' !== designType &&
[ 'main', 'desktop', 'subdomain' ].indexOf( this.props.flowName ) !== -1
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function isEligibleForCheckoutToChecklist( state, siteId, cart )
}

return (
'blog' === designType &&
'store' !== designType &&
isNewSite( state, siteId ) &&
cartItems.hasPlan( cart ) &&
! some( cartItems.getAll( cart ), isDotcomBusinessPlan )
Expand Down