@shopgate/pwa-core 7.30.0-alpha.6 → 7.30.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/classes/AppCommand/index.js +115 -11
  2. package/classes/AppCommand/spec.js +260 -6
  3. package/classes/AppCommandRequest/index.js +129 -20
  4. package/classes/AppPermissionsRequest/AppPermissionsRequest.js +45 -7
  5. package/classes/AppPermissionsRequest/GetAppPermissionsRequest.js +48 -9
  6. package/classes/AppPermissionsRequest/RequestAppPermissionsRequest.js +54 -9
  7. package/classes/Bridge/index.js +34 -4
  8. package/classes/Bridge/spec.js +24 -1
  9. package/classes/BrightnessRequest/index.js +59 -10
  10. package/classes/BrightnessRequest/spec.js +111 -6
  11. package/classes/BrowserConnector/index.js +180 -26
  12. package/classes/Conditioner/index.js +74 -8
  13. package/classes/Conditioner/spec.js +75 -1
  14. package/classes/DataRequest/index.js +116 -13
  15. package/classes/DevServerBridge/index.js +86 -9
  16. package/classes/DevServerBridge/spec.js +231 -14
  17. package/classes/ErrorManager/index.js +144 -20
  18. package/classes/ErrorManager/spec.js +244 -2
  19. package/classes/Event/index.js +101 -15
  20. package/classes/HttpRequest/index.js +182 -21
  21. package/classes/PipelineDependencies/index.js +42 -6
  22. package/classes/PipelineDependencies/spec.js +46 -3
  23. package/classes/PipelineManager/index.js +517 -71
  24. package/classes/PipelineManager/spec.js +733 -15
  25. package/classes/PipelineRequest/index.js +167 -19
  26. package/classes/PipelineRequest/mock.js +118 -21
  27. package/classes/PipelineRequest/spec.js +333 -2
  28. package/classes/PipelineSequence/index.js +34 -6
  29. package/classes/Request/index.js +61 -13
  30. package/classes/RequestBuffer/index.js +43 -6
  31. package/classes/RequestManager/index.js +216 -33
  32. package/classes/RequestManager/spec.js +188 -1
  33. package/classes/Scanner/index.js +246 -67
  34. package/classes/ScannerEvent/index.js +23 -9
  35. package/classes/ScannerEventHandler/index.js +39 -16
  36. package/classes/ScannerEventListener/index.js +84 -24
  37. package/classes/ScannerManager/ScanProcessingError.js +11 -3
  38. package/classes/ScannerManager/index.js +133 -21
  39. package/classes/WebStorageRequest/index.js +76 -9
  40. package/commands/analyticsSetCustomValues.js +8 -2
  41. package/commands/appPermissions.js +10 -3
  42. package/commands/brightness.js +33 -5
  43. package/commands/broadcastEvent.js +8 -2
  44. package/commands/cleanTab.js +11 -3
  45. package/commands/closeInAppBrowser.js +22 -2
  46. package/commands/flushTab.js +8 -2
  47. package/commands/getWebStorageEntry.js +11 -2
  48. package/commands/hideMenuBar.js +8 -2
  49. package/commands/hideNavigationBar.js +8 -2
  50. package/commands/hideSplashScreen.js +8 -2
  51. package/commands/onload.js +13 -3
  52. package/commands/openAppSettings.js +8 -2
  53. package/commands/openPage.js +8 -2
  54. package/commands/openPageExtern.js +8 -2
  55. package/commands/performCommandsAfterDelay.js +11 -3
  56. package/commands/plotProjects.js +65 -7
  57. package/commands/popTabToRoot.js +11 -3
  58. package/commands/registerEvents.js +10 -2
  59. package/commands/scanner.js +76 -7
  60. package/commands/setCookie.js +8 -2
  61. package/commands/setDebugLoggingEnabled.js +8 -2
  62. package/commands/setScrollingEnabled.js +7 -2
  63. package/commands/setWebStorageEntry.js +8 -2
  64. package/commands/shareItem.js +18 -2
  65. package/commands/showNavigationBar.js +8 -2
  66. package/commands/showTab.js +13 -2
  67. package/commands/unifiedTracking.js +128 -30
  68. package/constants/AppCommands.js +6 -1
  69. package/constants/AppEvents.js +9 -1
  70. package/constants/AppPermissions.js +57 -13
  71. package/constants/Command.js +1 -1
  72. package/constants/ErrorHandleTypes.js +2 -1
  73. package/constants/ErrorManager.js +15 -1
  74. package/constants/Pipeline.js +52 -17
  75. package/constants/ProcessTypes.js +3 -1
  76. package/constants/RequestManagerModes.js +19 -7
  77. package/constants/RequestTypes.js +2 -1
  78. package/constants/Scanner.js +39 -10
  79. package/constants/Trilean.js +6 -1
  80. package/emitters/ui.js +2 -1
  81. package/helpers/index.js +66 -8
  82. package/helpers/logGroup.js +56 -8
  83. package/helpers/version.js +216 -22
  84. package/index.js +60 -5
  85. package/package.json +1 -1
