@shopgate/engage 6.22.0-beta.1 → 6.22.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.
- package/app-rating/action-creators/appStart.js +3 -3
- package/app-rating/action-creators/ordersPlaced.js +3 -3
- package/app-rating/action-creators/popup.js +4 -4
- package/app-rating/action-creators/timer.js +3 -3
- package/app-rating/actions/showModal.js +2 -2
- package/app-rating/constants/index.js +2 -2
- package/app-rating/reducers/index.js +2 -2
- package/app-rating/subscriptions/index.js +2 -2
- package/back-in-stock/components/BackInStockButton/index.js +2 -2
- package/back-in-stock/components/BackInStockButton/style.js +1 -1
- package/back-in-stock/components/CharacteristicsButton/index.js +1 -1
- package/back-in-stock/components/ProductInfoBackInStockButton/connector.js +1 -1
- package/back-in-stock/components/Subscriptions/components/List/index.js +2 -2
- package/back-in-stock/components/Subscriptions/components/Subscription/index.js +3 -3
- package/back-in-stock/providers/BackInStockSubscriptionsProvider.connector.js +2 -2
- package/back-in-stock/providers/BackInStockSubscriptionsProvider.js +2 -2
- package/back-in-stock/reducers/index.js +2 -2
- package/back-in-stock/selectors/index.js +32 -14
- package/back-in-stock/subscriptions/index.js +10 -2
- package/core/action-creators/appPermissions.js +9 -0
- package/core/action-creators/index.js +1 -0
- package/core/actions/getGeolocation.js +1 -1
- package/core/actions/grantCameraPermissions.js +1 -1
- package/core/actions/grantGeolocationPermissions.js +1 -1
- package/core/actions/grantPermissions.js +4 -4
- package/core/actions/grantPushPermissions.js +2 -2
- package/core/actions/index.js +1 -0
- package/core/actions/requestAppPermission.js +7 -0
- package/core/actions/requestAppPermissionStatus.js +7 -0
- package/core/collections/AppInitialization.js +49 -0
- package/core/collections/index.js +1 -0
- package/core/constants/actionTypes.js +1 -0
- package/core/constants/appFeatures.js +1 -0
- package/core/constants/index.js +6 -0
- package/core/helpers/appFeatures.js +7 -0
- package/core/helpers/index.js +1 -0
- package/core/index.js +8 -12
- package/core/initialization/index.js +7 -0
- package/core/streams/appPermissions.js +19 -0
- package/core/streams/index.js +1 -0
- package/package.json +7 -7
- package/product/components/Characteristics/Characteristic/components/SheetItem/index.js +3 -3
- package/product/components/Characteristics/Characteristic/components/SheetItem/style.js +1 -1
- package/push-opt-in/action-creators/index.js +1 -0
- package/push-opt-in/action-creators/optInTrigger.js +23 -0
- package/push-opt-in/action-creators/pushOptIn.js +7 -0
- package/push-opt-in/actions/index.js +1 -0
- package/push-opt-in/actions/pushOptInModal.js +8 -0
- package/push-opt-in/components/PushOptInModal/connector.js +9 -0
- package/push-opt-in/components/PushOptInModal/index.js +10 -0
- package/push-opt-in/components/PushOptInModal/push-opt-in.svg +62 -0
- package/push-opt-in/components/PushOptInModal/style.js +1 -0
- package/push-opt-in/components/index.js +1 -0
- package/push-opt-in/constants/index.js +1 -0
- package/push-opt-in/constants/optInModal.js +1 -0
- package/push-opt-in/constants/optInTrigger.js +1 -0
- package/push-opt-in/reducers/index.js +1 -0
- package/push-opt-in/reducers/optInModal.js +6 -0
- package/push-opt-in/reducers/optInTrigger.js +6 -0
- package/push-opt-in/selectors/index.js +1 -0
- package/push-opt-in/selectors/optInModal.js +8 -0
- package/push-opt-in/selectors/optInTrigger.js +5 -0
- package/push-opt-in/subscriptions/index.js +1 -0
- package/push-opt-in/subscriptions/optInTrigger.js +12 -0
- package/a11y/components/LiveMessage/__tests__/index.spec.js +0 -1
- package/a11y/components/LiveMessenger/__tests__/helpers.spec.js +0 -1
- package/a11y/components/LiveMessenger/__tests__/index.spec.js +0 -1
- package/a11y/components/Navigation/__tests__/index.spec.js +0 -1
- package/a11y/components/Section/__tests__/index.spec.js +0 -1
- package/a11y/index.spec.js +0 -1
- package/back-in-stock/components/Subscriptions/components/Subscription/connector.js +0 -3
- package/cart/index.spec.js +0 -1
- package/category/index.spec.js +0 -1
- package/checkout/index.spec.js +0 -1
- package/components/Footer/__tests__/Footer.spec.js +0 -8
- package/components/Form/Builder/Builder.spec.js +0 -19
- package/components/Form/Builder/classes/ActionListener.spec.js +0 -21
- package/components/Form/Builder/helpers/buildCountryList.spec.js +0 -1
- package/components/Form/Builder/helpers/buildFormDefaults.spec.js +0 -1
- package/components/Form/Builder/helpers/buildFormElements.spec.js +0 -3
- package/components/Form/Builder/helpers/buildProvinceList.spec.js +0 -1
- package/components/IntersectionVisibility/__tests__/index.js +0 -1
- package/components/View/__mocks__/context.js +0 -1
- package/components/View/__mocks__/index.js +0 -5
- package/components/View/__tests__/index.spec.js +0 -1
- package/components/View/__tests__/provider.spec.js +0 -1
- package/components/View/components/Above/__tests__/index.spec.js +0 -1
- package/components/View/components/Below/__tests__/index.spec.js +0 -1
- package/components/View/components/Content/__tests__/index.spec.js +0 -2
- package/components/__mocks__/index.js +0 -4
- package/components/index.spec.js +0 -1
- package/core/actions/__tests__/getGeolocation.spec.js +0 -2
- package/core/actions/__tests__/grantCameraPermissions.spec.js +0 -1
- package/core/actions/__tests__/grantGeolocationPermissions.spec.js +0 -1
- package/core/actions/__tests__/grantPermissions.spec.js +0 -9
- package/core/actions/__tests__/updateStatusBarBackground.spec.js +0 -1
- package/core/classes/__tests__/GeolocationRequest.spec.js +0 -5
- package/core/config/__tests__/getPageConfig.spec.js +0 -1
- package/core/config/__tests__/getPageSettings.spec.js +0 -2
- package/core/config/__tests__/getThemeAssets.spec.js +0 -1
- package/core/config/__tests__/getThemeColors.spec.js +0 -1
- package/core/config/__tests__/getThemeConfig.spec.js +0 -2
- package/core/config/__tests__/getThemeSettings.spec.js +0 -1
- package/core/config/__tests__/getThemeStyles.spec.js +0 -1
- package/core/config/__tests__/getWidgetConfig.spec.js +0 -1
- package/core/config/__tests__/getWidgetSettings.spec.js +0 -3
- package/core/helpers/__mocks__/i18n.js +0 -1
- package/core/helpers/__tests__/i18n.spec.js +0 -1
- package/core/helpers/__tests__/updateLegacyNavigationBar.spec.js +0 -1
- package/core/hocs/__mocks__/withWidgetSettings.js +0 -5
- package/core/hocs/__tests__/withApp.spec.js +0 -2
- package/core/hocs/__tests__/withCurrentProduct.spec.js +0 -2
- package/core/hocs/__tests__/withForwardedRef.spec.js +0 -1
- package/core/hocs/__tests__/withNavigation.spec.js +0 -2
- package/core/hocs/__tests__/withRoute.spec.js +0 -2
- package/core/hocs/__tests__/withTheme.spec.js +0 -2
- package/core/hocs/__tests__/withWidgetSettings.spec.js +0 -2
- package/core/hocs/__tests__/withWidgetStyles.spec.js +0 -2
- package/core/hooks/__tests__/useApp.spec.js +0 -1
- package/core/hooks/__tests__/useNavigation.spec.js +0 -1
- package/core/hooks/__tests__/usePageConfig.spec.js +0 -1
- package/core/hooks/__tests__/usePageSettings.spec.js +0 -1
- package/core/hooks/__tests__/useTheme.spec.js +0 -1
- package/core/hooks/__tests__/useWidgetConfig.spec.js +0 -1
- package/core/hooks/__tests__/useWidgetSettings.spec.js +0 -1
- package/core/hooks/__tests__/useWidgetStyles.spec.js +0 -1
- package/core/index.spec.js +0 -1
- package/core/providers/__tests__/AppProvider.spec.js +0 -2
- package/core/router/__tests__/helpers.spec.js +0 -1
- package/favorites/index.spec.js +0 -1
- package/filter/helpers/__tests__/buildUpdatedFilters.spec.js +0 -1
- package/filter/index.spec.js +0 -1
- package/index.spec.js +0 -1
- package/market/index.spec.js +0 -1
- package/orders/index.spec.js +0 -1
- package/page/index.spec.js +0 -1
- package/product/components/Description/__tests__/Description.spec.js +0 -1
- package/product/components/Media/helpers.spec.js +0 -3
- package/product/components/ProductCharacteristics/helpers/index.spec.js +0 -12
- package/product/components/ProductGridPrice/index.spec.js +0 -1
- package/product/components/ProductProperties/__tests__/Content.spec.js +0 -1
- package/product/components/ProductProperties/__tests__/Group.spec.js +0 -1
- package/product/components/ProductProperties/__tests__/GroupedProperties.spec.js +0 -1
- package/product/components/ProductProperties/__tests__/Lists.spec.js +0 -1
- package/product/components/ProductProperties/__tests__/ProductProperties.spec.js +0 -1
- package/product/components/ProductProperties/__tests__/Row.spec.js +0 -1
- package/product/components/ProductProperties/__tests__/Rows.spec.js +0 -1
- package/product/components/ProductProperties/__tests__/helpers/getGroupsFromProperties.spec.js +0 -1
- package/product/components/ProductProperties/__tests__/helpers/getSubgroupsFromProperties.spec.js +0 -1
- package/product/components/QuantityPicker/helpers.spec.js +0 -1
- package/product/components/__mocks__/context.js +0 -1
- package/product/hocs/withMapPricing.spec.js +0 -4
- package/product/hocs/withPriceCalculation.spec.js +0 -1
- package/product/index.spec.js +0 -1
- package/product/selectors/__tests__/media.spec.js +0 -1
- package/product/selectors/__tests__/price.spec.js +0 -1
- package/product/selectors/__tests__/product.spec.js +0 -2
- package/product/selectors/__tests__/relations.spec.js +0 -1
- package/product/selectors/__tests__/variants.spec.js +0 -1
- package/product/selectors/mocks/productProperties.mock.js +0 -1
- package/reviews/index.spec.js +0 -1
- package/scanner/index.spec.js +0 -1
- package/search/index.spec.js +0 -1
- package/user/index.spec.js +0 -1
- package/user/selectors/__tests__/login.spec.js +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e){throw _e;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e2){didErr=true;err=_e2;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}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);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}/**
|
|
2
|
+
* @callback AppInitializationHandler
|
|
3
|
+
* @param {Object} params
|
|
4
|
+
* @param {Function} params.dispatch Redux dispatch function
|
|
5
|
+
* @param {Function} params.getState Redux dispatch function
|
|
6
|
+
* @returns {Promise}
|
|
7
|
+
*/ /**
|
|
8
|
+
* Class to maintain handler functions that are executed before the React app initializes.
|
|
9
|
+
*
|
|
10
|
+
* Handlers are invoked before the React app initializes. They can
|
|
11
|
+
* interact with Redux via "dispatch" and "getState" and e.g. initialize states based on
|
|
12
|
+
* information which is retrieved via app commands.
|
|
13
|
+
*
|
|
14
|
+
* Since the handler execution is blocking and postpones the React app initialization, this
|
|
15
|
+
* system should be handled with care.
|
|
16
|
+
*/var AppInitialization=/*#__PURE__*/function(){/**
|
|
17
|
+
* Constructor
|
|
18
|
+
*/function AppInitialization(){_classCallCheck(this,AppInitialization);this.store=new Map();}/**
|
|
19
|
+
* Get an initialization handler
|
|
20
|
+
* @param {*} key Identifier for the handler
|
|
21
|
+
* @returns {Promise}
|
|
22
|
+
*/_createClass(AppInitialization,[{key:"get",value:function get(key){return this.store.get(key);}/**
|
|
23
|
+
* Sets an initialization handler.
|
|
24
|
+
*
|
|
25
|
+
* @param {*} key Identifier for the handler
|
|
26
|
+
* @param {AppInitializationHandler} handler The actual handler
|
|
27
|
+
* @returns {AppInitialization}
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const handler = ({ dispatch, getState }) => {
|
|
31
|
+
* return new Promise(async (resolve) => {
|
|
32
|
+
* // Retrieve some data from the app via app command
|
|
33
|
+
* const appCommandResponse = await getAppCommandResponse();
|
|
34
|
+
* // Retrieve some data from Redux (store will be nearly empty at this point)
|
|
35
|
+
* const reduxValue = getValueFromRedux(getState());
|
|
36
|
+
* // Dispatch Redux actions to initialize a Redux state
|
|
37
|
+
* dispatch(reduxAction(reduxValue, appCommandResponse));
|
|
38
|
+
* resolve();
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* appInitialization.set('handler-key', handler);
|
|
42
|
+
* }
|
|
43
|
+
*/},{key:"set",value:function set(key,handler){this.store.set(key,handler);return this;}/**
|
|
44
|
+
* Invokes all registered handlers
|
|
45
|
+
* @returns {Promise<{results: [], errors: []}>}
|
|
46
|
+
*/},{key:"initialize",value:function(){var _initialize=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref){var dispatch,getState,promises,results,errors,_iterator,_step,promise;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:dispatch=_ref.dispatch,getState=_ref.getState;promises=Array.from(this.store.values()).map(function(handler){var res;// Take care that errors inside handlers don't break the app
|
|
47
|
+
try{res=handler({dispatch:dispatch,getState:getState});}catch(e){// Nothing to see here
|
|
48
|
+
}return res;}).filter(Boolean);results=[];errors=[];// eslint-disable-next-line no-restricted-syntax
|
|
49
|
+
_iterator=_createForOfIteratorHelper(promises);_context.prev=5;_iterator.s();case 7:if((_step=_iterator.n()).done){_context.next=22;break;}promise=_step.value;_context.prev=9;_context.t0=results;_context.next=13;return promise;case 13:_context.t1=_context.sent;_context.t0.push.call(_context.t0,_context.t1);_context.next=20;break;case 17:_context.prev=17;_context.t2=_context["catch"](9);errors.push(_context.t2);case 20:_context.next=7;break;case 22:_context.next=27;break;case 24:_context.prev=24;_context.t3=_context["catch"](5);_iterator.e(_context.t3);case 27:_context.prev=27;_iterator.f();return _context.finish(27);case 30:return _context.abrupt("return",{results:results,errors:errors});case 31:case"end":return _context.stop();}}},_callee,this,[[5,24,27,30],[9,17]]);}));function initialize(_x){return _initialize.apply(this,arguments);}return initialize;}()}]);return AppInitialization;}();export default new AppInitialization();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as appInitialization}from"./AppInitialization";export*from'@shopgate/pwa-common/collections';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var APP_PERMISSION_STATUS_RECEIVED='APP_PERMISSION_STATUS_RECEIVED';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var APP_FEATURE_PUSH_OPT_IN='optIn';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{INDEX_PATH,INDEX_PATH_DEEPLINK}from'@shopgate/pwa-common/constants/RoutePaths';export*from"./actionTypes";export*from"./appFeatures";export*from"./geolocationRequest";// Core Constants
|
|
2
|
+
export*from'@shopgate/pwa-core/constants/AppEvents';export*from'@shopgate/pwa-core/constants/AppPermissions';export*from'@shopgate/pwa-core/constants/ErrorHandleTypes';export*from'@shopgate/pwa-core/constants/Pipeline';export*from'@shopgate/pwa-core/constants/ProcessTypes';export*from'@shopgate/pwa-core/constants/Scanner';export*from'@shopgate/pwa-core/constants/Trilean';// Common Constants
|
|
3
|
+
export*from'@shopgate/pwa-common/constants/ActionTypes';export*from'@shopgate/pwa-common/constants/Configuration';export*from'@shopgate/pwa-common/constants/Device';export*from'@shopgate/pwa-common/constants/DisplayOptions';export*from'@shopgate/pwa-common/constants/Pipelines';export*from'@shopgate/pwa-common/constants/Portals';// CLIENT CONSTANTS
|
|
4
|
+
export*from'@shopgate/pwa-common/constants/client';// MENU CONSTANTS
|
|
5
|
+
export*from'@shopgate/pwa-common/constants/MenuIDs';// MODAL CONSTANTS
|
|
6
|
+
export*from'@shopgate/pwa-common/constants/ModalTypes';export{INDEX_PATH,INDEX_PATH_DEEPLINK};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{APP_FEATURE_PUSH_OPT_IN}from'@shopgate/engage/core/constants';import{hasSGJavaScriptBridge}from'@shopgate/pwa-core/helpers';/**
|
|
2
|
+
* Determines if the app supports the push opt-in feature
|
|
3
|
+
* @returns {boolean}
|
|
4
|
+
*/export var appSupportsPushOptIn=function appSupportsPushOptIn(){var _window,_window$SGAppInfo,_window$SGAppInfo$fea,_window$SGAppInfo$fea2,_window$SGAppInfo$fea3;if(!hasSGJavaScriptBridge()){// Always supported in development
|
|
5
|
+
return true;}if(!Array.isArray((_window=window)===null||_window===void 0?void 0:(_window$SGAppInfo=_window.SGAppInfo)===null||_window$SGAppInfo===void 0?void 0:(_window$SGAppInfo$fea=_window$SGAppInfo.featureFlags)===null||_window$SGAppInfo$fea===void 0?void 0:(_window$SGAppInfo$fea2=_window$SGAppInfo$fea.Push)===null||_window$SGAppInfo$fea2===void 0?void 0:(_window$SGAppInfo$fea3=_window$SGAppInfo$fea2['1'])===null||_window$SGAppInfo$fea3===void 0?void 0:_window$SGAppInfo$fea3.flags)){// Not supported on app versions that don't provide the featureFlags object
|
|
6
|
+
return false;}// Supported when the feature flags contain the push opt-in flag
|
|
7
|
+
return window.SGAppInfo.featureFlags.Push['1'].flags.includes(APP_FEATURE_PUSH_OPT_IN);};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./appFeatures";export{getFullImageSource}from"./getFullImageSource";export{getImageFormat}from"./getImageFormat";export{i18n}from"./i18n";export{updateLegacyNavigationBar}from"./updateLegacyNavigationBar";
|
package/core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @module core */import{getCurrentRoute as getCurrentRouteHelper,router,history,parseQueryStringToObject,parseObjectToQueryString}from'@shopgate/pwa-common/helpers/router'
|
|
1
|
+
/** @module core */import{getCurrentRoute as getCurrentRouteHelper,router,history,parseQueryStringToObject,parseObjectToQueryString}from'@shopgate/pwa-common/helpers/router';// --------------- CORE --------------- //
|
|
2
2
|
// Classes
|
|
3
3
|
// TODO: Contains circular dependency!
|
|
4
4
|
// export { default as AppCommand } from '@shopgate/pwa-core/classes/AppCommand';
|
|
@@ -6,8 +6,7 @@ export{default as GetAppPermissionsRequest}from'@shopgate/pwa-core/classes/AppPe
|
|
|
6
6
|
export{default as analyticsSetCustomValues}from'@shopgate/pwa-core/commands/analyticsSetCustomValues';export*from'@shopgate/pwa-core/commands/appPermissions';export*from'@shopgate/pwa-core/commands/brightness';export{default as broadcastEvent}from'@shopgate/pwa-core/commands/broadcastEvent';export{default as cleanTab,cleanTabCmd}from'@shopgate/pwa-core/commands/cleanTab';export{default as closeInAppBrowser}from'@shopgate/pwa-core/commands/closeInAppBrowser';export{default as flushTab}from'@shopgate/pwa-core/commands/flushTab';export{default as hideMenuBar}from'@shopgate/pwa-core/commands/hideMenuBar';export{default as hideNavigationBar}from'@shopgate/pwa-core/commands/hideNavigationBar';export{default as hideSplashScreen}from'@shopgate/pwa-core/commands/hideSplashScreen';export{default as onload}from'@shopgate/pwa-core/commands/onload';export{default as openAppSettings}from'@shopgate/pwa-core/commands/openAppSettings';export{default as openPage}from'@shopgate/pwa-core/commands/openPage';export{default as openPageExtern}from'@shopgate/pwa-core/commands/openPageExtern';export{default as performCommandsAfterDelay,performCommandsAfterDelayCmd}from'@shopgate/pwa-core/commands/performCommandsAfterDelay';export*from'@shopgate/pwa-core/commands/plotProjects';export{default as popTabToRoot,popTabToRootCmd}from'@shopgate/pwa-core/commands/popTabToRoot';export{default as registerEvents}from'@shopgate/pwa-core/commands/registerEvents';export*from'@shopgate/pwa-core/commands/scanner';export{default as setCookie}from'@shopgate/pwa-core/commands/setCookie';export{default as setDebugLoggingEnabled}from'@shopgate/pwa-core/commands/setDebugLoggingEnabled';export{default as setScrollingEnabled}from'@shopgate/pwa-core/commands/setScrollingEnabled';export{default as showNavigationBar}from'@shopgate/pwa-core/commands/showNavigationBar';export{default as showTab}from'@shopgate/pwa-core/commands/showTab';export*from'@shopgate/pwa-core/commands/unifiedTracking';// TODO: Contains circular dependency!
|
|
7
7
|
// export * from '@shopgate/pwa-core/commands/webStorage';
|
|
8
8
|
// Constants
|
|
9
|
-
export*from
|
|
10
|
-
export*from'@shopgate/pwa-common/constants/ActionTypes';export*from'@shopgate/pwa-common/constants/Configuration';export*from'@shopgate/pwa-common/constants/Device';export*from'@shopgate/pwa-common/constants/DisplayOptions';export*from'@shopgate/pwa-common/constants/Pipelines';export*from'@shopgate/pwa-common/constants/Portals';export{INDEX_PATH,INDEX_PATH_DEEPLINK};export*from"./constants/geolocationRequest";// Emitters
|
|
9
|
+
export*from"./constants";// Emitters
|
|
11
10
|
export{default as UIEvents}from'@shopgate/pwa-core/emitters/ui';// Helpers
|
|
12
11
|
export*from'@shopgate/pwa-core/helpers';export{default as logGroup}from'@shopgate/pwa-core/helpers/logGroup';export*from'@shopgate/pwa-core/helpers/version';export*from'@shopgate/pwa-common/helpers/data';export*from'@shopgate/pwa-common/helpers/date';export*from'@shopgate/pwa-common/helpers/dom';export*from'@shopgate/pwa-common/helpers/environment';export{default as decodeHTML}from'@shopgate/pwa-common/helpers/html/decodeHTML';export*from'@shopgate/pwa-common/helpers/html/handleDOM';export{default as parseHTML}from'@shopgate/pwa-common/helpers/html/parseHTML';export{default as getTranslator}from'@shopgate/pwa-common/helpers/i18n/getTranslator';export{default as getPriceFormatter}from'@shopgate/pwa-common/helpers/i18n/getPriceFormatter';export{default as getDateFormatter}from'@shopgate/pwa-common/helpers/i18n/getDateFormatter';export{default as getTimeFormatter}from'@shopgate/pwa-common/helpers/i18n/getTimeFormatter';export{default as getNumberFormatter}from'@shopgate/pwa-common/helpers/i18n/getNumberFormatter';export*from'@shopgate/pwa-common/helpers/legacy';// TODO: Can only be exported once the theme uses it. causes issues with the custom routes feature.
|
|
13
12
|
/*
|
|
@@ -16,15 +15,14 @@ export { default as routePortals } from '@shopgate/pwa-common/helpers/portals/ro
|
|
|
16
15
|
*/export*from'@shopgate/pwa-common/helpers/redux';export*from'@shopgate/pwa-common/helpers/style';export*from'@shopgate/pwa-common/helpers/tracking';export*from'@shopgate/pwa-common/helpers/validation';// STREAMS
|
|
17
16
|
export*from'@shopgate/pwa-common/streams/main';export*from'@shopgate/pwa-common/streams/error';// --------------- APP --------------- //
|
|
18
17
|
// ACTIONS
|
|
19
|
-
export{default as handleDeepLink}from'@shopgate/pwa-common/actions/app/handleDeepLink';export{default as handleUniversalLink}from'@shopgate/pwa-common/actions/app/handleUniversalLink';export{default as handleLink}from'@shopgate/pwa-common/actions/app/handleLink';export{default as handlePushNotification}from'@shopgate/pwa-common/actions/app/handlePushNotification';export{default as registerLinkEvents}from'@shopgate/pwa-common/actions/app/registerLinkEvents';export{default as updateStatusBarBackground}from"./actions/updateStatusBarBackground";export{default as grantPermissions}from"./actions/grantPermissions";export{default as
|
|
18
|
+
export{default as handleDeepLink}from'@shopgate/pwa-common/actions/app/handleDeepLink';export{default as handleUniversalLink}from'@shopgate/pwa-common/actions/app/handleUniversalLink';export{default as handleLink}from'@shopgate/pwa-common/actions/app/handleLink';export{default as handlePushNotification}from'@shopgate/pwa-common/actions/app/handlePushNotification';export{default as registerLinkEvents}from'@shopgate/pwa-common/actions/app/registerLinkEvents';export{default as updateStatusBarBackground}from"./actions/updateStatusBarBackground";export{default as grantPermissions}from"./actions/grantPermissions";export{default as grantPushPermissions}from"./actions/grantPushPermissions";export{default as grantCameraPermissions}from"./actions/grantCameraPermissions";export{default as grantGeolocationPermissions}from"./actions/grantGeolocationPermissions";export{default as requestAppPermission}from"./actions/requestAppPermission";export{default as requestAppPermissionStatus}from"./actions/requestAppPermissionStatus";export{default as getGeolocation}from"./actions/getGeolocation";// STREAMS
|
|
20
19
|
export*from'@shopgate/pwa-common/streams/app';// --------------- STORE --------------- //
|
|
21
20
|
export*from'@shopgate/pwa-common/store';// --------------- CLIENT --------------- //
|
|
22
21
|
// ACTIONS
|
|
23
|
-
export{default as fetchClientInformation}from'@shopgate/pwa-common/actions/client/fetchClientInformation';//
|
|
24
|
-
export*from'@shopgate/pwa-common/constants/client';// SELECTORS
|
|
22
|
+
export{default as fetchClientInformation}from'@shopgate/pwa-common/actions/client/fetchClientInformation';// SELECTORS
|
|
25
23
|
export*from'@shopgate/pwa-common/selectors/client';// STREAMS
|
|
26
24
|
export*from'@shopgate/pwa-common/streams/client';// --------------- COLLECTIONS --------------- //
|
|
27
|
-
export{default as authRoutes}from'@shopgate/pwa-common/collections/AuthRoutes';export{default as redirects}from'@shopgate/pwa-common/collections/Redirects';export{default as configuration}from'@shopgate/pwa-common/collections/Configuration';export{default as embeddedMedia}from'@shopgate/pwa-common/collections/EmbeddedMedia';export{default as persistedReducers}from'@shopgate/pwa-common/collections/PersistedReducers';export{default as Vimeo}from'@shopgate/pwa-common/collections/media-providers/Vimeo';export{default as YouTube}from'@shopgate/pwa-common/collections/media-providers/YouTube';// --------------- CONTEXTS --------------- //
|
|
25
|
+
export{default as appInitialization}from"./collections/AppInitialization";export{default as authRoutes}from'@shopgate/pwa-common/collections/AuthRoutes';export{default as redirects}from'@shopgate/pwa-common/collections/Redirects';export{default as configuration}from'@shopgate/pwa-common/collections/Configuration';export{default as embeddedMedia}from'@shopgate/pwa-common/collections/EmbeddedMedia';export{default as persistedReducers}from'@shopgate/pwa-common/collections/PersistedReducers';export{default as Vimeo}from'@shopgate/pwa-common/collections/media-providers/Vimeo';export{default as YouTube}from'@shopgate/pwa-common/collections/media-providers/YouTube';// --------------- CONTEXTS --------------- //
|
|
28
26
|
export*from'@shopgate/pwa-common/context';export{default as AppContext}from"./contexts/AppContext";// --------------- PROVIDERS --------------- //
|
|
29
27
|
export{default as LoadingProvider}from'@shopgate/pwa-common/providers/loading';export{default as LoadingContext}from'@shopgate/pwa-common/providers/loading/context';export{default as ToastProvider}from'@shopgate/pwa-common/providers/toast';export{default as ToastContext}from'@shopgate/pwa-common/providers/toast/context';export{default as AppProvider}from"./providers/AppProvider";// --------------- ROUTER --------------- //
|
|
30
28
|
// ACTIONS
|
|
@@ -36,15 +34,13 @@ export*from'@shopgate/pwa-common/streams/router';// --------------- URL --------
|
|
|
36
34
|
export{resetApp}from'@shopgate/pwa-common/action-creators/app';export*from'@shopgate/pwa-common/action-creators/url';// SELECTORS
|
|
37
35
|
export*from'@shopgate/pwa-common/selectors/url';// --------------- MENU --------------- //
|
|
38
36
|
// ACTIONS
|
|
39
|
-
export{default as fetchMenu}from'@shopgate/pwa-common/actions/menu/fetchMenu';//
|
|
40
|
-
export*from'@shopgate/pwa-common/constants/MenuIDs';// SELECTORS
|
|
37
|
+
export{default as fetchMenu}from'@shopgate/pwa-common/actions/menu/fetchMenu';// SELECTORS
|
|
41
38
|
export*from'@shopgate/pwa-common/selectors/menu';// --------------- MODAL --------------- //
|
|
42
39
|
// ACTIONS
|
|
43
|
-
export{default as closeModal}from'@shopgate/pwa-common/actions/modal/closeModal';export{default as promiseMap}from'@shopgate/pwa-common/actions/modal/promiseMap';export{default as showModal}from'@shopgate/pwa-common/actions/modal/showModal';//
|
|
44
|
-
export*from'@shopgate/pwa-common/constants/ModalTypes';// HELPERS
|
|
40
|
+
export{default as closeModal}from'@shopgate/pwa-common/actions/modal/closeModal';export{default as promiseMap}from'@shopgate/pwa-common/actions/modal/promiseMap';export{default as showModal}from'@shopgate/pwa-common/actions/modal/showModal';// HELPERS
|
|
45
41
|
export{default as withShowModal}from'@shopgate/pwa-common/helpers/modal/withShowModal';// SELECTORS
|
|
46
42
|
export*from'@shopgate/pwa-common/selectors/modal';// --------------- HOOKS --------------- //
|
|
47
43
|
export{useRoute}from"./hooks/useRoute";export{useTheme}from"./hooks/useTheme";export{useCurrentProduct}from"./hooks/useCurrentProduct";export{useNavigation}from"./hooks/useNavigation";export{usePageConfig}from"./hooks/usePageConfig";export{usePageSettings}from"./hooks/usePageSettings";export{useWidgetConfig}from"./hooks/useWidgetConfig";export{useWidgetSettings}from"./hooks/useWidgetSettings";export{useWidgetStyles}from"./hooks/useWidgetStyles";export*from"./hooks/html";// --------------- HOCs --------------- //
|
|
48
44
|
export{withTheme}from"./hocs/withTheme";export{withRoute}from"./hocs/withRoute";export{withCurrentProduct}from"./hocs/withCurrentProduct";export{withForwardedRef}from"./hocs/withForwardedRef";export{withNavigation}from"./hocs/withNavigation";export{withWidgetSettings}from"./hocs/withWidgetSettings";export{withWidgetStyles}from"./hocs/withWidgetStyles";export{withApp}from"./hocs/withApp";// --------------- CONFIG --------------- //
|
|
49
45
|
export{ThemeConfigResolver}from"./config/ThemeConfigResolver";export{isBeta}from"./config/isBeta";export{getThemeConfig}from"./config/getThemeConfig";export{getThemeSettings}from"./config/getThemeSettings";export{getThemeColors}from"./config/getThemeColors";export{getThemeAssets}from"./config/getThemeAssets";export{getPageConfig}from"./config/getPageConfig";export{getPageSettings}from"./config/getPageSettings";export{getWidgetConfig}from"./config/getWidgetConfig";export{getWidgetSettings}from"./config/getWidgetSettings";// -------------- HELPERS -------------- //
|
|
50
|
-
export{i18n}from"./helpers/i18n";export{updateLegacyNavigationBar}from"./helpers/updateLegacyNavigationBar";export{getFullImageSource}from"./helpers/getFullImageSource";
|
|
46
|
+
export{i18n}from"./helpers/i18n";export{updateLegacyNavigationBar}from"./helpers/updateLegacyNavigationBar";export{getFullImageSource}from"./helpers/getFullImageSource";export*from"./initialization";
|
|
@@ -0,0 +1,7 @@
|
|
|
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{appConfig}from'@shopgate/engage';import{i18n,configureStore,fetchClientInformation}from'@shopgate/engage/core';import{appInitialization}from'@shopgate/engage/core/collections';import{appWillInit,appWillStart}from'@shopgate/pwa-common/action-creators/app';var _appConfig$locales=appConfig.locales;_appConfig$locales=_appConfig$locales===void 0?{}:_appConfig$locales;var _appConfig$locales$cu=_appConfig$locales.currency,currencyLocale=_appConfig$locales$cu===void 0?null:_appConfig$locales$cu;/**
|
|
2
|
+
*
|
|
3
|
+
* @param {Object} locales An object with locales.
|
|
4
|
+
* @param {Function} reducers The reducers from the theme.
|
|
5
|
+
* @param {Array} subscribers The subscribers to the streams middleware.
|
|
6
|
+
*/export var initialize=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(locales,reducers,subscribers){var store;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:i18n.init({locales:locales,lang:process.env.LOCALE,currencyLocale:currencyLocale});store=configureStore(reducers,subscribers);_context.prev=2;_context.next=5;return store.dispatch(fetchClientInformation());case 5:_context.next=9;break;case 7:_context.prev=7;_context.t0=_context["catch"](2);case 9:store.dispatch(appWillInit("".concat(window.location.pathname).concat(window.location.search)));// Execute all registered handlers from the AppInitialization collection
|
|
7
|
+
_context.next=12;return appInitialization.initialize({dispatch:store.dispatch,getState:store.getState});case 12:store.dispatch(appWillStart("".concat(window.location.pathname).concat(window.location.search)));return _context.abrupt("return",{store:store});case 14:case"end":return _context.stop();}}},_callee,null,[[2,7]]);}));return function initialize(_x,_x2,_x3){return _ref.apply(this,arguments);};}();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{main$}from'@shopgate/pwa-common/streams/main';import{PERMISSION_ID_PUSH,PERMISSION_ID_CAMERA,PERMISSION_ID_LOCATION,PERMISSION_ID_PHONE,PERMISSION_ID_BACKGROUND_APP_REFRESH,APP_PERMISSION_STATUS_RECEIVED}from'@shopgate/engage/core/constants';/**
|
|
2
|
+
* Gets triggered when a permission status was received from the app.
|
|
3
|
+
* @type {Observable}
|
|
4
|
+
*/export var appPermissionStatusReceived$=main$.filter(function(_ref){var action=_ref.action;return action.type===APP_PERMISSION_STATUS_RECEIVED;});/**
|
|
5
|
+
* Gets triggered when a push permission status was received from the app.
|
|
6
|
+
* @type {Observable}
|
|
7
|
+
*/export var appPermissionStatusPushReceived$=appPermissionStatusReceived$.filter(function(_ref2){var action=_ref2.action;return action.permissionId===PERMISSION_ID_PUSH;});/**
|
|
8
|
+
* Gets triggered when a camera permission status was received from the app.
|
|
9
|
+
* @type {Observable}
|
|
10
|
+
*/export var appPermissionStatusCameraReceived$=appPermissionStatusReceived$.filter(function(_ref3){var action=_ref3.action;return action.permissionId===PERMISSION_ID_CAMERA;});/**
|
|
11
|
+
* Gets triggered when a location permission status was received from the app.
|
|
12
|
+
* @type {Observable}
|
|
13
|
+
*/export var appPermissionStatusLocationReceived$=appPermissionStatusReceived$.filter(function(_ref4){var action=_ref4.action;return action.permissionId===PERMISSION_ID_LOCATION;});/**
|
|
14
|
+
* Gets triggered when a phone permission status was received from the app.
|
|
15
|
+
* @type {Observable}
|
|
16
|
+
*/export var appPermissionStatusPhoneReceived$=appPermissionStatusReceived$.filter(function(_ref5){var action=_ref5.action;return action.permissionId===PERMISSION_ID_PHONE;});/**
|
|
17
|
+
* Gets triggered when a backgroundAppRefresh permission status was received from the app.
|
|
18
|
+
* @type {Observable}
|
|
19
|
+
*/export var appPermissionStatusBackgroundAppRefreshReceived$=appPermissionStatusReceived$.filter(function(_ref6){var action=_ref6.action;return action.permissionId===PERMISSION_ID_BACKGROUND_APP_REFRESH;});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./appPermissions";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/engage",
|
|
3
|
-
"version": "6.22.0-beta.
|
|
3
|
+
"version": "6.22.0-beta.10",
|
|
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.22.0-beta.
|
|
19
|
-
"@shopgate/pwa-common-commerce": "6.22.0-beta.
|
|
20
|
-
"@shopgate/pwa-core": "6.22.0-beta.
|
|
21
|
-
"@shopgate/pwa-ui-ios": "6.22.0-beta.
|
|
22
|
-
"@shopgate/pwa-ui-material": "6.22.0-beta.
|
|
23
|
-
"@shopgate/pwa-ui-shared": "6.22.0-beta.
|
|
18
|
+
"@shopgate/pwa-common": "6.22.0-beta.10",
|
|
19
|
+
"@shopgate/pwa-common-commerce": "6.22.0-beta.10",
|
|
20
|
+
"@shopgate/pwa-core": "6.22.0-beta.10",
|
|
21
|
+
"@shopgate/pwa-ui-ios": "6.22.0-beta.10",
|
|
22
|
+
"@shopgate/pwa-ui-material": "6.22.0-beta.10",
|
|
23
|
+
"@shopgate/pwa-ui-shared": "6.22.0-beta.10",
|
|
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,5 +1,5 @@
|
|
|
1
|
-
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}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 _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import{withForwardedRef}from'@shopgate/engage/core';import{CharacteristicsButton}from'@shopgate/engage/back-in-stock/components';import styles from"./style";/**
|
|
1
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}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 _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{withForwardedRef}from'@shopgate/engage/core';import{CharacteristicsButton}from'@shopgate/engage/back-in-stock/components';import styles from"./style";/**
|
|
2
2
|
* The SheetItem component.
|
|
3
|
-
*/var SheetItem=/*#__PURE__*/function(_PureComponent){_inherits(SheetItem,_PureComponent);var _super=_createSuper(SheetItem);function SheetItem(){var _this;_classCallCheck(this,SheetItem);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"getStyle",function(selectable){
|
|
3
|
+
*/var SheetItem=/*#__PURE__*/function(_PureComponent){_inherits(SheetItem,_PureComponent);var _super=_createSuper(SheetItem);function SheetItem(){var _this;_classCallCheck(this,SheetItem);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"getStyle",function(selectable){if(!selectable){return styles.buttonDisabled;}return styles.button;});_defineProperty(_assertThisInitialized(_this),"buildProps",function(){var _this$props=_this.props,item=_this$props.item,_onClick=_this$props.onClick,forwardedRef=_this$props.forwardedRef;return _extends({className:"".concat(_this.getStyle(item.selectable).toString()," theme__product__characteristic__option"),key:item.id,ref:forwardedRef,value:item.id,'aria-hidden':!item.selectable},item.selectable&&{onClick:function onClick(event){return _onClick(event,item.id);}});});return _this;}_createClass(SheetItem,[{key:"render",value:/**
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/function render(){var _this$props2=this.props,item=_this$props2.item,Right=_this$props2.rightComponent,selected=_this$props2.selected,characteristics=_this$props2.characteristics;var buildProps=this.buildProps();return/*#__PURE__*/React.createElement("button",_extends({},buildProps,{"data-test-id":item.label,"aria-selected":selected,role:"option",type:"button"}),item.label,item.selectable&&/*#__PURE__*/React.createElement(Right,null),item.selectable&&/*#__PURE__*/React.createElement(CharacteristicsButton,{characteristics:characteristics}));}}]);return SheetItem;}(PureComponent);_defineProperty(SheetItem,"defaultProps",{forwardedRef:null,onClick:function onClick(){},rightComponent:null,selected:false});export default withForwardedRef(SheetItem);
|
|
5
|
+
*/function render(){var _this$props2=this.props,item=_this$props2.item,Right=_this$props2.rightComponent,selected=_this$props2.selected,characteristics=_this$props2.characteristics;var buildProps=this.buildProps();return/*#__PURE__*/React.createElement("div",{className:classNames(styles.root,_defineProperty({},styles.rootSelected,selected))},/*#__PURE__*/React.createElement("button",_extends({},buildProps,{"data-test-id":item.label,"aria-selected":selected,role:"option",type:"button"}),/*#__PURE__*/React.createElement("div",{className:styles.mainRow},/*#__PURE__*/React.createElement("div",null,item.label),/*#__PURE__*/React.createElement("div",{className:styles.mainRowRight},item.selectable&&/*#__PURE__*/React.createElement(Right,null)))),/*#__PURE__*/React.createElement("div",{className:styles.bottomRow},item.selectable&&/*#__PURE__*/React.createElement(CharacteristicsButton,{characteristics:characteristics})));}}]);return SheetItem;}(PureComponent);_defineProperty(SheetItem,"defaultProps",{forwardedRef:null,onClick:function onClick(){},rightComponent:null,selected:false});export default withForwardedRef(SheetItem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var button=css({outline:0,
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var button=css({outline:0,textAlign:'left',paddingLeft:0,paddingRight:0,width:'100%',display:'flex',justifyContent:'space-between',flexWrap:'wrap'});var buttonDisabled=css(button,{color:colors.shade4});var bgColor=colors.darkGray;var boxShadowOffset=variables.gap.bigger;var root=css({padding:'16px 0'});var rootSelected=css(root,{background:bgColor,boxShadow:"-".concat(boxShadowOffset,"px 0 0 ").concat(bgColor,", ").concat(boxShadowOffset,"px 0 0 ").concat(bgColor),paddingTop:17,paddingBottom:17,margin:'-1px 0'}).toString();var mainRow=css({display:'flex',flexWrap:'wrap',gap:'4px 8px',justifyContent:'space-between',width:'100%'}).toString();var mainRowRight=css({marginLeft:'auto'}).toString();var bottomRow=css({'&:not(:empty)':{marginTop:8,textAlign:'right'}}).toString();export default{root:root,rootSelected:rootSelected,button:button,buttonDisabled:buttonDisabled,mainRow:mainRow,mainRowRight:mainRowRight,bottomRow:bottomRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./optInTrigger";export*from"./pushOptIn";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{PUSH_OPT_IN_INCREASE_APP_START_COUNT,PUSH_OPT_IN_RESET_APP_START_COUNT,PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT,PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT,PUSH_OPT_IN_INCREASE_REJECTION_COUNT,PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP,PUSH_OPT_IN_OPT_IN_POSTPONED}from"../constants";/**
|
|
2
|
+
* Increment the app start count
|
|
3
|
+
* @return {Object} The dispatched action object.
|
|
4
|
+
*/export var increaseAppStartCount=function increaseAppStartCount(){return{type:PUSH_OPT_IN_INCREASE_APP_START_COUNT};};/**
|
|
5
|
+
* Reset the app start count, and increment reset counts
|
|
6
|
+
* @return {Object} The dispatched action object.
|
|
7
|
+
*/export var resetAppStartCount=function resetAppStartCount(){return{type:PUSH_OPT_IN_RESET_APP_START_COUNT};};/**
|
|
8
|
+
* Increment the orders placed count
|
|
9
|
+
* @return {Object} The dispatched action object.
|
|
10
|
+
*/export var increaseOrdersPlacedCount=function increaseOrdersPlacedCount(){return{type:PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT};};/**
|
|
11
|
+
* Reset the orders placed count, and increment reset counts
|
|
12
|
+
* @return {Object} The dispatched action object.
|
|
13
|
+
*/export var resetOrdersPlacedCount=function resetOrdersPlacedCount(){return{type:PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT};};/**
|
|
14
|
+
* Sets the last opt-in timestamp
|
|
15
|
+
* @return {Object} The dispatched action object.
|
|
16
|
+
*/export var setLastPopupTimestamp=function setLastPopupTimestamp(){return{type:PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP};};/**
|
|
17
|
+
* Increased the opt-in rejection / postponement count
|
|
18
|
+
* @return {Object} The dispatched action object.
|
|
19
|
+
*/export var increaseRejectionCount=function increaseRejectionCount(){return{type:PUSH_OPT_IN_INCREASE_REJECTION_COUNT};};/**
|
|
20
|
+
* Action to be dispatched when push opt in was postponed e.g. Opt In Modal was closed without
|
|
21
|
+
* taking a decision about permissions.
|
|
22
|
+
* @return {Object} The dispatched action object.
|
|
23
|
+
*/export var optInPostponed=function optInPostponed(){return{type:PUSH_OPT_IN_OPT_IN_POSTPONED};};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{HIDE_PUSH_OPT_IN_MODAL,SHOW_PUSH_OPT_IN_MODAL}from"../constants";/**
|
|
2
|
+
* action to be dispatched when the push opt-in should be shown
|
|
3
|
+
* @returns {Function}
|
|
4
|
+
*/export var showPushOptInModal=function showPushOptInModal(){return{type:SHOW_PUSH_OPT_IN_MODAL};};/**
|
|
5
|
+
* action to be dispatched when the push opt-in should be hidden
|
|
6
|
+
* @returns {Function}
|
|
7
|
+
*/export var hidePushOptInModal=function hidePushOptInModal(){return{type:HIDE_PUSH_OPT_IN_MODAL};};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./pushOptInModal";
|
|
@@ -0,0 +1,8 @@
|
|
|
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{grantPushPermissions}from"../../core";import{hidePushOptInModal,optInPostponed}from"../action-creators";/**
|
|
2
|
+
* action to be dispatched when the user allowed the push opt-in in the modal
|
|
3
|
+
* and native modal should be triggered for setting the permission
|
|
4
|
+
* @returns {Function}
|
|
5
|
+
*/export var allowPushOptIn=function allowPushOptIn(){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(grantPushPermissions({useSettingsModal:true}));case 2:dispatch(hidePushOptInModal());case 3:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}();};/**
|
|
6
|
+
* action to be dispatched when the user denied the push opt-in in the modal
|
|
7
|
+
* @returns {Function}
|
|
8
|
+
*/export var denyPushOptIn=function denyPushOptIn(){return/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(dispatch){return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.next=2;return dispatch(optInPostponed());case 2:dispatch(hidePushOptInModal());case 3:case"end":return _context2.stop();}}},_callee2);}));return function(_x2){return _ref2.apply(this,arguments);};}();};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{connect}from'react-redux';import{getIsPushOptInModalVisible}from"../../selectors";import{allowPushOptIn,denyPushOptIn}from"../../actions";/**
|
|
2
|
+
* Maps the contents of the state to the component props.
|
|
3
|
+
* @param {Object} state The current application state.
|
|
4
|
+
* @return {Object} The extended component props.
|
|
5
|
+
*/var mapStateToProps=function mapStateToProps(state){return{isPushOptInModalVisible:getIsPushOptInModalVisible(state)};};/**
|
|
6
|
+
* Connects the dispatch function to a callable function in the props.
|
|
7
|
+
* @param {Function} dispatch The redux dispatch function.
|
|
8
|
+
* @return {Object} The extended component props.
|
|
9
|
+
*/var mapDispatchToProps={allowPushOptIn:allowPushOptIn,denyPushOptIn:denyPushOptIn};export default connect(mapStateToProps,mapDispatchToProps);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React,{useMemo}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{Grid,I18n,Button,Modal}from'@shopgate/engage/components';import{appConfig}from'@shopgate/engage';import pushImage from"./push-opt-in.svg";import styles from"./style";import connect from"./connector";/**
|
|
2
|
+
* The Push opt-in modal component.
|
|
3
|
+
* @param {Object} props The component props.
|
|
4
|
+
* @returns {JSX.Element}
|
|
5
|
+
*/var PushOptInModal=function PushOptInModal(_ref){var isPushOptInModalVisible=_ref.isPushOptInModalVisible,allowPushOptIn=_ref.allowPushOptIn,denyPushOptIn=_ref.denyPushOptIn;var _appConfig$pushOptIn=appConfig.pushOptIn;_appConfig$pushOptIn=_appConfig$pushOptIn===void 0?{}:_appConfig$pushOptIn;var modalMessage=_appConfig$pushOptIn.modalMessage,modalTitle=_appConfig$pushOptIn.modalTitle,modalButtonDeny=_appConfig$pushOptIn.modalButtonDeny,modalButtonAllow=_appConfig$pushOptIn.modalButtonAllow,modalImageURL=_appConfig$pushOptIn.modalImageURL,modalImageSVG=_appConfig$pushOptIn.modalImageSVG;var imageSRC=useMemo(function(){// No overwrite configured -> use default image
|
|
6
|
+
if(!modalImageURL&&!modalImageSVG){return pushImage;}// URL overwrite configured -> use it
|
|
7
|
+
if(modalImageURL){return modalImageURL;}// SVG overwrite configured -> create data url
|
|
8
|
+
try{// Remove any characters outside the Latin1 range
|
|
9
|
+
var decoded=decodeURIComponent(encodeURIComponent(modalImageSVG));// Now we can use btoa to convert the svg to base64
|
|
10
|
+
var base64=btoa(decoded);return"data:image/svg+xml;base64,".concat(base64);}catch(e){return pushImage;}},[modalImageSVG,modalImageURL]);if(!isPushOptInModalVisible){return null;}return/*#__PURE__*/React.createElement(Modal,{isOpened:isPushOptInModalVisible,classes:{content:styles.modalContent}},/*#__PURE__*/React.createElement(Grid,{className:classNames(styles.container,'push-opt-in-modal__container')},/*#__PURE__*/React.createElement(Grid.Item,{className:styles.item},/*#__PURE__*/React.createElement("img",{src:imageSRC,className:classNames(styles.image,'push-opt-in-modal__image'),alt:"","aria-hidden":"true"}),/*#__PURE__*/React.createElement(I18n.Text,{className:classNames(styles.title,'push-opt-in-modal__title'),string:modalTitle||'pushOptInModal.title'}),/*#__PURE__*/React.createElement(I18n.Text,{className:classNames('push-opt-in-modal__message'),string:modalMessage||'pushOptInModal.message'}),/*#__PURE__*/React.createElement(Button,{onClick:allowPushOptIn,type:"primary",className:classNames(styles.button,'push-opt-in-modal__button-allow')},/*#__PURE__*/React.createElement(I18n.Text,{string:modalButtonAllow||'pushOptInModal.buttonAllow'})),/*#__PURE__*/React.createElement(Button,{onClick:denyPushOptIn,type:"plain",className:classNames(styles.button,'push-opt-in-modal__button-deny')},/*#__PURE__*/React.createElement(I18n.Text,{string:modalButtonDeny||'pushOptInModal.buttonDeny',className:styles.buttonText})))));};export default connect(PushOptInModal);
|
|
@@ -0,0 +1,62 @@
|
|
|
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 1107 791" 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,-88.9596,-502.577)">
|
|
5
|
+
<g transform="matrix(1.28381,0,0,1.28381,-145.009,-328.293)">
|
|
6
|
+
<g>
|
|
7
|
+
<g transform="matrix(0.738616,0,0,0.7166,142.625,351.19)">
|
|
8
|
+
<path d="M1052.9,1091.68C1052.9,1062.46 1029.88,1038.73 1001.53,1038.73L244.024,1038.73C215.667,1038.73 192.646,1062.46 192.646,1091.68L192.646,1219.08C192.646,1248.3 215.667,1272.03 244.024,1272.03L1001.53,1272.03C1029.88,1272.03 1052.9,1248.3 1052.9,1219.08L1052.9,1091.68Z" style="fill:rgb(193,193,193);"/>
|
|
9
|
+
</g>
|
|
10
|
+
<g transform="matrix(0.859568,0,0,0.833947,80.1965,145.713)">
|
|
11
|
+
<path d="M1052.9,1091.68C1052.9,1062.46 1029.88,1038.73 1001.53,1038.73L244.024,1038.73C215.667,1038.73 192.646,1062.46 192.646,1091.68L192.646,1219.08C192.646,1248.3 215.667,1272.03 244.024,1272.03L1001.53,1272.03C1029.88,1272.03 1052.9,1248.3 1052.9,1219.08L1052.9,1091.68Z" style="fill:rgb(216,216,216);"/>
|
|
12
|
+
</g>
|
|
13
|
+
<g transform="matrix(1.00203,0,0,0.972164,-10.791,-90.8989)">
|
|
14
|
+
<path d="M1052.9,1091.68C1052.9,1062.46 1029.88,1038.73 1001.53,1038.73L244.024,1038.73C215.667,1038.73 192.646,1062.46 192.646,1091.68L192.646,1219.08C192.646,1248.3 215.667,1272.03 244.024,1272.03L1001.53,1272.03C1029.88,1272.03 1052.9,1248.3 1052.9,1219.08L1052.9,1091.68Z" style="fill:rgb(235,235,235);"/>
|
|
15
|
+
</g>
|
|
16
|
+
<g transform="matrix(1.00203,0,0,0.972164,-10.791,-362.62)">
|
|
17
|
+
<path d="M1052.9,1091.68C1052.9,1062.46 1029.88,1038.73 1001.53,1038.73L244.024,1038.73C215.667,1038.73 192.646,1062.46 192.646,1091.68L192.646,1219.08C192.646,1248.3 215.667,1272.03 244.024,1272.03L1001.53,1272.03C1029.88,1272.03 1052.9,1248.3 1052.9,1219.08L1052.9,1091.68Z" style="fill:rgb(235,235,235);"/>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
<g transform="matrix(1.00052,0,0,1,-19.3912,30.3377)">
|
|
21
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.762,1033.42 949.281,1033.42L424.519,1033.42C422.039,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.039,1065.77 424.519,1065.77L949.281,1065.77C951.762,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
22
|
+
</g>
|
|
23
|
+
<g transform="matrix(0.823791,0,0,1,54.8392,-16.3916)">
|
|
24
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.33,1033.42 948.317,1033.42L425.484,1033.42C422.471,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.471,1065.77 425.484,1065.77L948.317,1065.77C951.33,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
25
|
+
</g>
|
|
26
|
+
<g transform="matrix(0.904048,0,0,1,21.129,-67.1309)">
|
|
27
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.547,1033.42 948.801,1033.42L424.999,1033.42C422.254,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.254,1065.77 424.999,1065.77L948.801,1065.77C951.547,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
28
|
+
</g>
|
|
29
|
+
<g transform="matrix(1.02071,0,0,1.04641,-38.8586,-763.331)">
|
|
30
|
+
<path d="M393.702,1679.71C393.702,1660.56 377.767,1645.02 358.141,1645.02L287.019,1645.02C267.393,1645.02 251.458,1660.56 251.458,1679.71L251.458,1749.29C251.458,1768.44 267.393,1783.98 287.019,1783.98L358.141,1783.98C377.767,1783.98 393.702,1768.44 393.702,1749.29L393.702,1679.71Z" style="fill:rgb(255,115,115);"/>
|
|
31
|
+
<clipPath id="_clip1">
|
|
32
|
+
<path d="M393.702,1679.71C393.702,1660.56 377.767,1645.02 358.141,1645.02L287.019,1645.02C267.393,1645.02 251.458,1660.56 251.458,1679.71L251.458,1749.29C251.458,1768.44 267.393,1783.98 287.019,1783.98L358.141,1783.98C377.767,1783.98 393.702,1768.44 393.702,1749.29L393.702,1679.71Z"/>
|
|
33
|
+
</clipPath>
|
|
34
|
+
<g clip-path="url(#_clip1)">
|
|
35
|
+
<g transform="matrix(0.76313,0,0,0.744387,148.731,1102.32)">
|
|
36
|
+
<path d="M226.411,745.537L243.421,797.888L298.467,797.888L253.934,830.243L270.944,882.594L226.411,850.239L181.879,882.594L198.889,830.243L154.356,797.888L209.402,797.888L226.411,745.537Z" style="fill:white;"/>
|
|
37
|
+
</g>
|
|
38
|
+
</g>
|
|
39
|
+
</g>
|
|
40
|
+
<g transform="matrix(0.933678,0,0,1,8.6838,-241.981)">
|
|
41
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.617,1033.42 948.959,1033.42L424.841,1033.42C422.183,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.183,1065.77 424.841,1065.77L948.959,1065.77C951.617,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
42
|
+
</g>
|
|
43
|
+
<g transform="matrix(1,0,0,1,-19.173,-288.71)">
|
|
44
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.761,1033.42 949.279,1033.42L424.522,1033.42C422.04,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.04,1065.77 424.522,1065.77L949.279,1065.77C951.761,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
45
|
+
</g>
|
|
46
|
+
<g transform="matrix(0.844941,0,0,1,45.9556,-337.889)">
|
|
47
|
+
<path d="M953.776,1037.91C953.776,1035.43 951.391,1033.42 948.453,1033.42L425.347,1033.42C422.409,1033.42 420.025,1035.43 420.025,1037.91L420.025,1061.27C420.025,1063.75 422.409,1065.77 425.347,1065.77L948.453,1065.77C951.391,1065.77 953.776,1063.75 953.776,1061.27L953.776,1037.91Z" style="fill:rgb(187,196,198);fill-opacity:0.65;"/>
|
|
48
|
+
</g>
|
|
49
|
+
<g transform="matrix(1.02071,0,0,1.04641,-38.8586,-1035.65)">
|
|
50
|
+
<path d="M393.702,1679.71C393.702,1660.56 377.767,1645.02 358.141,1645.02L287.019,1645.02C267.393,1645.02 251.458,1660.56 251.458,1679.71L251.458,1749.29C251.458,1768.44 267.393,1783.98 287.019,1783.98L358.141,1783.98C377.767,1783.98 393.702,1768.44 393.702,1749.29L393.702,1679.71Z" style="fill:rgb(255,115,115);"/>
|
|
51
|
+
<clipPath id="_clip2">
|
|
52
|
+
<path d="M393.702,1679.71C393.702,1660.56 377.767,1645.02 358.141,1645.02L287.019,1645.02C267.393,1645.02 251.458,1660.56 251.458,1679.71L251.458,1749.29C251.458,1768.44 267.393,1783.98 287.019,1783.98L358.141,1783.98C377.767,1783.98 393.702,1768.44 393.702,1749.29L393.702,1679.71Z"/>
|
|
53
|
+
</clipPath>
|
|
54
|
+
<g clip-path="url(#_clip2)">
|
|
55
|
+
<g transform="matrix(0.979712,0,0,0.955649,69.3286,762.785)">
|
|
56
|
+
<text x="193.673px" y="1041.62px" style="font-family:'HelveticaNeue-Bold', 'Helvetica Neue';font-weight:700;font-size:128px;fill:white;">%</text>
|
|
57
|
+
</g>
|
|
58
|
+
</g>
|
|
59
|
+
</g>
|
|
60
|
+
</g>
|
|
61
|
+
</g>
|
|
62
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';var modalContent=css({width:'100%'}).toString();var container=css({backgroundColor:themeColors.lightOverlay,height:'100vh',textAlign:'center',padding:'30px',justifyContent:'center',display:'flex',flexDirection:'column'}).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({paddingTop:'30px',textAlign:'center',color:themeColors.gray}).toString();var image=css({width:'80%',maxWidth:400}).toString();var button=css({marginTop:'30px'}).toString();var buttonText=css({color:themeColors.gray}).toString();export default{modalContent:modalContent,container:container,item:item,title:title,link:link,image:image,button:button,buttonText:buttonText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as PushOptInModal}from"./PushOptInModal";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./optInTrigger";export*from"./optInModal";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var SHOW_PUSH_OPT_IN_MODAL='SHOW_PUSH_OPT_IN_MODAL';export var HIDE_PUSH_OPT_IN_MODAL='HIDE_PUSH_OPT_IN_MODAL';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var PUSH_OPT_IN_INCREASE_APP_START_COUNT='PUSH_OPT_IN_INCREASE_APP_START_COUNT';export var PUSH_OPT_IN_RESET_APP_START_COUNT='PUSH_OPT_IN_RESET_APP_START_COUNT';export var PUSH_OPT_IN_RESET_APP_START_STATE='PUSH_OPT_IN_RESET_APP_START_STATE';export var PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT='PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT';export var PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT='PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT';export var PUSH_OPT_IN_RESET_ORDERS_PLACED_STATE='PUSH_OPT_IN_RESET_ORDERS_PLACED_STATE';export var PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP='PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP';export var PUSH_OPT_IN_INCREASE_REJECTION_COUNT='PUSH_OPT_IN_INCREASE_REJECTION_COUNT';export var PUSH_OPT_IN_OPT_IN_POSTPONED='PUSH_OPT_IN_OPT_IN_POSTPONED';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{combineReducers}from'redux';import optInTrigger from"./optInTrigger";import optInModal from"./optInModal";export default combineReducers({optInTrigger:optInTrigger,optInModal:optInModal});
|
|
@@ -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_PUSH_OPT_IN_MODAL,SHOW_PUSH_OPT_IN_MODAL}from"../constants";var defaultState={isPushOptInModalVisible:false};/**
|
|
2
|
+
* Stores all the states related to the push Opt-In Modal functionality.
|
|
3
|
+
* @param {Object} [state] The current state.
|
|
4
|
+
* @param {Object} action The action object.
|
|
5
|
+
* @return {Object} The new state.
|
|
6
|
+
*/var pushOptInModalReducer=function pushOptInModalReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case SHOW_PUSH_OPT_IN_MODAL:{return _extends({},state,{isPushOptInModalVisible:true});}case HIDE_PUSH_OPT_IN_MODAL:{return _extends({},state,{isPushOptInModalVisible:false});}default:return state;}};export default pushOptInModalReducer;
|
|
@@ -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{PUSH_OPT_IN_INCREASE_APP_START_COUNT,PUSH_OPT_IN_RESET_APP_START_STATE,PUSH_OPT_IN_RESET_APP_START_COUNT,PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT,PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT,PUSH_OPT_IN_RESET_ORDERS_PLACED_STATE,PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP,PUSH_OPT_IN_INCREASE_REJECTION_COUNT}from"../constants";var defaultState={appStartCount:0,appStartResetCount:0,ordersPlacedCount:0,ordersPlacedResetCount:0,lastPopupAt:null,rejectionCount:0};/**
|
|
2
|
+
* Stores all the states related to the pushOptInTrigger functionality.
|
|
3
|
+
* @param {Object} [state] The current state.
|
|
4
|
+
* @param {Object} action The action object.
|
|
5
|
+
* @return {Object} The new state.
|
|
6
|
+
*/var pushOptInReducer=function pushOptInReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case PUSH_OPT_IN_INCREASE_APP_START_COUNT:{return _extends({},state,{appStartCount:state.appStartCount+1});}case PUSH_OPT_IN_RESET_APP_START_COUNT:{return _extends({},state,{appStartCount:0,appStartResetCount:state.appStartResetCount+1});}case PUSH_OPT_IN_RESET_APP_START_STATE:{return _extends({},state,{appStartCount:0,appStartResetCount:0});}case PUSH_OPT_IN_INCREASE_ORDERS_PLACED_COUNT:{return _extends({},state,{ordersPlacedCount:state.ordersPlacedCount+1});}case PUSH_OPT_IN_RESET_ORDERS_PLACED_COUNT:{return _extends({},state,{ordersPlacedCount:0,ordersPlacedResetCount:state.ordersPlacedResetCount+1});}case PUSH_OPT_IN_RESET_ORDERS_PLACED_STATE:{return _extends({},state,{ordersPlacedCount:0,ordersPlacedResetCount:0});}case PUSH_OPT_IN_SET_LAST_POPUP_TIMESTAMP:{return _extends({},state,{lastPopupAt:Date.now()});}case PUSH_OPT_IN_INCREASE_REJECTION_COUNT:{return _extends({},state,{rejectionCount:state.rejectionCount+1});}default:return state;}};export default pushOptInReducer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./optInTrigger";export*from"./optInModal";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{createSelector}from'reselect';/**
|
|
2
|
+
* Selects the push opt-in modal state.
|
|
3
|
+
* @param {Object} state The current state of the push opt-in modal.
|
|
4
|
+
* @returns {Object} whether push opt-in modal is shown.
|
|
5
|
+
*/export var getPushOptInModalState=function getPushOptInModalState(state){var _state$pushOptIn;return(state===null||state===void 0?void 0:(_state$pushOptIn=state.pushOptIn)===null||_state$pushOptIn===void 0?void 0:_state$pushOptIn.optInModal)||{};};/**
|
|
6
|
+
* Selects the property of the push opt-in modal.
|
|
7
|
+
* @returns {boolean} whether push opt-in modal is shown.
|
|
8
|
+
*/export var getIsPushOptInModalVisible=createSelector(getPushOptInModalState,function(modalState){return modalState.isPushOptInModalVisible||false;});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selects the push opt in information.
|
|
3
|
+
* @param {Object} state The current state.
|
|
4
|
+
* @returns {Object} The push opt in information.
|
|
5
|
+
*/export var getPushOptInTriggerState=function getPushOptInTriggerState(state){var _state$pushOptIn;return(state===null||state===void 0?void 0:(_state$pushOptIn=state.pushOptIn)===null||_state$pushOptIn===void 0?void 0:_state$pushOptIn.optInTrigger)||{};};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import optInTrigger from"./optInTrigger";export default(function(subscribe){optInTrigger(subscribe);});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_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$,event,appDidStart$,logger}from'@shopgate/engage/core';import{appSupportsPushOptIn}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{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;});/**
|
|
2
|
+
* Push opt in subscriptions
|
|
3
|
+
* @param {Function} subscribe The subscribe function
|
|
4
|
+
*/export default function pushOptIn(subscribe){/**
|
|
5
|
+
* @param {Object} subscriptionParams Params from the subscription callback
|
|
6
|
+
* @param {string} configKey The "pushOptIn" key to be used
|
|
7
|
+
* @param {Function} increaseCountAction Action to increase the count in Redux for the configKey
|
|
8
|
+
* @returns {void}
|
|
9
|
+
*/var showOptInAfterChecks=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2,configKey,increaseCountAction){var dispatch,getState,_appConfig$pushOptIn,appStarts,ordersPlaced,rejectionMaxCount,minDaysBetweenOptIns,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$pushOptIn=_appConfig$pushOptIn===void 0?{}:_appConfig$pushOptIn;appStarts=_appConfig$pushOptIn.appStarts,ordersPlaced=_appConfig$pushOptIn.ordersPlaced,rejectionMaxCount=_appConfig$pushOptIn.rejectionMaxCount,minDaysBetweenOptIns=_appConfig$pushOptIn.minDaysBetweenOptIns;// Deactivate feature when config is invalid
|
|
10
|
+
if(!(typeof minDaysBetweenOptIns!=='number'||typeof rejectionMaxCount!=='number'||_typeof(ordersPlaced)!=='object'||_typeof(appStarts)!=='object')){_context.next=9;break;}logger.error('PushOptInTrigger - Config invalid',appConfig===null||appConfig===void 0?void 0:appConfig.pushOptIn);return _context.abrupt("return");case 9:_context.next=11;return dispatch(requestAppPermissionStatus({permissionId:PERMISSION_ID_PUSH}));case 11:pushStatus=_context.sent;if(!(pushStatus!==PERMISSION_STATUS_NOT_DETERMINED)){_context.next=14;break;}return _context.abrupt("return");case 14: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=23;break;}return _context.abrupt("return");case 23: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 27: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
|
|
11
|
+
subscribe(appDidStart$,/*#__PURE__*/function(){var _ref5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4){var dispatch,getState;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:dispatch=_ref4.dispatch,getState=_ref4.getState;_context2.next=3;return showOptInAfterChecks({dispatch:dispatch,getState:getState},'appStarts',increaseAppStartCount);case 3:case"end":return _context2.stop();}}},_callee2);}));return function(_x4){return _ref5.apply(this,arguments);};}());// event subscriber to handle order based push opt in
|
|
12
|
+
subscribe(appDidStart$,function(_ref6){var dispatch=_ref6.dispatch,getState=_ref6.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(_ref8){var dispatch=_ref8.dispatch;dispatch(increaseRejectionCount());});}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from'react';import{shallow}from'enzyme';import LiveMessage from"../index";jest.mock("../../../../components",function(){return{I18n:{Text:function Translate(_ref){var string=_ref.string;return string;}}};});describe('<LiveMessage />',function(){var message='My Message';it('should render a polite simple message',function(){var ariaLive='polite';var wrapper=shallow(/*#__PURE__*/React.createElement(LiveMessage,{message:message}));expect(wrapper).toMatchSnapshot();expect(wrapper.find('div').prop('aria-live')).toBe(ariaLive);expect(wrapper.find('Translate').prop('string')).toBe(message);expect(wrapper.find('Translate').prop('params')).toEqual(null);});it('should render an assertive message with params ',function(){var ariaLive='assertive';var params={my:'param'};var wrapper=shallow(/*#__PURE__*/React.createElement(LiveMessage,{message:message,params:params,"aria-live":ariaLive}));expect(wrapper).toMatchSnapshot();expect(wrapper.find('div').prop('aria-live')).toBe(ariaLive);expect(wrapper.find('Translate').prop('string')).toBe(message);expect(wrapper.find('Translate').prop('params')).toEqual(params);});});
|
|
@@ -1 +0,0 @@
|
|
|
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{UIEvents}from"../../../../core";import{broadcastLiveMessage}from"../helpers";import{EVENT_LIVE_MESSAGE,LIVE_MESSAGE_TYPE_POLITE,LIVE_MESSAGE_TYPE_ASSERTIVE}from"../constants";jest.mock("../../../../core",function(){return{UIEvents:{emit:jest.fn()}};});jest.useFakeTimers();describe('LiveMessenger helpers',function(){beforeEach(function(){jest.clearAllMocks();});describe('broadcastLiveMessage()',function(){var message='My Message';var defaultOptions={type:LIVE_MESSAGE_TYPE_POLITE,params:null,id:null};it('should not broadcast without a message',function(){broadcastLiveMessage();jest.runAllTimers();expect(UIEvents.emit).not.toHaveBeenCalled();});it('should broadcast with default options',function(){broadcastLiveMessage(message);expect(UIEvents.emit).toHaveBeenCalledTimes(1);expect(UIEvents.emit).toHaveBeenCalledWith(EVENT_LIVE_MESSAGE,message,defaultOptions);jest.runAllTimers();expect(UIEvents.emit).toHaveBeenCalledTimes(2);expect(UIEvents.emit).toHaveBeenCalledWith(EVENT_LIVE_MESSAGE,'',defaultOptions);});it('should broadcast with some options',function(){var options={type:LIVE_MESSAGE_TYPE_ASSERTIVE,params:{some:'params'},id:'some-id'};broadcastLiveMessage(message,options);expect(UIEvents.emit).toHaveBeenCalledTimes(1);expect(UIEvents.emit).toHaveBeenCalledWith(EVENT_LIVE_MESSAGE,message,_extends({},options));jest.runAllTimers();expect(UIEvents.emit).toHaveBeenCalledTimes(2);expect(UIEvents.emit).toHaveBeenCalledWith(EVENT_LIVE_MESSAGE,'',_extends({},options));});});});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_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 from'react';import{act}from'react-dom/test-utils';import{mount}from'enzyme';import{UIEvents}from"../../../../core";import LiveMessage from"../../LiveMessage";import{EVENT_LIVE_MESSAGE,LIVE_MESSAGE_TYPE_ASSERTIVE,LIVE_MESSAGE_TYPE_POLITE}from"../constants";import LiveMessenger from"../index";jest.mock("../../../../components",function(){return{I18n:{Text:function Translate(_ref){var string=_ref.string;return string;}}};});jest.mock("../../../../core",function(){return{UIEvents:{addListener:jest.fn(),removeListener:jest.fn()}};});describe('<LiveMessenger />',function(){beforeEach(function(){jest.clearAllMocks();});it('should render',function(){var wrapper=mount(/*#__PURE__*/React.createElement(LiveMessenger,null));expect(wrapper).toMatchSnapshot();var liveMessages=wrapper.find(LiveMessage);expect(liveMessages).toHaveLength(2);expect(liveMessages.at(0).props()).toEqual({'aria-live':'assertive',message:'',params:null});expect(liveMessages.at(1).props()).toEqual({'aria-live':'polite',message:'',params:null});});it('should register and remove the events as expected',function(){var wrapper=mount(/*#__PURE__*/React.createElement(LiveMessenger,null));var _UIEvents$addListener=_slicedToArray(UIEvents.addListener.mock.calls,1),_UIEvents$addListener2=_slicedToArray(_UIEvents$addListener[0],2),callback=_UIEvents$addListener2[1];expect(UIEvents.addListener).toHaveBeenCalledTimes(1);expect(UIEvents.addListener).toHaveBeenCalledWith(EVENT_LIVE_MESSAGE,expect.any(Function));expect(UIEvents.removeListener).not.toHaveBeenCalled();wrapper.unmount();expect(UIEvents.addListener).toHaveBeenCalledTimes(1);expect(UIEvents.removeListener).toHaveBeenCalledTimes(1);expect(UIEvents.removeListener).toHaveBeenCalledWith(EVENT_LIVE_MESSAGE,callback);});it('should update the polite message by default when the event comes in',function(){var message='My Message';var options={params:{some:'param'}};var wrapper=mount(/*#__PURE__*/React.createElement(LiveMessenger,null));var _UIEvents$addListener3=_slicedToArray(UIEvents.addListener.mock.calls,1),_UIEvents$addListener4=_slicedToArray(_UIEvents$addListener3[0],2),callback=_UIEvents$addListener4[1];act(function(){callback(message,options);});wrapper.update();expect(wrapper.find(LiveMessage).at(1).props()).toEqual({'aria-live':'polite',params:options.params,message:message});});it('should update the polite message when the event comes in with the appropriate type',function(){var message='My Polite Message';var options={type:LIVE_MESSAGE_TYPE_POLITE,params:{some:'param'}};var wrapper=mount(/*#__PURE__*/React.createElement(LiveMessenger,null));var _UIEvents$addListener5=_slicedToArray(UIEvents.addListener.mock.calls,1),_UIEvents$addListener6=_slicedToArray(_UIEvents$addListener5[0],2),callback=_UIEvents$addListener6[1];act(function(){callback(message,options);});wrapper.update();expect(wrapper.find(LiveMessage).at(1).props()).toEqual({'aria-live':'polite',message:message,params:options.params});});it('should update the assertive message when the event comes in with the appropriate type',function(){var message='My Assertive Message';var options={type:LIVE_MESSAGE_TYPE_ASSERTIVE,params:{some:'param'}};var wrapper=mount(/*#__PURE__*/React.createElement(LiveMessenger,null));var _UIEvents$addListener7=_slicedToArray(UIEvents.addListener.mock.calls,1),_UIEvents$addListener8=_slicedToArray(_UIEvents$addListener7[0],2),callback=_UIEvents$addListener8[1];act(function(){callback(message,options);});wrapper.update();expect(wrapper.find(LiveMessage).at(0).props()).toEqual({'aria-live':'assertive',params:options.params,message:message});});it('should only update the message when it has the correct id',function(){var id='my-id';var message='My Message';var options={};var wrapper=mount(/*#__PURE__*/React.createElement(LiveMessenger,{id:id}));var _UIEvents$addListener9=_slicedToArray(UIEvents.addListener.mock.calls,1),_UIEvents$addListener10=_slicedToArray(_UIEvents$addListener9[0],2),callback=_UIEvents$addListener10[1];act(function(){callback(message,options);});wrapper.update();expect(wrapper.find(LiveMessage).at(1).props()).toEqual({'aria-live':'polite',params:null,message:''});act(function(){callback(message,{id:id});});wrapper.update();expect(wrapper.find(LiveMessage).at(1).props()).toEqual({'aria-live':'polite',params:null,message:message});});});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from'react';import{mount}from'enzyme';import Navigation from"../index";jest.mock("../../../../components",function(){return{I18n:{Text:function Translate(_ref){var string=_ref.string;return string;}},Link:function Link(_ref2){var children=_ref2.children;return children;}};});var mockTranslate=jest.fn(function(key){return key;});var mockRenderOptions={context:{i18n:function i18n(){return{__:mockTranslate};}}};var entries=[{title:'Title One',link:'/some-link'},{title:'Title Two',link:'/another-link'}];describe('<Navigation />',function(){it('should render with an aria label and entries',function(){var title='Navigation Title';var wrapper=mount(/*#__PURE__*/React.createElement(Navigation,{title:title,entries:entries}),mockRenderOptions);expect(wrapper).toMatchSnapshot();expect(wrapper.find('nav').prop('aria-label')).toEqual(title);expect(wrapper.find('ul').children()).toHaveLength(2);});it('should render empty when no entries are passed',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Navigation,null),mockRenderOptions);expect(wrapper).toMatchSnapshot();expect(wrapper.isEmptyRender()).toBe(true);});});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from'react';import{mount}from'enzyme';import Section from"../index";var mockTranslate=jest.fn();jest.mock("../../../../components",function(){return{I18n:{Text:function Translate(props){mockTranslate(props);return props.string;}}};});var title='my.headline';var titleParams={some:'params'};describe('<Section />',function(){beforeEach(function(){jest.clearAllMocks();});it('should render with a label',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Section,{title:title,titleParams:titleParams},/*#__PURE__*/React.createElement("div",{id:"child-component"})));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h2').exists()).toBe(true);expect(mockTranslate).toHaveBeenCalledWith({string:title,params:titleParams});});it('should render hidden when no children rendered',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Section,{title:title}));expect(wrapper).toMatchSnapshot();expect(wrapper.find('h2').exists()).toBe(false);expect(mockTranslate).toHaveBeenCalledTimes(0);});describe('MutationObserver',function(){var wrapper;beforeEach(function(){wrapper=mount(/*#__PURE__*/React.createElement(Section,{title:title}));});it('should create an observer instance',function(){expect(global.mutationConstructorSpy).toHaveBeenCalledTimes(1);expect(global.mutationConstructorSpy).toHaveBeenCalledWith(expect.any(Function));});it('should observe with the correct initialization',function(){expect(global.mutationObserveSpy).toHaveBeenCalledTimes(1);expect(global.mutationObserveSpy).toHaveBeenCalledWith(wrapper.find('section').instance(),{childList:true});});it('should call disconnect on unmount',function(){wrapper.unmount();expect(global.mutationDisconnectSpy).toHaveBeenCalledTimes(1);});});});
|
package/a11y/index.spec.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import*as a11y from'.';describe('engage > a11y',function(){it('should have exports',function(){expect(_typeof(a11y)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(a11y).forEach(function(exportKey){expect(typeof a11y[exportKey]!=='undefined').toBe(true);});});});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{connect}from'react-redux';import{addBackInStockSubscription}from'@shopgate/engage/back-in-stock/actions';import{makeGetSubscriptionByProduct}from'@shopgate/engage/back-in-stock/selectors';/**
|
|
2
|
-
* @return {Object} The extended component props.
|
|
3
|
-
*/var makeMapStateToProps=function makeMapStateToProps(){var getSubscriptionByProduct=makeGetSubscriptionByProduct();return function(state,props){return{subscription:getSubscriptionByProduct(state,props)};};};var mapDispatchToProps={addBackInStockSubscription:addBackInStockSubscription};export default connect(makeMapStateToProps,mapDispatchToProps);
|