@shopgate/pwa-common 6.18.0-beta.4 → 6.18.0

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.
@@ -1,4 +1,4 @@
1
- var _PAGE_INSETS_ANDROID,_extends3;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 _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;}export var OS_ALL='all';export var OS_ANDROID='android';export var OS_IOS='ios';export var TYPE_PHONE='phone';export var MODEL_NAMES_IPHONE_X=['iPhone10,3','iPhone10,6','iPhone11,2','iPhone11,4','iPhone11,6','iPhone11,8'];/**
1
+ var _PAGE_INSETS_ANDROID,_extends3;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 _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;}export var OS_ALL='all';export var OS_ANDROID='android';export var OS_IOS='ios';export var TYPE_PHONE='phone';export var TYPE_TABLET='tablet';export var MODEL_NAMES_IPHONE_X=['iPhone10,3','iPhone10,6','iPhone11,2','iPhone11,4','iPhone11,6','iPhone11,8'];/**
2
2
  * Page insets are device screen areas which can't be used to display content. Those come especially
3
3
  * relevant on iOS devices with their status bar ot the iPhone notch at the top of the screen.
4
4
  */export var PAGE_INSET_NAME_TOP='safeAreaInsetTop';export var PAGE_INSET_NAME_BOTTOM='safeAreaInsetBottom';export var PAGE_INSET_NAME_LEFT='safeAreaInsetLeft';export var PAGE_INSET_NAME_RIGHT='safeAreaInsetRight';export var PAGE_INSETS_ANDROID=(_PAGE_INSETS_ANDROID={},_defineProperty(_PAGE_INSETS_ANDROID,PAGE_INSET_NAME_TOP,0),_defineProperty(_PAGE_INSETS_ANDROID,PAGE_INSET_NAME_BOTTOM,0),_defineProperty(_PAGE_INSETS_ANDROID,PAGE_INSET_NAME_LEFT,0),_defineProperty(_PAGE_INSETS_ANDROID,PAGE_INSET_NAME_RIGHT,0),_PAGE_INSETS_ANDROID);export var PAGE_INSETS_IOS=_extends({},PAGE_INSETS_ANDROID,_defineProperty({},PAGE_INSET_NAME_TOP,20));export var PAGE_INSETS_IPHONE_X=_extends({},PAGE_INSETS_IOS,(_extends3={},_defineProperty(_extends3,PAGE_INSET_NAME_TOP,44),_defineProperty(_extends3,PAGE_INSET_NAME_BOTTOM,30),_extends3));
