@aws-amplify/notifications 0.2.4-in-app-messaging.7286 → 1.0.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.
Files changed (80) hide show
  1. package/lib/InAppMessaging/InAppMessaging.js +24 -94
  2. package/lib/InAppMessaging/InAppMessaging.js.map +1 -1
  3. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js +33 -92
  4. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +1 -1
  5. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js +2 -12
  6. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +1 -1
  7. package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js +8 -36
  8. package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +1 -1
  9. package/lib/InAppMessaging/Providers/index.js +2 -12
  10. package/lib/InAppMessaging/Providers/index.js.map +1 -1
  11. package/lib/InAppMessaging/SessionTracker/SessionTracker.js +4 -16
  12. package/lib/InAppMessaging/SessionTracker/SessionTracker.js.map +1 -1
  13. package/lib/InAppMessaging/SessionTracker/SessionTracker.native.js +4 -16
  14. package/lib/InAppMessaging/SessionTracker/SessionTracker.native.js.map +1 -1
  15. package/lib/InAppMessaging/SessionTracker/index.js +4 -16
  16. package/lib/InAppMessaging/SessionTracker/index.js.map +1 -1
  17. package/lib/InAppMessaging/SessionTracker/types.js +2 -12
  18. package/lib/InAppMessaging/SessionTracker/types.js.map +1 -1
  19. package/lib/InAppMessaging/eventListeners.js +2 -12
  20. package/lib/InAppMessaging/eventListeners.js.map +1 -1
  21. package/lib/InAppMessaging/index.js +2 -12
  22. package/lib/InAppMessaging/index.js.map +1 -1
  23. package/lib/InAppMessaging/types.js.map +1 -1
  24. package/lib/Notifications.js +5 -28
  25. package/lib/Notifications.js.map +1 -1
  26. package/lib/index.js +2 -12
  27. package/lib/index.js.map +1 -1
  28. package/lib-esm/InAppMessaging/InAppMessaging.js +3 -70
  29. package/lib-esm/InAppMessaging/InAppMessaging.js.map +1 -1
  30. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js +4 -60
  31. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +1 -1
  32. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js +2 -12
  33. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +1 -1
  34. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js +3 -28
  35. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +1 -1
  36. package/lib-esm/InAppMessaging/Providers/index.js +2 -12
  37. package/lib-esm/InAppMessaging/Providers/index.js.map +1 -1
  38. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.js +2 -12
  39. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.js.map +1 -1
  40. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.js +2 -12
  41. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.js.map +1 -1
  42. package/lib-esm/InAppMessaging/SessionTracker/index.js +2 -12
  43. package/lib-esm/InAppMessaging/SessionTracker/index.js.map +1 -1
  44. package/lib-esm/InAppMessaging/SessionTracker/types.js +2 -12
  45. package/lib-esm/InAppMessaging/SessionTracker/types.js.map +1 -1
  46. package/lib-esm/InAppMessaging/eventListeners.js +2 -12
  47. package/lib-esm/InAppMessaging/eventListeners.js.map +1 -1
  48. package/lib-esm/InAppMessaging/index.js +2 -12
  49. package/lib-esm/InAppMessaging/index.js.map +1 -1
  50. package/lib-esm/InAppMessaging/types.js.map +1 -1
  51. package/lib-esm/Notifications.js +3 -23
  52. package/lib-esm/Notifications.js.map +1 -1
  53. package/lib-esm/index.js +2 -12
  54. package/lib-esm/index.js.map +1 -1
  55. package/package.json +13 -10
  56. package/src/InAppMessaging/InAppMessaging.ts +2 -12
  57. package/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts +3 -13
  58. package/src/InAppMessaging/Providers/AWSPinpointProvider/types.ts +2 -12
  59. package/src/InAppMessaging/Providers/AWSPinpointProvider/utils.ts +2 -12
  60. package/src/InAppMessaging/Providers/index.ts +2 -12
  61. package/src/InAppMessaging/SessionTracker/SessionTracker.native.ts +2 -12
  62. package/src/InAppMessaging/SessionTracker/SessionTracker.ts +2 -12
  63. package/src/InAppMessaging/SessionTracker/index.ts +2 -12
  64. package/src/InAppMessaging/SessionTracker/types.ts +2 -12
  65. package/src/InAppMessaging/eventListeners.ts +2 -12
  66. package/src/InAppMessaging/index.ts +2 -12
  67. package/src/InAppMessaging/types.ts +2 -12
  68. package/src/Notifications.ts +2 -12
  69. package/src/index.ts +2 -12
  70. package/src/types.ts +2 -12
  71. package/build.js +0 -5
  72. package/dist/aws-amplify-notifications.js +0 -4423
  73. package/dist/aws-amplify-notifications.js.map +0 -1
  74. package/dist/aws-amplify-notifications.min.js +0 -2
  75. package/dist/aws-amplify-notifications.min.js.map +0 -1
  76. package/index.js +0 -7
  77. package/tsconfig.json +0 -21
  78. package/tslint.json +0 -50
  79. package/webpack.config.dev.js +0 -6
  80. package/webpack.config.js +0 -48
