File "with-filtered-attributes.js"
Full Path: /home/vantageo/public_html/cache/cache/cache/cache/.wp-cli/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/hocs/with-filtered-attributes.js
File size: 606 bytes
MIME-type: text/x-java
Charset: utf-8
/**
* External dependencies
*/
import { getValidBlockAttributes } from '@woocommerce/base-utils';
/**
* HOC that filters given attributes by valid block attribute values, or uses defaults if undefined.
*
* @param {Object} blockAttributes Component being wrapped.
*/
const withFilteredAttributes = ( blockAttributes ) => ( OriginalComponent ) => {
return ( ownProps ) => {
const validBlockAttributes = getValidBlockAttributes(
blockAttributes,
ownProps
);
return (
<OriginalComponent { ...ownProps } { ...validBlockAttributes } />
);
};
};
export default withFilteredAttributes;