@shopgate/engage
Version:
Shopgate's ENGAGE library.
24 lines • 2.6 kB
JavaScript
import{appConfig}from'@shopgate/engage';import{UPDATE_COOKIE_CONSENT,COOKIE_CONSENT_HANDLED,HIDE_COOKIE_CONSENT_MODAL,SHOW_COOKIE_CONSENT_MODAL}from"../constants";var _appConfig$cookieCons=appConfig.cookieConsent,_appConfig$cookieCons2=_appConfig$cookieCons===void 0?{}:_appConfig$cookieCons,showComfortCookiesToggle=_appConfig$cookieCons2.showComfortCookiesToggle;/**
* action to be dispatched when the cookie consent modal should be shown
* @returns {Function}
*/export var showCookieConsentModal=function showCookieConsentModal(){return{type:SHOW_COOKIE_CONSENT_MODAL};};/**
* action to be dispatched when the cookie consent modal should be hidden
* @returns {Function}
*/export var hideCookieConsentModal=function hideCookieConsentModal(){return{type:HIDE_COOKIE_CONSENT_MODAL};};/**
* action to be dispatched when the user accepted the selected cookies in the custom modal
* @param {Object} params Action params
* @param {boolean} [params.comfortCookiesAccepted=false] whether this cookie type was accepted
* by user
* @param {boolean} [params.statisticsCookiesAccepted=false] whether this cookie type was accepted
* by user
* @returns {Function}
*/export var updateCookieConsent=function updateCookieConsent(_ref){var _ref$comfortCookiesAc=_ref.comfortCookiesAccepted,comfortCookiesAccepted=_ref$comfortCookiesAc===void 0?false:_ref$comfortCookiesAc,_ref$statisticsCookie=_ref.statisticsCookiesAccepted,statisticsCookiesAccepted=_ref$statisticsCookie===void 0?false:_ref$statisticsCookie;return{type:UPDATE_COOKIE_CONSENT,comfortCookiesAccepted:showComfortCookiesToggle===true?comfortCookiesAccepted:true,statisticsCookiesAccepted:statisticsCookiesAccepted};};/**
* action to be dispatched when the cookies have been handled either by user or by merchant
* and native modal should be triggered for setting the permission
* @param {Object} params Action params
* @param {boolean} [params.comfortCookiesAccepted=false] whether this cookie type was accepted
* by user
* @param {boolean} [params.statisticsCookiesAccepted=false] whether this cookie type was accepted
* by user
* @returns {Function}
*/export var handleCookieConsent=function handleCookieConsent(_ref2){var _ref2$comfortCookiesA=_ref2.comfortCookiesAccepted,comfortCookiesAccepted=_ref2$comfortCookiesA===void 0?false:_ref2$comfortCookiesA,_ref2$statisticsCooki=_ref2.statisticsCookiesAccepted,statisticsCookiesAccepted=_ref2$statisticsCooki===void 0?false:_ref2$statisticsCooki;return{type:COOKIE_CONSENT_HANDLED,comfortCookiesAccepted:comfortCookiesAccepted,statisticsCookiesAccepted:statisticsCookiesAccepted};};