@shopgate/engage 6.23.3 → 6.23.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/tracking/action-creators/cookieConsent.js +3 -3
- package/tracking/actions/cookieConsent.js +2 -2
- package/tracking/selectors/cookieConsent.js +4 -4
- package/tracking/streams/cookieConsent.js +15 -5
- package/tracking/streams/index.js +1 -1
- package/tracking/subscriptions/analytics.js +2 -2
- package/tracking/subscriptions/cookieConsent.js +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/engage",
|
|
3
|
-
"version": "6.23.
|
|
3
|
+
"version": "6.23.4-beta.1",
|
|
4
4
|
"description": "Shopgate's ENGAGE library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"connect"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@shopgate/pwa-common": "6.23.
|
|
19
|
-
"@shopgate/pwa-common-commerce": "6.23.
|
|
20
|
-
"@shopgate/pwa-core": "6.23.
|
|
21
|
-
"@shopgate/pwa-ui-ios": "6.23.
|
|
22
|
-
"@shopgate/pwa-ui-material": "6.23.
|
|
23
|
-
"@shopgate/pwa-ui-shared": "6.23.
|
|
18
|
+
"@shopgate/pwa-common": "6.23.4-beta.1",
|
|
19
|
+
"@shopgate/pwa-common-commerce": "6.23.4-beta.1",
|
|
20
|
+
"@shopgate/pwa-core": "6.23.4-beta.1",
|
|
21
|
+
"@shopgate/pwa-ui-ios": "6.23.4-beta.1",
|
|
22
|
+
"@shopgate/pwa-ui-material": "6.23.4-beta.1",
|
|
23
|
+
"@shopgate/pwa-ui-shared": "6.23.4-beta.1",
|
|
24
24
|
"@virtuous/conductor": "~2.4.0",
|
|
25
25
|
"babel-plugin-transform-es3-member-expression-literals": "^6.8.0",
|
|
26
26
|
"babel-plugin-transform-es3-property-literals": "^6.8.0",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{UPDATE_COOKIE_CONSENT,COOKIE_CONSENT_HANDLED,HIDE_COOKIE_CONSENT_MODAL,SHOW_COOKIE_CONSENT_MODAL}from"../constants";/**
|
|
1
|
+
import{appConfig}from'@shopgate/engage';import{UPDATE_COOKIE_CONSENT,COOKIE_CONSENT_HANDLED,HIDE_COOKIE_CONSENT_MODAL,SHOW_COOKIE_CONSENT_MODAL}from"../constants";/**
|
|
2
2
|
* action to be dispatched when the cookie consent modal should be shown
|
|
3
3
|
* @returns {Function}
|
|
4
4
|
*/export var showCookieConsentModal=function showCookieConsentModal(){return{type:SHOW_COOKIE_CONSENT_MODAL};};/**
|
|
5
5
|
* action to be dispatched when the cookie consent modal should be hidden
|
|
6
6
|
* @returns {Function}
|
|
7
|
-
*/export var hideCookieConsentModal=function hideCookieConsentModal(){return{type:HIDE_COOKIE_CONSENT_MODAL};};/**
|
|
7
|
+
*/export var hideCookieConsentModal=function hideCookieConsentModal(){return{type:HIDE_COOKIE_CONSENT_MODAL};};var _appConfig$cookieCons=appConfig.cookieConsent;_appConfig$cookieCons=_appConfig$cookieCons===void 0?{}:_appConfig$cookieCons;var showComfortCookiesToggle=_appConfig$cookieCons.showComfortCookiesToggle;/**
|
|
8
8
|
* action to be dispatched when the user accepted the selected cookies in the custom modal
|
|
9
9
|
* @param {Object} params Action params
|
|
10
10
|
* @param {boolean} [params.comfortCookiesAccepted=false] whether this cookie type was accepted
|
|
@@ -12,7 +12,7 @@ import{UPDATE_COOKIE_CONSENT,COOKIE_CONSENT_HANDLED,HIDE_COOKIE_CONSENT_MODAL,SH
|
|
|
12
12
|
* @param {boolean} [params.statisticsCookiesAccepted=false] whether this cookie type was accepted
|
|
13
13
|
* by user
|
|
14
14
|
* @returns {Function}
|
|
15
|
-
*/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:comfortCookiesAccepted,statisticsCookiesAccepted:statisticsCookiesAccepted};};/**
|
|
15
|
+
*/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};};/**
|
|
16
16
|
* action to be dispatched when the cookies have been handled either by user or by merchant
|
|
17
17
|
* and native modal should be triggered for setting the permission
|
|
18
18
|
* @param {Object} params Action params
|
|
@@ -2,7 +2,7 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGenera
|
|
|
2
2
|
* action to be dispatched when the user accepted all cookies in the custom modal
|
|
3
3
|
* and native modal should be triggered for setting the permission
|
|
4
4
|
* @returns {Function}
|
|
5
|
-
*/export var acceptAllCookies=function acceptAllCookies(){return/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return dispatch(grantAppTrackingTransparencyPermission());case 2:dispatch(updateCookieConsent({comfortCookiesAccepted:true,statisticsCookiesAccepted:true}));dispatch(hideCookieConsentModal());
|
|
5
|
+
*/export var acceptAllCookies=function acceptAllCookies(){return/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return dispatch(grantAppTrackingTransparencyPermission());case 2:dispatch(updateCookieConsent({comfortCookiesAccepted:true,statisticsCookiesAccepted:true}));dispatch(hideCookieConsentModal());case 4:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}();};/**
|
|
6
6
|
* action to be dispatched when the user accepted the selected cookies in the custom modal
|
|
7
7
|
* and native modal should be triggered for setting the permission
|
|
8
8
|
* @param {Object} params Action params
|
|
@@ -11,7 +11,7 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGenera
|
|
|
11
11
|
* @param {boolean|null} params.statisticsCookiesAccepted whether this cookie type was accepted
|
|
12
12
|
* by user
|
|
13
13
|
* @returns {Function}
|
|
14
|
-
*/export var acceptSelectedCookies=function acceptSelectedCookies(_ref2){var comfortCookiesAccepted=_ref2.comfortCookiesAccepted,statisticsCookiesAccepted=_ref2.statisticsCookiesAccepted;return/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(dispatch){return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(!(comfortCookiesAccepted||statisticsCookiesAccepted)){_context2.next=3;break;}_context2.next=3;return dispatch(grantAppTrackingTransparencyPermission());case 3:dispatch(updateCookieConsent({comfortCookiesAccepted:comfortCookiesAccepted,statisticsCookiesAccepted:statisticsCookiesAccepted}));dispatch(hideCookieConsentModal());
|
|
14
|
+
*/export var acceptSelectedCookies=function acceptSelectedCookies(_ref2){var comfortCookiesAccepted=_ref2.comfortCookiesAccepted,statisticsCookiesAccepted=_ref2.statisticsCookiesAccepted;return/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(dispatch){return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(!(comfortCookiesAccepted||statisticsCookiesAccepted)){_context2.next=3;break;}_context2.next=3;return dispatch(grantAppTrackingTransparencyPermission());case 3:dispatch(updateCookieConsent({comfortCookiesAccepted:comfortCookiesAccepted,statisticsCookiesAccepted:statisticsCookiesAccepted}));dispatch(hideCookieConsentModal());case 5:case"end":return _context2.stop();}}},_callee2);}));return function(_x2){return _ref3.apply(this,arguments);};}();};/**
|
|
15
15
|
* action to be dispatched when the user selected only the required cookies in the custom modal
|
|
16
16
|
* and native modal should be triggered for setting the permission
|
|
17
17
|
* @returns {Function}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createSelector}from'reselect';/**
|
|
1
|
+
import{createSelector}from'reselect';import{appConfig}from'@shopgate/engage';/**
|
|
2
2
|
* Selects the cookie consent modal state.
|
|
3
3
|
* @param {Object} state The current state of the cookie consent modal.
|
|
4
4
|
* @returns {Object} whether cookie consent modal is shown.
|
|
@@ -16,15 +16,15 @@ import{createSelector}from'reselect';/**
|
|
|
16
16
|
* @private This selector is intended to be used internally. When a cookie consent status needs
|
|
17
17
|
* to be checked for a feature, please use `getAreStatisticsCookiesAccepted` instead.
|
|
18
18
|
* @returns {boolean|null} whether statistics cookies have been selected by the user.
|
|
19
|
-
*/export var getAreStatisticsCookiesAcceptedInternal=createSelector(getCookieSettingsState,function(settingsState){return settingsState.statisticsCookiesAccepted;});/**
|
|
19
|
+
*/export var getAreStatisticsCookiesAcceptedInternal=createSelector(getCookieSettingsState,function(settingsState){return settingsState.statisticsCookiesAccepted;});var _appConfig$cookieCons=appConfig.cookieConsent;_appConfig$cookieCons=_appConfig$cookieCons===void 0?{}:_appConfig$cookieCons;var showComfortCookiesToggle=_appConfig$cookieCons.showComfortCookiesToggle,isCookieConsentActivated=_appConfig$cookieCons.isCookieConsentActivated;/**
|
|
20
20
|
* Determines if comfort cookies where accepted in the cookie consent process. When cookie
|
|
21
21
|
* consent is inactive, the selector will also return true.
|
|
22
22
|
* @returns {boolean} whether comfort cookies are set and should activate tracking.
|
|
23
|
-
*/export var getAreComfortCookiesAccepted=createSelector(getCookieSettingsState,function(settingsState){if(settingsState.comfortCookiesAccepted===null)return true;return settingsState.comfortCookiesAccepted;});/**
|
|
23
|
+
*/export var getAreComfortCookiesAccepted=createSelector(getCookieSettingsState,function(settingsState){if(!isCookieConsentActivated||!showComfortCookiesToggle)return true;if(settingsState.comfortCookiesAccepted===null)return true;return settingsState.comfortCookiesAccepted;});/**
|
|
24
24
|
* Determines if statistics cookies where accepted in the cookie consent process. When cookie
|
|
25
25
|
* consent is inactive, the selector will also return true.
|
|
26
26
|
* @returns {boolean} whether statistics cookies are set and should activate tracking.
|
|
27
|
-
*/export var getAreStatisticsCookiesAccepted=createSelector(getCookieSettingsState,function(settingsState){if(settingsState.statisticsCookiesAccepted===null)return true;return settingsState.statisticsCookiesAccepted;});/**
|
|
27
|
+
*/export var getAreStatisticsCookiesAccepted=createSelector(getCookieSettingsState,function(settingsState){if(!isCookieConsentActivated)return true;if(settingsState.statisticsCookiesAccepted===null)return true;return settingsState.statisticsCookiesAccepted;});/**
|
|
28
28
|
* Selects the visibility property of the cookie consent modal.
|
|
29
29
|
* @returns {boolean} whether cookie consent modal is shown.
|
|
30
30
|
*/export var getIsCookieConsentModalVisible=createSelector(getCookieConsentModalState,getAreComfortCookiesAcceptedInternal,getAreStatisticsCookiesAcceptedInternal,function(modalState,comfortCookiesState,statisticsCookiesState){return modalState.isCookieConsentModalVisible&&comfortCookiesState===null&&statisticsCookiesState===null;});/**
|
|
@@ -7,23 +7,33 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
|
|
|
7
7
|
* handled already.
|
|
8
8
|
* @type {Observable}
|
|
9
9
|
*/export var cookieConsentInitialized$=cookieConsentSetInternal$.first();/**
|
|
10
|
+
* Gets triggered when the cookie consent was initialized / handled by user. In that case
|
|
11
|
+
* the UPDATE_COOKIE_CONSENT action is dispatched. When handled automatically the
|
|
12
|
+
* COOKIE_CONSENT_HANDLED action is dispatched.
|
|
13
|
+
*/export var cookieConsentInitializedByUserInternal$=cookieConsentInitialized$.filter(function(_ref2){var action=_ref2.action;return action.type===UPDATE_COOKIE_CONSENT;});/**
|
|
14
|
+
* Gets triggered when the user interacted with the buttons on the privacy settings page,
|
|
15
|
+
* but no settings was changed. Needed to navigate back to the previous page.
|
|
16
|
+
* When a setting was changed, the "cookieConsentUpdated$" stream triggers which will cause
|
|
17
|
+
* an app reload.
|
|
18
|
+
* @type {Observable}
|
|
19
|
+
*/export var privacySettingsConfirmedWithoutChangeInternal$=cookieConsentSetInternal$.pairwise().filter(function(_ref3){var _ref4=_slicedToArray(_ref3,2),actionPrev=_ref4[0].action,actionCurrent=_ref4[1].action;return actionPrev.comfortCookiesAccepted===actionCurrent.comfortCookiesAccepted&&actionPrev.statisticsCookiesAccepted===actionCurrent.statisticsCookiesAccepted;}).switchMap(function(_ref5){var _ref6=_slicedToArray(_ref5,2),latest=_ref6[1];return Observable.of(latest);});/**
|
|
10
20
|
* Gets triggered when cookie consent settings changed after initialization
|
|
11
21
|
* @type {Observable}
|
|
12
|
-
*/export var cookieConsentUpdated$=cookieConsentSetInternal$.pairwise().filter(function(
|
|
22
|
+
*/export var cookieConsentUpdated$=cookieConsentSetInternal$.pairwise().filter(function(_ref7){var _ref8=_slicedToArray(_ref7,2),actionPrev=_ref8[0].action,actionCurrent=_ref8[1].action;return actionPrev.comfortCookiesAccepted!==actionCurrent.comfortCookiesAccepted||actionPrev.statisticsCookiesAccepted!==actionCurrent.statisticsCookiesAccepted;}).switchMap(function(_ref9){var _ref10=_slicedToArray(_ref9,2),latest=_ref10[1];return Observable.of(latest);});/**
|
|
13
23
|
* Gets triggered when the cookie consent has been updated by the user or handled already.
|
|
14
24
|
* @type {Observable}
|
|
15
25
|
*/export var cookieConsentSet$=cookieConsentInitialized$.merge(cookieConsentUpdated$);/**
|
|
16
26
|
* Gets triggered when the cookie consent has been set either by user or merchant.
|
|
17
27
|
* @type {Observable}
|
|
18
|
-
*/export var comfortCookiesAccepted$=cookieConsentSet$.filter(function(
|
|
28
|
+
*/export var comfortCookiesAccepted$=cookieConsentSet$.filter(function(_ref11){var action=_ref11.action;return action.comfortCookiesAccepted===true;});/**
|
|
19
29
|
* Gets triggered when the cookie consent has been set either by user or merchant.
|
|
20
30
|
* @type {Observable}
|
|
21
|
-
*/export var statisticsCookiesAccepted$=cookieConsentSet$.filter(function(
|
|
31
|
+
*/export var statisticsCookiesAccepted$=cookieConsentSet$.filter(function(_ref12){var action=_ref12.action;return action.statisticsCookiesAccepted===true;});/**
|
|
22
32
|
* Gets triggered when comfort cookies where accepted first and declined afterwards during an
|
|
23
33
|
* app session.
|
|
24
34
|
* @type {Observable}
|
|
25
|
-
*/export var comfortCookiesDeclined$=comfortCookiesAccepted$.switchMap(function(){return cookieConsentSet$.filter(function(
|
|
35
|
+
*/export var comfortCookiesDeclined$=comfortCookiesAccepted$.switchMap(function(){return cookieConsentSet$.filter(function(_ref13){var action=_ref13.action;return action.comfortCookiesAccepted===false;}).first();});/**
|
|
26
36
|
* Gets triggered when statistics cookies where accepted first and declined afterwards during an
|
|
27
37
|
* app session.
|
|
28
38
|
* @type {Observable}
|
|
29
|
-
*/export var statisticsCookiesDeclined$=statisticsCookiesAccepted$.switchMap(function(){return cookieConsentSet$.filter(function(
|
|
39
|
+
*/export var statisticsCookiesDeclined$=statisticsCookiesAccepted$.switchMap(function(){return cookieConsentSet$.filter(function(_ref14){var action=_ref14.action;return action.statisticsCookiesAccepted===false;}).first();});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{cookieConsentInitialized$,cookieConsentUpdated$,cookieConsentSet$,comfortCookiesAccepted$,comfortCookiesDeclined$,statisticsCookiesAccepted$,statisticsCookiesDeclined$}from"./cookieConsent";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{reloadApp}from'@shopgate/engage/core/action-creators';import{appSupportsCookieConsent}from'@shopgate/engage/core/helpers';import{analyticsSetConsent}from'@shopgate/engage/core/commands';import{cookieConsentInitialized$,cookieConsentUpdated$}from"../streams";/**
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{reloadApp}from'@shopgate/engage/core/action-creators';import{appSupportsCookieConsent,hasSGJavaScriptBridge}from'@shopgate/engage/core/helpers';import{analyticsSetConsent}from'@shopgate/engage/core/commands';import{cookieConsentInitialized$,cookieConsentUpdated$}from"../streams";/**
|
|
2
2
|
* Analytics subscriptions
|
|
3
3
|
* @param {Function} subscribe The subscribe function
|
|
4
4
|
*/export default function analytics(subscribe){/**
|
|
5
5
|
* Sends cookie consent decisions to the app
|
|
6
6
|
* @param {Object} params Function params
|
|
7
7
|
* @param {Object} params.action Cookie consent update action
|
|
8
|
-
*/var sendConsentToApp=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref){var action,statisticsCookiesAccepted,comfortCookiesAccepted;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:action=_ref.action;if(appSupportsCookieConsent()){_context.next=3;break;}return _context.abrupt("return");case 3:statisticsCookiesAccepted=action.statisticsCookiesAccepted,comfortCookiesAccepted=action.comfortCookiesAccepted;// Send consent decisions to the app
|
|
8
|
+
*/var sendConsentToApp=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref){var action,statisticsCookiesAccepted,comfortCookiesAccepted;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:action=_ref.action;if(!(!appSupportsCookieConsent()||!hasSGJavaScriptBridge())){_context.next=3;break;}return _context.abrupt("return");case 3:statisticsCookiesAccepted=action.statisticsCookiesAccepted,comfortCookiesAccepted=action.comfortCookiesAccepted;// Send consent decisions to the app
|
|
9
9
|
_context.next=6;return analyticsSetConsent({statistics:statisticsCookiesAccepted,comfort:comfortCookiesAccepted});case 6:case"end":return _context.stop();}}},_callee);}));return function sendConsentToApp(_x){return _ref2.apply(this,arguments);};}();subscribe(cookieConsentInitialized$,/*#__PURE__*/function(){var _ref4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3){var action;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:action=_ref3.action;_context2.next=3;return sendConsentToApp({action:action});case 3:case"end":return _context2.stop();}}},_callee2);}));return function(_x2){return _ref4.apply(this,arguments);};}());subscribe(cookieConsentUpdated$,/*#__PURE__*/function(){var _ref6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5){var dispatch,action;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:dispatch=_ref5.dispatch,action=_ref5.action;_context3.next=3;return sendConsentToApp({action:action});case 3:// The PWA is reloaded whenever cookie consent settings changed to guarantee that all trackers
|
|
10
10
|
// are turned off
|
|
11
11
|
dispatch(reloadApp());case 4:case"end":return _context3.stop();}}},_callee3);}));return function(_x3){return _ref6.apply(this,arguments);};}());}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{main$,appDidStart$}from'@shopgate/engage/core/streams';import{ROUTE_WILL_LEAVE}from'@shopgate/engage/core/constants';import{PRIVACY_SETTINGS_PATTERN}from'@shopgate/engage/tracking/constants';import{appSupportsCookieConsent}from'@shopgate/engage/core/helpers';import{grantAppTrackingTransparencyPermission}from'@shopgate/engage/core/actions';import{handleCookieConsent,showCookieConsentModal}from"../action-creators";import{getIsCookieConsentHandled,getAreComfortCookiesAccepted,getAreStatisticsCookiesAccepted}from"../selectors/cookieConsent";import{appConfig}from"../../index";/**
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{main$,appDidStart$}from'@shopgate/engage/core/streams';import{ROUTE_WILL_LEAVE}from'@shopgate/engage/core/constants';import{PRIVACY_SETTINGS_PATTERN}from'@shopgate/engage/tracking/constants';import{appSupportsCookieConsent}from'@shopgate/engage/core/helpers';import{grantAppTrackingTransparencyPermission,historyReset,historyPop}from'@shopgate/engage/core/actions';import{handleCookieConsent,showCookieConsentModal}from"../action-creators";import{getIsCookieConsentHandled,getAreComfortCookiesAccepted,getAreStatisticsCookiesAccepted}from"../selectors/cookieConsent";import{cookieConsentInitializedByUserInternal$,privacySettingsConfirmedWithoutChangeInternal$}from"../streams/cookieConsent";import{appConfig}from"../../index";/**
|
|
2
2
|
* stream which gets triggered when the user navigates back from privacy settings page
|
|
3
3
|
* and cookie consent modal needs to be shown again.
|
|
4
4
|
* @type {Observable}
|
|
@@ -11,4 +11,7 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGenera
|
|
|
11
11
|
* consent.
|
|
12
12
|
*/if(!(!isCookieConsentActivated||isCookieConsentActivated&&isCookieConsentHandled||!appSupportsCookieConsent())){_context.next=14;break;}comfortCookiesAccepted=getAreComfortCookiesAccepted(state);statisticsCookiesAccepted=getAreStatisticsCookiesAccepted(state);dispatch(handleCookieConsent({comfortCookiesAccepted:comfortCookiesAccepted,statisticsCookiesAccepted:statisticsCookiesAccepted}));if(!(appSupportsCookieConsent()&&(comfortCookiesAccepted||statisticsCookiesAccepted))){_context.next=13;break;}_context.next=13;return dispatch(grantAppTrackingTransparencyPermission());case 13:return _context.abrupt("return");case 14:// if merchant has activated cookie feature but user has not chosen cookies yet:
|
|
13
13
|
// show cookie consent modal to make user choose them
|
|
14
|
-
if(isCookieConsentActivated&&!isCookieConsentHandled){dispatch(showCookieConsentModal());}case 15:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref4.apply(this,arguments);};}());subscribe(navigateBackToCookieModal$,function(_ref5){var dispatch=_ref5.dispatch,getState=_ref5.getState;var isCookieConsentActivated=appConfig.cookieConsent.isCookieConsentActivated;var isCookieConsentHandled=getIsCookieConsentHandled(getState());if(isCookieConsentActivated&&!isCookieConsentHandled){dispatch(showCookieConsentModal());}});
|
|
14
|
+
if(isCookieConsentActivated&&!isCookieConsentHandled){dispatch(showCookieConsentModal());}case 15:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref4.apply(this,arguments);};}());subscribe(navigateBackToCookieModal$,function(_ref5){var dispatch=_ref5.dispatch,getState=_ref5.getState;var isCookieConsentActivated=appConfig.cookieConsent.isCookieConsentActivated;var isCookieConsentHandled=getIsCookieConsentHandled(getState());if(isCookieConsentActivated&&!isCookieConsentHandled){dispatch(showCookieConsentModal());}});subscribe(cookieConsentInitializedByUserInternal$,function(_ref6){var dispatch=_ref6.dispatch;// Reset history after consent initialization to guarantee an empty history
|
|
15
|
+
dispatch(historyReset());});subscribe(privacySettingsConfirmedWithoutChangeInternal$,function(_ref7){var dispatch=_ref7.dispatch;// Remove privacy settings route from route stack when any button was clicked but no settings
|
|
16
|
+
// where changed. When something was changed, app will reset via the "analytics" streams.
|
|
17
|
+
dispatch(historyPop());});}
|