@@ -1,71 +1,265 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";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 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 _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}import MobileDetect from'mobile-detect';import detector from'detector';import{logger,hasSGJavaScriptBridge}from"./index";import getWebStorageEntry from"../commands/getWebStorageEntry";var MODE_AT_MOST='at_most';var MODE_AT_LEAST='at_least';export var PLATFORM_ANDROID='android';export var PLATFORM_IOS='ios';export var MIN_ANDROID_LIB_VERSION='13.0';var versions=null;var requesting=false;var md=new MobileDetect(navigator.userAgent);export var isAndroidOs=md.is('AndroidOS');export var isIOs=md.is('iOS');var fullVersion=_typeof(detector)==='object'&&detector.os?detector.os.fullVersion:null;// Eslint doesn't allow to use one liner here.
2
- var model=null;if(fullVersion){model=isAndroidOs?'Android':"iPhone".concat(fullVersion);}export var defaultClientInformation={libVersion:'21.0',appVersion:'5.18.0',codebaseVersion:'5.18.0',type:!md.tablet()?'phone':'tablet',device:{type:!md.tablet()?'phone':'tablet',os:{platform:isAndroidOs?PLATFORM_ANDROID:PLATFORM_IOS,ver:fullVersion},model:model},supportedAnalyticsServices:[]};/**
1
+ import MobileDetect from 'mobile-detect';
2
+ import detector from 'detector';
3
+ import { logger, hasSGJavaScriptBridge } from "./index";
4
+ import getWebStorageEntry from "../commands/getWebStorageEntry";
5
+ const MODE_AT_MOST = 'at_most';
6
+ const MODE_AT_LEAST = 'at_least';
7
+ export const PLATFORM_ANDROID = 'android';
8
+ export const PLATFORM_IOS = 'ios';
9
+ export const MIN_ANDROID_LIB_VERSION = '13.0';
10
+ let versions = null;
11
+ let requesting = false;
12
+ const md = new MobileDetect(navigator.userAgent);
13
+ export const isAndroidOs = md.is('AndroidOS');
14
+ export const isIOs = md.is('iOS');
15
+ const fullVersion = typeof detector === 'object' && detector.os ? detector.os.fullVersion : null;
16
+
17
+ // Eslint doesn't allow to use one liner here.
18
+ let model = null;
19
+ if (fullVersion) {
20
+ model = isAndroidOs ? 'Android' : `iPhone${fullVersion}`;
21
+ }
22
+ export const defaultClientInformation = {
23
+ libVersion: '21.0',
24
+ appVersion: '5.18.0',
25
+ codebaseVersion: '5.18.0',
26
+ type: !md.tablet() ? 'phone' : 'tablet',
27
+ device: {
28
+ type: !md.tablet() ? 'phone' : 'tablet',
29
+ os: {
30
+ platform: isAndroidOs ? PLATFORM_ANDROID : PLATFORM_IOS,
31
+ ver: fullVersion
32
+ },
33
+ model
34
+ },
35
+ supportedAnalyticsServices: []
36
+ };
37
+
38
+ /**
3
39
  * Waits till a passed handler function returns TRUE and resolves.
4
40
  * @param {Function} handler Handler function which checks a condition to resolve.
5
41
  * @return {Promise}
6
- */var wait=function wait(handler){return new Promise(function(resolve){/**
42
+ */
43
+ const wait = handler => new Promise(resolve => {
44
+ /**
7
45
  * Checks the request state.
8
- */var check=function check(){if(handler()===true){resolve();}else{setTimeout(check,20);}};check();});};/**
46
+ */
47
+ const check = () => {
48
+ if (handler() === true) {
49
+ resolve();
50
+ } else {
51
+ setTimeout(check, 20);
52
+ }
53
+ };
54
+ check();
55
+ });
56
+
57
+ /**
9
58
  * Splits a version string into it's segments.
10
59
  * @param {string} input The string to parse.
11
60
  * @return {Array}
12
- */var parseVersionSegments=function parseVersionSegments(input){if(typeof input!=='string'){return[Number.NaN];}return input.trim().split('.').map(function(segment){return parseInt(segment,10);});};/**
61
+ */
62
+ const parseVersionSegments = input => {
63
+ if (typeof input !== 'string') {
64
+ return [Number.NaN];
65
+ }
66
+ return input.trim().split('.').map(segment => parseInt(segment, 10));
67
+ };
68
+
69
+ /**
13
70
  * Validates version segments.
14
71
  * @param {Array} segments The segments array.
15
72
  * @return {boolean}
16
- */var validateVersionSegments=function validateVersionSegments(segments){return segments.filter(function(entry){return Number.isNaN(entry);}).length===0;};/**
73
+ */
74
+ const validateVersionSegments = segments => segments.filter(entry => Number.isNaN(entry)).length === 0;
75
+
76
+ /**
17
77
  * Checks if a required version matches a current version.
18
78
  * @param {string} mode The mode for the check.
19
79
  * @param {string} requiredVersion The required version - 17[|17.0|17.0.0].
20
80
  * @param {string} currentVersion The current version (same pattern).
21
81
  * @return {boolean}
22
- */var check=function check(mode){var requiredVersion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'';var currentVersion=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';var parsedCurrent=parseVersionSegments(currentVersion);var parsedRequired=parseVersionSegments(requiredVersion);if(!validateVersionSegments(parsedCurrent)||!validateVersionSegments(parsedRequired)){logger.error("Error parsing version strings (current: ".concat(currentVersion," | required: ").concat(requiredVersion,")"));return false;}var _parsedRequired=_slicedToArray(parsedRequired,3),requiredMajor=_parsedRequired[0],_parsedRequired$=_parsedRequired[1],requiredMinor=_parsedRequired$===void 0?0:_parsedRequired$,_parsedRequired$2=_parsedRequired[2],requiredMicro=_parsedRequired$2===void 0?0:_parsedRequired$2;var _parsedCurrent=_slicedToArray(parsedCurrent,3),currentMajor=_parsedCurrent[0],_parsedCurrent$=_parsedCurrent[1],currentMinor=_parsedCurrent$===void 0?0:_parsedCurrent$,_parsedCurrent$2=_parsedCurrent[2],currentMicro=_parsedCurrent$2===void 0?0:_parsedCurrent$2;if(mode===MODE_AT_LEAST){if(currentMajor!==requiredMajor){return currentMajor>requiredMajor;}if(currentMinor!==requiredMinor){return currentMinor>requiredMinor;}return currentMicro>=requiredMicro;}// MODE_AT_MOST - no extra branch necessary, since it's just an internal function right now.
23
- if(currentMajor!==requiredMajor){return currentMajor<requiredMajor;}if(currentMinor!==requiredMinor){return currentMinor<requiredMinor;}return currentMicro<=requiredMicro;};/** @returns {string} */export var getUserAgent=function getUserAgent(){return navigator.userAgent;};/**
82
+ */
83
+ const check = (mode, requiredVersion = '', currentVersion = '') => {
84
+ const parsedCurrent = parseVersionSegments(currentVersion);
85
+ const parsedRequired = parseVersionSegments(requiredVersion);
86
+ if (!validateVersionSegments(parsedCurrent) || !validateVersionSegments(parsedRequired)) {
87
+ logger.error(`Error parsing version strings (current: ${currentVersion} | required: ${requiredVersion})`);
88
+ return false;
89
+ }
90
+ const [requiredMajor, requiredMinor = 0, requiredMicro = 0] = parsedRequired;
91
+ const [currentMajor, currentMinor = 0, currentMicro = 0] = parsedCurrent;
92
+ if (mode === MODE_AT_LEAST) {
93
+ if (currentMajor !== requiredMajor) {
94
+ return currentMajor > requiredMajor;
95
+ }
96
+ if (currentMinor !== requiredMinor) {
97
+ return currentMinor > requiredMinor;
98
+ }
99
+ return currentMicro >= requiredMicro;
100
+ }
101
+
102
+ // MODE_AT_MOST - no extra branch necessary, since it's just an internal function right now.
103
+ if (currentMajor !== requiredMajor) {
104
+ return currentMajor < requiredMajor;
105
+ }
106
+ if (currentMinor !== requiredMinor) {
107
+ return currentMinor < requiredMinor;
108
+ }
109
+ return currentMicro <= requiredMicro;
110
+ };
111
+
112
+ /** @returns {string} */
113
+ export const getUserAgent = () => navigator.userAgent;
114
+
115
+ /**
24
116
  * Checks if a version string is valid.
25
117
  * @param {string} input The string to check - 17[|17.0|17.0.0].
26
118
  * @return {boolean}
27
- */export var isValidVersion=function isValidVersion(input){return validateVersionSegments(parseVersionSegments(input));};/**
119
+ */
120
+ export const isValidVersion = input => validateVersionSegments(parseVersionSegments(input));
121
+
122
+ /**
28
123
  * Checks if a required version matches at least a current version.
29
124
  * @param {string} requiredVersion The required version - 17[|17.0|17.0.0].
30
125
  * @param {string} currentVersion The current version (same pattern).
31
126
  * @return {boolean}
32
- */export var isVersionAtLeast=function isVersionAtLeast(requiredVersion,currentVersion){return check(MODE_AT_LEAST,requiredVersion,currentVersion);};/**
127
+ */
128
+ export const isVersionAtLeast = (requiredVersion, currentVersion) => check(MODE_AT_LEAST, requiredVersion, currentVersion);
129
+
130
+ /**
33
131
  * Checks if a required version matches at most a current version.
34
132
  * @param {string} requiredVersion The required version - 17[|17.0|17.0.0].
35
133
  * @param {string} currentVersion The current (same pattern).
36
134
  * @return {boolean}
37
- */export var isVersionAtMost=function isVersionAtMost(requiredVersion,currentVersion){return check(MODE_AT_MOST,requiredVersion,currentVersion);};/**
135
+ */
136
+ export const isVersionAtMost = (requiredVersion, currentVersion) => check(MODE_AT_MOST, requiredVersion, currentVersion);
137
+
138
+ /**
38
139
  * Checks if a required version is equal to a current version.
39
140
  * @param {string} requiredVersion The required version - 17[|17.0|17.0.0].
40
141
  * @param {string} currentVersion The current (same pattern).
41
142
  * @return {boolean}
42
- */export var isVersion=function isVersion(requiredVersion,currentVersion){return isVersionAtLeast(requiredVersion,currentVersion)===true&&isVersionAtMost(requiredVersion,currentVersion)===true;};/**
143
+ */
144
+ export const isVersion = (requiredVersion, currentVersion) => isVersionAtLeast(requiredVersion, currentVersion) === true && isVersionAtMost(requiredVersion, currentVersion) === true;
145
+
146
+ /**
43
147
  * Fetches versions from the client information webStorage entry.
44
148
  * @return {Promise}
45
- */var getVersionsFromClientInformation=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var isIdle,clientInformation,libVersion,_clientInformation$va,appVersion,codebaseVersion,device,_ref2,_ref2$os,_ref2$os2,_ref2$os2$platform,platform;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:/**
149
+ */
150
+ const getVersionsFromClientInformation = async () => {
151
+ /**
46
152
  * Checks if currently no request is ongoing.
47
153
  * @return {boolean}
48
- */isIdle=function isIdle(){return requesting===false;};if(isIdle()){_context.next=4;break;}_context.next=4;return wait(isIdle);case 4:if(!(versions!==null)){_context.next=6;break;}return _context.abrupt("return",versions);case 6:requesting=true;if(hasSGJavaScriptBridge()){_context.next=11;break;}clientInformation={value:_extends({},defaultClientInformation)};_context.next=14;break;case 11:_context.next=13;return getWebStorageEntry({name:'clientInformation'});case 13:clientInformation=_context.sent;case 14:// Grab all relevant data from the client information.
49
- libVersion=clientInformation.value.libVersion;_clientInformation$va=clientInformation.value,appVersion=_clientInformation$va.appVersion,codebaseVersion=_clientInformation$va.codebaseVersion,device=_clientInformation$va.device;/* istanbul ignore next */_ref2=device||{},_ref2$os=_ref2.os,_ref2$os2=_ref2$os===void 0?{}:_ref2$os,_ref2$os2$platform=_ref2$os2.platform,platform=_ref2$os2$platform===void 0?null:_ref2$os2$platform;/**
154
+ */
155
+ const isIdle = () => requesting === false;
156
+ if (!isIdle()) {
157
+ // Wait until the request finished before proceed.
158
+ await wait(isIdle);
159
+ }
160
+ // If a version object is already present, the request can be skipped.
161
+ if (versions !== null) {
162
+ return versions;
163
+ }
164
+ requesting = true;
165
+ let clientInformation;
166
+
167
+ // Fetch the client information.
168
+ if (!hasSGJavaScriptBridge()) {
169
+ clientInformation = {
170
+ value: {
171
+ ...defaultClientInformation
172
+ }
173
+ };
174
+ } else {
175
+ clientInformation = await getWebStorageEntry({
176
+ name: 'clientInformation'
177
+ });
178
+ }
179
+
180
+ // Grab all relevant data from the client information.
181
+ let {
182
+ libVersion
183
+ } = clientInformation.value;
184
+ const {
185
+ appVersion,
186
+ codebaseVersion,
187
+ device
188
+ } = clientInformation.value;
189
+ /* istanbul ignore next */
190
+ const {
191
+ os: {
192
+ platform = null
193
+ } = {}
194
+ } = device || {};
195
+ /**
50
196
  * Older Android app versions didn't handle the libVersion within the client information like the
51
197
  * iOS apps. Those apps usually send a version 2.0. But since they also support most of the PWA
52
198
  * related commands, the lib version is corrected here to improve handling within the code.
53
- */if(platform===PLATFORM_ANDROID&&!isVersionAtLeast('9.0',libVersion)){libVersion=MIN_ANDROID_LIB_VERSION;}// Update the version cache.
54
- versions={libVersion:libVersion,appVersion:appVersion,codebaseVersion:codebaseVersion};requesting=false;return _context.abrupt("return",versions);case 21:case"end":return _context.stop();}},_callee);}));return function getVersionsFromClientInformation(){return _ref.apply(this,arguments);};}();/**
199
+ */
200
+ if (platform === PLATFORM_ANDROID && !isVersionAtLeast('9.0', libVersion)) {
201
+ libVersion = MIN_ANDROID_LIB_VERSION;
202
+ }
203
+ // Update the version cache.
204
+ versions = {
205
+ libVersion,
206
+ appVersion,
207
+ codebaseVersion
208
+ };
209
+ requesting = false;
210
+ return versions;
211
+ };
212
+
213
+ /**
55
214
  * Clears the local versions cache
56
- */export var clearVersionCache=function clearVersionCache(){versions=null;};/**
215
+ */
216
+ export const clearVersionCache = () => {
217
+ versions = null;
218
+ };
219
+
220
+ /**
57
221
  * Checks if a required version matches at least the current lib version.
58
222
  * @param {string} requiredVersion The required version - 17[|17.0|17.0.0].
59
223
  * @return {Promise}
60
- */export var isLibVersionAtLeast=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(requiredVersion){var _ref4,libVersion;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return getVersionsFromClientInformation();case 2:_ref4=_context2.sent;libVersion=_ref4.libVersion;return _context2.abrupt("return",isVersionAtLeast(requiredVersion,libVersion));case 5:case"end":return _context2.stop();}},_callee2);}));return function isLibVersionAtLeast(_x){return _ref3.apply(this,arguments);};}();/**
224
+ */
225
+ export const isLibVersionAtLeast = async requiredVersion => {
226
+ const {
227
+ libVersion
228
+ } = await getVersionsFromClientInformation();
229
+ return isVersionAtLeast(requiredVersion, libVersion);
230
+ };
231
+
232
+ /**
61
233
  * Checks if a required version matches at most the current lib version.
62
234
  * @param {string} requiredVersion The required version - 17[|17.0|17.0.0].
63
235
  * @return {Promise}
64
- */export var isLibVersionAtMost=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(requiredVersion){var _ref6,libVersion;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return getVersionsFromClientInformation();case 2:_ref6=_context3.sent;libVersion=_ref6.libVersion;return _context3.abrupt("return",isVersionAtMost(requiredVersion,libVersion));case 5:case"end":return _context3.stop();}},_callee3);}));return function isLibVersionAtMost(_x2){return _ref5.apply(this,arguments);};}();/**
236
+ */
237
+ export const isLibVersionAtMost = async requiredVersion => {
238
+ const {
239
+ libVersion
240
+ } = await getVersionsFromClientInformation();
241
+ return isVersionAtMost(requiredVersion, libVersion);
242
+ };
243
+
244
+ /**
65
245
  * Checks if a required version matches the current lib version.
66
246
  * @param {string} requiredVersion The required version - 17[|17.0|17.0.0].
67
247
  * @return {Promise}
68
- */export var isLibVersion=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(requiredVersion){var _ref8,libVersion;return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.next=2;return getVersionsFromClientInformation();case 2:_ref8=_context4.sent;libVersion=_ref8.libVersion;return _context4.abrupt("return",isVersion(requiredVersion,libVersion));case 5:case"end":return _context4.stop();}},_callee4);}));return function isLibVersion(_x3){return _ref7.apply(this,arguments);};}();/**
248
+ */
249
+ export const isLibVersion = async requiredVersion => {
250
+ const {
251
+ libVersion
252
+ } = await getVersionsFromClientInformation();
253
+ return isVersion(requiredVersion, libVersion);
254
+ };
255
+
256
+ /**
69
257
  * Returns the current libVersion.
70
258
  * @return {Promise}
71
- */export var getLibVersion=/*#__PURE__*/function(){var _ref9=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(){var _ref10,libVersion;return _regeneratorRuntime.wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:_context5.next=2;return getVersionsFromClientInformation();case 2:_ref10=_context5.sent;libVersion=_ref10.libVersion;return _context5.abrupt("return",libVersion);case 5:case"end":return _context5.stop();}},_callee5);}));return function getLibVersion(){return _ref9.apply(this,arguments);};}();
259
+ */
260
+ export const getLibVersion = async () => {
261
+ const {
262
+ libVersion
263
+ } = await getVersionsFromClientInformation();
264
+ return libVersion;
265
+ };
package/index.js CHANGED
@@ -1,6 +1,61 @@
1
1
  // Classes
