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';
|
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,
|
2020-06-18 23:44:00 +00:00
|
|
|
__experimentalText as Text,
|
2020-05-27 16:08:39 +00:00
|
|
|
} from '@wordpress/components';
|
2020-08-05 00:14:56 +00:00
|
|
|
import { withDispatch, withSelect } from '@wordpress/data';
|
2020-09-11 06:09:17 +00:00
|
|
|
import { Icon, check } from '@wordpress/icons';
|
2020-07-20 06:19:01 +00:00
|
|
|
import { xor } from 'lodash';
|
2020-06-18 23:44:00 +00:00
|
|
|
import { 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,
|
2020-08-03 08:22:25 +00:00
|
|
|
SETTINGS_STORE_NAME,
|
2020-06-10 23:49:27 +00:00
|
|
|
} from '@woocommerce/data';
|
2020-08-20 04:59:52 +00:00
|
|
|
import { recordEvent } from '@woocommerce/tracks';
|
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-08-13 02:05:22 +00:00
|
|
|
import CartModal from '../dashboard/components/cart-modal';
|
2020-07-14 01:40:56 +00:00
|
|
|
import { getAllTasks, recordTaskViewEvent } from './tasks';
|
2020-08-13 02:05:22 +00:00
|
|
|
import { getCountryCode } from '../dashboard/utils';
|
2020-09-03 02:28:31 +00:00
|
|
|
import sanitizeHTML from '../lib/sanitize-html';
|
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
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-07-18 10:11:21 +00:00
|
|
|
componentDidMount() {
|
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();
|
2020-07-20 06:19:01 +00:00
|
|
|
this.possiblyCompleteTaskList();
|
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-07-20 06:19:01 +00:00
|
|
|
const { query } = this.props;
|
|
|
|
const { query: prevQuery } = prevProps;
|
2020-03-23 20:47:12 +00:00
|
|
|
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
|
|
|
|
2020-07-20 06:19:01 +00:00
|
|
|
this.possiblyCompleteTaskList();
|
|
|
|
this.possiblyTrackCompletedTasks();
|
|
|
|
}
|
|
|
|
|
|
|
|
possiblyCompleteTaskList() {
|
|
|
|
const { isTaskListComplete, updateOptions } = this.props;
|
|
|
|
|
|
|
|
if ( ! this.getIncompleteTasks().length && ! isTaskListComplete ) {
|
2020-03-23 20:47:12 +00:00
|
|
|
updateOptions( {
|
2020-06-10 13:33:30 +00:00
|
|
|
woocommerce_task_list_complete: 'yes',
|
2020-03-23 20:47:12 +00:00
|
|
|
} );
|
|
|
|
}
|
2020-07-20 06:19:01 +00:00
|
|
|
}
|
2020-03-23 20:47:12 +00:00
|
|
|
|
2020-07-20 06:19:01 +00:00
|
|
|
getCompletedTaskKeys() {
|
|
|
|
return this.getVisibleTasks()
|
|
|
|
.filter( ( task ) => task.completed )
|
|
|
|
.map( ( task ) => task.key );
|
|
|
|
}
|
|
|
|
|
|
|
|
getIncompleteTasks() {
|
|
|
|
return this.getAllTasks().filter(
|
|
|
|
( task ) => task.visible && ! task.completed
|
|
|
|
);
|
2020-03-23 20:47:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
possiblyTrackCompletedTasks() {
|
2020-07-28 02:32:58 +00:00
|
|
|
const { trackedCompletedTasks, updateOptions } = this.props;
|
2020-07-20 06:19:01 +00:00
|
|
|
const completedTaskKeys = this.getCompletedTaskKeys();
|
2020-03-23 20:47:12 +00:00
|
|
|
|
2020-07-20 06:19:01 +00:00
|
|
|
if ( xor( trackedCompletedTasks, completedTaskKeys ).length !== 0 ) {
|
2020-03-23 20:47:12 +00:00
|
|
|
updateOptions( {
|
|
|
|
woocommerce_task_list_tracked_completed_tasks: completedTaskKeys,
|
|
|
|
} );
|
|
|
|
}
|
2019-10-29 02:08:39 +00:00
|
|
|
}
|
|
|
|
|
2020-07-14 10:46:25 +00:00
|
|
|
dismissTask( key ) {
|
|
|
|
const { createNotice, dismissedTasks, updateOptions } = this.props;
|
|
|
|
|
|
|
|
createNotice( 'success', __( 'Task dismissed' ), {
|
|
|
|
actions: [
|
|
|
|
{
|
|
|
|
label: __( 'Undo', 'woocommerce-admin' ),
|
|
|
|
onClick: () => this.undoDismissTask( key ),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
} );
|
|
|
|
|
|
|
|
recordEvent( 'tasklist_dismiss_task', { task_name: key } );
|
|
|
|
|
|
|
|
updateOptions( {
|
|
|
|
woocommerce_task_list_dismissed_tasks: [ ...dismissedTasks, key ],
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
undoDismissTask( key ) {
|
|
|
|
const { dismissedTasks, updateOptions } = this.props;
|
|
|
|
|
|
|
|
const updatedDismissedTasks = dismissedTasks.filter(
|
|
|
|
( task ) => task !== key
|
|
|
|
);
|
|
|
|
|
|
|
|
updateOptions( {
|
|
|
|
woocommerce_task_list_dismissed_tasks: updatedDismissedTasks,
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
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' );
|
|
|
|
}
|
|
|
|
|
2020-07-20 06:19:01 +00:00
|
|
|
getAllTasks() {
|
2020-05-25 00:26:08 +00:00
|
|
|
const {
|
2020-07-14 01:40:56 +00:00
|
|
|
activePlugins,
|
2020-08-24 13:20:57 +00:00
|
|
|
countryCode,
|
2020-07-14 01:40:56 +00:00
|
|
|
createNotice,
|
2020-08-24 13:20:57 +00:00
|
|
|
installAndActivatePlugins,
|
|
|
|
installedPlugins,
|
2020-07-14 01:40:56 +00:00
|
|
|
isJetpackConnected,
|
2020-08-24 13:20:57 +00:00
|
|
|
onboardingStatus,
|
|
|
|
profileItems,
|
|
|
|
query,
|
2020-05-25 00:26:08 +00:00
|
|
|
} = this.props;
|
2019-12-31 08:50:45 +00:00
|
|
|
|
|
|
|
return getAllTasks( {
|
2020-08-24 13:20:57 +00:00
|
|
|
activePlugins,
|
2020-08-03 08:22:25 +00:00
|
|
|
countryCode,
|
2020-08-24 13:20:57 +00:00
|
|
|
createNotice,
|
|
|
|
installAndActivatePlugins,
|
|
|
|
installedPlugins,
|
|
|
|
isJetpackConnected,
|
|
|
|
onboardingStatus,
|
2019-12-31 08:50:45 +00:00
|
|
|
profileItems,
|
2020-02-14 02:23:21 +00:00
|
|
|
query,
|
2019-12-31 08:50:45 +00:00
|
|
|
toggleCartModal: this.toggleCartModal.bind( this ),
|
2020-07-20 06:19:01 +00:00
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
getVisibleTasks() {
|
|
|
|
const { dismissedTasks } = this.props;
|
|
|
|
|
|
|
|
return this.getAllTasks().filter(
|
2020-07-14 10:46:25 +00:00
|
|
|
( task ) => task.visible && ! dismissedTasks.includes( task.key )
|
|
|
|
);
|
2019-12-31 08:50:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-14 01:40:56 +00:00
|
|
|
recordTaskView() {
|
2020-04-16 23:58:36 +00:00
|
|
|
const {
|
|
|
|
isJetpackConnected,
|
|
|
|
activePlugins,
|
|
|
|
installedPlugins,
|
2020-07-14 01:40:56 +00:00
|
|
|
query,
|
2020-04-16 23:58:36 +00:00
|
|
|
} = this.props;
|
2020-07-14 01:40:56 +00:00
|
|
|
const { task: taskName } = query;
|
2020-03-02 22:22:32 +00:00
|
|
|
|
2020-07-14 01:40:56 +00:00
|
|
|
if ( ! taskName ) {
|
2019-10-29 02:08:39 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-07-14 01:40:56 +00:00
|
|
|
recordTaskViewEvent(
|
|
|
|
taskName,
|
|
|
|
isJetpackConnected,
|
|
|
|
activePlugins,
|
|
|
|
installedPlugins
|
|
|
|
);
|
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;
|
2020-07-20 06:19:01 +00:00
|
|
|
const tasks = this.getVisibleTasks();
|
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
|
|
|
hideTaskCard( action ) {
|
|
|
|
recordEvent( 'tasklist_completed', {
|
|
|
|
action,
|
2020-08-24 11:19:36 +00:00
|
|
|
completed_task_count: this.getCompletedTaskKeys().length,
|
|
|
|
incomplete_task_count: this.getIncompleteTasks().length,
|
2019-10-11 12:55:35 +00:00
|
|
|
} );
|
|
|
|
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() {
|
2020-07-20 06:19:01 +00:00
|
|
|
const { query } = this.props;
|
2020-07-15 02:09:49 +00:00
|
|
|
const { task } = query;
|
2020-07-20 06:19:01 +00:00
|
|
|
const currentTask = this.getAllTasks().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-03-28 06:09:44 +00:00
|
|
|
render() {
|
2020-05-27 16:08:39 +00:00
|
|
|
const { query } = this.props;
|
2020-08-05 00:14:56 +00:00
|
|
|
const { isCartModalOpen } = this.state;
|
2019-07-19 02:54:38 +00:00
|
|
|
const currentTask = this.getCurrentTask();
|
2020-07-20 06:19:01 +00:00
|
|
|
const listTasks = this.getVisibleTasks().map( ( task ) => {
|
2020-02-14 02:23:21 +00:00
|
|
|
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-06-19 00:13:41 +00:00
|
|
|
task.title = (
|
2020-06-24 22:14:44 +00:00
|
|
|
<Text
|
|
|
|
as="div"
|
|
|
|
variant={ task.completed ? 'body.small' : 'button' }
|
|
|
|
>
|
|
|
|
{ task.title }
|
2020-09-03 02:28:31 +00:00
|
|
|
{ task.additionalInfo && (
|
|
|
|
<div
|
|
|
|
className="woocommerce-task__additional-info"
|
|
|
|
dangerouslySetInnerHTML={ sanitizeHTML(
|
|
|
|
task.additionalInfo
|
|
|
|
) }
|
|
|
|
></div>
|
|
|
|
) }
|
2020-07-14 10:46:25 +00:00
|
|
|
{ task.time && ! task.completed && (
|
2020-09-03 02:28:31 +00:00
|
|
|
<div className="woocommerce-task__estimated-time">
|
2020-07-14 10:46:25 +00:00
|
|
|
{ task.time }
|
2020-09-03 02:28:31 +00:00
|
|
|
</div>
|
2020-07-14 10:46:25 +00:00
|
|
|
) }
|
2020-06-24 22:14:44 +00:00
|
|
|
</Text>
|
2020-06-19 00:13:41 +00:00
|
|
|
);
|
|
|
|
|
2020-09-11 06:09:17 +00:00
|
|
|
if ( ! task.completed && task.isDismissable ) {
|
|
|
|
task.after = (
|
2020-07-14 10:46:25 +00:00
|
|
|
<Button
|
2020-09-11 06:09:17 +00:00
|
|
|
data-testid={ `${ task.key }-dismiss-button` }
|
2020-07-14 10:46:25 +00:00
|
|
|
isTertiary
|
|
|
|
onClick={ ( event ) => {
|
|
|
|
event.stopPropagation();
|
|
|
|
this.dismissTask( task.key );
|
|
|
|
} }
|
|
|
|
>
|
|
|
|
{ __( 'Dismiss', 'woocommerce-admin' ) }
|
|
|
|
</Button>
|
2020-05-27 16:08:39 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-10-29 18:03:07 +00:00
|
|
|
if ( ! task.onClick ) {
|
2020-09-03 02:28:31 +00:00
|
|
|
task.onClick = ( e ) => {
|
|
|
|
if ( e.target.nodeName === 'A' ) {
|
|
|
|
// This is a nested link, so don't activate this task.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
updateQueryString( { task: task.key } );
|
|
|
|
};
|
2019-10-29 18:03:07 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 12:55:35 +00:00
|
|
|
return task;
|
|
|
|
} );
|
2020-05-27 16:08:39 +00:00
|
|
|
const progressBarClass = classNames(
|
|
|
|
'woocommerce-task-card__progress-bar',
|
|
|
|
{
|
2020-07-28 02:32:58 +00:00
|
|
|
completed:
|
|
|
|
listTasks.length === this.getCompletedTaskKeys().length,
|
2020-05-27 16:08:39 +00:00
|
|
|
}
|
|
|
|
);
|
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"
|
2020-06-24 22:14:44 +00:00
|
|
|
className="woocommerce-task-card woocommerce-dashboard-card"
|
2019-10-11 12:55:35 +00:00
|
|
|
>
|
2020-05-27 16:08:39 +00:00
|
|
|
<progress
|
|
|
|
className={ progressBarClass }
|
|
|
|
max={ listTasks.length }
|
2020-07-20 06:19:01 +00:00
|
|
|
value={ this.getCompletedTaskKeys().length }
|
2020-05-27 16:08:39 +00:00
|
|
|
/>
|
2020-06-18 23:44:00 +00:00
|
|
|
<CardHeader size="medium">
|
|
|
|
<Text variant="title.small">
|
2020-05-27 16:08:39 +00:00
|
|
|
{ __(
|
2020-06-09 02:06:35 +00:00
|
|
|
'Finish setup',
|
2020-05-27 16:08:39 +00:00
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2020-06-18 23:44:00 +00:00
|
|
|
</Text>
|
2020-05-27 16:08:39 +00:00
|
|
|
{ this.renderMenu() }
|
|
|
|
</CardHeader>
|
|
|
|
<CardBody>
|
|
|
|
<List items={ listTasks } />
|
|
|
|
</CardBody>
|
2019-10-11 12:55:35 +00:00
|
|
|
</Card>
|
|
|
|
</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-07-20 06:19:01 +00:00
|
|
|
withSelect( ( select ) => {
|
2020-08-24 13:20:57 +00:00
|
|
|
const { getProfileItems, getTasksStatus } = select(
|
|
|
|
ONBOARDING_STORE_NAME
|
|
|
|
);
|
2020-06-10 23:49:27 +00:00
|
|
|
const { getOption } = select( OPTIONS_STORE_NAME );
|
2020-08-03 08:22:25 +00:00
|
|
|
const { getSettings } = select( SETTINGS_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-07-20 06:19:01 +00:00
|
|
|
const isTaskListComplete =
|
2020-09-29 15:24:39 +00:00
|
|
|
getOption( 'woocommerce_task_list_complete' ) === 'yes';
|
2020-06-10 23:49:27 +00:00
|
|
|
const trackedCompletedTasks =
|
|
|
|
getOption( 'woocommerce_task_list_tracked_completed_tasks' ) || [];
|
2020-07-14 10:46:25 +00:00
|
|
|
const dismissedTasks =
|
|
|
|
getOption( 'woocommerce_task_list_dismissed_tasks' ) || [];
|
2020-06-10 23:49:27 +00:00
|
|
|
|
2020-08-03 08:22:25 +00:00
|
|
|
const { general: generalSettings = {} } = getSettings( 'general' );
|
|
|
|
const countryCode = getCountryCode(
|
|
|
|
generalSettings.woocommerce_default_country
|
|
|
|
);
|
|
|
|
|
2020-07-14 01:40:56 +00:00
|
|
|
const activePlugins = getActivePlugins();
|
2020-05-25 00:26:08 +00:00
|
|
|
const installedPlugins = getInstalledPlugins();
|
2020-08-24 13:20:57 +00:00
|
|
|
const onboardingStatus = getTasksStatus();
|
2019-10-11 12:55:35 +00:00
|
|
|
|
|
|
|
return {
|
2020-07-20 06:19:01 +00:00
|
|
|
activePlugins,
|
2020-08-03 08:22:25 +00:00
|
|
|
countryCode,
|
2020-07-14 10:46:25 +00:00
|
|
|
dismissedTasks,
|
2020-07-20 06:19:01 +00:00
|
|
|
isJetpackConnected: isJetpackConnected(),
|
|
|
|
installedPlugins,
|
|
|
|
isTaskListComplete,
|
2020-08-24 13:20:57 +00:00
|
|
|
onboardingStatus,
|
2019-10-11 12:55:35 +00:00
|
|
|
profileItems,
|
2020-03-23 20:47:12 +00:00
|
|
|
trackedCompletedTasks,
|
2019-10-11 12:55:35 +00:00
|
|
|
};
|
|
|
|
} ),
|
2020-02-14 02:23:21 +00:00
|
|
|
withDispatch( ( dispatch ) => {
|
2020-07-14 10:46:25 +00:00
|
|
|
const { createNotice } = dispatch( 'core/notices' );
|
2020-06-10 23:49:27 +00:00
|
|
|
const { updateOptions } = dispatch( OPTIONS_STORE_NAME );
|
2020-07-14 01:40:56 +00:00
|
|
|
const { installAndActivatePlugins } = dispatch( PLUGINS_STORE_NAME );
|
|
|
|
|
2019-10-11 12:55:35 +00:00
|
|
|
return {
|
2020-07-14 10:46:25 +00:00
|
|
|
createNotice,
|
2020-07-14 01:40:56 +00:00
|
|
|
installAndActivatePlugins,
|
2020-07-20 06:19:01 +00:00
|
|
|
updateOptions,
|
2019-10-11 12:55:35 +00:00
|
|
|
};
|
2019-08-01 18:09:08 +00:00
|
|
|
} )
|
|
|
|
)( TaskDashboard );
|