@@ -1,4423 +0,0 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("aws_amplify_cache"), require("aws_amplify_core"), require("@aws-sdk/client-pinpoint"));
4
- else if(typeof define === 'function' && define.amd)
5
- define("aws_amplify_notifications", ["aws_amplify_cache", "aws_amplify_core", "@aws-sdk/client-pinpoint"], factory);
6
- else if(typeof exports === 'object')
7
- exports["aws_amplify_notifications"] = factory(require("aws_amplify_cache"), require("aws_amplify_core"), require("@aws-sdk/client-pinpoint"));
8
- else
9
- root["aws_amplify_notifications"] = factory(root["aws_amplify_cache"], root["aws_amplify_core"], root["@aws-sdk/client-pinpoint"]);
10
- })(this, function(__WEBPACK_EXTERNAL_MODULE__aws_amplify_cache__, __WEBPACK_EXTERNAL_MODULE__aws_amplify_core__, __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_pinpoint__) {
11
- return /******/ (function(modules) { // webpackBootstrap
12
- /******/ // The module cache
13
- /******/ var installedModules = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function __webpack_require__(moduleId) {
17
- /******/
18
- /******/ // Check if module is in cache
19
- /******/ if(installedModules[moduleId]) {
20
- /******/ return installedModules[moduleId].exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var module = installedModules[moduleId] = {
24
- /******/ i: moduleId,
25
- /******/ l: false,
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
- /******/
32
- /******/ // Flag the module as loaded
33
- /******/ module.l = true;
34
- /******/
35
- /******/ // Return the exports of the module
36
- /******/ return module.exports;
37
- /******/ }
38
- /******/
39
- /******/
40
- /******/ // expose the modules object (__webpack_modules__)
41
- /******/ __webpack_require__.m = modules;
42
- /******/
43
- /******/ // expose the module cache
44
- /******/ __webpack_require__.c = installedModules;
45
- /******/
46
- /******/ // define getter function for harmony exports
47
- /******/ __webpack_require__.d = function(exports, name, getter) {
48
- /******/ if(!__webpack_require__.o(exports, name)) {
49
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50
- /******/ }
51
- /******/ };
52
- /******/
53
- /******/ // define __esModule on exports
54
- /******/ __webpack_require__.r = function(exports) {
55
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
- /******/ }
58
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
59
- /******/ };
60
- /******/
61
- /******/ // create a fake namespace object
62
- /******/ // mode & 1: value is a module id, require it
63
- /******/ // mode & 2: merge all properties of value into the ns
64
- /******/ // mode & 4: return value when already ns object
65
- /******/ // mode & 8|1: behave like require
66
- /******/ __webpack_require__.t = function(value, mode) {
67
- /******/ if(mode & 1) value = __webpack_require__(value);
68
- /******/ if(mode & 8) return value;
69
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70
- /******/ var ns = Object.create(null);
71
- /******/ __webpack_require__.r(ns);
72
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74
- /******/ return ns;
75
- /******/ };
76
- /******/
77
- /******/ // getDefaultExport function for compatibility with non-harmony modules
78
- /******/ __webpack_require__.n = function(module) {
79
- /******/ var getter = module && module.__esModule ?
80
- /******/ function getDefault() { return module['default']; } :
81
- /******/ function getModuleExports() { return module; };
82
- /******/ __webpack_require__.d(getter, 'a', getter);
83
- /******/ return getter;
84
- /******/ };
85
- /******/
86
- /******/ // Object.prototype.hasOwnProperty.call
87
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88
- /******/
89
- /******/ // __webpack_public_path__
90
- /******/ __webpack_require__.p = "";
91
- /******/
92
- /******/
93
- /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = "./lib-esm/index.js");
95
- /******/ })
96
- /************************************************************************/
97
- /******/ ({
98
-
99
- /***/ "../../node_modules/lodash/_DataView.js":
100
- /*!*********************************************************!*\
101
- !*** /root/amplify-js/node_modules/lodash/_DataView.js ***!
102
- \*********************************************************/
103
- /*! no static exports found */
104
- /***/ (function(module, exports, __webpack_require__) {
105
-
106
- var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
107
- root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
108
-
109
- /* Built-in method references that are verified to be native. */
110
- var DataView = getNative(root, 'DataView');
111
-
112
- module.exports = DataView;
113
-
114
-
115
- /***/ }),
116
-
117
- /***/ "../../node_modules/lodash/_Map.js":
118
- /*!****************************************************!*\
119
- !*** /root/amplify-js/node_modules/lodash/_Map.js ***!
120
- \****************************************************/
121
- /*! no static exports found */
122
- /***/ (function(module, exports, __webpack_require__) {
123
-
124
- var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
125
- root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
126
-
127
- /* Built-in method references that are verified to be native. */
128
- var Map = getNative(root, 'Map');
129
-
130
- module.exports = Map;
131
-
132
-
133
- /***/ }),
134
-
135
- /***/ "../../node_modules/lodash/_Promise.js":
136
- /*!********************************************************!*\
137
- !*** /root/amplify-js/node_modules/lodash/_Promise.js ***!
138
- \********************************************************/
139
- /*! no static exports found */
140
- /***/ (function(module, exports, __webpack_require__) {
141
-
142
- var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
143
- root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
144
-
145
- /* Built-in method references that are verified to be native. */
146
- var Promise = getNative(root, 'Promise');
147
-
148
- module.exports = Promise;
149
-
150
-
151
- /***/ }),
152
-
153
- /***/ "../../node_modules/lodash/_Set.js":
154
- /*!****************************************************!*\
155
- !*** /root/amplify-js/node_modules/lodash/_Set.js ***!
156
- \****************************************************/
157
- /*! no static exports found */
158
- /***/ (function(module, exports, __webpack_require__) {
159
-
160
- var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
161
- root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
162
-
163
- /* Built-in method references that are verified to be native. */
164
- var Set = getNative(root, 'Set');
165
-
166
- module.exports = Set;
167
-
168
-
169
- /***/ }),
170
-
171
- /***/ "../../node_modules/lodash/_Symbol.js":
172
- /*!*******************************************************!*\
173
- !*** /root/amplify-js/node_modules/lodash/_Symbol.js ***!
174
- \*******************************************************/
175
- /*! no static exports found */
176
- /***/ (function(module, exports, __webpack_require__) {
177
-
178
- var root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
179
-
180
- /** Built-in value references. */
181
- var Symbol = root.Symbol;
182
-
183
- module.exports = Symbol;
184
-
185
-
186
- /***/ }),
187
-
188
- /***/ "../../node_modules/lodash/_WeakMap.js":
189
- /*!********************************************************!*\
190
- !*** /root/amplify-js/node_modules/lodash/_WeakMap.js ***!
191
- \********************************************************/
192
- /*! no static exports found */
193
- /***/ (function(module, exports, __webpack_require__) {
194
-
195
- var getNative = __webpack_require__(/*! ./_getNative */ "../../node_modules/lodash/_getNative.js"),
196
- root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
197
-
198
- /* Built-in method references that are verified to be native. */
199
- var WeakMap = getNative(root, 'WeakMap');
200
-
201
- module.exports = WeakMap;
202
-
203
-
204
- /***/ }),
205
-
206
- /***/ "../../node_modules/lodash/_arrayPush.js":
207
- /*!**********************************************************!*\
208
- !*** /root/amplify-js/node_modules/lodash/_arrayPush.js ***!
209
- \**********************************************************/
210
- /*! no static exports found */
211
- /***/ (function(module, exports) {
212
-
213
- /**
214
- * Appends the elements of `values` to `array`.
215
- *
216
- * @private
217
- * @param {Array} array The array to modify.
218
- * @param {Array} values The values to append.
219
- * @returns {Array} Returns `array`.
220
- */
221
- function arrayPush(array, values) {
222
- var index = -1,
223
- length = values.length,
224
- offset = array.length;
225
-
226
- while (++index < length) {
227
- array[offset + index] = values[index];
228
- }
229
- return array;
230
- }
231
-
232
- module.exports = arrayPush;
233
-
234
-
235
- /***/ }),
236
-
237
- /***/ "../../node_modules/lodash/_baseFlatten.js":
238
- /*!************************************************************!*\
239
- !*** /root/amplify-js/node_modules/lodash/_baseFlatten.js ***!
240
- \************************************************************/
241
- /*! no static exports found */
242
- /***/ (function(module, exports, __webpack_require__) {
243
-
244
- var arrayPush = __webpack_require__(/*! ./_arrayPush */ "../../node_modules/lodash/_arrayPush.js"),
245
- isFlattenable = __webpack_require__(/*! ./_isFlattenable */ "../../node_modules/lodash/_isFlattenable.js");
246
-
247
- /**
248
- * The base implementation of `_.flatten` with support for restricting flattening.
249
- *
250
- * @private
251
- * @param {Array} array The array to flatten.
252
- * @param {number} depth The maximum recursion depth.
253
- * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
254
- * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
255
- * @param {Array} [result=[]] The initial result value.
256
- * @returns {Array} Returns the new flattened array.
257
- */
258
- function baseFlatten(array, depth, predicate, isStrict, result) {
259
- var index = -1,
260
- length = array.length;
261
-
262
- predicate || (predicate = isFlattenable);
263
- result || (result = []);
264
-
265
- while (++index < length) {
266
- var value = array[index];
267
- if (depth > 0 && predicate(value)) {
268
- if (depth > 1) {
269
- // Recursively flatten arrays (susceptible to call stack limits).
270
- baseFlatten(value, depth - 1, predicate, isStrict, result);
271
- } else {
272
- arrayPush(result, value);
273
- }
274
- } else if (!isStrict) {
275
- result[result.length] = value;
276
- }
277
- }
278
- return result;
279
- }
280
-
281
- module.exports = baseFlatten;
282
-
283
-
284
- /***/ }),
285
-
286
- /***/ "../../node_modules/lodash/_baseGetTag.js":
287
- /*!***********************************************************!*\
288
- !*** /root/amplify-js/node_modules/lodash/_baseGetTag.js ***!
289
- \***********************************************************/
290
- /*! no static exports found */
291
- /***/ (function(module, exports, __webpack_require__) {
292
-
293
- var Symbol = __webpack_require__(/*! ./_Symbol */ "../../node_modules/lodash/_Symbol.js"),
294
- getRawTag = __webpack_require__(/*! ./_getRawTag */ "../../node_modules/lodash/_getRawTag.js"),
295
- objectToString = __webpack_require__(/*! ./_objectToString */ "../../node_modules/lodash/_objectToString.js");
296
-
297
- /** `Object#toString` result references. */
298
- var nullTag = '[object Null]',
299
- undefinedTag = '[object Undefined]';
300
-
301
- /** Built-in value references. */
302
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
303
-
304
- /**
305
- * The base implementation of `getTag` without fallbacks for buggy environments.
306
- *
307
- * @private
308
- * @param {*} value The value to query.
309
- * @returns {string} Returns the `toStringTag`.
310
- */
311
- function baseGetTag(value) {
312
- if (value == null) {
313
- return value === undefined ? undefinedTag : nullTag;
314
- }
315
- return (symToStringTag && symToStringTag in Object(value))
316
- ? getRawTag(value)
317
- : objectToString(value);
318
- }
319
-
320
- module.exports = baseGetTag;
321
-
322
-
323
- /***/ }),
324
-
325
- /***/ "../../node_modules/lodash/_baseIsArguments.js":
326
- /*!****************************************************************!*\
327
- !*** /root/amplify-js/node_modules/lodash/_baseIsArguments.js ***!
328
- \****************************************************************/
329
- /*! no static exports found */
330
- /***/ (function(module, exports, __webpack_require__) {
331
-
332
- var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
333
- isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
334
-
335
- /** `Object#toString` result references. */
336
- var argsTag = '[object Arguments]';
337
-
338
- /**
339
- * The base implementation of `_.isArguments`.
340
- *
341
- * @private
342
- * @param {*} value The value to check.
343
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
344
- */
345
- function baseIsArguments(value) {
346
- return isObjectLike(value) && baseGetTag(value) == argsTag;
347
- }
348
-
349
- module.exports = baseIsArguments;
350
-
351
-
352
- /***/ }),
353
-
354
- /***/ "../../node_modules/lodash/_baseIsNative.js":
355
- /*!*************************************************************!*\
356
- !*** /root/amplify-js/node_modules/lodash/_baseIsNative.js ***!
357
- \*************************************************************/
358
- /*! no static exports found */
359
- /***/ (function(module, exports, __webpack_require__) {
360
-
361
- var isFunction = __webpack_require__(/*! ./isFunction */ "../../node_modules/lodash/isFunction.js"),
362
- isMasked = __webpack_require__(/*! ./_isMasked */ "../../node_modules/lodash/_isMasked.js"),
363
- isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js"),
364
- toSource = __webpack_require__(/*! ./_toSource */ "../../node_modules/lodash/_toSource.js");
365
-
366
- /**
367
- * Used to match `RegExp`
368
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
369
- */
370
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
371
-
372
- /** Used to detect host constructors (Safari). */
373
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
374
-
375
- /** Used for built-in method references. */
376
- var funcProto = Function.prototype,
377
- objectProto = Object.prototype;
378
-
379
- /** Used to resolve the decompiled source of functions. */
380
- var funcToString = funcProto.toString;
381
-
382
- /** Used to check objects for own properties. */
383
- var hasOwnProperty = objectProto.hasOwnProperty;
384
-
385
- /** Used to detect if a method is native. */
386
- var reIsNative = RegExp('^' +
387
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
388
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
389
- );
390
-
391
- /**
392
- * The base implementation of `_.isNative` without bad shim checks.
393
- *
394
- * @private
395
- * @param {*} value The value to check.
396
- * @returns {boolean} Returns `true` if `value` is a native function,
397
- * else `false`.
398
- */
399
- function baseIsNative(value) {
400
- if (!isObject(value) || isMasked(value)) {
401
- return false;
402
- }
403
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
404
- return pattern.test(toSource(value));
405
- }
406
-
407
- module.exports = baseIsNative;
408
-
409
-
410
- /***/ }),
411
-
412
- /***/ "../../node_modules/lodash/_baseIsTypedArray.js":
413
- /*!*****************************************************************!*\
414
- !*** /root/amplify-js/node_modules/lodash/_baseIsTypedArray.js ***!
415
- \*****************************************************************/
416
- /*! no static exports found */
417
- /***/ (function(module, exports, __webpack_require__) {
418
-
419
- var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
420
- isLength = __webpack_require__(/*! ./isLength */ "../../node_modules/lodash/isLength.js"),
421
- isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
422
-
423
- /** `Object#toString` result references. */
424
- var argsTag = '[object Arguments]',
425
- arrayTag = '[object Array]',
426
- boolTag = '[object Boolean]',
427
- dateTag = '[object Date]',
428
- errorTag = '[object Error]',
429
- funcTag = '[object Function]',
430
- mapTag = '[object Map]',
431
- numberTag = '[object Number]',
432
- objectTag = '[object Object]',
433
- regexpTag = '[object RegExp]',
434
- setTag = '[object Set]',
435
- stringTag = '[object String]',
436
- weakMapTag = '[object WeakMap]';
437
-
438
- var arrayBufferTag = '[object ArrayBuffer]',
439
- dataViewTag = '[object DataView]',
440
- float32Tag = '[object Float32Array]',
441
- float64Tag = '[object Float64Array]',
442
- int8Tag = '[object Int8Array]',
443
- int16Tag = '[object Int16Array]',
444
- int32Tag = '[object Int32Array]',
445
- uint8Tag = '[object Uint8Array]',
446
- uint8ClampedTag = '[object Uint8ClampedArray]',
447
- uint16Tag = '[object Uint16Array]',
448
- uint32Tag = '[object Uint32Array]';
449
-
450
- /** Used to identify `toStringTag` values of typed arrays. */
451
- var typedArrayTags = {};
452
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
453
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
454
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
455
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
456
- typedArrayTags[uint32Tag] = true;
457
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
458
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
459
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
460
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
461
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
462
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
463
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
464
- typedArrayTags[weakMapTag] = false;
465
-
466
- /**
467
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
468
- *
469
- * @private
470
- * @param {*} value The value to check.
471
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
472
- */
473
- function baseIsTypedArray(value) {
474
- return isObjectLike(value) &&
475
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
476
- }
477
-
478
- module.exports = baseIsTypedArray;
479
-
480
-
481
- /***/ }),
482
-
483
- /***/ "../../node_modules/lodash/_baseKeys.js":
484
- /*!*********************************************************!*\
485
- !*** /root/amplify-js/node_modules/lodash/_baseKeys.js ***!
486
- \*********************************************************/
487
- /*! no static exports found */
488
- /***/ (function(module, exports, __webpack_require__) {
489
-
490
- var isPrototype = __webpack_require__(/*! ./_isPrototype */ "../../node_modules/lodash/_isPrototype.js"),
491
- nativeKeys = __webpack_require__(/*! ./_nativeKeys */ "../../node_modules/lodash/_nativeKeys.js");
492
-
493
- /** Used for built-in method references. */
494
- var objectProto = Object.prototype;
495
-
496
- /** Used to check objects for own properties. */
497
- var hasOwnProperty = objectProto.hasOwnProperty;
498
-
499
- /**
500
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
501
- *
502
- * @private
503
- * @param {Object} object The object to query.
504
- * @returns {Array} Returns the array of property names.
505
- */
506
- function baseKeys(object) {
507
- if (!isPrototype(object)) {
508
- return nativeKeys(object);
509
- }
510
- var result = [];
511
- for (var key in Object(object)) {
512
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
513
- result.push(key);
514
- }
515
- }
516
- return result;
517
- }
518
-
519
- module.exports = baseKeys;
520
-
521
-
522
- /***/ }),
523
-
524
- /***/ "../../node_modules/lodash/_baseUnary.js":
525
- /*!**********************************************************!*\
526
- !*** /root/amplify-js/node_modules/lodash/_baseUnary.js ***!
527
- \**********************************************************/
528
- /*! no static exports found */
529
- /***/ (function(module, exports) {
530
-
531
- /**
532
- * The base implementation of `_.unary` without support for storing metadata.
533
- *
534
- * @private
535
- * @param {Function} func The function to cap arguments for.
536
- * @returns {Function} Returns the new capped function.
537
- */
538
- function baseUnary(func) {
539
- return function(value) {
540
- return func(value);
541
- };
542
- }
543
-
544
- module.exports = baseUnary;
545
-
546
-
547
- /***/ }),
548
-
549
- /***/ "../../node_modules/lodash/_coreJsData.js":
550
- /*!***********************************************************!*\
551
- !*** /root/amplify-js/node_modules/lodash/_coreJsData.js ***!
552
- \***********************************************************/
553
- /*! no static exports found */
554
- /***/ (function(module, exports, __webpack_require__) {
555
-
556
- var root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js");
557
-
558
- /** Used to detect overreaching core-js shims. */
559
- var coreJsData = root['__core-js_shared__'];
560
-
561
- module.exports = coreJsData;
562
-
563
-
564
- /***/ }),
565
-
566
- /***/ "../../node_modules/lodash/_freeGlobal.js":
567
- /*!***********************************************************!*\
568
- !*** /root/amplify-js/node_modules/lodash/_freeGlobal.js ***!
569
- \***********************************************************/
570
- /*! no static exports found */
571
- /***/ (function(module, exports, __webpack_require__) {
572
-
573
- /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
574
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
575
-
576
- module.exports = freeGlobal;
577
-
578
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
579
-
580
- /***/ }),
581
-
582
- /***/ "../../node_modules/lodash/_getNative.js":
583
- /*!**********************************************************!*\
584
- !*** /root/amplify-js/node_modules/lodash/_getNative.js ***!
585
- \**********************************************************/
586
- /*! no static exports found */
587
- /***/ (function(module, exports, __webpack_require__) {
588
-
589
- var baseIsNative = __webpack_require__(/*! ./_baseIsNative */ "../../node_modules/lodash/_baseIsNative.js"),
590
- getValue = __webpack_require__(/*! ./_getValue */ "../../node_modules/lodash/_getValue.js");
591
-
592
- /**
593
- * Gets the native function at `key` of `object`.
594
- *
595
- * @private
596
- * @param {Object} object The object to query.
597
- * @param {string} key The key of the method to get.
598
- * @returns {*} Returns the function if it's native, else `undefined`.
599
- */
600
- function getNative(object, key) {
601
- var value = getValue(object, key);
602
- return baseIsNative(value) ? value : undefined;
603
- }
604
-
605
- module.exports = getNative;
606
-
607
-
608
- /***/ }),
609
-
610
- /***/ "../../node_modules/lodash/_getRawTag.js":
611
- /*!**********************************************************!*\
612
- !*** /root/amplify-js/node_modules/lodash/_getRawTag.js ***!
613
- \**********************************************************/
614
- /*! no static exports found */
615
- /***/ (function(module, exports, __webpack_require__) {
616
-
617
- var Symbol = __webpack_require__(/*! ./_Symbol */ "../../node_modules/lodash/_Symbol.js");
618
-
619
- /** Used for built-in method references. */
620
- var objectProto = Object.prototype;
621
-
622
- /** Used to check objects for own properties. */
623
- var hasOwnProperty = objectProto.hasOwnProperty;
624
-
625
- /**
626
- * Used to resolve the
627
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
628
- * of values.
629
- */
630
- var nativeObjectToString = objectProto.toString;
631
-
632
- /** Built-in value references. */
633
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
634
-
635
- /**
636
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
637
- *
638
- * @private
639
- * @param {*} value The value to query.
640
- * @returns {string} Returns the raw `toStringTag`.
641
- */
642
- function getRawTag(value) {
643
- var isOwn = hasOwnProperty.call(value, symToStringTag),
644
- tag = value[symToStringTag];
645
-
646
- try {
647
- value[symToStringTag] = undefined;
648
- var unmasked = true;
649
- } catch (e) {}
650
-
651
- var result = nativeObjectToString.call(value);
652
- if (unmasked) {
653
- if (isOwn) {
654
- value[symToStringTag] = tag;
655
- } else {
656
- delete value[symToStringTag];
657
- }
658
- }
659
- return result;
660
- }
661
-
662
- module.exports = getRawTag;
663
-
664
-
665
- /***/ }),
666
-
667
- /***/ "../../node_modules/lodash/_getTag.js":
668
- /*!*******************************************************!*\
669
- !*** /root/amplify-js/node_modules/lodash/_getTag.js ***!
670
- \*******************************************************/
671
- /*! no static exports found */
672
- /***/ (function(module, exports, __webpack_require__) {
673
-
674
- var DataView = __webpack_require__(/*! ./_DataView */ "../../node_modules/lodash/_DataView.js"),
675
- Map = __webpack_require__(/*! ./_Map */ "../../node_modules/lodash/_Map.js"),
676
- Promise = __webpack_require__(/*! ./_Promise */ "../../node_modules/lodash/_Promise.js"),
677
- Set = __webpack_require__(/*! ./_Set */ "../../node_modules/lodash/_Set.js"),
678
- WeakMap = __webpack_require__(/*! ./_WeakMap */ "../../node_modules/lodash/_WeakMap.js"),
679
- baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
680
- toSource = __webpack_require__(/*! ./_toSource */ "../../node_modules/lodash/_toSource.js");
681
-
682
- /** `Object#toString` result references. */
683
- var mapTag = '[object Map]',
684
- objectTag = '[object Object]',
685
- promiseTag = '[object Promise]',
686
- setTag = '[object Set]',
687
- weakMapTag = '[object WeakMap]';
688
-
689
- var dataViewTag = '[object DataView]';
690
-
691
- /** Used to detect maps, sets, and weakmaps. */
692
- var dataViewCtorString = toSource(DataView),
693
- mapCtorString = toSource(Map),
694
- promiseCtorString = toSource(Promise),
695
- setCtorString = toSource(Set),
696
- weakMapCtorString = toSource(WeakMap);
697
-
698
- /**
699
- * Gets the `toStringTag` of `value`.
700
- *
701
- * @private
702
- * @param {*} value The value to query.
703
- * @returns {string} Returns the `toStringTag`.
704
- */
705
- var getTag = baseGetTag;
706
-
707
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
708
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
709
- (Map && getTag(new Map) != mapTag) ||
710
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
711
- (Set && getTag(new Set) != setTag) ||
712
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
713
- getTag = function(value) {
714
- var result = baseGetTag(value),
715
- Ctor = result == objectTag ? value.constructor : undefined,
716
- ctorString = Ctor ? toSource(Ctor) : '';
717
-
718
- if (ctorString) {
719
- switch (ctorString) {
720
- case dataViewCtorString: return dataViewTag;
721
- case mapCtorString: return mapTag;
722
- case promiseCtorString: return promiseTag;
723
- case setCtorString: return setTag;
724
- case weakMapCtorString: return weakMapTag;
725
- }
726
- }
727
- return result;
728
- };
729
- }
730
-
731
- module.exports = getTag;
732
-
733
-
734
- /***/ }),
735
-
736
- /***/ "../../node_modules/lodash/_getValue.js":
737
- /*!*********************************************************!*\
738
- !*** /root/amplify-js/node_modules/lodash/_getValue.js ***!
739
- \*********************************************************/
740
- /*! no static exports found */
741
- /***/ (function(module, exports) {
742
-
743
- /**
744
- * Gets the value at `key` of `object`.
745
- *
746
- * @private
747
- * @param {Object} [object] The object to query.
748
- * @param {string} key The key of the property to get.
749
- * @returns {*} Returns the property value.
750
- */
751
- function getValue(object, key) {
752
- return object == null ? undefined : object[key];
753
- }
754
-
755
- module.exports = getValue;
756
-
757
-
758
- /***/ }),
759
-
760
- /***/ "../../node_modules/lodash/_isFlattenable.js":
761
- /*!**************************************************************!*\
762
- !*** /root/amplify-js/node_modules/lodash/_isFlattenable.js ***!
763
- \**************************************************************/
764
- /*! no static exports found */
765
- /***/ (function(module, exports, __webpack_require__) {
766
-
767
- var Symbol = __webpack_require__(/*! ./_Symbol */ "../../node_modules/lodash/_Symbol.js"),
768
- isArguments = __webpack_require__(/*! ./isArguments */ "../../node_modules/lodash/isArguments.js"),
769
- isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js");
770
-
771
- /** Built-in value references. */
772
- var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
773
-
774
- /**
775
- * Checks if `value` is a flattenable `arguments` object or array.
776
- *
777
- * @private
778
- * @param {*} value The value to check.
779
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
780
- */
781
- function isFlattenable(value) {
782
- return isArray(value) || isArguments(value) ||
783
- !!(spreadableSymbol && value && value[spreadableSymbol]);
784
- }
785
-
786
- module.exports = isFlattenable;
787
-
788
-
789
- /***/ }),
790
-
791
- /***/ "../../node_modules/lodash/_isMasked.js":
792
- /*!*********************************************************!*\
793
- !*** /root/amplify-js/node_modules/lodash/_isMasked.js ***!
794
- \*********************************************************/
795
- /*! no static exports found */
796
- /***/ (function(module, exports, __webpack_require__) {
797
-
798
- var coreJsData = __webpack_require__(/*! ./_coreJsData */ "../../node_modules/lodash/_coreJsData.js");
799
-
800
- /** Used to detect methods masquerading as native. */
801
- var maskSrcKey = (function() {
802
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
803
- return uid ? ('Symbol(src)_1.' + uid) : '';
804
- }());
805
-
806
- /**
807
- * Checks if `func` has its source masked.
808
- *
809
- * @private
810
- * @param {Function} func The function to check.
811
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
812
- */
813
- function isMasked(func) {
814
- return !!maskSrcKey && (maskSrcKey in func);
815
- }
816
-
817
- module.exports = isMasked;
818
-
819
-
820
- /***/ }),
821
-
822
- /***/ "../../node_modules/lodash/_isPrototype.js":
823
- /*!************************************************************!*\
824
- !*** /root/amplify-js/node_modules/lodash/_isPrototype.js ***!
825
- \************************************************************/
826
- /*! no static exports found */
827
- /***/ (function(module, exports) {
828
-
829
- /** Used for built-in method references. */
830
- var objectProto = Object.prototype;
831
-
832
- /**
833
- * Checks if `value` is likely a prototype object.
834
- *
835
- * @private
836
- * @param {*} value The value to check.
837
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
838
- */
839
- function isPrototype(value) {
840
- var Ctor = value && value.constructor,
841
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
842
-
843
- return value === proto;
844
- }
845
-
846
- module.exports = isPrototype;
847
-
848
-
849
- /***/ }),
850
-
851
- /***/ "../../node_modules/lodash/_nativeKeys.js":
852
- /*!***********************************************************!*\
853
- !*** /root/amplify-js/node_modules/lodash/_nativeKeys.js ***!
854
- \***********************************************************/
855
- /*! no static exports found */
856
- /***/ (function(module, exports, __webpack_require__) {
857
-
858
- var overArg = __webpack_require__(/*! ./_overArg */ "../../node_modules/lodash/_overArg.js");
859
-
860
- /* Built-in method references for those with the same name as other `lodash` methods. */
861
- var nativeKeys = overArg(Object.keys, Object);
862
-
863
- module.exports = nativeKeys;
864
-
865
-
866
- /***/ }),
867
-
868
- /***/ "../../node_modules/lodash/_nodeUtil.js":
869
- /*!*********************************************************!*\
870
- !*** /root/amplify-js/node_modules/lodash/_nodeUtil.js ***!
871
- \*********************************************************/
872
- /*! no static exports found */
873
- /***/ (function(module, exports, __webpack_require__) {
874
-
875
- /* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(/*! ./_freeGlobal */ "../../node_modules/lodash/_freeGlobal.js");
876
-
877
- /** Detect free variable `exports`. */
878
- var freeExports = true && exports && !exports.nodeType && exports;
879
-
880
- /** Detect free variable `module`. */
881
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
882
-
883
- /** Detect the popular CommonJS extension `module.exports`. */
884
- var moduleExports = freeModule && freeModule.exports === freeExports;
885
-
886
- /** Detect free variable `process` from Node.js. */
887
- var freeProcess = moduleExports && freeGlobal.process;
888
-
889
- /** Used to access faster Node.js helpers. */
890
- var nodeUtil = (function() {
891
- try {
892
- // Use `util.types` for Node.js 10+.
893
- var types = freeModule && freeModule.require && freeModule.require('util').types;
894
-
895
- if (types) {
896
- return types;
897
- }
898
-
899
- // Legacy `process.binding('util')` for Node.js < 10.
900
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
901
- } catch (e) {}
902
- }());
903
-
904
- module.exports = nodeUtil;
905
-
906
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "../../node_modules/webpack/buildin/module.js")(module)))
907
-
908
- /***/ }),
909
-
910
- /***/ "../../node_modules/lodash/_objectToString.js":
911
- /*!***************************************************************!*\
912
- !*** /root/amplify-js/node_modules/lodash/_objectToString.js ***!
913
- \***************************************************************/
914
- /*! no static exports found */
915
- /***/ (function(module, exports) {
916
-
917
- /** Used for built-in method references. */
918
- var objectProto = Object.prototype;
919
-
920
- /**
921
- * Used to resolve the
922
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
923
- * of values.
924
- */
925
- var nativeObjectToString = objectProto.toString;
926
-
927
- /**
928
- * Converts `value` to a string using `Object.prototype.toString`.
929
- *
930
- * @private
931
- * @param {*} value The value to convert.
932
- * @returns {string} Returns the converted string.
933
- */
934
- function objectToString(value) {
935
- return nativeObjectToString.call(value);
936
- }
937
-
938
- module.exports = objectToString;
939
-
940
-
941
- /***/ }),
942
-
943
- /***/ "../../node_modules/lodash/_overArg.js":
944
- /*!********************************************************!*\
945
- !*** /root/amplify-js/node_modules/lodash/_overArg.js ***!
946
- \********************************************************/
947
- /*! no static exports found */
948
- /***/ (function(module, exports) {
949
-
950
- /**
951
- * Creates a unary function that invokes `func` with its argument transformed.
952
- *
953
- * @private
954
- * @param {Function} func The function to wrap.
955
- * @param {Function} transform The argument transform.
956
- * @returns {Function} Returns the new function.
957
- */
958
- function overArg(func, transform) {
959
- return function(arg) {
960
- return func(transform(arg));
961
- };
962
- }
963
-
964
- module.exports = overArg;
965
-
966
-
967
- /***/ }),
968
-
969
- /***/ "../../node_modules/lodash/_root.js":
970
- /*!*****************************************************!*\
971
- !*** /root/amplify-js/node_modules/lodash/_root.js ***!
972
- \*****************************************************/
973
- /*! no static exports found */
974
- /***/ (function(module, exports, __webpack_require__) {
975
-
976
- var freeGlobal = __webpack_require__(/*! ./_freeGlobal */ "../../node_modules/lodash/_freeGlobal.js");
977
-
978
- /** Detect free variable `self`. */
979
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
980
-
981
- /** Used as a reference to the global object. */
982
- var root = freeGlobal || freeSelf || Function('return this')();
983
-
984
- module.exports = root;
985
-
986
-
987
- /***/ }),
988
-
989
- /***/ "../../node_modules/lodash/_toSource.js":
990
- /*!*********************************************************!*\
991
- !*** /root/amplify-js/node_modules/lodash/_toSource.js ***!
992
- \*********************************************************/
993
- /*! no static exports found */
994
- /***/ (function(module, exports) {
995
-
996
- /** Used for built-in method references. */
997
- var funcProto = Function.prototype;
998
-
999
- /** Used to resolve the decompiled source of functions. */
1000
- var funcToString = funcProto.toString;
1001
-
1002
- /**
1003
- * Converts `func` to its source code.
1004
- *
1005
- * @private
1006
- * @param {Function} func The function to convert.
1007
- * @returns {string} Returns the source code.
1008
- */
1009
- function toSource(func) {
1010
- if (func != null) {
1011
- try {
1012
- return funcToString.call(func);
1013
- } catch (e) {}
1014
- try {
1015
- return (func + '');
1016
- } catch (e) {}
1017
- }
1018
- return '';
1019
- }
1020
-
1021
- module.exports = toSource;
1022
-
1023
-
1024
- /***/ }),
1025
-
1026
- /***/ "../../node_modules/lodash/flatten.js":
1027
- /*!*******************************************************!*\
1028
- !*** /root/amplify-js/node_modules/lodash/flatten.js ***!
1029
- \*******************************************************/
1030
- /*! no static exports found */
1031
- /***/ (function(module, exports, __webpack_require__) {
1032
-
1033
- var baseFlatten = __webpack_require__(/*! ./_baseFlatten */ "../../node_modules/lodash/_baseFlatten.js");
1034
-
1035
- /**
1036
- * Flattens `array` a single level deep.
1037
- *
1038
- * @static
1039
- * @memberOf _
1040
- * @since 0.1.0
1041
- * @category Array
1042
- * @param {Array} array The array to flatten.
1043
- * @returns {Array} Returns the new flattened array.
1044
- * @example
1045
- *
1046
- * _.flatten([1, [2, [3, [4]], 5]]);
1047
- * // => [1, 2, [3, [4]], 5]
1048
- */
1049
- function flatten(array) {
1050
- var length = array == null ? 0 : array.length;
1051
- return length ? baseFlatten(array, 1) : [];
1052
- }
1053
-
1054
- module.exports = flatten;
1055
-
1056
-
1057
- /***/ }),
1058
-
1059
- /***/ "../../node_modules/lodash/isArguments.js":
1060
- /*!***********************************************************!*\
1061
- !*** /root/amplify-js/node_modules/lodash/isArguments.js ***!
1062
- \***********************************************************/
1063
- /*! no static exports found */
1064
- /***/ (function(module, exports, __webpack_require__) {
1065
-
1066
- var baseIsArguments = __webpack_require__(/*! ./_baseIsArguments */ "../../node_modules/lodash/_baseIsArguments.js"),
1067
- isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../node_modules/lodash/isObjectLike.js");
1068
-
1069
- /** Used for built-in method references. */
1070
- var objectProto = Object.prototype;
1071
-
1072
- /** Used to check objects for own properties. */
1073
- var hasOwnProperty = objectProto.hasOwnProperty;
1074
-
1075
- /** Built-in value references. */
1076
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
1077
-
1078
- /**
1079
- * Checks if `value` is likely an `arguments` object.
1080
- *
1081
- * @static
1082
- * @memberOf _
1083
- * @since 0.1.0
1084
- * @category Lang
1085
- * @param {*} value The value to check.
1086
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1087
- * else `false`.
1088
- * @example
1089
- *
1090
- * _.isArguments(function() { return arguments; }());
1091
- * // => true
1092
- *
1093
- * _.isArguments([1, 2, 3]);
1094
- * // => false
1095
- */
1096
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1097
- return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
1098
- !propertyIsEnumerable.call(value, 'callee');
1099
- };
1100
-
1101
- module.exports = isArguments;
1102
-
1103
-
1104
- /***/ }),
1105
-
1106
- /***/ "../../node_modules/lodash/isArray.js":
1107
- /*!*******************************************************!*\
1108
- !*** /root/amplify-js/node_modules/lodash/isArray.js ***!
1109
- \*******************************************************/
1110
- /*! no static exports found */
1111
- /***/ (function(module, exports) {
1112
-
1113
- /**
1114
- * Checks if `value` is classified as an `Array` object.
1115
- *
1116
- * @static
1117
- * @memberOf _
1118
- * @since 0.1.0
1119
- * @category Lang
1120
- * @param {*} value The value to check.
1121
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1122
- * @example
1123
- *
1124
- * _.isArray([1, 2, 3]);
1125
- * // => true
1126
- *
1127
- * _.isArray(document.body.children);
1128
- * // => false
1129
- *
1130
- * _.isArray('abc');
1131
- * // => false
1132
- *
1133
- * _.isArray(_.noop);
1134
- * // => false
1135
- */
1136
- var isArray = Array.isArray;
1137
-
1138
- module.exports = isArray;
1139
-
1140
-
1141
- /***/ }),
1142
-
1143
- /***/ "../../node_modules/lodash/isArrayLike.js":
1144
- /*!***********************************************************!*\
1145
- !*** /root/amplify-js/node_modules/lodash/isArrayLike.js ***!
1146
- \***********************************************************/
1147
- /*! no static exports found */
1148
- /***/ (function(module, exports, __webpack_require__) {
1149
-
1150
- var isFunction = __webpack_require__(/*! ./isFunction */ "../../node_modules/lodash/isFunction.js"),
1151
- isLength = __webpack_require__(/*! ./isLength */ "../../node_modules/lodash/isLength.js");
1152
-
1153
- /**
1154
- * Checks if `value` is array-like. A value is considered array-like if it's
1155
- * not a function and has a `value.length` that's an integer greater than or
1156
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1157
- *
1158
- * @static
1159
- * @memberOf _
1160
- * @since 4.0.0
1161
- * @category Lang
1162
- * @param {*} value The value to check.
1163
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1164
- * @example
1165
- *
1166
- * _.isArrayLike([1, 2, 3]);
1167
- * // => true
1168
- *
1169
- * _.isArrayLike(document.body.children);
1170
- * // => true
1171
- *
1172
- * _.isArrayLike('abc');
1173
- * // => true
1174
- *
1175
- * _.isArrayLike(_.noop);
1176
- * // => false
1177
- */
1178
- function isArrayLike(value) {
1179
- return value != null && isLength(value.length) && !isFunction(value);
1180
- }
1181
-
1182
- module.exports = isArrayLike;
1183
-
1184
-
1185
- /***/ }),
1186
-
1187
- /***/ "../../node_modules/lodash/isBuffer.js":
1188
- /*!********************************************************!*\
1189
- !*** /root/amplify-js/node_modules/lodash/isBuffer.js ***!
1190
- \********************************************************/
1191
- /*! no static exports found */
1192
- /***/ (function(module, exports, __webpack_require__) {
1193
-
1194
- /* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(/*! ./_root */ "../../node_modules/lodash/_root.js"),
1195
- stubFalse = __webpack_require__(/*! ./stubFalse */ "../../node_modules/lodash/stubFalse.js");
1196
-
1197
- /** Detect free variable `exports`. */
1198
- var freeExports = true && exports && !exports.nodeType && exports;
1199
-
1200
- /** Detect free variable `module`. */
1201
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
1202
-
1203
- /** Detect the popular CommonJS extension `module.exports`. */
1204
- var moduleExports = freeModule && freeModule.exports === freeExports;
1205
-
1206
- /** Built-in value references. */
1207
- var Buffer = moduleExports ? root.Buffer : undefined;
1208
-
1209
- /* Built-in method references for those with the same name as other `lodash` methods. */
1210
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1211
-
1212
- /**
1213
- * Checks if `value` is a buffer.
1214
- *
1215
- * @static
1216
- * @memberOf _
1217
- * @since 4.3.0
1218
- * @category Lang
1219
- * @param {*} value The value to check.
1220
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1221
- * @example
1222
- *
1223
- * _.isBuffer(new Buffer(2));
1224
- * // => true
1225
- *
1226
- * _.isBuffer(new Uint8Array(2));
1227
- * // => false
1228
- */
1229
- var isBuffer = nativeIsBuffer || stubFalse;
1230
-
1231
- module.exports = isBuffer;
1232
-
1233
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "../../node_modules/webpack/buildin/module.js")(module)))
1234
-
1235
- /***/ }),
1236
-
1237
- /***/ "../../node_modules/lodash/isEmpty.js":
1238
- /*!*******************************************************!*\
1239
- !*** /root/amplify-js/node_modules/lodash/isEmpty.js ***!
1240
- \*******************************************************/
1241
- /*! no static exports found */
1242
- /***/ (function(module, exports, __webpack_require__) {
1243
-
1244
- var baseKeys = __webpack_require__(/*! ./_baseKeys */ "../../node_modules/lodash/_baseKeys.js"),
1245
- getTag = __webpack_require__(/*! ./_getTag */ "../../node_modules/lodash/_getTag.js"),
1246
- isArguments = __webpack_require__(/*! ./isArguments */ "../../node_modules/lodash/isArguments.js"),
1247
- isArray = __webpack_require__(/*! ./isArray */ "../../node_modules/lodash/isArray.js"),
1248
- isArrayLike = __webpack_require__(/*! ./isArrayLike */ "../../node_modules/lodash/isArrayLike.js"),
1249
- isBuffer = __webpack_require__(/*! ./isBuffer */ "../../node_modules/lodash/isBuffer.js"),
1250
- isPrototype = __webpack_require__(/*! ./_isPrototype */ "../../node_modules/lodash/_isPrototype.js"),
1251
- isTypedArray = __webpack_require__(/*! ./isTypedArray */ "../../node_modules/lodash/isTypedArray.js");
1252
-
1253
- /** `Object#toString` result references. */
1254
- var mapTag = '[object Map]',
1255
- setTag = '[object Set]';
1256
-
1257
- /** Used for built-in method references. */
1258
- var objectProto = Object.prototype;
1259
-
1260
- /** Used to check objects for own properties. */
1261
- var hasOwnProperty = objectProto.hasOwnProperty;
1262
-
1263
- /**
1264
- * Checks if `value` is an empty object, collection, map, or set.
1265
- *
1266
- * Objects are considered empty if they have no own enumerable string keyed
1267
- * properties.
1268
- *
1269
- * Array-like values such as `arguments` objects, arrays, buffers, strings, or
1270
- * jQuery-like collections are considered empty if they have a `length` of `0`.
1271
- * Similarly, maps and sets are considered empty if they have a `size` of `0`.
1272
- *
1273
- * @static
1274
- * @memberOf _
1275
- * @since 0.1.0
1276
- * @category Lang
1277
- * @param {*} value The value to check.
1278
- * @returns {boolean} Returns `true` if `value` is empty, else `false`.
1279
- * @example
1280
- *
1281
- * _.isEmpty(null);
1282
- * // => true
1283
- *
1284
- * _.isEmpty(true);
1285
- * // => true
1286
- *
1287
- * _.isEmpty(1);
1288
- * // => true
1289
- *
1290
- * _.isEmpty([1, 2, 3]);
1291
- * // => false
1292
- *
1293
- * _.isEmpty({ 'a': 1 });
1294
- * // => false
1295
- */
1296
- function isEmpty(value) {
1297
- if (value == null) {
1298
- return true;
1299
- }
1300
- if (isArrayLike(value) &&
1301
- (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
1302
- isBuffer(value) || isTypedArray(value) || isArguments(value))) {
1303
- return !value.length;
1304
- }
1305
- var tag = getTag(value);
1306
- if (tag == mapTag || tag == setTag) {
1307
- return !value.size;
1308
- }
1309
- if (isPrototype(value)) {
1310
- return !baseKeys(value).length;
1311
- }
1312
- for (var key in value) {
1313
- if (hasOwnProperty.call(value, key)) {
1314
- return false;
1315
- }
1316
- }
1317
- return true;
1318
- }
1319
-
1320
- module.exports = isEmpty;
1321
-
1322
-
1323
- /***/ }),
1324
-
1325
- /***/ "../../node_modules/lodash/isFunction.js":
1326
- /*!**********************************************************!*\
1327
- !*** /root/amplify-js/node_modules/lodash/isFunction.js ***!
1328
- \**********************************************************/
1329
- /*! no static exports found */
1330
- /***/ (function(module, exports, __webpack_require__) {
1331
-
1332
- var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "../../node_modules/lodash/_baseGetTag.js"),
1333
- isObject = __webpack_require__(/*! ./isObject */ "../../node_modules/lodash/isObject.js");
1334
-
1335
- /** `Object#toString` result references. */
1336
- var asyncTag = '[object AsyncFunction]',
1337
- funcTag = '[object Function]',
1338
- genTag = '[object GeneratorFunction]',
1339
- proxyTag = '[object Proxy]';
1340
-
1341
- /**
1342
- * Checks if `value` is classified as a `Function` object.
1343
- *
1344
- * @static
1345
- * @memberOf _
1346
- * @since 0.1.0
1347
- * @category Lang
1348
- * @param {*} value The value to check.
1349
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1350
- * @example
1351
- *
1352
- * _.isFunction(_);
1353
- * // => true
1354
- *
1355
- * _.isFunction(/abc/);
1356
- * // => false
1357
- */
1358
- function isFunction(value) {
1359
- if (!isObject(value)) {
1360
- return false;
1361
- }
1362
- // The use of `Object#toString` avoids issues with the `typeof` operator
1363
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
1364
- var tag = baseGetTag(value);
1365
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1366
- }
1367
-
1368
- module.exports = isFunction;
1369
-
1370
-
1371
- /***/ }),
1372
-
1373
- /***/ "../../node_modules/lodash/isLength.js":
1374
- /*!********************************************************!*\
1375
- !*** /root/amplify-js/node_modules/lodash/isLength.js ***!
1376
- \********************************************************/
1377
- /*! no static exports found */
1378
- /***/ (function(module, exports) {
1379
-
1380
- /** Used as references for various `Number` constants. */
1381
- var MAX_SAFE_INTEGER = 9007199254740991;
1382
-
1383
- /**
1384
- * Checks if `value` is a valid array-like length.
1385
- *
1386
- * **Note:** This method is loosely based on
1387
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1388
- *
1389
- * @static
1390
- * @memberOf _
1391
- * @since 4.0.0
1392
- * @category Lang
1393
- * @param {*} value The value to check.
1394
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1395
- * @example
1396
- *
1397
- * _.isLength(3);
1398
- * // => true
1399
- *
1400
- * _.isLength(Number.MIN_VALUE);
1401
- * // => false
1402
- *
1403
- * _.isLength(Infinity);
1404
- * // => false
1405
- *
1406
- * _.isLength('3');
1407
- * // => false
1408
- */
1409
- function isLength(value) {
1410
- return typeof value == 'number' &&
1411
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1412
- }
1413
-
1414
- module.exports = isLength;
1415
-
1416
-
1417
- /***/ }),
1418
-
1419
- /***/ "../../node_modules/lodash/isObject.js":
1420
- /*!********************************************************!*\
1421
- !*** /root/amplify-js/node_modules/lodash/isObject.js ***!
1422
- \********************************************************/
1423
- /*! no static exports found */
1424
- /***/ (function(module, exports) {
1425
-
1426
- /**
1427
- * Checks if `value` is the
1428
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1429
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1430
- *
1431
- * @static
1432
- * @memberOf _
1433
- * @since 0.1.0
1434
- * @category Lang
1435
- * @param {*} value The value to check.
1436
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1437
- * @example
1438
- *
1439
- * _.isObject({});
1440
- * // => true
1441
- *
1442
- * _.isObject([1, 2, 3]);
1443
- * // => true
1444
- *
1445
- * _.isObject(_.noop);
1446
- * // => true
1447
- *
1448
- * _.isObject(null);
1449
- * // => false
1450
- */
1451
- function isObject(value) {
1452
- var type = typeof value;
1453
- return value != null && (type == 'object' || type == 'function');
1454
- }
1455
-
1456
- module.exports = isObject;
1457
-
1458
-
1459
- /***/ }),
1460
-
1461
- /***/ "../../node_modules/lodash/isObjectLike.js":
1462
- /*!************************************************************!*\
1463
- !*** /root/amplify-js/node_modules/lodash/isObjectLike.js ***!
1464
- \************************************************************/
1465
- /*! no static exports found */
1466
- /***/ (function(module, exports) {
1467
-
1468
- /**
1469
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1470
- * and has a `typeof` result of "object".
1471
- *
1472
- * @static
1473
- * @memberOf _
1474
- * @since 4.0.0
1475
- * @category Lang
1476
- * @param {*} value The value to check.
1477
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1478
- * @example
1479
- *
1480
- * _.isObjectLike({});
1481
- * // => true
1482
- *
1483
- * _.isObjectLike([1, 2, 3]);
1484
- * // => true
1485
- *
1486
- * _.isObjectLike(_.noop);
1487
- * // => false
1488
- *
1489
- * _.isObjectLike(null);
1490
- * // => false
1491
- */
1492
- function isObjectLike(value) {
1493
- return value != null && typeof value == 'object';
1494
- }
1495
-
1496
- module.exports = isObjectLike;
1497
-
1498
-
1499
- /***/ }),
1500
-
1501
- /***/ "../../node_modules/lodash/isTypedArray.js":
1502
- /*!************************************************************!*\
1503
- !*** /root/amplify-js/node_modules/lodash/isTypedArray.js ***!
1504
- \************************************************************/
1505
- /*! no static exports found */
1506
- /***/ (function(module, exports, __webpack_require__) {
1507
-
1508
- var baseIsTypedArray = __webpack_require__(/*! ./_baseIsTypedArray */ "../../node_modules/lodash/_baseIsTypedArray.js"),
1509
- baseUnary = __webpack_require__(/*! ./_baseUnary */ "../../node_modules/lodash/_baseUnary.js"),
1510
- nodeUtil = __webpack_require__(/*! ./_nodeUtil */ "../../node_modules/lodash/_nodeUtil.js");
1511
-
1512
- /* Node.js helper references. */
1513
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1514
-
1515
- /**
1516
- * Checks if `value` is classified as a typed array.
1517
- *
1518
- * @static
1519
- * @memberOf _
1520
- * @since 3.0.0
1521
- * @category Lang
1522
- * @param {*} value The value to check.
1523
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1524
- * @example
1525
- *
1526
- * _.isTypedArray(new Uint8Array);
1527
- * // => true
1528
- *
1529
- * _.isTypedArray([]);
1530
- * // => false
1531
- */
1532
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1533
-
1534
- module.exports = isTypedArray;
1535
-
1536
-
1537
- /***/ }),
1538
-
1539
- /***/ "../../node_modules/lodash/noop.js":
1540
- /*!****************************************************!*\
1541
- !*** /root/amplify-js/node_modules/lodash/noop.js ***!
1542
- \****************************************************/
1543
- /*! no static exports found */
1544
- /***/ (function(module, exports) {
1545
-
1546
- /**
1547
- * This method returns `undefined`.
1548
- *
1549
- * @static
1550
- * @memberOf _
1551
- * @since 2.3.0
1552
- * @category Util
1553
- * @example
1554
- *
1555
- * _.times(2, _.noop);
1556
- * // => [undefined, undefined]
1557
- */
1558
- function noop() {
1559
- // No operation performed.
1560
- }
1561
-
1562
- module.exports = noop;
1563
-
1564
-
1565
- /***/ }),
1566
-
1567
- /***/ "../../node_modules/lodash/stubFalse.js":
1568
- /*!*********************************************************!*\
1569
- !*** /root/amplify-js/node_modules/lodash/stubFalse.js ***!
1570
- \*********************************************************/
1571
- /*! no static exports found */
1572
- /***/ (function(module, exports) {
1573
-
1574
- /**
1575
- * This method returns `false`.
1576
- *
1577
- * @static
1578
- * @memberOf _
1579
- * @since 4.13.0
1580
- * @category Util
1581
- * @returns {boolean} Returns `false`.
1582
- * @example
1583
- *
1584
- * _.times(2, _.stubFalse);
1585
- * // => [false, false]
1586
- */
1587
- function stubFalse() {
1588
- return false;
1589
- }
1590
-
1591
- module.exports = stubFalse;
1592
-
1593
-
1594
- /***/ }),
1595
-
1596
- /***/ "../../node_modules/uuid/index.js":
1597
- /*!***************************************************!*\
1598
- !*** /root/amplify-js/node_modules/uuid/index.js ***!
1599
- \***************************************************/
1600
- /*! no static exports found */
1601
- /***/ (function(module, exports, __webpack_require__) {
1602
-
1603
- var v1 = __webpack_require__(/*! ./v1 */ "../../node_modules/uuid/v1.js");
1604
- var v4 = __webpack_require__(/*! ./v4 */ "../../node_modules/uuid/v4.js");
1605
-
1606
- var uuid = v4;
1607
- uuid.v1 = v1;
1608
- uuid.v4 = v4;
1609
-
1610
- module.exports = uuid;
1611
-
1612
-
1613
- /***/ }),
1614
-
1615
- /***/ "../../node_modules/uuid/lib/bytesToUuid.js":
1616
- /*!*************************************************************!*\
1617
- !*** /root/amplify-js/node_modules/uuid/lib/bytesToUuid.js ***!
1618
- \*************************************************************/
1619
- /*! no static exports found */
1620
- /***/ (function(module, exports) {
1621
-
1622
- /**
1623
- * Convert array of 16 byte values to UUID string format of the form:
1624
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
1625
- */
1626
- var byteToHex = [];
1627
- for (var i = 0; i < 256; ++i) {
1628
- byteToHex[i] = (i + 0x100).toString(16).substr(1);
1629
- }
1630
-
1631
- function bytesToUuid(buf, offset) {
1632
- var i = offset || 0;
1633
- var bth = byteToHex;
1634
- // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
1635
- return ([
1636
- bth[buf[i++]], bth[buf[i++]],
1637
- bth[buf[i++]], bth[buf[i++]], '-',
1638
- bth[buf[i++]], bth[buf[i++]], '-',
1639
- bth[buf[i++]], bth[buf[i++]], '-',
1640
- bth[buf[i++]], bth[buf[i++]], '-',
1641
- bth[buf[i++]], bth[buf[i++]],
1642
- bth[buf[i++]], bth[buf[i++]],
1643
- bth[buf[i++]], bth[buf[i++]]
1644
- ]).join('');
1645
- }
1646
-
1647
- module.exports = bytesToUuid;
1648
-
1649
-
1650
- /***/ }),
1651
-
1652
- /***/ "../../node_modules/uuid/lib/rng-browser.js":
1653
- /*!*************************************************************!*\
1654
- !*** /root/amplify-js/node_modules/uuid/lib/rng-browser.js ***!
1655
- \*************************************************************/
1656
- /*! no static exports found */
1657
- /***/ (function(module, exports) {
1658
-
1659
- // Unique ID creation requires a high quality random # generator. In the
1660
- // browser this is a little complicated due to unknown quality of Math.random()
1661
- // and inconsistent support for the `crypto` API. We do the best we can via
1662
- // feature-detection
1663
-
1664
- // getRandomValues needs to be invoked in a context where "this" is a Crypto
1665
- // implementation. Also, find the complete implementation of crypto on IE11.
1666
- var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
1667
- (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
1668
-
1669
- if (getRandomValues) {
1670
- // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
1671
- var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
1672
-
1673
- module.exports = function whatwgRNG() {
1674
- getRandomValues(rnds8);
1675
- return rnds8;
1676
- };
1677
- } else {
1678
- // Math.random()-based (RNG)
1679
- //
1680
- // If all else fails, use Math.random(). It's fast, but is of unspecified
1681
- // quality.
1682
- var rnds = new Array(16);
1683
-
1684
- module.exports = function mathRNG() {
1685
- for (var i = 0, r; i < 16; i++) {
1686
- if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
1687
- rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
1688
- }
1689
-
1690
- return rnds;
1691
- };
1692
- }
1693
-
1694
-
1695
- /***/ }),
1696
-
1697
- /***/ "../../node_modules/uuid/v1.js":
1698
- /*!************************************************!*\
1699
- !*** /root/amplify-js/node_modules/uuid/v1.js ***!
1700
- \************************************************/
1701
- /*! no static exports found */
1702
- /***/ (function(module, exports, __webpack_require__) {
1703
-
1704
- var rng = __webpack_require__(/*! ./lib/rng */ "../../node_modules/uuid/lib/rng-browser.js");
1705
- var bytesToUuid = __webpack_require__(/*! ./lib/bytesToUuid */ "../../node_modules/uuid/lib/bytesToUuid.js");
1706
-
1707
- // **`v1()` - Generate time-based UUID**
1708
- //
1709
- // Inspired by https://github.com/LiosK/UUID.js
1710
- // and http://docs.python.org/library/uuid.html
1711
-
1712
- var _nodeId;
1713
- var _clockseq;
1714
-
1715
- // Previous uuid creation time
1716
- var _lastMSecs = 0;
1717
- var _lastNSecs = 0;
1718
-
1719
- // See https://github.com/uuidjs/uuid for API details
1720
- function v1(options, buf, offset) {
1721
- var i = buf && offset || 0;
1722
- var b = buf || [];
1723
-
1724
- options = options || {};
1725
- var node = options.node || _nodeId;
1726
- var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
1727
-
1728
- // node and clockseq need to be initialized to random values if they're not
1729
- // specified. We do this lazily to minimize issues related to insufficient
1730
- // system entropy. See #189
1731
- if (node == null || clockseq == null) {
1732
- var seedBytes = rng();
1733
- if (node == null) {
1734
- // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
1735
- node = _nodeId = [
1736
- seedBytes[0] | 0x01,
1737
- seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
1738
- ];
1739
- }
1740
- if (clockseq == null) {
1741
- // Per 4.2.2, randomize (14 bit) clockseq
1742
- clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
1743
- }
1744
- }
1745
-
1746
- // UUID timestamps are 100 nano-second units since the Gregorian epoch,
1747
- // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
1748
- // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
1749
- // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
1750
- var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
1751
-
1752
- // Per 4.2.1.2, use count of uuid's generated during the current clock
1753
- // cycle to simulate higher resolution clock
1754
- var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
1755
-
1756
- // Time since last uuid creation (in msecs)
1757
- var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
1758
-
1759
- // Per 4.2.1.2, Bump clockseq on clock regression
1760
- if (dt < 0 && options.clockseq === undefined) {
1761
- clockseq = clockseq + 1 & 0x3fff;
1762
- }
1763
-
1764
- // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
1765
- // time interval
1766
- if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
1767
- nsecs = 0;
1768
- }
1769
-
1770
- // Per 4.2.1.2 Throw error if too many uuids are requested
1771
- if (nsecs >= 10000) {
1772
- throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
1773
- }
1774
-
1775
- _lastMSecs = msecs;
1776
- _lastNSecs = nsecs;
1777
- _clockseq = clockseq;
1778
-
1779
- // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
1780
- msecs += 12219292800000;
1781
-
1782
- // `time_low`
1783
- var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
1784
- b[i++] = tl >>> 24 & 0xff;
1785
- b[i++] = tl >>> 16 & 0xff;
1786
- b[i++] = tl >>> 8 & 0xff;
1787
- b[i++] = tl & 0xff;
1788
-
1789
- // `time_mid`
1790
- var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
1791
- b[i++] = tmh >>> 8 & 0xff;
1792
- b[i++] = tmh & 0xff;
1793
-
1794
- // `time_high_and_version`
1795
- b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
1796
- b[i++] = tmh >>> 16 & 0xff;
1797
-
1798
- // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
1799
- b[i++] = clockseq >>> 8 | 0x80;
1800
-
1801
- // `clock_seq_low`
1802
- b[i++] = clockseq & 0xff;
1803
-
1804
- // `node`
1805
- for (var n = 0; n < 6; ++n) {
1806
- b[i + n] = node[n];
1807
- }
1808
-
1809
- return buf ? buf : bytesToUuid(b);
1810
- }
1811
-
1812
- module.exports = v1;
1813
-
1814
-
1815
- /***/ }),
1816
-
1817
- /***/ "../../node_modules/uuid/v4.js":
1818
- /*!************************************************!*\
1819
- !*** /root/amplify-js/node_modules/uuid/v4.js ***!
1820
- \************************************************/
1821
- /*! no static exports found */
1822
- /***/ (function(module, exports, __webpack_require__) {
1823
-
1824
- var rng = __webpack_require__(/*! ./lib/rng */ "../../node_modules/uuid/lib/rng-browser.js");
1825
- var bytesToUuid = __webpack_require__(/*! ./lib/bytesToUuid */ "../../node_modules/uuid/lib/bytesToUuid.js");
1826
-
1827
- function v4(options, buf, offset) {
1828
- var i = buf && offset || 0;
1829
-
1830
- if (typeof(options) == 'string') {
1831
- buf = options === 'binary' ? new Array(16) : null;
1832
- options = null;
1833
- }
1834
- options = options || {};
1835
-
1836
- var rnds = options.random || (options.rng || rng)();
1837
-
1838
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
1839
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
1840
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
1841
-
1842
- // Copy bytes to buffer, if provided
1843
- if (buf) {
1844
- for (var ii = 0; ii < 16; ++ii) {
1845
- buf[i + ii] = rnds[ii];
1846
- }
1847
- }
1848
-
1849
- return buf || bytesToUuid(rnds);
1850
- }
1851
-
1852
- module.exports = v4;
1853
-
1854
-
1855
- /***/ }),
1856
-
1857
- /***/ "../../node_modules/webpack/buildin/global.js":
1858
- /*!***********************************!*\
1859
- !*** (webpack)/buildin/global.js ***!
1860
- \***********************************/
1861
- /*! no static exports found */
1862
- /***/ (function(module, exports) {
1863
-
1864
- var g;
1865
-
1866
- // This works in non-strict mode
1867
- g = (function() {
1868
- return this;
1869
- })();
1870
-
1871
- try {
1872
- // This works if eval is allowed (see CSP)
1873
- g = g || new Function("return this")();
1874
- } catch (e) {
1875
- // This works if the window reference is available
1876
- if (typeof window === "object") g = window;
1877
- }
1878
-
1879
- // g can still be undefined, but nothing to do about it...
1880
- // We return undefined, instead of nothing here, so it's
1881
- // easier to handle this case. if(!global) { ...}
1882
-
1883
- module.exports = g;
1884
-
1885
-
1886
- /***/ }),
1887
-
1888
- /***/ "../../node_modules/webpack/buildin/module.js":
1889
- /*!***********************************!*\
1890
- !*** (webpack)/buildin/module.js ***!
1891
- \***********************************/
1892
- /*! no static exports found */
1893
- /***/ (function(module, exports) {
1894
-
1895
- module.exports = function(module) {
1896
- if (!module.webpackPolyfill) {
1897
- module.deprecate = function() {};
1898
- module.paths = [];
1899
- // module.parent = undefined by default
1900
- if (!module.children) module.children = [];
1901
- Object.defineProperty(module, "loaded", {
1902
- enumerable: true,
1903
- get: function() {
1904
- return module.l;
1905
- }
1906
- });
1907
- Object.defineProperty(module, "id", {
1908
- enumerable: true,
1909
- get: function() {
1910
- return module.i;
1911
- }
1912
- });
1913
- module.webpackPolyfill = 1;
1914
- }
1915
- return module;
1916
- };
1917
-
1918
-
1919
- /***/ }),
1920
-
1921
- /***/ "./lib-esm/InAppMessaging/InAppMessaging.js":
1922
- /*!**************************************************!*\
1923
- !*** ./lib-esm/InAppMessaging/InAppMessaging.js ***!
1924
- \**************************************************/
1925
- /*! exports provided: default */
1926
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1927
-
1928
- "use strict";
1929
- __webpack_require__.r(__webpack_exports__);
1930
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
1931
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
1932
- /* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/flatten */ "../../node_modules/lodash/flatten.js");
1933
- /* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_flatten__WEBPACK_IMPORTED_MODULE_1__);
1934
- /* harmony import */ var _Providers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Providers */ "./lib-esm/InAppMessaging/Providers/index.js");
1935
- /* harmony import */ var _eventListeners__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./eventListeners */ "./lib-esm/InAppMessaging/eventListeners.js");
1936
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./types */ "./lib-esm/InAppMessaging/types.js");
1937
- /*
1938
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1939
- *
1940
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
1941
- * the License. A copy of the License is located at
1942
- *
1943
- * http://aws.amazon.com/apache2.0/
1944
- *
1945
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
1946
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
1947
- * and limitations under the License.
1948
- */
1949
- var __assign = undefined && undefined.__assign || function () {
1950
- __assign = Object.assign || function (t) {
1951
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1952
- s = arguments[i];
1953
-
1954
- for (var p in s) {
1955
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1956
- }
1957
- }
1958
-
1959
- return t;
1960
- };
1961
-
1962
- return __assign.apply(this, arguments);
1963
- };
1964
-
1965
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
1966
- function adopt(value) {
1967
- return value instanceof P ? value : new P(function (resolve) {
1968
- resolve(value);
1969
- });
1970
- }
1971
-
1972
- return new (P || (P = Promise))(function (resolve, reject) {
1973
- function fulfilled(value) {
1974
- try {
1975
- step(generator.next(value));
1976
- } catch (e) {
1977
- reject(e);
1978
- }
1979
- }
1980
-
1981
- function rejected(value) {
1982
- try {
1983
- step(generator["throw"](value));
1984
- } catch (e) {
1985
- reject(e);
1986
- }
1987
- }
1988
-
1989
- function step(result) {
1990
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1991
- }
1992
-
1993
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1994
- });
1995
- };
1996
-
1997
- var __generator = undefined && undefined.__generator || function (thisArg, body) {
1998
- var _ = {
1999
- label: 0,
2000
- sent: function sent() {
2001
- if (t[0] & 1) throw t[1];
2002
- return t[1];
2003
- },
2004
- trys: [],
2005
- ops: []
2006
- },
2007
- f,
2008
- y,
2009
- t,
2010
- g;
2011
- return g = {
2012
- next: verb(0),
2013
- "throw": verb(1),
2014
- "return": verb(2)
2015
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
2016
- return this;
2017
- }), g;
2018
-
2019
- function verb(n) {
2020
- return function (v) {
2021
- return step([n, v]);
2022
- };
2023
- }
2024
-
2025
- function step(op) {
2026
- if (f) throw new TypeError("Generator is already executing.");
2027
-
2028
- while (_) {
2029
- try {
2030
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2031
- if (y = 0, t) op = [op[0] & 2, t.value];
2032
-
2033
- switch (op[0]) {
2034
- case 0:
2035
- case 1:
2036
- t = op;
2037
- break;
2038
-
2039
- case 4:
2040
- _.label++;
2041
- return {
2042
- value: op[1],
2043
- done: false
2044
- };
2045
-
2046
- case 5:
2047
- _.label++;
2048
- y = op[1];
2049
- op = [0];
2050
- continue;
2051
-
2052
- case 7:
2053
- op = _.ops.pop();
2054
-
2055
- _.trys.pop();
2056
-
2057
- continue;
2058
-
2059
- default:
2060
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
2061
- _ = 0;
2062
- continue;
2063
- }
2064
-
2065
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
2066
- _.label = op[1];
2067
- break;
2068
- }
2069
-
2070
- if (op[0] === 6 && _.label < t[1]) {
2071
- _.label = t[1];
2072
- t = op;
2073
- break;
2074
- }
2075
-
2076
- if (t && _.label < t[2]) {
2077
- _.label = t[2];
2078
-
2079
- _.ops.push(op);
2080
-
2081
- break;
2082
- }
2083
-
2084
- if (t[2]) _.ops.pop();
2085
-
2086
- _.trys.pop();
2087
-
2088
- continue;
2089
- }
2090
-
2091
- op = body.call(thisArg, _);
2092
- } catch (e) {
2093
- op = [6, e];
2094
- y = 0;
2095
- } finally {
2096
- f = t = 0;
2097
- }
2098
- }
2099
-
2100
- if (op[0] & 5) throw op[1];
2101
- return {
2102
- value: op[0] ? op[1] : void 0,
2103
- done: true
2104
- };
2105
- }
2106
- };
2107
-
2108
- var __rest = undefined && undefined.__rest || function (s, e) {
2109
- var t = {};
2110
-
2111
- for (var p in s) {
2112
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2113
- }
2114
-
2115
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2116
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2117
- }
2118
- return t;
2119
- };
2120
-
2121
-
2122
-
2123
-
2124
-
2125
-
2126
- var STORAGE_KEY_SUFFIX = '_inAppMessages';
2127
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('Notifications.InAppMessaging');
2128
-
2129
- var InAppMessaging =
2130
- /** @class */
2131
- function () {
2132
- function InAppMessaging() {
2133
- var _this = this;
2134
-
2135
- this.config = {};
2136
- this.listeningForAnalyticEvents = false;
2137
- this.pluggables = [];
2138
- this.storageSynced = false;
2139
- /**
2140
- * Configure InAppMessaging
2141
- * @param {Object} config - InAppMessaging configuration object
2142
- */
2143
-
2144
- this.configure = function (_a) {
2145
- if (_a === void 0) {
2146
- _a = {};
2147
- }
2148
-
2149
- var _b = _a.listenForAnalyticsEvents,
2150
- listenForAnalyticsEvents = _b === void 0 ? true : _b,
2151
- config = __rest(_a, ["listenForAnalyticsEvents"]);
2152
-
2153
- _this.config = __assign(__assign({}, _this.config), config);
2154
- logger.debug('configure InAppMessaging', _this.config);
2155
-
2156
- _this.pluggables.forEach(function (pluggable) {
2157
- pluggable.configure(_this.config[pluggable.getProviderName()]);
2158
- });
2159
-
2160
- if (_this.pluggables.length === 0) {
2161
- _this.addPluggable(new _Providers__WEBPACK_IMPORTED_MODULE_2__["AWSPinpointProvider"]());
2162
- }
2163
-
2164
- if (listenForAnalyticsEvents && !_this.listeningForAnalyticEvents) {
2165
- _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Hub"].listen('analytics', _this.analyticsListener);
2166
- _this.listeningForAnalyticEvents = true;
2167
- }
2168
-
2169
- return _this.config;
2170
- };
2171
- /**
2172
- * Get a plugin from added plugins
2173
- * @param {string} providerName - the name of the plugin to get
2174
- */
2175
-
2176
-
2177
- this.getPluggable = function (providerName) {
2178
- var _a;
2179
-
2180
- var pluggable = (_a = _this.pluggables.find(function (pluggable) {
2181
- return pluggable.getProviderName() === providerName;
2182
- })) !== null && _a !== void 0 ? _a : null;
2183
-
2184
- if (!pluggable) {
2185
- logger.debug("No plugin found with name " + providerName);
2186
- }
2187
-
2188
- return pluggable;
2189
- };
2190
- /**
2191
- * Add plugin into InAppMessaging
2192
- * @param {InAppMessagingProvider} pluggable - an instance of the plugin
2193
- */
2194
-
2195
-
2196
- this.addPluggable = function (pluggable) {
2197
- if (pluggable && pluggable.getCategory() === 'Notifications' && pluggable.getSubCategory() === 'InAppMessaging') {
2198
- if (_this.getPluggable(pluggable.getProviderName())) {
2199
- throw new Error("Pluggable " + pluggable.getProviderName() + " has already been added.");
2200
- }
2201
-
2202
- _this.pluggables.push(pluggable);
2203
-
2204
- pluggable.configure(_this.config[pluggable.getProviderName()]);
2205
- }
2206
- };
2207
- /**
2208
- * Remove a plugin from added plugins
2209
- * @param {string} providerName - the name of the plugin to remove
2210
- */
2211
-
2212
-
2213
- this.removePluggable = function (providerName) {
2214
- var index = _this.pluggables.findIndex(function (pluggable) {
2215
- return pluggable.getProviderName() === providerName;
2216
- });
2217
-
2218
- if (index === -1) {
2219
- logger.debug("No plugin found with name " + providerName);
2220
- } else {
2221
- _this.pluggables.splice(index, 1);
2222
- }
2223
- };
2224
- /**
2225
- * Get the map resources that are currently available through the provider
2226
- * @param {string} provider
2227
- * @returns - Array of available map resources
2228
- */
2229
-
2230
-
2231
- this.syncMessages = function () {
2232
- return Promise.all(_this.pluggables.map(function (pluggable) {
2233
- return __awaiter(_this, void 0, void 0, function () {
2234
- var messages, key, err_1;
2235
- return __generator(this, function (_a) {
2236
- switch (_a.label) {
2237
- case 0:
2238
- _a.trys.push([0, 3,, 4]);
2239
-
2240
- return [4
2241
- /*yield*/
2242
- , pluggable.getInAppMessages()];
2243
-
2244
- case 1:
2245
- messages = _a.sent();
2246
- key = "" + pluggable.getProviderName() + STORAGE_KEY_SUFFIX;
2247
- return [4
2248
- /*yield*/
2249
- , this.setMessages(key, messages)];
2250
-
2251
- case 2:
2252
- _a.sent();
2253
-
2254
- return [3
2255
- /*break*/
2256
- , 4];
2257
-
2258
- case 3:
2259
- err_1 = _a.sent();
2260
- logger.error('Failed to sync messages', err_1);
2261
- throw err_1;
2262
-
2263
- case 4:
2264
- return [2
2265
- /*return*/
2266
- ];
2267
- }
2268
- });
2269
- });
2270
- }));
2271
- };
2272
-
2273
- this.clearMessages = function () {
2274
- return Promise.all(_this.pluggables.map(function (pluggable) {
2275
- return __awaiter(_this, void 0, void 0, function () {
2276
- var key;
2277
- return __generator(this, function (_a) {
2278
- switch (_a.label) {
2279
- case 0:
2280
- key = "" + pluggable.getProviderName() + STORAGE_KEY_SUFFIX;
2281
- return [4
2282
- /*yield*/
2283
- , this.removeMessages(key)];
2284
-
2285
- case 1:
2286
- _a.sent();
2287
-
2288
- return [2
2289
- /*return*/
2290
- ];
2291
- }
2292
- });
2293
- });
2294
- }));
2295
- };
2296
-
2297
- this.dispatchEvent = function (event) {
2298
- return __awaiter(_this, void 0, void 0, function () {
2299
- var messages, flattenedMessages;
2300
-
2301
- var _this = this;
2302
-
2303
- return __generator(this, function (_a) {
2304
- switch (_a.label) {
2305
- case 0:
2306
- return [4
2307
- /*yield*/
2308
- , Promise.all(this.pluggables.map(function (pluggable) {
2309
- return __awaiter(_this, void 0, void 0, function () {
2310
- var key, messages;
2311
- return __generator(this, function (_a) {
2312
- switch (_a.label) {
2313
- case 0:
2314
- key = "" + pluggable.getProviderName() + STORAGE_KEY_SUFFIX;
2315
- return [4
2316
- /*yield*/
2317
- , this.getMessages(key)];
2318
-
2319
- case 1:
2320
- messages = _a.sent();
2321
- return [2
2322
- /*return*/
2323
- , pluggable.processInAppMessages(messages, event)];
2324
- }
2325
- });
2326
- });
2327
- }))];
2328
-
2329
- case 1:
2330
- messages = _a.sent();
2331
- flattenedMessages = lodash_flatten__WEBPACK_IMPORTED_MODULE_1___default()(messages);
2332
-
2333
- if (flattenedMessages.length) {
2334
- Object(_eventListeners__WEBPACK_IMPORTED_MODULE_3__["notifyMessageInteractionEventListeners"])(this.conflictHandler(flattenedMessages), _types__WEBPACK_IMPORTED_MODULE_4__["InAppMessageInteractionEvent"].MESSAGE_RECEIVED);
2335
- }
2336
-
2337
- return [2
2338
- /*return*/
2339
- ];
2340
- }
2341
- });
2342
- });
2343
- };
2344
-
2345
- this.identifyUser = function (userId, userInfo) {
2346
- return Promise.all(_this.pluggables.map(function (pluggable) {
2347
- return __awaiter(_this, void 0, void 0, function () {
2348
- var err_2;
2349
- return __generator(this, function (_a) {
2350
- switch (_a.label) {
2351
- case 0:
2352
- _a.trys.push([0, 2,, 3]);
2353
-
2354
- return [4
2355
- /*yield*/
2356
- , pluggable.identifyUser(userId, userInfo)];
2357
-
2358
- case 1:
2359
- _a.sent();
2360
-
2361
- return [3
2362
- /*break*/
2363
- , 3];
2364
-
2365
- case 2:
2366
- err_2 = _a.sent();
2367
- logger.error('Failed to identify user', err_2);
2368
- throw err_2;
2369
-
2370
- case 3:
2371
- return [2
2372
- /*return*/
2373
- ];
2374
- }
2375
- });
2376
- });
2377
- }));
2378
- };
2379
-
2380
- this.onMessageReceived = function (handler) {
2381
- return Object(_eventListeners__WEBPACK_IMPORTED_MODULE_3__["addMessageInteractionEventListener"])(handler, _types__WEBPACK_IMPORTED_MODULE_4__["InAppMessageInteractionEvent"].MESSAGE_RECEIVED);
2382
- };
2383
-
2384
- this.onMessageDisplayed = function (handler) {
2385
- return Object(_eventListeners__WEBPACK_IMPORTED_MODULE_3__["addMessageInteractionEventListener"])(handler, _types__WEBPACK_IMPORTED_MODULE_4__["InAppMessageInteractionEvent"].MESSAGE_DISPLAYED);
2386
- };
2387
-
2388
- this.onMessageDismissed = function (handler) {
2389
- return Object(_eventListeners__WEBPACK_IMPORTED_MODULE_3__["addMessageInteractionEventListener"])(handler, _types__WEBPACK_IMPORTED_MODULE_4__["InAppMessageInteractionEvent"].MESSAGE_DISMISSED);
2390
- };
2391
-
2392
- this.onMessageActionTaken = function (handler) {
2393
- return Object(_eventListeners__WEBPACK_IMPORTED_MODULE_3__["addMessageInteractionEventListener"])(handler, _types__WEBPACK_IMPORTED_MODULE_4__["InAppMessageInteractionEvent"].MESSAGE_ACTION_TAKEN);
2394
- };
2395
-
2396
- this.notifyMessageInteraction = function (message, event) {
2397
- Object(_eventListeners__WEBPACK_IMPORTED_MODULE_3__["notifyMessageInteractionEventListeners"])(message, event);
2398
- };
2399
-
2400
- this.setConflictHandler = function (handler) {
2401
- _this.conflictHandler = handler;
2402
- };
2403
-
2404
- this.analyticsListener = function (_a) {
2405
- var payload = _a.payload;
2406
- var event = payload.event,
2407
- data = payload.data;
2408
-
2409
- switch (event) {
2410
- case 'record':
2411
- {
2412
- _this.dispatchEvent(data);
2413
-
2414
- break;
2415
- }
2416
-
2417
- default:
2418
- break;
2419
- }
2420
- };
2421
-
2422
- this.syncStorage = function () {
2423
- return __awaiter(_this, void 0, void 0, function () {
2424
- var storage, err_3;
2425
- return __generator(this, function (_a) {
2426
- switch (_a.label) {
2427
- case 0:
2428
- storage = this.config.storage;
2429
- _a.label = 1;
2430
-
2431
- case 1:
2432
- _a.trys.push([1, 4,, 5]);
2433
-
2434
- if (!(typeof storage.sync === 'function')) return [3
2435
- /*break*/
2436
- , 3];
2437
- return [4
2438
- /*yield*/
2439
- , storage.sync()];
2440
-
2441
- case 2:
2442
- _a.sent();
2443
-
2444
- _a.label = 3;
2445
-
2446
- case 3:
2447
- this.storageSynced = true;
2448
- return [3
2449
- /*break*/
2450
- , 5];
2451
-
2452
- case 4:
2453
- err_3 = _a.sent();
2454
- logger.error('Failed to sync storage', err_3);
2455
- return [3
2456
- /*break*/
2457
- , 5];
2458
-
2459
- case 5:
2460
- return [2
2461
- /*return*/
2462
- ];
2463
- }
2464
- });
2465
- });
2466
- };
2467
-
2468
- this.getMessages = function (key) {
2469
- return __awaiter(_this, void 0, void 0, function () {
2470
- var storage, storedMessages, err_4;
2471
- return __generator(this, function (_a) {
2472
- switch (_a.label) {
2473
- case 0:
2474
- _a.trys.push([0, 3,, 4]);
2475
-
2476
- if (!!this.storageSynced) return [3
2477
- /*break*/
2478
- , 2];
2479
- return [4
2480
- /*yield*/
2481
- , this.syncStorage()];
2482
-
2483
- case 1:
2484
- _a.sent();
2485
-
2486
- _a.label = 2;
2487
-
2488
- case 2:
2489
- storage = this.config.storage;
2490
- storedMessages = storage.getItem(key);
2491
- return [2
2492
- /*return*/
2493
- , storedMessages ? JSON.parse(storedMessages) : []];
2494
-
2495
- case 3:
2496
- err_4 = _a.sent();
2497
- logger.error('Failed to retrieve in-app messages from storage', err_4);
2498
- return [3
2499
- /*break*/
2500
- , 4];
2501
-
2502
- case 4:
2503
- return [2
2504
- /*return*/
2505
- ];
2506
- }
2507
- });
2508
- });
2509
- };
2510
-
2511
- this.setMessages = function (key, messages) {
2512
- return __awaiter(_this, void 0, void 0, function () {
2513
- var storage, err_5;
2514
- return __generator(this, function (_a) {
2515
- switch (_a.label) {
2516
- case 0:
2517
- if (!messages) {
2518
- return [2
2519
- /*return*/
2520
- ];
2521
- }
2522
-
2523
- _a.label = 1;
2524
-
2525
- case 1:
2526
- _a.trys.push([1, 4,, 5]);
2527
-
2528
- if (!!this.storageSynced) return [3
2529
- /*break*/
2530
- , 3];
2531
- return [4
2532
- /*yield*/
2533
- , this.syncStorage()];
2534
-
2535
- case 2:
2536
- _a.sent();
2537
-
2538
- _a.label = 3;
2539
-
2540
- case 3:
2541
- storage = this.config.storage;
2542
- storage.setItem(key, JSON.stringify(messages));
2543
- return [3
2544
- /*break*/
2545
- , 5];
2546
-
2547
- case 4:
2548
- err_5 = _a.sent();
2549
- logger.error('Failed to store in-app messages', err_5);
2550
- return [3
2551
- /*break*/
2552
- , 5];
2553
-
2554
- case 5:
2555
- return [2
2556
- /*return*/
2557
- ];
2558
- }
2559
- });
2560
- });
2561
- };
2562
-
2563
- this.removeMessages = function (key) {
2564
- return __awaiter(_this, void 0, void 0, function () {
2565
- var storage, err_6;
2566
- return __generator(this, function (_a) {
2567
- switch (_a.label) {
2568
- case 0:
2569
- _a.trys.push([0, 3,, 4]);
2570
-
2571
- if (!!this.storageSynced) return [3
2572
- /*break*/
2573
- , 2];
2574
- return [4
2575
- /*yield*/
2576
- , this.syncStorage()];
2577
-
2578
- case 1:
2579
- _a.sent();
2580
-
2581
- _a.label = 2;
2582
-
2583
- case 2:
2584
- storage = this.config.storage;
2585
- storage.removeItem(key);
2586
- return [3
2587
- /*break*/
2588
- , 4];
2589
-
2590
- case 3:
2591
- err_6 = _a.sent();
2592
- logger.error('Failed to remove in-app messages from storage', err_6);
2593
- return [3
2594
- /*break*/
2595
- , 4];
2596
-
2597
- case 4:
2598
- return [2
2599
- /*return*/
2600
- ];
2601
- }
2602
- });
2603
- });
2604
- };
2605
-
2606
- this.defaultConflictHandler = function (messages) {
2607
- // default behavior is to return the message closest to expiry
2608
- // this function assumes that messages processed by providers already filters out expired messages
2609
- var sorted = messages.sort(function (a, b) {
2610
- var _a, _b;
2611
-
2612
- var endDateA = (_a = a.metadata) === null || _a === void 0 ? void 0 : _a.endDate;
2613
- var endDateB = (_b = b.metadata) === null || _b === void 0 ? void 0 : _b.endDate; // if both message end dates are falsy or have the same date string, treat them as equal
2614
-
2615
- if (endDateA === endDateB) {
2616
- return 0;
2617
- } // if only message A has an end date, treat it as closer to expiry
2618
-
2619
-
2620
- if (endDateA && !endDateB) {
2621
- return -1;
2622
- } // if only message B has an end date, treat it as closer to expiry
2623
-
2624
-
2625
- if (!endDateA && endDateB) {
2626
- return 1;
2627
- } // otherwise, compare them
2628
-
2629
-
2630
- return new Date(endDateA) < new Date(endDateB) ? -1 : 1;
2631
- }); // always return the top sorted
2632
-
2633
- return sorted[0];
2634
- };
2635
-
2636
- this.config = {
2637
- storage: new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["StorageHelper"]().getStorage()
2638
- };
2639
- this.setConflictHandler(this.defaultConflictHandler);
2640
- }
2641
- /**
2642
- * Get the name of this module
2643
- * @returns {string} name of this module
2644
- */
2645
-
2646
-
2647
- InAppMessaging.prototype.getModuleName = function () {
2648
- return 'InAppMessaging';
2649
- };
2650
-
2651
- return InAppMessaging;
2652
- }();
2653
-
2654
- /* harmony default export */ __webpack_exports__["default"] = (InAppMessaging);
2655
-
2656
- /***/ }),
2657
-
2658
- /***/ "./lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js":
2659
- /*!***********************************************************************!*\
2660
- !*** ./lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js ***!
2661
- \***********************************************************************/
2662
- /*! exports provided: default */
2663
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2664
-
2665
- "use strict";
2666
- __webpack_require__.r(__webpack_exports__);
2667
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
2668
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
2669
- /* harmony import */ var _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/cache */ "@aws-amplify/cache");
2670
- /* harmony import */ var _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_cache__WEBPACK_IMPORTED_MODULE_1__);
2671
- /* harmony import */ var _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-sdk/client-pinpoint */ "@aws-sdk/client-pinpoint");
2672
- /* harmony import */ var _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_2__);
2673
- /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uuid */ "../../node_modules/uuid/index.js");
2674
- /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(uuid__WEBPACK_IMPORTED_MODULE_3__);
2675
- /* harmony import */ var _eventListeners__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../eventListeners */ "./lib-esm/InAppMessaging/eventListeners.js");
2676
- /* harmony import */ var _SessionTracker__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../SessionTracker */ "./lib-esm/InAppMessaging/SessionTracker/index.js");
2677
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../types */ "./lib-esm/InAppMessaging/types.js");
2678
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./types */ "./lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js");
2679
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils */ "./lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js");
2680
- /*
2681
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2682
- *
2683
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
2684
- * the License. A copy of the License is located at
2685
- *
2686
- * http://aws.amazon.com/apache2.0/
2687
- *
2688
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
2689
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
2690
- * and limitations under the License.
2691
- */
2692
- var __assign = undefined && undefined.__assign || function () {
2693
- __assign = Object.assign || function (t) {
2694
- for (var s, i = 1, n = arguments.length; i < n; i++) {
2695
- s = arguments[i];
2696
-
2697
- for (var p in s) {
2698
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2699
- }
2700
- }
2701
-
2702
- return t;
2703
- };
2704
-
2705
- return __assign.apply(this, arguments);
2706
- };
2707
-
2708
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
2709
- function adopt(value) {
2710
- return value instanceof P ? value : new P(function (resolve) {
2711
- resolve(value);
2712
- });
2713
- }
2714
-
2715
- return new (P || (P = Promise))(function (resolve, reject) {
2716
- function fulfilled(value) {
2717
- try {
2718
- step(generator.next(value));
2719
- } catch (e) {
2720
- reject(e);
2721
- }
2722
- }
2723
-
2724
- function rejected(value) {
2725
- try {
2726
- step(generator["throw"](value));
2727
- } catch (e) {
2728
- reject(e);
2729
- }
2730
- }
2731
-
2732
- function step(result) {
2733
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2734
- }
2735
-
2736
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2737
- });
2738
- };
2739
-
2740
- var __generator = undefined && undefined.__generator || function (thisArg, body) {
2741
- var _ = {
2742
- label: 0,
2743
- sent: function sent() {
2744
- if (t[0] & 1) throw t[1];
2745
- return t[1];
2746
- },
2747
- trys: [],
2748
- ops: []
2749
- },
2750
- f,
2751
- y,
2752
- t,
2753
- g;
2754
- return g = {
2755
- next: verb(0),
2756
- "throw": verb(1),
2757
- "return": verb(2)
2758
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
2759
- return this;
2760
- }), g;
2761
-
2762
- function verb(n) {
2763
- return function (v) {
2764
- return step([n, v]);
2765
- };
2766
- }
2767
-
2768
- function step(op) {
2769
- if (f) throw new TypeError("Generator is already executing.");
2770
-
2771
- while (_) {
2772
- try {
2773
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2774
- if (y = 0, t) op = [op[0] & 2, t.value];
2775
-
2776
- switch (op[0]) {
2777
- case 0:
2778
- case 1:
2779
- t = op;
2780
- break;
2781
-
2782
- case 4:
2783
- _.label++;
2784
- return {
2785
- value: op[1],
2786
- done: false
2787
- };
2788
-
2789
- case 5:
2790
- _.label++;
2791
- y = op[1];
2792
- op = [0];
2793
- continue;
2794
-
2795
- case 7:
2796
- op = _.ops.pop();
2797
-
2798
- _.trys.pop();
2799
-
2800
- continue;
2801
-
2802
- default:
2803
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
2804
- _ = 0;
2805
- continue;
2806
- }
2807
-
2808
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
2809
- _.label = op[1];
2810
- break;
2811
- }
2812
-
2813
- if (op[0] === 6 && _.label < t[1]) {
2814
- _.label = t[1];
2815
- t = op;
2816
- break;
2817
- }
2818
-
2819
- if (t && _.label < t[2]) {
2820
- _.label = t[2];
2821
-
2822
- _.ops.push(op);
2823
-
2824
- break;
2825
- }
2826
-
2827
- if (t[2]) _.ops.pop();
2828
-
2829
- _.trys.pop();
2830
-
2831
- continue;
2832
- }
2833
-
2834
- op = body.call(thisArg, _);
2835
- } catch (e) {
2836
- op = [6, e];
2837
- y = 0;
2838
- } finally {
2839
- f = t = 0;
2840
- }
2841
- }
2842
-
2843
- if (op[0] & 5) throw op[1];
2844
- return {
2845
- value: op[0] ? op[1] : void 0,
2846
- done: true
2847
- };
2848
- }
2849
- };
2850
-
2851
-
2852
-
2853
-
2854
-
2855
-
2856
-
2857
-
2858
-
2859
-
2860
- var MESSAGE_DAILY_COUNT_KEY = 'pinpointProvider_inAppMessages_dailyCount';
2861
- var MESSAGE_TOTAL_COUNT_KEY = 'pinpointProvider_inAppMessages_totalCount';
2862
-
2863
- var AWSPinpointProvider =
2864
- /** @class */
2865
- function () {
2866
- function AWSPinpointProvider() {
2867
- var _this = this;
2868
-
2869
- var _a;
2870
-
2871
- this.config = {};
2872
- this.configured = false;
2873
- this.endpointInitialized = false;
2874
- this.initialized = false;
2875
-
2876
- this.configure = function (config) {
2877
- if (config === void 0) {
2878
- config = {};
2879
- }
2880
-
2881
- _this.config = __assign(__assign({}, _this.config), config);
2882
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].debug('configure AWSPinpointProvider', _this.config); // some configuration steps should not be re-run even if provider is re-configured for some reason
2883
-
2884
- if (!_this.configured) {
2885
- _this.sessionTracker = new _SessionTracker__WEBPACK_IMPORTED_MODULE_5__["default"](_this.sessionStateChangeHandler);
2886
-
2887
- _this.sessionTracker.start(); // wire up default Pinpoint message event handling
2888
-
2889
-
2890
- Object(_eventListeners__WEBPACK_IMPORTED_MODULE_4__["addMessageInteractionEventListener"])(function (message) {
2891
- _this.recordMessageEvent(message, _types__WEBPACK_IMPORTED_MODULE_7__["AWSPinpointMessageEvent"].MESSAGE_DISPLAYED);
2892
- }, _types__WEBPACK_IMPORTED_MODULE_6__["InAppMessageInteractionEvent"].MESSAGE_DISPLAYED);
2893
- Object(_eventListeners__WEBPACK_IMPORTED_MODULE_4__["addMessageInteractionEventListener"])(function (message) {
2894
- _this.recordMessageEvent(message, _types__WEBPACK_IMPORTED_MODULE_7__["AWSPinpointMessageEvent"].MESSAGE_DISMISSED);
2895
- }, _types__WEBPACK_IMPORTED_MODULE_6__["InAppMessageInteractionEvent"].MESSAGE_DISMISSED);
2896
- Object(_eventListeners__WEBPACK_IMPORTED_MODULE_4__["addMessageInteractionEventListener"])(function (message) {
2897
- _this.recordMessageEvent(message, _types__WEBPACK_IMPORTED_MODULE_7__["AWSPinpointMessageEvent"].MESSAGE_ACTION_TAKEN);
2898
- }, _types__WEBPACK_IMPORTED_MODULE_6__["InAppMessageInteractionEvent"].MESSAGE_ACTION_TAKEN);
2899
- }
2900
-
2901
- _this.configured = true;
2902
- Object(_utils__WEBPACK_IMPORTED_MODULE_8__["dispatchInAppMessagingEvent"])('pinpointProvider_configured', null);
2903
- return _this.config;
2904
- };
2905
-
2906
- this.getInAppMessages = function () {
2907
- return __awaiter(_this, void 0, void 0, function () {
2908
- var _a, appId, endpointId, pinpointClient, input, command, response, messages, err_1;
2909
-
2910
- return __generator(this, function (_b) {
2911
- switch (_b.label) {
2912
- case 0:
2913
- if (!!this.initialized) return [3
2914
- /*break*/
2915
- , 2];
2916
- return [4
2917
- /*yield*/
2918
- , this.init()];
2919
-
2920
- case 1:
2921
- _b.sent();
2922
-
2923
- _b.label = 2;
2924
-
2925
- case 2:
2926
- // There is no way to granuarly reconcile the filter memoization as the keys are composited from a message id and
2927
- // event properties thus opting to just clear them out when getting messages rather than leave potentially
2928
- // obsolete entries that will no longer serve any purpose.
2929
- Object(_utils__WEBPACK_IMPORTED_MODULE_8__["clearMemo"])();
2930
- _b.label = 3;
2931
-
2932
- case 3:
2933
- _b.trys.push([3, 6,, 7]);
2934
-
2935
- return [4
2936
- /*yield*/
2937
- , this.updateEndpoint()];
2938
-
2939
- case 4:
2940
- _b.sent();
2941
-
2942
- _a = this.config, appId = _a.appId, endpointId = _a.endpointId, pinpointClient = _a.pinpointClient;
2943
- input = {
2944
- ApplicationId: appId,
2945
- EndpointId: endpointId
2946
- };
2947
- command = new _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_2__["GetInAppMessagesCommand"](input);
2948
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].debug('getting in-app messages', input);
2949
- return [4
2950
- /*yield*/
2951
- , pinpointClient.send(command)];
2952
-
2953
- case 5:
2954
- response = _b.sent();
2955
- messages = response.InAppMessagesResponse.InAppMessageCampaigns;
2956
- Object(_utils__WEBPACK_IMPORTED_MODULE_8__["dispatchInAppMessagingEvent"])('getInAppMessages', messages);
2957
- return [2
2958
- /*return*/
2959
- , messages];
2960
-
2961
- case 6:
2962
- err_1 = _b.sent();
2963
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].error('Error getting in-app messages', err_1);
2964
- throw err_1;
2965
-
2966
- case 7:
2967
- return [2
2968
- /*return*/
2969
- ];
2970
- }
2971
- });
2972
- });
2973
- };
2974
-
2975
- this.processInAppMessages = function (messages, event) {
2976
- return __awaiter(_this, void 0, void 0, function () {
2977
- var highestPrioritySeen;
2978
-
2979
- var _this = this;
2980
-
2981
- return __generator(this, function (_a) {
2982
- switch (_a.label) {
2983
- case 0:
2984
- if (!!this.initialized) return [3
2985
- /*break*/
2986
- , 2];
2987
- return [4
2988
- /*yield*/
2989
- , this.init()];
2990
-
2991
- case 1:
2992
- _a.sent();
2993
-
2994
- _a.label = 2;
2995
-
2996
- case 2:
2997
- return [2
2998
- /*return*/
2999
- , this.normalizeMessages(messages.reduce(function (acc, message) {
3000
- var messageQualifies = Object(_utils__WEBPACK_IMPORTED_MODULE_8__["matchesEventType"])(message, event) && Object(_utils__WEBPACK_IMPORTED_MODULE_8__["matchesAttributes"])(message, event) && Object(_utils__WEBPACK_IMPORTED_MODULE_8__["matchesMetrics"])(message, event) && Object(_utils__WEBPACK_IMPORTED_MODULE_8__["isBeforeEndDate"])(message) && _this.isBelowCap(message); // filter all qualifying messages returning only those that are of (relative) highest priority
3001
-
3002
-
3003
- if (messageQualifies) {
3004
- // have not yet encountered message with priority
3005
- if (!highestPrioritySeen) {
3006
- // this message has priority, so reset the accumulator with this message only
3007
- if (message.Priority) {
3008
- highestPrioritySeen = message.Priority;
3009
- return [message];
3010
- } else {
3011
- // this message also has no priority, so just add this message to accumulator
3012
- acc.push(message);
3013
- } // have previously encountered message with priority, so only messages with priority matter now
3014
-
3015
- } else if (message.Priority) {
3016
- // this message has higher priority (lower number), so reset the accumulator with this message only
3017
- if (message.Priority < highestPrioritySeen) {
3018
- highestPrioritySeen = message.Priority;
3019
- return [message]; // this message has the same priority, so just add this message to accumulator
3020
- } else if (message.Priority === highestPrioritySeen) {
3021
- acc.push(message);
3022
- }
3023
- }
3024
- }
3025
-
3026
- return acc;
3027
- }, []))];
3028
- }
3029
- });
3030
- });
3031
- };
3032
-
3033
- this.identifyUser = function (userId, userInfo) {
3034
- return __awaiter(_this, void 0, void 0, function () {
3035
- var err_2;
3036
- return __generator(this, function (_a) {
3037
- switch (_a.label) {
3038
- case 0:
3039
- if (!!this.initialized) return [3
3040
- /*break*/
3041
- , 2];
3042
- return [4
3043
- /*yield*/
3044
- , this.init()];
3045
-
3046
- case 1:
3047
- _a.sent();
3048
-
3049
- _a.label = 2;
3050
-
3051
- case 2:
3052
- _a.trys.push([2, 4,, 5]);
3053
-
3054
- return [4
3055
- /*yield*/
3056
- , this.updateEndpoint(userId, userInfo)];
3057
-
3058
- case 3:
3059
- _a.sent();
3060
-
3061
- return [3
3062
- /*break*/
3063
- , 5];
3064
-
3065
- case 4:
3066
- err_2 = _a.sent();
3067
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].error('Error identifying user', err_2);
3068
- throw err_2;
3069
-
3070
- case 5:
3071
- return [2
3072
- /*return*/
3073
- ];
3074
- }
3075
- });
3076
- });
3077
- };
3078
-
3079
- this.init = function () {
3080
- return __awaiter(_this, void 0, void 0, function () {
3081
- var _a, endpointId, storage, providerName, _b, err_3;
3082
-
3083
- return __generator(this, function (_c) {
3084
- switch (_c.label) {
3085
- case 0:
3086
- _a = this.config, endpointId = _a.endpointId, storage = _a.storage;
3087
- providerName = this.getProviderName();
3088
- _c.label = 1;
3089
-
3090
- case 1:
3091
- _c.trys.push([1, 6,, 7]);
3092
-
3093
- if (!(typeof storage.sync === 'function')) return [3
3094
- /*break*/
3095
- , 3];
3096
- return [4
3097
- /*yield*/
3098
- , storage.sync()];
3099
-
3100
- case 2:
3101
- _c.sent();
3102
-
3103
- _c.label = 3;
3104
-
3105
- case 3:
3106
- if (!!endpointId) return [3
3107
- /*break*/
3108
- , 5];
3109
- _b = this.config;
3110
- return [4
3111
- /*yield*/
3112
- , this.getEndpointId()];
3113
-
3114
- case 4:
3115
- _b.endpointId = _c.sent();
3116
- _c.label = 5;
3117
-
3118
- case 5:
3119
- this.initialized = true;
3120
- return [3
3121
- /*break*/
3122
- , 7];
3123
-
3124
- case 6:
3125
- err_3 = _c.sent();
3126
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].error("Failed to initialize " + providerName, err_3);
3127
- return [3
3128
- /*break*/
3129
- , 7];
3130
-
3131
- case 7:
3132
- return [2
3133
- /*return*/
3134
- ];
3135
- }
3136
- });
3137
- });
3138
- };
3139
-
3140
- this.initPinpointClient = function () {
3141
- return __awaiter(_this, void 0, void 0, function () {
3142
- var _a, appId, credentials, pinpointClient, region;
3143
-
3144
- return __generator(this, function (_b) {
3145
- _a = this.config, appId = _a.appId, credentials = _a.credentials, pinpointClient = _a.pinpointClient, region = _a.region;
3146
-
3147
- if (!appId || !credentials || !region) {
3148
- throw new Error('One or more of credentials, appId or region is not configured');
3149
- }
3150
-
3151
- if (pinpointClient) {
3152
- pinpointClient.destroy();
3153
- }
3154
-
3155
- this.config.pinpointClient = new _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_2__["PinpointClient"]({
3156
- region: region,
3157
- credentials: credentials,
3158
- customUserAgent: Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["getAmplifyUserAgent"])()
3159
- });
3160
- return [2
3161
- /*return*/
3162
- ];
3163
- });
3164
- });
3165
- };
3166
-
3167
- this.getEndpointId = function () {
3168
- return __awaiter(_this, void 0, void 0, function () {
3169
- var appId, cacheKey, cachedEndpointId, endpointId, ttl, expiration;
3170
- return __generator(this, function (_a) {
3171
- switch (_a.label) {
3172
- case 0:
3173
- appId = this.config.appId;
3174
- cacheKey = this.getSubCategory() + ":" + this.getProviderName() + ":" + appId;
3175
- return [4
3176
- /*yield*/
3177
- , _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_1___default.a.getItem(cacheKey)];
3178
-
3179
- case 1:
3180
- cachedEndpointId = _a.sent(); // Found in cache, just return it
3181
-
3182
- if (cachedEndpointId) {
3183
- return [2
3184
- /*return*/
3185
- , cachedEndpointId];
3186
- }
3187
-
3188
- endpointId = Object(uuid__WEBPACK_IMPORTED_MODULE_3__["v4"])();
3189
- ttl = 1000 * 60 * 60 * 24 * 365 * 100;
3190
- expiration = new Date().getTime() + ttl;
3191
- _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_1___default.a.setItem(cacheKey, endpointId, {
3192
- expires: expiration,
3193
- priority: 1
3194
- });
3195
- return [2
3196
- /*return*/
3197
- , endpointId];
3198
- }
3199
- });
3200
- });
3201
- };
3202
-
3203
- this.updateEndpoint = function (userId, userInfo) {
3204
- if (userId === void 0) {
3205
- userId = null;
3206
- }
3207
-
3208
- if (userInfo === void 0) {
3209
- userInfo = null;
3210
- }
3211
-
3212
- return __awaiter(_this, void 0, void 0, function () {
3213
- var _a, appId, credentials, endpointId, _b, endpointInfo, pinpointClient, currentCredentials, credentialsUpdated, _c, address, attributes, demographic, location_1, metrics, optOut, _d, appVersion, make, model, platform, version, input, command, err_4;
3214
-
3215
- var _e;
3216
-
3217
- return __generator(this, function (_f) {
3218
- switch (_f.label) {
3219
- case 0:
3220
- _a = this.config, appId = _a.appId, credentials = _a.credentials, endpointId = _a.endpointId, _b = _a.endpointInfo, endpointInfo = _b === void 0 ? {} : _b, pinpointClient = _a.pinpointClient;
3221
- return [4
3222
- /*yield*/
3223
- , this.getCredentials()];
3224
-
3225
- case 1:
3226
- currentCredentials = _f.sent();
3227
- credentialsUpdated = !credentials || Object.keys(currentCredentials).some(function (key) {
3228
- return currentCredentials[key] !== credentials[key];
3229
- }); // If endpoint is already initialized, and nothing else is changing, just early return
3230
-
3231
- if (this.endpointInitialized && !credentialsUpdated && !userId && !userInfo) {
3232
- return [2
3233
- /*return*/
3234
- ];
3235
- } // Update credentials
3236
-
3237
-
3238
- this.config.credentials = currentCredentials;
3239
- _f.label = 2;
3240
-
3241
- case 2:
3242
- _f.trys.push([2, 6,, 7]);
3243
-
3244
- if (!(!pinpointClient || credentialsUpdated)) return [3
3245
- /*break*/
3246
- , 4];
3247
- return [4
3248
- /*yield*/
3249
- , this.initPinpointClient()];
3250
-
3251
- case 3:
3252
- _f.sent();
3253
-
3254
- _f.label = 4;
3255
-
3256
- case 4:
3257
- _c = userInfo !== null && userInfo !== void 0 ? userInfo : {}, address = _c.address, attributes = _c.attributes, demographic = _c.demographic, location_1 = _c.location, metrics = _c.metrics, optOut = _c.optOut;
3258
- _d = this.clientInfo, appVersion = _d.appVersion, make = _d.make, model = _d.model, platform = _d.platform, version = _d.version;
3259
- input = {
3260
- ApplicationId: appId,
3261
- EndpointId: endpointId,
3262
- EndpointRequest: {
3263
- RequestId: Object(uuid__WEBPACK_IMPORTED_MODULE_3__["v4"])(),
3264
- EffectiveDate: new Date().toISOString(),
3265
- ChannelType: _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_2__["ChannelType"].IN_APP,
3266
- Address: address !== null && address !== void 0 ? address : endpointInfo.address,
3267
- Attributes: __assign(__assign({}, endpointInfo.attributes), attributes),
3268
- Demographic: __assign({
3269
- AppVersion: appVersion,
3270
- Make: make,
3271
- Model: model,
3272
- ModelVersion: version,
3273
- Platform: platform
3274
- }, Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["transferKeyToUpperCase"])(__assign(__assign({}, endpointInfo.demographic), demographic))),
3275
- Location: Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["transferKeyToUpperCase"])(__assign(__assign({}, endpointInfo.location), location_1)),
3276
- Metrics: __assign(__assign({}, endpointInfo.metrics), metrics),
3277
- OptOut: optOut !== null && optOut !== void 0 ? optOut : endpointInfo.optOut,
3278
- User: {
3279
- UserId: (_e = userId !== null && userId !== void 0 ? userId : endpointInfo.userId) !== null && _e !== void 0 ? _e : currentCredentials.identityId,
3280
- UserAttributes: attributes !== null && attributes !== void 0 ? attributes : endpointInfo.userAttributes
3281
- }
3282
- }
3283
- };
3284
- command = new _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_2__["UpdateEndpointCommand"](input);
3285
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].debug('updating endpoint', input);
3286
- return [4
3287
- /*yield*/
3288
- , this.config.pinpointClient.send(command)];
3289
-
3290
- case 5:
3291
- _f.sent();
3292
-
3293
- this.endpointInitialized = true;
3294
- return [3
3295
- /*break*/
3296
- , 7];
3297
-
3298
- case 6:
3299
- err_4 = _f.sent();
3300
- throw err_4;
3301
-
3302
- case 7:
3303
- return [2
3304
- /*return*/
3305
- ];
3306
- }
3307
- });
3308
- });
3309
- };
3310
-
3311
- this.getCredentials = function () {
3312
- return __awaiter(_this, void 0, void 0, function () {
3313
- var credentials, err_5;
3314
- return __generator(this, function (_a) {
3315
- switch (_a.label) {
3316
- case 0:
3317
- _a.trys.push([0, 2,, 3]);
3318
-
3319
- return [4
3320
- /*yield*/
3321
- , _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Credentials"].get()];
3322
-
3323
- case 1:
3324
- credentials = _a.sent();
3325
-
3326
- if (!credentials) {
3327
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].debug('no credentials found');
3328
- return [2
3329
- /*return*/
3330
- , null];
3331
- }
3332
-
3333
- return [2
3334
- /*return*/
3335
- , _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Credentials"].shear(credentials)];
3336
-
3337
- case 2:
3338
- err_5 = _a.sent();
3339
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].error('Error getting credentials:', err_5);
3340
- return [2
3341
- /*return*/
3342
- , null];
3343
-
3344
- case 3:
3345
- return [2
3346
- /*return*/
3347
- ];
3348
- }
3349
- });
3350
- });
3351
- };
3352
-
3353
- this.sessionStateChangeHandler = function (state) {
3354
- if (state === 'started') {
3355
- // reset all session counts
3356
- _this.sessionMessageCountMap = {};
3357
- }
3358
- };
3359
-
3360
- this.isBelowCap = function (_a) {
3361
- var CampaignId = _a.CampaignId,
3362
- SessionCap = _a.SessionCap,
3363
- DailyCap = _a.DailyCap,
3364
- TotalCap = _a.TotalCap;
3365
-
3366
- var _b = _this.getMessageCounts(CampaignId),
3367
- sessionCount = _b.sessionCount,
3368
- dailyCount = _b.dailyCount,
3369
- totalCount = _b.totalCount;
3370
-
3371
- return (!SessionCap || sessionCount < SessionCap) && (!DailyCap || dailyCount < DailyCap) && (!TotalCap || totalCount < TotalCap);
3372
- }; // Use the current session count in memory or initialize as empty count
3373
-
3374
-
3375
- this.getSessionCount = function (messageId) {
3376
- return _this.sessionMessageCountMap[messageId] || 0;
3377
- };
3378
-
3379
- this.getDailyCount = function () {
3380
- var storage = _this.config.storage;
3381
- var today = Object(_utils__WEBPACK_IMPORTED_MODULE_8__["getStartOfDay"])();
3382
- var item = storage.getItem(MESSAGE_DAILY_COUNT_KEY); // Parse stored count or initialize as empty count
3383
-
3384
- var counter = item ? JSON.parse(item) : {
3385
- count: 0,
3386
- lastCountTimestamp: today
3387
- }; // If the stored counter timestamp is today, use it as the count, otherwise reset to 0
3388
-
3389
- return counter.lastCountTimestamp === today ? counter.count : 0;
3390
- };
3391
-
3392
- this.getTotalCountMap = function () {
3393
- var storage = _this.config.storage;
3394
- var item = storage.getItem(MESSAGE_TOTAL_COUNT_KEY); // Parse stored count map or initialize as empty
3395
-
3396
- return item ? JSON.parse(item) : {};
3397
- };
3398
-
3399
- this.getTotalCount = function (messageId) {
3400
- var countMap = _this.getTotalCountMap(); // Return stored count or initialize as empty count
3401
-
3402
-
3403
- return countMap[messageId] || 0;
3404
- };
3405
-
3406
- this.getMessageCounts = function (messageId) {
3407
- try {
3408
- return {
3409
- sessionCount: _this.getSessionCount(messageId),
3410
- dailyCount: _this.getDailyCount(),
3411
- totalCount: _this.getTotalCount(messageId)
3412
- };
3413
- } catch (err) {
3414
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].error('Failed to get message counts from storage', err);
3415
- }
3416
- };
3417
-
3418
- this.setSessionCount = function (messageId, count) {
3419
- _this.sessionMessageCountMap[messageId] = count;
3420
- };
3421
-
3422
- this.setDailyCount = function (count) {
3423
- var storage = _this.config.storage;
3424
- var dailyCount = {
3425
- count: count,
3426
- lastCountTimestamp: Object(_utils__WEBPACK_IMPORTED_MODULE_8__["getStartOfDay"])()
3427
- };
3428
-
3429
- try {
3430
- storage.setItem(MESSAGE_DAILY_COUNT_KEY, JSON.stringify(dailyCount));
3431
- } catch (err) {
3432
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].error('Failed to save daily message count to storage', err);
3433
- }
3434
- };
3435
-
3436
- this.setTotalCountMap = function (countMap) {
3437
- var storage = _this.config.storage;
3438
-
3439
- try {
3440
- storage.setItem(MESSAGE_TOTAL_COUNT_KEY, JSON.stringify(countMap));
3441
- } catch (err) {
3442
- _utils__WEBPACK_IMPORTED_MODULE_8__["logger"].error('Failed to save total count to storage', err);
3443
- }
3444
- };
3445
-
3446
- this.setTotalCount = function (messageId, count) {
3447
- var _a;
3448
-
3449
- var updatedMap = __assign(__assign({}, _this.getTotalCountMap()), (_a = {}, _a[messageId] = count, _a));
3450
-
3451
- _this.setTotalCountMap(updatedMap);
3452
- };
3453
-
3454
- this.incrementCounts = function (messageId) {
3455
- return __awaiter(_this, void 0, void 0, function () {
3456
- var _a, sessionCount, dailyCount, totalCount;
3457
-
3458
- return __generator(this, function (_b) {
3459
- _a = this.getMessageCounts(messageId), sessionCount = _a.sessionCount, dailyCount = _a.dailyCount, totalCount = _a.totalCount;
3460
- this.setSessionCount(messageId, sessionCount + 1);
3461
- this.setDailyCount(dailyCount + 1);
3462
- this.setTotalCount(messageId, totalCount + 1);
3463
- return [2
3464
- /*return*/
3465
- ];
3466
- });
3467
- });
3468
- };
3469
-
3470
- this.normalizeMessages = function (messages) {
3471
- return messages.map(function (message) {
3472
- var CampaignId = message.CampaignId,
3473
- InAppMessage = message.InAppMessage;
3474
- return {
3475
- id: CampaignId,
3476
- content: Object(_utils__WEBPACK_IMPORTED_MODULE_8__["extractContent"])(message),
3477
- layout: Object(_utils__WEBPACK_IMPORTED_MODULE_8__["interpretLayout"])(InAppMessage.Layout),
3478
- metadata: Object(_utils__WEBPACK_IMPORTED_MODULE_8__["extractMetadata"])(message)
3479
- };
3480
- });
3481
- };
3482
-
3483
- this.recordMessageEvent = function (message, event) {
3484
- return __awaiter(_this, void 0, void 0, function () {
3485
- return __generator(this, function (_a) {
3486
- switch (_a.label) {
3487
- case 0:
3488
- if (!!this.initialized) return [3
3489
- /*break*/
3490
- , 2];
3491
- return [4
3492
- /*yield*/
3493
- , this.init()];
3494
-
3495
- case 1:
3496
- _a.sent();
3497
-
3498
- _a.label = 2;
3499
-
3500
- case 2:
3501
- Object(_utils__WEBPACK_IMPORTED_MODULE_8__["recordAnalyticsEvent"])(event, message);
3502
- if (!(event === _types__WEBPACK_IMPORTED_MODULE_7__["AWSPinpointMessageEvent"].MESSAGE_DISPLAYED)) return [3
3503
- /*break*/
3504
- , 4];
3505
- return [4
3506
- /*yield*/
3507
- , this.incrementCounts(message.id)];
3508
-
3509
- case 3:
3510
- _a.sent();
3511
-
3512
- _a.label = 4;
3513
-
3514
- case 4:
3515
- return [2
3516
- /*return*/
3517
- ];
3518
- }
3519
- });
3520
- });
3521
- };
3522
-
3523
- this.sessionMessageCountMap = {};
3524
- this.config = {
3525
- storage: new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["StorageHelper"]().getStorage()
3526
- };
3527
- this.clientInfo = (_a = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ClientDevice"].clientInfo()) !== null && _a !== void 0 ? _a : {};
3528
- }
3529
- /**
3530
- * get the category of the plugin
3531
- */
3532
-
3533
-
3534
- AWSPinpointProvider.prototype.getCategory = function () {
3535
- return AWSPinpointProvider.category;
3536
- };
3537
- /**
3538
- * get the sub-category of the plugin
3539
- */
3540
-
3541
-
3542
- AWSPinpointProvider.prototype.getSubCategory = function () {
3543
- return AWSPinpointProvider.subCategory;
3544
- };
3545
- /**
3546
- * get provider name of the plugin
3547
- */
3548
-
3549
-
3550
- AWSPinpointProvider.prototype.getProviderName = function () {
3551
- return AWSPinpointProvider.providerName;
3552
- };
3553
-
3554
- AWSPinpointProvider.category = 'Notifications';
3555
- AWSPinpointProvider.subCategory = 'InAppMessaging';
3556
- AWSPinpointProvider.providerName = 'AWSPinpoint';
3557
- return AWSPinpointProvider;
3558
- }();
3559
-
3560
- /* harmony default export */ __webpack_exports__["default"] = (AWSPinpointProvider);
3561
-
3562
- /***/ }),
3563
-
3564
- /***/ "./lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js":
3565
- /*!***********************************************************************!*\
3566
- !*** ./lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js ***!
3567
- \***********************************************************************/
3568
- /*! exports provided: AWSPinpointMessageEvent */
3569
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3570
-
3571
- "use strict";
3572
- __webpack_require__.r(__webpack_exports__);
3573
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWSPinpointMessageEvent", function() { return AWSPinpointMessageEvent; });
3574
- /*
3575
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3576
- *
3577
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
3578
- * the License. A copy of the License is located at
3579
- *
3580
- * http://aws.amazon.com/apache2.0/
3581
- *
3582
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
3583
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
3584
- * and limitations under the License.
3585
- */
3586
- var AWSPinpointMessageEvent;
3587
-
3588
- (function (AWSPinpointMessageEvent) {
3589
- AWSPinpointMessageEvent["MESSAGE_DISPLAYED"] = "_inapp.message_displayed";
3590
- AWSPinpointMessageEvent["MESSAGE_DISMISSED"] = "_inapp.message_dismissed";
3591
- AWSPinpointMessageEvent["MESSAGE_ACTION_TAKEN"] = "_inapp.message_clicked";
3592
- })(AWSPinpointMessageEvent || (AWSPinpointMessageEvent = {}));
3593
-
3594
- /***/ }),
3595
-
3596
- /***/ "./lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js":
3597
- /*!***********************************************************************!*\
3598
- !*** ./lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js ***!
3599
- \***********************************************************************/
3600
- /*! exports provided: logger, dispatchInAppMessagingEvent, recordAnalyticsEvent, getStartOfDay, matchesEventType, matchesAttributes, matchesMetrics, getComparator, isBeforeEndDate, isQuietTime, clearMemo, interpretLayout, extractContent, extractMetadata */
3601
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3602
-
3603
- "use strict";
3604
- __webpack_require__.r(__webpack_exports__);
3605
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logger", function() { return logger; });
3606
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dispatchInAppMessagingEvent", function() { return dispatchInAppMessagingEvent; });
3607
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "recordAnalyticsEvent", function() { return recordAnalyticsEvent; });
3608
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStartOfDay", function() { return getStartOfDay; });
3609
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matchesEventType", function() { return matchesEventType; });
3610
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matchesAttributes", function() { return matchesAttributes; });
3611
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matchesMetrics", function() { return matchesMetrics; });
3612
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getComparator", function() { return getComparator; });
3613
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBeforeEndDate", function() { return isBeforeEndDate; });
3614
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isQuietTime", function() { return isQuietTime; });
3615
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clearMemo", function() { return clearMemo; });
3616
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "interpretLayout", function() { return interpretLayout; });
3617
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractContent", function() { return extractContent; });
3618
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractMetadata", function() { return extractMetadata; });
3619
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
3620
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
3621
- /* harmony import */ var _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-sdk/client-pinpoint */ "@aws-sdk/client-pinpoint");
3622
- /* harmony import */ var _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_1__);
3623
- /* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/isEmpty */ "../../node_modules/lodash/isEmpty.js");
3624
- /* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2__);
3625
- /*
3626
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3627
- *
3628
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
3629
- * the License. A copy of the License is located at
3630
- *
3631
- * http://aws.amazon.com/apache2.0/
3632
- *
3633
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
3634
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
3635
- * and limitations under the License.
3636
- */
3637
- var __read = undefined && undefined.__read || function (o, n) {
3638
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3639
- if (!m) return o;
3640
- var i = m.call(o),
3641
- r,
3642
- ar = [],
3643
- e;
3644
-
3645
- try {
3646
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
3647
- ar.push(r.value);
3648
- }
3649
- } catch (error) {
3650
- e = {
3651
- error: error
3652
- };
3653
- } finally {
3654
- try {
3655
- if (r && !r.done && (m = i["return"])) m.call(i);
3656
- } finally {
3657
- if (e) throw e.error;
3658
- }
3659
- }
3660
-
3661
- return ar;
3662
- };
3663
-
3664
-
3665
-
3666
-
3667
- var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
3668
- var DELIVERY_TYPE = 'IN_APP_MESSAGE';
3669
- var eventNameMemo = {};
3670
- var eventAttributesMemo = {};
3671
- var eventMetricsMemo = {};
3672
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('AWSPinpointProvider');
3673
- var dispatchInAppMessagingEvent = function dispatchInAppMessagingEvent(event, data, message) {
3674
- _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Hub"].dispatch('inAppMessaging', {
3675
- event: event,
3676
- data: data,
3677
- message: message
3678
- }, 'InAppMessaging', AMPLIFY_SYMBOL);
3679
- };
3680
- var recordAnalyticsEvent = function recordAnalyticsEvent(event, message) {
3681
- if (!message) {
3682
- logger.debug('Unable to record analytics event - no InAppMessage was received');
3683
- return;
3684
- }
3685
-
3686
- if (_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Amplify"].Analytics && typeof _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Amplify"].Analytics.record === 'function') {
3687
- var id = message.id,
3688
- metadata = message.metadata;
3689
- _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Amplify"].Analytics.record({
3690
- name: event,
3691
- attributes: {
3692
- campaign_id: id,
3693
- delivery_type: DELIVERY_TYPE,
3694
- treatment_id: metadata === null || metadata === void 0 ? void 0 : metadata.treatmentId
3695
- }
3696
- });
3697
- } else {
3698
- logger.debug('Analytics module is not registered into Amplify');
3699
- }
3700
- };
3701
- var getStartOfDay = function getStartOfDay() {
3702
- var now = new Date();
3703
- now.setHours(0, 0, 0, 0);
3704
- return now.toISOString();
3705
- };
3706
- var matchesEventType = function matchesEventType(_a, _b) {
3707
- var CampaignId = _a.CampaignId,
3708
- Schedule = _a.Schedule;
3709
- var eventType = _b.name;
3710
-
3711
- var _c;
3712
-
3713
- var EventType = ((_c = Schedule === null || Schedule === void 0 ? void 0 : Schedule.EventFilter) === null || _c === void 0 ? void 0 : _c.Dimensions).EventType;
3714
- var memoKey = CampaignId + ":" + eventType;
3715
-
3716
- if (!eventNameMemo.hasOwnProperty(memoKey)) {
3717
- eventNameMemo[memoKey] = !!(EventType === null || EventType === void 0 ? void 0 : EventType.Values.includes(eventType));
3718
- }
3719
-
3720
- return eventNameMemo[memoKey];
3721
- };
3722
- var matchesAttributes = function matchesAttributes(_a, _b) {
3723
- var CampaignId = _a.CampaignId,
3724
- Schedule = _a.Schedule;
3725
- var attributes = _b.attributes;
3726
-
3727
- var _c;
3728
-
3729
- var Attributes = ((_c = Schedule === null || Schedule === void 0 ? void 0 : Schedule.EventFilter) === null || _c === void 0 ? void 0 : _c.Dimensions).Attributes;
3730
-
3731
- if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(Attributes)) {
3732
- // if message does not have attributes defined it does not matter what attributes are on the event
3733
- return true;
3734
- }
3735
-
3736
- if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(attributes)) {
3737
- // if message does have attributes but the event does not then it always fails the check
3738
- return false;
3739
- }
3740
-
3741
- var memoKey = CampaignId + ":" + JSON.stringify(attributes);
3742
-
3743
- if (!eventAttributesMemo.hasOwnProperty(memoKey)) {
3744
- eventAttributesMemo[memoKey] = Object.entries(Attributes).every(function (_a) {
3745
- var _b = __read(_a, 2),
3746
- key = _b[0],
3747
- Values = _b[1].Values;
3748
-
3749
- return Values.includes(attributes[key]);
3750
- });
3751
- }
3752
-
3753
- return eventAttributesMemo[memoKey];
3754
- };
3755
- var matchesMetrics = function matchesMetrics(_a, _b) {
3756
- var CampaignId = _a.CampaignId,
3757
- Schedule = _a.Schedule;
3758
- var metrics = _b.metrics;
3759
-
3760
- var _c;
3761
-
3762
- var Metrics = ((_c = Schedule === null || Schedule === void 0 ? void 0 : Schedule.EventFilter) === null || _c === void 0 ? void 0 : _c.Dimensions).Metrics;
3763
-
3764
- if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(Metrics)) {
3765
- // if message does not have metrics defined it does not matter what metrics are on the event
3766
- return true;
3767
- }
3768
-
3769
- if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_2___default()(metrics)) {
3770
- // if message does have metrics but the event does not then it always fails the check
3771
- return false;
3772
- }
3773
-
3774
- var memoKey = CampaignId + ":" + JSON.stringify(metrics);
3775
-
3776
- if (!eventMetricsMemo.hasOwnProperty(memoKey)) {
3777
- eventMetricsMemo[memoKey] = Object.entries(Metrics).every(function (_a) {
3778
- var _b = __read(_a, 2),
3779
- key = _b[0],
3780
- _c = _b[1],
3781
- ComparisonOperator = _c.ComparisonOperator,
3782
- Value = _c.Value;
3783
-
3784
- var compare = getComparator(ComparisonOperator); // if there is some unknown comparison operator, treat as a comparison failure
3785
-
3786
- return compare ? compare(Value, metrics[key]) : false;
3787
- });
3788
- }
3789
-
3790
- return eventMetricsMemo[memoKey];
3791
- };
3792
- var getComparator = function getComparator(operator) {
3793
- switch (operator) {
3794
- case 'EQUAL':
3795
- return function (metricsVal, eventVal) {
3796
- return metricsVal === eventVal;
3797
- };
3798
-
3799
- case 'GREATER_THAN':
3800
- return function (metricsVal, eventVal) {
3801
- return metricsVal < eventVal;
3802
- };
3803
-
3804
- case 'GREATER_THAN_OR_EQUAL':
3805
- return function (metricsVal, eventVal) {
3806
- return metricsVal <= eventVal;
3807
- };
3808
-
3809
- case 'LESS_THAN':
3810
- return function (metricsVal, eventVal) {
3811
- return metricsVal > eventVal;
3812
- };
3813
-
3814
- case 'LESS_THAN_OR_EQUAL':
3815
- return function (metricsVal, eventVal) {
3816
- return metricsVal >= eventVal;
3817
- };
3818
-
3819
- default:
3820
- return null;
3821
- }
3822
- };
3823
- var isBeforeEndDate = function isBeforeEndDate(_a) {
3824
- var Schedule = _a.Schedule;
3825
-
3826
- if (!(Schedule === null || Schedule === void 0 ? void 0 : Schedule.EndDate)) {
3827
- return true;
3828
- }
3829
-
3830
- return new Date() < new Date(Schedule.EndDate);
3831
- };
3832
- var isQuietTime = function isQuietTime(message) {
3833
- var Schedule = message.Schedule;
3834
-
3835
- if (!(Schedule === null || Schedule === void 0 ? void 0 : Schedule.QuietTime)) {
3836
- return false;
3837
- }
3838
-
3839
- var pattern = /^[0-2]\d:[0-5]\d$/; // basic sanity check, not a fully featured HH:MM validation
3840
-
3841
- var _a = Schedule.QuietTime,
3842
- Start = _a.Start,
3843
- End = _a.End;
3844
-
3845
- if (!Start || !End || Start === End || !pattern.test(Start) || !pattern.test(End)) {
3846
- return false;
3847
- }
3848
-
3849
- var now = new Date();
3850
- var start = new Date(now);
3851
- var end = new Date(now);
3852
-
3853
- var _b = __read(Start.split(':'), 2),
3854
- startHours = _b[0],
3855
- startMinutes = _b[1];
3856
-
3857
- var _c = __read(End.split(':'), 2),
3858
- endHours = _c[0],
3859
- endMinutes = _c[1];
3860
-
3861
- start.setHours(Number.parseInt(startHours, 10), Number.parseInt(startMinutes, 10), 0, 0);
3862
- end.setHours(Number.parseInt(endHours, 10), Number.parseInt(endMinutes, 10), 0, 0); // if quiet time includes midnight, bump the end time to the next day
3863
-
3864
- if (start > end) {
3865
- end.setDate(end.getDate() + 1);
3866
- }
3867
-
3868
- var isQuietTime = now >= start && now <= end;
3869
-
3870
- if (isQuietTime) {
3871
- logger.debug('message filtered due to quiet time', message);
3872
- }
3873
-
3874
- return isQuietTime;
3875
- };
3876
- var clearMemo = function clearMemo() {
3877
- eventNameMemo = {};
3878
- eventAttributesMemo = {};
3879
- eventMetricsMemo = {};
3880
- }; // in the pinpoint console when a message is created with a Modal or Full Screen layout,
3881
- // it is assigned a layout value of MOBILE_FEED or OVERLAYS respectively in the message payload.
3882
- // In the future, Pinpoint will be updating the layout values in the aforementioned scenario
3883
- // to MODAL and FULL_SCREEN.
3884
- //
3885
- // This utility acts as a safeguard to ensure that:
3886
- // - 1. the usage of MOBILE_FEED and OVERLAYS as values for message layouts are not leaked
3887
- // outside the Pinpoint provider
3888
- // - 2. Amplify correctly handles the legacy layout values from Pinpoint after they are updated
3889
-
3890
- var interpretLayout = function interpretLayout(layout) {
3891
- if (layout === _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_1__["Layout"].MOBILE_FEED) {
3892
- return 'MODAL';
3893
- }
3894
-
3895
- if (layout === _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_1__["Layout"].OVERLAYS) {
3896
- return 'FULL_SCREEN';
3897
- } // cast as PinpointInAppMessage['InAppMessage']['Layout'] allows `string` as a value
3898
-
3899
-
3900
- return layout;
3901
- };
3902
- var extractContent = function extractContent(_a) {
3903
- var message = _a.InAppMessage;
3904
-
3905
- var _b, _c;
3906
-
3907
- return (_c = (_b = message === null || message === void 0 ? void 0 : message.Content) === null || _b === void 0 ? void 0 : _b.map(function (content) {
3908
- var BackgroundColor = content.BackgroundColor,
3909
- BodyConfig = content.BodyConfig,
3910
- HeaderConfig = content.HeaderConfig,
3911
- ImageUrl = content.ImageUrl,
3912
- PrimaryBtn = content.PrimaryBtn,
3913
- SecondaryBtn = content.SecondaryBtn;
3914
- var defaultPrimaryButton = PrimaryBtn === null || PrimaryBtn === void 0 ? void 0 : PrimaryBtn.DefaultConfig;
3915
- var defaultSecondaryButton = SecondaryBtn === null || SecondaryBtn === void 0 ? void 0 : SecondaryBtn.DefaultConfig;
3916
- var extractedContent = {};
3917
-
3918
- if (BackgroundColor) {
3919
- extractedContent.container = {
3920
- style: {
3921
- backgroundColor: BackgroundColor
3922
- }
3923
- };
3924
- }
3925
-
3926
- if (HeaderConfig) {
3927
- extractedContent.header = {
3928
- content: HeaderConfig.Header,
3929
- style: {
3930
- color: HeaderConfig.TextColor,
3931
- textAlign: HeaderConfig.Alignment.toLowerCase()
3932
- }
3933
- };
3934
- }
3935
-
3936
- if (BodyConfig) {
3937
- extractedContent.body = {
3938
- content: BodyConfig.Body,
3939
- style: {
3940
- color: BodyConfig.TextColor,
3941
- textAlign: BodyConfig.Alignment.toLowerCase()
3942
- }
3943
- };
3944
- }
3945
-
3946
- if (ImageUrl) {
3947
- extractedContent.image = {
3948
- src: ImageUrl
3949
- };
3950
- }
3951
-
3952
- if (defaultPrimaryButton) {
3953
- extractedContent.primaryButton = {
3954
- title: defaultPrimaryButton.Text,
3955
- action: defaultPrimaryButton.ButtonAction,
3956
- url: defaultPrimaryButton.Link,
3957
- style: {
3958
- backgroundColor: defaultPrimaryButton.BackgroundColor,
3959
- borderRadius: defaultPrimaryButton.BorderRadius,
3960
- color: defaultPrimaryButton.TextColor
3961
- }
3962
- };
3963
- }
3964
-
3965
- if (defaultSecondaryButton) {
3966
- extractedContent.secondaryButton = {
3967
- title: defaultSecondaryButton.Text,
3968
- action: defaultSecondaryButton.ButtonAction,
3969
- url: defaultSecondaryButton.Link,
3970
- style: {
3971
- backgroundColor: defaultSecondaryButton.BackgroundColor,
3972
- borderRadius: defaultSecondaryButton.BorderRadius,
3973
- color: defaultSecondaryButton.TextColor
3974
- }
3975
- };
3976
- }
3977
-
3978
- return extractedContent;
3979
- })) !== null && _c !== void 0 ? _c : [];
3980
- };
3981
- var extractMetadata = function extractMetadata(_a) {
3982
- var InAppMessage = _a.InAppMessage,
3983
- Priority = _a.Priority,
3984
- Schedule = _a.Schedule,
3985
- TreatmentId = _a.TreatmentId;
3986
- return {
3987
- customData: InAppMessage === null || InAppMessage === void 0 ? void 0 : InAppMessage.CustomConfig,
3988
- endDate: Schedule === null || Schedule === void 0 ? void 0 : Schedule.EndDate,
3989
- priority: Priority,
3990
- treatmentId: TreatmentId
3991
- };
3992
- };
3993
-
3994
- /***/ }),
3995
-
3996
- /***/ "./lib-esm/InAppMessaging/Providers/index.js":
3997
- /*!***************************************************!*\
3998
- !*** ./lib-esm/InAppMessaging/Providers/index.js ***!
3999
- \***************************************************/
4000
- /*! exports provided: AWSPinpointProvider */
4001
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4002
-
4003
- "use strict";
4004
- __webpack_require__.r(__webpack_exports__);
4005
- /* harmony import */ var _AWSPinpointProvider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AWSPinpointProvider */ "./lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js");
4006
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSPinpointProvider", function() { return _AWSPinpointProvider__WEBPACK_IMPORTED_MODULE_0__["default"]; });
4007
-
4008
- /*
4009
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4010
- *
4011
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
4012
- * the License. A copy of the License is located at
4013
- *
4014
- * http://aws.amazon.com/apache2.0/
4015
- *
4016
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
4017
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
4018
- * and limitations under the License.
4019
- */
4020
-
4021
-
4022
- /***/ }),
4023
-
4024
- /***/ "./lib-esm/InAppMessaging/SessionTracker/SessionTracker.js":
4025
- /*!*****************************************************************!*\
4026
- !*** ./lib-esm/InAppMessaging/SessionTracker/SessionTracker.js ***!
4027
- \*****************************************************************/
4028
- /*! exports provided: default */
4029
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4030
-
4031
- "use strict";
4032
- __webpack_require__.r(__webpack_exports__);
4033
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
4034
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
4035
- /* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/noop */ "../../node_modules/lodash/noop.js");
4036
- /* harmony import */ var lodash_noop__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_noop__WEBPACK_IMPORTED_MODULE_1__);
4037
- /*
4038
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4039
- *
4040
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
4041
- * the License. A copy of the License is located at
4042
- *
4043
- * http://aws.amazon.com/apache2.0/
4044
- *
4045
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
4046
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
4047
- * and limitations under the License.
4048
- */
4049
-
4050
- // Per https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
4051
-
4052
- var hidden;
4053
- var visibilityChange;
4054
- var isBrowser = Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["browserOrNode"])().isBrowser;
4055
-
4056
- if (isBrowser && document) {
4057
- if (typeof document.hidden !== 'undefined') {
4058
- hidden = 'hidden';
4059
- visibilityChange = 'visibilitychange';
4060
- } else if (typeof document['msHidden'] !== 'undefined') {
4061
- hidden = 'msHidden';
4062
- visibilityChange = 'msvisibilitychange';
4063
- } else if (typeof document['webkitHidden'] !== 'undefined') {
4064
- hidden = 'webkitHidden';
4065
- visibilityChange = 'webkitvisibilitychange';
4066
- }
4067
- }
4068
-
4069
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('InAppMessagingSessionTracker');
4070
-
4071
- var SessionTracker =
4072
- /** @class */
4073
- function () {
4074
- function SessionTracker(sessionStateChangeHandler) {
4075
- var _this = this;
4076
-
4077
- if (sessionStateChangeHandler === void 0) {
4078
- sessionStateChangeHandler = lodash_noop__WEBPACK_IMPORTED_MODULE_1___default.a;
4079
- }
4080
-
4081
- this.start = function () {
4082
- if (isBrowser) {
4083
- document === null || document === void 0 ? void 0 : document.addEventListener(visibilityChange, _this.visibilityChangeHandler);
4084
- }
4085
-
4086
- return _this.getSessionState();
4087
- };
4088
-
4089
- this.end = function () {
4090
- if (isBrowser) {
4091
- document === null || document === void 0 ? void 0 : document.removeEventListener(visibilityChange, _this.visibilityChangeHandler);
4092
- }
4093
-
4094
- return _this.getSessionState();
4095
- };
4096
-
4097
- this.getSessionState = function () {
4098
- if (isBrowser && document && !document[hidden]) {
4099
- return 'started';
4100
- } // If, for any reason, document is undefined the session will never start
4101
-
4102
-
4103
- return 'ended';
4104
- };
4105
-
4106
- this.visibilityChangeHandler = function () {
4107
- if (!isBrowser || !document) {
4108
- return;
4109
- }
4110
-
4111
- if (document[hidden]) {
4112
- logger.debug('App is now hidden');
4113
-
4114
- _this.sessionStateChangeHandler('ended');
4115
- } else {
4116
- logger.debug('App is now visible');
4117
-
4118
- _this.sessionStateChangeHandler('started');
4119
- }
4120
- };
4121
-
4122
- this.sessionStateChangeHandler = sessionStateChangeHandler;
4123
- }
4124
-
4125
- return SessionTracker;
4126
- }();
4127
-
4128
- /* harmony default export */ __webpack_exports__["default"] = (SessionTracker);
4129
-
4130
- /***/ }),
4131
-
4132
- /***/ "./lib-esm/InAppMessaging/SessionTracker/index.js":
4133
- /*!********************************************************!*\
4134
- !*** ./lib-esm/InAppMessaging/SessionTracker/index.js ***!
4135
- \********************************************************/
4136
- /*! exports provided: default */
4137
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4138
-
4139
- "use strict";
4140
- __webpack_require__.r(__webpack_exports__);
4141
- /* harmony import */ var _SessionTracker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SessionTracker */ "./lib-esm/InAppMessaging/SessionTracker/SessionTracker.js");
4142
- /*
4143
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4144
- *
4145
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
4146
- * the License. A copy of the License is located at
4147
- *
4148
- * http://aws.amazon.com/apache2.0/
4149
- *
4150
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
4151
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
4152
- * and limitations under the License.
4153
- */
4154
-
4155
- /* harmony default export */ __webpack_exports__["default"] = (_SessionTracker__WEBPACK_IMPORTED_MODULE_0__["default"]);
4156
-
4157
- /***/ }),
4158
-
4159
- /***/ "./lib-esm/InAppMessaging/eventListeners.js":
4160
- /*!**************************************************!*\
4161
- !*** ./lib-esm/InAppMessaging/eventListeners.js ***!
4162
- \**************************************************/
4163
- /*! exports provided: notifyMessageInteractionEventListeners, addMessageInteractionEventListener */
4164
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4165
-
4166
- "use strict";
4167
- __webpack_require__.r(__webpack_exports__);
4168
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "notifyMessageInteractionEventListeners", function() { return notifyMessageInteractionEventListeners; });
4169
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMessageInteractionEventListener", function() { return addMessageInteractionEventListener; });
4170
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ "./lib-esm/InAppMessaging/types.js");
4171
- /*
4172
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4173
- *
4174
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
4175
- * the License. A copy of the License is located at
4176
- *
4177
- * http://aws.amazon.com/apache2.0/
4178
- *
4179
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
4180
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
4181
- * and limitations under the License.
4182
- */
4183
- var _a;
4184
-
4185
-
4186
- var onMessageActionListeners = (_a = {}, _a[_types__WEBPACK_IMPORTED_MODULE_0__["InAppMessageInteractionEvent"].MESSAGE_RECEIVED] = new Set(), _a[_types__WEBPACK_IMPORTED_MODULE_0__["InAppMessageInteractionEvent"].MESSAGE_DISPLAYED] = new Set(), _a[_types__WEBPACK_IMPORTED_MODULE_0__["InAppMessageInteractionEvent"].MESSAGE_DISMISSED] = new Set(), _a[_types__WEBPACK_IMPORTED_MODULE_0__["InAppMessageInteractionEvent"].MESSAGE_ACTION_TAKEN] = new Set(), _a);
4187
- var notifyMessageInteractionEventListeners = function notifyMessageInteractionEventListeners(message, event) {
4188
- onMessageActionListeners[event].forEach(function (listener) {
4189
- listener.handleEvent(message);
4190
- });
4191
- };
4192
- var addMessageInteractionEventListener = function addMessageInteractionEventListener(handler, event) {
4193
- var listener = {
4194
- handleEvent: handler,
4195
- remove: function remove() {
4196
- onMessageActionListeners[event]["delete"](listener);
4197
- }
4198
- };
4199
- onMessageActionListeners[event].add(listener);
4200
- return listener;
4201
- };
4202
-
4203
- /***/ }),
4204
-
4205
- /***/ "./lib-esm/InAppMessaging/index.js":
4206
- /*!*****************************************!*\
4207
- !*** ./lib-esm/InAppMessaging/index.js ***!
4208
- \*****************************************/
4209
- /*! exports provided: default, AWSPinpointProvider, InAppMessageInteractionEvent */
4210
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4211
-
4212
- "use strict";
4213
- __webpack_require__.r(__webpack_exports__);
4214
- /* harmony import */ var _InAppMessaging__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./InAppMessaging */ "./lib-esm/InAppMessaging/InAppMessaging.js");
4215
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _InAppMessaging__WEBPACK_IMPORTED_MODULE_0__["default"]; });
4216
-
4217
- /* harmony import */ var _Providers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Providers */ "./lib-esm/InAppMessaging/Providers/index.js");
4218
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSPinpointProvider", function() { return _Providers__WEBPACK_IMPORTED_MODULE_1__["AWSPinpointProvider"]; });
4219
-
4220
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ "./lib-esm/InAppMessaging/types.js");
4221
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InAppMessageInteractionEvent", function() { return _types__WEBPACK_IMPORTED_MODULE_2__["InAppMessageInteractionEvent"]; });
4222
-
4223
- /*
4224
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4225
- *
4226
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
4227
- * the License. A copy of the License is located at
4228
- *
4229
- * http://aws.amazon.com/apache2.0/
4230
- *
4231
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
4232
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
4233
- * and limitations under the License.
4234
- */
4235
-
4236
-
4237
-
4238
-
4239
- /***/ }),
4240
-
4241
- /***/ "./lib-esm/InAppMessaging/types.js":
4242
- /*!*****************************************!*\
4243
- !*** ./lib-esm/InAppMessaging/types.js ***!
4244
- \*****************************************/
4245
- /*! exports provided: InAppMessageInteractionEvent */
4246
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4247
-
4248
- "use strict";
4249
- __webpack_require__.r(__webpack_exports__);
4250
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InAppMessageInteractionEvent", function() { return InAppMessageInteractionEvent; });
4251
- var InAppMessageInteractionEvent;
4252
-
4253
- (function (InAppMessageInteractionEvent) {
4254
- InAppMessageInteractionEvent["MESSAGE_RECEIVED"] = "MESSAGE_RECEIVED_EVENT";
4255
- InAppMessageInteractionEvent["MESSAGE_DISPLAYED"] = "MESSAGE_DISPLAYED_EVENT";
4256
- InAppMessageInteractionEvent["MESSAGE_DISMISSED"] = "MESSAGE_DISMISSED_EVENT";
4257
- InAppMessageInteractionEvent["MESSAGE_ACTION_TAKEN"] = "MESSAGE_ACTION_TAKEN_EVENT";
4258
- })(InAppMessageInteractionEvent || (InAppMessageInteractionEvent = {}));
4259
-
4260
- /***/ }),
4261
-
4262
- /***/ "./lib-esm/Notifications.js":
4263
- /*!**********************************!*\
4264
- !*** ./lib-esm/Notifications.js ***!
4265
- \**********************************/
4266
- /*! exports provided: default */
4267
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4268
-
4269
- "use strict";
4270
- __webpack_require__.r(__webpack_exports__);
4271
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
4272
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
4273
- /* harmony import */ var _InAppMessaging__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./InAppMessaging */ "./lib-esm/InAppMessaging/index.js");
4274
- /*
4275
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4276
- *
4277
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
4278
- * the License. A copy of the License is located at
4279
- *
4280
- * http://aws.amazon.com/apache2.0/
4281
- *
4282
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
4283
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
4284
- * and limitations under the License.
4285
- */
4286
- var __assign = undefined && undefined.__assign || function () {
4287
- __assign = Object.assign || function (t) {
4288
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4289
- s = arguments[i];
4290
-
4291
- for (var p in s) {
4292
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4293
- }
4294
- }
4295
-
4296
- return t;
4297
- };
4298
-
4299
- return __assign.apply(this, arguments);
4300
- };
4301
-
4302
-
4303
-
4304
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('Notifications');
4305
-
4306
- var NotificationsClass =
4307
- /** @class */
4308
- function () {
4309
- function NotificationsClass() {
4310
- var _this = this;
4311
-
4312
- this.config = {};
4313
- /**
4314
- * Configure Notifications
4315
- * @param {Object} config - Notifications configuration object
4316
- */
4317
-
4318
- this.configure = function (_a) {
4319
- var config = (_a === void 0 ? {} : _a).Notifications;
4320
- _this.config = __assign(__assign({}, _this.config), config);
4321
- logger.debug('configure Notifications', config); // Configure sub-categories
4322
-
4323
- _this.inAppMessaging.configure(_this.config.InAppMessaging);
4324
-
4325
- return _this.config;
4326
- };
4327
-
4328
- this.inAppMessaging = new _InAppMessaging__WEBPACK_IMPORTED_MODULE_1__["default"]();
4329
- }
4330
- /**
4331
- * Get the name of the module category
4332
- * @returns {string} name of the module category
4333
- */
4334
-
4335
-
4336
- NotificationsClass.prototype.getModuleName = function () {
4337
- return 'Notifications';
4338
- };
4339
-
4340
- Object.defineProperty(NotificationsClass.prototype, "InAppMessaging", {
4341
- get: function get() {
4342
- return this.inAppMessaging;
4343
- },
4344
- enumerable: true,
4345
- configurable: true
4346
- });
4347
- return NotificationsClass;
4348
- }();
4349
-
4350
- var Notifications = new NotificationsClass();
4351
- /* harmony default export */ __webpack_exports__["default"] = (Notifications);
4352
- _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Amplify"].register(Notifications);
4353
-
4354
- /***/ }),
4355
-
4356
- /***/ "./lib-esm/index.js":
4357
- /*!**************************!*\
4358
- !*** ./lib-esm/index.js ***!
4359
- \**************************/
4360
- /*! exports provided: Notifications, InAppMessageInteractionEvent */
4361
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4362
-
4363
- "use strict";
4364
- __webpack_require__.r(__webpack_exports__);
4365
- /* harmony import */ var _Notifications__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Notifications */ "./lib-esm/Notifications.js");
4366
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Notifications", function() { return _Notifications__WEBPACK_IMPORTED_MODULE_0__["default"]; });
4367
-
4368
- /* harmony import */ var _InAppMessaging__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./InAppMessaging */ "./lib-esm/InAppMessaging/index.js");
4369
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InAppMessageInteractionEvent", function() { return _InAppMessaging__WEBPACK_IMPORTED_MODULE_1__["InAppMessageInteractionEvent"]; });
4370
-
4371
- /*
4372
- * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4373
- *
4374
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
4375
- * the License. A copy of the License is located at
4376
- *
4377
- * http://aws.amazon.com/apache2.0/
4378
- *
4379
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
4380
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
4381
- * and limitations under the License.
4382
- */
4383
-
4384
-
4385
-
4386
- /***/ }),
4387
-
4388
- /***/ "@aws-amplify/cache":
4389
- /*!************************************!*\
4390
- !*** external "aws_amplify_cache" ***!
4391
- \************************************/
4392
- /*! no static exports found */
4393
- /***/ (function(module, exports) {
4394
-
4395
- module.exports = __WEBPACK_EXTERNAL_MODULE__aws_amplify_cache__;
4396
-
4397
- /***/ }),
4398
-
4399
- /***/ "@aws-amplify/core":
4400
- /*!***********************************!*\
4401
- !*** external "aws_amplify_core" ***!
4402
- \***********************************/
4403
- /*! no static exports found */
4404
- /***/ (function(module, exports) {
4405
-
4406
- module.exports = __WEBPACK_EXTERNAL_MODULE__aws_amplify_core__;
4407
-
4408
- /***/ }),
4409
-
4410
- /***/ "@aws-sdk/client-pinpoint":
4411
- /*!*******************************************!*\
4412
- !*** external "@aws-sdk/client-pinpoint" ***!
4413
- \*******************************************/
4414
- /*! no static exports found */
4415
- /***/ (function(module, exports) {
4416
-
4417
- module.exports = __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_pinpoint__;
4418
-
4419
- /***/ })
4420
-
4421
- /******/ });
4422
- });
4423
- //# sourceMappingURL=aws-amplify-notifications.js.map