@shopgate/engage 7.20.0-beta.1 → 7.20.0-beta.10

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.
Files changed (140) hide show
  1. package/account/actions/addContacts.js +1 -1
  2. package/account/actions/deleteContact.js +1 -1
  3. package/account/actions/deleteCustomer.js +1 -1
  4. package/account/actions/fetchContacts.js +1 -1
  5. package/account/actions/fetchCustomer.js +1 -1
  6. package/account/actions/updateContact.js +1 -1
  7. package/account/actions/updateCustomer.js +1 -1
  8. package/account/components/Account/Account.js +1 -1
  9. package/account/reducers/index.js +2 -2
  10. package/cart/cart.helpers.js +8 -1
  11. package/cart/components/CartItem/CartItemProductLayout.js +2 -1
  12. package/cart/index.js +2 -1
  13. package/cart/streams/index.js +1 -0
  14. package/checkout/components/Checkout/CheckoutPickupContactForm.config.js +1 -1
  15. package/checkout/components/GuestCheckout/GuestCheckoutPickupNotes.config.js +1 -1
  16. package/checkout/components/index.js +1 -1
  17. package/checkout/constants/index.js +1 -1
  18. package/checkout/index.js +3 -4
  19. package/checkout/paymentMethods/stripe/sdk.js +3 -2
  20. package/components/ChipLayout/style.js +2 -2
  21. package/components/ConditionalWrapper/ConditionalWrapper.js +7 -2
  22. package/components/QuantityInput/QuantityInput.js +5 -4
  23. package/components/ResponsiveContainer/ResponsiveContainer.js +2 -6
  24. package/components/ResponsiveContainer/breakpoints.js +2 -1
  25. package/components/ResponsiveContainer/hooks.js +20 -0
  26. package/components/ScrollHeader/index.js +2 -2
  27. package/components/ScrollHeader/style.js +1 -1
  28. package/core/constants/index.js +1 -1
  29. package/core/helpers/appFeatures.js +2 -1
  30. package/core/helpers/i18n.js +1 -1
  31. package/core/helpers/index.js +1 -1
  32. package/core/hooks/index.js +1 -1
  33. package/core/streams/index.js +1 -1
  34. package/core/subscriptions/app.js +2 -2
  35. package/favorites/components/Item/Item.js +6 -6
  36. package/favorites/components/List/List.js +17 -6
  37. package/favorites/components/List/ListAccordionLabel.js +4 -0
  38. package/favorites/components/List/ListContent.js +8 -0
  39. package/favorites/components/List/ListItemWrapper.js +6 -0
  40. package/favorites/components/List/styles.js +1 -0
  41. package/favorites/components/Lists/Lists.js +4 -4
  42. package/favorites/components/Lists/ListsModal.js +3 -2
  43. package/favorites/constants/index.js +1 -0
  44. package/filter/actions/index.js +1 -0
  45. package/filter/components/PriceSlider/style.js +1 -3
  46. package/filter/components/index.js +1 -0
  47. package/filter/constants/index.js +1 -1
  48. package/filter/helpers/buildInitialFilters.js +1 -1
  49. package/filter/helpers/translateFilterLabel.js +3 -3
  50. package/filter/index.js +2 -7
  51. package/filter/selectors/index.js +1 -1
  52. package/filter/streams/index.js +1 -0
  53. package/i18n/locale/cs-cz/countries.json +255 -0
  54. package/i18n/locale/de-de/countries.json +26 -28
  55. package/i18n/locale/el-gr/countries.json +255 -0
  56. package/i18n/locale/en-us/countries.json +12 -14
  57. package/i18n/locale/es-es/countries.json +65 -67
  58. package/i18n/locale/fi-fi/countries.json +255 -0
  59. package/i18n/locale/fr-fr/countries.json +85 -87
  60. package/i18n/locale/hu-hu/countries.json +255 -0
  61. package/i18n/locale/it-it/countries.json +11 -13
  62. package/i18n/locale/nl-nl/countries.json +42 -44
  63. package/i18n/locale/pl-pl/countries.json +255 -0
  64. package/i18n/locale/pt-pt/countries.json +128 -130
  65. package/i18n/locale/ro-ro/countries.json +255 -0
  66. package/i18n/locale/sv-se/countries.json +255 -0
  67. package/locations/action-creators/receiveInventories.js +3 -5
  68. package/locations/components/StoreList/StoreListSearch.js +3 -1
  69. package/locations/subscriptions.js +2 -2
  70. package/orders/index.js +1 -1
  71. package/package.json +7 -7
  72. package/page/selectors/index.js +7 -1
  73. package/product/components/Options/components/Content/spec.js +1 -1
  74. package/product/components/ProductSlider/index.js +1 -1
  75. package/product/components/QuantityPicker/hooks.js +5 -0
  76. package/product/components/QuantityPicker/index.js +2 -2
  77. package/product/components/Rating/spec.js +1 -1
  78. package/product/components/UnitQuantityPicker/CartUnitQuantityPicker.js +2 -2
  79. package/product/components/UnitQuantityPicker/ProductUnitQuantityPicker.js +3 -2
  80. package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +6 -3
  81. package/product/components/UnitQuantityPicker/UnitQuantityPickerWithSection.js +7 -0
  82. package/product/components/UnitQuantityPicker/index.js +1 -1
  83. package/product/components/index.js +1 -1
  84. package/product/providers/ProductListType/context.js +2 -1
  85. package/product/providers/ProductListType/index.js +2 -1
  86. package/product/providers/index.js +1 -1
  87. package/product/selectors/product.js +12 -2
  88. package/push-opt-in/components/PushOptInModal/index.js +5 -6
  89. package/push-opt-in/subscriptions/optInTrigger.js +3 -5
  90. package/registration/components/index.js +1 -0
  91. package/registration/index.js +1 -1
  92. package/registration/streams/index.js +4 -0
  93. package/registration/subscriptions/index.js +4 -4
  94. package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/style.js +1 -2
  95. package/reviews/components/Reviews/components/RatingCount/style.js +1 -2
  96. package/reviews/index.js +3 -1
  97. package/styles/helpers/initCSSCustomProperties.js +2 -2
  98. package/styles/helpers/loadCustomStyles.js +2 -2
  99. package/styles/helpers/setPageBackgroundColor.js +2 -1
  100. package/tracking/action-creators/cookieConsent.js +24 -0
  101. package/tracking/action-creators/index.js +1 -4
  102. package/tracking/actions/cookieConsent.js +21 -0
  103. package/tracking/actions/index.js +1 -0
  104. package/tracking/components/CookieConsentModal/connector.js +6 -0
  105. package/tracking/components/CookieConsentModal/index.js +9 -0
  106. package/tracking/components/CookieConsentModal/style.js +1 -0
  107. package/tracking/components/CookieConsentModal/tracking-opt-in.svg +18 -0
  108. package/tracking/components/PrivacySettings/connector.js +6 -0
  109. package/tracking/components/PrivacySettings/index.js +4 -0
  110. package/tracking/components/PrivacySettings/style.js +1 -0
  111. package/tracking/components/index.js +1 -1
  112. package/tracking/constants/index.js +0 -1
  113. package/tracking/reducers/cookieConsentModal.js +6 -0
  114. package/tracking/reducers/cookieSettings.js +6 -0
  115. package/tracking/reducers/index.js +1 -0
  116. package/tracking/selectors/cookieConsent.js +35 -0
  117. package/tracking/selectors/index.js +1 -4
  118. package/tracking/streams/cookieConsent.js +46 -0
  119. package/tracking/streams/index.js +1 -1
  120. package/tracking/subscriptions/analytics.js +11 -0
  121. package/tracking/subscriptions/cookieConsent.js +13 -0
  122. package/tracking/subscriptions/index.js +1 -4
  123. package/user/index.js +1 -1
  124. package/i18n/locale/ru-ru/countries.json +0 -251
  125. package/product/components/QuantityPicker/helpers.js +0 -5
  126. package/tracking/components/CookieConsent/CookieConsent.connector.js +0 -4
  127. package/tracking/components/CookieConsent/CookieConsent.js +0 -4
  128. package/tracking/components/CookieConsent/CookieConsentButtons.js +0 -3
  129. package/tracking/components/CookieConsent/CookieConsentCheckboxes.js +0 -3
  130. package/tracking/components/CookieConsent/CookieConsentContent.js +0 -4
  131. package/tracking/components/CookieConsent/CookieConsentMessage.js +0 -4
  132. package/tracking/components/CookieConsent/index.js +0 -1
  133. package/tracking/helpers/index.js +0 -7
  134. package/tracking/hooks/index.js +0 -4
  135. package/tracking/index.js +0 -1
  136. package/tracking/providers/CookieConsentProvider.connector.js +0 -4
  137. package/tracking/providers/CookieConsentProvider.context.js +0 -1
  138. package/tracking/providers/CookieConsentProvider.js +0 -8
  139. /package/product/{components/ProductProvider → providers/Product}/connector.js +0 -0
  140. /package/product/{components/ProductProvider → providers/Product}/index.js +0 -0
