UNPKG

@shopgate/engage

Version:
10 lines 1.21 kB
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{connect}from'react-redux';import{historyPush}from'@shopgate/engage/core';import{getProductDescription}from'@shopgate/engage/product';/** * Maps the contents of the state to the component props. * @param {Object} state The current application state. * @param {Object} props The current component props. * @return {Object} The extended component props. */var mapStateToProps=function mapStateToProps(state,props){return{html:getProductDescription(state,props)};};/** * Connects the dispatch function to a callable function in the props. * @param {Function} dispatch The redux dispatch function. * @return {Object} The extended component props. */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{navigate:function navigate(pathname,target){return dispatch(historyPush(_extends({pathname:pathname},target&&{state:{target:target}})));}};};export default connect(mapStateToProps,mapDispatchToProps);