2019-03-28 06:09:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* External dependencies
|
|
|
|
|
*/
|
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2020-03-15 21:45:19 +00:00
|
|
|
|
import { Component, cloneElement, Fragment } from '@wordpress/element';
|
2020-06-10 23:49:27 +00:00
|
|
|
|
import { isEqual } from 'lodash';
|
2019-08-01 18:09:08 +00:00
|
|
|
|
import { compose } from '@wordpress/compose';
|
2019-10-11 12:55:35 +00:00
|
|
|
|
import classNames from 'classnames';
|
2020-05-27 16:08:39 +00:00
|
|
|
|
import {
|
|
|
|
|
Button,
|
|
|
|
|
Card,
|
|
|
|
|
CardBody,
|
|
|
|
|
CardHeader,
|
|
|
|
|
Modal,
|
|
|
|
|
} from '@wordpress/components';
|
2019-10-11 12:55:35 +00:00
|
|
|
|
import { withDispatch } from '@wordpress/data';
|
2020-05-27 16:08:39 +00:00
|
|
|
|
import { Icon, check, chevronRight } from '@wordpress/icons';
|
2019-07-18 10:11:21 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* WooCommerce dependencies
|
|
|
|
|
*/
|
2020-05-27 16:08:39 +00:00
|
|
|
|
import { H, List, EllipsisMenu } from '@woocommerce/components';
|
2019-07-19 02:54:38 +00:00
|
|
|
|
import { updateQueryString } from '@woocommerce/navigation';
|
2020-06-10 23:49:27 +00:00
|
|
|
|
import {
|
|
|
|
|
PLUGINS_STORE_NAME,
|
|
|
|
|
OPTIONS_STORE_NAME,
|
|
|
|
|
ONBOARDING_STORE_NAME,
|
|
|
|
|
} from '@woocommerce/data';
|
2019-03-28 06:09:44 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2019-11-14 14:35:55 +00:00
|
|
|
|
* Internal dependencies
|
2019-03-28 06:09:44 +00:00
|
|
|
|
*/
|
|
|
|
|
import './style.scss';
|
2020-05-21 17:15:08 +00:00
|
|
|
|
import CartModal from 'dashboard/components/cart-modal';
|
2019-12-31 08:50:45 +00:00
|
|
|
|
import { getAllTasks } from './tasks';
|
2019-10-07 20:27:34 +00:00
|
|
|
|
import { recordEvent } from 'lib/tracks';
|
2019-12-31 08:50:45 +00:00
|
|
|
|
import withSelect from 'wc-api/with-select';
|
2019-09-23 21:47:08 +00:00
|
|
|
|
|
2019-08-01 18:09:08 +00:00
|
|
|
|
class TaskDashboard extends Component {
|
2019-11-01 04:00:57 +00:00
|
|
|
|
constructor( props ) {
|
|
|
|
|
super( props );
|
|
|
|
|
this.state = {
|
2019-12-31 08:50:45 +00:00
|
|
|
|
isCartModalOpen: false,
|
2019-11-01 04:00:57 +00:00
|
|
|
|
isWelcomeModalOpen: ! props.modalDismissed,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-18 10:11:21 +00:00
|
|
|
|
componentDidMount() {
|
2020-03-23 20:47:12 +00:00
|
|
|
|
const { incompleteTasks, updateOptions } = this.props;
|
2019-08-21 05:58:47 +00:00
|
|
|
|
document.body.classList.add( 'woocommerce-onboarding' );
|
2019-07-18 10:11:21 +00:00
|
|
|
|
document.body.classList.add( 'woocommerce-task-dashboard__body' );
|
2019-10-07 20:27:34 +00:00
|
|
|
|
|
2019-10-29 02:08:39 +00:00
|
|
|
|
this.recordTaskView();
|
|
|
|
|
this.recordTaskListView();
|
2019-10-21 00:33:46 +00:00
|
|
|
|
|
2020-03-23 20:47:12 +00:00
|
|
|
|
if ( ! incompleteTasks.length ) {
|
|
|
|
|
updateOptions( {
|
2020-06-10 13:33:30 +00:00
|
|
|
|
woocommerce_task_list_complete: 'yes',
|
2019-10-21 00:33:46 +00:00
|
|
|
|
} );
|
|
|
|
|
}
|
2020-03-23 20:47:12 +00:00
|
|
|
|
|
|
|
|
|
this.possiblyTrackCompletedTasks();
|
2019-07-18 10:11:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-29 02:08:39 +00:00
|
|
|
|
componentDidUpdate( prevProps ) {
|
2020-04-08 21:27:24 +00:00
|
|
|
|
const {
|
|
|
|
|
completedTaskKeys,
|
|
|
|
|
incompleteTasks,
|
|
|
|
|
query,
|
|
|
|
|
updateOptions,
|
|
|
|
|
} = this.props;
|
2020-03-23 20:47:12 +00:00
|
|
|
|
const {
|
|
|
|
|
completedTaskKeys: prevCompletedTaskKeys,
|
|
|
|
|
incompleteTasks: prevIncompleteTasks,
|
|
|
|
|
query: prevQuery,
|
|
|
|
|
} = prevProps;
|
|
|
|
|
const { task: prevTask } = prevQuery;
|
|
|
|
|
const { task } = query;
|
2019-10-29 02:08:39 +00:00
|
|
|
|
|
|
|
|
|
if ( prevTask !== task ) {
|
2019-10-29 18:24:24 +00:00
|
|
|
|
window.document.documentElement.scrollTop = 0;
|
2019-10-29 02:08:39 +00:00
|
|
|
|
this.recordTaskView();
|
|
|
|
|
}
|
2020-03-23 20:47:12 +00:00
|
|
|
|
|
|
|
|
|
if ( ! incompleteTasks.length && prevIncompleteTasks.length ) {
|
|
|
|
|
updateOptions( {
|
2020-06-10 13:33:30 +00:00
|
|
|
|
woocommerce_task_list_complete: 'yes',
|
2020-03-23 20:47:12 +00:00
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( ! isEqual( prevCompletedTaskKeys, completedTaskKeys ) ) {
|
|
|
|
|
this.possiblyTrackCompletedTasks();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
possiblyTrackCompletedTasks() {
|
2020-04-08 21:27:24 +00:00
|
|
|
|
const {
|
|
|
|
|
completedTaskKeys,
|
|
|
|
|
trackedCompletedTasks,
|
|
|
|
|
updateOptions,
|
|
|
|
|
} = this.props;
|
2020-03-23 20:47:12 +00:00
|
|
|
|
|
|
|
|
|
if ( ! isEqual( trackedCompletedTasks, completedTaskKeys ) ) {
|
|
|
|
|
updateOptions( {
|
|
|
|
|
woocommerce_task_list_tracked_completed_tasks: completedTaskKeys,
|
|
|
|
|
} );
|
|
|
|
|
}
|
2019-10-29 02:08:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-18 10:11:21 +00:00
|
|
|
|
componentWillUnmount() {
|
2019-08-21 05:58:47 +00:00
|
|
|
|
document.body.classList.remove( 'woocommerce-onboarding' );
|
2019-07-18 10:11:21 +00:00
|
|
|
|
document.body.classList.remove( 'woocommerce-task-dashboard__body' );
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-31 08:50:45 +00:00
|
|
|
|
getTasks() {
|
2020-05-25 00:26:08 +00:00
|
|
|
|
const {
|
|
|
|
|
profileItems,
|
|
|
|
|
query,
|
|
|
|
|
taskListPayments,
|
|
|
|
|
installedPlugins,
|
|
|
|
|
} = this.props;
|
2019-12-31 08:50:45 +00:00
|
|
|
|
|
|
|
|
|
return getAllTasks( {
|
|
|
|
|
profileItems,
|
2020-06-10 23:49:27 +00:00
|
|
|
|
taskListPayments,
|
2020-02-14 02:23:21 +00:00
|
|
|
|
query,
|
2019-12-31 08:50:45 +00:00
|
|
|
|
toggleCartModal: this.toggleCartModal.bind( this ),
|
2020-05-25 00:26:08 +00:00
|
|
|
|
installedPlugins,
|
2020-02-14 02:23:21 +00:00
|
|
|
|
} ).filter( ( task ) => task.visible );
|
2019-12-31 08:50:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-02 22:22:32 +00:00
|
|
|
|
getPluginsInformation() {
|
2020-04-16 23:58:36 +00:00
|
|
|
|
const {
|
|
|
|
|
isJetpackConnected,
|
|
|
|
|
activePlugins,
|
|
|
|
|
installedPlugins,
|
|
|
|
|
} = this.props;
|
2020-03-02 22:22:32 +00:00
|
|
|
|
return {
|
|
|
|
|
wcs_installed: installedPlugins.includes( 'woocommerce-services' ),
|
|
|
|
|
wcs_active: activePlugins.includes( 'woocommerce-services' ),
|
|
|
|
|
jetpack_installed: installedPlugins.includes( 'jetpack' ),
|
|
|
|
|
jetpack_active: activePlugins.includes( 'jetpack' ),
|
|
|
|
|
jetpack_connected: isJetpackConnected,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-29 02:08:39 +00:00
|
|
|
|
recordTaskView() {
|
|
|
|
|
const { task } = this.props.query;
|
2020-03-02 22:22:32 +00:00
|
|
|
|
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
|
|
|
|
|
const pluginsInformation = this.getPluginsInformation();
|
2019-10-29 02:08:39 +00:00
|
|
|
|
|
|
|
|
|
if ( ! task ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recordEvent( 'task_view', {
|
|
|
|
|
task_name: task,
|
2020-03-02 22:22:32 +00:00
|
|
|
|
...pluginsInformation,
|
2019-10-29 02:08:39 +00:00
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recordTaskListView() {
|
2019-10-07 20:27:34 +00:00
|
|
|
|
if ( this.getCurrentTask() ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-01-02 02:36:25 +00:00
|
|
|
|
|
2019-10-07 20:27:34 +00:00
|
|
|
|
const { profileItems } = this.props;
|
2019-12-31 08:50:45 +00:00
|
|
|
|
const tasks = this.getTasks();
|
2020-01-02 02:36:25 +00:00
|
|
|
|
|
2019-10-07 20:27:34 +00:00
|
|
|
|
recordEvent( 'tasklist_view', {
|
|
|
|
|
number_tasks: tasks.length,
|
|
|
|
|
store_connected: profileItems.wccom_connected,
|
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-11 12:55:35 +00:00
|
|
|
|
keepTaskCard() {
|
|
|
|
|
recordEvent( 'tasklist_completed', {
|
|
|
|
|
action: 'keep_card',
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
this.props.updateOptions( {
|
|
|
|
|
woocommerce_task_list_prompt_shown: true,
|
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hideTaskCard( action ) {
|
|
|
|
|
recordEvent( 'tasklist_completed', {
|
|
|
|
|
action,
|
|
|
|
|
} );
|
|
|
|
|
this.props.updateOptions( {
|
|
|
|
|
woocommerce_task_list_hidden: 'yes',
|
|
|
|
|
woocommerce_task_list_prompt_shown: true,
|
|
|
|
|
} );
|
2019-08-01 18:09:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-19 02:54:38 +00:00
|
|
|
|
getCurrentTask() {
|
|
|
|
|
const { task } = this.props.query;
|
2020-02-14 02:23:21 +00:00
|
|
|
|
const currentTask = this.getTasks().find( ( s ) => s.key === task );
|
2019-07-19 02:54:38 +00:00
|
|
|
|
|
|
|
|
|
if ( ! currentTask ) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return currentTask;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-11 12:55:35 +00:00
|
|
|
|
renderMenu() {
|
|
|
|
|
return (
|
2020-05-27 16:08:39 +00:00
|
|
|
|
<div className="woocommerce-card__menu woocommerce-card__header-item">
|
|
|
|
|
<EllipsisMenu
|
|
|
|
|
label={ __( 'Task List Options', 'woocommerce-admin' ) }
|
|
|
|
|
renderContent={ () => (
|
|
|
|
|
<div className="woocommerce-task-card__section-controls">
|
|
|
|
|
<Button
|
|
|
|
|
onClick={ () =>
|
|
|
|
|
this.hideTaskCard( 'remove_card' )
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
{ __( 'Hide this', 'woocommerce-admin' ) }
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
) }
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2019-10-11 12:55:35 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-31 08:50:45 +00:00
|
|
|
|
toggleCartModal() {
|
2020-01-02 02:36:25 +00:00
|
|
|
|
const { isCartModalOpen } = this.state;
|
|
|
|
|
|
|
|
|
|
if ( ! isCartModalOpen ) {
|
|
|
|
|
recordEvent( 'tasklist_purchase_extensions' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState( { isCartModalOpen: ! isCartModalOpen } );
|
2019-12-31 08:50:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-01 04:00:57 +00:00
|
|
|
|
closeWelcomeModal() {
|
|
|
|
|
// Prevent firing this event before the modal is seen.
|
2020-02-14 02:23:21 +00:00
|
|
|
|
if (
|
|
|
|
|
document.body.classList.contains( 'woocommerce-admin-is-loading' )
|
|
|
|
|
) {
|
2019-11-01 04:00:57 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState( { isWelcomeModalOpen: false } );
|
|
|
|
|
this.props.updateOptions( {
|
|
|
|
|
woocommerce_task_list_welcome_modal_dismissed: true,
|
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
renderWelcomeModal() {
|
|
|
|
|
return (
|
|
|
|
|
<Modal
|
|
|
|
|
title={
|
|
|
|
|
<Fragment>
|
|
|
|
|
<span
|
|
|
|
|
role="img"
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
focusable="false"
|
|
|
|
|
className="woocommerce-task-dashboard__welcome-modal-icon"
|
|
|
|
|
>
|
|
|
|
|
🚀
|
|
|
|
|
</span>
|
2020-02-14 02:23:21 +00:00
|
|
|
|
{ __(
|
|
|
|
|
"Woo hoo - you're almost there!",
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
) }
|
2019-11-01 04:00:57 +00:00
|
|
|
|
</Fragment>
|
|
|
|
|
}
|
|
|
|
|
onRequestClose={ () => this.closeWelcomeModal() }
|
|
|
|
|
className="woocommerce-task-dashboard__welcome-modal"
|
|
|
|
|
>
|
|
|
|
|
<div className="woocommerce-task-dashboard__welcome-modal-wrapper">
|
|
|
|
|
<div className="woocommerce-task-dashboard__welcome-modal-message">
|
|
|
|
|
<p>
|
|
|
|
|
{ __(
|
|
|
|
|
'Based on the information you provided we’ve prepared some final set up tasks for you to perform.',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
) }
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
{ __(
|
|
|
|
|
'Once complete your store will be ready for launch - exciting!',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
) }
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2020-02-14 02:23:21 +00:00
|
|
|
|
<Button
|
|
|
|
|
isPrimary
|
|
|
|
|
onClick={ () => this.closeWelcomeModal() }
|
|
|
|
|
>
|
2019-11-01 04:00:57 +00:00
|
|
|
|
{ __( 'Continue', 'woocommerce-admin' ) }
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-28 06:09:44 +00:00
|
|
|
|
render() {
|
2020-05-27 16:08:39 +00:00
|
|
|
|
const { query } = this.props;
|
2019-12-31 08:50:45 +00:00
|
|
|
|
const { isCartModalOpen, isWelcomeModalOpen } = this.state;
|
2019-07-19 02:54:38 +00:00
|
|
|
|
const currentTask = this.getCurrentTask();
|
2020-02-14 02:23:21 +00:00
|
|
|
|
const listTasks = this.getTasks().map( ( task ) => {
|
|
|
|
|
task.className = classNames(
|
|
|
|
|
task.completed ? 'is-complete' : null,
|
|
|
|
|
task.className
|
|
|
|
|
);
|
2020-05-27 16:08:39 +00:00
|
|
|
|
task.before = (
|
|
|
|
|
<div className="woocommerce-task__icon">
|
|
|
|
|
{ task.completed && <Icon icon={ check } /> }
|
|
|
|
|
</div>
|
2020-02-14 02:23:21 +00:00
|
|
|
|
);
|
2019-10-29 18:03:07 +00:00
|
|
|
|
|
2020-05-27 16:08:39 +00:00
|
|
|
|
if ( ! task.completed ) {
|
|
|
|
|
task.after = task.time ? (
|
|
|
|
|
<span className="woocommerce-task-estimated-time">
|
|
|
|
|
{ task.time }
|
|
|
|
|
</span>
|
|
|
|
|
) : (
|
|
|
|
|
<Icon icon={ chevronRight } />
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-29 18:03:07 +00:00
|
|
|
|
if ( ! task.onClick ) {
|
|
|
|
|
task.onClick = () => updateQueryString( { task: task.key } );
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-11 12:55:35 +00:00
|
|
|
|
return task;
|
|
|
|
|
} );
|
2020-05-27 16:08:39 +00:00
|
|
|
|
const numCompleteTasks = listTasks.filter( ( task ) => task.completed )
|
|
|
|
|
.length;
|
|
|
|
|
const progressBarClass = classNames(
|
|
|
|
|
'woocommerce-task-card__progress-bar',
|
|
|
|
|
{
|
|
|
|
|
completed: listTasks.length === numCompleteTasks,
|
|
|
|
|
}
|
|
|
|
|
);
|
2019-07-19 02:54:38 +00:00
|
|
|
|
|
2019-03-28 06:09:44 +00:00
|
|
|
|
return (
|
2019-07-18 10:11:21 +00:00
|
|
|
|
<Fragment>
|
|
|
|
|
<div className="woocommerce-task-dashboard__container">
|
2019-07-19 02:54:38 +00:00
|
|
|
|
{ currentTask ? (
|
2020-03-15 21:45:19 +00:00
|
|
|
|
cloneElement( currentTask.container, {
|
|
|
|
|
query,
|
|
|
|
|
} )
|
2019-07-19 02:54:38 +00:00
|
|
|
|
) : (
|
2019-10-11 12:55:35 +00:00
|
|
|
|
<Fragment>
|
|
|
|
|
<Card
|
2020-05-27 16:08:39 +00:00
|
|
|
|
size="large"
|
2019-10-11 12:55:35 +00:00
|
|
|
|
className="woocommerce-task-card"
|
|
|
|
|
>
|
2020-05-27 16:08:39 +00:00
|
|
|
|
<progress
|
|
|
|
|
className={ progressBarClass }
|
|
|
|
|
max={ listTasks.length }
|
|
|
|
|
value={ numCompleteTasks }
|
|
|
|
|
/>
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<H>
|
|
|
|
|
{ __(
|
2020-06-09 02:06:35 +00:00
|
|
|
|
'Finish setup',
|
2020-05-27 16:08:39 +00:00
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
) }
|
|
|
|
|
</H>
|
|
|
|
|
{ this.renderMenu() }
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardBody>
|
|
|
|
|
<List items={ listTasks } />
|
|
|
|
|
</CardBody>
|
2019-10-11 12:55:35 +00:00
|
|
|
|
</Card>
|
2019-11-01 04:00:57 +00:00
|
|
|
|
{ isWelcomeModalOpen && this.renderWelcomeModal() }
|
2019-10-11 12:55:35 +00:00
|
|
|
|
</Fragment>
|
2019-07-19 02:54:38 +00:00
|
|
|
|
) }
|
2019-03-28 06:09:44 +00:00
|
|
|
|
</div>
|
2019-12-31 08:50:45 +00:00
|
|
|
|
{ isCartModalOpen && (
|
|
|
|
|
<CartModal
|
|
|
|
|
onClose={ () => this.toggleCartModal() }
|
|
|
|
|
onClickPurchaseLater={ () => this.toggleCartModal() }
|
|
|
|
|
/>
|
|
|
|
|
) }
|
2019-07-18 10:11:21 +00:00
|
|
|
|
</Fragment>
|
2019-03-28 06:09:44 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-01 18:09:08 +00:00
|
|
|
|
|
|
|
|
|
export default compose(
|
2020-03-23 20:47:12 +00:00
|
|
|
|
withSelect( ( select, props ) => {
|
2020-05-28 08:51:40 +00:00
|
|
|
|
const { getProfileItems } = select( ONBOARDING_STORE_NAME );
|
2020-06-10 23:49:27 +00:00
|
|
|
|
const { getOption } = select( OPTIONS_STORE_NAME );
|
2020-05-21 17:15:08 +00:00
|
|
|
|
const {
|
|
|
|
|
getActivePlugins,
|
|
|
|
|
getInstalledPlugins,
|
|
|
|
|
isJetpackConnected,
|
|
|
|
|
} = select( PLUGINS_STORE_NAME );
|
2019-08-01 18:09:08 +00:00
|
|
|
|
const profileItems = getProfileItems();
|
2019-10-03 16:03:29 +00:00
|
|
|
|
|
2020-06-10 23:49:27 +00:00
|
|
|
|
const modalDismissed =
|
|
|
|
|
getOption( 'woocommerce_task_list_welcome_modal_dismissed' ) ||
|
|
|
|
|
false;
|
|
|
|
|
const taskListPayments = getOption( 'woocommerce_task_list_payments' );
|
|
|
|
|
const trackedCompletedTasks =
|
|
|
|
|
getOption( 'woocommerce_task_list_tracked_completed_tasks' ) || [];
|
|
|
|
|
const payments = getOption( 'woocommerce_task_list_payments' );
|
|
|
|
|
|
2020-05-25 00:26:08 +00:00
|
|
|
|
const installedPlugins = getInstalledPlugins();
|
2020-03-23 20:47:12 +00:00
|
|
|
|
const tasks = getAllTasks( {
|
|
|
|
|
profileItems,
|
2020-06-10 23:49:27 +00:00
|
|
|
|
options: payments,
|
2020-03-23 20:47:12 +00:00
|
|
|
|
query: props.query,
|
2020-05-25 00:26:08 +00:00
|
|
|
|
installedPlugins,
|
2020-03-23 20:47:12 +00:00
|
|
|
|
} );
|
2020-04-08 21:27:24 +00:00
|
|
|
|
const completedTaskKeys = tasks
|
|
|
|
|
.filter( ( task ) => task.completed )
|
|
|
|
|
.map( ( task ) => task.key );
|
2020-03-23 20:47:12 +00:00
|
|
|
|
const incompleteTasks = tasks.filter(
|
|
|
|
|
( task ) => task.visible && ! task.completed
|
|
|
|
|
);
|
2020-04-16 23:58:36 +00:00
|
|
|
|
const activePlugins = getActivePlugins();
|
2019-10-11 12:55:35 +00:00
|
|
|
|
|
|
|
|
|
return {
|
2019-11-01 04:00:57 +00:00
|
|
|
|
modalDismissed,
|
2019-10-11 12:55:35 +00:00
|
|
|
|
profileItems,
|
2019-12-31 08:50:45 +00:00
|
|
|
|
taskListPayments,
|
2020-03-02 22:22:32 +00:00
|
|
|
|
isJetpackConnected: isJetpackConnected(),
|
2020-03-23 20:47:12 +00:00
|
|
|
|
incompleteTasks,
|
|
|
|
|
trackedCompletedTasks,
|
|
|
|
|
completedTaskKeys,
|
2020-04-16 23:58:36 +00:00
|
|
|
|
activePlugins,
|
|
|
|
|
installedPlugins,
|
2019-10-11 12:55:35 +00:00
|
|
|
|
};
|
|
|
|
|
} ),
|
2020-02-14 02:23:21 +00:00
|
|
|
|
withDispatch( ( dispatch ) => {
|
2020-06-10 23:49:27 +00:00
|
|
|
|
const { updateOptions } = dispatch( OPTIONS_STORE_NAME );
|
2019-10-11 12:55:35 +00:00
|
|
|
|
return {
|
|
|
|
|
updateOptions,
|
|
|
|
|
};
|
2019-08-01 18:09:08 +00:00
|
|
|
|
} )
|
|
|
|
|
)( TaskDashboard );
|