@@ -1,6 +1,4 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}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{appConfig}from'@shopgate/engage';import{main$,appDidStart$}from'@shopgate/engage/core/streams';import{event}from'@shopgate/engage/core/classes';import{appSupportsPushOptIn,logger}from'@shopgate/engage/core/helpers';import{PERMISSION_ID_PUSH,PERMISSION_STATUS_NOT_DETERMINED}from'@shopgate/engage/core/constants';import{requestAppPermissionStatus}from'@shopgate/engage/core/actions';// TODO replace appDidStart$ with cookieConsentInitialized$ after cookie consent feature is merged
2
- // import { cookieConsentInitialized$ } from '@shopgate/engage/tracking/streams';
3
- import{increaseAppStartCount,resetAppStartCount,increaseOrdersPlacedCount,resetOrdersPlacedCount,setLastPopupTimestamp,increaseRejectionCount,showPushOptInModal}from"../action-creators";import{PUSH_OPT_IN_OPT_IN_POSTPONED}from"../constants";import{getPushOptInTriggerState}from"../selectors";var DAY_IN_MS=1000*60*60*24;var increaseRejectionCount$=main$.filter(function(_ref){var action=_ref.action;return action.type===PUSH_OPT_IN_OPT_IN_POSTPONED;});/**
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}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{appConfig}from'@shopgate/engage';import{main$}from'@shopgate/engage/core/streams';import{event}from'@shopgate/engage/core/classes';import{appSupportsPushOptIn,logger}from'@shopgate/engage/core/helpers';import{PERMISSION_ID_PUSH,PERMISSION_STATUS_NOT_DETERMINED}from'@shopgate/engage/core/constants';import{requestAppPermissionStatus}from'@shopgate/engage/core/actions';import{cookieConsentInitialized$}from'@shopgate/engage/tracking/streams';import{increaseAppStartCount,resetAppStartCount,increaseOrdersPlacedCount,resetOrdersPlacedCount,setLastPopupTimestamp,increaseRejectionCount,showPushOptInModal}from"../action-creators";import{PUSH_OPT_IN_OPT_IN_POSTPONED}from"../constants";import{getPushOptInTriggerState}from"../selectors";var DAY_IN_MS=1000*60*60*24;var increaseRejectionCount$=main$.filter(function(_ref){var action=_ref.action;return action.type===PUSH_OPT_IN_OPT_IN_POSTPONED;});/**
4
2
  * Push opt in subscriptions
5
3
  * @param {Function} subscribe The subscribe function
6
4
  */export default function pushOptIn(subscribe){/**
@@ -10,5 +8,5 @@ import{increaseAppStartCount,resetAppStartCount,increaseOrdersPlacedCount,resetO
10
8
  * @returns {void}
11
9
  */var showOptInAfterChecks=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2,configKey,increaseCountAction){var dispatch,getState,_appConfig$pushOptIn,_appConfig$pushOptIn2,appStarts,ordersPlaced,rejectionMaxCount,minDaysBetweenOptIns,_ref4,pushStatus,state,configValue,resetAction,resetCountState,configCountState,mustShowModal,hasRepeats,minDaysElapsed;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:dispatch=_ref2.dispatch,getState=_ref2.getState;if(appSupportsPushOptIn()){_context.next=3;break;}return _context.abrupt("return");case 3:_appConfig$pushOptIn=appConfig.pushOptIn,_appConfig$pushOptIn2=_appConfig$pushOptIn===void 0?{}:_appConfig$pushOptIn,appStarts=_appConfig$pushOptIn2.appStarts,ordersPlaced=_appConfig$pushOptIn2.ordersPlaced,rejectionMaxCount=_appConfig$pushOptIn2.rejectionMaxCount,minDaysBetweenOptIns=_appConfig$pushOptIn2.minDaysBetweenOptIns;// Deactivate feature when config is invalid
12
10
  if(!(typeof minDaysBetweenOptIns!=='number'||typeof rejectionMaxCount!=='number'||_typeof(ordersPlaced)!=='object'||_typeof(appStarts)!=='object')){_context.next=7;break;}logger.error('PushOptInTrigger - Config invalid',appConfig===null||appConfig===void 0?void 0:appConfig.pushOptIn);return _context.abrupt("return");case 7:_context.next=9;return dispatch(requestAppPermissionStatus({permissionId:PERMISSION_ID_PUSH}));case 9:_ref4=_context.sent;pushStatus=_ref4.status;if(!(pushStatus!==PERMISSION_STATUS_NOT_DETERMINED)){_context.next=13;break;}return _context.abrupt("return");case 13:dispatch(increaseCountAction());state=getPushOptInTriggerState(getState());configValue=appStarts;resetAction=resetAppStartCount;resetCountState=state.appStartResetCount;configCountState=state.appStartCount;if(configKey==='ordersPlaced'){configValue=ordersPlaced;resetAction=resetOrdersPlacedCount;resetCountState=state.ordersPlacedResetCount;configCountState=state.ordersPlacedCount;}if(!(state.rejectionCount>=rejectionMaxCount)){_context.next=22;break;}return _context.abrupt("return");case 22:mustShowModal=Number(configValue.value)>0&&configCountState>=configValue.value;hasRepeats=configValue.repeats===null||resetCountState<=configValue.repeats;minDaysElapsed=Date.now()-state.lastPopupAt>=minDaysBetweenOptIns*DAY_IN_MS;if(mustShowModal&&hasRepeats&&minDaysElapsed){dispatch(setLastPopupTimestamp());dispatch(resetAction());dispatch(showPushOptInModal());}case 26:case"end":return _context.stop();}},_callee);}));return function showOptInAfterChecks(_x,_x2,_x3){return _ref3.apply(this,arguments);};}();// event subscriber to handle app start based push opt in
13
- subscribe(appDidStart$,/*#__PURE__*/function(){var _ref6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref5){var dispatch,getState;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:dispatch=_ref5.dispatch,getState=_ref5.getState;_context2.next=3;return showOptInAfterChecks({dispatch:dispatch,getState:getState},'appStarts',increaseAppStartCount);case 3:case"end":return _context2.stop();}},_callee2);}));return function(_x4){return _ref6.apply(this,arguments);};}());// event subscriber to handle order based push opt in
14
- subscribe(appDidStart$,function(_ref7){var dispatch=_ref7.dispatch,getState=_ref7.getState;event.addCallback('checkoutSuccess',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(){return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return showOptInAfterChecks({dispatch:dispatch,getState:getState},'ordersPlaced',increaseOrdersPlacedCount);case 2:case"end":return _context3.stop();}},_callee3);})));});subscribe(increaseRejectionCount$,function(_ref9){var dispatch=_ref9.dispatch;dispatch(increaseRejectionCount());});}
11
+ subscribe(cookieConsentInitialized$,/*#__PURE__*/function(){var _ref6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref5){var dispatch,getState;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:dispatch=_ref5.dispatch,getState=_ref5.getState;_context2.next=3;return showOptInAfterChecks({dispatch:dispatch,getState:getState},'appStarts',increaseAppStartCount);case 3:case"end":return _context2.stop();}},_callee2);}));return function(_x4){return _ref6.apply(this,arguments);};}());// event subscriber to handle order based push opt in
12
+ subscribe(cookieConsentInitialized$,function(_ref7){var dispatch=_ref7.dispatch,getState=_ref7.getState;event.addCallback('checkoutSuccess',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(){return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return showOptInAfterChecks({dispatch:dispatch,getState:getState},'ordersPlaced',increaseOrdersPlacedCount);case 2:case"end":return _context3.stop();}},_callee3);})));});subscribe(increaseRejectionCount$,function(_ref9){var dispatch=_ref9.dispatch;dispatch(increaseRejectionCount());});}
@@ -0,0 +1 @@
1
+ export{default as Registration}from"./Registration/Registration";export{default as GuestRegistration}from"./GuestRegistration/GuestRegistration";
@@ -1,2 +1,2 @@
1
1
  // Components
