UNPKG

@shopgate/engage

Version:
7 lines 691 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} */var withPriceCalculation=function withPriceCalculation(PriceComponent){return function(props){// price is null if(!props.price){return React.createElement(PriceComponent,props);}// HOC for map price if(isBeta()&&props.price.mapPricing){return withMapPricing(PriceComponent)(props);}// Fallback to default return React.createElement(PriceComponent,props);};};export default withPriceCalculation;/* eslint-enable react/prop-types */