2019-09-02 03:45:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* External dependencies
|
|
|
|
|
*/
|
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2019-09-06 02:06:29 +00:00
|
|
|
|
import apiFetch from '@wordpress/api-fetch';
|
2019-12-02 17:39:22 +00:00
|
|
|
|
import { Button } from '@wordpress/components';
|
2019-09-02 03:45:56 +00:00
|
|
|
|
import { Component, Fragment } from '@wordpress/element';
|
|
|
|
|
import { compose } from '@wordpress/compose';
|
2020-06-10 23:49:27 +00:00
|
|
|
|
import { filter } from 'lodash';
|
|
|
|
|
import { withDispatch, withSelect } from '@wordpress/data';
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
|
import {
|
|
|
|
|
Card,
|
|
|
|
|
Stepper,
|
|
|
|
|
TextControl,
|
|
|
|
|
ImageUpload,
|
|
|
|
|
} from '@woocommerce/components';
|
2019-09-02 03:45:56 +00:00
|
|
|
|
import { getHistory, getNewPath } from '@woocommerce/navigation';
|
2019-10-07 11:51:25 +00:00
|
|
|
|
import { getSetting, setSetting } from '@woocommerce/wc-admin-settings';
|
2020-06-10 23:49:27 +00:00
|
|
|
|
import { OPTIONS_STORE_NAME } from '@woocommerce/data';
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Internal dependencies
|
|
|
|
|
*/
|
2020-08-13 02:05:22 +00:00
|
|
|
|
import { queueRecordEvent, recordEvent } from '../../lib/tracks';
|
|
|
|
|
import { WC_ADMIN_NAMESPACE } from '../../wc-api/constants';
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
|
|
|
|
class Appearance extends Component {
|
|
|
|
|
constructor( props ) {
|
|
|
|
|
super( props );
|
2019-10-07 11:51:25 +00:00
|
|
|
|
const { hasHomepage, hasProducts } = getSetting( 'onboarding', {} );
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
2019-09-06 02:06:29 +00:00
|
|
|
|
this.stepVisibility = {
|
2019-10-07 11:51:25 +00:00
|
|
|
|
homepage: ! hasHomepage,
|
|
|
|
|
import: ! hasProducts,
|
2019-09-06 02:06:29 +00:00
|
|
|
|
};
|
|
|
|
|
|
2019-09-02 03:45:56 +00:00
|
|
|
|
this.state = {
|
2020-01-09 02:05:03 +00:00
|
|
|
|
isDirty: false,
|
2019-09-06 02:06:29 +00:00
|
|
|
|
isPending: false,
|
2019-09-02 03:45:56 +00:00
|
|
|
|
logo: null,
|
|
|
|
|
stepIndex: 0,
|
2020-06-10 23:49:27 +00:00
|
|
|
|
isUpdatingLogo: false,
|
|
|
|
|
isUpdatingNotice: false,
|
|
|
|
|
storeNoticeText: props.demoStoreNotice || '',
|
2019-09-02 03:45:56 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.completeStep = this.completeStep.bind( this );
|
2019-09-06 14:18:44 +00:00
|
|
|
|
this.createHomepage = this.createHomepage.bind( this );
|
2019-09-06 02:06:29 +00:00
|
|
|
|
this.importProducts = this.importProducts.bind( this );
|
2019-09-02 03:45:56 +00:00
|
|
|
|
this.updateLogo = this.updateLogo.bind( this );
|
|
|
|
|
this.updateNotice = this.updateNotice.bind( this );
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-10 04:08:44 +00:00
|
|
|
|
componentDidMount() {
|
|
|
|
|
const { themeMods } = getSetting( 'onboarding', {} );
|
|
|
|
|
|
|
|
|
|
if ( themeMods.custom_logo ) {
|
|
|
|
|
/* eslint-disable react/no-did-mount-set-state */
|
|
|
|
|
this.setState( { logo: { id: themeMods.custom_logo } } );
|
|
|
|
|
/* eslint-enable react/no-did-mount-set-state */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-10 23:49:27 +00:00
|
|
|
|
componentDidUpdate( prevProps ) {
|
|
|
|
|
const { isPending, logo } = this.state;
|
|
|
|
|
const { demoStoreNotice } = this.props;
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
2019-12-10 04:08:44 +00:00
|
|
|
|
if ( logo && ! logo.url && ! isPending ) {
|
2019-09-02 03:45:56 +00:00
|
|
|
|
/* eslint-disable react/no-did-update-set-state */
|
2019-11-27 02:59:40 +00:00
|
|
|
|
this.setState( { isPending: true } );
|
|
|
|
|
wp.media
|
2019-12-10 04:08:44 +00:00
|
|
|
|
.attachment( logo.id )
|
2019-11-27 02:59:40 +00:00
|
|
|
|
.fetch()
|
|
|
|
|
.then( () => {
|
2019-12-10 04:08:44 +00:00
|
|
|
|
const logoUrl = wp.media.attachment( logo.id ).get( 'url' );
|
2019-11-27 02:59:40 +00:00
|
|
|
|
this.setState( {
|
|
|
|
|
isPending: false,
|
2019-12-10 04:08:44 +00:00
|
|
|
|
logo: { id: logo.id, url: logoUrl },
|
2019-11-27 02:59:40 +00:00
|
|
|
|
} );
|
|
|
|
|
} );
|
2019-09-02 03:45:56 +00:00
|
|
|
|
/* eslint-enable react/no-did-update-set-state */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (
|
2020-06-10 23:49:27 +00:00
|
|
|
|
demoStoreNotice &&
|
|
|
|
|
prevProps.demoStoreNotice !== demoStoreNotice
|
2019-09-02 03:45:56 +00:00
|
|
|
|
) {
|
|
|
|
|
/* eslint-disable react/no-did-update-set-state */
|
2020-02-14 02:23:21 +00:00
|
|
|
|
this.setState( {
|
2020-06-10 23:49:27 +00:00
|
|
|
|
storeNoticeText: demoStoreNotice,
|
2020-02-14 02:23:21 +00:00
|
|
|
|
} );
|
2019-09-02 03:45:56 +00:00
|
|
|
|
/* eslint-enable react/no-did-update-set-state */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
completeStep() {
|
|
|
|
|
const { stepIndex } = this.state;
|
|
|
|
|
const nextStep = this.getSteps()[ stepIndex + 1 ];
|
|
|
|
|
|
|
|
|
|
if ( nextStep ) {
|
|
|
|
|
this.setState( { stepIndex: stepIndex + 1 } );
|
|
|
|
|
} else {
|
|
|
|
|
getHistory().push( getNewPath( {}, '/', {} ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-06 02:06:29 +00:00
|
|
|
|
importProducts() {
|
|
|
|
|
const { createNotice } = this.props;
|
|
|
|
|
this.setState( { isPending: true } );
|
|
|
|
|
|
2019-10-29 02:08:39 +00:00
|
|
|
|
recordEvent( 'tasklist_appearance_import_demo', {} );
|
|
|
|
|
|
2019-09-06 14:18:44 +00:00
|
|
|
|
apiFetch( {
|
|
|
|
|
path: `${ WC_ADMIN_NAMESPACE }/onboarding/tasks/import_sample_products`,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
} )
|
2020-02-14 02:23:21 +00:00
|
|
|
|
.then( ( result ) => {
|
2019-09-06 02:06:29 +00:00
|
|
|
|
if ( result.failed && result.failed.length ) {
|
|
|
|
|
createNotice(
|
|
|
|
|
'error',
|
2020-02-14 02:23:21 +00:00
|
|
|
|
__(
|
2020-04-24 10:23:45 +00:00
|
|
|
|
'There was an error importing some of the sample products.',
|
2020-02-14 02:23:21 +00:00
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
)
|
2019-09-06 02:06:29 +00:00
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
createNotice(
|
|
|
|
|
'success',
|
2020-02-14 02:23:21 +00:00
|
|
|
|
__(
|
2020-04-24 10:23:45 +00:00
|
|
|
|
'All sample products have been imported.',
|
2020-02-14 02:23:21 +00:00
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
)
|
2019-09-06 02:06:29 +00:00
|
|
|
|
);
|
2019-10-07 11:51:25 +00:00
|
|
|
|
setSetting( 'onboarding', {
|
|
|
|
|
...getSetting( 'onboarding', {} ),
|
|
|
|
|
hasProducts: true,
|
|
|
|
|
} );
|
2019-09-06 02:06:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState( { isPending: false } );
|
|
|
|
|
this.completeStep();
|
|
|
|
|
} )
|
2020-02-14 02:23:21 +00:00
|
|
|
|
.catch( ( error ) => {
|
2019-09-06 02:06:29 +00:00
|
|
|
|
createNotice( 'error', error.message );
|
|
|
|
|
this.setState( { isPending: false } );
|
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-06 14:18:44 +00:00
|
|
|
|
createHomepage() {
|
|
|
|
|
const { createNotice } = this.props;
|
|
|
|
|
this.setState( { isPending: true } );
|
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
|
recordEvent( 'tasklist_appearance_create_homepage', {
|
|
|
|
|
create_homepage: true,
|
|
|
|
|
} );
|
2019-10-07 20:27:34 +00:00
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
|
apiFetch( {
|
|
|
|
|
path: '/wc-admin/onboarding/tasks/create_homepage',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
} )
|
2020-05-21 17:15:08 +00:00
|
|
|
|
.then( ( response ) => {
|
2020-03-02 22:22:32 +00:00
|
|
|
|
createNotice( response.status, response.message, {
|
|
|
|
|
actions: response.edit_post_link
|
|
|
|
|
? [
|
|
|
|
|
{
|
2020-05-21 17:15:08 +00:00
|
|
|
|
label: __(
|
|
|
|
|
'Customize',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
),
|
2020-03-02 22:22:32 +00:00
|
|
|
|
onClick: () => {
|
2020-05-21 17:15:08 +00:00
|
|
|
|
queueRecordEvent(
|
|
|
|
|
'tasklist_appearance_customize_homepage',
|
|
|
|
|
{}
|
|
|
|
|
);
|
|
|
|
|
window.location = `${ response.edit_post_link }&wc_onboarding_active_task=homepage`;
|
2020-03-02 22:22:32 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2020-05-21 17:15:08 +00:00
|
|
|
|
]
|
2020-03-02 22:22:32 +00:00
|
|
|
|
: null,
|
|
|
|
|
} );
|
2019-09-06 14:18:44 +00:00
|
|
|
|
|
|
|
|
|
this.setState( { isPending: false } );
|
2020-03-02 22:22:32 +00:00
|
|
|
|
this.completeStep();
|
2019-09-06 14:18:44 +00:00
|
|
|
|
} )
|
2020-02-14 02:23:21 +00:00
|
|
|
|
.catch( ( error ) => {
|
2019-09-06 14:18:44 +00:00
|
|
|
|
createNotice( 'error', error.message );
|
|
|
|
|
this.setState( { isPending: false } );
|
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-10 23:49:27 +00:00
|
|
|
|
async updateLogo() {
|
|
|
|
|
const { updateOptions, createNotice } = this.props;
|
2019-09-02 03:45:56 +00:00
|
|
|
|
const { logo } = this.state;
|
2019-12-10 04:08:44 +00:00
|
|
|
|
const { stylesheet, themeMods } = getSetting( 'onboarding', {} );
|
2020-02-14 02:23:21 +00:00
|
|
|
|
const updatedThemeMods = {
|
|
|
|
|
...themeMods,
|
|
|
|
|
custom_logo: logo ? logo.id : null,
|
|
|
|
|
};
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
2019-10-07 20:27:34 +00:00
|
|
|
|
recordEvent( 'tasklist_appearance_upload_logo' );
|
|
|
|
|
|
2019-12-10 04:08:44 +00:00
|
|
|
|
setSetting( 'onboarding', {
|
|
|
|
|
...getSetting( 'onboarding', {} ),
|
|
|
|
|
themeMods: updatedThemeMods,
|
|
|
|
|
} );
|
|
|
|
|
|
2020-06-10 23:49:27 +00:00
|
|
|
|
this.setState( { isUpdatingLogo: true } );
|
|
|
|
|
const update = await updateOptions( {
|
2019-12-10 04:08:44 +00:00
|
|
|
|
[ `theme_mods_${ stylesheet }` ]: updatedThemeMods,
|
2019-09-02 03:45:56 +00:00
|
|
|
|
} );
|
2020-06-10 23:49:27 +00:00
|
|
|
|
|
|
|
|
|
if ( update.success ) {
|
|
|
|
|
this.setState( { isUpdatingLogo: false } );
|
|
|
|
|
createNotice(
|
|
|
|
|
'success',
|
|
|
|
|
__( 'Store logo updated sucessfully.', 'woocommerce-admin' )
|
|
|
|
|
);
|
|
|
|
|
this.completeStep();
|
|
|
|
|
} else {
|
|
|
|
|
createNotice( 'error', update.message );
|
|
|
|
|
}
|
2019-09-02 03:45:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-10 23:49:27 +00:00
|
|
|
|
async updateNotice() {
|
|
|
|
|
const { updateOptions, createNotice } = this.props;
|
2019-09-02 03:45:56 +00:00
|
|
|
|
const { storeNoticeText } = this.state;
|
|
|
|
|
|
2019-10-07 20:27:34 +00:00
|
|
|
|
recordEvent( 'tasklist_appearance_set_store_notice', {
|
|
|
|
|
added_text: Boolean( storeNoticeText.length ),
|
|
|
|
|
} );
|
|
|
|
|
|
2020-01-09 02:05:03 +00:00
|
|
|
|
setSetting( 'onboarding', {
|
|
|
|
|
...getSetting( 'onboarding', {} ),
|
|
|
|
|
isAppearanceComplete: true,
|
|
|
|
|
} );
|
|
|
|
|
|
2020-06-10 23:49:27 +00:00
|
|
|
|
this.setState( { isUpdatingNotice: true } );
|
|
|
|
|
const update = await updateOptions( {
|
2020-01-09 02:05:03 +00:00
|
|
|
|
woocommerce_task_list_appearance_complete: true,
|
2019-09-02 03:45:56 +00:00
|
|
|
|
woocommerce_demo_store: storeNoticeText.length ? 'yes' : 'no',
|
|
|
|
|
woocommerce_demo_store_notice: storeNoticeText,
|
|
|
|
|
} );
|
2020-06-10 23:49:27 +00:00
|
|
|
|
|
|
|
|
|
if ( update.success ) {
|
|
|
|
|
this.setState( { isUpdatingNotice: false } );
|
|
|
|
|
createNotice(
|
|
|
|
|
'success',
|
|
|
|
|
__(
|
|
|
|
|
"🎨 Your store is looking great! Don't forget to continue personalizing it.",
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
this.completeStep();
|
|
|
|
|
} else {
|
|
|
|
|
createNotice( 'error', update.message );
|
|
|
|
|
}
|
2019-09-02 03:45:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getSteps() {
|
2020-06-10 23:49:27 +00:00
|
|
|
|
const {
|
|
|
|
|
isDirty,
|
|
|
|
|
isPending,
|
|
|
|
|
logo,
|
|
|
|
|
storeNoticeText,
|
|
|
|
|
isUpdatingLogo,
|
|
|
|
|
} = this.state;
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
|
|
|
|
const steps = [
|
|
|
|
|
{
|
|
|
|
|
key: 'import',
|
2020-04-24 10:23:45 +00:00
|
|
|
|
label: __( 'Import sample products', 'woocommerce-admin' ),
|
2019-09-02 03:45:56 +00:00
|
|
|
|
description: __(
|
2019-10-29 18:15:36 +00:00
|
|
|
|
'We’ll add some products that will make it easier to see what your store looks like',
|
2019-09-02 03:45:56 +00:00
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
),
|
|
|
|
|
content: (
|
|
|
|
|
<Fragment>
|
2020-02-14 02:23:21 +00:00
|
|
|
|
<Button
|
|
|
|
|
onClick={ this.importProducts }
|
|
|
|
|
isBusy={ isPending }
|
|
|
|
|
isPrimary
|
|
|
|
|
>
|
2019-09-06 02:06:29 +00:00
|
|
|
|
{ __( 'Import products', 'woocommerce-admin' ) }
|
|
|
|
|
</Button>
|
2019-09-02 03:45:56 +00:00
|
|
|
|
<Button onClick={ () => this.completeStep() }>
|
|
|
|
|
{ __( 'Skip', 'woocommerce-admin' ) }
|
|
|
|
|
</Button>
|
|
|
|
|
</Fragment>
|
|
|
|
|
),
|
2019-09-06 02:06:29 +00:00
|
|
|
|
visible: this.stepVisibility.import,
|
2019-09-02 03:45:56 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'homepage',
|
|
|
|
|
label: __( 'Create a custom homepage', 'woocommerce-admin' ),
|
|
|
|
|
description: __(
|
|
|
|
|
'Create a new homepage and customize it to suit your needs',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
),
|
|
|
|
|
content: (
|
|
|
|
|
<Fragment>
|
2020-05-21 17:15:08 +00:00
|
|
|
|
<Button
|
|
|
|
|
isPrimary
|
|
|
|
|
isBusy={ isPending }
|
|
|
|
|
onClick={ this.createHomepage }
|
|
|
|
|
>
|
2019-09-06 14:18:44 +00:00
|
|
|
|
{ __( 'Create homepage', 'woocommerce-admin' ) }
|
|
|
|
|
</Button>
|
2019-10-07 20:27:34 +00:00
|
|
|
|
<Button
|
|
|
|
|
onClick={ () => {
|
2020-02-14 02:23:21 +00:00
|
|
|
|
recordEvent(
|
|
|
|
|
'tasklist_appearance_create_homepage',
|
|
|
|
|
{ create_homepage: false }
|
|
|
|
|
);
|
2019-10-07 20:27:34 +00:00
|
|
|
|
this.completeStep();
|
|
|
|
|
} }
|
|
|
|
|
>
|
2019-09-02 03:45:56 +00:00
|
|
|
|
{ __( 'Skip', 'woocommerce-admin' ) }
|
|
|
|
|
</Button>
|
|
|
|
|
</Fragment>
|
|
|
|
|
),
|
2019-09-06 14:18:44 +00:00
|
|
|
|
visible: this.stepVisibility.homepage,
|
2019-09-02 03:45:56 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'logo',
|
|
|
|
|
label: __( 'Upload a logo', 'woocommerce-admin' ),
|
2020-02-14 02:23:21 +00:00
|
|
|
|
description: __(
|
|
|
|
|
'Ensure your store is on-brand by adding your logo',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
),
|
2019-12-10 04:08:44 +00:00
|
|
|
|
content: isPending ? null : (
|
|
|
|
|
<Fragment>
|
2020-01-09 02:05:03 +00:00
|
|
|
|
<ImageUpload
|
|
|
|
|
image={ logo }
|
2020-02-14 02:23:21 +00:00
|
|
|
|
onChange={ ( image ) =>
|
|
|
|
|
this.setState( { isDirty: true, logo: image } )
|
|
|
|
|
}
|
2020-01-09 02:05:03 +00:00
|
|
|
|
/>
|
|
|
|
|
<Button
|
|
|
|
|
disabled={ ! logo && ! isDirty }
|
|
|
|
|
onClick={ this.updateLogo }
|
2020-06-10 23:49:27 +00:00
|
|
|
|
isBusy={ isUpdatingLogo }
|
2020-01-09 02:05:03 +00:00
|
|
|
|
isPrimary
|
|
|
|
|
>
|
2019-12-10 04:08:44 +00:00
|
|
|
|
{ __( 'Proceed', 'woocommerce-admin' ) }
|
|
|
|
|
</Button>
|
2020-06-16 02:07:06 +00:00
|
|
|
|
<Button
|
|
|
|
|
isTertiary
|
|
|
|
|
onClick={ () => this.completeStep() }
|
|
|
|
|
>
|
2019-12-10 04:08:44 +00:00
|
|
|
|
{ __( 'Skip', 'woocommerce-admin' ) }
|
|
|
|
|
</Button>
|
|
|
|
|
</Fragment>
|
|
|
|
|
),
|
2019-09-06 14:18:44 +00:00
|
|
|
|
visible: true,
|
2019-09-02 03:45:56 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'notice',
|
|
|
|
|
label: __( 'Set a store notice', 'woocommerce-admin' ),
|
|
|
|
|
description: __(
|
|
|
|
|
'Optionally display a prominent notice across all pages of your store',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
),
|
|
|
|
|
content: (
|
|
|
|
|
<Fragment>
|
|
|
|
|
<TextControl
|
2020-02-14 02:23:21 +00:00
|
|
|
|
label={ __(
|
|
|
|
|
'Store notice text',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
) }
|
|
|
|
|
placeholder={ __(
|
|
|
|
|
'Store notice text',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
) }
|
2019-09-02 03:45:56 +00:00
|
|
|
|
value={ storeNoticeText }
|
2020-02-14 02:23:21 +00:00
|
|
|
|
onChange={ ( value ) =>
|
|
|
|
|
this.setState( { storeNoticeText: value } )
|
|
|
|
|
}
|
2019-09-02 03:45:56 +00:00
|
|
|
|
/>
|
|
|
|
|
<Button onClick={ this.updateNotice } isPrimary>
|
|
|
|
|
{ __( 'Complete task', 'woocommerce-admin' ) }
|
|
|
|
|
</Button>
|
|
|
|
|
</Fragment>
|
|
|
|
|
),
|
|
|
|
|
visible: true,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
|
return filter( steps, ( step ) => step.visible );
|
2019-09-02 03:45:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
2020-06-10 23:49:27 +00:00
|
|
|
|
const {
|
|
|
|
|
isPending,
|
|
|
|
|
stepIndex,
|
|
|
|
|
isUpdatingLogo,
|
|
|
|
|
isUpdatingNotice,
|
|
|
|
|
} = this.state;
|
2019-11-27 02:59:40 +00:00
|
|
|
|
const currentStep = this.getSteps()[ stepIndex ].key;
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="woocommerce-task-appearance">
|
|
|
|
|
<Card className="is-narrow">
|
|
|
|
|
<Stepper
|
2020-02-14 02:23:21 +00:00
|
|
|
|
isPending={
|
2020-06-10 23:49:27 +00:00
|
|
|
|
isUpdatingNotice || isUpdatingLogo || isPending
|
2020-02-14 02:23:21 +00:00
|
|
|
|
}
|
2019-09-02 03:45:56 +00:00
|
|
|
|
isVertical
|
2019-11-27 02:59:40 +00:00
|
|
|
|
currentStep={ currentStep }
|
2019-09-02 03:45:56 +00:00
|
|
|
|
steps={ this.getSteps() }
|
|
|
|
|
/>
|
|
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default compose(
|
2020-02-14 02:23:21 +00:00
|
|
|
|
withSelect( ( select ) => {
|
2020-06-10 23:49:27 +00:00
|
|
|
|
const { getOption } = select( OPTIONS_STORE_NAME );
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
2020-06-10 23:49:27 +00:00
|
|
|
|
return {
|
|
|
|
|
demoStoreNotice: getOption( 'woocommerce_demo_store_notice' ),
|
|
|
|
|
};
|
2019-09-02 03:45:56 +00:00
|
|
|
|
} ),
|
2020-02-14 02:23:21 +00:00
|
|
|
|
withDispatch( ( dispatch ) => {
|
2019-09-02 03:45:56 +00:00
|
|
|
|
const { createNotice } = dispatch( 'core/notices' );
|
2020-06-10 23:49:27 +00:00
|
|
|
|
const { updateOptions } = dispatch( OPTIONS_STORE_NAME );
|
2019-09-02 03:45:56 +00:00
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
createNotice,
|
|
|
|
|
updateOptions,
|
|
|
|
|
};
|
|
|
|
|
} )
|
|
|
|
|
)( Appearance );
|