woocommerce/plugins/woocommerce-admin/client/customize-store/assembler-hub/utils/is-full-composability-enabl...

25 lines
636 B
TypeScript

/**
* External dependencies
*/
import {
BlockPopover,
// @ts-expect-error No types for this exist yet.
} from '@wordpress/block-editor';
export const isPatternToolkitFullComposabilityFeatureFlagEnabled = () => {
return window.wcAdminFeatures[ 'pattern-toolkit-full-composability' ];
};
export const isGutenbergAPIAvailableForFullComposability = () => {
return [ BlockPopover ].every(
( api ) => api !== undefined && api !== null
);
};
export const isFullComposabilityFeatureAndAPIAvailable = () => {
return (
isPatternToolkitFullComposabilityFeatureFlagEnabled() &&
isGutenbergAPIAvailableForFullComposability()
);
};