2019-06-12 03:56:10 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2020-01-06 15:16:38 +00:00
|
|
|
import { __, _n, _x, sprintf } from '@wordpress/i18n';
|
2019-06-12 03:56:10 +00:00
|
|
|
import { Component, Fragment } from '@wordpress/element';
|
|
|
|
import { compose } from '@wordpress/compose';
|
2020-07-01 12:20:24 +00:00
|
|
|
import {
|
|
|
|
Button,
|
2020-12-21 19:34:22 +00:00
|
|
|
Card,
|
|
|
|
CardBody,
|
|
|
|
CardFooter,
|
2020-07-01 12:20:24 +00:00
|
|
|
CheckboxControl,
|
|
|
|
FormToggle,
|
|
|
|
Popover,
|
2020-09-01 08:47:49 +00:00
|
|
|
__experimentalText as Text,
|
2020-07-01 12:20:24 +00:00
|
|
|
} from '@wordpress/components';
|
|
|
|
import interpolateComponents from 'interpolate-components';
|
2020-03-25 03:20:17 +00:00
|
|
|
import { withDispatch, withSelect } from '@wordpress/data';
|
2019-11-05 00:05:20 +00:00
|
|
|
import { keys, get, pickBy } from 'lodash';
|
2020-08-13 02:05:22 +00:00
|
|
|
import {
|
|
|
|
H,
|
2020-09-03 23:35:06 +00:00
|
|
|
Link,
|
2020-08-13 02:05:22 +00:00
|
|
|
SelectControl,
|
|
|
|
Form,
|
|
|
|
TextControl,
|
|
|
|
} from '@woocommerce/components';
|
2020-04-02 21:54:38 +00:00
|
|
|
import { formatValue } from '@woocommerce/number';
|
|
|
|
import { getSetting } from '@woocommerce/wc-admin-settings';
|
2020-06-12 06:38:33 +00:00
|
|
|
import {
|
|
|
|
ONBOARDING_STORE_NAME,
|
|
|
|
PLUGINS_STORE_NAME,
|
|
|
|
pluginNames,
|
|
|
|
SETTINGS_STORE_NAME,
|
2020-12-29 21:21:24 +00:00
|
|
|
OPTIONS_STORE_NAME,
|
2020-06-12 06:38:33 +00:00
|
|
|
} from '@woocommerce/data';
|
2020-08-20 04:59:52 +00:00
|
|
|
import { recordEvent } from '@woocommerce/tracks';
|
2019-06-12 03:56:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2020-08-13 02:05:22 +00:00
|
|
|
import { getCountryCode, getCurrencyRegion } from '../../dashboard/utils';
|
|
|
|
import { CurrencyContext } from '../../lib/currency-context';
|
|
|
|
import { createNoticesFromResponse } from '../../lib/notices';
|
2019-06-12 03:56:10 +00:00
|
|
|
|
2019-09-23 21:47:08 +00:00
|
|
|
const wcAdminAssetUrl = getSetting( 'wcAdminAssetUrl', '' );
|
|
|
|
|
2019-06-12 03:56:10 +00:00
|
|
|
class BusinessDetails extends Component {
|
2019-11-05 00:05:20 +00:00
|
|
|
constructor( props ) {
|
2019-06-12 03:56:10 +00:00
|
|
|
super();
|
2020-07-15 14:52:21 +00:00
|
|
|
const settings = get( props, 'settings', {} );
|
2019-11-05 00:05:20 +00:00
|
|
|
const profileItems = get( props, 'profileItems', {} );
|
2020-07-15 14:52:21 +00:00
|
|
|
const industrySlugs = get( profileItems, 'industry', [] ).map(
|
|
|
|
( industry ) => industry.slug
|
|
|
|
);
|
2020-02-14 02:23:21 +00:00
|
|
|
const businessExtensions = get(
|
|
|
|
profileItems,
|
|
|
|
'business_extensions',
|
|
|
|
false
|
|
|
|
);
|
2019-06-12 03:56:10 +00:00
|
|
|
|
2020-07-01 12:20:24 +00:00
|
|
|
this.state = {
|
|
|
|
isPopoverVisible: false,
|
|
|
|
};
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
this.initialValues = {
|
2019-11-05 00:05:20 +00:00
|
|
|
other_platform: profileItems.other_platform || '',
|
2020-03-06 19:20:54 +00:00
|
|
|
other_platform_name: profileItems.other_platform_name || '',
|
2019-11-05 00:05:20 +00:00
|
|
|
product_count: profileItems.product_count || '',
|
|
|
|
selling_venues: profileItems.selling_venues || '',
|
|
|
|
revenue: profileItems.revenue || '',
|
|
|
|
'facebook-for-woocommerce': businessExtensions
|
|
|
|
? businessExtensions.includes( 'facebook-for-woocommerce' )
|
|
|
|
: true,
|
|
|
|
'mailchimp-for-woocommerce': businessExtensions
|
|
|
|
? businessExtensions.includes( 'mailchimp-for-woocommerce' )
|
|
|
|
: true,
|
2020-11-06 00:55:44 +00:00
|
|
|
'creative-mail-by-constant-contact': businessExtensions
|
|
|
|
? businessExtensions.includes(
|
|
|
|
'creative-mail-by-constant-contact'
|
|
|
|
)
|
|
|
|
: true,
|
2020-03-16 06:12:30 +00:00
|
|
|
'kliken-marketing-for-google': businessExtensions
|
|
|
|
? businessExtensions.includes( 'kliken-marketing-for-google' )
|
|
|
|
: true,
|
2020-07-01 12:20:24 +00:00
|
|
|
install_extensions: true,
|
2019-06-12 03:56:10 +00:00
|
|
|
};
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
this.extensions = [
|
|
|
|
'facebook-for-woocommerce',
|
|
|
|
'mailchimp-for-woocommerce',
|
2020-03-16 06:12:30 +00:00
|
|
|
'kliken-marketing-for-google',
|
2020-11-06 00:55:44 +00:00
|
|
|
'creative-mail-by-constant-contact',
|
2020-02-14 02:23:21 +00:00
|
|
|
];
|
2019-08-08 05:25:55 +00:00
|
|
|
|
2020-07-15 14:52:21 +00:00
|
|
|
this.bundleInstall =
|
|
|
|
getCountryCode( settings.woocommerce_default_country ) === 'US' &&
|
|
|
|
( industrySlugs.includes( 'fashion-apparel-accessories' ) ||
|
2020-08-26 16:15:02 +00:00
|
|
|
industrySlugs.includes( 'health-beauty' ) ) &&
|
|
|
|
! industrySlugs.includes( 'cbd-other-hemp-derived-products' );
|
2019-06-12 03:56:10 +00:00
|
|
|
this.onContinue = this.onContinue.bind( this );
|
2019-08-08 05:25:55 +00:00
|
|
|
this.validate = this.validate.bind( this );
|
2020-04-07 18:08:17 +00:00
|
|
|
this.getNumberRangeString = this.getNumberRangeString.bind( this );
|
|
|
|
this.numberFormat = this.numberFormat.bind( this );
|
2019-06-12 03:56:10 +00:00
|
|
|
}
|
|
|
|
|
2020-12-29 21:21:24 +00:00
|
|
|
onCreativeMailInstallAndActivated() {
|
|
|
|
const { updateOptions } = this.props;
|
|
|
|
updateOptions( {
|
|
|
|
ce4wp_referred_by: {
|
|
|
|
plugin: 'woocommerce',
|
|
|
|
version: getSetting( 'wcVersion' ),
|
|
|
|
time: Math.floor( new Date().getTime() / 1000 ),
|
|
|
|
source: 'onboarding',
|
|
|
|
},
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
onPostInstallAndActivePlugins( response ) {
|
|
|
|
const activated = response.data.activated;
|
|
|
|
if ( activated.includes( 'creative-mail-by-constant-contact' ) ) {
|
|
|
|
this.onCreativeMailInstallAndActivated();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
async onContinue( values ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
const {
|
|
|
|
createNotice,
|
|
|
|
goToNextStep,
|
2020-06-12 06:38:33 +00:00
|
|
|
installAndActivatePlugins,
|
2020-02-14 02:23:21 +00:00
|
|
|
updateProfileItems,
|
|
|
|
} = this.props;
|
|
|
|
const {
|
2020-07-01 12:20:24 +00:00
|
|
|
install_extensions: installExtensions,
|
2020-02-14 02:23:21 +00:00
|
|
|
other_platform: otherPlatform,
|
2020-03-06 19:20:54 +00:00
|
|
|
other_platform_name: otherPlatformName,
|
2020-02-14 02:23:21 +00:00
|
|
|
product_count: productCount,
|
|
|
|
revenue,
|
|
|
|
selling_venues: sellingVenues,
|
|
|
|
} = values;
|
2019-08-08 05:25:55 +00:00
|
|
|
const businessExtensions = this.getBusinessExtensions( values );
|
2020-06-17 23:33:40 +00:00
|
|
|
const { getCurrencyConfig } = this.context;
|
2019-06-12 03:56:10 +00:00
|
|
|
|
2019-07-01 18:13:29 +00:00
|
|
|
recordEvent( 'storeprofiler_store_business_details_continue', {
|
2020-02-14 02:23:21 +00:00
|
|
|
product_number: productCount,
|
2020-03-09 11:39:38 +00:00
|
|
|
already_selling: sellingVenues,
|
2020-06-17 23:33:40 +00:00
|
|
|
currency: getCurrencyConfig().code,
|
2019-08-08 15:38:47 +00:00
|
|
|
revenue,
|
2020-02-14 02:23:21 +00:00
|
|
|
used_platform: otherPlatform,
|
2020-03-06 19:20:54 +00:00
|
|
|
used_platform_name: otherPlatformName,
|
2020-07-01 12:20:24 +00:00
|
|
|
install_woocommerce_services: businessExtensions.includes(
|
2020-11-13 20:31:18 +00:00
|
|
|
'woocommerce-services'
|
2020-07-01 12:20:24 +00:00
|
|
|
),
|
|
|
|
install_jetpack: businessExtensions.includes( 'jetpack' ),
|
|
|
|
install_facebook: businessExtensions.includes(
|
|
|
|
'facebook-for-woocommerce'
|
|
|
|
),
|
|
|
|
install_mailchimp: businessExtensions.includes(
|
|
|
|
'mailchimp-for-woocommerce'
|
|
|
|
),
|
2020-11-06 00:55:44 +00:00
|
|
|
install_creative_mail: businessExtensions.includes(
|
|
|
|
'creative-mail-by-constant-contact'
|
|
|
|
),
|
2020-07-01 12:20:24 +00:00
|
|
|
install_google_ads: businessExtensions.includes(
|
|
|
|
'kliken-marketing-for-google'
|
|
|
|
),
|
|
|
|
install_extensions: installExtensions,
|
|
|
|
bundle_install: this.bundleInstall,
|
2019-07-01 18:13:29 +00:00
|
|
|
} );
|
|
|
|
|
2019-08-08 15:38:47 +00:00
|
|
|
const _updates = {
|
2020-02-14 02:23:21 +00:00
|
|
|
other_platform: otherPlatform,
|
2020-03-06 19:20:54 +00:00
|
|
|
other_platform_name:
|
|
|
|
otherPlatform === 'other' ? otherPlatformName : '',
|
2020-02-14 02:23:21 +00:00
|
|
|
product_count: productCount,
|
2019-08-08 15:38:47 +00:00
|
|
|
revenue,
|
2020-02-14 02:23:21 +00:00
|
|
|
selling_venues: sellingVenues,
|
2019-07-15 11:09:31 +00:00
|
|
|
business_extensions: businessExtensions,
|
2019-08-08 15:38:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Remove possible empty values like `revenue` and `other_platform`.
|
|
|
|
const updates = {};
|
2020-02-14 02:23:21 +00:00
|
|
|
Object.keys( _updates ).forEach( ( key ) => {
|
2019-08-08 15:38:47 +00:00
|
|
|
if ( _updates[ key ] !== '' ) {
|
|
|
|
updates[ key ] = _updates[ key ];
|
|
|
|
}
|
2019-07-04 15:56:28 +00:00
|
|
|
} );
|
2019-06-12 03:56:10 +00:00
|
|
|
|
2020-06-12 06:38:33 +00:00
|
|
|
const promises = [
|
|
|
|
updateProfileItems( updates ).catch( () => {
|
|
|
|
throw new Error();
|
|
|
|
} ),
|
|
|
|
];
|
2019-10-23 15:17:38 +00:00
|
|
|
|
2020-06-12 06:38:33 +00:00
|
|
|
if ( businessExtensions.length ) {
|
|
|
|
promises.push(
|
|
|
|
installAndActivatePlugins( businessExtensions )
|
|
|
|
.then( ( response ) => {
|
|
|
|
createNoticesFromResponse( response );
|
2020-12-29 21:21:24 +00:00
|
|
|
this.onPostInstallAndActivePlugins( response );
|
2020-06-12 06:38:33 +00:00
|
|
|
} )
|
|
|
|
.catch( ( error ) => {
|
|
|
|
createNoticesFromResponse( error );
|
|
|
|
throw new Error();
|
|
|
|
} )
|
2019-07-23 03:26:46 +00:00
|
|
|
);
|
2019-06-12 03:56:10 +00:00
|
|
|
}
|
2020-06-12 06:38:33 +00:00
|
|
|
|
2020-07-15 14:52:21 +00:00
|
|
|
Promise.all( promises )
|
|
|
|
.then( () => {
|
|
|
|
goToNextStep();
|
|
|
|
} )
|
|
|
|
.catch( () => {
|
|
|
|
createNotice(
|
|
|
|
'error',
|
|
|
|
__(
|
|
|
|
'There was a problem updating your business details.',
|
|
|
|
'woocommerce-admin'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
} );
|
2019-06-12 03:56:10 +00:00
|
|
|
}
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
validate( values ) {
|
|
|
|
const errors = {};
|
|
|
|
|
2020-07-01 12:20:24 +00:00
|
|
|
if ( ! values.product_count.length ) {
|
|
|
|
errors.product_count = __(
|
|
|
|
'This field is required',
|
|
|
|
'woocommerce-admin'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! values.selling_venues.length ) {
|
|
|
|
errors.selling_venues = __(
|
|
|
|
'This field is required',
|
|
|
|
'woocommerce-admin'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
! values.other_platform.length &&
|
|
|
|
[ 'other', 'brick-mortar-other' ].includes( values.selling_venues )
|
|
|
|
) {
|
|
|
|
errors.other_platform = __(
|
|
|
|
'This field is required',
|
|
|
|
'woocommerce-admin'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
! values.other_platform_name &&
|
|
|
|
values.other_platform === 'other' &&
|
|
|
|
[ 'other', 'brick-mortar-other' ].includes( values.selling_venues )
|
|
|
|
) {
|
|
|
|
errors.other_platform_name = __(
|
|
|
|
'This field is required',
|
|
|
|
'woocommerce-admin'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
! values.revenue.length &&
|
|
|
|
[
|
|
|
|
'other',
|
|
|
|
'brick-mortar',
|
|
|
|
'brick-mortar-other',
|
|
|
|
'other-woocommerce',
|
|
|
|
].includes( values.selling_venues )
|
|
|
|
) {
|
|
|
|
errors.revenue = __(
|
|
|
|
'This field is required',
|
|
|
|
'woocommerce-admin'
|
|
|
|
);
|
|
|
|
}
|
2019-07-15 11:09:31 +00:00
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
return errors;
|
2019-07-15 11:09:31 +00:00
|
|
|
}
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
getBusinessExtensions( values ) {
|
2020-07-01 12:20:24 +00:00
|
|
|
if ( this.bundleInstall ) {
|
|
|
|
return values.install_extensions
|
|
|
|
? [
|
|
|
|
'jetpack',
|
|
|
|
'woocommerce-services',
|
|
|
|
'woocommerce-payments',
|
|
|
|
...this.extensions,
|
|
|
|
]
|
|
|
|
: [];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( values.selling_venues === '' ) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
return keys( pickBy( values ) ).filter( ( name ) =>
|
|
|
|
this.extensions.includes( name )
|
|
|
|
);
|
2019-06-12 03:56:10 +00:00
|
|
|
}
|
|
|
|
|
2019-12-10 19:01:21 +00:00
|
|
|
convertCurrency( value ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
const region = getCurrencyRegion(
|
|
|
|
this.props.settings.woocommerce_default_country
|
|
|
|
);
|
|
|
|
if ( region === 'US' ) {
|
2019-12-10 19:01:21 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
// These are rough exchange rates from USD. Precision is not paramount.
|
|
|
|
// The keys here should match the keys in `getCurrencyData`.
|
|
|
|
const exchangeRates = {
|
|
|
|
US: 1,
|
|
|
|
EU: 0.9,
|
|
|
|
IN: 71.24,
|
|
|
|
GB: 0.76,
|
|
|
|
BR: 4.19,
|
|
|
|
VN: 23172.5,
|
|
|
|
ID: 14031.0,
|
|
|
|
BD: 84.87,
|
|
|
|
PK: 154.8,
|
|
|
|
RU: 63.74,
|
|
|
|
TR: 5.75,
|
|
|
|
MX: 19.37,
|
|
|
|
CA: 1.32,
|
|
|
|
};
|
|
|
|
|
|
|
|
const exchangeRate = exchangeRates[ region ] || exchangeRates.US;
|
|
|
|
const digits = exchangeRate.toString().split( '.' )[ 0 ].length;
|
|
|
|
const multiplier = Math.pow( 10, 2 + digits );
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
return Math.round( ( value * exchangeRate ) / multiplier ) * multiplier;
|
2019-12-10 19:01:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
numberFormat( value ) {
|
2020-06-17 23:33:40 +00:00
|
|
|
const { getCurrencyConfig } = this.context;
|
|
|
|
return formatValue( getCurrencyConfig(), 'number', value );
|
2019-12-10 19:01:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
getNumberRangeString( min, max = false, format = this.numberFormat ) {
|
2019-06-12 03:56:10 +00:00
|
|
|
if ( ! max ) {
|
2019-10-21 00:48:30 +00:00
|
|
|
return sprintf(
|
2020-02-14 02:23:21 +00:00
|
|
|
_x(
|
|
|
|
'%s+',
|
|
|
|
'store product count or revenue',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
2019-12-10 19:01:21 +00:00
|
|
|
format( min )
|
2019-10-21 00:48:30 +00:00
|
|
|
);
|
2019-06-12 03:56:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return sprintf(
|
2020-02-14 02:23:21 +00:00
|
|
|
_x(
|
|
|
|
'%1$s - %2$s',
|
|
|
|
'store product count or revenue range',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
2019-12-10 19:01:21 +00:00
|
|
|
format( min ),
|
|
|
|
format( max )
|
2019-06-12 03:56:10 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
renderBusinessExtensionHelpText( values ) {
|
2020-06-12 06:38:33 +00:00
|
|
|
const { isInstallingActivating } = this.props;
|
2019-08-08 05:25:55 +00:00
|
|
|
const extensions = this.getBusinessExtensions( values );
|
2019-07-04 15:56:28 +00:00
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
if ( extensions.length === 0 ) {
|
2019-07-04 15:56:28 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-10-23 15:17:38 +00:00
|
|
|
const extensionsList = extensions
|
2020-02-14 02:23:21 +00:00
|
|
|
.map( ( extension ) => {
|
2019-10-23 15:17:38 +00:00
|
|
|
return pluginNames[ extension ];
|
|
|
|
} )
|
|
|
|
.join( ', ' );
|
|
|
|
|
2020-06-12 06:38:33 +00:00
|
|
|
if ( isInstallingActivating ) {
|
2020-01-06 15:16:38 +00:00
|
|
|
return (
|
2020-09-01 08:47:49 +00:00
|
|
|
<Text variant="caption" as="p">
|
2020-01-06 15:16:38 +00:00
|
|
|
{ sprintf(
|
|
|
|
_n(
|
|
|
|
'Installing the following plugin: %s',
|
|
|
|
'Installing the following plugins: %s',
|
|
|
|
extensions.length,
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
extensionsList
|
|
|
|
) }
|
2020-09-01 08:47:49 +00:00
|
|
|
</Text>
|
2020-01-06 15:16:38 +00:00
|
|
|
);
|
2019-10-23 15:17:38 +00:00
|
|
|
}
|
2020-08-03 22:08:07 +00:00
|
|
|
const accountRequiredText = this.bundleInstall
|
|
|
|
? __(
|
|
|
|
'User accounts are required to use these features.',
|
|
|
|
'woocommerce-admin'
|
|
|
|
)
|
|
|
|
: '';
|
2019-07-04 15:56:28 +00:00
|
|
|
return (
|
2020-09-03 23:35:06 +00:00
|
|
|
<div className="woocommerce-profile-wizard__footnote">
|
|
|
|
<Text variant="caption" as="p">
|
|
|
|
{ sprintf(
|
|
|
|
_n(
|
|
|
|
'The following plugin will be installed for free: %s. %s',
|
|
|
|
'The following plugins will be installed for free: %s. %s',
|
|
|
|
extensions.length,
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
extensionsList,
|
|
|
|
accountRequiredText
|
|
|
|
) }
|
|
|
|
</Text>
|
|
|
|
{ this.bundleInstall && (
|
|
|
|
<Text variant="caption" as="p">
|
|
|
|
{ interpolateComponents( {
|
|
|
|
mixedString: __(
|
2020-09-16 21:45:16 +00:00
|
|
|
'By installing Jetpack and WooCommerce Shipping plugins for free you agree to our {{link}}Terms of Service{{/link}}.',
|
2020-09-03 23:35:06 +00:00
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
components: {
|
|
|
|
link: (
|
|
|
|
<Link
|
|
|
|
href="https://wordpress.com/tos/"
|
|
|
|
target="_blank"
|
|
|
|
type="external"
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
} ) }
|
|
|
|
</Text>
|
2020-09-01 08:47:49 +00:00
|
|
|
) }
|
2020-09-03 23:35:06 +00:00
|
|
|
</div>
|
2019-07-04 15:56:28 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
renderBusinessExtensions( values, getInputProps ) {
|
2020-07-01 12:20:24 +00:00
|
|
|
// Show extensions when the currently selling elsewhere checkbox has been answered.
|
|
|
|
if ( values.selling_venues === '' ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-07-04 15:56:28 +00:00
|
|
|
const extensionBenefits = [
|
|
|
|
{
|
2019-10-23 15:17:38 +00:00
|
|
|
slug: 'facebook-for-woocommerce',
|
2019-07-04 15:56:28 +00:00
|
|
|
title: __( 'Market on Facebook', 'woocommerce-admin' ),
|
2020-03-19 02:11:25 +00:00
|
|
|
icon: 'onboarding/fb-woocommerce.png',
|
2019-07-04 15:56:28 +00:00
|
|
|
description: __(
|
|
|
|
'Grow your business by targeting the right people and driving sales with Facebook.',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
2019-10-23 15:17:38 +00:00
|
|
|
slug: 'mailchimp-for-woocommerce',
|
2020-02-14 02:23:21 +00:00
|
|
|
title: __(
|
|
|
|
'Contact customers with Mailchimp',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
2019-07-04 15:56:28 +00:00
|
|
|
icon: 'onboarding/mailchimp.png',
|
|
|
|
description: __(
|
|
|
|
'Send targeted campaigns, recover abandoned carts and much more with Mailchimp.',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
},
|
2020-11-06 00:55:44 +00:00
|
|
|
{
|
|
|
|
slug: 'creative-mail-by-constant-contact',
|
|
|
|
title: __(
|
|
|
|
'Email marketing for WooCommerce with Creative Mail',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
icon: 'onboarding/creativemail.png',
|
|
|
|
description: __(
|
|
|
|
'Create on-brand store campaigns, fast email promotions and customer retargeting with Creative Mail.',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
},
|
2020-03-16 06:12:30 +00:00
|
|
|
{
|
|
|
|
slug: 'kliken-marketing-for-google',
|
2020-09-02 03:42:04 +00:00
|
|
|
title: __(
|
|
|
|
'Drive traffic to your store with Google Ads & Marketing by Kliken',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
2020-03-19 02:11:25 +00:00
|
|
|
icon: 'onboarding/g-shopping.png',
|
2020-03-16 06:12:30 +00:00
|
|
|
description: __(
|
2020-09-02 03:42:04 +00:00
|
|
|
'Get in front of shoppers and drive traffic so you can grow your business with Smart Shopping Campaigns and free listings.',
|
2020-03-16 06:12:30 +00:00
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
},
|
2019-07-04 15:56:28 +00:00
|
|
|
];
|
2019-08-08 05:25:55 +00:00
|
|
|
|
2019-07-04 15:56:28 +00:00
|
|
|
return (
|
2020-12-21 19:34:22 +00:00
|
|
|
<div>
|
2020-03-16 06:12:30 +00:00
|
|
|
{ extensionBenefits.map( ( benefit ) => (
|
|
|
|
<div
|
|
|
|
className="woocommerce-profile-wizard__benefit"
|
|
|
|
key={ benefit.title }
|
|
|
|
>
|
|
|
|
<div className="woocommerce-profile-wizard__business-extension">
|
|
|
|
<img
|
|
|
|
src={ wcAdminAssetUrl + benefit.icon }
|
|
|
|
alt=""
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-profile-wizard__benefit-content">
|
|
|
|
<H className="woocommerce-profile-wizard__benefit-title">
|
|
|
|
{ benefit.title }
|
|
|
|
</H>
|
|
|
|
<p>{ benefit.description }</p>
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-profile-wizard__benefit-toggle">
|
|
|
|
<FormToggle
|
|
|
|
checked={ values[ benefit.slug ] }
|
|
|
|
{ ...getInputProps( benefit.slug ) }
|
|
|
|
/>
|
2019-07-04 15:56:28 +00:00
|
|
|
</div>
|
2020-03-16 06:12:30 +00:00
|
|
|
</div>
|
|
|
|
) ) }
|
2020-12-21 19:34:22 +00:00
|
|
|
</div>
|
2019-07-04 15:56:28 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-07-01 12:20:24 +00:00
|
|
|
renderBusinessExtensionsBundle( values, getInputProps ) {
|
|
|
|
const { isPopoverVisible } = this.state;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="woocommerce-business-extensions">
|
|
|
|
<label htmlFor="woocommerce-business-extensions__checkbox">
|
|
|
|
<CheckboxControl
|
|
|
|
id="woocommerce-business-extensions__checkbox"
|
|
|
|
{ ...getInputProps( 'install_extensions' ) }
|
|
|
|
/>
|
|
|
|
<span className="woocommerce-business-extensions__label-text">
|
|
|
|
{ interpolateComponents( {
|
|
|
|
mixedString: __(
|
|
|
|
'Install recommended {{strong}}free{{/strong}} business features',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
components: {
|
|
|
|
strong: <strong />,
|
|
|
|
},
|
|
|
|
} ) }
|
|
|
|
<span className="woocommerce-business-extensions__label-subtext">
|
|
|
|
{ __( 'Requires an account', 'woocommerce-admin' ) }
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</label>
|
|
|
|
|
|
|
|
<div className="woocommerce-business-extensions__popover-wrapper">
|
|
|
|
<Button
|
|
|
|
isTertiary
|
2020-07-15 14:52:21 +00:00
|
|
|
label={ __(
|
|
|
|
'Learn more about recommended free business features',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2020-07-01 12:20:24 +00:00
|
|
|
onClick={ () => {
|
|
|
|
recordEvent(
|
|
|
|
'storeprofiler_store_business_details_popover'
|
|
|
|
);
|
|
|
|
this.setState( { isPopoverVisible: true } );
|
|
|
|
} }
|
|
|
|
>
|
2020-07-15 14:52:21 +00:00
|
|
|
<i
|
|
|
|
className="material-icons-outlined"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
|
|
|
info
|
|
|
|
</i>
|
2020-07-01 12:20:24 +00:00
|
|
|
</Button>
|
|
|
|
{ isPopoverVisible && (
|
|
|
|
<Popover
|
|
|
|
className="woocommerce-business-extensions__popover"
|
2020-07-15 14:52:21 +00:00
|
|
|
focusOnMount="container"
|
2020-07-01 12:20:24 +00:00
|
|
|
position="top center"
|
|
|
|
onClose={ () =>
|
|
|
|
this.setState( { isPopoverVisible: false } )
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<div className="woocommerce-business-extensions__benefits">
|
|
|
|
<div className="woocommerce-business-extensions__benefit">
|
2020-07-15 14:52:21 +00:00
|
|
|
<i
|
|
|
|
className="material-icons-outlined"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2020-07-01 12:20:24 +00:00
|
|
|
check
|
|
|
|
</i>
|
|
|
|
{ __(
|
|
|
|
'Manage your store on the go with the WooCommerce mobile app',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-business-extensions__benefit">
|
2020-07-15 14:52:21 +00:00
|
|
|
<i
|
|
|
|
className="material-icons-outlined"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2020-07-01 12:20:24 +00:00
|
|
|
check
|
|
|
|
</i>
|
|
|
|
{ __(
|
|
|
|
'Accept credit cards with WooCommerce Payments',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-business-extensions__benefit">
|
2020-07-15 14:52:21 +00:00
|
|
|
<i
|
|
|
|
className="material-icons-outlined"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2020-07-01 12:20:24 +00:00
|
|
|
check
|
|
|
|
</i>
|
|
|
|
{ __(
|
|
|
|
'Speed & security enhancements',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-business-extensions__benefit">
|
2020-07-15 14:52:21 +00:00
|
|
|
<i
|
|
|
|
className="material-icons-outlined"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2020-07-01 12:20:24 +00:00
|
|
|
check
|
|
|
|
</i>
|
|
|
|
{ __(
|
|
|
|
'Automatic sales taxes',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-business-extensions__benefit">
|
2020-07-15 14:52:21 +00:00
|
|
|
<i
|
|
|
|
className="material-icons-outlined"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2020-07-01 12:20:24 +00:00
|
|
|
check
|
|
|
|
</i>
|
|
|
|
{ __(
|
|
|
|
'Market on Facebook',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-business-extensions__benefit">
|
2020-07-15 14:52:21 +00:00
|
|
|
<i
|
|
|
|
className="material-icons-outlined"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2020-07-01 12:20:24 +00:00
|
|
|
check
|
|
|
|
</i>
|
|
|
|
{ __(
|
|
|
|
'Contact customers with Mailchimp',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-business-extensions__benefit">
|
2020-07-15 14:52:21 +00:00
|
|
|
<i
|
|
|
|
className="material-icons-outlined"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2020-07-01 12:20:24 +00:00
|
|
|
check
|
|
|
|
</i>
|
|
|
|
{ __(
|
|
|
|
'Drive sales with Google Ads',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-business-extensions__benefit">
|
2020-07-15 14:52:21 +00:00
|
|
|
<i
|
|
|
|
className="material-icons-outlined"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2020-07-01 12:20:24 +00:00
|
|
|
check
|
|
|
|
</i>
|
|
|
|
{ __(
|
|
|
|
'Print shipping labels at home',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Popover>
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-06-12 03:56:10 +00:00
|
|
|
render() {
|
2020-06-12 06:38:33 +00:00
|
|
|
const {
|
|
|
|
goToNextStep,
|
|
|
|
isInstallingActivating,
|
|
|
|
hasInstallActivateError,
|
2020-12-01 22:56:17 +00:00
|
|
|
isUpdatingProfileItems,
|
2020-06-12 06:38:33 +00:00
|
|
|
} = this.props;
|
2020-06-17 23:33:40 +00:00
|
|
|
const { formatAmount } = this.context;
|
2019-06-12 03:56:10 +00:00
|
|
|
const productCountOptions = [
|
2019-10-23 23:33:10 +00:00
|
|
|
{
|
|
|
|
key: '0',
|
2020-02-14 02:23:21 +00:00
|
|
|
label: __(
|
|
|
|
"I don't have any products yet.",
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
2019-10-23 23:33:10 +00:00
|
|
|
},
|
2019-06-12 03:56:10 +00:00
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: '1-10',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: this.getNumberRangeString( 1, 10 ),
|
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: '11-100',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: this.getNumberRangeString( 11, 100 ),
|
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: '101-1000',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: this.getNumberRangeString( 101, 1000 ),
|
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: '1000+',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: this.getNumberRangeString( 1000 ),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-08-08 15:38:47 +00:00
|
|
|
const revenueOptions = [
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'none',
|
2019-12-03 23:32:13 +00:00
|
|
|
label: sprintf(
|
|
|
|
/* translators: %s: $0 revenue amount */
|
|
|
|
__( "%s (I'm just getting started)", 'woocommerce-admin' ),
|
2020-06-17 23:33:40 +00:00
|
|
|
formatAmount( 0 )
|
2019-12-03 23:32:13 +00:00
|
|
|
),
|
2019-08-08 15:38:47 +00:00
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'up-to-2500',
|
2019-12-03 23:32:13 +00:00
|
|
|
label: sprintf(
|
|
|
|
/* translators: %s: A given revenue amount, e.g., $2500 */
|
|
|
|
__( 'Up to %s', 'woocommerce-admin' ),
|
2020-06-17 23:33:40 +00:00
|
|
|
formatAmount( this.convertCurrency( 2500 ) )
|
2019-12-03 23:32:13 +00:00
|
|
|
),
|
2019-08-08 15:38:47 +00:00
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: '2500-10000',
|
2019-12-10 19:01:21 +00:00
|
|
|
label: this.getNumberRangeString(
|
|
|
|
this.convertCurrency( 2500 ),
|
|
|
|
this.convertCurrency( 10000 ),
|
2020-06-17 23:33:40 +00:00
|
|
|
formatAmount
|
2019-12-10 19:01:21 +00:00
|
|
|
),
|
2019-08-08 15:38:47 +00:00
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: '10000-50000',
|
2019-12-10 19:01:21 +00:00
|
|
|
label: this.getNumberRangeString(
|
|
|
|
this.convertCurrency( 10000 ),
|
|
|
|
this.convertCurrency( 50000 ),
|
2020-06-17 23:33:40 +00:00
|
|
|
formatAmount
|
2019-12-10 19:01:21 +00:00
|
|
|
),
|
2019-08-08 15:38:47 +00:00
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: '50000-250000',
|
2019-12-10 19:01:21 +00:00
|
|
|
label: this.getNumberRangeString(
|
|
|
|
this.convertCurrency( 50000 ),
|
|
|
|
this.convertCurrency( 250000 ),
|
2020-06-17 23:33:40 +00:00
|
|
|
formatAmount
|
2019-12-10 19:01:21 +00:00
|
|
|
),
|
2019-08-08 15:38:47 +00:00
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'more-than-250000',
|
2019-12-03 23:32:13 +00:00
|
|
|
label: sprintf(
|
|
|
|
/* translators: %s: A given revenue amount, e.g., $250000 */
|
|
|
|
__( 'More than %s', 'woocommerce-admin' ),
|
2020-06-17 23:33:40 +00:00
|
|
|
formatAmount( this.convertCurrency( 250000 ) )
|
2019-08-08 15:38:47 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-06-12 03:56:10 +00:00
|
|
|
const sellingVenueOptions = [
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'no',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: __( 'No', 'woocommerce-admin' ),
|
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'other',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: __( 'Yes, on another platform', 'woocommerce-admin' ),
|
|
|
|
},
|
2019-12-27 16:30:59 +00:00
|
|
|
{
|
|
|
|
key: 'other-woocommerce',
|
2020-02-14 02:23:21 +00:00
|
|
|
label: __(
|
|
|
|
'Yes, I own a different store powered by WooCommerce',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
2019-12-27 16:30:59 +00:00
|
|
|
},
|
2019-06-12 03:56:10 +00:00
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'brick-mortar',
|
2020-02-14 02:23:21 +00:00
|
|
|
label: __(
|
|
|
|
'Yes, in person at physical stores and/or events',
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
2019-06-12 03:56:10 +00:00
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'brick-mortar-other',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: __(
|
2019-08-08 18:41:26 +00:00
|
|
|
'Yes, on another platform and in person at physical stores and/or events',
|
2019-06-12 03:56:10 +00:00
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const otherPlatformOptions = [
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'shopify',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: __( 'Shopify', 'woocommerce-admin' ),
|
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'bigcommerce',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: __( 'BigCommerce', 'woocommerce-admin' ),
|
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'magento',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: __( 'Magento', 'woocommerce-admin' ),
|
|
|
|
},
|
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'wix',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: __( 'Wix', 'woocommerce-admin' ),
|
|
|
|
},
|
2020-03-06 19:20:54 +00:00
|
|
|
{
|
|
|
|
key: 'amazon',
|
|
|
|
label: __( 'Amazon', 'woocommerce-admin' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'ebay',
|
|
|
|
label: __( 'eBay', 'woocommerce-admin' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'etsy',
|
|
|
|
label: __( 'Etsy', 'woocommerce-admin' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'squarespace',
|
|
|
|
label: __( 'Squarespace', 'woocommerce-admin' ),
|
|
|
|
},
|
2019-06-12 03:56:10 +00:00
|
|
|
{
|
2019-10-07 22:42:32 +00:00
|
|
|
key: 'other',
|
2019-06-12 03:56:10 +00:00
|
|
|
label: __( 'Other', 'woocommerce-admin' ),
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
return (
|
2019-08-08 05:25:55 +00:00
|
|
|
<Form
|
|
|
|
initialValues={ this.initialValues }
|
|
|
|
onSubmitCallback={ this.onContinue }
|
|
|
|
validate={ this.validate }
|
|
|
|
>
|
2019-10-04 13:46:27 +00:00
|
|
|
{ ( { getInputProps, handleSubmit, values, isValidForm } ) => {
|
2020-12-21 19:34:22 +00:00
|
|
|
const businessExtensions = this.bundleInstall
|
|
|
|
? this.renderBusinessExtensionsBundle(
|
|
|
|
values,
|
|
|
|
getInputProps
|
|
|
|
)
|
|
|
|
: this.renderBusinessExtensions(
|
|
|
|
values,
|
|
|
|
getInputProps
|
|
|
|
);
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
return (
|
|
|
|
<Fragment>
|
2020-09-01 08:47:49 +00:00
|
|
|
<div className="woocommerce-profile-wizard__step-header">
|
|
|
|
<Text variant="title.small" as="h2">
|
|
|
|
{ __(
|
|
|
|
'Tell us about your business',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</Text>
|
|
|
|
<Text variant="body">
|
|
|
|
{ __(
|
|
|
|
"We'd love to know if you are just getting started or you already have a business in place.",
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</Text>
|
|
|
|
</div>
|
2019-08-08 05:25:55 +00:00
|
|
|
<Card>
|
2020-12-21 19:34:22 +00:00
|
|
|
<CardBody>
|
2019-10-07 22:42:32 +00:00
|
|
|
<SelectControl
|
2020-02-14 02:23:21 +00:00
|
|
|
label={ __(
|
2020-03-06 19:20:54 +00:00
|
|
|
'How many products do you plan to display?',
|
2020-02-14 02:23:21 +00:00
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2019-08-08 05:25:55 +00:00
|
|
|
options={ productCountOptions }
|
|
|
|
required
|
|
|
|
{ ...getInputProps( 'product_count' ) }
|
|
|
|
/>
|
|
|
|
|
2019-10-07 22:42:32 +00:00
|
|
|
<SelectControl
|
2020-02-14 02:23:21 +00:00
|
|
|
label={ __(
|
|
|
|
'Currently selling elsewhere?',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2019-08-08 05:25:55 +00:00
|
|
|
options={ sellingVenueOptions }
|
|
|
|
required
|
|
|
|
{ ...getInputProps( 'selling_venues' ) }
|
|
|
|
/>
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
{ [
|
|
|
|
'other',
|
|
|
|
'brick-mortar',
|
|
|
|
'brick-mortar-other',
|
|
|
|
'other-woocommerce',
|
|
|
|
].includes( values.selling_venues ) && (
|
2019-10-07 22:42:32 +00:00
|
|
|
<SelectControl
|
2020-02-14 02:23:21 +00:00
|
|
|
label={ __(
|
|
|
|
"What's your current annual revenue?",
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2019-08-08 15:38:47 +00:00
|
|
|
options={ revenueOptions }
|
|
|
|
required
|
|
|
|
{ ...getInputProps( 'revenue' ) }
|
|
|
|
/>
|
|
|
|
) }
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
{ [
|
|
|
|
'other',
|
|
|
|
'brick-mortar-other',
|
|
|
|
].includes( values.selling_venues ) && (
|
2020-03-06 19:20:54 +00:00
|
|
|
<Fragment>
|
2020-04-13 14:43:57 +00:00
|
|
|
<div className="business-competitors">
|
|
|
|
<SelectControl
|
2020-03-06 19:20:54 +00:00
|
|
|
label={ __(
|
2020-04-13 14:43:57 +00:00
|
|
|
'Which platform is the store using?',
|
2020-03-06 19:20:54 +00:00
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2020-04-13 14:43:57 +00:00
|
|
|
options={
|
|
|
|
otherPlatformOptions
|
|
|
|
}
|
2020-03-06 19:20:54 +00:00
|
|
|
required
|
|
|
|
{ ...getInputProps(
|
2020-04-13 14:43:57 +00:00
|
|
|
'other_platform'
|
2020-03-06 19:20:54 +00:00
|
|
|
) }
|
|
|
|
/>
|
2020-04-13 14:43:57 +00:00
|
|
|
{ values.other_platform ===
|
|
|
|
'other' && (
|
|
|
|
<TextControl
|
|
|
|
label={ __(
|
|
|
|
'What is the platform name?',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
required
|
|
|
|
{ ...getInputProps(
|
|
|
|
'other_platform_name'
|
|
|
|
) }
|
|
|
|
/>
|
|
|
|
) }
|
|
|
|
</div>
|
2020-03-06 19:20:54 +00:00
|
|
|
</Fragment>
|
2019-08-08 05:25:55 +00:00
|
|
|
) }
|
2020-12-21 19:34:22 +00:00
|
|
|
</CardBody>
|
|
|
|
{ businessExtensions && (
|
|
|
|
<CardFooter>
|
|
|
|
{ businessExtensions }
|
|
|
|
</CardFooter>
|
|
|
|
) }
|
|
|
|
<CardFooter justify="center">
|
|
|
|
<Button
|
|
|
|
isPrimary
|
|
|
|
onClick={ handleSubmit }
|
|
|
|
disabled={
|
|
|
|
! isValidForm ||
|
|
|
|
isUpdatingProfileItems ||
|
|
|
|
isInstallingActivating
|
|
|
|
}
|
|
|
|
isBusy={ isInstallingActivating }
|
|
|
|
>
|
|
|
|
{ ! hasInstallActivateError
|
|
|
|
? __(
|
|
|
|
'Continue',
|
|
|
|
'woocommerce-admin'
|
|
|
|
)
|
|
|
|
: __(
|
|
|
|
'Retry',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
|
|
|
</Button>
|
|
|
|
{ hasInstallActivateError && (
|
2019-10-23 15:17:38 +00:00
|
|
|
<Button
|
2020-12-21 19:34:22 +00:00
|
|
|
onClick={ () => goToNextStep() }
|
2019-10-23 15:17:38 +00:00
|
|
|
>
|
2020-12-21 19:34:22 +00:00
|
|
|
{ __(
|
|
|
|
'Continue without installing',
|
|
|
|
'woocommerce-admin'
|
|
|
|
) }
|
2019-10-23 15:17:38 +00:00
|
|
|
</Button>
|
2020-12-21 19:34:22 +00:00
|
|
|
) }
|
|
|
|
</CardFooter>
|
2019-08-08 05:25:55 +00:00
|
|
|
</Card>
|
|
|
|
|
2020-07-01 12:20:24 +00:00
|
|
|
{ this.renderBusinessExtensionHelpText( values ) }
|
2019-08-08 05:25:55 +00:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
} }
|
|
|
|
</Form>
|
2019-06-12 03:56:10 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-02 21:54:38 +00:00
|
|
|
BusinessDetails.contextType = CurrencyContext;
|
|
|
|
|
2019-06-12 03:56:10 +00:00
|
|
|
export default compose(
|
2020-03-27 15:57:25 +00:00
|
|
|
withSelect( ( select ) => {
|
2020-12-01 22:56:17 +00:00
|
|
|
const {
|
|
|
|
getSettings,
|
|
|
|
getSettingsError,
|
|
|
|
isUpdateSettingsRequesting,
|
|
|
|
} = select( SETTINGS_STORE_NAME );
|
|
|
|
const {
|
|
|
|
getProfileItems,
|
|
|
|
getOnboardingError,
|
|
|
|
isOnboardingRequesting,
|
|
|
|
} = select( ONBOARDING_STORE_NAME );
|
2020-06-12 06:38:33 +00:00
|
|
|
const { getPluginsError, isPluginsRequesting } = select(
|
|
|
|
PLUGINS_STORE_NAME
|
|
|
|
);
|
2020-03-25 03:20:17 +00:00
|
|
|
const { general: settings = {} } = getSettings( 'general' );
|
|
|
|
|
|
|
|
return {
|
2020-06-12 06:38:33 +00:00
|
|
|
hasInstallActivateError:
|
|
|
|
getPluginsError( 'installPlugins' ) ||
|
|
|
|
getPluginsError( 'activatePlugins' ),
|
|
|
|
isError: Boolean( getOnboardingError( 'updateProfileItems' ) ),
|
|
|
|
profileItems: getProfileItems(),
|
|
|
|
isSettingsError: Boolean( getSettingsError( 'general' ) ),
|
2019-12-10 19:01:21 +00:00
|
|
|
settings,
|
2020-12-01 22:56:17 +00:00
|
|
|
isUpdatingProfileItems:
|
|
|
|
isOnboardingRequesting( 'updateProfileItems' ) ||
|
|
|
|
isUpdateSettingsRequesting( 'general' ),
|
2020-06-12 06:38:33 +00:00
|
|
|
isInstallingActivating:
|
|
|
|
isPluginsRequesting( 'installPlugins' ) ||
|
|
|
|
isPluginsRequesting( 'activatePlugins' ) ||
|
|
|
|
isPluginsRequesting( 'getJetpackConnectUrl' ),
|
2019-11-05 00:05:20 +00:00
|
|
|
};
|
2019-06-12 03:56:10 +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 );
|
2020-06-12 06:38:33 +00:00
|
|
|
const { installAndActivatePlugins } = dispatch( PLUGINS_STORE_NAME );
|
2019-07-23 03:26:46 +00:00
|
|
|
const { createNotice } = dispatch( 'core/notices' );
|
2020-12-29 21:21:24 +00:00
|
|
|
const { updateOptions } = dispatch( OPTIONS_STORE_NAME );
|
2019-06-12 03:56:10 +00:00
|
|
|
|
|
|
|
return {
|
2019-07-23 03:26:46 +00:00
|
|
|
createNotice,
|
2020-06-12 06:38:33 +00:00
|
|
|
installAndActivatePlugins,
|
2019-06-12 03:56:10 +00:00
|
|
|
updateProfileItems,
|
2020-12-29 21:21:24 +00:00
|
|
|
updateOptions,
|
2019-06-12 03:56:10 +00:00
|
|
|
};
|
|
|
|
} )
|
|
|
|
)( BusinessDetails );
|