2
- export{default as Registration}from"./components/Registration/Registration";export{default as GuestRegistration}from"./components/GuestRegistration/GuestRegistration";export{MARKETING_OPT_IN_DEFAULT}from"./constants";
2
+ export{MARKETING_OPT_IN_DEFAULT}from"./constants";
@@ -0,0 +1,4 @@
1
+ import{main$}from'@shopgate/pwa-common/streams';import{SUCCESS_REGISTRATION}from"../constants/actionTypes";/**
2
+ * Gets triggered when registration was successful via the shopgate.user.register pipeline
3
+ * @type {Observable}
4
+ */export var registrationSuccess$=main$.filter(function(_ref){var action=_ref.action;return action.type===SUCCESS_REGISTRATION;});
@@ -1,5 +1,5 @@
1
- import{main$,makeGetPrevRoute,getCurrentRoute,historyPop}from'@shopgate/engage/core';import{LOGIN_PATH}from'@shopgate/pwa-common/constants/RoutePaths';import{successLogin}from'@shopgate/pwa-common/action-creators';import{SUCCESS_REGISTRATION}from"../constants";/**
1
+ import{makeGetPrevRoute,getCurrentRoute,historyPop}from'@shopgate/engage/core';import{LOGIN_PATH}from'@shopgate/pwa-common/constants/RoutePaths';import{REGISTRATION_FORM_LOGIN_STRATEGY}from'@shopgate/pwa-common/constants/user';import{successLogin}from'@shopgate/pwa-common/action-creators';import{registrationSuccess$}from"../streams";/**
2
2
  * @param {Function} subscribe Subscribes to an observable.
3
- */export default function registration(subscribe){var registrationSuccess$=main$.filter(function(_ref){var action=_ref.action;return action.type===SUCCESS_REGISTRATION;});subscribe(registrationSuccess$,function(_ref2){var dispatch=_ref2.dispatch,getState=_ref2.getState;var currentRoute=getCurrentRoute(getState());var redirect;if(currentRoute){// Try to get the login page from the router stack to extract the original redirect target
4
- var getPrevRoute=makeGetPrevRoute();var routeId=currentRoute.id;var _ref4=getPrevRoute(getState(),{routeId:routeId})||{},pattern=_ref4.pattern,state=_ref4.state;if(pattern===LOGIN_PATH&&(state===null||state===void 0?void 0:state.redirect)){redirect=state.redirect;}}// TODO improve navigation since the login page will be briefly visible
5
- dispatch(historyPop());dispatch(successLogin(redirect));});}
3
+ */export default function registration(subscribe){subscribe(registrationSuccess$,function(_ref){var _action$response;var dispatch=_ref.dispatch,getState=_ref.getState,action=_ref.action;var currentRoute=getCurrentRoute(getState());var redirect;if(currentRoute){// Try to get the login page from the router stack to extract the original redirect target
4
+ var getPrevRoute=makeGetPrevRoute();var routeId=currentRoute.id;var _ref3=getPrevRoute(getState(),{routeId:routeId})||{},pattern=_ref3.pattern,state=_ref3.state;if(pattern===LOGIN_PATH&&(state===null||state===void 0?void 0:state.redirect)){redirect=state.redirect;}}// TODO improve navigation since the login page will be briefly visible
5
+ dispatch(historyPop());dispatch(successLogin(redirect,REGISTRATION_FORM_LOGIN_STRATEGY,action===null||action===void 0?void 0:(_action$response=action.response)===null||_action$response===void 0?void 0:_action$response.sessionLifetimeInSeconds));});}
@@ -1,2 +1 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;export var container=css({fontWeight:500,margin:0});export var withTopGapContainer=css(container,{marginTop:variables.gap.xbig});export var reviewsLine=css({display:'flex',justifyContent:'space-between',alignItems:'baseline',padding:"0 0 ".concat(variables.gap.small,"px"),marginBottom:-2});export var averageRatingNumber=css({// Before the custom properties the primary color was used for this class.
2
- color:"var(--color-secondary, ".concat(colors.primary,")"),marginLeft:variables.gap.small}).toString();export var averageRatingText=css({marginLeft:variables.gap.big}).toString();
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;export var container=css({fontWeight:500,margin:0});export var withTopGapContainer=css(container,{marginTop:variables.gap.xbig});export var reviewsLine=css({display:'flex',justifyContent:'space-between',alignItems:'baseline',padding:"0 0 ".concat(variables.gap.small,"px"),marginBottom:-2});export var averageRatingNumber=css({color:"var(--color-primary, ".concat(colors.primary,")"),marginLeft:variables.gap.small}).toString();export var averageRatingText=css({marginLeft:variables.gap.big}).toString();
@@ -1,2 +1 @@
1
- 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{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;var main={fontSize:12,margin:'0 0.5em',lineHeight:'2em'};var greyStyle=css(_extends({},main,{color:colors.shade3,fontSize:12})).toString();var prominentStyle=css(_extends({},main,{// Before the custom properties the primary color was used for this class.
2
- color:"var(--color-secondary, ".concat(colors.primary,")")})).toString();export{greyStyle,prominentStyle};
1
+ 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{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;var main={fontSize:12,margin:'0 0.5em',lineHeight:'2em'};var greyStyle=css(_extends({},main,{color:colors.shade3,fontSize:12})).toString();var prominentStyle=css(_extends({},main,{color:"var(--color-primary, ".concat(colors.primary,")")})).toString();export{greyStyle,prominentStyle};
package/reviews/index.js CHANGED
@@ -1 +1,3 @@
1
- /** @module reviews */ /* eslint-disable import/export */export*from"./actions";export*from"./components";export*from"./constants";export*from"./mocks";export*from"./selectors";export*from"./streams";/* eslint-enable import/export */
1
+ /** @module reviews */ // Not moved into a "mocks" folder with index.js, since folders with "*mocks*" are deleted during
2
+ // release before upload to github, which will cause errors because auf in invalid import.
3
+ export*from'@shopgate/pwa-common-commerce/reviews/mock';/* eslint-disable import/export */export*from"./actions";export*from"./components";export*from"./constants";export*from"./selectors";export*from"./streams";/* eslint-enable import/export */
@@ -5,6 +5,6 @@ import Color from'color';import{themeConfig}from'@shopgate/pwa-common/helpers/co
5
5
  */var getContrastColor=function getContrastColor(color){var perceivedLuminosity=Color(color).luminosity();return perceivedLuminosity>=0.74?colors.dark:colors.light;};/**
6
6
  * Initializes the CSS custom properties after they where loaded from a CSS file.
7
7
  * When the CSS file doesn't contain contrast colors, they will be calculated automatically.
8
- */export var initCSSCustomProps=function initCSSCustomProps(){var primary=getCSSCustomProp('--color-primary');var primaryContrast=getCSSCustomProp('--color-primary-contrast');var secondary=getCSSCustomProp('--color-secondary');var secondaryContrast=getCSSCustomProp('--color-secondary-contrast');if(primary&&!primaryContrast){setCSSCustomProp('--color-primary-contrast',getContrastColor(primary));}if(secondary&&!secondaryContrast){setCSSCustomProp('--color-secondary-contrast',getContrastColor(secondary));}if(hasWebBridge()){setCSSCustomProp('--page-background-color','#fff');}var sideNavigationBackground=Color(getCSSCustomProp('--color-primary')||colors.primary).alpha(0.08);setCSSCustomProp('--color-side-navigation-active-background',sideNavigationBackground);setCSSCustomProp('--color-button-cta','var(--color-primary)');setCSSCustomProp('--color-button-cta-contrast','var(--color-primary-contrast)');};/**
8
+ */export var initCSSCustomProps=function initCSSCustomProps(){var primary=getCSSCustomProp('--color-primary');var primaryContrast=getCSSCustomProp('--color-primary-contrast');var secondary=getCSSCustomProp('--color-secondary');var secondaryContrast=getCSSCustomProp('--color-secondary-contrast');if(primary&&!primaryContrast){setCSSCustomProp('--color-primary-contrast',getContrastColor(primary));}if(secondary&&!secondaryContrast){setCSSCustomProp('--color-secondary-contrast',getContrastColor(secondary));}if(hasWebBridge()){setCSSCustomProp('--page-background-color','#fff');}var sideNavigationBackground=Color(getCSSCustomProp('--color-primary')||colors.primary).alpha(0.08);setCSSCustomProp('--color-side-navigation-active-background',sideNavigationBackground);setCSSCustomProp('--color-button-cta','var(--color-primary)');setCSSCustomProp('--color-button-cta-contrast','var(--color-primary-contrast)');if(!getCSSCustomProp('--color-button-dialog-ios')){setCSSCustomProp('--color-button-dialog-ios','#1a73e8');}};/**
9
9
  * Initializes fallback CSS custom properties from the theme colors.
10
- */export var initCSSCustomPropsFallback=function initCSSCustomPropsFallback(){setCSSCustomProp('--color-primary',colors.primary);setCSSCustomProp('--color-primary-contrast',getContrastColor(colors.primary));setCSSCustomProp('--color-secondary',colors.accent);setCSSCustomProp('--color-secondary-contrast',getContrastColor(colors.accent));if(!hasNewServices()){setCSSCustomProp('--color-button-cta',colors.cta);setCSSCustomProp('--color-button-cta-contrast',colors.ctaContrast);}else{setCSSCustomProp('--color-button-cta','var(--color-primary)');setCSSCustomProp('--color-button-cta-contrast','var(--color-primary-contrast)');}setCSSCustomProp('--color-text-high-emphasis','#212121');setCSSCustomProp('--color-text-medium-emphasis','#666666');setCSSCustomProp('--color-text-low-emphasis','#9e9e9e');setCSSCustomProp('--color-background-accent','#f7f7f7');setCSSCustomProp('--color-state-alert',colors.error);setCSSCustomProp('--color-state-warning',colors.warning);setCSSCustomProp('--color-state-ok',colors.success);var sideNavigationBackground=Color(getCSSCustomProp('--color-primary')||colors.primary).fade(0.9);setCSSCustomProp('--color-side-navigation-active-background',sideNavigationBackground);if(hasWebBridge()){setCSSCustomProp('--page-background-color','#fff');}};
10
+ */export var initCSSCustomPropsFallback=function initCSSCustomPropsFallback(){setCSSCustomProp('--color-primary',colors.primary);setCSSCustomProp('--color-primary-contrast',getContrastColor(colors.primary));setCSSCustomProp('--color-secondary',colors.accent);setCSSCustomProp('--color-secondary-contrast',getContrastColor(colors.accent));if(!hasNewServices()){setCSSCustomProp('--color-button-cta',colors.cta);setCSSCustomProp('--color-button-cta-contrast',colors.ctaContrast);}else{setCSSCustomProp('--color-button-cta','var(--color-primary)');setCSSCustomProp('--color-button-cta-contrast','var(--color-primary-contrast)');}if(!getCSSCustomProp('--color-button-dialog-ios')){setCSSCustomProp('--color-button-dialog-ios','#1a73e8');}setCSSCustomProp('--color-text-high-emphasis','#212121');setCSSCustomProp('--color-text-medium-emphasis','#666666');setCSSCustomProp('--color-text-low-emphasis','#9e9e9e');setCSSCustomProp('--color-background-accent','#f7f7f7');setCSSCustomProp('--color-state-alert',colors.error);setCSSCustomProp('--color-state-warning',colors.warning);setCSSCustomProp('--color-state-ok',colors.success);var sideNavigationBackground=Color(getCSSCustomProp('--color-primary')||colors.primary).fade(0.9);setCSSCustomProp('--color-side-navigation-active-background',sideNavigationBackground);if(hasWebBridge()){setCSSCustomProp('--page-background-color','#fff');}};
@@ -1,6 +1,6 @@
1
- import appConfig from'@shopgate/pwa-common/helpers/config';import{isDev}from'@shopgate/engage/core';import{initCSSCustomProps,initCSSCustomPropsFallback}from"./initCSSCustomProperties";/**
1
+ import appConfig from'@shopgate/pwa-common/helpers/config';import{initCSSCustomProps,initCSSCustomPropsFallback}from"./initCSSCustomProperties";/**
2
2
  * Loads external CSS with custom properties
3
3
  * @returns {void}
4
4
  */export var loadCustomStyles=function loadCustomStyles(){var id='external-css';var href=appConfig.customStyleUrl;var linkTag=document.querySelector("#".concat(id));/**
5
5
  * Error handler
6
- */var onError=function onError(){if(isDev){initCSSCustomPropsFallback();}};if(!href){onError();}if(href&&!linkTag){linkTag=document.createElement('link');linkTag.setAttribute('rel','stylesheet');linkTag.setAttribute('type','text/css');linkTag.setAttribute('href',href);linkTag.setAttribute('id',id);linkTag.onload=initCSSCustomProps;linkTag.onerror=onError;document.querySelector('head').appendChild(linkTag);}};
6
+ */var onError=function onError(){initCSSCustomPropsFallback();};if(!href){onError();}if(href&&!linkTag){linkTag=document.createElement('link');linkTag.setAttribute('rel','stylesheet');linkTag.setAttribute('type','text/css');linkTag.setAttribute('href',href);linkTag.setAttribute('id',id);linkTag.onload=initCSSCustomProps;linkTag.onerror=onError;document.querySelector('head').appendChild(linkTag);}};
@@ -1,4 +1,5 @@
1
1
  import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{hasWebBridge}from'@shopgate/engage/core';import{setCSSCustomProp}from"./cssCustomProperties";var defaultBackgroundColor=themeConfig.colors.light;/**
2
2
  * Updates the page background color.
3
3
  * @param {string} color The new background color.
4
- */export var setPageBackgroundColor=function setPageBackgroundColor(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultBackgroundColor;if(!hasWebBridge()){setCSSCustomProp('--page-background-color',color);}};
4
+ */export var setPageBackgroundColor=function setPageBackgroundColor(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultBackgroundColor;// Curbside website changes never its background color
5
+ if(!hasWebBridge()){setCSSCustomProp('--page-background-color',color);}};
@@ -0,0 +1,24 @@
1
+ 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;/**
2
+ * action to be dispatched when the cookie consent modal should be shown
3
+ * @returns {Function}
4
+ */export var showCookieConsentModal=function showCookieConsentModal(){return{type:SHOW_COOKIE_CONSENT_MODAL};};/**
5
+ * action to be dispatched when the cookie consent modal should be hidden
6
+ * @returns {Function}
7
+ */export var hideCookieConsentModal=function hideCookieConsentModal(){return{type:HIDE_COOKIE_CONSENT_MODAL};};/**
8
+ * action to be dispatched when the user accepted the selected cookies in the custom modal
9
+ * @param {Object} params Action params
10
+ * @param {boolean} [params.comfortCookiesAccepted=false] whether this cookie type was accepted
11
+ * by user
12
+ * @param {boolean} [params.statisticsCookiesAccepted=false] whether this cookie type was accepted
13
+ * by user
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:showComfortCookiesToggle===true?comfortCookiesAccepted:true,statisticsCookiesAccepted:statisticsCookiesAccepted};};/**
16
+ * action to be dispatched when the cookies have been handled either by user or by merchant
17
+ * and native modal should be triggered for setting the permission
18
+ * @param {Object} params Action params
19
+ * @param {boolean} [params.comfortCookiesAccepted=false] whether this cookie type was accepted
20
+ * by user
21
+ * @param {boolean} [params.statisticsCookiesAccepted=false] whether this cookie type was accepted
22
+ * by user
23
+ * @returns {Function}
24
+ */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};};
@@ -1,4 +1 @@
1
- import{INITIALIZE_TRACKING}from"../constants";/**
2
- * Creates the dispatched INITIALIZE_TRACKING action object.
3
- * @returns {Object} The dispatched action object.
4
- */export var initTracking=function initTracking(){return{type:INITIALIZE_TRACKING};};
1
+ export*from"./cookieConsent";
@@ -0,0 +1,21 @@
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{historyPush,grantAppTrackingTransparencyPermission}from'@shopgate/engage/core/actions';import{updateCookieConsent,hideCookieConsentModal}from"../action-creators";import{PRIVACY_SETTINGS_PATTERN}from"../constants";/**
2
+ * action to be dispatched when the user accepted all cookies in the custom modal
3
+ * and native modal should be triggered for setting the permission
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());case 4:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());};/**
6
+ * action to be dispatched when the user accepted the selected cookies in the custom modal
7
+ * and native modal should be triggered for setting the permission
8
+ * @param {Object} params Action params
9
+ * @param {boolean|null} params.comfortCookiesAccepted whether this cookie type was accepted
10
+ * by user
11
+ * @param {boolean|null} params.statisticsCookiesAccepted whether this cookie type was accepted
12
+ * by user
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());case 5:case"end":return _context2.stop();}},_callee2);}));return function(_x2){return _ref3.apply(this,arguments);};}());};/**
15
+ * action to be dispatched when the user selected only the required cookies in the custom modal
16
+ * and native modal should be triggered for setting the permission
17
+ * @returns {Function}
18
+ */export var acceptRequiredCookies=function acceptRequiredCookies(){return function(dispatch){dispatch(updateCookieConsent({comfortCookiesAccepted:false,statisticsCookiesAccepted:false}));dispatch(hideCookieConsentModal());};};/**
19
+ * action to be dispatched when the user opted to configure cookie settings in the custom modal
20
+ * @returns {Function}
21
+ */export var openPrivacySettings=function openPrivacySettings(){return function(dispatch){dispatch(historyPush({pathname:PRIVACY_SETTINGS_PATTERN}));};};
@@ -0,0 +1 @@
1
+ export*from"./cookieConsent";
@@ -0,0 +1,6 @@
1
+ import{connect}from'react-redux';import{makeGetPrivacyPolicyLink}from'@shopgate/engage/page/selectors';import{getIsCookieConsentModalVisible}from"../../selectors/cookieConsent";import{acceptAllCookies,acceptRequiredCookies,openPrivacySettings}from"../../actions";/**
2
+ * @return {Object} The extended component props.
3
+ */var makeMapStateToProps=function makeMapStateToProps(){var getPrivacyPolicyLink=makeGetPrivacyPolicyLink();return function(state){return{isCookieConsentModalVisible:getIsCookieConsentModalVisible(state),privacyPolicyLink:getPrivacyPolicyLink(state)};};};/**
4
+ * Connects the dispatch function to a callable function in the props.
5
+ * @return {Object} The extended component props.
6
+ */var mapDispatchToProps={acceptAllCookies:acceptAllCookies,acceptRequiredCookies:acceptRequiredCookies,openPrivacySettings:openPrivacySettings};export default connect(makeMapStateToProps,mapDispatchToProps);
@@ -0,0 +1,9 @@
1
+ import React,{useMemo}from'react';import PropTypes from'prop-types';import{Grid,I18n,Button,Modal,Link,ConditionalWrapper}from'@shopgate/engage/components';import{appConfig}from'@shopgate/engage';import classNames from'classnames';import connect from"./connector";import cookieImage from"./tracking-opt-in.svg";import styles from"./style";/**
2
+ * The cookie consent modal component.
3
+ * @param {Object} props The component props.
4
+ * @returns {JSX.Element}
5
+ */var CookieConsentModal=function CookieConsentModal(_ref){var isCookieConsentModalVisible=_ref.isCookieConsentModalVisible,acceptAllCookies=_ref.acceptAllCookies,acceptRequiredCookies=_ref.acceptRequiredCookies,openPrivacySettings=_ref.openPrivacySettings,privacyPolicyLink=_ref.privacyPolicyLink;var _appConfig$cookieCons=appConfig.cookieConsent,_appConfig$cookieCons2=_appConfig$cookieCons===void 0?{}:_appConfig$cookieCons,modalMessage=_appConfig$cookieCons2.modalMessage,modalTitle=_appConfig$cookieCons2.modalTitle,modalButtonConfigureSettings=_appConfig$cookieCons2.modalButtonConfigureSettings,modalButtonOnlyRequired=_appConfig$cookieCons2.modalButtonOnlyRequired,modalButtonAcceptAll=_appConfig$cookieCons2.modalButtonAcceptAll,modalImageURL=_appConfig$cookieCons2.modalImageURL,modalImageSVG=_appConfig$cookieCons2.modalImageSVG,showRequiredCookiesButton=_appConfig$cookieCons2.showRequiredCookiesButton;var imageSRC=useMemo(function(){if(!modalImageURL&&!modalImageSVG){return cookieImage;}if(modalImageURL){return modalImageURL;}// if SVG overwrite configured: create data url
6
+ try{// encode SVG string to UTF-8 byte array to handle non-Latin1 characters
7
+ // (e.g. Unicode characters like emojis)
8
+ var utf8Encoder=new TextEncoder();var svgBytes=utf8Encoder.encode(modalImageSVG);// Convert the byte array to a Base64 string
9
+ var base64Svg=btoa(String.fromCharCode.apply(null,svgBytes));return"data:image/svg+xml;base64,".concat(base64Svg);}catch(e){return cookieImage;}},[modalImageSVG,modalImageURL]);if(!isCookieConsentModalVisible){return null;}return React.createElement(Modal,{isOpened:isCookieConsentModalVisible,classes:{content:styles.modalContent,layout:styles.modalLayout}},React.createElement(Grid,{component:"div",className:classNames(styles.container,'cookie-consent-modal__container'),role:"alertdialog","aria-modal":true,"aria-labelledby":"cookieConsentDialogTitle","aria-describedby":"cookieConsentDialogMessage"},React.createElement(Grid.Item,{component:"div",className:styles.item},React.createElement("img",{src:imageSRC,className:classNames(styles.image,'cookie-consent-modal__image'),alt:"","aria-hidden":"true"}),React.createElement(I18n.Text,{className:classNames(styles.title,'cookie-consent-modal__title'),string:modalTitle||'cookieConsentModal.title',id:"cookieConsentDialogTitle"}),React.createElement(I18n.Text,{string:modalMessage||'cookieConsentModal.message',className:classNames('cookie-consent-modal__message'),acceptPlainTextWithPlaceholders:true,id:"cookieConsentDialogMessage"},React.createElement(I18n.Placeholder,{forKey:"privacyLink"},React.createElement(ConditionalWrapper,{condition:!!privacyPolicyLink,wrapper:function wrapper(children){return React.createElement(Link,{href:privacyPolicyLink,tag:"span"},children);}},React.createElement(I18n.Text,{string:"cookieConsentModal.privacyText",className:styles.link})))),React.createElement(Grid.Item,{component:"div",className:styles.buttonWrapper},React.createElement(Button,{onClick:acceptAllCookies,type:"primary",className:classNames(styles.button,'cookie-consent-modal__button-accept-all')},React.createElement(I18n.Text,{string:modalButtonAcceptAll||'cookieConsentModal.buttonAcceptAll'})),showRequiredCookiesButton?React.createElement(Button,{onClick:acceptRequiredCookies,type:"simple",className:classNames(styles.button,'cookie-consent-modal__button-accept-required')},React.createElement(I18n.Text,{string:modalButtonOnlyRequired||'cookieConsentModal.modalButtonOnlyRequired'})):null,React.createElement(Button,{onClick:openPrivacySettings,type:"simple",className:classNames(styles.button,'cookie-consent-modal__button-open-settings')},React.createElement(I18n.Text,{string:modalButtonConfigureSettings||'cookieConsentModal.buttonConfigure'}))))));};CookieConsentModal.defaultProps={privacyPolicyLink:null};export default connect(CookieConsentModal);
@@ -0,0 +1 @@
1
+ import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';var modalContent=css({width:'100%'}).toString();var modalLayout=css({backgroundColor:themeColors.lightOverlay}).toString();var container=css({backgroundColor:themeColors.lightOverlay,padding:'30px',justifyContent:'center',display:'flex',flexDirection:'column',textAlign:'center'}).toString();var title=css({fontWeight:'bold',fontSize:'1.35rem',paddingTop:'30px',paddingBottom:'30px'}).toString();var item=css({display:'flex',flexDirection:'column',alignItems:'center'}).toString();var link=css({color:themeColors.accent,textDecoration:'underline'}).toString();var image=css({width:'60%',maxWidth:400}).toString();var button=css({marginTop:'20px'}).toString();var buttonText=css({color:themeColors.gray}).toString();var buttonWrapper=css({display:'flex',flexDirection:'column',marginBottom:'30px',width:'100%'}).toString();export default{modalContent:modalContent,modalLayout:modalLayout,container:container,item:item,title:title,link:link,image:image,button:button,buttonText:buttonText,buttonWrapper:buttonWrapper};
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="100%" height="100%" viewBox="0 0 895 895" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
4
+ <g transform="matrix(1,0,0,1,-197.772,-376.125)">
5
+ <g transform="matrix(1.28727,0,0,1.28727,-185.288,-236.524)">
6
+ <g transform="matrix(1.25456,0,0,1.25456,-164.192,-209.593)">
7
+ <circle cx="645" cy="823.354" r="276.929" style="fill:rgb(235,235,235);"/>
8
+ </g>
9
+ <g transform="matrix(17.6233,0,0,17.6233,433.521,611.874)">
10
+ <path d="M12,0C8.629,2.866 6.516,3 3,3L3,14.535C3,19.138 6.203,20.339 12,24C17.797,20.339 21,19.138 21,14.535L21,3C17.484,3 15.371,2.866 12,0Z" style="fill:rgb(255,115,115);fill-rule:nonzero;"/>
11
+ <path d="M12.99,-1.164C12.419,-1.649 11.581,-1.649 11.01,-1.164C8.014,1.383 6.125,1.472 3,1.472C2.156,1.472 1.472,2.156 1.472,3L1.472,14.535C1.472,17.357 2.45,19.137 4.32,20.771C5.891,22.144 8.2,23.407 11.184,25.292C11.682,25.607 12.318,25.607 12.816,25.292C15.8,23.407 18.109,22.144 19.68,20.771C21.55,19.137 22.528,17.357 22.528,14.535L22.528,3C22.528,2.156 21.844,1.472 21,1.472C17.875,1.472 15.986,1.383 12.99,-1.164ZM12,0C8.629,2.866 6.516,3 3,3L3,14.535C3,19.138 6.203,20.339 12,24C17.797,20.339 21,19.138 21,14.535L21,3C17.484,3 15.371,2.866 12,0Z" style="fill:rgb(216,216,216);"/>
12
+ </g>
13
+ <g transform="matrix(24.4351,0,0,24.4351,340.416,541.775)">
14
+ <path d="M15.762,8.047L11.381,12.522L9.166,10.399L7.93,11.638L11.381,15L17,9.285L15.762,8.047Z" style="fill:white;fill-rule:nonzero;"/>
15
+ </g>
16
+ </g>
17
+ </g>
18
+ </svg>
@@ -0,0 +1,6 @@
1
+ import{connect}from'react-redux';import{makeGetPrivacyPolicyLink}from'@shopgate/engage/page/selectors';import{acceptAllCookies,acceptSelectedCookies}from"../../actions";import{getAreComfortCookiesAcceptedInternal,getAreStatisticsCookiesAcceptedInternal}from"../../selectors/cookieConsent";/**
2
+ * @return {Object} The extended component props.
3
+ */var makeMapStateToProps=function makeMapStateToProps(){var getPrivacyPolicyLink=makeGetPrivacyPolicyLink();return function(state){return{comfortCookiesAcceptedState:getAreComfortCookiesAcceptedInternal(state),statisticsCookiesAcceptedState:getAreStatisticsCookiesAcceptedInternal(state),privacyPolicyLink:getPrivacyPolicyLink(state)};};};/**
4
+ * Connects the dispatch function to a callable function in the props.
5
+ * @return {Object} The extended component props.
6
+ */var mapDispatchToProps={acceptAllCookies:acceptAllCookies,acceptSelectedCookies:acceptSelectedCookies};export default connect(makeMapStateToProps,mapDispatchToProps);
@@ -0,0 +1,4 @@
1
+ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useCallback,useState}from'react';import{Button,Grid,I18n,Link,Switch,ConditionalWrapper}from'@shopgate/engage/components';import PropTypes from'prop-types';import{appConfig}from'@shopgate/engage';import{i18n}from'@shopgate/engage/core';import classNames from'classnames';import styles from"./style";import connect from"./connector";/**
2
+ * The PrivacySettings component.
3
+ * @returns {JSX.Element}
4
+ */var PrivacySettings=function PrivacySettings(_ref){var acceptAllCookies=_ref.acceptAllCookies,acceptSelectedCookies=_ref.acceptSelectedCookies,comfortCookiesAcceptedState=_ref.comfortCookiesAcceptedState,statisticsCookiesAcceptedState=_ref.statisticsCookiesAcceptedState,privacyPolicyLink=_ref.privacyPolicyLink;var _appConfig$cookieCons=appConfig.cookieConsent,_appConfig$cookieCons2=_appConfig$cookieCons===void 0?{}:_appConfig$cookieCons,settingsComfortText=_appConfig$cookieCons2.settingsComfortText,settingsComfortTitle=_appConfig$cookieCons2.settingsComfortTitle,settingsStatisticsText=_appConfig$cookieCons2.settingsStatisticsText,settingsStatisticsTitle=_appConfig$cookieCons2.settingsStatisticsTitle,settingsRequiredText=_appConfig$cookieCons2.settingsRequiredText,settingsRequiredTitle=_appConfig$cookieCons2.settingsRequiredTitle,showComfortCookiesToggle=_appConfig$cookieCons2.showComfortCookiesToggle;var _useState=useState(comfortCookiesAcceptedState!==null?comfortCookiesAcceptedState:false),_useState2=_slicedToArray(_useState,2),areComfortCookiesSelected=_useState2[0],setAreComfortCookiesSelected=_useState2[1];var _useState3=useState(statisticsCookiesAcceptedState!==null?statisticsCookiesAcceptedState:false),_useState4=_slicedToArray(_useState3,2),areStatisticsCookiesSelected=_useState4[0],setAreStatisticsCookiesSelected=_useState4[1];var handleChangeComfortCookies=useCallback(function(){setAreComfortCookiesSelected(!areComfortCookiesSelected);},[areComfortCookiesSelected]);var handleChangeStatisticsCookies=useCallback(function(){setAreStatisticsCookiesSelected(!areStatisticsCookiesSelected);},[areStatisticsCookiesSelected]);var handleAcceptAllCookies=useCallback(function(){setAreStatisticsCookiesSelected(true);setAreComfortCookiesSelected(true);acceptAllCookies();},[acceptAllCookies]);return React.createElement(Grid,{component:"div",className:styles.container},React.createElement(Grid.Item,{component:"div",className:styles.item},showComfortCookiesToggle?React.createElement(Grid.Item,{component:"div",className:styles.switchWrapper},React.createElement(Switch,{onChange:handleChangeComfortCookies,checked:areComfortCookiesSelected,a11yFallbackText:"".concat(i18n.text(settingsComfortTitle||'cookieSettings.comfortTitle'),". ").concat(i18n.text(settingsComfortText||'cookieSettings.comfort'))},React.createElement("span",{className:styles.title},React.createElement(I18n.Text,{string:settingsComfortTitle||'cookieSettings.comfortTitle'})),React.createElement("span",null,React.createElement(I18n.Text,{string:settingsComfortText||'cookieSettings.comfort'})))):null,React.createElement(Grid.Item,{component:"div",className:styles.switchWrapper},React.createElement(Switch,{onChange:handleChangeStatisticsCookies,checked:areStatisticsCookiesSelected,a11yFallbackText:"".concat(i18n.text(settingsStatisticsTitle||'cookieSettings.statisticsTitle'),". ").concat(i18n.text(settingsStatisticsText||'cookieSettings.statistics'))},React.createElement("span",{className:styles.title},React.createElement(I18n.Text,{string:settingsStatisticsTitle||'cookieSettings.statisticsTitle'})),React.createElement("span",null,React.createElement(I18n.Text,{string:settingsStatisticsText||'cookieSettings.statistics'})))),React.createElement(Grid.Item,{component:"div",className:styles.switchWrapper},React.createElement(Switch,{disabled:true,checked:true,a11yFallbackText:"".concat(i18n.text(settingsRequiredTitle||'cookieSettings.requiredTitle'),". ").concat(i18n.text(settingsRequiredText||'cookieSettings.required'))},React.createElement("span",{className:styles.title},React.createElement(I18n.Text,{string:settingsRequiredTitle||'cookieSettings.requiredTitle'})),React.createElement("span",null,React.createElement(I18n.Text,{string:settingsRequiredText||'cookieSettings.required'}))))),React.createElement(Grid.Item,{component:"div",className:styles.buttonWrapper},React.createElement(Button,{onClick:function onClick(){return handleAcceptAllCookies();},type:"primary",className:classNames(styles.button,'privacy-settings__button-accept-all')},React.createElement(I18n.Text,{string:"cookieConsentModal.buttonAcceptAll"})),React.createElement(Button,{onClick:function onClick(){return acceptSelectedCookies({comfortCookiesAccepted:areComfortCookiesSelected,statisticsCookiesAccepted:areStatisticsCookiesSelected});},type:"simple",className:classNames(styles.button,'privacy-settings__button-accept-selected')},React.createElement(I18n.Text,{string:"cookieConsentModal.modalButtonConfirmSelected"}))),React.createElement(Grid.Item,{component:"div"},React.createElement(I18n.Text,{string:"cookieSettings.privacy"},React.createElement(I18n.Placeholder,{forKey:"privacyLink"},React.createElement(ConditionalWrapper,{condition:!!privacyPolicyLink,wrapper:function wrapper(children){return React.createElement(Link,{href:privacyPolicyLink,tag:"span"},children);}},React.createElement(I18n.Text,{string:"cookieConsentModal.privacyText",className:styles.link}))))));};PrivacySettings.defaultProps={comfortCookiesAcceptedState:null,statisticsCookiesAcceptedState:null,privacyPolicyLink:null};export default connect(PrivacySettings);
@@ -0,0 +1 @@
1
+ import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';var button=css({marginTop:'20px'}).toString();var container=css({flexDirection:'column',height:'100vh',textAlign:'center',padding:'30px',justifyContent:'center',display:'flex'}).toString();var buttonWrapper=css({display:'flex',flexDirection:'column',marginBottom:'30px'}).toString();var item=css({display:'flex',flexDirection:'column'}).toString();var link=css({color:themeColors.accent,textDecoration:'underline'}).toString();var switchWrapper=css({marginBottom:'25px',display:'flex',textAlign:'left',justifyContent:'space-between'}).toString();var title=css({fontWeight:'bold',display:'block'});export default{button:button,container:container,buttonWrapper:buttonWrapper,link:link,item:item,switchWrapper:switchWrapper,title:title};
@@ -1 +1 @@
1
- export{CookieConsent}from"./CookieConsent";
1
+ export{default as CookieConsentModal}from"./CookieConsentModal";export{default as PrivacySettings}from"./PrivacySettings";
@@ -1,2 +1 @@
1
- export var COOKIE_CONSENT_COOKIE_NAME_STATUS='sg-cookie-banner-status';export var COOKIE_CONSENT_COOKIE_NAME_PREFS='sg-cookie-banner-pref';export var COOKIE_CONSENT_STATUS_ALLOW='allow';export var COOKIE_CONSENT_STATUS_DENY='deny';export var COOKIE_CONSENT_PREF_NEEDED='needed';export var COOKIE_CONSENT_PREF_ANALYTICS='analytics';export var COOKIE_CONSENT_MODE_OFF='off';export var COOKIE_CONSENT_MODE_STANDARD='standard';export var COOKIE_CONSENT_MODE_STRICT='strict';export var INITIALIZE_TRACKING='INITIALIZE_TRACKING';// PWA6 cookie consent constants
2
1
  export var SHOW_COOKIE_CONSENT_MODAL='SHOW_COOKIE_CONSENT_MODAL';export var HIDE_COOKIE_CONSENT_MODAL='HIDE_COOKIE_CONSENT_MODAL';export var UPDATE_COOKIE_CONSENT='UPDATE_COOKIE_CONSENT';export var COOKIE_CONSENT_HANDLED='COOKIE_CONSENT_HANDLED';export var PRIVACY_SETTINGS_PATTERN='/privacy-settings';
