@shopgate/engage
Version:
Shopgate's ENGAGE library.
12 lines • 1.01 kB
JavaScript
import{connect}from'react-redux';import{fetchProductRelations,makeGetMaximumRelatedProducts}from'@shopgate/engage/product';/**
* Creates the mapStateToProps connector function.
* @returns {Function}
*/function makeMapStateToProps(){var getMaximumRelatedProducts=makeGetMaximumRelatedProducts();/**
* @param {Object} state The application state.
* @param {Object} props The component props.
* @returns {Object}
*/return function(state,props){return{products:getMaximumRelatedProducts(state,props)};};}/**
* @param {Function} dispatch Dispatches an action.
* @param {Object} props The component props.
* @returns {Object}
*/var mapDispatchToProps=function mapDispatchToProps(dispatch,_ref){var productId=_ref.productId,type=_ref.type,_ref$limit=_ref.limit,limit=_ref$limit===void 0?100:_ref$limit;return{getRelations:function getRelations(){return dispatch(fetchProductRelations({productId:productId,type:type,limit:limit}));}};};export default connect(makeMapStateToProps,mapDispatchToProps);