2021-01-06 22:08:57 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { useSelect } from '@wordpress/data';
|
|
|
|
import { Spinner } from '@woocommerce/components';
|
|
|
|
import { ONBOARDING_STORE_NAME, SETTINGS_STORE_NAME } from '@woocommerce/data';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-06-03 08:33:54 +00:00
|
|
|
import { BusinessFeaturesList } from './flows/selective-bundle';
|
2021-01-06 22:08:57 +00:00
|
|
|
import './style.scss';
|
|
|
|
|
|
|
|
export const BusinessDetailsStep = ( props ) => {
|
2021-06-03 08:33:54 +00:00
|
|
|
const { profileItems, isLoading } = useSelect( ( select ) => {
|
2021-01-06 22:08:57 +00:00
|
|
|
return {
|
|
|
|
isLoading:
|
|
|
|
! select( ONBOARDING_STORE_NAME ).hasFinishedResolution(
|
|
|
|
'getProfileItems'
|
|
|
|
) ||
|
|
|
|
! select(
|
|
|
|
SETTINGS_STORE_NAME
|
|
|
|
).hasFinishedResolution( 'getSettings', [ 'general' ] ),
|
|
|
|
profileItems: select( ONBOARDING_STORE_NAME ).getProfileItems(),
|
|
|
|
};
|
|
|
|
} );
|
|
|
|
|
|
|
|
if ( isLoading ) {
|
|
|
|
return (
|
|
|
|
<div className="woocommerce-admin__business-details__spinner">
|
|
|
|
<Spinner />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-06-03 08:33:54 +00:00
|
|
|
const initialValues = {
|
2021-11-29 20:00:38 +00:00
|
|
|
number_employees: profileItems.number_employees || '',
|
2021-06-03 08:33:54 +00:00
|
|
|
other_platform: profileItems.other_platform || '',
|
|
|
|
other_platform_name: profileItems.other_platform_name || '',
|
|
|
|
product_count: profileItems.product_count || '',
|
|
|
|
selling_venues: profileItems.selling_venues || '',
|
|
|
|
revenue: profileItems.revenue || '',
|
2021-08-31 04:39:04 +00:00
|
|
|
setup_client: profileItems.setup_client || false,
|
2021-06-03 08:33:54 +00:00
|
|
|
};
|
2021-01-06 22:08:57 +00:00
|
|
|
|
2021-06-03 08:33:54 +00:00
|
|
|
return (
|
|
|
|
<BusinessFeaturesList { ...props } initialValues={ initialValues } />
|
|
|
|
);
|
2021-01-06 22:08:57 +00:00
|
|
|
};
|