@@ -1,7 +1,7 @@
1
1
  function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import pck from"../../package";import{buildThemeConfig}from"./theme";import{assignObjectDeep}from"../data";import{isObject}from"../validation";/**
2
2
  * Provides a default app config as a fallback.
3
3
  * @mixin AppConfig
4
- */var defaultAppConfig={appId:'shop_30177',browserConnector:false,colors:{},forgotPasswordUrl:null,hasFavorites:false,hasReviews:true,showWriteReview:true,language:'en-us',logo:'https://example.com/logo',marketId:'US',publicPath:'https://example.com/public',shopName:'Shopgate Connect',webCheckoutShopify:null,hasNoScanner:false,apiUrl:'https://shop_30177.dev.connect.shopgate.com/',shopCNAME:null,currency:'USD',showGmdMenuSubHeaders:false,benchmark:false,sentry:{},theme:{},cartShippingHideAnonymousLegacy:null,cartShippingTextAnonymousLegacy:null,variantSelectionMode:null,product:{variantPreselect:false},cart:{},scanner:{},tracking:{hasWebTrackingEngage:false},webTrackingEngage:{android:'',ios:''}};/**
4
+ */var defaultAppConfig={appId:'shop_30177',browserConnector:false,colors:{},forgotPasswordUrl:null,hasFavorites:false,hasReviews:true,showWriteReview:true,language:'en-us',logo:'https://example.com/logo',marketId:'US',publicPath:'https://example.com/public',shopName:'Shopgate Connect',webCheckoutShopify:null,hasNoScanner:false,apiUrl:'https://shop_30177.dev.connect.shopgate.com/',shopCNAME:null,currency:'USD',showGmdMenuSubHeaders:false,benchmark:false,sentry:{},theme:{},cartShippingHideAnonymousLegacy:null,cartShippingTextAnonymousLegacy:null,variantSelectionMode:null,product:{variantPreselect:false},cart:{},scanner:{},tracking:{hasWebTrackingEngage:false,useSkuAsProductId:false},webTrackingEngage:{android:'',ios:''}};/**
5
5
  * @type {string} package version from package.json
6
6
  */export var pckVersion=pck.version;/**
7
7
  * Provides a default components config as a fallback.
@@ -1,4 +1,4 @@
1
- import{isObject}from"../validation";/**
1
+ import noop from'lodash/noop';import{isObject}from"../validation";/**
2
2
  * @typedef {Object} MutableFunction
3
3
  * @property {Function} replace Replaces the original functionality with a custom function.
4
4
  * @property {Function} restore Restores the original function.
@@ -38,7 +38,8 @@ if(res.action===BEFORE_ACTION_NEXT){if(res.args&&res.args.length>0){res=res.args
38
38
  if(res.action===BEFORE_ACTION_SKIP_REST){arr.splice(-(arr.length-i));if(res.args&&res.args.length>0){res=res.args;}else{res=args;}}// Check if the step requested to stop any further processing including the action itself
39
39
  if(res.action===BEFORE_ACTION_STOP){// Cut off all following step functions including the mutable func
40
40
  arr.splice(-(arr.length-i));runAction=false;res=res.args;}// Replace arguments for the next step to get.
41
- return res;},args);}if(!runAction){return mutatedArgs;}// Call the actual mutable
41
+ return res;},args);}if(!runAction){// the return value here gets passed to the dispatch() so it must be a function or action obj
42
+ return noop;}// Call the actual mutable
42
43
  return current.apply(void 0,mutatedArgs);}/**
43
44
  * Replaces the original functionality with a custom function.
44
45
  * @param {Function} customFunc The function to execute instead of the original one.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-common",
3
- "version": "6.18.0-beta.4",
3
+ "version": "6.18.0",
4
4
  "description": "Common library for the Shopgate Connect PWA.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "@sentry/browser": "^4.6.3",
19
- "@shopgate/pwa-benchmark": "6.18.0-beta.4",
19
+ "@shopgate/pwa-benchmark": "6.18.0",
20
20
  "@virtuous/conductor": "~2.4.0",
21
21
  "@virtuous/react-conductor": "~2.4.0",
22
22
  "@virtuous/redux-persister": "1.1.0-beta.7",
@@ -44,7 +44,7 @@
44
44
  "url-search-params": "^0.10.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@shopgate/pwa-core": "6.18.0-beta.4",
47
+ "@shopgate/pwa-core": "6.18.0",
48
48
  "lodash": "^4.17.4",
49
49
  "prop-types": "~15.7.2",
50
50
  "react": "~16.12.0",
@@ -1,4 +1,4 @@
1
- import{createSelector}from'reselect';import{hasSGJavaScriptBridge}from'@shopgate/pwa-core/helpers';import{isVersionAtLeast}from'@shopgate/pwa-core/helpers/version';import{SCANNER_MIN_APP_LIB_VERSION}from'@shopgate/pwa-core/constants/Scanner';import{OS_ANDROID,OS_IOS,MODEL_NAMES_IPHONE_X,PAGE_INSETS_ANDROID,PAGE_INSETS_IOS,PAGE_INSETS_IPHONE_X}from"../constants/Device";/**
1
+ import{createSelector}from'reselect';import{hasSGJavaScriptBridge}from'@shopgate/pwa-core/helpers';import{isVersionAtLeast}from'@shopgate/pwa-core/helpers/version';import{SCANNER_MIN_APP_LIB_VERSION}from'@shopgate/pwa-core/constants/Scanner';import{OS_ANDROID,OS_IOS,MODEL_NAMES_IPHONE_X,PAGE_INSETS_ANDROID,PAGE_INSETS_IOS,PAGE_INSETS_IPHONE_X,TYPE_TABLET}from"../constants/Device";/**
2
2
  * Returns the client state (state.client)
3
3
  * @param {Object} state The application state.
4
4
  * @returns {Object}
@@ -22,10 +22,6 @@ import{createSelector}from'reselect';import{hasSGJavaScriptBridge}from'@shopgate
22
22
  * @param {string} service The identity service to check.
23
23
  * @returns {Function}
24
24
  */export function makeSupportsIdentityService(service){var getSupportedIdentityServices=makeGetSupportedIdentityServices();return createSelector(getSupportedIdentityServices,function(services){return services.includes(service);});}/**
25
- * Checks if the currently stored lib version is one that supports the scanner.
26
- * @param {Object} state The application state.
27
- * @returns {boolean}
28
- */export var hasScannerSupport=createSelector(getClientInformation,function(clientInformation){return isVersionAtLeast(SCANNER_MIN_APP_LIB_VERSION,clientInformation.libVersion);});/**
29
25
  * Returns the device platform.
30
26
  * @param {Object} state The application state.
31
27
  * @return {string|null}
@@ -45,6 +41,11 @@ import{createSelector}from'reselect';import{hasSGJavaScriptBridge}from'@shopgate
45
41
  * @param {Object} state The application state.
46
42
  * @return {boolean}
47
43
  */export var isIos=createSelector(getPlatform,function(platform){return platform===OS_IOS;});/**
44
+ * Checks if the currently stored lib version is one that supports the scanner.
45
+ * @param {Object} state The application state.
46
+ * @returns {boolean}
47
+ */export var hasScannerSupport=createSelector(getClientInformation,getDeviceInformation,isIos,function(clientInformation,deviceInformation,deviceIsIos){// scanner is not supported on ipads
48
+ var type=deviceInformation.type;var isIpad=type===TYPE_TABLET&&deviceIsIos;return isVersionAtLeast(SCANNER_MIN_APP_LIB_VERSION,clientInformation.libVersion)&&!isIpad;});/**
48
49
  * Determines page insets for the current device
49
50
  * @param {Object} state The application state.
50
51
  * @returns {Object}