UNPKG

@shopgate/engage

Version:
5 lines 705 B
import{connect}from'react-redux';import{getProduct}from'@shopgate/pwa-common-commerce/product/selectors/product';import{AVAILABILITY_STATE_OK}from'@shopgate/pwa-common-commerce/product/constants';/** * Creates the mapStateToProps connector function. * @returns {Function} */var makeMapStateToProps=function makeMapStateToProps(){return function(state,props){var product=getProduct(state,props);if(!product){return{availability:null,fulfillmentMethods:null};}return{// Show stock info always as availability on PDP availability:!product.stock?null:{text:product.stock.info,state:AVAILABILITY_STATE_OK},fulfillmentMethods:product.fulfillmentMethods||null};};};export default connect(makeMapStateToProps);