@shopgate/engage
Version:
Shopgate's ENGAGE library.
3 lines • 887 B
JavaScript
import{connect}from'react-redux';import{hasLineItemPromotions}from'@shopgate/engage/cart';import{makeGetEnabledFulfillmentMethodsCount}from'@shopgate/engage/core/config';import{makeGetLocation}from'@shopgate/engage/locations';/**
* @return {Function} The extended component props.
*/var makeMapStateToProps=function makeMapStateToProps(){var getEnabledFulfillmentMethods=makeGetEnabledFulfillmentMethodsCount();var getLocation=makeGetLocation(function(state,props){return props.locationId;});return function(state,props){var isOrderDetails=props.isOrderDetails,isCheckoutConfirmation=props.isCheckoutConfirmation;var isCart=!isOrderDetails&&!isCheckoutConfirmation;return{location:getLocation(state,props),enabledFulfillmentMethodsCount:getEnabledFulfillmentMethods(state),cartHasLineItemPromotions:isCart&&hasLineItemPromotions(state)};};};export default connect(makeMapStateToProps);