woocommerce/plugins/woocommerce-blocks/assets/js/blocks/single-product/frontend.js

40 lines
772 B
JavaScript
Raw Normal View History

/**
* External dependencies
*/
import { StoreNoticesProvider } from '@woocommerce/base-context';
import {
renderFrontend,
getAttributesFromDataset,
} from '@woocommerce/base-utils';
/**
* Internal dependencies
*/
import Block from './block';
import blockAttributes from './attributes';
/**
* Wrapper component to supply the notice provider.
*
* @param {*} props
*/
const FrontendBlock = ( props ) => {
return (
<StoreNoticesProvider context="woocommerce/single-product">
<Block { ...props } />
</StoreNoticesProvider>
);
};
const getProps = ( el ) => {
return {
attributes: getAttributesFromDataset( blockAttributes, el.dataset ),
};
};
renderFrontend( {
selector: '.wp-block-woocommerce-single-product',
Block: FrontendBlock,
getProps,
} );