UNPKG

@shopgate/engage

Version:
8 lines 726 B
import{connect}from'react-redux';import{getPromotionCoupons,deleteCouponsFromCart}from'@shopgate/engage/cart';/** * Maps the contents of the state to the component props. * @param {Object} state The current application state. * @return {Object} The extended component props. */var mapStateToProps=function mapStateToProps(state){return{coupons:getPromotionCoupons(state)};};/** * @param {Function} dispatch The redux dispatch function. * @return {Object} The extended component props. */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{deleteCoupon:function deleteCoupon(couponCode){return dispatch(deleteCouponsFromCart([couponCode]));}};};export default connect(mapStateToProps,mapDispatchToProps);