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';
|
2019-12-02 17:39:22 +00:00
|
|
|
|
import { Button, FormToggle } from '@wordpress/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';
|
2019-06-12 03:56:10 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* WooCommerce dependencies
|
|
|
|
|
*/
|
2020-04-02 21:54:38 +00:00
|
|
|
|
import { formatValue } from '@woocommerce/number';
|
|
|
|
|
import { getSetting } from '@woocommerce/wc-admin-settings';
|
2020-03-25 03:20:17 +00:00
|
|
|
|
import { SETTINGS_STORE_NAME } from '@woocommerce/data';
|
2019-06-12 03:56:10 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Internal dependencies
|
|
|
|
|
*/
|
2020-03-06 19:20:54 +00:00
|
|
|
|
import {
|
|
|
|
|
H,
|
|
|
|
|
Card,
|
|
|
|
|
SelectControl,
|
|
|
|
|
Form,
|
|
|
|
|
TextControl,
|
2020-04-16 23:58:36 +00:00
|
|
|
|
Plugins,
|
2020-03-06 19:20:54 +00:00
|
|
|
|
} from '@woocommerce/components';
|
2020-03-25 03:20:17 +00:00
|
|
|
|
import withWCApiSelect from 'wc-api/with-select';
|
2019-07-01 18:13:29 +00:00
|
|
|
|
import { recordEvent } from 'lib/tracks';
|
2019-10-23 15:17:38 +00:00
|
|
|
|
import { pluginNames } from 'wc-api/onboarding/constants';
|
2019-12-10 19:01:21 +00:00
|
|
|
|
import { getCurrencyRegion } from 'dashboard/utils';
|
2020-04-02 21:54:38 +00:00
|
|
|
|
import { CurrencyContext } from 'lib/currency-context';
|
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();
|
2019-11-05 00:05:20 +00:00
|
|
|
|
const profileItems = get( props, 'profileItems', {} );
|
2020-02-14 02:23:21 +00:00
|
|
|
|
const businessExtensions = get(
|
|
|
|
|
profileItems,
|
|
|
|
|
'business_extensions',
|
|
|
|
|
false
|
|
|
|
|
);
|
2019-06-12 03:56:10 +00:00
|
|
|
|
|
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-03-16 06:12:30 +00:00
|
|
|
|
'kliken-marketing-for-google': businessExtensions
|
|
|
|
|
? businessExtensions.includes( 'kliken-marketing-for-google' )
|
|
|
|
|
: true,
|
2019-06-12 03:56:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
2019-10-23 15:17:38 +00:00
|
|
|
|
this.state = {
|
|
|
|
|
installExtensions: false,
|
|
|
|
|
isInstallingExtensions: false,
|
|
|
|
|
extensionInstallError: false,
|
|
|
|
|
};
|
|
|
|
|
|
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-02-14 02:23:21 +00:00
|
|
|
|
];
|
2019-08-08 05:25:55 +00:00
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
|
async onContinue( values ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
|
const {
|
|
|
|
|
createNotice,
|
|
|
|
|
goToNextStep,
|
|
|
|
|
isError,
|
|
|
|
|
updateProfileItems,
|
|
|
|
|
} = this.props;
|
|
|
|
|
const {
|
|
|
|
|
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-04-02 21:54:38 +00:00
|
|
|
|
const { getCurrency } = 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-04-02 21:54:38 +00:00
|
|
|
|
currency: getCurrency().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,
|
2019-10-23 15:17:38 +00:00
|
|
|
|
install_facebook: values[ 'facebook-for-woocommerce' ],
|
|
|
|
|
install_mailchimp: values[ 'mailchimp-for-woocommerce' ],
|
2020-03-16 06:12:30 +00:00
|
|
|
|
install_google_ads: values[ 'kliken-marketing-for-google' ],
|
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
|
|
|
|
|
2019-08-08 15:38:47 +00:00
|
|
|
|
await updateProfileItems( updates );
|
|
|
|
|
|
2019-06-12 03:56:10 +00:00
|
|
|
|
if ( ! isError ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
|
if ( businessExtensions.length === 0 ) {
|
2019-10-23 15:17:38 +00:00
|
|
|
|
goToNextStep();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState( {
|
|
|
|
|
installExtensions: true,
|
|
|
|
|
isInstallingExtensions: true,
|
|
|
|
|
} );
|
2019-06-12 03:56:10 +00:00
|
|
|
|
} else {
|
2019-07-23 03:26:46 +00:00
|
|
|
|
createNotice(
|
|
|
|
|
'error',
|
2020-02-14 02:23:21 +00:00
|
|
|
|
__(
|
|
|
|
|
'There was a problem updating your business details.',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
)
|
2019-07-23 03:26:46 +00:00
|
|
|
|
);
|
2019-06-12 03:56:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
|
validate( values ) {
|
|
|
|
|
const errors = {};
|
|
|
|
|
|
2020-03-06 19:20:54 +00:00
|
|
|
|
Object.keys( values ).forEach( ( name ) => {
|
2020-02-14 02:23:21 +00:00
|
|
|
|
if ( name === 'other_platform' ) {
|
2019-08-08 05:25:55 +00:00
|
|
|
|
if (
|
|
|
|
|
! values.other_platform.length &&
|
2020-02-14 02:23:21 +00:00
|
|
|
|
[ 'other', 'brick-mortar-other' ].includes(
|
|
|
|
|
values.selling_venues
|
|
|
|
|
)
|
2019-08-08 05:25:55 +00:00
|
|
|
|
) {
|
2020-02-14 02:23:21 +00:00
|
|
|
|
errors.other_platform = __(
|
|
|
|
|
'This field is required',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
);
|
2019-08-08 05:25:55 +00:00
|
|
|
|
}
|
2020-03-06 19:20:54 +00:00
|
|
|
|
} else if ( name === 'other_platform_name' ) {
|
|
|
|
|
if (
|
|
|
|
|
! values.other_platform_name &&
|
2020-03-27 15:57:25 +00:00
|
|
|
|
values.other_platform === 'other' &&
|
|
|
|
|
[ 'other', 'brick-mortar-other' ].includes(
|
|
|
|
|
values.selling_venues
|
|
|
|
|
)
|
2020-03-06 19:20:54 +00:00
|
|
|
|
) {
|
|
|
|
|
errors.other_platform_name = __(
|
|
|
|
|
'This field is required',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-02-14 02:23:21 +00:00
|
|
|
|
} else if ( name === 'revenue' ) {
|
2019-08-08 15:38:47 +00:00
|
|
|
|
if (
|
|
|
|
|
! values.revenue.length &&
|
2020-02-14 02:23:21 +00:00
|
|
|
|
[
|
|
|
|
|
'other',
|
|
|
|
|
'brick-mortar',
|
|
|
|
|
'brick-mortar-other',
|
|
|
|
|
'other-woocommerce',
|
|
|
|
|
].includes( values.selling_venues )
|
2019-08-08 15:38:47 +00:00
|
|
|
|
) {
|
2020-02-14 02:23:21 +00:00
|
|
|
|
errors.revenue = __(
|
|
|
|
|
'This field is required',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
);
|
2019-08-08 15:38:47 +00:00
|
|
|
|
}
|
2020-02-14 02:23:21 +00:00
|
|
|
|
} else if (
|
|
|
|
|
! this.extensions.includes( name ) &&
|
|
|
|
|
! values[ name ].length
|
|
|
|
|
) {
|
|
|
|
|
errors[ name ] = __(
|
|
|
|
|
'This field is required',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
);
|
2019-08-08 05:25:55 +00:00
|
|
|
|
}
|
|
|
|
|
} );
|
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-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-04-02 21:54:38 +00:00
|
|
|
|
const { getCurrency } = this.context;
|
|
|
|
|
return formatValue( getCurrency(), '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 ) {
|
2019-10-23 15:17:38 +00:00
|
|
|
|
const { isInstallingExtensions } = this.state;
|
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( ', ' );
|
|
|
|
|
|
|
|
|
|
if ( isInstallingExtensions ) {
|
2020-01-06 15:16:38 +00:00
|
|
|
|
return (
|
|
|
|
|
<p>
|
|
|
|
|
{ sprintf(
|
|
|
|
|
_n(
|
|
|
|
|
'Installing the following plugin: %s',
|
|
|
|
|
'Installing the following plugins: %s',
|
|
|
|
|
extensions.length,
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
),
|
|
|
|
|
extensionsList
|
|
|
|
|
) }
|
|
|
|
|
</p>
|
|
|
|
|
);
|
2019-10-23 15:17:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-04 15:56:28 +00:00
|
|
|
|
return (
|
|
|
|
|
<p>
|
2020-01-06 15:16:38 +00:00
|
|
|
|
{ sprintf(
|
|
|
|
|
_n(
|
|
|
|
|
'The following plugin will be installed for free: %s',
|
|
|
|
|
'The following plugins will be installed for free: %s',
|
|
|
|
|
extensions.length,
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
),
|
|
|
|
|
extensionsList
|
|
|
|
|
) }
|
2019-07-04 15:56:28 +00:00
|
|
|
|
</p>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-08 05:25:55 +00:00
|
|
|
|
renderBusinessExtensions( values, getInputProps ) {
|
Merge final `version/1.0` branch with `master` (https://github.com/woocommerce/woocommerce-admin/pull/3848)
* Try: Moving Customers to main Woo Menu (https://github.com/woocommerce/woocommerce-admin/pull/3632)
* Only add onboarding settings on wc-admin pages when task list should be shown. (https://github.com/woocommerce/woocommerce-admin/pull/3722)
* Use cron for unsnoozing admin notes (https://github.com/woocommerce/woocommerce-admin/pull/3662)
* Use wp-cron for admin note snoozing.
* Remove "unsnooze" scheduled action.
* Use correct version.
* Avoid using deprecated method for unscheduling actions.
* Onboarding: Fix toggle tracking events (https://github.com/woocommerce/woocommerce-admin/pull/3645)
* Fix errant wcadmin prefix on event name
* Track the onboarding toggle on the option in case enable_onboarding isn't used
* Move toggle actions to separate function
* Move onboarding actions
* Move onboarding filters
* Move help tab updates to add_toggle_actions
* Only run onboarding actions when enabled
* Onboarding: Add tracks events when profiler steps are completed (https://github.com/woocommerce/woocommerce-admin/pull/3726)
* Add tracks for store profiler step completion
* Record event when profiler is completed
* Ensure continue setup loads the onboarding profiler (https://github.com/woocommerce/woocommerce-admin/pull/3646)
* 'All that include' option removed when input field is empty (https://github.com/woocommerce/woocommerce-admin/pull/3700)
* 'All that include' option removed when input field is empty
Added a control to check that when the input field 'Search by customer name' is empty, the 'All that include' option is not appearing.
* Const name improved
The constant name hasValues was changed to optionsHaveValues (more descriptive)
* Fix select text alignment (https://github.com/woocommerce/woocommerce-admin/pull/3723)
* Stock panel indicator - cache and use lookup tables. (https://github.com/woocommerce/woocommerce-admin/pull/3729)
* Stock panel indicator - cache and use lookup tables.
* Revise query, clear transient on product update.
* Fix error, ht Josh.
* Checklist: Remove sideloaded images to reduce build size, take 2 (https://github.com/woocommerce/woocommerce-admin/pull/3731)
* Remove homepage template images.
* Use other-small on all industries, adjust text color.
* Remove background dim and opacity set to 0
* Fix/3631 (https://github.com/woocommerce/woocommerce-admin/pull/3730)
* Added CBD as an industry type
CBD was added as an industry type in API
* Industries options modified
Modified the industries options. Now we are able to choose if we will use an input or not in the option.
* API control changed for industries.
API control changed for industries. Now it accepts the data type we need.
* Added input in Industries list for the option "Other"
Added an input for the option "Other" in the industries list
* Added suggested changes in review comments.
* Added data preparation for recordEvent
* Changed variable to snake_case
The variable "industriesWithDetail" was changed to "industries_with_detail" (snake_case)
* Onboarding: Create homepage without redirect (https://github.com/woocommerce/woocommerce-admin/pull/3727)
* Add link to edit homepage instead of redirect
* Add busy state to homepage creation button
* Publish homepage on create via API
* Update homepage notice to show on first post update
* Update homepage creation notice per design
* Record event on customize homepage
* Set homepage to frontpage on creation
* Add deactivation note for feature plugin (https://github.com/woocommerce/woocommerce-admin/pull/3687)
* Add version deactivation note
* Add the note to deactivate if the version is older than the current WC version
* Deactivate wc admin feature plugin on action click
* Add notes version hooks
* change the Package class namespace to exclude from standalone autoloader
* add use statement for FeaturePlugin
* add note explaining namespace
* use wc-admin-deactivate-plugin note name
* Rename file and class to WC_Admin_Notes_Deactivate_Plugin
Co-authored-by: Ron Rennick <ron@ronandandrea.com>
Co-authored-by: Paul Sealock <psealock@gmail.com>
* Add Travis tests on GH for release branch (https://github.com/woocommerce/woocommerce-admin/pull/3751)
* Add Travis tests on GH for release branch
* fix linter errors
* ActivityPanels.php -> use public static functions
* Remove free text Search option when no query exists (https://github.com/woocommerce/woocommerce-admin/pull/3755)
* Revert changes in woocommerce/woocommerce-admin#3700
* Don't add free text search if no query exists
* Add tests for Search without query
* Add test for showing free text search option
* Fix image sideloading for store industries. (https://github.com/woocommerce/woocommerce-admin/pull/3743)
* Fix image sideloading for store industries.
Data format changed in https://github.com/woocommerce/woocommerce-admin/pull/3730
* Fix industry image sideload in cases where the count is less than requested.
* Be backwards compatible with the old industry data format.
* Added event props to identify stores with WCS and Jetpack installed (https://github.com/woocommerce/woocommerce-admin/pull/3750)
* Added event props to identify stores with WCS and Jetpack installed
Also, added Jeckpack connected status
* Improved variable name
* Simplified method
Simplified method. "intersection" check was removed
* Tests errors repeared
The method "clear_low_out_of_stock_count_transient" now is static.
* OBW: fix sideloading image test error (https://github.com/woocommerce/woocommerce-admin/pull/3762)
* Release 0.26.0 changes (https://github.com/woocommerce/woocommerce-admin/pull/3753)
* add deactivation hook to Package.php (https://github.com/woocommerce/woocommerce-admin/pull/3770)
* Add active version functions (https://github.com/woocommerce/woocommerce-admin/pull/3772)
* add active version functions to Package.php
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* 0.26.1 changes (https://github.com/woocommerce/woocommerce-admin/pull/3773)
* Customers Report: fix missing report param in search (https://github.com/woocommerce/woocommerce-admin/pull/3778)
* Product titles include encoded entities (https://github.com/woocommerce/woocommerce-admin/pull/3765)
* Stripped HTML from product titles and decoded before displaying them
Stripped html from product titles and entities are decoded before displaying them
* Stripped HTML from product titles and decoded in Stock report
Stripped html from product titles and entities are decoded before displaying them. Now in Stock report
* Added support for HTML tags and encoded entities on product titles
Added support for HTML tags and encoded entities on filtered product list, dropdown menus and tag names.
Also, strip_tags() function was replaced with wp_strip_all_tags() instead.
* strip_tags() function was replaced with wp_strip_all_tags() instead.
* Added control for a variable
Added control for "item->data" before applying wp_strip_all_tags method.
* pre-commit changes
* Test text corrected
* Enable taxes on automatic tax setup (https://github.com/woocommerce/woocommerce-admin/pull/3795)
* Update Country Labeling to Match Core (https://github.com/woocommerce/woocommerce-admin/pull/3790)
* Updated country labeling
Country labeling on Customer Report was updated
* Updated country labeling in other files
* remove .jitm-card notice padding (https://github.com/woocommerce/woocommerce-admin/pull/3814)
* OBW Connect: Fix requesting state (https://github.com/woocommerce/woocommerce-admin/pull/3786)
* OBW Connect: Fix requesting state
* pass down setIsPending
* setIspending propType
* defaultProps
* test
* Revert "test"
This reverts commit e921092b19401931cc1aec8ee84fa53c53b67f36.
* better comparison for redirect
* Fixes Taxes Report search bug and adds initial documentation. (https://github.com/woocommerce/woocommerce-admin/pull/3816)
* Initial Taxes Report documentation.
* Fix taxes endpoint search parameter.
* OBW: Fix retry plugin install button disappearing (https://github.com/woocommerce/woocommerce-admin/pull/3787)
* OBW: Fix retry plugin install btn disappearing
* try suggestion
* Revert "try suggestion"
This reverts commit 5b9386957a501ac3e729e5f16b0ee71c9d792859.
* Fix special character escaping in search. (https://github.com/woocommerce/woocommerce-admin/pull/3826)
* Properly prepare/escape special characters in Product search.
* Properly prepare/escape special characters in Coupon search.
* Properly prepare/escape special characters in Tax code search.
* Fix tracking on migrated options (https://github.com/woocommerce/woocommerce-admin/pull/3828)
* Don't track onboarding toggle if migrating options
* Prevent WC_Tracks from recording event post types not yet registered
* Activity Panels: Remove W Panel (https://github.com/woocommerce/woocommerce-admin/pull/3827)
* Remove W Notif Panel.
* Add back in trapping logic, and hide on non-embed pages.
* add npm run test:zip command (https://github.com/woocommerce/woocommerce-admin/pull/3823)
* add npm run test:zip command
* 1.0.0 release changes🎉 (https://github.com/woocommerce/woocommerce-admin/pull/3831)
* 1.0.0 release changes🎉
* changelog
* 0.26.1 changelog
* Add Report Extension Example: Add default props to ReportFilters (https://github.com/woocommerce/woocommerce-admin/pull/3830)
* ReportFilters component: Add sane defaults
* styles
* add required column
* add left join to sku ordering (https://github.com/woocommerce/woocommerce-admin/pull/3845)
* Deal with lint errors, and improperly merged files
* regenerate package-lock.json
* attempting to resolve package lock conflict.
Co-authored-by: Jeff Stieler <jeff.m.stieler@gmail.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Ron Rennick <ron@ronandandrea.com>
Co-authored-by: Fernando <ultimoround@gmail.com>
Co-authored-by: edmundcwm <edmundcwm@gmail.com>
Co-authored-by: Paul Sealock <psealock@gmail.com>
2020-03-10 02:47:39 +00:00
|
|
|
|
const { installExtensions, extensionInstallError } = this.state;
|
2019-10-23 15:17:38 +00:00
|
|
|
|
const { goToNextStep } = this.props;
|
|
|
|
|
const extensionsToInstall = this.getBusinessExtensions( values );
|
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-03-16 06:12:30 +00:00
|
|
|
|
{
|
|
|
|
|
slug: 'kliken-marketing-for-google',
|
2020-03-27 17:18:27 +00:00
|
|
|
|
title: __( 'Drive sales with Google Ads', 'woocommerce-admin' ),
|
2020-03-19 02:11:25 +00:00
|
|
|
|
icon: 'onboarding/g-shopping.png',
|
2020-03-16 06:12:30 +00:00
|
|
|
|
description: __(
|
|
|
|
|
'Get in front of new customers on Google and secure $150 in ads credit with Kliken’s integration.',
|
|
|
|
|
'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 (
|
2019-10-23 15:17:38 +00:00
|
|
|
|
<Fragment>
|
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>
|
|
|
|
|
) ) }
|
2019-10-23 15:17:38 +00:00
|
|
|
|
|
|
|
|
|
{ installExtensions && (
|
2020-01-23 07:11:40 +00:00
|
|
|
|
<div className="woocommerce-profile-wizard__card-actions">
|
|
|
|
|
<Plugins
|
|
|
|
|
onComplete={ () => {
|
|
|
|
|
goToNextStep();
|
|
|
|
|
} }
|
|
|
|
|
onSkip={ () => {
|
|
|
|
|
goToNextStep();
|
|
|
|
|
} }
|
|
|
|
|
onError={ () => {
|
|
|
|
|
this.setState( {
|
|
|
|
|
extensionInstallError: true,
|
|
|
|
|
isInstallingExtensions: false,
|
|
|
|
|
} );
|
|
|
|
|
} }
|
Merge final `version/1.0` branch with `master` (https://github.com/woocommerce/woocommerce-admin/pull/3848)
* Try: Moving Customers to main Woo Menu (https://github.com/woocommerce/woocommerce-admin/pull/3632)
* Only add onboarding settings on wc-admin pages when task list should be shown. (https://github.com/woocommerce/woocommerce-admin/pull/3722)
* Use cron for unsnoozing admin notes (https://github.com/woocommerce/woocommerce-admin/pull/3662)
* Use wp-cron for admin note snoozing.
* Remove "unsnooze" scheduled action.
* Use correct version.
* Avoid using deprecated method for unscheduling actions.
* Onboarding: Fix toggle tracking events (https://github.com/woocommerce/woocommerce-admin/pull/3645)
* Fix errant wcadmin prefix on event name
* Track the onboarding toggle on the option in case enable_onboarding isn't used
* Move toggle actions to separate function
* Move onboarding actions
* Move onboarding filters
* Move help tab updates to add_toggle_actions
* Only run onboarding actions when enabled
* Onboarding: Add tracks events when profiler steps are completed (https://github.com/woocommerce/woocommerce-admin/pull/3726)
* Add tracks for store profiler step completion
* Record event when profiler is completed
* Ensure continue setup loads the onboarding profiler (https://github.com/woocommerce/woocommerce-admin/pull/3646)
* 'All that include' option removed when input field is empty (https://github.com/woocommerce/woocommerce-admin/pull/3700)
* 'All that include' option removed when input field is empty
Added a control to check that when the input field 'Search by customer name' is empty, the 'All that include' option is not appearing.
* Const name improved
The constant name hasValues was changed to optionsHaveValues (more descriptive)
* Fix select text alignment (https://github.com/woocommerce/woocommerce-admin/pull/3723)
* Stock panel indicator - cache and use lookup tables. (https://github.com/woocommerce/woocommerce-admin/pull/3729)
* Stock panel indicator - cache and use lookup tables.
* Revise query, clear transient on product update.
* Fix error, ht Josh.
* Checklist: Remove sideloaded images to reduce build size, take 2 (https://github.com/woocommerce/woocommerce-admin/pull/3731)
* Remove homepage template images.
* Use other-small on all industries, adjust text color.
* Remove background dim and opacity set to 0
* Fix/3631 (https://github.com/woocommerce/woocommerce-admin/pull/3730)
* Added CBD as an industry type
CBD was added as an industry type in API
* Industries options modified
Modified the industries options. Now we are able to choose if we will use an input or not in the option.
* API control changed for industries.
API control changed for industries. Now it accepts the data type we need.
* Added input in Industries list for the option "Other"
Added an input for the option "Other" in the industries list
* Added suggested changes in review comments.
* Added data preparation for recordEvent
* Changed variable to snake_case
The variable "industriesWithDetail" was changed to "industries_with_detail" (snake_case)
* Onboarding: Create homepage without redirect (https://github.com/woocommerce/woocommerce-admin/pull/3727)
* Add link to edit homepage instead of redirect
* Add busy state to homepage creation button
* Publish homepage on create via API
* Update homepage notice to show on first post update
* Update homepage creation notice per design
* Record event on customize homepage
* Set homepage to frontpage on creation
* Add deactivation note for feature plugin (https://github.com/woocommerce/woocommerce-admin/pull/3687)
* Add version deactivation note
* Add the note to deactivate if the version is older than the current WC version
* Deactivate wc admin feature plugin on action click
* Add notes version hooks
* change the Package class namespace to exclude from standalone autoloader
* add use statement for FeaturePlugin
* add note explaining namespace
* use wc-admin-deactivate-plugin note name
* Rename file and class to WC_Admin_Notes_Deactivate_Plugin
Co-authored-by: Ron Rennick <ron@ronandandrea.com>
Co-authored-by: Paul Sealock <psealock@gmail.com>
* Add Travis tests on GH for release branch (https://github.com/woocommerce/woocommerce-admin/pull/3751)
* Add Travis tests on GH for release branch
* fix linter errors
* ActivityPanels.php -> use public static functions
* Remove free text Search option when no query exists (https://github.com/woocommerce/woocommerce-admin/pull/3755)
* Revert changes in woocommerce/woocommerce-admin#3700
* Don't add free text search if no query exists
* Add tests for Search without query
* Add test for showing free text search option
* Fix image sideloading for store industries. (https://github.com/woocommerce/woocommerce-admin/pull/3743)
* Fix image sideloading for store industries.
Data format changed in https://github.com/woocommerce/woocommerce-admin/pull/3730
* Fix industry image sideload in cases where the count is less than requested.
* Be backwards compatible with the old industry data format.
* Added event props to identify stores with WCS and Jetpack installed (https://github.com/woocommerce/woocommerce-admin/pull/3750)
* Added event props to identify stores with WCS and Jetpack installed
Also, added Jeckpack connected status
* Improved variable name
* Simplified method
Simplified method. "intersection" check was removed
* Tests errors repeared
The method "clear_low_out_of_stock_count_transient" now is static.
* OBW: fix sideloading image test error (https://github.com/woocommerce/woocommerce-admin/pull/3762)
* Release 0.26.0 changes (https://github.com/woocommerce/woocommerce-admin/pull/3753)
* add deactivation hook to Package.php (https://github.com/woocommerce/woocommerce-admin/pull/3770)
* Add active version functions (https://github.com/woocommerce/woocommerce-admin/pull/3772)
* add active version functions to Package.php
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* 0.26.1 changes (https://github.com/woocommerce/woocommerce-admin/pull/3773)
* Customers Report: fix missing report param in search (https://github.com/woocommerce/woocommerce-admin/pull/3778)
* Product titles include encoded entities (https://github.com/woocommerce/woocommerce-admin/pull/3765)
* Stripped HTML from product titles and decoded before displaying them
Stripped html from product titles and entities are decoded before displaying them
* Stripped HTML from product titles and decoded in Stock report
Stripped html from product titles and entities are decoded before displaying them. Now in Stock report
* Added support for HTML tags and encoded entities on product titles
Added support for HTML tags and encoded entities on filtered product list, dropdown menus and tag names.
Also, strip_tags() function was replaced with wp_strip_all_tags() instead.
* strip_tags() function was replaced with wp_strip_all_tags() instead.
* Added control for a variable
Added control for "item->data" before applying wp_strip_all_tags method.
* pre-commit changes
* Test text corrected
* Enable taxes on automatic tax setup (https://github.com/woocommerce/woocommerce-admin/pull/3795)
* Update Country Labeling to Match Core (https://github.com/woocommerce/woocommerce-admin/pull/3790)
* Updated country labeling
Country labeling on Customer Report was updated
* Updated country labeling in other files
* remove .jitm-card notice padding (https://github.com/woocommerce/woocommerce-admin/pull/3814)
* OBW Connect: Fix requesting state (https://github.com/woocommerce/woocommerce-admin/pull/3786)
* OBW Connect: Fix requesting state
* pass down setIsPending
* setIspending propType
* defaultProps
* test
* Revert "test"
This reverts commit e921092b19401931cc1aec8ee84fa53c53b67f36.
* better comparison for redirect
* Fixes Taxes Report search bug and adds initial documentation. (https://github.com/woocommerce/woocommerce-admin/pull/3816)
* Initial Taxes Report documentation.
* Fix taxes endpoint search parameter.
* OBW: Fix retry plugin install button disappearing (https://github.com/woocommerce/woocommerce-admin/pull/3787)
* OBW: Fix retry plugin install btn disappearing
* try suggestion
* Revert "try suggestion"
This reverts commit 5b9386957a501ac3e729e5f16b0ee71c9d792859.
* Fix special character escaping in search. (https://github.com/woocommerce/woocommerce-admin/pull/3826)
* Properly prepare/escape special characters in Product search.
* Properly prepare/escape special characters in Coupon search.
* Properly prepare/escape special characters in Tax code search.
* Fix tracking on migrated options (https://github.com/woocommerce/woocommerce-admin/pull/3828)
* Don't track onboarding toggle if migrating options
* Prevent WC_Tracks from recording event post types not yet registered
* Activity Panels: Remove W Panel (https://github.com/woocommerce/woocommerce-admin/pull/3827)
* Remove W Notif Panel.
* Add back in trapping logic, and hide on non-embed pages.
* add npm run test:zip command (https://github.com/woocommerce/woocommerce-admin/pull/3823)
* add npm run test:zip command
* 1.0.0 release changes🎉 (https://github.com/woocommerce/woocommerce-admin/pull/3831)
* 1.0.0 release changes🎉
* changelog
* 0.26.1 changelog
* Add Report Extension Example: Add default props to ReportFilters (https://github.com/woocommerce/woocommerce-admin/pull/3830)
* ReportFilters component: Add sane defaults
* styles
* add required column
* add left join to sku ordering (https://github.com/woocommerce/woocommerce-admin/pull/3845)
* Deal with lint errors, and improperly merged files
* regenerate package-lock.json
* attempting to resolve package lock conflict.
Co-authored-by: Jeff Stieler <jeff.m.stieler@gmail.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Ron Rennick <ron@ronandandrea.com>
Co-authored-by: Fernando <ultimoround@gmail.com>
Co-authored-by: edmundcwm <edmundcwm@gmail.com>
Co-authored-by: Paul Sealock <psealock@gmail.com>
2020-03-10 02:47:39 +00:00
|
|
|
|
autoInstall={ ! extensionInstallError }
|
2020-01-23 07:11:40 +00:00
|
|
|
|
pluginSlugs={ extensionsToInstall }
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2019-10-23 15:17:38 +00:00
|
|
|
|
) }
|
|
|
|
|
</Fragment>
|
2019-07-04 15:56:28 +00:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-12 03:56:10 +00:00
|
|
|
|
render() {
|
2019-10-23 15:17:38 +00:00
|
|
|
|
const { isInstallingExtensions, extensionInstallError } = this.state;
|
2020-04-02 21:54:38 +00:00
|
|
|
|
const { formatCurrency } = 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' ),
|
|
|
|
|
formatCurrency( 0 )
|
|
|
|
|
),
|
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' ),
|
2019-12-10 19:01:21 +00:00
|
|
|
|
formatCurrency( 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 ),
|
|
|
|
|
formatCurrency
|
|
|
|
|
),
|
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 ),
|
|
|
|
|
formatCurrency
|
|
|
|
|
),
|
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 ),
|
|
|
|
|
formatCurrency
|
|
|
|
|
),
|
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' ),
|
2019-12-10 19:01:21 +00:00
|
|
|
|
formatCurrency( 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 } ) => {
|
2019-08-08 05:25:55 +00:00
|
|
|
|
// Show extensions when the currently selling elsewhere checkbox has been answered.
|
2020-02-14 02:23:21 +00:00
|
|
|
|
const showExtensions = values.selling_venues !== '';
|
2019-08-08 05:25:55 +00:00
|
|
|
|
return (
|
|
|
|
|
<Fragment>
|
|
|
|
|
<H className="woocommerce-profile-wizard__header-title">
|
2020-02-14 02:23:21 +00:00
|
|
|
|
{ __(
|
|
|
|
|
'Tell us about your business',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
) }
|
2019-08-08 05:25:55 +00:00
|
|
|
|
</H>
|
2019-08-08 18:41:26 +00:00
|
|
|
|
<p>
|
|
|
|
|
{ __(
|
|
|
|
|
"We'd love to know if you are just getting started or you already have a business in place.",
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
) }
|
|
|
|
|
</p>
|
2019-08-08 05:25:55 +00:00
|
|
|
|
<Card>
|
|
|
|
|
<Fragment>
|
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-02-14 02:23:21 +00:00
|
|
|
|
{ showExtensions &&
|
|
|
|
|
this.renderBusinessExtensions(
|
|
|
|
|
values,
|
|
|
|
|
getInputProps
|
|
|
|
|
) }
|
2019-08-08 05:25:55 +00:00
|
|
|
|
|
2019-10-23 15:17:38 +00:00
|
|
|
|
{ ! extensionInstallError && (
|
|
|
|
|
<Button
|
|
|
|
|
isPrimary
|
|
|
|
|
className="woocommerce-profile-wizard__continue"
|
|
|
|
|
onClick={ handleSubmit }
|
|
|
|
|
disabled={ ! isValidForm }
|
|
|
|
|
isBusy={ isInstallingExtensions }
|
|
|
|
|
>
|
2020-02-14 02:23:21 +00:00
|
|
|
|
{ __(
|
|
|
|
|
'Continue',
|
|
|
|
|
'woocommerce-admin'
|
|
|
|
|
) }
|
2019-10-23 15:17:38 +00:00
|
|
|
|
</Button>
|
|
|
|
|
) }
|
2019-08-08 05:25:55 +00:00
|
|
|
|
</Fragment>
|
|
|
|
|
</Card>
|
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
|
{ showExtensions &&
|
|
|
|
|
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
|
|
|
|
withWCApiSelect( ( select ) => {
|
2020-03-25 03:20:17 +00:00
|
|
|
|
const { getProfileItems, getProfileItemsError } = select( 'wc-api' );
|
2019-06-12 03:56:10 +00:00
|
|
|
|
|
2019-11-05 00:05:20 +00:00
|
|
|
|
return {
|
|
|
|
|
isError: Boolean( getProfileItemsError() ),
|
|
|
|
|
profileItems: getProfileItems(),
|
2020-03-25 03:20:17 +00:00
|
|
|
|
};
|
|
|
|
|
} ),
|
2020-03-27 15:57:25 +00:00
|
|
|
|
withSelect( ( select ) => {
|
|
|
|
|
const {
|
|
|
|
|
getSettings,
|
|
|
|
|
getSettingsError,
|
|
|
|
|
isGetSettingsRequesting,
|
|
|
|
|
} = select( SETTINGS_STORE_NAME );
|
2020-03-25 03:20:17 +00:00
|
|
|
|
|
|
|
|
|
const { general: settings = {} } = getSettings( 'general' );
|
|
|
|
|
const isSettingsError = Boolean( getSettingsError( 'general' ) );
|
|
|
|
|
const isSettingsRequesting = isGetSettingsRequesting( 'general' );
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
isSettingsError,
|
|
|
|
|
isSettingsRequesting,
|
2019-12-10 19:01:21 +00:00
|
|
|
|
settings,
|
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 ) => {
|
2019-07-23 03:26:46 +00:00
|
|
|
|
const { updateProfileItems } = dispatch( 'wc-api' );
|
|
|
|
|
const { createNotice } = dispatch( 'core/notices' );
|
2019-06-12 03:56:10 +00:00
|
|
|
|
|
|
|
|
|
return {
|
2019-07-23 03:26:46 +00:00
|
|
|
|
createNotice,
|
2019-06-12 03:56:10 +00:00
|
|
|
|
updateProfileItems,
|
|
|
|
|
};
|
|
|
|
|
} )
|
|
|
|
|
)( BusinessDetails );
|