2021-08-11 22:09:32 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { lazy, Suspense } from '@wordpress/element';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { EmbeddedBodyProps } from '../embedded-body-layout/embedded-body-props';
|
|
|
|
import RecommendationsEligibilityWrapper from '../settings-recommendations/recommendations-eligibility-wrapper';
|
2022-08-12 01:49:18 +00:00
|
|
|
import { ShippingTour } from '../guided-tours/shipping-tour';
|
2021-08-11 22:09:32 +00:00
|
|
|
|
2022-06-23 01:54:38 +00:00
|
|
|
const ShippingRecommendationsLoader = lazy( () => {
|
|
|
|
if ( window.wcAdminFeatures[ 'shipping-smart-defaults' ] ) {
|
|
|
|
return import(
|
|
|
|
/* webpackChunkName: "shipping-recommendations" */ './experimental-shipping-recommendations'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return import(
|
|
|
|
/* webpackChunkName: "shipping-recommendations" */ './shipping-recommendations'
|
|
|
|
);
|
|
|
|
} );
|
2021-08-11 22:09:32 +00:00
|
|
|
|
|
|
|
export const ShippingRecommendations: React.FC< EmbeddedBodyProps > = ( {
|
|
|
|
page,
|
|
|
|
tab,
|
|
|
|
section,
|
|
|
|
zone_id,
|
|
|
|
} ) => {
|
|
|
|
if ( page !== 'wc-settings' ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( tab !== 'shipping' ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( Boolean( section ) ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( Boolean( zone_id ) ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<RecommendationsEligibilityWrapper>
|
|
|
|
<Suspense fallback={ null }>
|
2022-07-05 05:02:52 +00:00
|
|
|
{ window.wcAdminFeatures[ 'shipping-setting-tour' ] && (
|
|
|
|
<ShippingTour />
|
|
|
|
) }
|
2021-08-11 22:09:32 +00:00
|
|
|
<ShippingRecommendationsLoader />
|
|
|
|
</Suspense>
|
|
|
|
</RecommendationsEligibilityWrapper>
|
|
|
|
);
|
|
|
|
};
|