2
- export{default as AppCommand}from"./classes/AppCommand";export{default as GetAppPermissionsRequest}from"./classes/AppPermissionsRequest/GetAppPermissionsRequest";export{default as RequestAppPermissionsRequest}from"./classes/AppPermissionsRequest/RequestAppPermissionsRequest";export{default as BrightnessRequest}from"./classes/BrightnessRequest";export{default as Conditioner}from"./classes/Conditioner";export{default as DataRequest}from"./classes/DataRequest";export{default as DevServerBridge}from"./classes/DevServerBridge";export{default as errorManager,emitter}from"./classes/ErrorManager";export{default as event}from"./classes/Event";export{default as HttpRequest}from"./classes/HttpRequest";export{default as PipelineRequest}from"./classes/PipelineRequest";export{default as ScannerManager}from"./classes/ScannerManager";export{default as WebStorageRequest}from"./classes/WebStorageRequest";// Commands
3
- export{default as analyticsSetCustomValues}from"./commands/analyticsSetCustomValues";export*from"./commands/appPermissions";export*from"./commands/brightness";export{default as broadcastEvent}from"./commands/broadcastEvent";export{default as cleanTab,cleanTabCmd}from"./commands/cleanTab";export{default as closeInAppBrowser}from"./commands/closeInAppBrowser";export{default as flushTab}from"./commands/flushTab";export{default as hideMenuBar}from"./commands/hideMenuBar";export{default as hideNavigationBar}from"./commands/hideNavigationBar";export{default as hideSplashScreen}from"./commands/hideSplashScreen";export{default as onload}from"./commands/onload";export{default as openAppSettings}from"./commands/openAppSettings";export{default as openPage}from"./commands/openPage";export{default as openPageExtern}from"./commands/openPageExtern";export{default as performCommandsAfterDelay,performCommandsAfterDelayCmd}from"./commands/performCommandsAfterDelay";export*from"./commands/plotProjects";export{default as popTabToRoot,popTabToRootCmd}from"./commands/popTabToRoot";export{default as registerEvents}from"./commands/registerEvents";export*from"./commands/scanner";export{default as setCookie}from"./commands/setCookie";export{default as setDebugLoggingEnabled}from"./commands/setDebugLoggingEnabled";export{default as setScrollingEnabled}from"./commands/setScrollingEnabled";export{default as showNavigationBar}from"./commands/showNavigationBar";export{default as showTab}from"./commands/showTab";export*from"./commands/unifiedTracking";export{default as getWebStorageEntry}from"./commands/getWebStorageEntry";export{default as setWebStorageEntry}from"./commands/setWebStorageEntry";// Constants
4
- export*from"./constants/AppEvents";export*from"./constants/AppPermissions";export*from"./constants/ErrorHandleTypes";export*from"./constants/Pipeline";export*from"./constants/ProcessTypes";export*from"./constants/Scanner";export*from"./constants/ErrorManager";export*from"./constants/Trilean";// Emitters
5
- export{default as UIEvents}from"./emitters/ui";// Helpers
6
- export*from"./helpers";export{default as logGroup}from"./helpers/logGroup";export*from"./helpers/version";
2
+ export { default as AppCommand } from "./classes/AppCommand";
3
+ export { default as GetAppPermissionsRequest } from "./classes/AppPermissionsRequest/GetAppPermissionsRequest";
4
+ export { default as RequestAppPermissionsRequest } from "./classes/AppPermissionsRequest/RequestAppPermissionsRequest";
5
+ export { default as BrightnessRequest } from "./classes/BrightnessRequest";
6
+ export { default as Conditioner } from "./classes/Conditioner";
7
+ export { default as DataRequest } from "./classes/DataRequest";
8
+ export { default as DevServerBridge } from "./classes/DevServerBridge";
9
+ export { default as errorManager, emitter } from "./classes/ErrorManager";
10
+ export { default as event } from "./classes/Event";
11
+ export { default as HttpRequest } from "./classes/HttpRequest";
12
+ export { default as PipelineRequest } from "./classes/PipelineRequest";
13
+ export { default as ScannerManager } from "./classes/ScannerManager";
14
+ export { default as WebStorageRequest } from "./classes/WebStorageRequest";
15
+
16
+ // Commands
17
+ export { default as analyticsSetCustomValues } from "./commands/analyticsSetCustomValues";
18
+ export * from "./commands/appPermissions";
19
+ export * from "./commands/brightness";
20
+ export { default as broadcastEvent } from "./commands/broadcastEvent";
21
+ export { default as cleanTab, cleanTabCmd } from "./commands/cleanTab";
22
+ export { default as closeInAppBrowser } from "./commands/closeInAppBrowser";
23
+ export { default as flushTab } from "./commands/flushTab";
24
+ export { default as hideMenuBar } from "./commands/hideMenuBar";
25
+ export { default as hideNavigationBar } from "./commands/hideNavigationBar";
26
+ export { default as hideSplashScreen } from "./commands/hideSplashScreen";
27
+ export { default as onload } from "./commands/onload";
28
+ export { default as openAppSettings } from "./commands/openAppSettings";
29
+ export { default as openPage } from "./commands/openPage";
30
+ export { default as openPageExtern } from "./commands/openPageExtern";
31
+ export { default as performCommandsAfterDelay, performCommandsAfterDelayCmd } from "./commands/performCommandsAfterDelay";
32
+ export * from "./commands/plotProjects";
33
+ export { default as popTabToRoot, popTabToRootCmd } from "./commands/popTabToRoot";
34
+ export { default as registerEvents } from "./commands/registerEvents";
35
+ export * from "./commands/scanner";
36
+ export { default as setCookie } from "./commands/setCookie";
37
+ export { default as setDebugLoggingEnabled } from "./commands/setDebugLoggingEnabled";
38
+ export { default as setScrollingEnabled } from "./commands/setScrollingEnabled";
39
+ export { default as showNavigationBar } from "./commands/showNavigationBar";
40
+ export { default as showTab } from "./commands/showTab";
41
+ export * from "./commands/unifiedTracking";
42
+ export { default as getWebStorageEntry } from "./commands/getWebStorageEntry";
43
+ export { default as setWebStorageEntry } from "./commands/setWebStorageEntry";
44
+
45
+ // Constants
46
+ export * from "./constants/AppEvents";
47
+ export * from "./constants/AppPermissions";
48
+ export * from "./constants/ErrorHandleTypes";
49
+ export * from "./constants/Pipeline";
50
+ export * from "./constants/ProcessTypes";
51
+ export * from "./constants/Scanner";
52
+ export * from "./constants/ErrorManager";
53
+ export * from "./constants/Trilean";
54
+
55
+ // Emitters
56
+ export { default as UIEvents } from "./emitters/ui";
57
+
58
+ // Helpers
59
+ export * from "./helpers";
60
+ export { default as logGroup } from "./helpers/logGroup";
61
+ export * from "./helpers/version";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-core",
3
- "version": "7.30.0-alpha.6",
3
+ "version": "7.30.0-alpha.8",
4
4
  "description": "Core library for the Shopgate Connect PWA.",
5
5
  "author": "Support <support@shopgate.com>",
6
6
  "license": "Apache-2.0",