2021-06-04 08:44:26 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import classnames from 'classnames';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-10-12 14:23:52 +00:00
|
|
|
import { createSlotFill, hasValidFills, useSlot } from '../../slot';
|
2023-11-20 12:53:41 +00:00
|
|
|
import TotalsWrapper from '../../../components/totals-wrapper';
|
2021-06-04 08:44:26 +00:00
|
|
|
|
|
|
|
const slotName = '__experimentalDiscountsMeta';
|
|
|
|
|
2022-06-15 09:56:52 +00:00
|
|
|
const { Fill: ExperimentalDiscountsMeta, Slot: DiscountsMetaSlot } =
|
|
|
|
createSlotFill( slotName );
|
2021-06-04 08:44:26 +00:00
|
|
|
|
2022-02-22 09:33:52 +00:00
|
|
|
const Slot = ( { className, extensions, cart, context } ) => {
|
2021-07-02 14:56:39 +00:00
|
|
|
const { fills } = useSlot( slotName );
|
2021-06-04 08:44:26 +00:00
|
|
|
return (
|
2021-07-02 14:56:39 +00:00
|
|
|
hasValidFills( fills ) && (
|
|
|
|
<TotalsWrapper slotWrapper={ true }>
|
|
|
|
<DiscountsMetaSlot
|
|
|
|
className={ classnames(
|
|
|
|
className,
|
|
|
|
'wc-block-components-discounts-meta'
|
|
|
|
) }
|
2022-02-22 09:33:52 +00:00
|
|
|
fillProps={ { extensions, cart, context } }
|
2021-07-02 14:56:39 +00:00
|
|
|
/>
|
|
|
|
</TotalsWrapper>
|
|
|
|
)
|
2021-06-04 08:44:26 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
ExperimentalDiscountsMeta.Slot = Slot;
|
|
|
|
|
|
|
|
export default ExperimentalDiscountsMeta;
|