UNPKG

@shopgate/engage

Version:
29 lines (27 loc) 783 B
/* eslint-disable react/prop-types */ import React from 'react'; import { isBeta } from "../../core"; import withMapPricing from "./withMapPricing"; /** * @param {Function|React.Component} PriceComponent price component with product price shape * @returns {Function} */ import { jsx as _jsx } from "react/jsx-runtime"; const withPriceCalculation = PriceComponent => props => { // price is null if (!props.price) { return /*#__PURE__*/_jsx(PriceComponent, { ...props }); } // HOC for map price if (isBeta() && props.price.mapPricing) { return withMapPricing(PriceComponent)(props); } // Fallback to default return /*#__PURE__*/_jsx(PriceComponent, { ...props }); }; export default withPriceCalculation; /* eslint-enable react/prop-types */