@shopgate/engage
Version:
Shopgate's ENGAGE library.
6 lines • 1.07 kB
JavaScript
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{HIDE_COOKIE_CONSENT_MODAL,SHOW_COOKIE_CONSENT_MODAL}from"../constants";var defaultState={isCookieConsentModalVisible:false};/**
* Stores all states of the cookie consent modal.
* @param {Object} [state] The current state.
* @param {Object} action The action object.
* @return {Object} The new state.
*/var cookieConsentModalReducer=function cookieConsentModalReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case SHOW_COOKIE_CONSENT_MODAL:{return _extends({},state,{isCookieConsentModalVisible:true});}case HIDE_COOKIE_CONSENT_MODAL:{return _extends({},state,{isCookieConsentModalVisible:false});}default:return state;}};export default cookieConsentModalReducer;