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-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 }>
|
|
|
|
<ShippingRecommendationsLoader />
|
|
|
|
</Suspense>
|
|
|
|
</RecommendationsEligibilityWrapper>
|
|
|
|
);
|
|
|
|
};
|