Wrap product task import around experiment

This commit is contained in:
Ilyas Foo 2022-05-16 10:49:49 +08:00
parent e78f6e02be
commit ebec562699
1 changed files with 11 additions and 9 deletions

View File

@ -22,7 +22,15 @@ const onboardingData = getAdminSetting( 'onboarding' );
const possiblyImportProductTaskExperiment = async () => { const possiblyImportProductTaskExperiment = async () => {
const isExperiment = await isProductTaskExperimentTreatment(); const isExperiment = await isProductTaskExperimentTreatment();
if ( isExperiment ) { if ( isExperiment ) {
if (
window.wcAdminFeatures[ 'experimental-import-products-task' ] &&
onboardingData?.profile?.selling_venues &&
onboardingData?.profile?.selling_venues !== 'no'
) {
import( './experimental-import-products' );
} else {
import( './experimental-products' ); import( './experimental-products' );
}
} else { } else {
import( './products' ); import( './products' );
} }
@ -30,14 +38,8 @@ const possiblyImportProductTaskExperiment = async () => {
if ( if (
window.wcAdminFeatures && window.wcAdminFeatures &&
window.wcAdminFeatures[ 'experimental-import-products-task' ] && ( window.wcAdminFeatures[ 'experimental-import-products-task' ] ||
onboardingData?.profile?.selling_venues && window.wcAdminFeatures[ 'experimental-products-task' ] )
onboardingData?.profile?.selling_venues !== 'no'
) {
import( './experimental-import-products' );
} else if (
window.wcAdminFeatures &&
window.wcAdminFeatures[ 'experimental-products-task' ]
) { ) {
possiblyImportProductTaskExperiment(); possiblyImportProductTaskExperiment();
} else { } else {