2019-06-26 02:22:44 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __, sprintf } from '@wordpress/i18n';
|
2019-12-30 10:11:50 +00:00
|
|
|
import apiFetch from '@wordpress/api-fetch';
|
2019-06-26 02:22:44 +00:00
|
|
|
import { Component, Fragment } from '@wordpress/element';
|
|
|
|
import { compose } from '@wordpress/compose';
|
|
|
|
import { decodeEntities } from '@wordpress/html-entities';
|
2020-11-18 20:52:24 +00:00
|
|
|
import InfoIcon from 'gridicons/dist/info';
|
2020-09-01 08:47:49 +00:00
|
|
|
import {
|
|
|
|
Button,
|
2020-12-21 19:34:22 +00:00
|
|
|
Card,
|
|
|
|
CardBody,
|
|
|
|
CardFooter,
|
2020-09-01 08:47:49 +00:00
|
|
|
TabPanel,
|
|
|
|
Tooltip,
|
|
|
|
} from '@wordpress/components';
|
2020-09-03 21:45:40 +00:00
|
|
|
import { withDispatch, withSelect } from '@wordpress/data';
|
2020-12-21 19:34:22 +00:00
|
|
|
import { H } from '@woocommerce/components';
|
2020-05-28 08:51:40 +00:00
|
|
|
import { ONBOARDING_STORE_NAME } from '@woocommerce/data';
|
2020-08-20 04:59:52 +00:00
|
|
|
import { recordEvent } from '@woocommerce/tracks';
|
2021-01-07 23:57:09 +00:00
|
|
|
import { Text } from '@woocommerce/experimental';
|
2019-06-26 02:22:44 +00:00
|
|
|
|
|
|
|
/**
|
2019-11-14 14:35:55 +00:00
|
|
|
* Internal dependencies
|
2019-06-26 02:22:44 +00:00
|
|
|
*/
|
|
|
|
import './style.scss';
|
2019-07-08 02:54:26 +00:00
|
|
|
import ThemeUploader from './uploader';
|
2019-08-01 23:27:38 +00:00
|
|
|
import ThemePreview from './preview';
|
2020-08-13 02:05:22 +00:00
|
|
|
import { getPriceValue } from '../../../dashboard/utils';
|
2022-01-06 12:53:30 +00:00
|
|
|
import { getAdminSetting, setAdminSetting } from '~/utils/admin-settings';
|
2019-06-26 02:22:44 +00:00
|
|
|
|
|
|
|
class Theme extends Component {
|
|
|
|
constructor() {
|
|
|
|
super( ...arguments );
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
activeTab: 'all',
|
2019-11-01 02:04:54 +00:00
|
|
|
chosen: null,
|
2019-08-01 23:27:38 +00:00
|
|
|
demo: null,
|
2019-07-08 02:54:26 +00:00
|
|
|
uploadedThemes: [],
|
2019-06-26 02:22:44 +00:00
|
|
|
};
|
|
|
|
|
2019-07-08 02:54:26 +00:00
|
|
|
this.handleUploadComplete = this.handleUploadComplete.bind( this );
|
2019-06-26 02:22:44 +00:00
|
|
|
this.onChoose = this.onChoose.bind( this );
|
2019-08-01 23:27:38 +00:00
|
|
|
this.onClosePreview = this.onClosePreview.bind( this );
|
2019-06-26 02:22:44 +00:00
|
|
|
this.onSelectTab = this.onSelectTab.bind( this );
|
|
|
|
this.openDemo = this.openDemo.bind( this );
|
2019-12-31 19:55:00 +00:00
|
|
|
this.skipStep = this.skipStep.bind( this );
|
2019-06-26 02:22:44 +00:00
|
|
|
}
|
|
|
|
|
2019-11-06 14:41:38 +00:00
|
|
|
componentDidUpdate( prevProps ) {
|
2020-05-28 08:51:40 +00:00
|
|
|
const { isError, isUpdatingProfileItems, createNotice } = this.props;
|
2019-11-06 14:41:38 +00:00
|
|
|
const { chosen } = this.state;
|
2019-12-20 12:58:38 +00:00
|
|
|
const isRequestSuccessful =
|
2020-05-28 08:51:40 +00:00
|
|
|
! isUpdatingProfileItems &&
|
|
|
|
prevProps.isUpdatingProfileItems &&
|
2020-02-14 02:23:21 +00:00
|
|
|
! isError &&
|
|
|
|
chosen;
|
|
|
|
const isRequestError =
|
2020-05-28 08:51:40 +00:00
|
|
|
! isUpdatingProfileItems && prevProps.isRequesting && isError;
|
2019-11-06 14:41:38 +00:00
|
|
|
|
2019-12-20 12:58:38 +00:00
|
|
|
if ( isRequestSuccessful ) {
|
|
|
|
/* eslint-disable react/no-did-update-set-state */
|
|
|
|
this.setState( { chosen: null } );
|
|
|
|
/* eslint-enable react/no-did-update-set-state */
|
|
|
|
this.props.goToNextStep();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( isRequestError ) {
|
|
|
|
/* eslint-disable react/no-did-update-set-state */
|
|
|
|
this.setState( { chosen: null } );
|
|
|
|
/* eslint-enable react/no-did-update-set-state */
|
|
|
|
createNotice(
|
|
|
|
'error',
|
2020-02-14 02:23:21 +00:00
|
|
|
__(
|
2021-02-10 23:57:51 +00:00
|
|
|
'There was a problem selecting your store theme',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-02-14 02:23:21 +00:00
|
|
|
)
|
2019-12-20 12:58:38 +00:00
|
|
|
);
|
2019-11-06 14:41:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-30 10:11:50 +00:00
|
|
|
onChoose( theme, location = '' ) {
|
2019-11-06 14:41:38 +00:00
|
|
|
const { updateProfileItems } = this.props;
|
2020-04-21 12:13:04 +00:00
|
|
|
const { is_installed: isInstalled, price, slug } = theme;
|
2022-01-06 12:53:30 +00:00
|
|
|
const { activeTheme = '' } = getAdminSetting( 'onboarding', {} );
|
2019-12-30 10:11:50 +00:00
|
|
|
|
|
|
|
this.setState( { chosen: slug } );
|
2020-02-14 02:23:21 +00:00
|
|
|
recordEvent( 'storeprofiler_store_theme_choose', {
|
|
|
|
theme: slug,
|
|
|
|
location,
|
|
|
|
} );
|
2019-12-30 10:11:50 +00:00
|
|
|
|
2022-03-18 19:05:38 +00:00
|
|
|
if ( slug !== activeTheme && isInstalled ) {
|
|
|
|
this.activateTheme( slug );
|
|
|
|
} else if ( slug !== activeTheme && getPriceValue( price ) <= 0 ) {
|
|
|
|
this.installTheme( slug );
|
2019-12-30 10:11:50 +00:00
|
|
|
} else {
|
|
|
|
updateProfileItems( { theme: slug } );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
installTheme( slug ) {
|
|
|
|
const { createNotice } = this.props;
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
apiFetch( {
|
|
|
|
path: '/wc-admin/onboarding/themes/install?theme=' + slug,
|
|
|
|
method: 'POST',
|
|
|
|
} )
|
2022-02-01 17:02:33 +00:00
|
|
|
.then( () => {
|
2019-12-30 10:11:50 +00:00
|
|
|
this.activateTheme( slug );
|
|
|
|
} )
|
2020-02-14 02:23:21 +00:00
|
|
|
.catch( ( response ) => {
|
2019-12-30 10:11:50 +00:00
|
|
|
this.setState( { chosen: null } );
|
|
|
|
createNotice( 'error', response.message );
|
|
|
|
} );
|
|
|
|
}
|
2019-06-26 02:22:44 +00:00
|
|
|
|
2019-12-30 10:11:50 +00:00
|
|
|
activateTheme( slug ) {
|
|
|
|
const { createNotice, updateProfileItems } = this.props;
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
apiFetch( {
|
|
|
|
path: '/wc-admin/onboarding/themes/activate?theme=' + slug,
|
|
|
|
method: 'POST',
|
|
|
|
} )
|
|
|
|
.then( ( response ) => {
|
2019-12-30 10:11:50 +00:00
|
|
|
createNotice(
|
|
|
|
'success',
|
|
|
|
sprintf(
|
2022-02-01 17:02:33 +00:00
|
|
|
/* translators: The name of the theme that was installed and activated */
|
2020-02-14 02:23:21 +00:00
|
|
|
__(
|
2022-02-01 17:02:33 +00:00
|
|
|
'%s was installed and activated on your site',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-02-14 02:23:21 +00:00
|
|
|
),
|
2019-12-30 10:11:50 +00:00
|
|
|
response.name
|
|
|
|
)
|
|
|
|
);
|
2022-01-06 12:53:30 +00:00
|
|
|
setAdminSetting( 'onboarding', {
|
|
|
|
...getAdminSetting( 'onboarding', {} ),
|
2019-12-30 10:11:50 +00:00
|
|
|
activeTheme: response.slug,
|
|
|
|
} );
|
|
|
|
updateProfileItems( { theme: slug } );
|
|
|
|
} )
|
2020-02-14 02:23:21 +00:00
|
|
|
.catch( ( response ) => {
|
2019-12-30 10:11:50 +00:00
|
|
|
this.setState( { chosen: null } );
|
|
|
|
createNotice( 'error', response.message );
|
|
|
|
} );
|
2019-06-26 02:22:44 +00:00
|
|
|
}
|
|
|
|
|
2019-08-01 23:27:38 +00:00
|
|
|
onClosePreview() {
|
|
|
|
const { demo } = this.state;
|
2020-02-14 02:23:21 +00:00
|
|
|
recordEvent( 'storeprofiler_store_theme_demo_close', {
|
|
|
|
theme: demo.slug,
|
|
|
|
} );
|
2019-08-01 23:27:38 +00:00
|
|
|
document.body.classList.remove( 'woocommerce-theme-preview-active' );
|
|
|
|
this.setState( { demo: null } );
|
|
|
|
}
|
2019-07-01 18:13:29 +00:00
|
|
|
|
2019-08-01 23:27:38 +00:00
|
|
|
openDemo( theme ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
recordEvent( 'storeprofiler_store_theme_live_demo', {
|
|
|
|
theme: theme.slug,
|
|
|
|
} );
|
2019-08-01 23:27:38 +00:00
|
|
|
document.body.classList.add( 'woocommerce-theme-preview-active' );
|
|
|
|
this.setState( { demo: theme } );
|
2019-06-26 02:22:44 +00:00
|
|
|
}
|
|
|
|
|
2019-12-31 19:55:00 +00:00
|
|
|
skipStep() {
|
2022-01-06 12:53:30 +00:00
|
|
|
const { activeTheme = '' } = getAdminSetting( 'onboarding', {} );
|
2019-12-31 19:55:00 +00:00
|
|
|
recordEvent( 'storeprofiler_store_theme_skip_step', { activeTheme } );
|
|
|
|
this.props.goToNextStep();
|
|
|
|
}
|
|
|
|
|
2019-06-26 02:22:44 +00:00
|
|
|
renderTheme( theme ) {
|
2020-04-21 12:13:04 +00:00
|
|
|
const {
|
|
|
|
demo_url: demoUrl,
|
|
|
|
has_woocommerce_support: hasSupport,
|
|
|
|
image,
|
|
|
|
slug,
|
|
|
|
title,
|
|
|
|
} = theme;
|
2019-11-01 02:04:54 +00:00
|
|
|
const { chosen } = this.state;
|
2022-01-06 12:53:30 +00:00
|
|
|
const { activeTheme = '' } = getAdminSetting( 'onboarding', {} );
|
2019-06-26 02:22:44 +00:00
|
|
|
|
|
|
|
return (
|
2020-06-15 22:32:36 +00:00
|
|
|
<Card className="woocommerce-profile-wizard__theme" key={ slug }>
|
2020-12-21 19:34:22 +00:00
|
|
|
<CardBody size={ null }>
|
|
|
|
{ image && (
|
|
|
|
<div
|
|
|
|
className="woocommerce-profile-wizard__theme-image"
|
|
|
|
style={ { backgroundImage: `url(${ image })` } }
|
|
|
|
role="img"
|
|
|
|
aria-label={ title }
|
|
|
|
/>
|
|
|
|
) }
|
|
|
|
</CardBody>
|
|
|
|
<CardBody className="woocommerce-profile-wizard__theme-details">
|
2019-06-28 07:42:20 +00:00
|
|
|
<H className="woocommerce-profile-wizard__theme-name">
|
|
|
|
{ title }
|
2020-02-14 02:23:21 +00:00
|
|
|
{ ! hasSupport && (
|
2019-06-28 07:42:20 +00:00
|
|
|
<Tooltip
|
2020-02-14 02:23:21 +00:00
|
|
|
text={ __(
|
|
|
|
'This theme does not support WooCommerce.',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-02-14 02:23:21 +00:00
|
|
|
) }
|
2019-06-28 07:42:20 +00:00
|
|
|
>
|
|
|
|
<span>
|
2020-11-18 20:52:24 +00:00
|
|
|
<InfoIcon
|
2020-02-14 02:23:21 +00:00
|
|
|
role="img"
|
|
|
|
aria-hidden="true"
|
|
|
|
focusable="false"
|
|
|
|
/>
|
2019-06-28 07:42:20 +00:00
|
|
|
</span>
|
|
|
|
</Tooltip>
|
|
|
|
) }
|
|
|
|
</H>
|
|
|
|
<p className="woocommerce-profile-wizard__theme-status">
|
|
|
|
{ this.getThemeStatus( theme ) }
|
2019-06-26 02:22:44 +00:00
|
|
|
</p>
|
2020-12-21 19:34:22 +00:00
|
|
|
</CardBody>
|
|
|
|
<CardFooter>
|
|
|
|
{ slug === activeTheme ? (
|
|
|
|
<Button
|
|
|
|
isPrimary
|
|
|
|
onClick={ () => this.onChoose( theme, 'card' ) }
|
|
|
|
isBusy={ chosen === slug }
|
|
|
|
disabled={ chosen === slug }
|
|
|
|
>
|
|
|
|
{ __(
|
|
|
|
'Continue with my active theme',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-12-21 19:34:22 +00:00
|
|
|
) }
|
|
|
|
</Button>
|
|
|
|
) : (
|
|
|
|
<Button
|
|
|
|
isSecondary
|
|
|
|
onClick={ () => this.onChoose( theme, 'card' ) }
|
|
|
|
isBusy={ chosen === slug }
|
|
|
|
disabled={ chosen === slug }
|
|
|
|
>
|
2022-03-30 09:00:04 +00:00
|
|
|
{ __( 'Choose', 'woocommerce' ) }
|
2020-12-21 19:34:22 +00:00
|
|
|
</Button>
|
|
|
|
) }
|
|
|
|
{ demoUrl && (
|
|
|
|
<Button
|
|
|
|
isTertiary
|
|
|
|
onClick={ () => this.openDemo( theme ) }
|
|
|
|
>
|
2022-03-30 09:00:04 +00:00
|
|
|
{ __( 'Live demo', 'woocommerce' ) }
|
2020-12-21 19:34:22 +00:00
|
|
|
</Button>
|
|
|
|
) }
|
|
|
|
</CardFooter>
|
2019-06-26 02:22:44 +00:00
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-06-28 07:42:20 +00:00
|
|
|
getThemeStatus( theme ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
const { is_installed: isInstalled, price, slug } = theme;
|
2022-01-06 12:53:30 +00:00
|
|
|
const { activeTheme = '' } = getAdminSetting( 'onboarding', {} );
|
2019-06-28 07:42:20 +00:00
|
|
|
|
|
|
|
if ( activeTheme === slug ) {
|
2022-03-30 09:00:04 +00:00
|
|
|
return __( 'Currently active theme', 'woocommerce' );
|
2019-06-28 07:42:20 +00:00
|
|
|
}
|
2020-02-14 02:23:21 +00:00
|
|
|
if ( isInstalled ) {
|
2022-03-30 09:00:04 +00:00
|
|
|
return __( 'Installed', 'woocommerce' );
|
2019-12-30 10:11:50 +00:00
|
|
|
} else if ( getPriceValue( price ) <= 0 ) {
|
2022-03-30 09:00:04 +00:00
|
|
|
return __( 'Free', 'woocommerce' );
|
2019-06-28 07:42:20 +00:00
|
|
|
}
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
return sprintf(
|
2022-03-30 09:00:04 +00:00
|
|
|
__( '%s per year', 'woocommerce' ),
|
2020-02-14 02:23:21 +00:00
|
|
|
decodeEntities( price )
|
|
|
|
);
|
2019-06-28 07:42:20 +00:00
|
|
|
}
|
|
|
|
|
2019-12-31 19:55:00 +00:00
|
|
|
doesActiveThemeSupportWooCommerce() {
|
2022-01-06 12:53:30 +00:00
|
|
|
const { activeTheme = '' } = getAdminSetting( 'onboarding', {} );
|
2019-12-31 19:55:00 +00:00
|
|
|
const allThemes = this.getThemes();
|
2020-02-14 02:23:21 +00:00
|
|
|
const currentTheme = allThemes.find(
|
|
|
|
( theme ) => theme.slug === activeTheme
|
|
|
|
);
|
2019-12-31 19:55:00 +00:00
|
|
|
return currentTheme && currentTheme.has_woocommerce_support;
|
|
|
|
}
|
|
|
|
|
2019-06-26 02:22:44 +00:00
|
|
|
onSelectTab( tab ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
recordEvent( 'storeprofiler_store_theme_navigate', {
|
|
|
|
navigation: tab,
|
|
|
|
} );
|
2019-06-26 02:22:44 +00:00
|
|
|
this.setState( { activeTab: tab } );
|
|
|
|
}
|
|
|
|
|
|
|
|
getPriceValue( string ) {
|
|
|
|
return Number( decodeEntities( string ).replace( /[^0-9.-]+/g, '' ) );
|
|
|
|
}
|
|
|
|
|
2019-12-31 19:55:00 +00:00
|
|
|
getThemes( activeTab = 'all' ) {
|
|
|
|
const { uploadedThemes } = this.state;
|
2022-01-06 12:53:30 +00:00
|
|
|
const { activeTheme = '', themes = [] } = getAdminSetting(
|
2020-02-14 02:23:21 +00:00
|
|
|
'onboarding',
|
|
|
|
{}
|
|
|
|
);
|
2020-01-24 02:11:36 +00:00
|
|
|
const allThemes = [
|
2020-02-14 02:23:21 +00:00
|
|
|
...themes.filter(
|
|
|
|
( theme ) =>
|
2020-05-08 07:12:37 +00:00
|
|
|
theme &&
|
|
|
|
( theme.has_woocommerce_support ||
|
|
|
|
theme.slug === activeTheme )
|
2020-02-14 02:23:21 +00:00
|
|
|
),
|
2020-01-24 02:11:36 +00:00
|
|
|
...uploadedThemes,
|
|
|
|
];
|
2019-06-26 02:22:44 +00:00
|
|
|
|
|
|
|
switch ( activeTab ) {
|
|
|
|
case 'paid':
|
2020-02-14 02:23:21 +00:00
|
|
|
return allThemes.filter(
|
|
|
|
( theme ) => getPriceValue( theme.price ) > 0
|
|
|
|
);
|
2019-06-26 02:22:44 +00:00
|
|
|
case 'free':
|
2020-02-14 02:23:21 +00:00
|
|
|
return allThemes.filter(
|
|
|
|
( theme ) => getPriceValue( theme.price ) <= 0
|
|
|
|
);
|
2019-06-26 02:22:44 +00:00
|
|
|
case 'all':
|
|
|
|
default:
|
2019-07-08 02:54:26 +00:00
|
|
|
return allThemes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
handleUploadComplete( upload ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
if ( upload.status === 'success' && upload.theme_data ) {
|
2019-07-08 02:54:26 +00:00
|
|
|
this.setState( {
|
2020-02-14 02:23:21 +00:00
|
|
|
uploadedThemes: [
|
|
|
|
...this.state.uploadedThemes,
|
|
|
|
upload.theme_data,
|
|
|
|
],
|
2019-07-08 02:54:26 +00:00
|
|
|
} );
|
2019-08-01 23:27:38 +00:00
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
recordEvent( 'storeprofiler_store_theme_upload', {
|
|
|
|
theme: upload.theme_data.slug,
|
|
|
|
} );
|
2019-06-26 02:22:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2019-12-31 19:55:00 +00:00
|
|
|
const { activeTab, chosen, demo } = this.state;
|
|
|
|
const themes = this.getThemes( activeTab );
|
2022-06-21 08:37:34 +00:00
|
|
|
const activeThemeSupportsWooCommerce =
|
|
|
|
this.doesActiveThemeSupportWooCommerce();
|
2019-06-26 02:22:44 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Fragment>
|
2020-09-01 08:47:49 +00:00
|
|
|
<div className="woocommerce-profile-wizard__step-header">
|
2021-06-28 01:14:59 +00:00
|
|
|
<Text
|
|
|
|
variant="title.small"
|
|
|
|
as="h2"
|
|
|
|
size="20"
|
|
|
|
lineHeight="28px"
|
|
|
|
>
|
2022-03-30 09:00:04 +00:00
|
|
|
{ __( 'Choose a theme', 'woocommerce' ) }
|
2020-09-01 08:47:49 +00:00
|
|
|
</Text>
|
2021-06-28 01:14:59 +00:00
|
|
|
<Text variant="body" as="p">
|
2020-09-01 08:47:49 +00:00
|
|
|
{ __(
|
|
|
|
"Choose how your store appears to customers. And don't worry, you can always switch themes and edit them later.",
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2020-09-01 08:47:49 +00:00
|
|
|
) }
|
|
|
|
</Text>
|
|
|
|
</div>
|
2019-06-26 02:22:44 +00:00
|
|
|
<TabPanel
|
|
|
|
className="woocommerce-profile-wizard__themes-tab-panel"
|
|
|
|
activeClass="is-active"
|
|
|
|
onSelect={ this.onSelectTab }
|
|
|
|
tabs={ [
|
|
|
|
{
|
|
|
|
name: 'all',
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'All themes', 'woocommerce' ),
|
2019-06-26 02:22:44 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'paid',
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Paid themes', 'woocommerce' ),
|
2019-06-26 02:22:44 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'free',
|
2022-03-30 09:00:04 +00:00
|
|
|
title: __( 'Free themes', 'woocommerce' ),
|
2019-06-26 02:22:44 +00:00
|
|
|
},
|
|
|
|
] }
|
|
|
|
>
|
|
|
|
{ () => (
|
|
|
|
<div className="woocommerce-profile-wizard__themes">
|
2020-02-14 02:23:21 +00:00
|
|
|
{ themes &&
|
|
|
|
themes.map( ( theme ) =>
|
|
|
|
this.renderTheme( theme )
|
|
|
|
) }
|
|
|
|
<ThemeUploader
|
|
|
|
onUploadComplete={ this.handleUploadComplete }
|
|
|
|
/>
|
2019-06-26 02:22:44 +00:00
|
|
|
</div>
|
|
|
|
) }
|
|
|
|
</TabPanel>
|
2019-08-01 23:27:38 +00:00
|
|
|
{ demo && (
|
2019-11-01 02:04:54 +00:00
|
|
|
<ThemePreview
|
|
|
|
theme={ demo }
|
2020-06-15 22:32:36 +00:00
|
|
|
onChoose={ () => this.onChoose( demo, 'card' ) }
|
2019-11-01 02:04:54 +00:00
|
|
|
onClose={ this.onClosePreview }
|
|
|
|
isBusy={ chosen === demo.slug }
|
|
|
|
/>
|
2019-08-01 23:27:38 +00:00
|
|
|
) }
|
2019-12-31 19:55:00 +00:00
|
|
|
{ activeThemeSupportsWooCommerce && (
|
2020-07-22 23:37:40 +00:00
|
|
|
<p className="woocommerce-profile-wizard__themes-skip-this-step">
|
2019-12-31 19:55:00 +00:00
|
|
|
<Button
|
|
|
|
isLink
|
|
|
|
className="woocommerce-profile-wizard__skip"
|
|
|
|
onClick={ () => this.skipStep() }
|
|
|
|
>
|
2022-03-30 09:00:04 +00:00
|
|
|
{ __( 'Skip this step', 'woocommerce' ) }
|
2019-12-31 19:55:00 +00:00
|
|
|
</Button>
|
|
|
|
</p>
|
|
|
|
) }
|
2019-06-26 02:22:44 +00:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default compose(
|
2020-02-14 02:23:21 +00:00
|
|
|
withSelect( ( select ) => {
|
2022-06-21 08:37:34 +00:00
|
|
|
const { getProfileItems, getOnboardingError, isOnboardingRequesting } =
|
|
|
|
select( ONBOARDING_STORE_NAME );
|
2019-06-26 02:22:44 +00:00
|
|
|
|
2019-11-01 02:04:54 +00:00
|
|
|
return {
|
2020-05-28 08:51:40 +00:00
|
|
|
isError: Boolean( getOnboardingError( 'updateProfileItems' ) ),
|
2022-06-21 08:37:34 +00:00
|
|
|
isUpdatingProfileItems:
|
|
|
|
isOnboardingRequesting( 'updateProfileItems' ),
|
2019-11-01 02:04:54 +00:00
|
|
|
profileItems: getProfileItems(),
|
|
|
|
};
|
2019-06-26 02:22:44 +00:00
|
|
|
} ),
|
2020-02-14 02:23:21 +00:00
|
|
|
withDispatch( ( dispatch ) => {
|
2020-05-28 08:51:40 +00:00
|
|
|
const { updateProfileItems } = dispatch( ONBOARDING_STORE_NAME );
|
2019-07-23 03:26:46 +00:00
|
|
|
const { createNotice } = dispatch( 'core/notices' );
|
2019-06-26 02:22:44 +00:00
|
|
|
|
|
|
|
return {
|
2019-07-23 03:26:46 +00:00
|
|
|
createNotice,
|
2019-06-26 02:22:44 +00:00
|
|
|
updateProfileItems,
|
|
|
|
};
|
|
|
|
} )
|
|
|
|
)( Theme );
|