@@ -0,0 +1,6 @@
1
+ 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};/**
2
+ * Stores all states of the cookie consent modal.
3
+ * @param {Object} [state] The current state.
4
+ * @param {Object} action The action object.
5
+ * @return {Object} The new state.
6
+ */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;
@@ -0,0 +1,6 @@
1
+ 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{UPDATE_COOKIE_CONSENT}from"../constants";var defaultState={comfortCookiesAccepted:null,statisticsCookiesAccepted:null};/**
2
+ * Stores all states of the cookie settings.
3
+ * @param {Object} [state] The current state.
4
+ * @param {Object} action The action object.
5
+ * @return {Object} The new state.
6
+ */var cookieSettingsReducer=function cookieSettingsReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case UPDATE_COOKIE_CONSENT:{return _extends({},state,{comfortCookiesAccepted:action.comfortCookiesAccepted,statisticsCookiesAccepted:action.statisticsCookiesAccepted});}default:return state;}};export default cookieSettingsReducer;
@@ -0,0 +1 @@
1
+ import{combineReducers}from'redux';import cookieConsentModal from"./cookieConsentModal";import cookieSettings from"./cookieSettings";export default combineReducers({cookieConsentModal:cookieConsentModal,cookieSettings:cookieSettings});
@@ -0,0 +1,35 @@
1
+ import{createSelector}from'reselect';import{appConfig}from'@shopgate/engage';import{appSupportsCookieConsent}from'@shopgate/engage/core/helpers';var _appConfig$cookieCons=appConfig.cookieConsent,_appConfig$cookieCons2=_appConfig$cookieCons===void 0?{}:_appConfig$cookieCons,isCookieConsentActivated=_appConfig$cookieCons2.isCookieConsentActivated,showComfortCookiesToggle=_appConfig$cookieCons2.showComfortCookiesToggle;/**
2
+ * Selects the cookie consent modal state.
3
+ * @param {Object} state The current state of the cookie consent modal.
4
+ * @returns {Object} whether cookie consent modal is shown.
5
+ */export var getCookieConsentModalState=function getCookieConsentModalState(state){var _state$tracking;return(state===null||state===void 0?void 0:(_state$tracking=state.tracking)===null||_state$tracking===void 0?void 0:_state$tracking.cookieConsentModal)||{};};/**
6
+ * Selects the cookie settings state.
7
+ * @param {Object} state The current state of the cookie settings.
8
+ * @returns {Object} whether cookies have been accepted by the user.
9
+ */export var getCookieSettingsState=function getCookieSettingsState(state){var _state$tracking2;return(state===null||state===void 0?void 0:(_state$tracking2=state.tracking)===null||_state$tracking2===void 0?void 0:_state$tracking2.cookieSettings)||{};};/**
10
+ * Determines whether the cookie consent process is finished (selection happened before, feature is
11
+ * inactive, app doesn't support the feature).
12
+ * @returns {boolean} Whether the cookie consent process is handled either by user
13
+ * or by app/feature settings
14
+ */export var getIsCookieConsentHandled=createSelector(getCookieSettingsState,function(settingsState){if(!isCookieConsentActivated||!appSupportsCookieConsent()){return true;}return(settingsState===null||settingsState===void 0?void 0:settingsState.comfortCookiesAccepted)!==null||(settingsState===null||settingsState===void 0?void 0:settingsState.statisticsCookiesAccepted)!==null;});/**
15
+ * Selects the property of the comfort cookie settings.
16
+ * @private This selector is intended to be used internally. When a cookie consent status needs
17
+ * to be checked for a feature, please use `getAreComfortCookiesAccepted` instead.
18
+ * @returns {boolean|null} whether comfort cookies have been selected by the user.
19
+ */export var getAreComfortCookiesAcceptedInternal=createSelector(getCookieSettingsState,function(settingsState){return settingsState.comfortCookiesAccepted;});/**
20
+ * Selects the property of the statistics cookie settings.
21
+ * @private This selector is intended to be used internally. When a cookie consent status needs
22
+ * to be checked for a feature, please use `getAreStatisticsCookiesAccepted` instead.
23
+ * @returns {boolean|null} whether statistics cookies have been selected by the user.
24
+ */export var getAreStatisticsCookiesAcceptedInternal=createSelector(getCookieSettingsState,function(settingsState){return settingsState.statisticsCookiesAccepted;});/**
25
+ * Determines if comfort cookies were accepted in the cookie consent process. When cookie
26
+ * consent is inactive, the selector will also return true.
27
+ * @returns {boolean} whether comfort cookies are set and should activate tracking.
28
+ */export var getAreComfortCookiesAccepted=createSelector(getCookieSettingsState,getIsCookieConsentHandled,function(settingsState,consentHandled){if(!consentHandled)return false;if(!isCookieConsentActivated||!showComfortCookiesToggle)return true;if(settingsState.comfortCookiesAccepted===null)return true;return settingsState.comfortCookiesAccepted;});/**
29
+ * Determines if statistics cookies were accepted in the cookie consent process. When cookie
30
+ * consent is inactive, the selector will also return true.
31
+ * @returns {boolean} whether statistics cookies are set and should activate tracking.
32
+ */export var getAreStatisticsCookiesAccepted=createSelector(getCookieSettingsState,getIsCookieConsentHandled,function(settingsState,consentHandled){if(!consentHandled)return false;if(!isCookieConsentActivated)return true;if(settingsState.statisticsCookiesAccepted===null)return true;return settingsState.statisticsCookiesAccepted;});/**
33
+ * Selects the visibility property of the cookie consent modal.
34
+ * @returns {boolean} whether cookie consent modal is shown.
35
+ */export var getIsCookieConsentModalVisible=createSelector(getCookieConsentModalState,getAreComfortCookiesAcceptedInternal,getAreStatisticsCookiesAcceptedInternal,function(modalState,comfortCookiesState,statisticsCookiesState){return modalState.isCookieConsentModalVisible&&comfortCookiesState===null&&statisticsCookiesState===null;});
@@ -1,4 +1 @@
1
- import{createSelector}from'reselect';import{makeGetMenu,makeGetIsFetchingMenu,makeGetShopSettingByKey,SHOP_SETTING_COOKIE_CONSENT_MODE,hasWebBridge}from'@shopgate/engage/core';import{LEGAL_MENU}from'@shopgate/pwa-common/constants/MenuIDs';import{COOKIE_CONSENT_MODE_OFF,COOKIE_CONSENT_MODE_STANDARD,COOKIE_CONSENT_MODE_STRICT}from"../constants";/**
2
- * Creates a selector that retrieves the privacy polity link.
3
- * @returns {string}
4
- */export var makeGetPrivacyPolicyLink=function makeGetPrivacyPolicyLink(){var getMenu=makeGetMenu(LEGAL_MENU);var getIsFetchingMenu=makeGetIsFetchingMenu(LEGAL_MENU);return createSelector(getMenu,getIsFetchingMenu,function(menu,fetching){if(fetching||!menu){return null;}var entry=menu.find(function(item){return item.url.includes('privacy');})||{};return(entry===null||entry===void 0?void 0:entry.url)||null;});};var getCookieConsentShopSetting=makeGetShopSettingByKey(SHOP_SETTING_COOKIE_CONSENT_MODE,COOKIE_CONSENT_MODE_OFF);export var hasCookieConsent=createSelector(getCookieConsentShopSetting,function(setting){if(!hasWebBridge()){return false;}return[COOKIE_CONSENT_MODE_STANDARD,COOKIE_CONSENT_MODE_STRICT].includes(setting);});export var hasStrictCookieConsent=createSelector(getCookieConsentShopSetting,function(setting){return setting===COOKIE_CONSENT_MODE_STRICT;});
1
+ export{getAreComfortCookiesAccepted}from"./cookieConsent";export{getAreStatisticsCookiesAccepted}from"./cookieConsent";
@@ -0,0 +1,46 @@
1
+ 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);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import{main$,routeWillEnter$}from'@shopgate/engage/core/streams';import'rxjs/add/observable/of';import{Observable}from'rxjs/Observable';import{makeGetPrivacyPolicyLink}from'@shopgate/engage/page/selectors';import{COOKIE_CONSENT_HANDLED,UPDATE_COOKIE_CONSENT,PRIVACY_SETTINGS_PATTERN}from"../constants";import{getIsCookieConsentHandled}from"../selectors/cookieConsent";/**
2
+ * Gets triggered when the cookie consent has been updated by the user or handled already.
3
+ * This stream is only for internal usage and will be triggered independent of changed payload.
4
+ * @type {Observable}
5
+ */var cookieConsentSetInternal$=main$.filter(function(_ref){var action=_ref.action;return action.type===UPDATE_COOKIE_CONSENT||action.type===COOKIE_CONSENT_HANDLED;});/**
6
+ * Gets triggered when the cookie consent has been initially configured by the user or is
7
+ * handled already.
8
+ * @type {Observable}
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);});/**
20
+ * Gets triggered when cookie consent settings changed after initialization
21
+ * @type {Observable}
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);});/**
23
+ * Gets triggered when the cookie consent has been updated by the user or handled already.
24
+ * @type {Observable}
25
+ */export var cookieConsentSet$=cookieConsentInitialized$.merge(cookieConsentUpdated$);/**
26
+ * Gets triggered when the cookie consent has been set either by user or merchant.
27
+ * @type {Observable}
28
+ */export var comfortCookiesAccepted$=cookieConsentSet$.filter(function(_ref11){var action=_ref11.action;return action.comfortCookiesAccepted===true;});/**
29
+ * Gets triggered when the cookie consent has been set either by user or merchant.
30
+ * @type {Observable}
31
+ */export var statisticsCookiesAccepted$=cookieConsentSet$.filter(function(_ref12){var action=_ref12.action;return action.statisticsCookiesAccepted===true;});/**
32
+ * Gets triggered when comfort cookies where accepted first and declined afterwards during an
33
+ * app session.
34
+ * @type {Observable}
35
+ */export var comfortCookiesDeclined$=comfortCookiesAccepted$.switchMap(function(){return cookieConsentSet$.filter(function(_ref13){var action=_ref13.action;return action.comfortCookiesAccepted===false;}).first();});/**
36
+ * Gets triggered when statistics cookies where accepted first and declined afterwards during an
37
+ * app session.
38
+ * @type {Observable}
39
+ */export var statisticsCookiesDeclined$=statisticsCookiesAccepted$.switchMap(function(){return cookieConsentSet$.filter(function(_ref14){var action=_ref14.action;return action.statisticsCookiesAccepted===false;}).first();});/**
40
+ * Emit when the cookie consent modal is supposed to be shown / hidden on route changes.
41
+ *
42
+ * When cookie consent is not handled yet, the modal should overlay every route, except the
43
+ * pages with privacy polity and privacy settings when extended consent decisions are taken.
44
+ */export var cookieConsentModalShouldToggleInternal$=routeWillEnter$// Stop the stream after cookie consent is handled
45
+ .takeUntil(cookieConsentInitialized$).switchMap(function(input){var action=input.action,getState=input.getState;var isCookieConsentHandled=getIsCookieConsentHandled(getState());var showConsentModal=false;// Only run extended logic when cookie consent is active and still need to be handled
46
+ if(!isCookieConsentHandled){var _action$route;var pagesWithoutModal=[PRIVACY_SETTINGS_PATTERN,makeGetPrivacyPolicyLink()(getState())];showConsentModal=!pagesWithoutModal.includes(action===null||action===void 0?void 0:(_action$route=action.route)===null||_action$route===void 0?void 0:_action$route.pathname);}return Observable.of(_extends({},input,{showConsentModal:showConsentModal}));});
@@ -1 +1 @@
1
- import{main$}from'@shopgate/pwa-common/streams';import{INITIALIZE_TRACKING}from"../constants";export var initializeTracking$=main$.filter(function(_ref){var action=_ref.action;return action.type===INITIALIZE_TRACKING;});
1
+ export{cookieConsentInitialized$,cookieConsentUpdated$,cookieConsentSet$,comfortCookiesAccepted$,comfortCookiesDeclined$,statisticsCookiesAccepted$,statisticsCookiesDeclined$}from"./cookieConsent";
@@ -0,0 +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,hasSGJavaScriptBridge}from'@shopgate/engage/core/helpers';import{analyticsSetConsent}from'@shopgate/engage/core/commands';import{cookieConsentInitialized$,cookieConsentUpdated$}from"../streams";/**
2
+ * Analytics subscriptions
3
+ * @param {Function} subscribe The subscribe function
4
+ */export default function analytics(subscribe){/**
5
+ * Sends cookie consent decisions to the app
6
+ * @param {Object} params Function params
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()||!hasSGJavaScriptBridge())){_context.next=3;break;}return _context.abrupt("return");case 3:statisticsCookiesAccepted=action.statisticsCookiesAccepted,comfortCookiesAccepted=action.comfortCookiesAccepted;// Send consent decisions to the app
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
+ // are turned off
11
+ dispatch(reloadApp());case 4:case"end":return _context3.stop();}},_callee3);}));return function(_x3){return _ref6.apply(this,arguments);};}());}
@@ -0,0 +1,13 @@
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{appDidStart$}from'@shopgate/engage/core/streams';import{appSupportsCookieConsent}from'@shopgate/engage/core/helpers';import{grantAppTrackingTransparencyPermission,historyReset,historyPop}from'@shopgate/engage/core/actions';import{handleCookieConsent,showCookieConsentModal,hideCookieConsentModal}from"../action-creators";import{getIsCookieConsentHandled,getAreComfortCookiesAccepted,getAreStatisticsCookiesAccepted}from"../selectors/cookieConsent";import{cookieConsentInitializedByUserInternal$,privacySettingsConfirmedWithoutChangeInternal$,cookieConsentModalShouldToggleInternal$}from"../streams/cookieConsent";/**
2
+ * determine whether to show the cookie consent modal at app start
3
+ * @param {Function} subscribe The subscribe function
4
+ */export default function cookieConsent(subscribe){subscribe(appDidStart$,/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref){var dispatch,getState,state,isCookieConsentHandled,comfortCookiesAccepted,statisticsCookiesAccepted;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:dispatch=_ref.dispatch,getState=_ref.getState;state=getState();isCookieConsentHandled=getIsCookieConsentHandled(state);/**
5
+ * if merchant has not activated the cookie feature OR if merchant has activated cookie feature
6
+ * and user has chosen cookies already trigger stream to run code that depends on the cookie
7
+ * consent.
8
+ */if(!isCookieConsentHandled){_context.next=12;break;}comfortCookiesAccepted=getAreComfortCookiesAccepted(state);statisticsCookiesAccepted=getAreStatisticsCookiesAccepted(state);dispatch(handleCookieConsent({comfortCookiesAccepted:comfortCookiesAccepted,statisticsCookiesAccepted:statisticsCookiesAccepted}));if(!(appSupportsCookieConsent()&&(comfortCookiesAccepted||statisticsCookiesAccepted))){_context.next=10;break;}_context.next=10;return dispatch(grantAppTrackingTransparencyPermission());case 10:_context.next=13;break;case 12:// if merchant has activated cookie feature but user has not chosen cookies yet:
9
+ // show cookie consent modal to make user choose them
10
+ dispatch(showCookieConsentModal());case 13:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref2.apply(this,arguments);};}());subscribe(cookieConsentInitializedByUserInternal$,function(_ref3){var dispatch=_ref3.dispatch;// Reset history after consent initialization to guarantee an empty history
11
+ dispatch(historyReset());});subscribe(privacySettingsConfirmedWithoutChangeInternal$,function(_ref4){var dispatch=_ref4.dispatch;// Remove privacy settings route from route stack when any button was clicked but no settings
12
+ // where changed. When something was changed, app will reset via the "analytics" streams.
13
+ dispatch(historyPop());});subscribe(cookieConsentModalShouldToggleInternal$,function(_ref5){var dispatch=_ref5.dispatch,showConsentModal=_ref5.showConsentModal;dispatch(showConsentModal?showCookieConsentModal():hideCookieConsentModal());});}
@@ -1,4 +1 @@
1
- import{appDidStart$}from'@shopgate/engage/core';import{isTrackingAllowed}from"../helpers";import{hasCookieConsent}from"../selectors";import{initTracking}from"../action-creators";/**
2
- * Orders subscriptions.
3
- * @param {Function} subscribe The subscribe function.
4
- */var tracking=function tracking(subscribe){subscribe(appDidStart$,function(_ref){var getState=_ref.getState,dispatch=_ref.dispatch;var hasConsent=hasCookieConsent(getState());if(!hasConsent||isTrackingAllowed()){dispatch(initTracking());}});};export default tracking;
1
+ import analytics from"./analytics";import cookieConsent from"./cookieConsent";export default(function(subscribe){analytics(subscribe);cookieConsent(subscribe);});
package/user/index.js CHANGED
@@ -3,4 +3,4 @@ export{disableLogin}from'@shopgate/pwa-common/action-creators/user';// ACTIONS
3
3
  export{default as fetchRegisterUrl}from'@shopgate/pwa-common/actions/user/fetchRegisterUrl';export{default as fetchUser}from'@shopgate/pwa-common/actions/user/fetchUser';export{default as login}from'@shopgate/pwa-common/actions/user/login';export{default as logout}from'@shopgate/pwa-common/actions/user/logout';// CONSTANTS
4
4
  export*from'@shopgate/pwa-common/constants/Registration';export*from'@shopgate/pwa-common/constants/user';export{REGISTER_PATH,LOGIN_PATH};// SELECTORS
5
5
  export*from'@shopgate/pwa-common/selectors/user';export*from"./selectors/login";export*from"./selectors/data";// STREAMS
6
- export*from'@shopgate/pwa-common/streams/user';
6
+ export*from'@shopgate/pwa-common/streams/user';export{registrationSuccess$}from'@shopgate/engage/registration/streams';