@aws-amplify/analytics 5.2.23-legacy-ui-tests.14 → 5.2.23-unstable.11
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.
|
@@ -51430,7 +51430,7 @@ var EventStreamMarshaller = /** @class */ (function () {
|
|
|
51430
51430
|
__webpack_require__.r(__webpack_exports__);
|
|
51431
51431
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HeaderMarshaller", function() { return HeaderMarshaller; });
|
|
51432
51432
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
|
|
51433
|
-
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
51433
|
+
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/eventstream-marshaller/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
51434
51434
|
/* harmony import */ var _Int64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Int64 */ "../../node_modules/@aws-sdk/eventstream-marshaller/dist/es/Int64.js");
|
|
51435
51435
|
|
|
51436
51436
|
|
|
@@ -51655,7 +51655,7 @@ var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12
|
|
|
51655
51655
|
"use strict";
|
|
51656
51656
|
__webpack_require__.r(__webpack_exports__);
|
|
51657
51657
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Int64", function() { return Int64; });
|
|
51658
|
-
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
51658
|
+
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/eventstream-marshaller/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
51659
51659
|
|
|
51660
51660
|
/**
|
|
51661
51661
|
* A lossless representation of a signed, 64-bit integer. Instances of this
|
|
@@ -51806,6 +51806,64 @@ function splitMessage(_a) {
|
|
|
51806
51806
|
|
|
51807
51807
|
/***/ }),
|
|
51808
51808
|
|
|
51809
|
+
/***/ "../../node_modules/@aws-sdk/eventstream-marshaller/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js":
|
|
51810
|
+
/*!******************************************************************************************************************************!*\
|
|
51811
|
+
!*** /root/amplify-js/node_modules/@aws-sdk/eventstream-marshaller/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js ***!
|
|
51812
|
+
\******************************************************************************************************************************/
|
|
51813
|
+
/*! exports provided: fromHex, toHex */
|
|
51814
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
51815
|
+
|
|
51816
|
+
"use strict";
|
|
51817
|
+
__webpack_require__.r(__webpack_exports__);
|
|
51818
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromHex", function() { return fromHex; });
|
|
51819
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toHex", function() { return toHex; });
|
|
51820
|
+
var SHORT_TO_HEX = {};
|
|
51821
|
+
var HEX_TO_SHORT = {};
|
|
51822
|
+
for (var i = 0; i < 256; i++) {
|
|
51823
|
+
var encodedByte = i.toString(16).toLowerCase();
|
|
51824
|
+
if (encodedByte.length === 1) {
|
|
51825
|
+
encodedByte = "0" + encodedByte;
|
|
51826
|
+
}
|
|
51827
|
+
SHORT_TO_HEX[i] = encodedByte;
|
|
51828
|
+
HEX_TO_SHORT[encodedByte] = i;
|
|
51829
|
+
}
|
|
51830
|
+
/**
|
|
51831
|
+
* Converts a hexadecimal encoded string to a Uint8Array of bytes.
|
|
51832
|
+
*
|
|
51833
|
+
* @param encoded The hexadecimal encoded string
|
|
51834
|
+
*/
|
|
51835
|
+
function fromHex(encoded) {
|
|
51836
|
+
if (encoded.length % 2 !== 0) {
|
|
51837
|
+
throw new Error("Hex encoded strings must have an even number length");
|
|
51838
|
+
}
|
|
51839
|
+
var out = new Uint8Array(encoded.length / 2);
|
|
51840
|
+
for (var i = 0; i < encoded.length; i += 2) {
|
|
51841
|
+
var encodedByte = encoded.substr(i, 2).toLowerCase();
|
|
51842
|
+
if (encodedByte in HEX_TO_SHORT) {
|
|
51843
|
+
out[i / 2] = HEX_TO_SHORT[encodedByte];
|
|
51844
|
+
}
|
|
51845
|
+
else {
|
|
51846
|
+
throw new Error("Cannot decode unrecognized sequence " + encodedByte + " as hexadecimal");
|
|
51847
|
+
}
|
|
51848
|
+
}
|
|
51849
|
+
return out;
|
|
51850
|
+
}
|
|
51851
|
+
/**
|
|
51852
|
+
* Converts a Uint8Array of binary data to a hexadecimal encoded string.
|
|
51853
|
+
*
|
|
51854
|
+
* @param bytes The binary data to encode
|
|
51855
|
+
*/
|
|
51856
|
+
function toHex(bytes) {
|
|
51857
|
+
var out = "";
|
|
51858
|
+
for (var i = 0; i < bytes.byteLength; i++) {
|
|
51859
|
+
out += SHORT_TO_HEX[bytes[i]];
|
|
51860
|
+
}
|
|
51861
|
+
return out;
|
|
51862
|
+
}
|
|
51863
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBTSxZQUFZLEdBQThCLEVBQUUsQ0FBQztBQUNuRCxJQUFNLFlBQVksR0FBOEIsRUFBRSxDQUFDO0FBRW5ELEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxHQUFHLEVBQUUsQ0FBQyxFQUFFLEVBQUU7SUFDNUIsSUFBSSxXQUFXLEdBQUcsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsQ0FBQyxXQUFXLEVBQUUsQ0FBQztJQUMvQyxJQUFJLFdBQVcsQ0FBQyxNQUFNLEtBQUssQ0FBQyxFQUFFO1FBQzVCLFdBQVcsR0FBRyxNQUFJLFdBQWEsQ0FBQztLQUNqQztJQUVELFlBQVksQ0FBQyxDQUFDLENBQUMsR0FBRyxXQUFXLENBQUM7SUFDOUIsWUFBWSxDQUFDLFdBQVcsQ0FBQyxHQUFHLENBQUMsQ0FBQztDQUMvQjtBQUVEOzs7O0dBSUc7QUFDSCxNQUFNLFVBQVUsT0FBTyxDQUFDLE9BQWU7SUFDckMsSUFBSSxPQUFPLENBQUMsTUFBTSxHQUFHLENBQUMsS0FBSyxDQUFDLEVBQUU7UUFDNUIsTUFBTSxJQUFJLEtBQUssQ0FBQyxxREFBcUQsQ0FBQyxDQUFDO0tBQ3hFO0lBRUQsSUFBTSxHQUFHLEdBQUcsSUFBSSxVQUFVLENBQUMsT0FBTyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQztJQUMvQyxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsT0FBTyxDQUFDLE1BQU0sRUFBRSxDQUFDLElBQUksQ0FBQyxFQUFFO1FBQzFDLElBQU0sV0FBVyxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLFdBQVcsRUFBRSxDQUFDO1FBQ3ZELElBQUksV0FBVyxJQUFJLFlBQVksRUFBRTtZQUMvQixHQUFHLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxHQUFHLFlBQVksQ0FBQyxXQUFXLENBQUMsQ0FBQztTQUN4QzthQUFNO1lBQ0wsTUFBTSxJQUFJLEtBQUssQ0FBQyx5Q0FBdUMsV0FBVyxvQkFBaUIsQ0FBQyxDQUFDO1NBQ3RGO0tBQ0Y7SUFFRCxPQUFPLEdBQUcsQ0FBQztBQUNiLENBQUM7QUFFRDs7OztHQUlHO0FBQ0gsTUFBTSxVQUFVLEtBQUssQ0FBQyxLQUFpQjtJQUNyQyxJQUFJLEdBQUcsR0FBRyxFQUFFLENBQUM7SUFDYixLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsS0FBSyxDQUFDLFVBQVUsRUFBRSxDQUFDLEVBQUUsRUFBRTtRQUN6QyxHQUFHLElBQUksWUFBWSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0tBQy9CO0lBRUQsT0FBTyxHQUFHLENBQUM7QUFDYixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiY29uc3QgU0hPUlRfVE9fSEVYOiB7IFtrZXk6IG51bWJlcl06IHN0cmluZyB9ID0ge307XG5jb25zdCBIRVhfVE9fU0hPUlQ6IHsgW2tleTogc3RyaW5nXTogbnVtYmVyIH0gPSB7fTtcblxuZm9yIChsZXQgaSA9IDA7IGkgPCAyNTY7IGkrKykge1xuICBsZXQgZW5jb2RlZEJ5dGUgPSBpLnRvU3RyaW5nKDE2KS50b0xvd2VyQ2FzZSgpO1xuICBpZiAoZW5jb2RlZEJ5dGUubGVuZ3RoID09PSAxKSB7XG4gICAgZW5jb2RlZEJ5dGUgPSBgMCR7ZW5jb2RlZEJ5dGV9YDtcbiAgfVxuXG4gIFNIT1JUX1RPX0hFWFtpXSA9IGVuY29kZWRCeXRlO1xuICBIRVhfVE9fU0hPUlRbZW5jb2RlZEJ5dGVdID0gaTtcbn1cblxuLyoqXG4gKiBDb252ZXJ0cyBhIGhleGFkZWNpbWFsIGVuY29kZWQgc3RyaW5nIHRvIGEgVWludDhBcnJheSBvZiBieXRlcy5cbiAqXG4gKiBAcGFyYW0gZW5jb2RlZCBUaGUgaGV4YWRlY2ltYWwgZW5jb2RlZCBzdHJpbmdcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGZyb21IZXgoZW5jb2RlZDogc3RyaW5nKTogVWludDhBcnJheSB7XG4gIGlmIChlbmNvZGVkLmxlbmd0aCAlIDIgIT09IDApIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoXCJIZXggZW5jb2RlZCBzdHJpbmdzIG11c3QgaGF2ZSBhbiBldmVuIG51bWJlciBsZW5ndGhcIik7XG4gIH1cblxuICBjb25zdCBvdXQgPSBuZXcgVWludDhBcnJheShlbmNvZGVkLmxlbmd0aCAvIDIpO1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGVuY29kZWQubGVuZ3RoOyBpICs9IDIpIHtcbiAgICBjb25zdCBlbmNvZGVkQnl0ZSA9IGVuY29kZWQuc3Vic3RyKGksIDIpLnRvTG93ZXJDYXNlKCk7XG4gICAgaWYgKGVuY29kZWRCeXRlIGluIEhFWF9UT19TSE9SVCkge1xuICAgICAgb3V0W2kgLyAyXSA9IEhFWF9UT19TSE9SVFtlbmNvZGVkQnl0ZV07XG4gICAgfSBlbHNlIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihgQ2Fubm90IGRlY29kZSB1bnJlY29nbml6ZWQgc2VxdWVuY2UgJHtlbmNvZGVkQnl0ZX0gYXMgaGV4YWRlY2ltYWxgKTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gb3V0O1xufVxuXG4vKipcbiAqIENvbnZlcnRzIGEgVWludDhBcnJheSBvZiBiaW5hcnkgZGF0YSB0byBhIGhleGFkZWNpbWFsIGVuY29kZWQgc3RyaW5nLlxuICpcbiAqIEBwYXJhbSBieXRlcyBUaGUgYmluYXJ5IGRhdGEgdG8gZW5jb2RlXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiB0b0hleChieXRlczogVWludDhBcnJheSk6IHN0cmluZyB7XG4gIGxldCBvdXQgPSBcIlwiO1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGJ5dGVzLmJ5dGVMZW5ndGg7IGkrKykge1xuICAgIG91dCArPSBTSE9SVF9UT19IRVhbYnl0ZXNbaV1dO1xuICB9XG5cbiAgcmV0dXJuIG91dDtcbn1cbiJdfQ==
|
|
51864
|
+
|
|
51865
|
+
/***/ }),
|
|
51866
|
+
|
|
51809
51867
|
/***/ "../../node_modules/@aws-sdk/eventstream-serde-browser/dist/es/EventStreamMarshaller.js":
|
|
51810
51868
|
/*!*********************************************************************************************************!*\
|
|
51811
51869
|
!*** /root/amplify-js/node_modules/@aws-sdk/eventstream-serde-browser/dist/es/EventStreamMarshaller.js ***!
|
|
@@ -53824,7 +53882,7 @@ var isArrayBuffer = function (arg) {
|
|
|
53824
53882
|
__webpack_require__.r(__webpack_exports__);
|
|
53825
53883
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SignatureV4", function() { return SignatureV4; });
|
|
53826
53884
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
|
|
53827
|
-
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
53885
|
+
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
53828
53886
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/signature-v4/dist/es/constants.js");
|
|
53829
53887
|
/* harmony import */ var _credentialDerivation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./credentialDerivation */ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/signature-v4/dist/es/credentialDerivation.js");
|
|
53830
53888
|
/* harmony import */ var _getCanonicalHeaders__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./getCanonicalHeaders */ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/signature-v4/dist/es/getCanonicalHeaders.js");
|
|
@@ -54247,7 +54305,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
54247
54305
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSigningKey", function() { return getSigningKey; });
|
|
54248
54306
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clearCredentialCache", function() { return clearCredentialCache; });
|
|
54249
54307
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
|
|
54250
|
-
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
54308
|
+
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
54251
54309
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/signature-v4/dist/es/constants.js");
|
|
54252
54310
|
|
|
54253
54311
|
|
|
@@ -54464,7 +54522,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
54464
54522
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPayloadHash", function() { return getPayloadHash; });
|
|
54465
54523
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
|
|
54466
54524
|
/* harmony import */ var _aws_sdk_is_array_buffer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-sdk/is-array-buffer */ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/is-array-buffer/dist/es/index.js");
|
|
54467
|
-
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
54525
|
+
/* harmony import */ var _aws_sdk_util_hex_encoding__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-sdk/util-hex-encoding */ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js");
|
|
54468
54526
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/signature-v4/dist/es/constants.js");
|
|
54469
54527
|
|
|
54470
54528
|
|
|
@@ -54701,6 +54759,64 @@ function toDate(time) {
|
|
|
54701
54759
|
|
|
54702
54760
|
/***/ }),
|
|
54703
54761
|
|
|
54762
|
+
/***/ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js":
|
|
54763
|
+
/*!**************************************************************************************************************************!*\
|
|
54764
|
+
!*** /root/amplify-js/node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js ***!
|
|
54765
|
+
\**************************************************************************************************************************/
|
|
54766
|
+
/*! exports provided: fromHex, toHex */
|
|
54767
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
54768
|
+
|
|
54769
|
+
"use strict";
|
|
54770
|
+
__webpack_require__.r(__webpack_exports__);
|
|
54771
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromHex", function() { return fromHex; });
|
|
54772
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toHex", function() { return toHex; });
|
|
54773
|
+
var SHORT_TO_HEX = {};
|
|
54774
|
+
var HEX_TO_SHORT = {};
|
|
54775
|
+
for (var i = 0; i < 256; i++) {
|
|
54776
|
+
var encodedByte = i.toString(16).toLowerCase();
|
|
54777
|
+
if (encodedByte.length === 1) {
|
|
54778
|
+
encodedByte = "0" + encodedByte;
|
|
54779
|
+
}
|
|
54780
|
+
SHORT_TO_HEX[i] = encodedByte;
|
|
54781
|
+
HEX_TO_SHORT[encodedByte] = i;
|
|
54782
|
+
}
|
|
54783
|
+
/**
|
|
54784
|
+
* Converts a hexadecimal encoded string to a Uint8Array of bytes.
|
|
54785
|
+
*
|
|
54786
|
+
* @param encoded The hexadecimal encoded string
|
|
54787
|
+
*/
|
|
54788
|
+
function fromHex(encoded) {
|
|
54789
|
+
if (encoded.length % 2 !== 0) {
|
|
54790
|
+
throw new Error("Hex encoded strings must have an even number length");
|
|
54791
|
+
}
|
|
54792
|
+
var out = new Uint8Array(encoded.length / 2);
|
|
54793
|
+
for (var i = 0; i < encoded.length; i += 2) {
|
|
54794
|
+
var encodedByte = encoded.substr(i, 2).toLowerCase();
|
|
54795
|
+
if (encodedByte in HEX_TO_SHORT) {
|
|
54796
|
+
out[i / 2] = HEX_TO_SHORT[encodedByte];
|
|
54797
|
+
}
|
|
54798
|
+
else {
|
|
54799
|
+
throw new Error("Cannot decode unrecognized sequence " + encodedByte + " as hexadecimal");
|
|
54800
|
+
}
|
|
54801
|
+
}
|
|
54802
|
+
return out;
|
|
54803
|
+
}
|
|
54804
|
+
/**
|
|
54805
|
+
* Converts a Uint8Array of binary data to a hexadecimal encoded string.
|
|
54806
|
+
*
|
|
54807
|
+
* @param bytes The binary data to encode
|
|
54808
|
+
*/
|
|
54809
|
+
function toHex(bytes) {
|
|
54810
|
+
var out = "";
|
|
54811
|
+
for (var i = 0; i < bytes.byteLength; i++) {
|
|
54812
|
+
out += SHORT_TO_HEX[bytes[i]];
|
|
54813
|
+
}
|
|
54814
|
+
return out;
|
|
54815
|
+
}
|
|
54816
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBTSxZQUFZLEdBQThCLEVBQUUsQ0FBQztBQUNuRCxJQUFNLFlBQVksR0FBOEIsRUFBRSxDQUFDO0FBRW5ELEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxHQUFHLEVBQUUsQ0FBQyxFQUFFLEVBQUU7SUFDNUIsSUFBSSxXQUFXLEdBQUcsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsQ0FBQyxXQUFXLEVBQUUsQ0FBQztJQUMvQyxJQUFJLFdBQVcsQ0FBQyxNQUFNLEtBQUssQ0FBQyxFQUFFO1FBQzVCLFdBQVcsR0FBRyxNQUFJLFdBQWEsQ0FBQztLQUNqQztJQUVELFlBQVksQ0FBQyxDQUFDLENBQUMsR0FBRyxXQUFXLENBQUM7SUFDOUIsWUFBWSxDQUFDLFdBQVcsQ0FBQyxHQUFHLENBQUMsQ0FBQztDQUMvQjtBQUVEOzs7O0dBSUc7QUFDSCxNQUFNLFVBQVUsT0FBTyxDQUFDLE9BQWU7SUFDckMsSUFBSSxPQUFPLENBQUMsTUFBTSxHQUFHLENBQUMsS0FBSyxDQUFDLEVBQUU7UUFDNUIsTUFBTSxJQUFJLEtBQUssQ0FBQyxxREFBcUQsQ0FBQyxDQUFDO0tBQ3hFO0lBRUQsSUFBTSxHQUFHLEdBQUcsSUFBSSxVQUFVLENBQUMsT0FBTyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQztJQUMvQyxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsT0FBTyxDQUFDLE1BQU0sRUFBRSxDQUFDLElBQUksQ0FBQyxFQUFFO1FBQzFDLElBQU0sV0FBVyxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLFdBQVcsRUFBRSxDQUFDO1FBQ3ZELElBQUksV0FBVyxJQUFJLFlBQVksRUFBRTtZQUMvQixHQUFHLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxHQUFHLFlBQVksQ0FBQyxXQUFXLENBQUMsQ0FBQztTQUN4QzthQUFNO1lBQ0wsTUFBTSxJQUFJLEtBQUssQ0FBQyx5Q0FBdUMsV0FBVyxvQkFBaUIsQ0FBQyxDQUFDO1NBQ3RGO0tBQ0Y7SUFFRCxPQUFPLEdBQUcsQ0FBQztBQUNiLENBQUM7QUFFRDs7OztHQUlHO0FBQ0gsTUFBTSxVQUFVLEtBQUssQ0FBQyxLQUFpQjtJQUNyQyxJQUFJLEdBQUcsR0FBRyxFQUFFLENBQUM7SUFDYixLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsS0FBSyxDQUFDLFVBQVUsRUFBRSxDQUFDLEVBQUUsRUFBRTtRQUN6QyxHQUFHLElBQUksWUFBWSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0tBQy9CO0lBRUQsT0FBTyxHQUFHLENBQUM7QUFDYixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiY29uc3QgU0hPUlRfVE9fSEVYOiB7IFtrZXk6IG51bWJlcl06IHN0cmluZyB9ID0ge307XG5jb25zdCBIRVhfVE9fU0hPUlQ6IHsgW2tleTogc3RyaW5nXTogbnVtYmVyIH0gPSB7fTtcblxuZm9yIChsZXQgaSA9IDA7IGkgPCAyNTY7IGkrKykge1xuICBsZXQgZW5jb2RlZEJ5dGUgPSBpLnRvU3RyaW5nKDE2KS50b0xvd2VyQ2FzZSgpO1xuICBpZiAoZW5jb2RlZEJ5dGUubGVuZ3RoID09PSAxKSB7XG4gICAgZW5jb2RlZEJ5dGUgPSBgMCR7ZW5jb2RlZEJ5dGV9YDtcbiAgfVxuXG4gIFNIT1JUX1RPX0hFWFtpXSA9IGVuY29kZWRCeXRlO1xuICBIRVhfVE9fU0hPUlRbZW5jb2RlZEJ5dGVdID0gaTtcbn1cblxuLyoqXG4gKiBDb252ZXJ0cyBhIGhleGFkZWNpbWFsIGVuY29kZWQgc3RyaW5nIHRvIGEgVWludDhBcnJheSBvZiBieXRlcy5cbiAqXG4gKiBAcGFyYW0gZW5jb2RlZCBUaGUgaGV4YWRlY2ltYWwgZW5jb2RlZCBzdHJpbmdcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGZyb21IZXgoZW5jb2RlZDogc3RyaW5nKTogVWludDhBcnJheSB7XG4gIGlmIChlbmNvZGVkLmxlbmd0aCAlIDIgIT09IDApIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoXCJIZXggZW5jb2RlZCBzdHJpbmdzIG11c3QgaGF2ZSBhbiBldmVuIG51bWJlciBsZW5ndGhcIik7XG4gIH1cblxuICBjb25zdCBvdXQgPSBuZXcgVWludDhBcnJheShlbmNvZGVkLmxlbmd0aCAvIDIpO1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGVuY29kZWQubGVuZ3RoOyBpICs9IDIpIHtcbiAgICBjb25zdCBlbmNvZGVkQnl0ZSA9IGVuY29kZWQuc3Vic3RyKGksIDIpLnRvTG93ZXJDYXNlKCk7XG4gICAgaWYgKGVuY29kZWRCeXRlIGluIEhFWF9UT19TSE9SVCkge1xuICAgICAgb3V0W2kgLyAyXSA9IEhFWF9UT19TSE9SVFtlbmNvZGVkQnl0ZV07XG4gICAgfSBlbHNlIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihgQ2Fubm90IGRlY29kZSB1bnJlY29nbml6ZWQgc2VxdWVuY2UgJHtlbmNvZGVkQnl0ZX0gYXMgaGV4YWRlY2ltYWxgKTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gb3V0O1xufVxuXG4vKipcbiAqIENvbnZlcnRzIGEgVWludDhBcnJheSBvZiBiaW5hcnkgZGF0YSB0byBhIGhleGFkZWNpbWFsIGVuY29kZWQgc3RyaW5nLlxuICpcbiAqIEBwYXJhbSBieXRlcyBUaGUgYmluYXJ5IGRhdGEgdG8gZW5jb2RlXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiB0b0hleChieXRlczogVWludDhBcnJheSk6IHN0cmluZyB7XG4gIGxldCBvdXQgPSBcIlwiO1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGJ5dGVzLmJ5dGVMZW5ndGg7IGkrKykge1xuICAgIG91dCArPSBTSE9SVF9UT19IRVhbYnl0ZXNbaV1dO1xuICB9XG5cbiAgcmV0dXJuIG91dDtcbn1cbiJdfQ==
|
|
54817
|
+
|
|
54818
|
+
/***/ }),
|
|
54819
|
+
|
|
54704
54820
|
/***/ "../../node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/util-uri-escape/dist/es/escape-uri-path.js":
|
|
54705
54821
|
/*!**********************************************************************************************************************************!*\
|
|
54706
54822
|
!*** /root/amplify-js/node_modules/@aws-sdk/middleware-signing/node_modules/@aws-sdk/util-uri-escape/dist/es/escape-uri-path.js ***!
|
|
@@ -56065,64 +56181,6 @@ function calculateBodyLength(body) {
|
|
|
56065
56181
|
|
|
56066
56182
|
/***/ }),
|
|
56067
56183
|
|
|
56068
|
-
/***/ "../../node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js":
|
|
56069
|
-
/*!*********************************************************************************!*\
|
|
56070
|
-
!*** /root/amplify-js/node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js ***!
|
|
56071
|
-
\*********************************************************************************/
|
|
56072
|
-
/*! exports provided: fromHex, toHex */
|
|
56073
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
56074
|
-
|
|
56075
|
-
"use strict";
|
|
56076
|
-
__webpack_require__.r(__webpack_exports__);
|
|
56077
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromHex", function() { return fromHex; });
|
|
56078
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toHex", function() { return toHex; });
|
|
56079
|
-
var SHORT_TO_HEX = {};
|
|
56080
|
-
var HEX_TO_SHORT = {};
|
|
56081
|
-
for (var i = 0; i < 256; i++) {
|
|
56082
|
-
var encodedByte = i.toString(16).toLowerCase();
|
|
56083
|
-
if (encodedByte.length === 1) {
|
|
56084
|
-
encodedByte = "0" + encodedByte;
|
|
56085
|
-
}
|
|
56086
|
-
SHORT_TO_HEX[i] = encodedByte;
|
|
56087
|
-
HEX_TO_SHORT[encodedByte] = i;
|
|
56088
|
-
}
|
|
56089
|
-
/**
|
|
56090
|
-
* Converts a hexadecimal encoded string to a Uint8Array of bytes.
|
|
56091
|
-
*
|
|
56092
|
-
* @param encoded The hexadecimal encoded string
|
|
56093
|
-
*/
|
|
56094
|
-
function fromHex(encoded) {
|
|
56095
|
-
if (encoded.length % 2 !== 0) {
|
|
56096
|
-
throw new Error("Hex encoded strings must have an even number length");
|
|
56097
|
-
}
|
|
56098
|
-
var out = new Uint8Array(encoded.length / 2);
|
|
56099
|
-
for (var i = 0; i < encoded.length; i += 2) {
|
|
56100
|
-
var encodedByte = encoded.substr(i, 2).toLowerCase();
|
|
56101
|
-
if (encodedByte in HEX_TO_SHORT) {
|
|
56102
|
-
out[i / 2] = HEX_TO_SHORT[encodedByte];
|
|
56103
|
-
}
|
|
56104
|
-
else {
|
|
56105
|
-
throw new Error("Cannot decode unrecognized sequence " + encodedByte + " as hexadecimal");
|
|
56106
|
-
}
|
|
56107
|
-
}
|
|
56108
|
-
return out;
|
|
56109
|
-
}
|
|
56110
|
-
/**
|
|
56111
|
-
* Converts a Uint8Array of binary data to a hexadecimal encoded string.
|
|
56112
|
-
*
|
|
56113
|
-
* @param bytes The binary data to encode
|
|
56114
|
-
*/
|
|
56115
|
-
function toHex(bytes) {
|
|
56116
|
-
var out = "";
|
|
56117
|
-
for (var i = 0; i < bytes.byteLength; i++) {
|
|
56118
|
-
out += SHORT_TO_HEX[bytes[i]];
|
|
56119
|
-
}
|
|
56120
|
-
return out;
|
|
56121
|
-
}
|
|
56122
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBTSxZQUFZLEdBQThCLEVBQUUsQ0FBQztBQUNuRCxJQUFNLFlBQVksR0FBOEIsRUFBRSxDQUFDO0FBRW5ELEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxHQUFHLEVBQUUsQ0FBQyxFQUFFLEVBQUU7SUFDNUIsSUFBSSxXQUFXLEdBQUcsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsQ0FBQyxXQUFXLEVBQUUsQ0FBQztJQUMvQyxJQUFJLFdBQVcsQ0FBQyxNQUFNLEtBQUssQ0FBQyxFQUFFO1FBQzVCLFdBQVcsR0FBRyxNQUFJLFdBQWEsQ0FBQztLQUNqQztJQUVELFlBQVksQ0FBQyxDQUFDLENBQUMsR0FBRyxXQUFXLENBQUM7SUFDOUIsWUFBWSxDQUFDLFdBQVcsQ0FBQyxHQUFHLENBQUMsQ0FBQztDQUMvQjtBQUVEOzs7O0dBSUc7QUFDSCxNQUFNLFVBQVUsT0FBTyxDQUFDLE9BQWU7SUFDckMsSUFBSSxPQUFPLENBQUMsTUFBTSxHQUFHLENBQUMsS0FBSyxDQUFDLEVBQUU7UUFDNUIsTUFBTSxJQUFJLEtBQUssQ0FBQyxxREFBcUQsQ0FBQyxDQUFDO0tBQ3hFO0lBRUQsSUFBTSxHQUFHLEdBQUcsSUFBSSxVQUFVLENBQUMsT0FBTyxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQztJQUMvQyxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsT0FBTyxDQUFDLE1BQU0sRUFBRSxDQUFDLElBQUksQ0FBQyxFQUFFO1FBQzFDLElBQU0sV0FBVyxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLFdBQVcsRUFBRSxDQUFDO1FBQ3ZELElBQUksV0FBVyxJQUFJLFlBQVksRUFBRTtZQUMvQixHQUFHLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxHQUFHLFlBQVksQ0FBQyxXQUFXLENBQUMsQ0FBQztTQUN4QzthQUFNO1lBQ0wsTUFBTSxJQUFJLEtBQUssQ0FBQyx5Q0FBdUMsV0FBVyxvQkFBaUIsQ0FBQyxDQUFDO1NBQ3RGO0tBQ0Y7SUFFRCxPQUFPLEdBQUcsQ0FBQztBQUNiLENBQUM7QUFFRDs7OztHQUlHO0FBQ0gsTUFBTSxVQUFVLEtBQUssQ0FBQyxLQUFpQjtJQUNyQyxJQUFJLEdBQUcsR0FBRyxFQUFFLENBQUM7SUFDYixLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsS0FBSyxDQUFDLFVBQVUsRUFBRSxDQUFDLEVBQUUsRUFBRTtRQUN6QyxHQUFHLElBQUksWUFBWSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0tBQy9CO0lBRUQsT0FBTyxHQUFHLENBQUM7QUFDYixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiY29uc3QgU0hPUlRfVE9fSEVYOiB7IFtrZXk6IG51bWJlcl06IHN0cmluZyB9ID0ge307XG5jb25zdCBIRVhfVE9fU0hPUlQ6IHsgW2tleTogc3RyaW5nXTogbnVtYmVyIH0gPSB7fTtcblxuZm9yIChsZXQgaSA9IDA7IGkgPCAyNTY7IGkrKykge1xuICBsZXQgZW5jb2RlZEJ5dGUgPSBpLnRvU3RyaW5nKDE2KS50b0xvd2VyQ2FzZSgpO1xuICBpZiAoZW5jb2RlZEJ5dGUubGVuZ3RoID09PSAxKSB7XG4gICAgZW5jb2RlZEJ5dGUgPSBgMCR7ZW5jb2RlZEJ5dGV9YDtcbiAgfVxuXG4gIFNIT1JUX1RPX0hFWFtpXSA9IGVuY29kZWRCeXRlO1xuICBIRVhfVE9fU0hPUlRbZW5jb2RlZEJ5dGVdID0gaTtcbn1cblxuLyoqXG4gKiBDb252ZXJ0cyBhIGhleGFkZWNpbWFsIGVuY29kZWQgc3RyaW5nIHRvIGEgVWludDhBcnJheSBvZiBieXRlcy5cbiAqXG4gKiBAcGFyYW0gZW5jb2RlZCBUaGUgaGV4YWRlY2ltYWwgZW5jb2RlZCBzdHJpbmdcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGZyb21IZXgoZW5jb2RlZDogc3RyaW5nKTogVWludDhBcnJheSB7XG4gIGlmIChlbmNvZGVkLmxlbmd0aCAlIDIgIT09IDApIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoXCJIZXggZW5jb2RlZCBzdHJpbmdzIG11c3QgaGF2ZSBhbiBldmVuIG51bWJlciBsZW5ndGhcIik7XG4gIH1cblxuICBjb25zdCBvdXQgPSBuZXcgVWludDhBcnJheShlbmNvZGVkLmxlbmd0aCAvIDIpO1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGVuY29kZWQubGVuZ3RoOyBpICs9IDIpIHtcbiAgICBjb25zdCBlbmNvZGVkQnl0ZSA9IGVuY29kZWQuc3Vic3RyKGksIDIpLnRvTG93ZXJDYXNlKCk7XG4gICAgaWYgKGVuY29kZWRCeXRlIGluIEhFWF9UT19TSE9SVCkge1xuICAgICAgb3V0W2kgLyAyXSA9IEhFWF9UT19TSE9SVFtlbmNvZGVkQnl0ZV07XG4gICAgfSBlbHNlIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihgQ2Fubm90IGRlY29kZSB1bnJlY29nbml6ZWQgc2VxdWVuY2UgJHtlbmNvZGVkQnl0ZX0gYXMgaGV4YWRlY2ltYWxgKTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gb3V0O1xufVxuXG4vKipcbiAqIENvbnZlcnRzIGEgVWludDhBcnJheSBvZiBiaW5hcnkgZGF0YSB0byBhIGhleGFkZWNpbWFsIGVuY29kZWQgc3RyaW5nLlxuICpcbiAqIEBwYXJhbSBieXRlcyBUaGUgYmluYXJ5IGRhdGEgdG8gZW5jb2RlXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiB0b0hleChieXRlczogVWludDhBcnJheSk6IHN0cmluZyB7XG4gIGxldCBvdXQgPSBcIlwiO1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGJ5dGVzLmJ5dGVMZW5ndGg7IGkrKykge1xuICAgIG91dCArPSBTSE9SVF9UT19IRVhbYnl0ZXNbaV1dO1xuICB9XG5cbiAgcmV0dXJuIG91dDtcbn1cbiJdfQ==
|
|
56123
|
-
|
|
56124
|
-
/***/ }),
|
|
56125
|
-
|
|
56126
56184
|
/***/ "../../node_modules/@aws-sdk/util-locate-window/dist-es/index.js":
|
|
56127
56185
|
/*!**********************************************************************************!*\
|
|
56128
56186
|
!*** /root/amplify-js/node_modules/@aws-sdk/util-locate-window/dist-es/index.js ***!
|
|
@@ -63139,25 +63197,20 @@ var __assign = undefined && undefined.__assign || function () {
|
|
|
63139
63197
|
__assign = Object.assign || function (t) {
|
|
63140
63198
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
63141
63199
|
s = arguments[i];
|
|
63142
|
-
|
|
63143
63200
|
for (var p in s) {
|
|
63144
63201
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
63145
63202
|
}
|
|
63146
63203
|
}
|
|
63147
|
-
|
|
63148
63204
|
return t;
|
|
63149
63205
|
};
|
|
63150
|
-
|
|
63151
63206
|
return __assign.apply(this, arguments);
|
|
63152
63207
|
};
|
|
63153
|
-
|
|
63154
63208
|
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
63155
63209
|
function adopt(value) {
|
|
63156
63210
|
return value instanceof P ? value : new P(function (resolve) {
|
|
63157
63211
|
resolve(value);
|
|
63158
63212
|
});
|
|
63159
63213
|
}
|
|
63160
|
-
|
|
63161
63214
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
63162
63215
|
function fulfilled(value) {
|
|
63163
63216
|
try {
|
|
@@ -63166,7 +63219,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
63166
63219
|
reject(e);
|
|
63167
63220
|
}
|
|
63168
63221
|
}
|
|
63169
|
-
|
|
63170
63222
|
function rejected(value) {
|
|
63171
63223
|
try {
|
|
63172
63224
|
step(generator["throw"](value));
|
|
@@ -63174,29 +63226,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
63174
63226
|
reject(e);
|
|
63175
63227
|
}
|
|
63176
63228
|
}
|
|
63177
|
-
|
|
63178
63229
|
function step(result) {
|
|
63179
63230
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
63180
63231
|
}
|
|
63181
|
-
|
|
63182
63232
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
63183
63233
|
});
|
|
63184
63234
|
};
|
|
63185
|
-
|
|
63186
63235
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
63187
63236
|
var _ = {
|
|
63188
|
-
|
|
63189
|
-
|
|
63190
|
-
|
|
63191
|
-
|
|
63237
|
+
label: 0,
|
|
63238
|
+
sent: function sent() {
|
|
63239
|
+
if (t[0] & 1) throw t[1];
|
|
63240
|
+
return t[1];
|
|
63241
|
+
},
|
|
63242
|
+
trys: [],
|
|
63243
|
+
ops: []
|
|
63192
63244
|
},
|
|
63193
|
-
|
|
63194
|
-
|
|
63195
|
-
|
|
63196
|
-
|
|
63197
|
-
y,
|
|
63198
|
-
t,
|
|
63199
|
-
g;
|
|
63245
|
+
f,
|
|
63246
|
+
y,
|
|
63247
|
+
t,
|
|
63248
|
+
g;
|
|
63200
63249
|
return g = {
|
|
63201
63250
|
next: verb(0),
|
|
63202
63251
|
"throw": verb(1),
|
|
@@ -63204,79 +63253,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
63204
63253
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
63205
63254
|
return this;
|
|
63206
63255
|
}), g;
|
|
63207
|
-
|
|
63208
63256
|
function verb(n) {
|
|
63209
63257
|
return function (v) {
|
|
63210
63258
|
return step([n, v]);
|
|
63211
63259
|
};
|
|
63212
63260
|
}
|
|
63213
|
-
|
|
63214
63261
|
function step(op) {
|
|
63215
63262
|
if (f) throw new TypeError("Generator is already executing.");
|
|
63216
|
-
|
|
63217
63263
|
while (_) {
|
|
63218
63264
|
try {
|
|
63219
63265
|
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;
|
|
63220
63266
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
63221
|
-
|
|
63222
63267
|
switch (op[0]) {
|
|
63223
63268
|
case 0:
|
|
63224
63269
|
case 1:
|
|
63225
63270
|
t = op;
|
|
63226
63271
|
break;
|
|
63227
|
-
|
|
63228
63272
|
case 4:
|
|
63229
63273
|
_.label++;
|
|
63230
63274
|
return {
|
|
63231
63275
|
value: op[1],
|
|
63232
63276
|
done: false
|
|
63233
63277
|
};
|
|
63234
|
-
|
|
63235
63278
|
case 5:
|
|
63236
63279
|
_.label++;
|
|
63237
63280
|
y = op[1];
|
|
63238
63281
|
op = [0];
|
|
63239
63282
|
continue;
|
|
63240
|
-
|
|
63241
63283
|
case 7:
|
|
63242
63284
|
op = _.ops.pop();
|
|
63243
|
-
|
|
63244
63285
|
_.trys.pop();
|
|
63245
|
-
|
|
63246
63286
|
continue;
|
|
63247
|
-
|
|
63248
63287
|
default:
|
|
63249
63288
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
63250
63289
|
_ = 0;
|
|
63251
63290
|
continue;
|
|
63252
63291
|
}
|
|
63253
|
-
|
|
63254
63292
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
63255
63293
|
_.label = op[1];
|
|
63256
63294
|
break;
|
|
63257
63295
|
}
|
|
63258
|
-
|
|
63259
63296
|
if (op[0] === 6 && _.label < t[1]) {
|
|
63260
63297
|
_.label = t[1];
|
|
63261
63298
|
t = op;
|
|
63262
63299
|
break;
|
|
63263
63300
|
}
|
|
63264
|
-
|
|
63265
63301
|
if (t && _.label < t[2]) {
|
|
63266
63302
|
_.label = t[2];
|
|
63267
|
-
|
|
63268
63303
|
_.ops.push(op);
|
|
63269
|
-
|
|
63270
63304
|
break;
|
|
63271
63305
|
}
|
|
63272
|
-
|
|
63273
63306
|
if (t[2]) _.ops.pop();
|
|
63274
|
-
|
|
63275
63307
|
_.trys.pop();
|
|
63276
|
-
|
|
63277
63308
|
continue;
|
|
63278
63309
|
}
|
|
63279
|
-
|
|
63280
63310
|
op = body.call(thisArg, _);
|
|
63281
63311
|
} catch (e) {
|
|
63282
63312
|
op = [6, e];
|
|
@@ -63285,7 +63315,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
63285
63315
|
f = t = 0;
|
|
63286
63316
|
}
|
|
63287
63317
|
}
|
|
63288
|
-
|
|
63289
63318
|
if (op[0] & 5) throw op[1];
|
|
63290
63319
|
return {
|
|
63291
63320
|
value: op[0] ? op[1] : void 0,
|
|
@@ -63296,10 +63325,8 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
63296
63325
|
|
|
63297
63326
|
|
|
63298
63327
|
|
|
63299
|
-
|
|
63300
63328
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('AnalyticsClass');
|
|
63301
63329
|
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
63302
|
-
|
|
63303
63330
|
var dispatchAnalyticsEvent = function dispatchAnalyticsEvent(event, data, message) {
|
|
63304
63331
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Hub"].dispatch('analytics', {
|
|
63305
63332
|
event: event,
|
|
@@ -63307,7 +63334,6 @@ var dispatchAnalyticsEvent = function dispatchAnalyticsEvent(event, data, messag
|
|
|
63307
63334
|
message: message
|
|
63308
63335
|
}, 'Analytics', AMPLIFY_SYMBOL);
|
|
63309
63336
|
};
|
|
63310
|
-
|
|
63311
63337
|
var trackers = {
|
|
63312
63338
|
pageView: _trackers__WEBPACK_IMPORTED_MODULE_2__["PageViewTracker"],
|
|
63313
63339
|
event: _trackers__WEBPACK_IMPORTED_MODULE_2__["EventTracker"],
|
|
@@ -63317,10 +63343,7 @@ var _instance = null;
|
|
|
63317
63343
|
/**
|
|
63318
63344
|
* Provide mobile analytics client functions
|
|
63319
63345
|
*/
|
|
63320
|
-
|
|
63321
|
-
var AnalyticsClass =
|
|
63322
|
-
/** @class */
|
|
63323
|
-
function () {
|
|
63346
|
+
var AnalyticsClass = /** @class */function () {
|
|
63324
63347
|
/**
|
|
63325
63348
|
* Initialize Analtyics
|
|
63326
63349
|
* @param config - Configuration of the Analytics
|
|
@@ -63336,7 +63359,6 @@ function () {
|
|
|
63336
63359
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Hub"].listen('storage', listener);
|
|
63337
63360
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Hub"].listen('analytics', listener);
|
|
63338
63361
|
}
|
|
63339
|
-
|
|
63340
63362
|
AnalyticsClass.prototype.getModuleName = function () {
|
|
63341
63363
|
return 'Analytics';
|
|
63342
63364
|
};
|
|
@@ -63344,25 +63366,19 @@ function () {
|
|
|
63344
63366
|
* configure Analytics
|
|
63345
63367
|
* @param {Object} config - Configuration of the Analytics
|
|
63346
63368
|
*/
|
|
63347
|
-
|
|
63348
|
-
|
|
63349
63369
|
AnalyticsClass.prototype.configure = function (config) {
|
|
63350
63370
|
var _this = this;
|
|
63351
|
-
|
|
63352
63371
|
if (!config) return this._config;
|
|
63353
63372
|
logger.debug('configure Analytics', config);
|
|
63354
63373
|
var amplifyConfig = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Parser"].parseMobilehubConfig(config);
|
|
63355
63374
|
this._config = Object.assign({}, this._config, amplifyConfig.Analytics, config);
|
|
63356
|
-
|
|
63357
63375
|
if (this._config['disabled']) {
|
|
63358
63376
|
this._disabled = true;
|
|
63359
|
-
}
|
|
63360
|
-
|
|
63361
|
-
|
|
63377
|
+
}
|
|
63378
|
+
// turn on the autoSessionRecord if not specified
|
|
63362
63379
|
if (this._config['autoSessionRecord'] === undefined) {
|
|
63363
63380
|
this._config['autoSessionRecord'] = true;
|
|
63364
63381
|
}
|
|
63365
|
-
|
|
63366
63382
|
this._pluggables.forEach(function (pluggable) {
|
|
63367
63383
|
// for backward compatibility
|
|
63368
63384
|
var providerConfig = pluggable.getProviderName() === 'AWSPinpoint' && !_this._config['AWSPinpoint'] ? _this._config : _this._config[pluggable.getProviderName()];
|
|
@@ -63371,11 +63387,9 @@ function () {
|
|
|
63371
63387
|
autoSessionRecord: _this._config['autoSessionRecord']
|
|
63372
63388
|
}, providerConfig));
|
|
63373
63389
|
});
|
|
63374
|
-
|
|
63375
63390
|
if (this._pluggables.length === 0) {
|
|
63376
63391
|
this.addPluggable(new _Providers_AWSPinpointProvider__WEBPACK_IMPORTED_MODULE_1__["AWSPinpointProvider"]());
|
|
63377
63392
|
}
|
|
63378
|
-
|
|
63379
63393
|
dispatchAnalyticsEvent('configured', null, "The Analytics category has been configured successfully");
|
|
63380
63394
|
logger.debug('current configuration', this._config);
|
|
63381
63395
|
return this._config;
|
|
@@ -63384,19 +63398,14 @@ function () {
|
|
|
63384
63398
|
* add plugin into Analytics category
|
|
63385
63399
|
* @param pluggable - an instance of the plugin
|
|
63386
63400
|
*/
|
|
63387
|
-
|
|
63388
|
-
|
|
63389
63401
|
AnalyticsClass.prototype.addPluggable = function (pluggable) {
|
|
63390
63402
|
if (pluggable && pluggable.getCategory() === 'Analytics') {
|
|
63391
|
-
this._pluggables.push(pluggable);
|
|
63392
|
-
|
|
63393
|
-
|
|
63403
|
+
this._pluggables.push(pluggable);
|
|
63404
|
+
// for backward compatibility
|
|
63394
63405
|
var providerConfig = pluggable.getProviderName() === 'AWSPinpoint' && !this._config['AWSPinpoint'] ? this._config : this._config[pluggable.getProviderName()];
|
|
63395
|
-
|
|
63396
63406
|
var config = __assign({
|
|
63397
63407
|
disabled: this._config['disabled']
|
|
63398
63408
|
}, providerConfig);
|
|
63399
|
-
|
|
63400
63409
|
pluggable.configure(config);
|
|
63401
63410
|
return config;
|
|
63402
63411
|
}
|
|
@@ -63405,17 +63414,13 @@ function () {
|
|
|
63405
63414
|
* Get the plugin object
|
|
63406
63415
|
* @param providerName - the name of the provider to be removed
|
|
63407
63416
|
*/
|
|
63408
|
-
|
|
63409
|
-
|
|
63410
63417
|
AnalyticsClass.prototype.getPluggable = function (providerName) {
|
|
63411
63418
|
for (var i = 0; i < this._pluggables.length; i += 1) {
|
|
63412
63419
|
var pluggable = this._pluggables[i];
|
|
63413
|
-
|
|
63414
63420
|
if (pluggable.getProviderName() === providerName) {
|
|
63415
63421
|
return pluggable;
|
|
63416
63422
|
}
|
|
63417
63423
|
}
|
|
63418
|
-
|
|
63419
63424
|
logger.debug('No plugin found with providerName', providerName);
|
|
63420
63425
|
return null;
|
|
63421
63426
|
};
|
|
@@ -63423,41 +63428,31 @@ function () {
|
|
|
63423
63428
|
* Remove the plugin object
|
|
63424
63429
|
* @param providerName - the name of the provider to be removed
|
|
63425
63430
|
*/
|
|
63426
|
-
|
|
63427
|
-
|
|
63428
63431
|
AnalyticsClass.prototype.removePluggable = function (providerName) {
|
|
63429
63432
|
var idx = 0;
|
|
63430
|
-
|
|
63431
63433
|
while (idx < this._pluggables.length) {
|
|
63432
63434
|
if (this._pluggables[idx].getProviderName() === providerName) {
|
|
63433
63435
|
break;
|
|
63434
63436
|
}
|
|
63435
|
-
|
|
63436
63437
|
idx += 1;
|
|
63437
63438
|
}
|
|
63438
|
-
|
|
63439
63439
|
if (idx === this._pluggables.length) {
|
|
63440
63440
|
logger.debug('No plugin found with providerName', providerName);
|
|
63441
63441
|
return;
|
|
63442
63442
|
} else {
|
|
63443
63443
|
this._pluggables.splice(idx, idx + 1);
|
|
63444
|
-
|
|
63445
63444
|
return;
|
|
63446
63445
|
}
|
|
63447
63446
|
};
|
|
63448
63447
|
/**
|
|
63449
63448
|
* stop sending events
|
|
63450
63449
|
*/
|
|
63451
|
-
|
|
63452
|
-
|
|
63453
63450
|
AnalyticsClass.prototype.disable = function () {
|
|
63454
63451
|
this._disabled = true;
|
|
63455
63452
|
};
|
|
63456
63453
|
/**
|
|
63457
63454
|
* start sending events
|
|
63458
63455
|
*/
|
|
63459
|
-
|
|
63460
|
-
|
|
63461
63456
|
AnalyticsClass.prototype.enable = function () {
|
|
63462
63457
|
this._disabled = false;
|
|
63463
63458
|
};
|
|
@@ -63466,8 +63461,6 @@ function () {
|
|
|
63466
63461
|
* @param [provider] - name of the provider.
|
|
63467
63462
|
* @return - A promise which resolves if buffer doesn't overflow
|
|
63468
63463
|
*/
|
|
63469
|
-
|
|
63470
|
-
|
|
63471
63464
|
AnalyticsClass.prototype.startSession = function (provider) {
|
|
63472
63465
|
return __awaiter(this, void 0, void 0, function () {
|
|
63473
63466
|
var params;
|
|
@@ -63478,9 +63471,7 @@ function () {
|
|
|
63478
63471
|
},
|
|
63479
63472
|
provider: provider
|
|
63480
63473
|
};
|
|
63481
|
-
return [2
|
|
63482
|
-
/*return*/
|
|
63483
|
-
, this._sendEvent(params)];
|
|
63474
|
+
return [2 /*return*/, this._sendEvent(params)];
|
|
63484
63475
|
});
|
|
63485
63476
|
});
|
|
63486
63477
|
};
|
|
@@ -63489,8 +63480,6 @@ function () {
|
|
|
63489
63480
|
* @param [provider] - name of the provider.
|
|
63490
63481
|
* @return - A promise which resolves if buffer doesn't overflow
|
|
63491
63482
|
*/
|
|
63492
|
-
|
|
63493
|
-
|
|
63494
63483
|
AnalyticsClass.prototype.stopSession = function (provider) {
|
|
63495
63484
|
return __awaiter(this, void 0, void 0, function () {
|
|
63496
63485
|
var params;
|
|
@@ -63501,19 +63490,16 @@ function () {
|
|
|
63501
63490
|
},
|
|
63502
63491
|
provider: provider
|
|
63503
63492
|
};
|
|
63504
|
-
return [2
|
|
63505
|
-
/*return*/
|
|
63506
|
-
, this._sendEvent(params)];
|
|
63493
|
+
return [2 /*return*/, this._sendEvent(params)];
|
|
63507
63494
|
});
|
|
63508
63495
|
});
|
|
63509
63496
|
};
|
|
63510
|
-
|
|
63511
63497
|
AnalyticsClass.prototype.record = function (event, providerOrAttributes, metrics) {
|
|
63512
63498
|
return __awaiter(this, void 0, void 0, function () {
|
|
63513
63499
|
var params;
|
|
63514
63500
|
return __generator(this, function (_a) {
|
|
63515
|
-
params = null;
|
|
63516
|
-
|
|
63501
|
+
params = null;
|
|
63502
|
+
// this is just for compatibility, going to be deprecated
|
|
63517
63503
|
if (typeof event === 'string') {
|
|
63518
63504
|
params = {
|
|
63519
63505
|
event: {
|
|
@@ -63529,14 +63515,10 @@ function () {
|
|
|
63529
63515
|
provider: providerOrAttributes
|
|
63530
63516
|
};
|
|
63531
63517
|
}
|
|
63532
|
-
|
|
63533
|
-
return [2
|
|
63534
|
-
/*return*/
|
|
63535
|
-
, this._sendEvent(params)];
|
|
63518
|
+
return [2 /*return*/, this._sendEvent(params)];
|
|
63536
63519
|
});
|
|
63537
63520
|
});
|
|
63538
63521
|
};
|
|
63539
|
-
|
|
63540
63522
|
AnalyticsClass.prototype.updateEndpoint = function (attrs, provider) {
|
|
63541
63523
|
return __awaiter(this, void 0, void 0, function () {
|
|
63542
63524
|
var event;
|
|
@@ -63544,21 +63526,16 @@ function () {
|
|
|
63544
63526
|
event = __assign(__assign({}, attrs), {
|
|
63545
63527
|
name: '_update_endpoint'
|
|
63546
63528
|
});
|
|
63547
|
-
return [2
|
|
63548
|
-
/*return*/
|
|
63549
|
-
, this.record(event, provider)];
|
|
63529
|
+
return [2 /*return*/, this.record(event, provider)];
|
|
63550
63530
|
});
|
|
63551
63531
|
});
|
|
63552
63532
|
};
|
|
63553
|
-
|
|
63554
63533
|
AnalyticsClass.prototype._sendEvent = function (params) {
|
|
63555
63534
|
var _this = this;
|
|
63556
|
-
|
|
63557
63535
|
if (this._disabled) {
|
|
63558
63536
|
logger.debug('Analytics has been disabled');
|
|
63559
63537
|
return Promise.resolve();
|
|
63560
63538
|
}
|
|
63561
|
-
|
|
63562
63539
|
var provider = params.provider ? params.provider : 'AWSPinpoint';
|
|
63563
63540
|
return new Promise(function (resolve, reject) {
|
|
63564
63541
|
_this._pluggables.forEach(function (pluggable) {
|
|
@@ -63571,64 +63548,51 @@ function () {
|
|
|
63571
63548
|
});
|
|
63572
63549
|
});
|
|
63573
63550
|
};
|
|
63574
|
-
|
|
63575
63551
|
AnalyticsClass.prototype.autoTrack = function (trackerType, opts) {
|
|
63576
63552
|
if (!trackers[trackerType]) {
|
|
63577
63553
|
logger.debug('invalid tracker type');
|
|
63578
63554
|
return;
|
|
63579
|
-
}
|
|
63580
|
-
|
|
63581
|
-
|
|
63555
|
+
}
|
|
63556
|
+
// to sync up two different configuration ways of auto session tracking
|
|
63582
63557
|
if (trackerType === 'session') {
|
|
63583
63558
|
this._config['autoSessionRecord'] = opts['enable'];
|
|
63584
63559
|
}
|
|
63585
|
-
|
|
63586
63560
|
var tracker = this._trackers[trackerType];
|
|
63587
|
-
|
|
63588
63561
|
if (!tracker) {
|
|
63589
63562
|
this._trackers[trackerType] = new trackers[trackerType](this.record, opts);
|
|
63590
63563
|
} else {
|
|
63591
63564
|
tracker.configure(opts);
|
|
63592
63565
|
}
|
|
63593
63566
|
};
|
|
63594
|
-
|
|
63595
63567
|
return AnalyticsClass;
|
|
63596
63568
|
}();
|
|
63597
63569
|
|
|
63598
|
-
|
|
63599
63570
|
var endpointUpdated = false;
|
|
63600
63571
|
var authConfigured = false;
|
|
63601
63572
|
var analyticsConfigured = false;
|
|
63602
|
-
|
|
63603
63573
|
var listener = function listener(capsule) {
|
|
63604
63574
|
var channel = capsule.channel,
|
|
63605
|
-
|
|
63575
|
+
payload = capsule.payload;
|
|
63606
63576
|
logger.debug('on hub capsule ' + channel, payload);
|
|
63607
|
-
|
|
63608
63577
|
switch (channel) {
|
|
63609
63578
|
case 'auth':
|
|
63610
63579
|
authEvent(payload);
|
|
63611
63580
|
break;
|
|
63612
|
-
|
|
63613
63581
|
case 'storage':
|
|
63614
63582
|
storageEvent(payload);
|
|
63615
63583
|
break;
|
|
63616
|
-
|
|
63617
63584
|
case 'analytics':
|
|
63618
63585
|
analyticsEvent(payload);
|
|
63619
63586
|
break;
|
|
63620
|
-
|
|
63621
63587
|
default:
|
|
63622
63588
|
break;
|
|
63623
63589
|
}
|
|
63624
63590
|
};
|
|
63625
|
-
|
|
63626
63591
|
var storageEvent = function storageEvent(payload) {
|
|
63627
63592
|
var _a = payload.data,
|
|
63628
|
-
|
|
63629
|
-
|
|
63593
|
+
attrs = _a.attrs,
|
|
63594
|
+
metrics = _a.metrics;
|
|
63630
63595
|
if (!attrs) return;
|
|
63631
|
-
|
|
63632
63596
|
if (analyticsConfigured) {
|
|
63633
63597
|
_instance.record({
|
|
63634
63598
|
name: 'Storage',
|
|
@@ -63639,50 +63603,32 @@ var storageEvent = function storageEvent(payload) {
|
|
|
63639
63603
|
});
|
|
63640
63604
|
}
|
|
63641
63605
|
};
|
|
63642
|
-
|
|
63643
63606
|
var authEvent = function authEvent(payload) {
|
|
63644
63607
|
var event = payload.event;
|
|
63645
|
-
|
|
63646
63608
|
if (!event) {
|
|
63647
63609
|
return;
|
|
63648
63610
|
}
|
|
63649
|
-
|
|
63650
63611
|
var recordAuthEvent = function recordAuthEvent(eventName) {
|
|
63651
63612
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
63652
63613
|
var err_1;
|
|
63653
63614
|
return __generator(this, function (_a) {
|
|
63654
63615
|
switch (_a.label) {
|
|
63655
63616
|
case 0:
|
|
63656
|
-
if (!(authConfigured && analyticsConfigured)) return [3
|
|
63657
|
-
/*break*/
|
|
63658
|
-
, 4];
|
|
63617
|
+
if (!(authConfigured && analyticsConfigured)) return [3 /*break*/, 4];
|
|
63659
63618
|
_a.label = 1;
|
|
63660
|
-
|
|
63661
63619
|
case 1:
|
|
63662
63620
|
_a.trys.push([1, 3,, 4]);
|
|
63663
|
-
|
|
63664
|
-
return [4
|
|
63665
|
-
/*yield*/
|
|
63666
|
-
, _instance.record({
|
|
63621
|
+
return [4 /*yield*/, _instance.record({
|
|
63667
63622
|
name: "_userauth." + eventName
|
|
63668
63623
|
})];
|
|
63669
|
-
|
|
63670
63624
|
case 2:
|
|
63671
|
-
return [2
|
|
63672
|
-
/*return*/
|
|
63673
|
-
, _a.sent()];
|
|
63674
|
-
|
|
63625
|
+
return [2 /*return*/, _a.sent()];
|
|
63675
63626
|
case 3:
|
|
63676
63627
|
err_1 = _a.sent();
|
|
63677
63628
|
logger.debug("Failed to send the " + eventName + " event automatically", err_1);
|
|
63678
|
-
return [3
|
|
63679
|
-
/*break*/
|
|
63680
|
-
, 4];
|
|
63681
|
-
|
|
63629
|
+
return [3 /*break*/, 4];
|
|
63682
63630
|
case 4:
|
|
63683
|
-
return [2
|
|
63684
|
-
/*return*/
|
|
63685
|
-
];
|
|
63631
|
+
return [2 /*return*/];
|
|
63686
63632
|
}
|
|
63687
63633
|
});
|
|
63688
63634
|
});
|
|
@@ -63691,61 +63637,46 @@ var authEvent = function authEvent(payload) {
|
|
|
63691
63637
|
switch (event) {
|
|
63692
63638
|
case 'signIn':
|
|
63693
63639
|
return recordAuthEvent('sign_in');
|
|
63694
|
-
|
|
63695
63640
|
case 'signUp':
|
|
63696
63641
|
return recordAuthEvent('sign_up');
|
|
63697
|
-
|
|
63698
63642
|
case 'signOut':
|
|
63699
63643
|
return recordAuthEvent('sign_out');
|
|
63700
|
-
|
|
63701
63644
|
case 'signIn_failure':
|
|
63702
63645
|
return recordAuthEvent('auth_fail');
|
|
63703
|
-
|
|
63704
63646
|
case 'configured':
|
|
63705
63647
|
authConfigured = true;
|
|
63706
|
-
|
|
63707
63648
|
if (authConfigured && analyticsConfigured) {
|
|
63708
63649
|
sendEvents();
|
|
63709
63650
|
}
|
|
63710
|
-
|
|
63711
63651
|
break;
|
|
63712
63652
|
}
|
|
63713
63653
|
};
|
|
63714
|
-
|
|
63715
63654
|
var analyticsEvent = function analyticsEvent(payload) {
|
|
63716
63655
|
var event = payload.event;
|
|
63717
63656
|
if (!event) return;
|
|
63718
|
-
|
|
63719
63657
|
switch (event) {
|
|
63720
63658
|
case 'pinpointProvider_configured':
|
|
63721
63659
|
analyticsConfigured = true;
|
|
63722
|
-
|
|
63723
63660
|
if (authConfigured && analyticsConfigured) {
|
|
63724
63661
|
sendEvents();
|
|
63725
63662
|
}
|
|
63726
|
-
|
|
63727
63663
|
break;
|
|
63728
63664
|
}
|
|
63729
63665
|
};
|
|
63730
|
-
|
|
63731
63666
|
var sendEvents = function sendEvents() {
|
|
63732
63667
|
var config = _instance.configure();
|
|
63733
|
-
|
|
63734
63668
|
if (!endpointUpdated && config['autoSessionRecord']) {
|
|
63735
63669
|
_instance.updateEndpoint({
|
|
63736
63670
|
immediate: true
|
|
63737
63671
|
})["catch"](function (e) {
|
|
63738
63672
|
logger.debug('Failed to update the endpoint', e);
|
|
63739
63673
|
});
|
|
63740
|
-
|
|
63741
63674
|
endpointUpdated = true;
|
|
63742
63675
|
}
|
|
63743
|
-
|
|
63744
63676
|
_instance.autoTrack('session', {
|
|
63745
63677
|
enable: config['autoSessionRecord']
|
|
63746
63678
|
});
|
|
63747
63679
|
};
|
|
63748
|
-
|
|
63749
63680
|
var Analytics = new AnalyticsClass();
|
|
63750
63681
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Amplify"].register(Analytics);
|
|
63751
63682
|
|
|
@@ -63789,17 +63720,13 @@ var __extends = undefined && undefined.__extends || function () {
|
|
|
63789
63720
|
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
63790
63721
|
}
|
|
63791
63722
|
};
|
|
63792
|
-
|
|
63793
63723
|
return _extendStatics(d, b);
|
|
63794
63724
|
};
|
|
63795
|
-
|
|
63796
63725
|
return function (d, b) {
|
|
63797
63726
|
_extendStatics(d, b);
|
|
63798
|
-
|
|
63799
63727
|
function __() {
|
|
63800
63728
|
this.constructor = d;
|
|
63801
63729
|
}
|
|
63802
|
-
|
|
63803
63730
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
63804
63731
|
};
|
|
63805
63732
|
}();
|
|
@@ -63807,51 +63734,37 @@ var __extends = undefined && undefined.__extends || function () {
|
|
|
63807
63734
|
|
|
63808
63735
|
|
|
63809
63736
|
|
|
63810
|
-
|
|
63811
63737
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('AWSKineisFirehoseProvider');
|
|
63812
|
-
|
|
63813
|
-
var AWSKinesisFirehoseProvider =
|
|
63814
|
-
/** @class */
|
|
63815
|
-
function (_super) {
|
|
63738
|
+
var AWSKinesisFirehoseProvider = /** @class */function (_super) {
|
|
63816
63739
|
__extends(AWSKinesisFirehoseProvider, _super);
|
|
63817
|
-
|
|
63818
63740
|
function AWSKinesisFirehoseProvider(config) {
|
|
63819
63741
|
return _super.call(this, config) || this;
|
|
63820
63742
|
}
|
|
63821
63743
|
/**
|
|
63822
63744
|
* get provider name of the plugin
|
|
63823
63745
|
*/
|
|
63824
|
-
|
|
63825
|
-
|
|
63826
63746
|
AWSKinesisFirehoseProvider.prototype.getProviderName = function () {
|
|
63827
63747
|
return 'AWSKinesisFirehose';
|
|
63828
63748
|
};
|
|
63829
|
-
|
|
63830
63749
|
AWSKinesisFirehoseProvider.prototype._sendEvents = function (group) {
|
|
63831
63750
|
var _this = this;
|
|
63832
|
-
|
|
63833
63751
|
if (group.length === 0) {
|
|
63834
63752
|
return;
|
|
63835
63753
|
}
|
|
63836
|
-
|
|
63837
63754
|
var _a = group[0],
|
|
63838
|
-
|
|
63839
|
-
|
|
63840
|
-
|
|
63755
|
+
config = _a.config,
|
|
63756
|
+
credentials = _a.credentials;
|
|
63841
63757
|
var initClients = this._init(config, credentials);
|
|
63842
|
-
|
|
63843
63758
|
if (!initClients) return false;
|
|
63844
63759
|
var records = {};
|
|
63845
63760
|
group.map(function (params) {
|
|
63846
63761
|
// split by streamName
|
|
63847
63762
|
var evt = params.event;
|
|
63848
63763
|
var streamName = evt.streamName,
|
|
63849
|
-
|
|
63850
|
-
|
|
63764
|
+
data = evt.data;
|
|
63851
63765
|
if (records[streamName] === undefined) {
|
|
63852
63766
|
records[streamName] = [];
|
|
63853
63767
|
}
|
|
63854
|
-
|
|
63855
63768
|
var bufferData = data && typeof data !== 'string' ? JSON.stringify(data) : data;
|
|
63856
63769
|
var Data = Object(_aws_sdk_util_utf8_browser__WEBPACK_IMPORTED_MODULE_3__["fromUtf8"])(bufferData);
|
|
63857
63770
|
var record = {
|
|
@@ -63861,7 +63774,6 @@ function (_super) {
|
|
|
63861
63774
|
});
|
|
63862
63775
|
Object.keys(records).map(function (streamName) {
|
|
63863
63776
|
logger.debug('putting records to kinesis', streamName, 'with records', records[streamName]);
|
|
63864
|
-
|
|
63865
63777
|
_this._kinesisFirehose.send(new _aws_sdk_client_firehose__WEBPACK_IMPORTED_MODULE_2__["PutRecordBatchCommand"]({
|
|
63866
63778
|
Records: records[streamName],
|
|
63867
63779
|
DeliveryStreamName: streamName
|
|
@@ -63872,20 +63784,16 @@ function (_super) {
|
|
|
63872
63784
|
});
|
|
63873
63785
|
});
|
|
63874
63786
|
};
|
|
63875
|
-
|
|
63876
63787
|
AWSKinesisFirehoseProvider.prototype._init = function (config, credentials) {
|
|
63877
63788
|
logger.debug('init clients');
|
|
63878
|
-
|
|
63879
63789
|
if (this._kinesisFirehose && this._config.credentials && this._config.credentials.sessionToken === credentials.sessionToken && this._config.credentials.identityId === credentials.identityId) {
|
|
63880
63790
|
logger.debug('no change for analytics config, directly return from init');
|
|
63881
63791
|
return true;
|
|
63882
63792
|
}
|
|
63883
|
-
|
|
63884
63793
|
this._config.credentials = credentials;
|
|
63885
63794
|
var region = config.region;
|
|
63886
63795
|
return this._initFirehose(region, credentials);
|
|
63887
63796
|
};
|
|
63888
|
-
|
|
63889
63797
|
AWSKinesisFirehoseProvider.prototype._initFirehose = function (region, credentials) {
|
|
63890
63798
|
logger.debug('initialize kinesis firehose with credentials', credentials);
|
|
63891
63799
|
this._kinesisFirehose = new _aws_sdk_client_firehose__WEBPACK_IMPORTED_MODULE_2__["FirehoseClient"]({
|
|
@@ -63895,15 +63803,12 @@ function (_super) {
|
|
|
63895
63803
|
});
|
|
63896
63804
|
return true;
|
|
63897
63805
|
};
|
|
63898
|
-
|
|
63899
63806
|
return AWSKinesisFirehoseProvider;
|
|
63900
63807
|
}(_AWSKinesisProvider__WEBPACK_IMPORTED_MODULE_1__["AWSKinesisProvider"]);
|
|
63901
63808
|
|
|
63902
|
-
|
|
63903
63809
|
/**
|
|
63904
63810
|
* @deprecated use named import
|
|
63905
63811
|
*/
|
|
63906
|
-
|
|
63907
63812
|
/* harmony default export */ __webpack_exports__["default"] = (AWSKinesisFirehoseProvider);
|
|
63908
63813
|
|
|
63909
63814
|
/***/ }),
|
|
@@ -63940,7 +63845,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
63940
63845
|
resolve(value);
|
|
63941
63846
|
});
|
|
63942
63847
|
}
|
|
63943
|
-
|
|
63944
63848
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
63945
63849
|
function fulfilled(value) {
|
|
63946
63850
|
try {
|
|
@@ -63949,7 +63853,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
63949
63853
|
reject(e);
|
|
63950
63854
|
}
|
|
63951
63855
|
}
|
|
63952
|
-
|
|
63953
63856
|
function rejected(value) {
|
|
63954
63857
|
try {
|
|
63955
63858
|
step(generator["throw"](value));
|
|
@@ -63957,29 +63860,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
63957
63860
|
reject(e);
|
|
63958
63861
|
}
|
|
63959
63862
|
}
|
|
63960
|
-
|
|
63961
63863
|
function step(result) {
|
|
63962
63864
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
63963
63865
|
}
|
|
63964
|
-
|
|
63965
63866
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
63966
63867
|
});
|
|
63967
63868
|
};
|
|
63968
|
-
|
|
63969
63869
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
63970
63870
|
var _ = {
|
|
63971
|
-
|
|
63972
|
-
|
|
63973
|
-
|
|
63974
|
-
|
|
63871
|
+
label: 0,
|
|
63872
|
+
sent: function sent() {
|
|
63873
|
+
if (t[0] & 1) throw t[1];
|
|
63874
|
+
return t[1];
|
|
63875
|
+
},
|
|
63876
|
+
trys: [],
|
|
63877
|
+
ops: []
|
|
63975
63878
|
},
|
|
63976
|
-
|
|
63977
|
-
|
|
63978
|
-
|
|
63979
|
-
|
|
63980
|
-
y,
|
|
63981
|
-
t,
|
|
63982
|
-
g;
|
|
63879
|
+
f,
|
|
63880
|
+
y,
|
|
63881
|
+
t,
|
|
63882
|
+
g;
|
|
63983
63883
|
return g = {
|
|
63984
63884
|
next: verb(0),
|
|
63985
63885
|
"throw": verb(1),
|
|
@@ -63987,79 +63887,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
63987
63887
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
63988
63888
|
return this;
|
|
63989
63889
|
}), g;
|
|
63990
|
-
|
|
63991
63890
|
function verb(n) {
|
|
63992
63891
|
return function (v) {
|
|
63993
63892
|
return step([n, v]);
|
|
63994
63893
|
};
|
|
63995
63894
|
}
|
|
63996
|
-
|
|
63997
63895
|
function step(op) {
|
|
63998
63896
|
if (f) throw new TypeError("Generator is already executing.");
|
|
63999
|
-
|
|
64000
63897
|
while (_) {
|
|
64001
63898
|
try {
|
|
64002
63899
|
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;
|
|
64003
63900
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
64004
|
-
|
|
64005
63901
|
switch (op[0]) {
|
|
64006
63902
|
case 0:
|
|
64007
63903
|
case 1:
|
|
64008
63904
|
t = op;
|
|
64009
63905
|
break;
|
|
64010
|
-
|
|
64011
63906
|
case 4:
|
|
64012
63907
|
_.label++;
|
|
64013
63908
|
return {
|
|
64014
63909
|
value: op[1],
|
|
64015
63910
|
done: false
|
|
64016
63911
|
};
|
|
64017
|
-
|
|
64018
63912
|
case 5:
|
|
64019
63913
|
_.label++;
|
|
64020
63914
|
y = op[1];
|
|
64021
63915
|
op = [0];
|
|
64022
63916
|
continue;
|
|
64023
|
-
|
|
64024
63917
|
case 7:
|
|
64025
63918
|
op = _.ops.pop();
|
|
64026
|
-
|
|
64027
63919
|
_.trys.pop();
|
|
64028
|
-
|
|
64029
63920
|
continue;
|
|
64030
|
-
|
|
64031
63921
|
default:
|
|
64032
63922
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
64033
63923
|
_ = 0;
|
|
64034
63924
|
continue;
|
|
64035
63925
|
}
|
|
64036
|
-
|
|
64037
63926
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
64038
63927
|
_.label = op[1];
|
|
64039
63928
|
break;
|
|
64040
63929
|
}
|
|
64041
|
-
|
|
64042
63930
|
if (op[0] === 6 && _.label < t[1]) {
|
|
64043
63931
|
_.label = t[1];
|
|
64044
63932
|
t = op;
|
|
64045
63933
|
break;
|
|
64046
63934
|
}
|
|
64047
|
-
|
|
64048
63935
|
if (t && _.label < t[2]) {
|
|
64049
63936
|
_.label = t[2];
|
|
64050
|
-
|
|
64051
63937
|
_.ops.push(op);
|
|
64052
|
-
|
|
64053
63938
|
break;
|
|
64054
63939
|
}
|
|
64055
|
-
|
|
64056
63940
|
if (t[2]) _.ops.pop();
|
|
64057
|
-
|
|
64058
63941
|
_.trys.pop();
|
|
64059
|
-
|
|
64060
63942
|
continue;
|
|
64061
63943
|
}
|
|
64062
|
-
|
|
64063
63944
|
op = body.call(thisArg, _);
|
|
64064
63945
|
} catch (e) {
|
|
64065
63946
|
op = [6, e];
|
|
@@ -64068,7 +63949,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
64068
63949
|
f = t = 0;
|
|
64069
63950
|
}
|
|
64070
63951
|
}
|
|
64071
|
-
|
|
64072
63952
|
if (op[0] & 5) throw op[1];
|
|
64073
63953
|
return {
|
|
64074
63954
|
value: op[0] ? op[1] : void 0,
|
|
@@ -64079,18 +63959,13 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
64079
63959
|
|
|
64080
63960
|
|
|
64081
63961
|
|
|
64082
|
-
|
|
64083
|
-
|
|
64084
|
-
|
|
63962
|
+
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('AWSKinesisProvider');
|
|
63963
|
+
// events buffer
|
|
64085
63964
|
var BUFFER_SIZE = 1000;
|
|
64086
63965
|
var FLUSH_SIZE = 100;
|
|
64087
63966
|
var FLUSH_INTERVAL = 5 * 1000; // 5s
|
|
64088
|
-
|
|
64089
63967
|
var RESEND_LIMIT = 5;
|
|
64090
|
-
|
|
64091
|
-
var AWSKinesisProvider =
|
|
64092
|
-
/** @class */
|
|
64093
|
-
function () {
|
|
63968
|
+
var AWSKinesisProvider = /** @class */function () {
|
|
64094
63969
|
function AWSKinesisProvider(config) {
|
|
64095
63970
|
this._buffer = [];
|
|
64096
63971
|
this._config = config || {};
|
|
@@ -64098,46 +63973,35 @@ function () {
|
|
|
64098
63973
|
this._config.flushSize = this._config.flushSize || FLUSH_SIZE;
|
|
64099
63974
|
this._config.flushInterval = this._config.flushInterval || FLUSH_INTERVAL;
|
|
64100
63975
|
this._config.resendLimit = this._config.resendLimit || RESEND_LIMIT;
|
|
64101
|
-
|
|
64102
63976
|
this._setupTimer();
|
|
64103
63977
|
}
|
|
64104
|
-
|
|
64105
63978
|
AWSKinesisProvider.prototype._setupTimer = function () {
|
|
64106
63979
|
var _this = this;
|
|
64107
|
-
|
|
64108
63980
|
if (this._timer) {
|
|
64109
63981
|
clearInterval(this._timer);
|
|
64110
63982
|
}
|
|
64111
|
-
|
|
64112
63983
|
var _a = this._config,
|
|
64113
|
-
|
|
64114
|
-
|
|
63984
|
+
flushSize = _a.flushSize,
|
|
63985
|
+
flushInterval = _a.flushInterval;
|
|
64115
63986
|
this._timer = setInterval(function () {
|
|
64116
63987
|
var size = _this._buffer.length < flushSize ? _this._buffer.length : flushSize;
|
|
64117
63988
|
var events = [];
|
|
64118
|
-
|
|
64119
63989
|
for (var i = 0; i < size; i += 1) {
|
|
64120
63990
|
var params = _this._buffer.shift();
|
|
64121
|
-
|
|
64122
63991
|
events.push(params);
|
|
64123
63992
|
}
|
|
64124
|
-
|
|
64125
63993
|
_this._sendFromBuffer(events);
|
|
64126
63994
|
}, flushInterval);
|
|
64127
63995
|
};
|
|
64128
63996
|
/**
|
|
64129
63997
|
* get the category of the plugin
|
|
64130
63998
|
*/
|
|
64131
|
-
|
|
64132
|
-
|
|
64133
63999
|
AWSKinesisProvider.prototype.getCategory = function () {
|
|
64134
64000
|
return 'Analytics';
|
|
64135
64001
|
};
|
|
64136
64002
|
/**
|
|
64137
64003
|
* get provider name of the plugin
|
|
64138
64004
|
*/
|
|
64139
|
-
|
|
64140
|
-
|
|
64141
64005
|
AWSKinesisProvider.prototype.getProviderName = function () {
|
|
64142
64006
|
return 'AWSKinesis';
|
|
64143
64007
|
};
|
|
@@ -64145,50 +64009,36 @@ function () {
|
|
|
64145
64009
|
* configure the plugin
|
|
64146
64010
|
* @param {Object} config - configuration
|
|
64147
64011
|
*/
|
|
64148
|
-
|
|
64149
|
-
|
|
64150
64012
|
AWSKinesisProvider.prototype.configure = function (config) {
|
|
64151
64013
|
logger.debug('configure Analytics', config);
|
|
64152
64014
|
var conf = config || {};
|
|
64153
64015
|
this._config = Object.assign({}, this._config, conf);
|
|
64154
|
-
|
|
64155
64016
|
this._setupTimer();
|
|
64156
|
-
|
|
64157
64017
|
return this._config;
|
|
64158
64018
|
};
|
|
64159
64019
|
/**
|
|
64160
64020
|
* record an event
|
|
64161
64021
|
* @param {Object} params - the params of an event
|
|
64162
64022
|
*/
|
|
64163
|
-
|
|
64164
|
-
|
|
64165
64023
|
AWSKinesisProvider.prototype.record = function (params) {
|
|
64166
64024
|
return __awaiter(this, void 0, void 0, function () {
|
|
64167
64025
|
var credentials;
|
|
64168
64026
|
return __generator(this, function (_a) {
|
|
64169
64027
|
switch (_a.label) {
|
|
64170
64028
|
case 0:
|
|
64171
|
-
return [4
|
|
64172
|
-
/*yield*/
|
|
64173
|
-
, this._getCredentials()];
|
|
64174
|
-
|
|
64029
|
+
return [4 /*yield*/, this._getCredentials()];
|
|
64175
64030
|
case 1:
|
|
64176
64031
|
credentials = _a.sent();
|
|
64177
|
-
if (!credentials) return [2
|
|
64178
|
-
/*return*/
|
|
64179
|
-
, Promise.resolve(false)];
|
|
64032
|
+
if (!credentials) return [2 /*return*/, Promise.resolve(false)];
|
|
64180
64033
|
Object.assign(params, {
|
|
64181
64034
|
config: this._config,
|
|
64182
64035
|
credentials: credentials
|
|
64183
64036
|
});
|
|
64184
|
-
return [2
|
|
64185
|
-
/*return*/
|
|
64186
|
-
, this._putToBuffer(params)];
|
|
64037
|
+
return [2 /*return*/, this._putToBuffer(params)];
|
|
64187
64038
|
}
|
|
64188
64039
|
});
|
|
64189
64040
|
});
|
|
64190
64041
|
};
|
|
64191
|
-
|
|
64192
64042
|
AWSKinesisProvider.prototype.updateEndpoint = function () {
|
|
64193
64043
|
logger.debug('updateEndpoint is not implemented in Kinesis provider');
|
|
64194
64044
|
return Promise.resolve(true);
|
|
@@ -64198,31 +64048,24 @@ function () {
|
|
|
64198
64048
|
* @param params - params for the event recording
|
|
64199
64049
|
* Put events into buffer
|
|
64200
64050
|
*/
|
|
64201
|
-
|
|
64202
|
-
|
|
64203
64051
|
AWSKinesisProvider.prototype._putToBuffer = function (params) {
|
|
64204
64052
|
if (this._buffer.length < BUFFER_SIZE) {
|
|
64205
64053
|
this._buffer.push(params);
|
|
64206
|
-
|
|
64207
64054
|
return Promise.resolve(true);
|
|
64208
64055
|
} else {
|
|
64209
64056
|
logger.debug('exceed analytics events buffer size');
|
|
64210
64057
|
return Promise.reject(false);
|
|
64211
64058
|
}
|
|
64212
64059
|
};
|
|
64213
|
-
|
|
64214
64060
|
AWSKinesisProvider.prototype._sendFromBuffer = function (events) {
|
|
64215
|
-
var _this = this;
|
|
64061
|
+
var _this = this;
|
|
64062
|
+
// collapse events by credentials
|
|
64216
64063
|
// events = [ {params} ]
|
|
64217
|
-
|
|
64218
|
-
|
|
64219
64064
|
var eventsGroups = [];
|
|
64220
64065
|
var preCred = null;
|
|
64221
64066
|
var group = [];
|
|
64222
|
-
|
|
64223
64067
|
for (var i = 0; i < events.length; i += 1) {
|
|
64224
64068
|
var cred = events[i].credentials;
|
|
64225
|
-
|
|
64226
64069
|
if (i === 0) {
|
|
64227
64070
|
group.push(events[i]);
|
|
64228
64071
|
preCred = cred;
|
|
@@ -64238,37 +64081,29 @@ function () {
|
|
|
64238
64081
|
}
|
|
64239
64082
|
}
|
|
64240
64083
|
}
|
|
64241
|
-
|
|
64242
64084
|
eventsGroups.push(group);
|
|
64243
64085
|
eventsGroups.map(function (evts) {
|
|
64244
64086
|
_this._sendEvents(evts);
|
|
64245
64087
|
});
|
|
64246
64088
|
};
|
|
64247
|
-
|
|
64248
64089
|
AWSKinesisProvider.prototype._sendEvents = function (group) {
|
|
64249
64090
|
var _this = this;
|
|
64250
|
-
|
|
64251
64091
|
if (group.length === 0) {
|
|
64252
64092
|
return;
|
|
64253
64093
|
}
|
|
64254
|
-
|
|
64255
64094
|
var _a = group[0],
|
|
64256
|
-
|
|
64257
|
-
|
|
64258
|
-
|
|
64095
|
+
config = _a.config,
|
|
64096
|
+
credentials = _a.credentials;
|
|
64259
64097
|
var initClients = this._init(config, credentials);
|
|
64260
|
-
|
|
64261
64098
|
if (!initClients) return false;
|
|
64262
64099
|
var records = {};
|
|
64263
64100
|
group.map(function (params) {
|
|
64264
64101
|
// spit by streamName
|
|
64265
64102
|
var evt = params.event;
|
|
64266
64103
|
var streamName = evt.streamName;
|
|
64267
|
-
|
|
64268
64104
|
if (records[streamName] === undefined) {
|
|
64269
64105
|
records[streamName] = [];
|
|
64270
64106
|
}
|
|
64271
|
-
|
|
64272
64107
|
var bufferData = evt.data && typeof evt.data !== 'string' ? JSON.stringify(evt.data) : evt.data;
|
|
64273
64108
|
var Data = Object(_aws_sdk_util_utf8_browser__WEBPACK_IMPORTED_MODULE_2__["fromUtf8"])(bufferData);
|
|
64274
64109
|
var PartitionKey = evt.partitionKey || 'partition-' + credentials.identityId;
|
|
@@ -64286,37 +64121,23 @@ function () {
|
|
|
64286
64121
|
case 0:
|
|
64287
64122
|
logger.debug('putting records to kinesis with records', records[streamName]);
|
|
64288
64123
|
_a.label = 1;
|
|
64289
|
-
|
|
64290
64124
|
case 1:
|
|
64291
64125
|
_a.trys.push([1, 3,, 4]);
|
|
64292
|
-
|
|
64293
64126
|
command = new _aws_sdk_client_kinesis__WEBPACK_IMPORTED_MODULE_1__["PutRecordsCommand"]({
|
|
64294
64127
|
Records: records[streamName],
|
|
64295
64128
|
StreamName: streamName
|
|
64296
64129
|
});
|
|
64297
|
-
return [4
|
|
64298
|
-
/*yield*/
|
|
64299
|
-
, this._kinesis.send(command)];
|
|
64300
|
-
|
|
64130
|
+
return [4 /*yield*/, this._kinesis.send(command)];
|
|
64301
64131
|
case 2:
|
|
64302
64132
|
_a.sent();
|
|
64303
|
-
|
|
64304
64133
|
logger.debug('Upload records to stream', streamName);
|
|
64305
|
-
return [3
|
|
64306
|
-
/*break*/
|
|
64307
|
-
, 4];
|
|
64308
|
-
|
|
64134
|
+
return [3 /*break*/, 4];
|
|
64309
64135
|
case 3:
|
|
64310
64136
|
err_1 = _a.sent();
|
|
64311
64137
|
logger.debug('Failed to upload records to Kinesis', err_1);
|
|
64312
|
-
return [3
|
|
64313
|
-
/*break*/
|
|
64314
|
-
, 4];
|
|
64315
|
-
|
|
64138
|
+
return [3 /*break*/, 4];
|
|
64316
64139
|
case 4:
|
|
64317
|
-
return [2
|
|
64318
|
-
/*return*/
|
|
64319
|
-
];
|
|
64140
|
+
return [2 /*return*/];
|
|
64320
64141
|
}
|
|
64321
64142
|
});
|
|
64322
64143
|
});
|
|
@@ -64325,18 +64146,15 @@ function () {
|
|
|
64325
64146
|
|
|
64326
64147
|
AWSKinesisProvider.prototype._init = function (config, credentials) {
|
|
64327
64148
|
logger.debug('init clients');
|
|
64328
|
-
|
|
64329
64149
|
if (this._kinesis && this._config.credentials && this._config.credentials.sessionToken === credentials.sessionToken && this._config.credentials.identityId === credentials.identityId) {
|
|
64330
64150
|
logger.debug('no change for analytics config, directly return from init');
|
|
64331
64151
|
return true;
|
|
64332
64152
|
}
|
|
64333
|
-
|
|
64334
64153
|
this._config.credentials = credentials;
|
|
64335
64154
|
var region = config.region,
|
|
64336
|
-
|
|
64155
|
+
endpoint = config.endpoint;
|
|
64337
64156
|
return this._initKinesis(region, endpoint, credentials);
|
|
64338
64157
|
};
|
|
64339
|
-
|
|
64340
64158
|
AWSKinesisProvider.prototype._initKinesis = function (region, endpoint, credentials) {
|
|
64341
64159
|
logger.debug('initialize kinesis with credentials', credentials);
|
|
64342
64160
|
this._kinesis = new _aws_sdk_client_kinesis__WEBPACK_IMPORTED_MODULE_1__["KinesisClient"]({
|
|
@@ -64351,11 +64169,8 @@ function () {
|
|
|
64351
64169
|
* @private
|
|
64352
64170
|
* check if current credentials exists
|
|
64353
64171
|
*/
|
|
64354
|
-
|
|
64355
|
-
|
|
64356
64172
|
AWSKinesisProvider.prototype._getCredentials = function () {
|
|
64357
64173
|
var _this = this;
|
|
64358
|
-
|
|
64359
64174
|
return _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Credentials"].get().then(function (credentials) {
|
|
64360
64175
|
if (!credentials) return null;
|
|
64361
64176
|
logger.debug('set credentials for analytics', _this._config.credentials);
|
|
@@ -64365,15 +64180,12 @@ function () {
|
|
|
64365
64180
|
return null;
|
|
64366
64181
|
});
|
|
64367
64182
|
};
|
|
64368
|
-
|
|
64369
64183
|
return AWSKinesisProvider;
|
|
64370
64184
|
}();
|
|
64371
64185
|
|
|
64372
|
-
|
|
64373
64186
|
/**
|
|
64374
64187
|
* @deprecated use named import
|
|
64375
64188
|
*/
|
|
64376
|
-
|
|
64377
64189
|
/* harmony default export */ __webpack_exports__["default"] = (AWSKinesisProvider);
|
|
64378
64190
|
|
|
64379
64191
|
/***/ }),
|
|
@@ -64417,31 +64229,24 @@ function _typeof(obj) {
|
|
|
64417
64229
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
64418
64230
|
* and limitations under the License.
|
|
64419
64231
|
*/
|
|
64420
|
-
|
|
64421
|
-
|
|
64422
64232
|
var __assign = undefined && undefined.__assign || function () {
|
|
64423
64233
|
__assign = Object.assign || function (t) {
|
|
64424
64234
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
64425
64235
|
s = arguments[i];
|
|
64426
|
-
|
|
64427
64236
|
for (var p in s) {
|
|
64428
64237
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
64429
64238
|
}
|
|
64430
64239
|
}
|
|
64431
|
-
|
|
64432
64240
|
return t;
|
|
64433
64241
|
};
|
|
64434
|
-
|
|
64435
64242
|
return __assign.apply(this, arguments);
|
|
64436
64243
|
};
|
|
64437
|
-
|
|
64438
64244
|
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
64439
64245
|
function adopt(value) {
|
|
64440
64246
|
return value instanceof P ? value : new P(function (resolve) {
|
|
64441
64247
|
resolve(value);
|
|
64442
64248
|
});
|
|
64443
64249
|
}
|
|
64444
|
-
|
|
64445
64250
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
64446
64251
|
function fulfilled(value) {
|
|
64447
64252
|
try {
|
|
@@ -64450,7 +64255,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
64450
64255
|
reject(e);
|
|
64451
64256
|
}
|
|
64452
64257
|
}
|
|
64453
|
-
|
|
64454
64258
|
function rejected(value) {
|
|
64455
64259
|
try {
|
|
64456
64260
|
step(generator["throw"](value));
|
|
@@ -64458,29 +64262,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
64458
64262
|
reject(e);
|
|
64459
64263
|
}
|
|
64460
64264
|
}
|
|
64461
|
-
|
|
64462
64265
|
function step(result) {
|
|
64463
64266
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
64464
64267
|
}
|
|
64465
|
-
|
|
64466
64268
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
64467
64269
|
});
|
|
64468
64270
|
};
|
|
64469
|
-
|
|
64470
64271
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
64471
64272
|
var _ = {
|
|
64472
|
-
|
|
64473
|
-
|
|
64474
|
-
|
|
64475
|
-
|
|
64273
|
+
label: 0,
|
|
64274
|
+
sent: function sent() {
|
|
64275
|
+
if (t[0] & 1) throw t[1];
|
|
64276
|
+
return t[1];
|
|
64277
|
+
},
|
|
64278
|
+
trys: [],
|
|
64279
|
+
ops: []
|
|
64476
64280
|
},
|
|
64477
|
-
|
|
64478
|
-
|
|
64479
|
-
|
|
64480
|
-
|
|
64481
|
-
y,
|
|
64482
|
-
t,
|
|
64483
|
-
g;
|
|
64281
|
+
f,
|
|
64282
|
+
y,
|
|
64283
|
+
t,
|
|
64284
|
+
g;
|
|
64484
64285
|
return g = {
|
|
64485
64286
|
next: verb(0),
|
|
64486
64287
|
"throw": verb(1),
|
|
@@ -64488,79 +64289,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
64488
64289
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
64489
64290
|
return this;
|
|
64490
64291
|
}), g;
|
|
64491
|
-
|
|
64492
64292
|
function verb(n) {
|
|
64493
64293
|
return function (v) {
|
|
64494
64294
|
return step([n, v]);
|
|
64495
64295
|
};
|
|
64496
64296
|
}
|
|
64497
|
-
|
|
64498
64297
|
function step(op) {
|
|
64499
64298
|
if (f) throw new TypeError("Generator is already executing.");
|
|
64500
|
-
|
|
64501
64299
|
while (_) {
|
|
64502
64300
|
try {
|
|
64503
64301
|
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;
|
|
64504
64302
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
64505
|
-
|
|
64506
64303
|
switch (op[0]) {
|
|
64507
64304
|
case 0:
|
|
64508
64305
|
case 1:
|
|
64509
64306
|
t = op;
|
|
64510
64307
|
break;
|
|
64511
|
-
|
|
64512
64308
|
case 4:
|
|
64513
64309
|
_.label++;
|
|
64514
64310
|
return {
|
|
64515
64311
|
value: op[1],
|
|
64516
64312
|
done: false
|
|
64517
64313
|
};
|
|
64518
|
-
|
|
64519
64314
|
case 5:
|
|
64520
64315
|
_.label++;
|
|
64521
64316
|
y = op[1];
|
|
64522
64317
|
op = [0];
|
|
64523
64318
|
continue;
|
|
64524
|
-
|
|
64525
64319
|
case 7:
|
|
64526
64320
|
op = _.ops.pop();
|
|
64527
|
-
|
|
64528
64321
|
_.trys.pop();
|
|
64529
|
-
|
|
64530
64322
|
continue;
|
|
64531
|
-
|
|
64532
64323
|
default:
|
|
64533
64324
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
64534
64325
|
_ = 0;
|
|
64535
64326
|
continue;
|
|
64536
64327
|
}
|
|
64537
|
-
|
|
64538
64328
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
64539
64329
|
_.label = op[1];
|
|
64540
64330
|
break;
|
|
64541
64331
|
}
|
|
64542
|
-
|
|
64543
64332
|
if (op[0] === 6 && _.label < t[1]) {
|
|
64544
64333
|
_.label = t[1];
|
|
64545
64334
|
t = op;
|
|
64546
64335
|
break;
|
|
64547
64336
|
}
|
|
64548
|
-
|
|
64549
64337
|
if (t && _.label < t[2]) {
|
|
64550
64338
|
_.label = t[2];
|
|
64551
|
-
|
|
64552
64339
|
_.ops.push(op);
|
|
64553
|
-
|
|
64554
64340
|
break;
|
|
64555
64341
|
}
|
|
64556
|
-
|
|
64557
64342
|
if (t[2]) _.ops.pop();
|
|
64558
|
-
|
|
64559
64343
|
_.trys.pop();
|
|
64560
|
-
|
|
64561
64344
|
continue;
|
|
64562
64345
|
}
|
|
64563
|
-
|
|
64564
64346
|
op = body.call(thisArg, _);
|
|
64565
64347
|
} catch (e) {
|
|
64566
64348
|
op = [6, e];
|
|
@@ -64569,7 +64351,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
64569
64351
|
f = t = 0;
|
|
64570
64352
|
}
|
|
64571
64353
|
}
|
|
64572
|
-
|
|
64573
64354
|
if (op[0] & 5) throw op[1];
|
|
64574
64355
|
return {
|
|
64575
64356
|
value: op[0] ? op[1] : void 0,
|
|
@@ -64577,14 +64358,11 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
64577
64358
|
};
|
|
64578
64359
|
}
|
|
64579
64360
|
};
|
|
64580
|
-
|
|
64581
64361
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
64582
64362
|
var t = {};
|
|
64583
|
-
|
|
64584
64363
|
for (var p in s) {
|
|
64585
64364
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
64586
64365
|
}
|
|
64587
|
-
|
|
64588
64366
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
64589
64367
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
64590
64368
|
}
|
|
@@ -64595,16 +64373,13 @@ var __rest = undefined && undefined.__rest || function (s, e) {
|
|
|
64595
64373
|
|
|
64596
64374
|
|
|
64597
64375
|
|
|
64598
|
-
|
|
64599
64376
|
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
64600
|
-
|
|
64601
64377
|
var dispatchAnalyticsEvent = function dispatchAnalyticsEvent(event, data) {
|
|
64602
64378
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Hub"].dispatch('analytics', {
|
|
64603
64379
|
event: event,
|
|
64604
64380
|
data: data
|
|
64605
64381
|
}, 'Analytics', AMPLIFY_SYMBOL);
|
|
64606
64382
|
};
|
|
64607
|
-
|
|
64608
64383
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('AWSPinpointProvider');
|
|
64609
64384
|
var RETRYABLE_CODES = [429, 500];
|
|
64610
64385
|
var ACCEPTED_CODES = [202];
|
|
@@ -64614,17 +64389,14 @@ var EXPIRED_TOKEN_CODE = 'ExpiredTokenException';
|
|
|
64614
64389
|
var UPDATE_ENDPOINT = '_update_endpoint';
|
|
64615
64390
|
var SESSION_START = '_session.start';
|
|
64616
64391
|
var SESSION_STOP = '_session.stop';
|
|
64617
|
-
var BEACON_SUPPORTED = typeof navigator !== 'undefined' && navigator && typeof navigator.sendBeacon === 'function';
|
|
64618
|
-
|
|
64392
|
+
var BEACON_SUPPORTED = typeof navigator !== 'undefined' && navigator && typeof navigator.sendBeacon === 'function';
|
|
64393
|
+
// events buffer
|
|
64619
64394
|
var BUFFER_SIZE = 1000;
|
|
64620
64395
|
var FLUSH_SIZE = 100;
|
|
64621
64396
|
var FLUSH_INTERVAL = 5 * 1000; // 5s
|
|
64622
|
-
|
|
64623
|
-
|
|
64624
|
-
|
|
64625
|
-
var AWSPinpointProvider =
|
|
64626
|
-
/** @class */
|
|
64627
|
-
function () {
|
|
64397
|
+
var RESEND_LIMIT = 5;
|
|
64398
|
+
// params: { event: {name: , .... }, timeStamp, config, resendLimits }
|
|
64399
|
+
var AWSPinpointProvider = /** @class */function () {
|
|
64628
64400
|
function AWSPinpointProvider(config) {
|
|
64629
64401
|
this._endpointGenerating = true;
|
|
64630
64402
|
this._endpointUpdateInProgress = false;
|
|
@@ -64640,16 +64412,12 @@ function () {
|
|
|
64640
64412
|
/**
|
|
64641
64413
|
* get the category of the plugin
|
|
64642
64414
|
*/
|
|
64643
|
-
|
|
64644
|
-
|
|
64645
64415
|
AWSPinpointProvider.prototype.getCategory = function () {
|
|
64646
64416
|
return AWSPinpointProvider.category;
|
|
64647
64417
|
};
|
|
64648
64418
|
/**
|
|
64649
64419
|
* get provider name of the plugin
|
|
64650
64420
|
*/
|
|
64651
|
-
|
|
64652
|
-
|
|
64653
64421
|
AWSPinpointProvider.prototype.getProviderName = function () {
|
|
64654
64422
|
return AWSPinpointProvider.providerName;
|
|
64655
64423
|
};
|
|
@@ -64657,22 +64425,17 @@ function () {
|
|
|
64657
64425
|
* configure the plugin
|
|
64658
64426
|
* @param {Object} config - configuration
|
|
64659
64427
|
*/
|
|
64660
|
-
|
|
64661
|
-
|
|
64662
64428
|
AWSPinpointProvider.prototype.configure = function (config) {
|
|
64663
64429
|
var _this = this;
|
|
64664
|
-
|
|
64665
64430
|
logger.debug('configure Analytics', config);
|
|
64666
64431
|
var conf = config || {};
|
|
64667
|
-
this._config = Object.assign({}, this._config, conf);
|
|
64432
|
+
this._config = Object.assign({}, this._config, conf);
|
|
64433
|
+
// If autoSessionRecord is enabled, we need to wait for the endpoint to be
|
|
64668
64434
|
// updated before sending any events. See `sendEvents` in `Analytics.ts`
|
|
64669
|
-
|
|
64670
64435
|
this._endpointGenerating = !!config['autoSessionRecord'];
|
|
64671
|
-
|
|
64672
64436
|
if (this._config.appId && !this._config.disabled) {
|
|
64673
64437
|
if (!this._config.endpointId) {
|
|
64674
64438
|
var cacheKey = this.getProviderName() + '_' + this._config.appId;
|
|
64675
|
-
|
|
64676
64439
|
this._getEndpointId(cacheKey).then(function (endpointId) {
|
|
64677
64440
|
logger.debug('setting endpoint id from the cache', endpointId);
|
|
64678
64441
|
_this._config.endpointId = endpointId;
|
|
@@ -64686,15 +64449,12 @@ function () {
|
|
|
64686
64449
|
} else {
|
|
64687
64450
|
this._flushBuffer();
|
|
64688
64451
|
}
|
|
64689
|
-
|
|
64690
64452
|
return this._config;
|
|
64691
64453
|
};
|
|
64692
64454
|
/**
|
|
64693
64455
|
* record an event
|
|
64694
64456
|
* @param {Object} params - the params of an event
|
|
64695
64457
|
*/
|
|
64696
|
-
|
|
64697
|
-
|
|
64698
64458
|
AWSPinpointProvider.prototype.record = function (params, handlers) {
|
|
64699
64459
|
return __awaiter(this, void 0, void 0, function () {
|
|
64700
64460
|
var credentials, timestamp;
|
|
@@ -64702,43 +64462,28 @@ function () {
|
|
|
64702
64462
|
switch (_a.label) {
|
|
64703
64463
|
case 0:
|
|
64704
64464
|
logger.debug('_public record', params);
|
|
64705
|
-
return [4
|
|
64706
|
-
/*yield*/
|
|
64707
|
-
, this._getCredentials()];
|
|
64708
|
-
|
|
64465
|
+
return [4 /*yield*/, this._getCredentials()];
|
|
64709
64466
|
case 1:
|
|
64710
64467
|
credentials = _a.sent();
|
|
64711
|
-
|
|
64712
64468
|
if (!credentials || !this._config.appId || !this._config.region) {
|
|
64713
64469
|
logger.debug('cannot send events without credentials, applicationId or region');
|
|
64714
|
-
return [2
|
|
64715
|
-
/*return*/
|
|
64716
|
-
, handlers.reject(new Error('No credentials, applicationId or region'))];
|
|
64470
|
+
return [2 /*return*/, handlers.reject(new Error('No credentials, applicationId or region'))];
|
|
64717
64471
|
}
|
|
64718
|
-
|
|
64719
64472
|
this._initClients(credentials);
|
|
64720
|
-
|
|
64721
|
-
|
|
64722
|
-
|
|
64473
|
+
timestamp = new Date().getTime();
|
|
64474
|
+
// attach the session and eventId
|
|
64723
64475
|
this._generateSession(params);
|
|
64724
|
-
|
|
64725
64476
|
params.event.eventId = Object(uuid__WEBPACK_IMPORTED_MODULE_3__["v1"])();
|
|
64726
64477
|
Object.assign(params, {
|
|
64727
64478
|
timestamp: timestamp,
|
|
64728
64479
|
config: this._config
|
|
64729
64480
|
});
|
|
64730
|
-
|
|
64731
64481
|
if (params.event.immediate) {
|
|
64732
|
-
return [2
|
|
64733
|
-
/*return*/
|
|
64734
|
-
, this._send(params, handlers)];
|
|
64482
|
+
return [2 /*return*/, this._send(params, handlers)];
|
|
64735
64483
|
} else {
|
|
64736
64484
|
this._putToBuffer(params, handlers);
|
|
64737
64485
|
}
|
|
64738
|
-
|
|
64739
|
-
return [2
|
|
64740
|
-
/*return*/
|
|
64741
|
-
];
|
|
64486
|
+
return [2 /*return*/];
|
|
64742
64487
|
}
|
|
64743
64488
|
});
|
|
64744
64489
|
});
|
|
@@ -64752,26 +64497,17 @@ function () {
|
|
|
64752
64497
|
case 0:
|
|
64753
64498
|
if (this._endpointUpdateInProgress) {
|
|
64754
64499
|
this._endpointBuffer.push(endpointObject);
|
|
64755
|
-
|
|
64756
|
-
return [2
|
|
64757
|
-
/*return*/
|
|
64758
|
-
];
|
|
64500
|
+
return [2 /*return*/];
|
|
64759
64501
|
}
|
|
64760
64502
|
|
|
64761
64503
|
this._endpointUpdateInProgress = true;
|
|
64762
|
-
return [4
|
|
64763
|
-
/*yield*/
|
|
64764
|
-
, this._updateEndpoint(endpointObject)];
|
|
64765
|
-
|
|
64504
|
+
return [4 /*yield*/, this._updateEndpoint(endpointObject)];
|
|
64766
64505
|
case 1:
|
|
64767
64506
|
_a.sent();
|
|
64768
|
-
|
|
64769
64507
|
next = this._endpointBuffer.shift();
|
|
64770
64508
|
this._endpointUpdateInProgress = false;
|
|
64771
64509
|
next && this._sendEndpointUpdate(next);
|
|
64772
|
-
return [2
|
|
64773
|
-
/*return*/
|
|
64774
|
-
];
|
|
64510
|
+
return [2 /*return*/];
|
|
64775
64511
|
}
|
|
64776
64512
|
});
|
|
64777
64513
|
});
|
|
@@ -64781,28 +64517,22 @@ function () {
|
|
|
64781
64517
|
* @param params - params for event recording
|
|
64782
64518
|
* Put events into buffer
|
|
64783
64519
|
*/
|
|
64784
|
-
|
|
64785
|
-
|
|
64786
64520
|
AWSPinpointProvider.prototype._putToBuffer = function (params, handlers) {
|
|
64787
64521
|
if (params.event.name === UPDATE_ENDPOINT) {
|
|
64788
64522
|
this._sendEndpointUpdate({
|
|
64789
64523
|
params: params,
|
|
64790
64524
|
handlers: handlers
|
|
64791
64525
|
});
|
|
64792
|
-
|
|
64793
64526
|
return;
|
|
64794
64527
|
}
|
|
64795
|
-
|
|
64796
64528
|
this._buffer && this._buffer.push({
|
|
64797
64529
|
params: params,
|
|
64798
64530
|
handlers: handlers
|
|
64799
64531
|
});
|
|
64800
64532
|
};
|
|
64801
|
-
|
|
64802
64533
|
AWSPinpointProvider.prototype._generateSession = function (params) {
|
|
64803
64534
|
this._sessionId = this._sessionId || Object(uuid__WEBPACK_IMPORTED_MODULE_3__["v1"])();
|
|
64804
64535
|
var event = params.event;
|
|
64805
|
-
|
|
64806
64536
|
switch (event.name) {
|
|
64807
64537
|
case SESSION_START:
|
|
64808
64538
|
// refresh the session id and session start time
|
|
@@ -64813,7 +64543,6 @@ function () {
|
|
|
64813
64543
|
StartTimestamp: new Date(this._sessionStartTimestamp).toISOString()
|
|
64814
64544
|
};
|
|
64815
64545
|
break;
|
|
64816
|
-
|
|
64817
64546
|
case SESSION_STOP:
|
|
64818
64547
|
var stopTimestamp = new Date().getTime();
|
|
64819
64548
|
this._sessionStartTimestamp = this._sessionStartTimestamp || new Date().getTime();
|
|
@@ -64827,7 +64556,6 @@ function () {
|
|
|
64827
64556
|
this._sessionId = undefined;
|
|
64828
64557
|
this._sessionStartTimestamp = undefined;
|
|
64829
64558
|
break;
|
|
64830
|
-
|
|
64831
64559
|
default:
|
|
64832
64560
|
this._sessionStartTimestamp = this._sessionStartTimestamp || new Date().getTime();
|
|
64833
64561
|
this._sessionId = this._sessionId || Object(uuid__WEBPACK_IMPORTED_MODULE_3__["v1"])();
|
|
@@ -64837,53 +64565,39 @@ function () {
|
|
|
64837
64565
|
};
|
|
64838
64566
|
}
|
|
64839
64567
|
};
|
|
64840
|
-
|
|
64841
64568
|
AWSPinpointProvider.prototype._send = function (params, handlers) {
|
|
64842
64569
|
return __awaiter(this, void 0, void 0, function () {
|
|
64843
64570
|
var event;
|
|
64844
64571
|
return __generator(this, function (_a) {
|
|
64845
64572
|
event = params.event;
|
|
64846
|
-
|
|
64847
64573
|
switch (event.name) {
|
|
64848
64574
|
case UPDATE_ENDPOINT:
|
|
64849
|
-
return [2
|
|
64850
|
-
/*return*/
|
|
64851
|
-
, this._updateEndpoint({
|
|
64575
|
+
return [2 /*return*/, this._updateEndpoint({
|
|
64852
64576
|
params: params,
|
|
64853
64577
|
handlers: handlers
|
|
64854
64578
|
})];
|
|
64855
|
-
|
|
64856
64579
|
case SESSION_STOP:
|
|
64857
|
-
return [2
|
|
64858
|
-
/*return*/
|
|
64859
|
-
, this._pinpointSendStopSession(params, handlers)];
|
|
64860
|
-
|
|
64580
|
+
return [2 /*return*/, this._pinpointSendStopSession(params, handlers)];
|
|
64861
64581
|
default:
|
|
64862
|
-
return [2
|
|
64863
|
-
/*return*/
|
|
64864
|
-
, this._pinpointPutEvents(params, handlers)];
|
|
64582
|
+
return [2 /*return*/, this._pinpointPutEvents(params, handlers)];
|
|
64865
64583
|
}
|
|
64866
|
-
|
|
64867
|
-
return [2
|
|
64868
|
-
/*return*/
|
|
64869
|
-
];
|
|
64584
|
+
return [2 /*return*/];
|
|
64870
64585
|
});
|
|
64871
64586
|
});
|
|
64872
64587
|
};
|
|
64873
64588
|
|
|
64874
64589
|
AWSPinpointProvider.prototype._generateBatchItemContext = function (params) {
|
|
64875
64590
|
var _a;
|
|
64876
|
-
|
|
64877
64591
|
var event = params.event,
|
|
64878
|
-
|
|
64879
|
-
|
|
64592
|
+
timestamp = params.timestamp,
|
|
64593
|
+
config = params.config;
|
|
64880
64594
|
var name = event.name,
|
|
64881
|
-
|
|
64882
|
-
|
|
64883
|
-
|
|
64884
|
-
|
|
64595
|
+
attributes = event.attributes,
|
|
64596
|
+
metrics = event.metrics,
|
|
64597
|
+
eventId = event.eventId,
|
|
64598
|
+
session = event.session;
|
|
64885
64599
|
var appId = config.appId,
|
|
64886
|
-
|
|
64600
|
+
endpointId = config.endpointId;
|
|
64887
64601
|
var endpointContext = {};
|
|
64888
64602
|
var eventParams = {
|
|
64889
64603
|
ApplicationId: appId,
|
|
@@ -64903,11 +64617,9 @@ function () {
|
|
|
64903
64617
|
eventParams.EventsRequest.BatchItem[endpointId] = endpointObj;
|
|
64904
64618
|
return eventParams;
|
|
64905
64619
|
};
|
|
64906
|
-
|
|
64907
64620
|
AWSPinpointProvider.prototype._pinpointPutEvents = function (params, handlers) {
|
|
64908
64621
|
return __awaiter(this, void 0, void 0, function () {
|
|
64909
64622
|
var eventId, endpointId, eventParams, command, data, _a, _b, _c, _d, StatusCode, Message, err_1;
|
|
64910
|
-
|
|
64911
64623
|
return __generator(this, function (_e) {
|
|
64912
64624
|
switch (_e.label) {
|
|
64913
64625
|
case 0:
|
|
@@ -64915,51 +64627,30 @@ function () {
|
|
|
64915
64627
|
eventParams = this._generateBatchItemContext(params);
|
|
64916
64628
|
command = new _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_1__["PutEventsCommand"](eventParams);
|
|
64917
64629
|
_e.label = 1;
|
|
64918
|
-
|
|
64919
64630
|
case 1:
|
|
64920
64631
|
_e.trys.push([1, 3,, 4]);
|
|
64921
|
-
|
|
64922
|
-
return [4
|
|
64923
|
-
/*yield*/
|
|
64924
|
-
, this.pinpointClient.send(command)];
|
|
64925
|
-
|
|
64632
|
+
return [4 /*yield*/, this.pinpointClient.send(command)];
|
|
64926
64633
|
case 2:
|
|
64927
64634
|
data = _e.sent();
|
|
64928
64635
|
_a = data, _b = endpointId, _c = eventId, _d = _a.EventsResponse.Results[_b].EventsItemResponse[_c], StatusCode = _d.StatusCode, Message = _d.Message;
|
|
64929
|
-
|
|
64930
64636
|
if (ACCEPTED_CODES.includes(StatusCode)) {
|
|
64931
64637
|
logger.debug('record event success. ', data);
|
|
64932
|
-
return [2
|
|
64933
|
-
/*return*/
|
|
64934
|
-
, handlers.resolve(data)];
|
|
64638
|
+
return [2 /*return*/, handlers.resolve(data)];
|
|
64935
64639
|
} else {
|
|
64936
64640
|
if (RETRYABLE_CODES.includes(StatusCode)) {
|
|
64937
64641
|
this._retry(params, handlers);
|
|
64938
64642
|
} else {
|
|
64939
64643
|
logger.error("Event " + eventId + " is not accepted, the error is " + Message);
|
|
64940
|
-
return [2
|
|
64941
|
-
/*return*/
|
|
64942
|
-
, handlers.reject(data)];
|
|
64644
|
+
return [2 /*return*/, handlers.reject(data)];
|
|
64943
64645
|
}
|
|
64944
64646
|
}
|
|
64945
|
-
|
|
64946
|
-
return [3
|
|
64947
|
-
/*break*/
|
|
64948
|
-
, 4];
|
|
64949
|
-
|
|
64647
|
+
return [3 /*break*/, 4];
|
|
64950
64648
|
case 3:
|
|
64951
64649
|
err_1 = _e.sent();
|
|
64952
|
-
|
|
64953
64650
|
this._eventError(err_1);
|
|
64954
|
-
|
|
64955
|
-
return [2
|
|
64956
|
-
/*return*/
|
|
64957
|
-
, handlers.reject(err_1)];
|
|
64958
|
-
|
|
64651
|
+
return [2 /*return*/, handlers.reject(err_1)];
|
|
64959
64652
|
case 4:
|
|
64960
|
-
return [2
|
|
64961
|
-
/*return*/
|
|
64962
|
-
];
|
|
64653
|
+
return [2 /*return*/];
|
|
64963
64654
|
}
|
|
64964
64655
|
});
|
|
64965
64656
|
});
|
|
@@ -64968,15 +64659,12 @@ function () {
|
|
|
64968
64659
|
AWSPinpointProvider.prototype._pinpointSendStopSession = function (params, handlers) {
|
|
64969
64660
|
if (!BEACON_SUPPORTED) {
|
|
64970
64661
|
this._pinpointPutEvents(params, handlers);
|
|
64971
|
-
|
|
64972
64662
|
return;
|
|
64973
64663
|
}
|
|
64974
|
-
|
|
64975
64664
|
var eventParams = this._generateBatchItemContext(params);
|
|
64976
|
-
|
|
64977
64665
|
var region = this._config.region;
|
|
64978
64666
|
var ApplicationId = eventParams.ApplicationId,
|
|
64979
|
-
|
|
64667
|
+
EventsRequest = eventParams.EventsRequest;
|
|
64980
64668
|
var accessInfo = {
|
|
64981
64669
|
secret_key: this._config.credentials.secretAccessKey,
|
|
64982
64670
|
access_key: this._config.credentials.accessKeyId,
|
|
@@ -64996,28 +64684,22 @@ function () {
|
|
|
64996
64684
|
};
|
|
64997
64685
|
var requestUrl = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Signer"].signUrl(request, accessInfo, serviceInfo, null);
|
|
64998
64686
|
var success = navigator.sendBeacon(requestUrl, body);
|
|
64999
|
-
|
|
65000
64687
|
if (success) {
|
|
65001
64688
|
return handlers.resolve('sendBeacon success');
|
|
65002
64689
|
}
|
|
65003
|
-
|
|
65004
64690
|
return handlers.reject('sendBeacon failure');
|
|
65005
64691
|
};
|
|
65006
|
-
|
|
65007
64692
|
AWSPinpointProvider.prototype._retry = function (params, handlers) {
|
|
65008
|
-
var resendLimit = params.config.resendLimit;
|
|
65009
|
-
|
|
64693
|
+
var resendLimit = params.config.resendLimit;
|
|
64694
|
+
// For backward compatibility
|
|
65010
64695
|
params.resendLimit = typeof params.resendLimit === 'number' ? params.resendLimit : resendLimit;
|
|
65011
|
-
|
|
65012
64696
|
if (params.resendLimit-- > 0) {
|
|
65013
64697
|
logger.debug("resending event " + params.eventName + " with " + params.resendLimit + " retry times left");
|
|
65014
|
-
|
|
65015
64698
|
this._pinpointPutEvents(params, handlers);
|
|
65016
64699
|
} else {
|
|
65017
64700
|
logger.debug("retry times used up for event " + params.eventName);
|
|
65018
64701
|
}
|
|
65019
64702
|
};
|
|
65020
|
-
|
|
65021
64703
|
AWSPinpointProvider.prototype._updateEndpoint = function (endpointObject) {
|
|
65022
64704
|
return __awaiter(this, void 0, void 0, function () {
|
|
65023
64705
|
var params, handlers, config, event, appId, endpointId, request, update_params, command, data, err_2, failureData;
|
|
@@ -65034,27 +64716,17 @@ function () {
|
|
|
65034
64716
|
EndpointRequest: request
|
|
65035
64717
|
};
|
|
65036
64718
|
_a.label = 1;
|
|
65037
|
-
|
|
65038
64719
|
case 1:
|
|
65039
64720
|
_a.trys.push([1, 3,, 4]);
|
|
65040
|
-
|
|
65041
64721
|
command = new _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_1__["UpdateEndpointCommand"](update_params);
|
|
65042
|
-
return [4
|
|
65043
|
-
/*yield*/
|
|
65044
|
-
, this.pinpointClient.send(command)];
|
|
65045
|
-
|
|
64722
|
+
return [4 /*yield*/, this.pinpointClient.send(command)];
|
|
65046
64723
|
case 2:
|
|
65047
64724
|
data = _a.sent();
|
|
65048
64725
|
logger.debug('updateEndpoint success', data);
|
|
65049
64726
|
this._endpointGenerating = false;
|
|
65050
|
-
|
|
65051
64727
|
this._resumeBuffer();
|
|
65052
|
-
|
|
65053
64728
|
handlers.resolve(data);
|
|
65054
|
-
return [2
|
|
65055
|
-
/*return*/
|
|
65056
|
-
];
|
|
65057
|
-
|
|
64729
|
+
return [2 /*return*/];
|
|
65058
64730
|
case 3:
|
|
65059
64731
|
err_2 = _a.sent();
|
|
65060
64732
|
failureData = {
|
|
@@ -65062,14 +64734,9 @@ function () {
|
|
|
65062
64734
|
update_params: update_params,
|
|
65063
64735
|
endpointObject: endpointObject
|
|
65064
64736
|
};
|
|
65065
|
-
return [2
|
|
65066
|
-
/*return*/
|
|
65067
|
-
, this._handleEndpointUpdateFailure(failureData)];
|
|
65068
|
-
|
|
64737
|
+
return [2 /*return*/, this._handleEndpointUpdateFailure(failureData)];
|
|
65069
64738
|
case 4:
|
|
65070
|
-
return [2
|
|
65071
|
-
/*return*/
|
|
65072
|
-
];
|
|
64739
|
+
return [2 /*return*/];
|
|
65073
64740
|
}
|
|
65074
64741
|
});
|
|
65075
64742
|
});
|
|
@@ -65082,65 +64749,48 @@ function () {
|
|
|
65082
64749
|
err = failureData.err, endpointObject = failureData.endpointObject;
|
|
65083
64750
|
statusCode = err.$metadata && err.$metadata.httpStatusCode;
|
|
65084
64751
|
logger.debug('updateEndpoint error', err);
|
|
65085
|
-
|
|
65086
64752
|
switch (statusCode) {
|
|
65087
64753
|
case FORBIDDEN_CODE:
|
|
65088
|
-
return [2
|
|
65089
|
-
/*return*/
|
|
65090
|
-
, this._handleEndpointUpdateForbidden(failureData)];
|
|
65091
|
-
|
|
64754
|
+
return [2 /*return*/, this._handleEndpointUpdateForbidden(failureData)];
|
|
65092
64755
|
default:
|
|
65093
64756
|
if (RETRYABLE_CODES.includes(statusCode)) {
|
|
65094
64757
|
exponential = true;
|
|
65095
|
-
return [2
|
|
65096
|
-
/*return*/
|
|
65097
|
-
, this._retryEndpointUpdate(endpointObject, exponential)];
|
|
64758
|
+
return [2 /*return*/, this._retryEndpointUpdate(endpointObject, exponential)];
|
|
65098
64759
|
}
|
|
65099
|
-
|
|
65100
64760
|
logger.error('updateEndpoint failed', err);
|
|
65101
64761
|
endpointObject.handlers.reject(err);
|
|
65102
64762
|
}
|
|
65103
|
-
|
|
65104
|
-
return [2
|
|
65105
|
-
/*return*/
|
|
65106
|
-
];
|
|
64763
|
+
return [2 /*return*/];
|
|
65107
64764
|
});
|
|
65108
64765
|
});
|
|
65109
64766
|
};
|
|
65110
64767
|
|
|
65111
64768
|
AWSPinpointProvider.prototype._handleEndpointUpdateForbidden = function (failureData) {
|
|
65112
64769
|
var err = failureData.err,
|
|
65113
|
-
|
|
64770
|
+
endpointObject = failureData.endpointObject;
|
|
65114
64771
|
var code = err.code,
|
|
65115
|
-
|
|
65116
|
-
|
|
64772
|
+
retryable = err.retryable;
|
|
65117
64773
|
if (code !== EXPIRED_TOKEN_CODE && !retryable) {
|
|
65118
64774
|
return endpointObject.handlers.reject(err);
|
|
65119
64775
|
}
|
|
65120
|
-
|
|
65121
64776
|
this._retryEndpointUpdate(endpointObject);
|
|
65122
64777
|
};
|
|
65123
|
-
|
|
65124
64778
|
AWSPinpointProvider.prototype._retryEndpointUpdate = function (endpointObject, exponential) {
|
|
65125
64779
|
if (exponential === void 0) {
|
|
65126
64780
|
exponential = false;
|
|
65127
64781
|
}
|
|
65128
|
-
|
|
65129
64782
|
logger.debug('_retryEndpointUpdate', endpointObject);
|
|
65130
|
-
var params = endpointObject.params;
|
|
65131
|
-
|
|
64783
|
+
var params = endpointObject.params;
|
|
64784
|
+
// TODO: implement retry with exp back off once exp function is available
|
|
65132
64785
|
var resendLimit = params.config.resendLimit;
|
|
65133
64786
|
params.resendLimit = typeof params.resendLimit === 'number' ? params.resendLimit : resendLimit;
|
|
65134
|
-
|
|
65135
64787
|
if (params.resendLimit-- > 0) {
|
|
65136
|
-
logger.debug("resending endpoint update " + params.event.eventId + " with " + params.resendLimit + " retry attempts remaining");
|
|
65137
|
-
|
|
64788
|
+
logger.debug("resending endpoint update " + params.event.eventId + " with " + params.resendLimit + " retry attempts remaining");
|
|
64789
|
+
// insert at the front of endpointBuffer
|
|
65138
64790
|
this._endpointBuffer.length ? this._endpointBuffer.unshift(endpointObject) : this._updateEndpoint(endpointObject);
|
|
65139
64791
|
return;
|
|
65140
64792
|
}
|
|
65141
|
-
|
|
65142
64793
|
logger.warn("resending endpoint update " + params.event.eventId + " failed after " + params.config.resendLimit + " attempts");
|
|
65143
|
-
|
|
65144
64794
|
if (this._endpointGenerating) {
|
|
65145
64795
|
logger.error('Initial endpoint update failed. ');
|
|
65146
64796
|
}
|
|
@@ -65150,19 +64800,14 @@ function () {
|
|
|
65150
64800
|
* @param config
|
|
65151
64801
|
* Init the clients
|
|
65152
64802
|
*/
|
|
65153
|
-
|
|
65154
|
-
|
|
65155
64803
|
AWSPinpointProvider.prototype._initClients = function (credentials) {
|
|
65156
64804
|
return __awaiter(this, void 0, void 0, function () {
|
|
65157
64805
|
var identityId, region;
|
|
65158
64806
|
return __generator(this, function (_a) {
|
|
65159
64807
|
logger.debug('init clients');
|
|
65160
|
-
|
|
65161
64808
|
if (this.pinpointClient && this._config.credentials && this._config.credentials.sessionToken === credentials.sessionToken && this._config.credentials.identityId === credentials.identityId) {
|
|
65162
64809
|
logger.debug('no change for aws credentials, directly return from init');
|
|
65163
|
-
return [2
|
|
65164
|
-
/*return*/
|
|
65165
|
-
];
|
|
64810
|
+
return [2 /*return*/];
|
|
65166
64811
|
}
|
|
65167
64812
|
|
|
65168
64813
|
identityId = this._config.credentials ? this._config.credentials.identityId : null;
|
|
@@ -65173,8 +64818,8 @@ function () {
|
|
|
65173
64818
|
region: region,
|
|
65174
64819
|
credentials: credentials,
|
|
65175
64820
|
customUserAgent: Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["getAmplifyUserAgent"])()
|
|
65176
|
-
});
|
|
65177
|
-
|
|
64821
|
+
});
|
|
64822
|
+
// TODO: remove this middleware once a long term fix is implemented by aws-sdk-js team.
|
|
65178
64823
|
this.pinpointClient.middlewareStack.addRelativeTo(function (next) {
|
|
65179
64824
|
return function (args) {
|
|
65180
64825
|
delete args.request.headers['amz-sdk-invocation-id'];
|
|
@@ -65186,7 +64831,6 @@ function () {
|
|
|
65186
64831
|
relation: 'after',
|
|
65187
64832
|
toMiddleware: 'retryMiddleware'
|
|
65188
64833
|
});
|
|
65189
|
-
|
|
65190
64834
|
if (this._bufferExists() && identityId === credentials.identityId) {
|
|
65191
64835
|
// if the identity has remained the same, pass the updated client to the buffer
|
|
65192
64836
|
this._updateBufferClient();
|
|
@@ -65196,12 +64840,8 @@ function () {
|
|
|
65196
64840
|
// with the old credentials and then stop looping and shortly thereafter get picked up by GC
|
|
65197
64841
|
this._initBuffer();
|
|
65198
64842
|
}
|
|
65199
|
-
|
|
65200
64843
|
this._customizePinpointClientReq();
|
|
65201
|
-
|
|
65202
|
-
return [2
|
|
65203
|
-
/*return*/
|
|
65204
|
-
];
|
|
64844
|
+
return [2 /*return*/];
|
|
65205
64845
|
});
|
|
65206
64846
|
});
|
|
65207
64847
|
};
|
|
@@ -65209,41 +64849,35 @@ function () {
|
|
|
65209
64849
|
AWSPinpointProvider.prototype._bufferExists = function () {
|
|
65210
64850
|
return this._buffer && this._buffer instanceof _EventBuffer__WEBPACK_IMPORTED_MODULE_4__["default"];
|
|
65211
64851
|
};
|
|
65212
|
-
|
|
65213
64852
|
AWSPinpointProvider.prototype._initBuffer = function () {
|
|
65214
64853
|
if (this._bufferExists()) {
|
|
65215
64854
|
this._flushBuffer();
|
|
65216
64855
|
}
|
|
65217
|
-
|
|
65218
|
-
|
|
64856
|
+
this._buffer = new _EventBuffer__WEBPACK_IMPORTED_MODULE_4__["default"](this.pinpointClient, this._config);
|
|
64857
|
+
// if the first endpoint update hasn't yet resolved pause the buffer to
|
|
65219
64858
|
// prevent race conditions. It will be resumed as soon as that request succeeds
|
|
65220
|
-
|
|
65221
64859
|
if (this._endpointGenerating) {
|
|
65222
64860
|
this._buffer.pause();
|
|
65223
64861
|
}
|
|
65224
64862
|
};
|
|
65225
|
-
|
|
65226
64863
|
AWSPinpointProvider.prototype._updateBufferClient = function () {
|
|
65227
64864
|
if (this._bufferExists()) {
|
|
65228
64865
|
this._buffer.updateClient(this.pinpointClient);
|
|
65229
64866
|
}
|
|
65230
64867
|
};
|
|
65231
|
-
|
|
65232
64868
|
AWSPinpointProvider.prototype._flushBuffer = function () {
|
|
65233
64869
|
if (this._bufferExists()) {
|
|
65234
64870
|
this._buffer.flush();
|
|
65235
|
-
|
|
65236
64871
|
this._buffer = null;
|
|
65237
64872
|
}
|
|
65238
64873
|
};
|
|
65239
|
-
|
|
65240
64874
|
AWSPinpointProvider.prototype._resumeBuffer = function () {
|
|
65241
64875
|
if (this._bufferExists()) {
|
|
65242
64876
|
this._buffer.resume();
|
|
65243
64877
|
}
|
|
65244
64878
|
};
|
|
65245
|
-
|
|
65246
|
-
|
|
64879
|
+
AWSPinpointProvider.prototype._customizePinpointClientReq = function () {
|
|
64880
|
+
// TODO FIXME: Find a middleware to do this with AWS V3 SDK
|
|
65247
64881
|
// if (Platform.isReactNative) {
|
|
65248
64882
|
// this.pinpointClient.customizeRequests(request => {
|
|
65249
64883
|
// request.on('build', req => {
|
|
@@ -65252,21 +64886,16 @@ function () {
|
|
|
65252
64886
|
// });
|
|
65253
64887
|
// }
|
|
65254
64888
|
};
|
|
65255
|
-
|
|
65256
64889
|
AWSPinpointProvider.prototype._getEndpointId = function (cacheKey) {
|
|
65257
64890
|
return __awaiter(this, void 0, void 0, function () {
|
|
65258
64891
|
var endpointId, ttl, expiration;
|
|
65259
64892
|
return __generator(this, function (_a) {
|
|
65260
64893
|
switch (_a.label) {
|
|
65261
64894
|
case 0:
|
|
65262
|
-
return [4
|
|
65263
|
-
/*yield*/
|
|
65264
|
-
, _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_2___default.a.getItem(cacheKey)];
|
|
65265
|
-
|
|
64895
|
+
return [4 /*yield*/, _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_2___default.a.getItem(cacheKey)];
|
|
65266
64896
|
case 1:
|
|
65267
64897
|
endpointId = _a.sent();
|
|
65268
64898
|
logger.debug('endpointId from cache', endpointId, 'type', _typeof(endpointId));
|
|
65269
|
-
|
|
65270
64899
|
if (!endpointId) {
|
|
65271
64900
|
endpointId = Object(uuid__WEBPACK_IMPORTED_MODULE_3__["v1"])();
|
|
65272
64901
|
ttl = 1000 * 60 * 60 * 24 * 365 * 100;
|
|
@@ -65276,10 +64905,7 @@ function () {
|
|
|
65276
64905
|
priority: 1
|
|
65277
64906
|
});
|
|
65278
64907
|
}
|
|
65279
|
-
|
|
65280
|
-
return [2
|
|
65281
|
-
/*return*/
|
|
65282
|
-
, endpointId];
|
|
64908
|
+
return [2 /*return*/, endpointId];
|
|
65283
64909
|
}
|
|
65284
64910
|
});
|
|
65285
64911
|
});
|
|
@@ -65288,16 +64914,14 @@ function () {
|
|
|
65288
64914
|
* EndPoint request
|
|
65289
64915
|
* @return {Object} - The request of updating endpoint
|
|
65290
64916
|
*/
|
|
65291
|
-
|
|
65292
|
-
|
|
65293
64917
|
AWSPinpointProvider.prototype._endpointRequest = function (config, event) {
|
|
65294
64918
|
var credentials = config.credentials;
|
|
65295
64919
|
var clientInfo = this._clientInfo || {};
|
|
65296
|
-
var clientContext = config.clientContext || {};
|
|
64920
|
+
var clientContext = config.clientContext || {};
|
|
64921
|
+
// for now we have three different ways for default endpoint configurations
|
|
65297
64922
|
// clientInfo
|
|
65298
64923
|
// clientContext (deprecated)
|
|
65299
64924
|
// config.endpoint
|
|
65300
|
-
|
|
65301
64925
|
var defaultEndpointConfig = config.endpoint || {};
|
|
65302
64926
|
var demographicByClientInfo = {
|
|
65303
64927
|
appVersion: clientInfo.appVersion,
|
|
@@ -65305,17 +64929,15 @@ function () {
|
|
|
65305
64929
|
model: clientInfo.model,
|
|
65306
64930
|
modelVersion: clientInfo.version,
|
|
65307
64931
|
platform: clientInfo.platform
|
|
65308
|
-
};
|
|
65309
|
-
|
|
64932
|
+
};
|
|
64933
|
+
// for backward compatibility
|
|
65310
64934
|
var clientId = clientContext.clientId,
|
|
65311
|
-
|
|
65312
|
-
|
|
65313
|
-
|
|
65314
|
-
|
|
65315
|
-
|
|
65316
|
-
|
|
64935
|
+
appTitle = clientContext.appTitle,
|
|
64936
|
+
appVersionName = clientContext.appVersionName,
|
|
64937
|
+
appVersionCode = clientContext.appVersionCode,
|
|
64938
|
+
appPackageName = clientContext.appPackageName,
|
|
64939
|
+
demographicByClientContext = __rest(clientContext, ["clientId", "appTitle", "appVersionName", "appVersionCode", "appPackageName"]);
|
|
65317
64940
|
var channelType = event.address ? clientInfo.platform === 'android' ? 'GCM' : 'APNS' : undefined;
|
|
65318
|
-
|
|
65319
64941
|
var tmp = __assign(__assign(__assign({
|
|
65320
64942
|
channelType: channelType,
|
|
65321
64943
|
requestId: Object(uuid__WEBPACK_IMPORTED_MODULE_3__["v1"])(),
|
|
@@ -65329,25 +64951,21 @@ function () {
|
|
|
65329
64951
|
userId: event.userId || defaultEndpointConfig.userId || credentials.identityId,
|
|
65330
64952
|
userAttributes: __assign(__assign({}, defaultEndpointConfig.userAttributes), event.userAttributes)
|
|
65331
64953
|
}
|
|
65332
|
-
});
|
|
65333
|
-
|
|
65334
|
-
|
|
64954
|
+
});
|
|
64955
|
+
// eliminate unnecessary params
|
|
65335
64956
|
var userId = tmp.userId,
|
|
65336
|
-
|
|
65337
|
-
|
|
65338
|
-
|
|
65339
|
-
|
|
65340
|
-
|
|
65341
|
-
|
|
65342
|
-
|
|
64957
|
+
userAttributes = tmp.userAttributes,
|
|
64958
|
+
name = tmp.name,
|
|
64959
|
+
session = tmp.session,
|
|
64960
|
+
eventId = tmp.eventId,
|
|
64961
|
+
immediate = tmp.immediate,
|
|
64962
|
+
ret = __rest(tmp, ["userId", "userAttributes", "name", "session", "eventId", "immediate"]);
|
|
65343
64963
|
return _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["JS"].transferKeyToUpperCase(ret, [], ['metrics', 'userAttributes', 'attributes']);
|
|
65344
64964
|
};
|
|
65345
|
-
|
|
65346
64965
|
AWSPinpointProvider.prototype._eventError = function (err) {
|
|
65347
64966
|
logger.error('record event failed.', err);
|
|
65348
64967
|
logger.warn("Please ensure you have updated your Pinpoint IAM Policy " + "with the Action: \"mobiletargeting:PutEvents\" " + "in order to record events");
|
|
65349
64968
|
};
|
|
65350
|
-
|
|
65351
64969
|
AWSPinpointProvider.prototype._getCredentials = function () {
|
|
65352
64970
|
return __awaiter(this, void 0, void 0, function () {
|
|
65353
64971
|
var credentials, err_3;
|
|
@@ -65355,32 +64973,18 @@ function () {
|
|
|
65355
64973
|
switch (_a.label) {
|
|
65356
64974
|
case 0:
|
|
65357
64975
|
_a.trys.push([0, 2,, 3]);
|
|
65358
|
-
|
|
65359
|
-
return [4
|
|
65360
|
-
/*yield*/
|
|
65361
|
-
, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Credentials"].get()];
|
|
65362
|
-
|
|
64976
|
+
return [4 /*yield*/, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Credentials"].get()];
|
|
65363
64977
|
case 1:
|
|
65364
64978
|
credentials = _a.sent();
|
|
65365
|
-
if (!credentials) return [2
|
|
65366
|
-
/*return*/
|
|
65367
|
-
, null];
|
|
64979
|
+
if (!credentials) return [2 /*return*/, null];
|
|
65368
64980
|
logger.debug('set credentials for analytics', credentials);
|
|
65369
|
-
return [2
|
|
65370
|
-
/*return*/
|
|
65371
|
-
, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Credentials"].shear(credentials)];
|
|
65372
|
-
|
|
64981
|
+
return [2 /*return*/, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Credentials"].shear(credentials)];
|
|
65373
64982
|
case 2:
|
|
65374
64983
|
err_3 = _a.sent();
|
|
65375
64984
|
logger.debug('ensure credentials error', err_3);
|
|
65376
|
-
return [2
|
|
65377
|
-
/*return*/
|
|
65378
|
-
, null];
|
|
65379
|
-
|
|
64985
|
+
return [2 /*return*/, null];
|
|
65380
64986
|
case 3:
|
|
65381
|
-
return [2
|
|
65382
|
-
/*return*/
|
|
65383
|
-
];
|
|
64987
|
+
return [2 /*return*/];
|
|
65384
64988
|
}
|
|
65385
64989
|
});
|
|
65386
64990
|
});
|
|
@@ -65391,11 +64995,9 @@ function () {
|
|
|
65391
64995
|
return AWSPinpointProvider;
|
|
65392
64996
|
}();
|
|
65393
64997
|
|
|
65394
|
-
|
|
65395
64998
|
/**
|
|
65396
64999
|
* @deprecated use named import
|
|
65397
65000
|
*/
|
|
65398
|
-
|
|
65399
65001
|
/* harmony default export */ __webpack_exports__["default"] = (AWSPinpointProvider);
|
|
65400
65002
|
|
|
65401
65003
|
/***/ }),
|
|
@@ -65411,36 +65013,27 @@ function () {
|
|
|
65411
65013
|
__webpack_require__.r(__webpack_exports__);
|
|
65412
65014
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MediaAutoTrack", function() { return MediaAutoTrack; });
|
|
65413
65015
|
var HTML5_MEDIA_EVENT;
|
|
65414
|
-
|
|
65415
65016
|
(function (HTML5_MEDIA_EVENT) {
|
|
65416
65017
|
HTML5_MEDIA_EVENT["PLAY"] = "play";
|
|
65417
65018
|
HTML5_MEDIA_EVENT["PAUSE"] = "pause";
|
|
65418
65019
|
HTML5_MEDIA_EVENT["ENDED"] = "Ended";
|
|
65419
65020
|
})(HTML5_MEDIA_EVENT || (HTML5_MEDIA_EVENT = {}));
|
|
65420
|
-
|
|
65421
65021
|
var MEDIA_TYPE;
|
|
65422
|
-
|
|
65423
65022
|
(function (MEDIA_TYPE) {
|
|
65424
65023
|
MEDIA_TYPE["IFRAME"] = "IFRAME";
|
|
65425
65024
|
MEDIA_TYPE["VIDEO"] = "VIDEO";
|
|
65426
65025
|
MEDIA_TYPE["AUDIO"] = "AUDIO";
|
|
65427
65026
|
})(MEDIA_TYPE || (MEDIA_TYPE = {}));
|
|
65428
|
-
|
|
65429
65027
|
var EVENT_TYPE;
|
|
65430
|
-
|
|
65431
65028
|
(function (EVENT_TYPE) {
|
|
65432
65029
|
EVENT_TYPE["PLAY"] = "Play";
|
|
65433
65030
|
EVENT_TYPE["ENDED"] = "Ended";
|
|
65434
65031
|
EVENT_TYPE["PAUSE"] = "Pause";
|
|
65435
65032
|
EVENT_TYPE["TIME_WATCHED"] = "TimeWatched";
|
|
65436
65033
|
})(EVENT_TYPE || (EVENT_TYPE = {}));
|
|
65437
|
-
|
|
65438
|
-
var MediaAutoTrack =
|
|
65439
|
-
/** @class */
|
|
65440
|
-
function () {
|
|
65034
|
+
var MediaAutoTrack = /** @class */function () {
|
|
65441
65035
|
function MediaAutoTrack(params, provider) {
|
|
65442
65036
|
var _a;
|
|
65443
|
-
|
|
65444
65037
|
this.eventActionMapping = (_a = {}, _a[EVENT_TYPE.ENDED] = this.endedEventAction.bind(this), _a[EVENT_TYPE.PLAY] = this.playEventAction.bind(this), _a[EVENT_TYPE.PAUSE] = this.pauseEventAction.bind(this), _a);
|
|
65445
65038
|
var eventData = params.eventData;
|
|
65446
65039
|
this._params = params;
|
|
@@ -65452,12 +65045,9 @@ function () {
|
|
|
65452
65045
|
VIDEO: this._html5MediaTracker,
|
|
65453
65046
|
AUDIO: this._html5MediaTracker
|
|
65454
65047
|
};
|
|
65455
|
-
|
|
65456
65048
|
mediaTrackFunMapping[this._mediaElement.tagName].bind(this)();
|
|
65457
|
-
|
|
65458
65049
|
this._initYoutubeFrame();
|
|
65459
65050
|
}
|
|
65460
|
-
|
|
65461
65051
|
MediaAutoTrack.prototype._initYoutubeFrame = function () {
|
|
65462
65052
|
this._youTubeIframeLoader = {
|
|
65463
65053
|
src: 'https://www.youtube.com/iframe_api',
|
|
@@ -65466,28 +65056,21 @@ function () {
|
|
|
65466
65056
|
listeners: [],
|
|
65467
65057
|
load: function load(callback) {
|
|
65468
65058
|
var _this = this;
|
|
65469
|
-
|
|
65470
65059
|
this.listeners.push(callback);
|
|
65471
|
-
|
|
65472
65060
|
if (this.loaded) {
|
|
65473
65061
|
setTimeout(function () {
|
|
65474
65062
|
_this.done();
|
|
65475
65063
|
});
|
|
65476
65064
|
return;
|
|
65477
65065
|
}
|
|
65478
|
-
|
|
65479
65066
|
if (this.loading) {
|
|
65480
65067
|
return;
|
|
65481
65068
|
}
|
|
65482
|
-
|
|
65483
65069
|
this.loading = true;
|
|
65484
|
-
|
|
65485
65070
|
window['onYouTubeIframeAPIReady'] = function () {
|
|
65486
65071
|
_this.loaded = true;
|
|
65487
|
-
|
|
65488
65072
|
_this.done();
|
|
65489
65073
|
};
|
|
65490
|
-
|
|
65491
65074
|
var script = document.createElement('script');
|
|
65492
65075
|
script.type = 'text/javascript';
|
|
65493
65076
|
script.src = this.src;
|
|
@@ -65495,14 +65078,12 @@ function () {
|
|
|
65495
65078
|
},
|
|
65496
65079
|
done: function done() {
|
|
65497
65080
|
delete window['onYouTubeIframeAPIReady'];
|
|
65498
|
-
|
|
65499
65081
|
while (this.listeners.length) {
|
|
65500
65082
|
this.listeners.pop()(window['YT']);
|
|
65501
65083
|
}
|
|
65502
65084
|
}
|
|
65503
65085
|
};
|
|
65504
65086
|
};
|
|
65505
|
-
|
|
65506
65087
|
MediaAutoTrack.prototype._iframeMediaTracker = function () {
|
|
65507
65088
|
var that = this;
|
|
65508
65089
|
setInterval(function () {
|
|
@@ -65510,7 +65091,6 @@ function () {
|
|
|
65510
65091
|
that.recordEvent(MEDIA_TYPE.IFRAME, EVENT_TYPE.TIME_WATCHED);
|
|
65511
65092
|
}
|
|
65512
65093
|
}, 3 * 1000);
|
|
65513
|
-
|
|
65514
65094
|
this._youTubeIframeLoader.load(function (YT) {
|
|
65515
65095
|
that._iframePlayer = new YT.Player(that._mediaElement.id, {
|
|
65516
65096
|
events: {
|
|
@@ -65519,7 +65099,6 @@ function () {
|
|
|
65519
65099
|
});
|
|
65520
65100
|
});
|
|
65521
65101
|
};
|
|
65522
|
-
|
|
65523
65102
|
MediaAutoTrack.prototype._onPlayerStateChange = function (event) {
|
|
65524
65103
|
var iframeEventMapping = {
|
|
65525
65104
|
0: EVENT_TYPE.ENDED,
|
|
@@ -65527,12 +65106,10 @@ function () {
|
|
|
65527
65106
|
2: EVENT_TYPE.PAUSE
|
|
65528
65107
|
};
|
|
65529
65108
|
var eventType = iframeEventMapping[event.data];
|
|
65530
|
-
|
|
65531
65109
|
if (eventType) {
|
|
65532
65110
|
this.eventActionMapping[eventType](MEDIA_TYPE.IFRAME);
|
|
65533
65111
|
}
|
|
65534
65112
|
};
|
|
65535
|
-
|
|
65536
65113
|
MediaAutoTrack.prototype._html5MediaTracker = function () {
|
|
65537
65114
|
var that = this;
|
|
65538
65115
|
setInterval(function () {
|
|
@@ -65540,40 +65117,32 @@ function () {
|
|
|
65540
65117
|
that.recordEvent(MEDIA_TYPE.VIDEO, EVENT_TYPE.TIME_WATCHED);
|
|
65541
65118
|
}
|
|
65542
65119
|
}, 3 * 1000);
|
|
65543
|
-
|
|
65544
65120
|
this._mediaElement.addEventListener(HTML5_MEDIA_EVENT.PLAY, function () {
|
|
65545
65121
|
that.eventActionMapping[EVENT_TYPE.PLAY](MEDIA_TYPE.VIDEO);
|
|
65546
65122
|
}, false);
|
|
65547
|
-
|
|
65548
65123
|
this._mediaElement.addEventListener(HTML5_MEDIA_EVENT.PAUSE, function () {
|
|
65549
65124
|
that.eventActionMapping[EVENT_TYPE.PAUSE](MEDIA_TYPE.VIDEO);
|
|
65550
65125
|
}, false);
|
|
65551
|
-
|
|
65552
65126
|
this._mediaElement.addEventListener(HTML5_MEDIA_EVENT.ENDED, function () {
|
|
65553
65127
|
that.eventActionMapping[EVENT_TYPE.ENDED](MEDIA_TYPE.VIDEO);
|
|
65554
65128
|
}, false);
|
|
65555
65129
|
};
|
|
65556
|
-
|
|
65557
65130
|
MediaAutoTrack.prototype.playEventAction = function (mediaType) {
|
|
65558
65131
|
this._started = true;
|
|
65559
65132
|
this.recordEvent(mediaType, EVENT_TYPE.PLAY);
|
|
65560
65133
|
};
|
|
65561
|
-
|
|
65562
65134
|
MediaAutoTrack.prototype.pauseEventAction = function (mediaType) {
|
|
65563
65135
|
this._started = false;
|
|
65564
65136
|
this.recordEvent(mediaType, EVENT_TYPE.PAUSE);
|
|
65565
65137
|
};
|
|
65566
|
-
|
|
65567
65138
|
MediaAutoTrack.prototype.endedEventAction = function (mediaType) {
|
|
65568
65139
|
this._started = false;
|
|
65569
65140
|
this.recordEvent(mediaType, EVENT_TYPE.ENDED);
|
|
65570
65141
|
};
|
|
65571
|
-
|
|
65572
65142
|
MediaAutoTrack.prototype.recordEvent = function (mediaType, eventType) {
|
|
65573
65143
|
var newParams = Object.assign({}, this._params);
|
|
65574
65144
|
var eventData = newParams.eventData;
|
|
65575
65145
|
eventData.eventType = eventType;
|
|
65576
|
-
|
|
65577
65146
|
if (mediaType === MEDIA_TYPE.VIDEO) {
|
|
65578
65147
|
eventData.properties.timestamp = this._mediaElement.currentTime;
|
|
65579
65148
|
eventData.properties.duration = this._mediaElement.duration;
|
|
@@ -65581,23 +65150,18 @@ function () {
|
|
|
65581
65150
|
eventData.properties.timestamp = this._financial(this._iframePlayer.getCurrentTime());
|
|
65582
65151
|
eventData.properties.duration = this._financial(this._iframePlayer.getDuration());
|
|
65583
65152
|
}
|
|
65584
|
-
|
|
65585
65153
|
var percentage = parseFloat(eventData.properties.timestamp) / parseFloat(eventData.properties.duration);
|
|
65586
65154
|
eventData.properties.eventValue = Number(percentage.toFixed(4));
|
|
65587
65155
|
delete eventData.properties.domElementId;
|
|
65588
|
-
|
|
65589
65156
|
this._provider.putToBuffer(newParams);
|
|
65590
65157
|
};
|
|
65591
|
-
|
|
65592
65158
|
MediaAutoTrack.prototype._financial = function (x) {
|
|
65593
65159
|
return Number.parseFloat(x).toFixed(4);
|
|
65594
65160
|
};
|
|
65595
|
-
|
|
65596
65161
|
return MediaAutoTrack;
|
|
65597
65162
|
}();
|
|
65598
65163
|
|
|
65599
65164
|
|
|
65600
|
-
|
|
65601
65165
|
/***/ }),
|
|
65602
65166
|
|
|
65603
65167
|
/***/ "./lib-esm/Providers/AmazonPersonalizeHelper/SessionInfoManager.js":
|
|
@@ -65633,32 +65197,24 @@ var TIMER_INTERVAL = 30 * 1000;
|
|
|
65633
65197
|
var DELIMITER = '.';
|
|
65634
65198
|
var CACHE_EXPIRY_IN_DAYS = 7;
|
|
65635
65199
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_3__["ConsoleLogger"]('AmazonPersonalizeProvider');
|
|
65636
|
-
|
|
65637
|
-
var SessionInfoManager =
|
|
65638
|
-
/** @class */
|
|
65639
|
-
function () {
|
|
65200
|
+
var SessionInfoManager = /** @class */function () {
|
|
65640
65201
|
function SessionInfoManager(prefixKey) {
|
|
65641
65202
|
if (prefixKey === void 0) {
|
|
65642
65203
|
prefixKey = '';
|
|
65643
65204
|
}
|
|
65644
|
-
|
|
65645
65205
|
this._isBrowser = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_3__["JS"].browserOrNode().isBrowser;
|
|
65646
65206
|
this._timerKey = Object(uuid__WEBPACK_IMPORTED_MODULE_2__["v1"])().substr(0, 15);
|
|
65647
|
-
|
|
65648
65207
|
this._refreshTimer();
|
|
65649
65208
|
}
|
|
65650
|
-
|
|
65651
65209
|
SessionInfoManager.prototype._refreshTimer = function () {
|
|
65652
65210
|
if (this._timer) {
|
|
65653
65211
|
clearInterval(this._timer);
|
|
65654
65212
|
}
|
|
65655
|
-
|
|
65656
65213
|
var that = this;
|
|
65657
65214
|
this._timer = setInterval(function () {
|
|
65658
65215
|
that._timerKey = Object(uuid__WEBPACK_IMPORTED_MODULE_2__["v1"])().substr(0, 15);
|
|
65659
65216
|
}, TIMER_INTERVAL);
|
|
65660
65217
|
};
|
|
65661
|
-
|
|
65662
65218
|
SessionInfoManager.prototype.storeValue = function (key, value) {
|
|
65663
65219
|
var today = new Date();
|
|
65664
65220
|
var expire = new Date();
|
|
@@ -65667,27 +65223,21 @@ function () {
|
|
|
65667
65223
|
expires: expire.getTime()
|
|
65668
65224
|
});
|
|
65669
65225
|
};
|
|
65670
|
-
|
|
65671
65226
|
SessionInfoManager.prototype.retrieveValue = function (key) {
|
|
65672
65227
|
return _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_4___default.a.getItem(this._getCachePrefix(key));
|
|
65673
65228
|
};
|
|
65674
|
-
|
|
65675
65229
|
SessionInfoManager.prototype._getCachePrefix = function (key) {
|
|
65676
65230
|
if (this._isBrowser) {
|
|
65677
65231
|
return key + DELIMITER + window.location.host;
|
|
65678
65232
|
}
|
|
65679
|
-
|
|
65680
65233
|
return DEFAULT_CACHE_PREFIX;
|
|
65681
65234
|
};
|
|
65682
|
-
|
|
65683
65235
|
SessionInfoManager.prototype.getTimerKey = function () {
|
|
65684
65236
|
return this._timerKey;
|
|
65685
65237
|
};
|
|
65686
|
-
|
|
65687
65238
|
SessionInfoManager.prototype.updateSessionInfo = function (userId, sessionInfo) {
|
|
65688
65239
|
var existUserId = sessionInfo.userId;
|
|
65689
65240
|
var existSessionId = sessionInfo.sessionId;
|
|
65690
|
-
|
|
65691
65241
|
if (this._isRequireNewSession(userId, existUserId, existSessionId)) {
|
|
65692
65242
|
var newSessionId = Object(uuid__WEBPACK_IMPORTED_MODULE_2__["v1"])();
|
|
65693
65243
|
this.storeValue(PERSONALIZE_CACHE_USERID, userId);
|
|
@@ -65696,31 +65246,25 @@ function () {
|
|
|
65696
65246
|
} else if (this._isRequireUpdateSessionInfo(userId, existUserId, existSessionId)) {
|
|
65697
65247
|
this.storeValue(PERSONALIZE_CACHE_USERID, userId);
|
|
65698
65248
|
}
|
|
65699
|
-
|
|
65700
65249
|
sessionInfo.userId = userId;
|
|
65701
65250
|
};
|
|
65702
|
-
|
|
65703
65251
|
SessionInfoManager.prototype._isRequireUpdateSessionInfo = function (userId, cachedSessionUserId, cachedSessionSessionId) {
|
|
65704
65252
|
// anonymouse => sign in : hasSession && s_userId == null && curr_userId !=null
|
|
65705
65253
|
var isNoCachedSession = lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(cachedSessionSessionId);
|
|
65706
65254
|
return !isNoCachedSession && lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(cachedSessionUserId) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(userId);
|
|
65707
65255
|
};
|
|
65708
|
-
|
|
65709
65256
|
SessionInfoManager.prototype.retrieveSessionInfo = function (trackingId) {
|
|
65710
65257
|
var sessionInfo = {};
|
|
65711
65258
|
sessionInfo.trackingId = trackingId;
|
|
65712
65259
|
sessionInfo.sessionId = this.retrieveValue(PERSONALIZE_CACHE_SESSIONID);
|
|
65713
65260
|
sessionInfo.userId = this.retrieveValue(PERSONALIZE_CACHE_USERID);
|
|
65714
|
-
|
|
65715
65261
|
if (lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(sessionInfo.sessionId)) {
|
|
65716
65262
|
sessionInfo.sessionId = Object(uuid__WEBPACK_IMPORTED_MODULE_2__["v1"])();
|
|
65717
65263
|
this.storeValue(PERSONALIZE_CACHE_SESSIONID, sessionInfo.sessionId);
|
|
65718
65264
|
}
|
|
65719
|
-
|
|
65720
65265
|
this.storeValue(PERSONALIZE_CACHE, trackingId);
|
|
65721
65266
|
return sessionInfo;
|
|
65722
65267
|
};
|
|
65723
|
-
|
|
65724
65268
|
SessionInfoManager.prototype._isRequireNewSession = function (userId, cachedSessionUserId, cachedSessionSessionId) {
|
|
65725
65269
|
// new session => 1. no cached session info 2. signOut: s_userId !=null && curr_userId ==null
|
|
65726
65270
|
// 3. switch account: s_userId !=null && curr_userId !=null && s_userId != curr_userId
|
|
@@ -65729,12 +65273,10 @@ function () {
|
|
|
65729
65273
|
var isSwitchUserCase = !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(userId) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(cachedSessionUserId) && !lodash_isEqual__WEBPACK_IMPORTED_MODULE_1___default()(userId, cachedSessionUserId);
|
|
65730
65274
|
return isNoCachedSession || isSignoutCase || isSwitchUserCase;
|
|
65731
65275
|
};
|
|
65732
|
-
|
|
65733
65276
|
return SessionInfoManager;
|
|
65734
65277
|
}();
|
|
65735
65278
|
|
|
65736
65279
|
|
|
65737
|
-
|
|
65738
65280
|
/***/ }),
|
|
65739
65281
|
|
|
65740
65282
|
/***/ "./lib-esm/Providers/AmazonPersonalizeHelper/index.js":
|
|
@@ -65795,7 +65337,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
65795
65337
|
resolve(value);
|
|
65796
65338
|
});
|
|
65797
65339
|
}
|
|
65798
|
-
|
|
65799
65340
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
65800
65341
|
function fulfilled(value) {
|
|
65801
65342
|
try {
|
|
@@ -65804,7 +65345,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
65804
65345
|
reject(e);
|
|
65805
65346
|
}
|
|
65806
65347
|
}
|
|
65807
|
-
|
|
65808
65348
|
function rejected(value) {
|
|
65809
65349
|
try {
|
|
65810
65350
|
step(generator["throw"](value));
|
|
@@ -65812,29 +65352,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
65812
65352
|
reject(e);
|
|
65813
65353
|
}
|
|
65814
65354
|
}
|
|
65815
|
-
|
|
65816
65355
|
function step(result) {
|
|
65817
65356
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
65818
65357
|
}
|
|
65819
|
-
|
|
65820
65358
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
65821
65359
|
});
|
|
65822
65360
|
};
|
|
65823
|
-
|
|
65824
65361
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
65825
65362
|
var _ = {
|
|
65826
|
-
|
|
65827
|
-
|
|
65828
|
-
|
|
65829
|
-
|
|
65363
|
+
label: 0,
|
|
65364
|
+
sent: function sent() {
|
|
65365
|
+
if (t[0] & 1) throw t[1];
|
|
65366
|
+
return t[1];
|
|
65367
|
+
},
|
|
65368
|
+
trys: [],
|
|
65369
|
+
ops: []
|
|
65830
65370
|
},
|
|
65831
|
-
|
|
65832
|
-
|
|
65833
|
-
|
|
65834
|
-
|
|
65835
|
-
y,
|
|
65836
|
-
t,
|
|
65837
|
-
g;
|
|
65371
|
+
f,
|
|
65372
|
+
y,
|
|
65373
|
+
t,
|
|
65374
|
+
g;
|
|
65838
65375
|
return g = {
|
|
65839
65376
|
next: verb(0),
|
|
65840
65377
|
"throw": verb(1),
|
|
@@ -65842,79 +65379,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
65842
65379
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
65843
65380
|
return this;
|
|
65844
65381
|
}), g;
|
|
65845
|
-
|
|
65846
65382
|
function verb(n) {
|
|
65847
65383
|
return function (v) {
|
|
65848
65384
|
return step([n, v]);
|
|
65849
65385
|
};
|
|
65850
65386
|
}
|
|
65851
|
-
|
|
65852
65387
|
function step(op) {
|
|
65853
65388
|
if (f) throw new TypeError("Generator is already executing.");
|
|
65854
|
-
|
|
65855
65389
|
while (_) {
|
|
65856
65390
|
try {
|
|
65857
65391
|
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;
|
|
65858
65392
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
65859
|
-
|
|
65860
65393
|
switch (op[0]) {
|
|
65861
65394
|
case 0:
|
|
65862
65395
|
case 1:
|
|
65863
65396
|
t = op;
|
|
65864
65397
|
break;
|
|
65865
|
-
|
|
65866
65398
|
case 4:
|
|
65867
65399
|
_.label++;
|
|
65868
65400
|
return {
|
|
65869
65401
|
value: op[1],
|
|
65870
65402
|
done: false
|
|
65871
65403
|
};
|
|
65872
|
-
|
|
65873
65404
|
case 5:
|
|
65874
65405
|
_.label++;
|
|
65875
65406
|
y = op[1];
|
|
65876
65407
|
op = [0];
|
|
65877
65408
|
continue;
|
|
65878
|
-
|
|
65879
65409
|
case 7:
|
|
65880
65410
|
op = _.ops.pop();
|
|
65881
|
-
|
|
65882
65411
|
_.trys.pop();
|
|
65883
|
-
|
|
65884
65412
|
continue;
|
|
65885
|
-
|
|
65886
65413
|
default:
|
|
65887
65414
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
65888
65415
|
_ = 0;
|
|
65889
65416
|
continue;
|
|
65890
65417
|
}
|
|
65891
|
-
|
|
65892
65418
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
65893
65419
|
_.label = op[1];
|
|
65894
65420
|
break;
|
|
65895
65421
|
}
|
|
65896
|
-
|
|
65897
65422
|
if (op[0] === 6 && _.label < t[1]) {
|
|
65898
65423
|
_.label = t[1];
|
|
65899
65424
|
t = op;
|
|
65900
65425
|
break;
|
|
65901
65426
|
}
|
|
65902
|
-
|
|
65903
65427
|
if (t && _.label < t[2]) {
|
|
65904
65428
|
_.label = t[2];
|
|
65905
|
-
|
|
65906
65429
|
_.ops.push(op);
|
|
65907
|
-
|
|
65908
65430
|
break;
|
|
65909
65431
|
}
|
|
65910
|
-
|
|
65911
65432
|
if (t[2]) _.ops.pop();
|
|
65912
|
-
|
|
65913
65433
|
_.trys.pop();
|
|
65914
|
-
|
|
65915
65434
|
continue;
|
|
65916
65435
|
}
|
|
65917
|
-
|
|
65918
65436
|
op = body.call(thisArg, _);
|
|
65919
65437
|
} catch (e) {
|
|
65920
65438
|
op = [6, e];
|
|
@@ -65923,7 +65441,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
65923
65441
|
f = t = 0;
|
|
65924
65442
|
}
|
|
65925
65443
|
}
|
|
65926
|
-
|
|
65927
65444
|
if (op[0] & 5) throw op[1];
|
|
65928
65445
|
return {
|
|
65929
65446
|
value: op[0] ? op[1] : void 0,
|
|
@@ -65937,39 +65454,30 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
65937
65454
|
|
|
65938
65455
|
|
|
65939
65456
|
|
|
65940
|
-
|
|
65941
|
-
|
|
65942
|
-
|
|
65457
|
+
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('AmazonPersonalizeProvider');
|
|
65458
|
+
// events buffer
|
|
65943
65459
|
var FLUSH_SIZE = 5;
|
|
65944
65460
|
var FLUSH_SIZE_THRESHHOLD = 10;
|
|
65945
65461
|
var FLUSH_INTERVAL = 5 * 1000; // 5s
|
|
65946
|
-
|
|
65947
65462
|
var IDENTIFY_EVENT = 'Identify';
|
|
65948
|
-
|
|
65949
|
-
var AmazonPersonalizeProvider =
|
|
65950
|
-
/** @class */
|
|
65951
|
-
function () {
|
|
65463
|
+
var AmazonPersonalizeProvider = /** @class */function () {
|
|
65952
65464
|
function AmazonPersonalizeProvider(config) {
|
|
65953
65465
|
this._buffer = [];
|
|
65954
65466
|
this._config = config ? config : {};
|
|
65955
65467
|
this._config.flushSize = this._config.flushSize > 0 && this._config.flushSize <= FLUSH_SIZE_THRESHHOLD ? this._config.flushSize : FLUSH_SIZE;
|
|
65956
65468
|
this._config.flushInterval = this._config.flushInterval || FLUSH_INTERVAL;
|
|
65957
65469
|
this._sessionManager = new _AmazonPersonalizeHelper__WEBPACK_IMPORTED_MODULE_2__["SessionInfoManager"]();
|
|
65958
|
-
|
|
65959
65470
|
if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_4___default()(this._config.trackingId)) {
|
|
65960
65471
|
this._sessionInfo = this._sessionManager.retrieveSessionInfo(this._config.trackingId);
|
|
65961
65472
|
}
|
|
65962
|
-
|
|
65963
|
-
|
|
65964
|
-
|
|
65473
|
+
this._isBrowser = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["JS"].browserOrNode().isBrowser;
|
|
65474
|
+
// flush event buffer
|
|
65965
65475
|
this._setupTimer();
|
|
65966
65476
|
}
|
|
65967
|
-
|
|
65968
65477
|
AmazonPersonalizeProvider.prototype._setupTimer = function () {
|
|
65969
65478
|
if (this._timer) {
|
|
65970
65479
|
clearInterval(this._timer);
|
|
65971
65480
|
}
|
|
65972
|
-
|
|
65973
65481
|
var flushInterval = this._config.flushInterval;
|
|
65974
65482
|
var that = this;
|
|
65975
65483
|
this._timer = setInterval(function () {
|
|
@@ -65982,95 +65490,57 @@ function () {
|
|
|
65982
65490
|
* @param properties - properties of the event
|
|
65983
65491
|
* @return Promise
|
|
65984
65492
|
*/
|
|
65985
|
-
|
|
65986
|
-
|
|
65987
65493
|
AmazonPersonalizeProvider.prototype.record = function (params) {
|
|
65988
65494
|
return __awaiter(this, void 0, void 0, function () {
|
|
65989
65495
|
var credentials, _a, eventType, properties, requestParams, isLoaded;
|
|
65990
|
-
|
|
65991
65496
|
return __generator(this, function (_b) {
|
|
65992
65497
|
switch (_b.label) {
|
|
65993
65498
|
case 0:
|
|
65994
|
-
return [4
|
|
65995
|
-
/*yield*/
|
|
65996
|
-
, this._getCredentials()];
|
|
65997
|
-
|
|
65499
|
+
return [4 /*yield*/, this._getCredentials()];
|
|
65998
65500
|
case 1:
|
|
65999
65501
|
credentials = _b.sent();
|
|
66000
|
-
if (!credentials) return [2
|
|
66001
|
-
/*return*/
|
|
66002
|
-
, Promise.resolve(false)];
|
|
65502
|
+
if (!credentials) return [2 /*return*/, Promise.resolve(false)];
|
|
66003
65503
|
Object.assign(params, {
|
|
66004
65504
|
config: this._config,
|
|
66005
65505
|
credentials: credentials,
|
|
66006
65506
|
sentAt: new Date()
|
|
66007
65507
|
});
|
|
66008
65508
|
_a = params.event, eventType = _a.eventType, properties = _a.properties;
|
|
66009
|
-
|
|
66010
65509
|
if (eventType === IDENTIFY_EVENT) {
|
|
66011
65510
|
this._sessionManager.updateSessionInfo(properties && properties.userId ? properties.userId : '', this._sessionInfo);
|
|
66012
|
-
|
|
66013
|
-
return [2
|
|
66014
|
-
/*return*/
|
|
66015
|
-
];
|
|
65511
|
+
return [2 /*return*/];
|
|
66016
65512
|
} else if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_4___default()(params.event.userId)) {
|
|
66017
65513
|
this._sessionManager.updateSessionInfo(params.event.userId, this._sessionInfo);
|
|
66018
65514
|
}
|
|
66019
|
-
|
|
66020
65515
|
requestParams = this.generateRequestParams(params, this._sessionInfo);
|
|
66021
|
-
if (!(eventType === 'MediaAutoTrack')) return [3
|
|
66022
|
-
/*break
|
|
66023
|
-
,
|
|
66024
|
-
|
|
66025
|
-
/*break*/
|
|
66026
|
-
, 5];
|
|
66027
|
-
if (!!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_4___default()(lodash_get__WEBPACK_IMPORTED_MODULE_3___default()(requestParams, 'eventData.properties.domElementId', null))) return [3
|
|
66028
|
-
/*break*/
|
|
66029
|
-
, 3];
|
|
66030
|
-
return [4
|
|
66031
|
-
/*yield*/
|
|
66032
|
-
, this.isElementFullyLoaded(this.loadElement, requestParams.eventData.properties['domElementId'], 500, 5)];
|
|
66033
|
-
|
|
65516
|
+
if (!(eventType === 'MediaAutoTrack')) return [3 /*break*/, 7];
|
|
65517
|
+
if (!this._isBrowser) return [3 /*break*/, 5];
|
|
65518
|
+
if (!!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_4___default()(lodash_get__WEBPACK_IMPORTED_MODULE_3___default()(requestParams, 'eventData.properties.domElementId', null))) return [3 /*break*/, 3];
|
|
65519
|
+
return [4 /*yield*/, this.isElementFullyLoaded(this.loadElement, requestParams.eventData.properties['domElementId'], 500, 5)];
|
|
66034
65520
|
case 2:
|
|
66035
65521
|
isLoaded = _b.sent();
|
|
66036
|
-
|
|
66037
65522
|
if (isLoaded) {
|
|
66038
65523
|
new _AmazonPersonalizeHelper__WEBPACK_IMPORTED_MODULE_2__["MediaAutoTrack"](requestParams, this);
|
|
66039
65524
|
} else {
|
|
66040
65525
|
logger.debug('Cannot find the media element.');
|
|
66041
65526
|
}
|
|
66042
|
-
|
|
66043
|
-
return [3
|
|
66044
|
-
/*break*/
|
|
66045
|
-
, 4];
|
|
66046
|
-
|
|
65527
|
+
return [3 /*break*/, 4];
|
|
66047
65528
|
case 3:
|
|
66048
65529
|
logger.debug("Missing domElementId field in 'properties' for MediaAutoTrack event type.");
|
|
66049
65530
|
_b.label = 4;
|
|
66050
|
-
|
|
66051
65531
|
case 4:
|
|
66052
|
-
return [3
|
|
66053
|
-
/*break*/
|
|
66054
|
-
, 6];
|
|
66055
|
-
|
|
65532
|
+
return [3 /*break*/, 6];
|
|
66056
65533
|
case 5:
|
|
66057
65534
|
logger.debug('MediaAutoTrack only for browser');
|
|
66058
65535
|
_b.label = 6;
|
|
66059
|
-
|
|
66060
65536
|
case 6:
|
|
66061
|
-
return [2
|
|
66062
|
-
/*return*/
|
|
66063
|
-
];
|
|
66064
|
-
|
|
65537
|
+
return [2 /*return*/];
|
|
66065
65538
|
case 7:
|
|
66066
|
-
return [2
|
|
66067
|
-
/*return*/
|
|
66068
|
-
, this.putToBuffer(requestParams)];
|
|
65539
|
+
return [2 /*return*/, this.putToBuffer(requestParams)];
|
|
66069
65540
|
}
|
|
66070
65541
|
});
|
|
66071
65542
|
});
|
|
66072
65543
|
};
|
|
66073
|
-
|
|
66074
65544
|
AmazonPersonalizeProvider.prototype.loadElement = function (domId) {
|
|
66075
65545
|
return new Promise(function (resolve, reject) {
|
|
66076
65546
|
if (document.getElementById(domId) && document.getElementById(domId).clientHeight) {
|
|
@@ -66080,22 +65550,18 @@ function () {
|
|
|
66080
65550
|
}
|
|
66081
65551
|
});
|
|
66082
65552
|
};
|
|
66083
|
-
|
|
66084
65553
|
AmazonPersonalizeProvider.prototype.isElementFullyLoaded = function (operation, params, delay, times) {
|
|
66085
65554
|
var _this = this;
|
|
66086
|
-
|
|
66087
65555
|
var wait = function wait(ms) {
|
|
66088
65556
|
return new Promise(function (r) {
|
|
66089
65557
|
return setTimeout(r, ms);
|
|
66090
65558
|
});
|
|
66091
65559
|
};
|
|
66092
|
-
|
|
66093
65560
|
return new Promise(function (resolve, reject) {
|
|
66094
65561
|
return operation(params).then(resolve)["catch"](function (reason) {
|
|
66095
65562
|
if (times - 1 > 0) {
|
|
66096
65563
|
return wait(delay).then(_this.isElementFullyLoaded.bind(null, operation, params, delay, times - 1)).then(resolve)["catch"](reject);
|
|
66097
65564
|
}
|
|
66098
|
-
|
|
66099
65565
|
return reject(reason);
|
|
66100
65566
|
});
|
|
66101
65567
|
});
|
|
@@ -66103,16 +65569,12 @@ function () {
|
|
|
66103
65569
|
/**
|
|
66104
65570
|
* get the category of the plugin
|
|
66105
65571
|
*/
|
|
66106
|
-
|
|
66107
|
-
|
|
66108
65572
|
AmazonPersonalizeProvider.prototype.getCategory = function () {
|
|
66109
65573
|
return 'Analytics';
|
|
66110
65574
|
};
|
|
66111
65575
|
/**
|
|
66112
65576
|
* get provider name of the plugin
|
|
66113
65577
|
*/
|
|
66114
|
-
|
|
66115
|
-
|
|
66116
65578
|
AmazonPersonalizeProvider.prototype.getProviderName = function () {
|
|
66117
65579
|
return 'AmazonPersonalize';
|
|
66118
65580
|
};
|
|
@@ -66120,19 +65582,14 @@ function () {
|
|
|
66120
65582
|
* configure the plugin
|
|
66121
65583
|
* @param {Object} config - configuration
|
|
66122
65584
|
*/
|
|
66123
|
-
|
|
66124
|
-
|
|
66125
65585
|
AmazonPersonalizeProvider.prototype.configure = function (config) {
|
|
66126
65586
|
logger.debug('configure Analytics', config);
|
|
66127
65587
|
var conf = config ? config : {};
|
|
66128
65588
|
this._config = Object.assign({}, this._config, conf);
|
|
66129
|
-
|
|
66130
65589
|
if (!lodash_isEmpty__WEBPACK_IMPORTED_MODULE_4___default()(this._config.trackingId)) {
|
|
66131
65590
|
this._sessionInfo = this._sessionManager.retrieveSessionInfo(this._config.trackingId);
|
|
66132
65591
|
}
|
|
66133
|
-
|
|
66134
65592
|
this._setupTimer();
|
|
66135
|
-
|
|
66136
65593
|
return this._config;
|
|
66137
65594
|
};
|
|
66138
65595
|
/**
|
|
@@ -66142,13 +65599,11 @@ function () {
|
|
|
66142
65599
|
* @param api - api name
|
|
66143
65600
|
* @return RequestParams - wrapper object with all information required for make request
|
|
66144
65601
|
*/
|
|
66145
|
-
|
|
66146
|
-
|
|
66147
65602
|
AmazonPersonalizeProvider.prototype.generateRequestParams = function (params, sessionInfo) {
|
|
66148
65603
|
var requestParams = {};
|
|
66149
65604
|
var _a = params.event,
|
|
66150
|
-
|
|
66151
|
-
|
|
65605
|
+
eventType = _a.eventType,
|
|
65606
|
+
properties = _a.properties;
|
|
66152
65607
|
requestParams.eventData = {
|
|
66153
65608
|
eventType: eventType,
|
|
66154
65609
|
properties: properties
|
|
@@ -66163,36 +65618,25 @@ function () {
|
|
|
66163
65618
|
* record an event
|
|
66164
65619
|
* @param {Object} params - the params of an event
|
|
66165
65620
|
*/
|
|
66166
|
-
|
|
66167
|
-
|
|
66168
65621
|
AmazonPersonalizeProvider.prototype._sendEvents = function (group) {
|
|
66169
65622
|
var groupLen = group.length;
|
|
66170
|
-
|
|
66171
65623
|
if (groupLen === 0) {
|
|
66172
65624
|
logger.debug('events array is empty, directly return');
|
|
66173
65625
|
return;
|
|
66174
65626
|
}
|
|
66175
|
-
|
|
66176
65627
|
var _a = group[0],
|
|
66177
|
-
|
|
66178
|
-
|
|
66179
|
-
|
|
66180
|
-
|
|
65628
|
+
config = _a.config,
|
|
65629
|
+
credentials = _a.credentials,
|
|
65630
|
+
sessionInfo = _a.sessionInfo;
|
|
66181
65631
|
var initClients = this._init(config, credentials);
|
|
66182
|
-
|
|
66183
65632
|
if (!initClients) return false;
|
|
66184
|
-
|
|
66185
65633
|
if (groupLen > 0) {
|
|
66186
65634
|
var events = [];
|
|
66187
|
-
|
|
66188
65635
|
for (var i = 0; i < groupLen; i += 1) {
|
|
66189
65636
|
var params = group.shift();
|
|
66190
|
-
|
|
66191
65637
|
var eventPayload = this._generateSingleRecordPayload(params, sessionInfo);
|
|
66192
|
-
|
|
66193
65638
|
events.push(eventPayload);
|
|
66194
65639
|
}
|
|
66195
|
-
|
|
66196
65640
|
var payload_1 = {};
|
|
66197
65641
|
payload_1.trackingId = sessionInfo.trackingId;
|
|
66198
65642
|
payload_1.sessionId = sessionInfo.sessionId;
|
|
@@ -66203,7 +65647,6 @@ function () {
|
|
|
66203
65647
|
payload_1.eventList.push(event);
|
|
66204
65648
|
});
|
|
66205
65649
|
var command = new _aws_sdk_client_personalize_events__WEBPACK_IMPORTED_MODULE_1__["PutEventsCommand"](payload_1);
|
|
66206
|
-
|
|
66207
65650
|
this._personalize.send(command, function (err) {
|
|
66208
65651
|
if (err) logger.debug('Failed to call putEvents in Personalize', err);else logger.debug('Put events');
|
|
66209
65652
|
});
|
|
@@ -66214,17 +65657,13 @@ function () {
|
|
|
66214
65657
|
* @private
|
|
66215
65658
|
* @param params - params for the event recording
|
|
66216
65659
|
*/
|
|
66217
|
-
|
|
66218
|
-
|
|
66219
65660
|
AmazonPersonalizeProvider.prototype.putToBuffer = function (params) {
|
|
66220
65661
|
if (this._buffer.length < this._config.flushSize) {
|
|
66221
65662
|
this._buffer.push(params);
|
|
66222
65663
|
} else {
|
|
66223
65664
|
this._buffer.push(params);
|
|
66224
|
-
|
|
66225
65665
|
this._sendFromBuffer();
|
|
66226
65666
|
}
|
|
66227
|
-
|
|
66228
65667
|
return Promise.resolve(true);
|
|
66229
65668
|
};
|
|
66230
65669
|
/**
|
|
@@ -66232,23 +65671,17 @@ function () {
|
|
|
66232
65671
|
* @private
|
|
66233
65672
|
* @param eventsParams - the buffer for cache the payload
|
|
66234
65673
|
*/
|
|
66235
|
-
|
|
66236
|
-
|
|
66237
65674
|
AmazonPersonalizeProvider.prototype._sendFromBuffer = function () {
|
|
66238
65675
|
var _this = this;
|
|
66239
|
-
|
|
66240
65676
|
var size = this._buffer.length;
|
|
66241
65677
|
if (size <= 0) return;
|
|
66242
65678
|
var eventsGroups = [];
|
|
66243
65679
|
var preCred = null;
|
|
66244
65680
|
var group = [];
|
|
66245
|
-
|
|
66246
65681
|
for (var i = 0; i < size; i += 1) {
|
|
66247
65682
|
var currRequestParams = this._buffer.shift();
|
|
66248
|
-
|
|
66249
65683
|
var cred = currRequestParams.credentials;
|
|
66250
65684
|
var sessionInfo = currRequestParams.sessionInfo;
|
|
66251
|
-
|
|
66252
65685
|
if (i === 0) {
|
|
66253
65686
|
group.push(currRequestParams);
|
|
66254
65687
|
preCred = cred;
|
|
@@ -66265,7 +65698,6 @@ function () {
|
|
|
66265
65698
|
}
|
|
66266
65699
|
}
|
|
66267
65700
|
}
|
|
66268
|
-
|
|
66269
65701
|
eventsGroups.push(group);
|
|
66270
65702
|
eventsGroups.map(function (group) {
|
|
66271
65703
|
_this._sendEvents(group);
|
|
@@ -66276,11 +65708,9 @@ function () {
|
|
|
66276
65708
|
* @private
|
|
66277
65709
|
* @param params - RequestParams
|
|
66278
65710
|
*/
|
|
66279
|
-
|
|
66280
|
-
|
|
66281
65711
|
AmazonPersonalizeProvider.prototype._generateSingleRecordPayload = function (params, sessionInfo) {
|
|
66282
65712
|
var eventData = params.eventData,
|
|
66283
|
-
|
|
65713
|
+
sentAt = params.sentAt;
|
|
66284
65714
|
var trackPayload = {};
|
|
66285
65715
|
trackPayload.sentAt = sentAt;
|
|
66286
65716
|
trackPayload.properties = eventData.properties && JSON.stringify(eventData.properties);
|
|
@@ -66293,16 +65723,12 @@ function () {
|
|
|
66293
65723
|
* @private
|
|
66294
65724
|
* @param params - RequestParams
|
|
66295
65725
|
*/
|
|
66296
|
-
|
|
66297
|
-
|
|
66298
65726
|
AmazonPersonalizeProvider.prototype._init = function (config, credentials) {
|
|
66299
65727
|
logger.debug('init clients');
|
|
66300
|
-
|
|
66301
65728
|
if (this._personalize && this._config.credentials && this._config.credentials.sessionToken === credentials.sessionToken && this._config.credentials.identityId === credentials.identityId) {
|
|
66302
65729
|
logger.debug('no change for analytics config, directly return from init');
|
|
66303
65730
|
return true;
|
|
66304
65731
|
}
|
|
66305
|
-
|
|
66306
65732
|
this._config.credentials = credentials;
|
|
66307
65733
|
var region = config.region;
|
|
66308
65734
|
logger.debug('initialize personalize with credentials', credentials);
|
|
@@ -66317,8 +65743,6 @@ function () {
|
|
|
66317
65743
|
* check if current credentials exists
|
|
66318
65744
|
* @private
|
|
66319
65745
|
*/
|
|
66320
|
-
|
|
66321
|
-
|
|
66322
65746
|
AmazonPersonalizeProvider.prototype._getCredentials = function () {
|
|
66323
65747
|
var that = this;
|
|
66324
65748
|
return _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Credentials"].get().then(function (credentials) {
|
|
@@ -66330,15 +65754,12 @@ function () {
|
|
|
66330
65754
|
return null;
|
|
66331
65755
|
});
|
|
66332
65756
|
};
|
|
66333
|
-
|
|
66334
65757
|
return AmazonPersonalizeProvider;
|
|
66335
65758
|
}();
|
|
66336
65759
|
|
|
66337
|
-
|
|
66338
65760
|
/**
|
|
66339
65761
|
* @deprecated use named import
|
|
66340
65762
|
*/
|
|
66341
|
-
|
|
66342
65763
|
/* harmony default export */ __webpack_exports__["default"] = (AmazonPersonalizeProvider);
|
|
66343
65764
|
|
|
66344
65765
|
/***/ }),
|
|
@@ -66362,7 +65783,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
66362
65783
|
resolve(value);
|
|
66363
65784
|
});
|
|
66364
65785
|
}
|
|
66365
|
-
|
|
66366
65786
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
66367
65787
|
function fulfilled(value) {
|
|
66368
65788
|
try {
|
|
@@ -66371,7 +65791,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
66371
65791
|
reject(e);
|
|
66372
65792
|
}
|
|
66373
65793
|
}
|
|
66374
|
-
|
|
66375
65794
|
function rejected(value) {
|
|
66376
65795
|
try {
|
|
66377
65796
|
step(generator["throw"](value));
|
|
@@ -66379,29 +65798,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
66379
65798
|
reject(e);
|
|
66380
65799
|
}
|
|
66381
65800
|
}
|
|
66382
|
-
|
|
66383
65801
|
function step(result) {
|
|
66384
65802
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
66385
65803
|
}
|
|
66386
|
-
|
|
66387
65804
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
66388
65805
|
});
|
|
66389
65806
|
};
|
|
66390
|
-
|
|
66391
65807
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
66392
65808
|
var _ = {
|
|
66393
|
-
|
|
66394
|
-
|
|
66395
|
-
|
|
66396
|
-
|
|
65809
|
+
label: 0,
|
|
65810
|
+
sent: function sent() {
|
|
65811
|
+
if (t[0] & 1) throw t[1];
|
|
65812
|
+
return t[1];
|
|
65813
|
+
},
|
|
65814
|
+
trys: [],
|
|
65815
|
+
ops: []
|
|
66397
65816
|
},
|
|
66398
|
-
|
|
66399
|
-
|
|
66400
|
-
|
|
66401
|
-
|
|
66402
|
-
y,
|
|
66403
|
-
t,
|
|
66404
|
-
g;
|
|
65817
|
+
f,
|
|
65818
|
+
y,
|
|
65819
|
+
t,
|
|
65820
|
+
g;
|
|
66405
65821
|
return g = {
|
|
66406
65822
|
next: verb(0),
|
|
66407
65823
|
"throw": verb(1),
|
|
@@ -66409,79 +65825,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
66409
65825
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
66410
65826
|
return this;
|
|
66411
65827
|
}), g;
|
|
66412
|
-
|
|
66413
65828
|
function verb(n) {
|
|
66414
65829
|
return function (v) {
|
|
66415
65830
|
return step([n, v]);
|
|
66416
65831
|
};
|
|
66417
65832
|
}
|
|
66418
|
-
|
|
66419
65833
|
function step(op) {
|
|
66420
65834
|
if (f) throw new TypeError("Generator is already executing.");
|
|
66421
|
-
|
|
66422
65835
|
while (_) {
|
|
66423
65836
|
try {
|
|
66424
65837
|
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;
|
|
66425
65838
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
66426
|
-
|
|
66427
65839
|
switch (op[0]) {
|
|
66428
65840
|
case 0:
|
|
66429
65841
|
case 1:
|
|
66430
65842
|
t = op;
|
|
66431
65843
|
break;
|
|
66432
|
-
|
|
66433
65844
|
case 4:
|
|
66434
65845
|
_.label++;
|
|
66435
65846
|
return {
|
|
66436
65847
|
value: op[1],
|
|
66437
65848
|
done: false
|
|
66438
65849
|
};
|
|
66439
|
-
|
|
66440
65850
|
case 5:
|
|
66441
65851
|
_.label++;
|
|
66442
65852
|
y = op[1];
|
|
66443
65853
|
op = [0];
|
|
66444
65854
|
continue;
|
|
66445
|
-
|
|
66446
65855
|
case 7:
|
|
66447
65856
|
op = _.ops.pop();
|
|
66448
|
-
|
|
66449
65857
|
_.trys.pop();
|
|
66450
|
-
|
|
66451
65858
|
continue;
|
|
66452
|
-
|
|
66453
65859
|
default:
|
|
66454
65860
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
66455
65861
|
_ = 0;
|
|
66456
65862
|
continue;
|
|
66457
65863
|
}
|
|
66458
|
-
|
|
66459
65864
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
66460
65865
|
_.label = op[1];
|
|
66461
65866
|
break;
|
|
66462
65867
|
}
|
|
66463
|
-
|
|
66464
65868
|
if (op[0] === 6 && _.label < t[1]) {
|
|
66465
65869
|
_.label = t[1];
|
|
66466
65870
|
t = op;
|
|
66467
65871
|
break;
|
|
66468
65872
|
}
|
|
66469
|
-
|
|
66470
65873
|
if (t && _.label < t[2]) {
|
|
66471
65874
|
_.label = t[2];
|
|
66472
|
-
|
|
66473
65875
|
_.ops.push(op);
|
|
66474
|
-
|
|
66475
65876
|
break;
|
|
66476
65877
|
}
|
|
66477
|
-
|
|
66478
65878
|
if (t[2]) _.ops.pop();
|
|
66479
|
-
|
|
66480
65879
|
_.trys.pop();
|
|
66481
|
-
|
|
66482
65880
|
continue;
|
|
66483
65881
|
}
|
|
66484
|
-
|
|
66485
65882
|
op = body.call(thisArg, _);
|
|
66486
65883
|
} catch (e) {
|
|
66487
65884
|
op = [6, e];
|
|
@@ -66490,7 +65887,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
66490
65887
|
f = t = 0;
|
|
66491
65888
|
}
|
|
66492
65889
|
}
|
|
66493
|
-
|
|
66494
65890
|
if (op[0] & 5) throw op[1];
|
|
66495
65891
|
return {
|
|
66496
65892
|
value: op[0] ? op[1] : void 0,
|
|
@@ -66498,15 +65894,13 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
66498
65894
|
};
|
|
66499
65895
|
}
|
|
66500
65896
|
};
|
|
66501
|
-
|
|
66502
65897
|
var __read = undefined && undefined.__read || function (o, n) {
|
|
66503
65898
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
66504
65899
|
if (!m) return o;
|
|
66505
65900
|
var i = m.call(o),
|
|
66506
|
-
|
|
66507
|
-
|
|
66508
|
-
|
|
66509
|
-
|
|
65901
|
+
r,
|
|
65902
|
+
ar = [],
|
|
65903
|
+
e;
|
|
66510
65904
|
try {
|
|
66511
65905
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
66512
65906
|
ar.push(r.value);
|
|
@@ -66522,28 +65916,21 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
66522
65916
|
if (e) throw e.error;
|
|
66523
65917
|
}
|
|
66524
65918
|
}
|
|
66525
|
-
|
|
66526
65919
|
return ar;
|
|
66527
65920
|
};
|
|
66528
|
-
|
|
66529
65921
|
var __spread = undefined && undefined.__spread || function () {
|
|
66530
65922
|
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
66531
65923
|
ar = ar.concat(__read(arguments[i]));
|
|
66532
65924
|
}
|
|
66533
|
-
|
|
66534
65925
|
return ar;
|
|
66535
65926
|
};
|
|
66536
65927
|
|
|
66537
65928
|
|
|
66538
65929
|
|
|
66539
|
-
|
|
66540
65930
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('EventsBuffer');
|
|
66541
65931
|
var RETRYABLE_CODES = [429, 500];
|
|
66542
65932
|
var ACCEPTED_CODES = [202];
|
|
66543
|
-
|
|
66544
|
-
var EventsBuffer =
|
|
66545
|
-
/** @class */
|
|
66546
|
-
function () {
|
|
65933
|
+
var EventsBuffer = /** @class */function () {
|
|
66547
65934
|
function EventsBuffer(client, config) {
|
|
66548
65935
|
this._pause = false;
|
|
66549
65936
|
this._flush = false;
|
|
@@ -66552,73 +65939,55 @@ function () {
|
|
|
66552
65939
|
this._client = client;
|
|
66553
65940
|
this._config = config;
|
|
66554
65941
|
this._sendBatch = this._sendBatch.bind(this);
|
|
66555
|
-
|
|
66556
65942
|
this._startLoop();
|
|
66557
65943
|
}
|
|
66558
|
-
|
|
66559
65944
|
EventsBuffer.prototype.push = function (event) {
|
|
66560
|
-
var _a;
|
|
66561
|
-
|
|
66562
|
-
|
|
65945
|
+
var _a;
|
|
65946
|
+
// if the buffer is currently at the configured limit, pushing would exceed it
|
|
66563
65947
|
if (this._buffer.length >= this._config.bufferSize) {
|
|
66564
65948
|
logger.debug('Exceeded analytics events buffer size');
|
|
66565
65949
|
return event.handlers.reject(new Error('Exceeded the size of analytics events buffer'));
|
|
66566
65950
|
}
|
|
66567
|
-
|
|
66568
65951
|
var eventId = event.params.event.eventId;
|
|
66569
65952
|
var bufferElement = (_a = {}, _a[eventId] = event, _a);
|
|
66570
|
-
|
|
66571
65953
|
this._buffer.push(bufferElement);
|
|
66572
65954
|
};
|
|
66573
|
-
|
|
66574
65955
|
EventsBuffer.prototype.pause = function () {
|
|
66575
65956
|
this._pause = true;
|
|
66576
65957
|
};
|
|
66577
|
-
|
|
66578
65958
|
EventsBuffer.prototype.resume = function () {
|
|
66579
65959
|
this._pause = false;
|
|
66580
65960
|
};
|
|
66581
|
-
|
|
66582
65961
|
EventsBuffer.prototype.updateClient = function (client) {
|
|
66583
65962
|
this._client = client;
|
|
66584
65963
|
};
|
|
66585
|
-
|
|
66586
65964
|
EventsBuffer.prototype.flush = function () {
|
|
66587
65965
|
this._flush = true;
|
|
66588
65966
|
};
|
|
66589
|
-
|
|
66590
65967
|
EventsBuffer.prototype._startLoop = function () {
|
|
66591
65968
|
if (this._interval) {
|
|
66592
65969
|
clearInterval(this._interval);
|
|
66593
65970
|
}
|
|
66594
|
-
|
|
66595
65971
|
var flushInterval = this._config.flushInterval;
|
|
66596
65972
|
this._interval = setInterval(this._sendBatch, flushInterval);
|
|
66597
65973
|
};
|
|
66598
|
-
|
|
66599
65974
|
EventsBuffer.prototype._sendBatch = function () {
|
|
66600
65975
|
var bufferLength = this._buffer.length;
|
|
66601
|
-
|
|
66602
65976
|
if (this._flush && !bufferLength) {
|
|
66603
65977
|
clearInterval(this._interval);
|
|
66604
|
-
}
|
|
65978
|
+
}
|
|
65979
|
+
// Do not send the batch of events if
|
|
66605
65980
|
// the Buffer is paused or is empty or the App is not in the foreground
|
|
66606
65981
|
// Apps should be in the foreground since
|
|
66607
65982
|
// the OS may restrict access to the network in the background
|
|
66608
|
-
|
|
66609
|
-
|
|
66610
65983
|
if (this._pause || !bufferLength || !Object(_utils_AppUtils__WEBPACK_IMPORTED_MODULE_2__["isAppInForeground"])()) {
|
|
66611
65984
|
return;
|
|
66612
65985
|
}
|
|
66613
|
-
|
|
66614
65986
|
var flushSize = this._config.flushSize;
|
|
66615
65987
|
var batchSize = Math.min(flushSize, bufferLength);
|
|
66616
|
-
|
|
66617
65988
|
var bufferSubset = this._buffer.splice(0, batchSize);
|
|
66618
|
-
|
|
66619
65989
|
this._putEvents(bufferSubset);
|
|
66620
65990
|
};
|
|
66621
|
-
|
|
66622
65991
|
EventsBuffer.prototype._putEvents = function (buffer) {
|
|
66623
65992
|
return __awaiter(this, void 0, void 0, function () {
|
|
66624
65993
|
var eventMap, batchEventParams, command, data, err_1;
|
|
@@ -66628,34 +65997,19 @@ function () {
|
|
|
66628
65997
|
eventMap = this._bufferToMap(buffer);
|
|
66629
65998
|
batchEventParams = this._generateBatchEventParams(eventMap);
|
|
66630
65999
|
_a.label = 1;
|
|
66631
|
-
|
|
66632
66000
|
case 1:
|
|
66633
66001
|
_a.trys.push([1, 3,, 4]);
|
|
66634
|
-
|
|
66635
66002
|
command = new _aws_sdk_client_pinpoint__WEBPACK_IMPORTED_MODULE_1__["PutEventsCommand"](batchEventParams);
|
|
66636
|
-
return [4
|
|
66637
|
-
/*yield*/
|
|
66638
|
-
, this._client.send(command)];
|
|
66639
|
-
|
|
66003
|
+
return [4 /*yield*/, this._client.send(command)];
|
|
66640
66004
|
case 2:
|
|
66641
66005
|
data = _a.sent();
|
|
66642
|
-
|
|
66643
66006
|
this._processPutEventsSuccessResponse(data, eventMap);
|
|
66644
|
-
|
|
66645
|
-
return [3
|
|
66646
|
-
/*break*/
|
|
66647
|
-
, 4];
|
|
66648
|
-
|
|
66007
|
+
return [3 /*break*/, 4];
|
|
66649
66008
|
case 3:
|
|
66650
66009
|
err_1 = _a.sent();
|
|
66651
|
-
return [2
|
|
66652
|
-
/*return*/
|
|
66653
|
-
, this._handlePutEventsFailure(err_1, eventMap)];
|
|
66654
|
-
|
|
66010
|
+
return [2 /*return*/, this._handlePutEventsFailure(err_1, eventMap)];
|
|
66655
66011
|
case 4:
|
|
66656
|
-
return [2
|
|
66657
|
-
/*return*/
|
|
66658
|
-
];
|
|
66012
|
+
return [2 /*return*/];
|
|
66659
66013
|
}
|
|
66660
66014
|
});
|
|
66661
66015
|
});
|
|
@@ -66671,25 +66025,23 @@ function () {
|
|
|
66671
66025
|
Object.values(eventMap).forEach(function (item) {
|
|
66672
66026
|
var params = item.params;
|
|
66673
66027
|
var event = params.event,
|
|
66674
|
-
|
|
66675
|
-
|
|
66028
|
+
timestamp = params.timestamp,
|
|
66029
|
+
config = params.config;
|
|
66676
66030
|
var name = event.name,
|
|
66677
|
-
|
|
66678
|
-
|
|
66679
|
-
|
|
66680
|
-
|
|
66031
|
+
attributes = event.attributes,
|
|
66032
|
+
metrics = event.metrics,
|
|
66033
|
+
eventId = event.eventId,
|
|
66034
|
+
session = event.session;
|
|
66681
66035
|
var appId = config.appId,
|
|
66682
|
-
|
|
66036
|
+
endpointId = config.endpointId;
|
|
66683
66037
|
var batchItem = batchEventParams.EventsRequest.BatchItem;
|
|
66684
66038
|
batchEventParams.ApplicationId = batchEventParams.ApplicationId || appId;
|
|
66685
|
-
|
|
66686
66039
|
if (!batchItem[endpointId]) {
|
|
66687
66040
|
batchItem[endpointId] = {
|
|
66688
66041
|
Endpoint: {},
|
|
66689
66042
|
Events: {}
|
|
66690
66043
|
};
|
|
66691
66044
|
}
|
|
66692
|
-
|
|
66693
66045
|
batchItem[endpointId].Events[eventId] = {
|
|
66694
66046
|
EventType: name,
|
|
66695
66047
|
Timestamp: new Date(timestamp).toISOString(),
|
|
@@ -66700,40 +66052,32 @@ function () {
|
|
|
66700
66052
|
});
|
|
66701
66053
|
return batchEventParams;
|
|
66702
66054
|
};
|
|
66703
|
-
|
|
66704
66055
|
EventsBuffer.prototype._handlePutEventsFailure = function (err, eventMap) {
|
|
66705
66056
|
logger.debug('_putEvents Failed: ', err);
|
|
66706
66057
|
var statusCode = err.$metadata && err.$metadata.httpStatusCode;
|
|
66707
|
-
|
|
66708
66058
|
if (RETRYABLE_CODES.includes(statusCode)) {
|
|
66709
66059
|
var retryableEvents = Object.values(eventMap);
|
|
66710
|
-
|
|
66711
66060
|
this._retry(retryableEvents);
|
|
66712
|
-
|
|
66713
66061
|
return;
|
|
66714
66062
|
}
|
|
66715
66063
|
};
|
|
66716
|
-
|
|
66717
66064
|
EventsBuffer.prototype._processPutEventsSuccessResponse = function (data, eventMap) {
|
|
66718
66065
|
var Results = data.EventsResponse.Results;
|
|
66719
66066
|
var retryableEvents = [];
|
|
66720
66067
|
Object.entries(Results).forEach(function (_a) {
|
|
66721
66068
|
var _b = __read(_a, 2),
|
|
66722
|
-
|
|
66723
|
-
|
|
66724
|
-
|
|
66069
|
+
endpointId = _b[0],
|
|
66070
|
+
endpointValues = _b[1];
|
|
66725
66071
|
var responses = endpointValues.EventsItemResponse;
|
|
66726
66072
|
Object.entries(responses).forEach(function (_a) {
|
|
66727
66073
|
var _b, _c;
|
|
66728
|
-
|
|
66729
66074
|
var _d = __read(_a, 2),
|
|
66730
|
-
|
|
66731
|
-
|
|
66732
|
-
|
|
66733
|
-
|
|
66734
|
-
|
|
66735
|
-
|
|
66736
|
-
|
|
66075
|
+
eventId = _d[0],
|
|
66076
|
+
_e = _d[1],
|
|
66077
|
+
StatusCode = _e.StatusCode,
|
|
66078
|
+
Message = _e.Message;
|
|
66079
|
+
var eventObject = eventMap[eventId];
|
|
66080
|
+
// manually crafting handlers response to keep API consistant
|
|
66737
66081
|
var response = {
|
|
66738
66082
|
EventsResponse: {
|
|
66739
66083
|
Results: (_b = {}, _b[endpointId] = {
|
|
@@ -66744,70 +66088,57 @@ function () {
|
|
|
66744
66088
|
}, _b)
|
|
66745
66089
|
}
|
|
66746
66090
|
};
|
|
66747
|
-
|
|
66748
66091
|
if (ACCEPTED_CODES.includes(StatusCode)) {
|
|
66749
66092
|
eventObject.handlers.resolve(response);
|
|
66750
66093
|
return;
|
|
66751
66094
|
}
|
|
66752
|
-
|
|
66753
66095
|
if (RETRYABLE_CODES.includes(StatusCode)) {
|
|
66754
66096
|
retryableEvents.push(eventObject);
|
|
66755
66097
|
return;
|
|
66756
66098
|
}
|
|
66757
|
-
|
|
66758
66099
|
var name = eventObject.params.event.name;
|
|
66759
66100
|
logger.error("event " + eventId + " : " + name + " failed with error: " + Message);
|
|
66760
66101
|
return eventObject.handlers.reject(response);
|
|
66761
66102
|
});
|
|
66762
66103
|
});
|
|
66763
|
-
|
|
66764
66104
|
if (retryableEvents.length) {
|
|
66765
66105
|
this._retry(retryableEvents);
|
|
66766
66106
|
}
|
|
66767
66107
|
};
|
|
66768
|
-
|
|
66769
66108
|
EventsBuffer.prototype._retry = function (retryableEvents) {
|
|
66770
|
-
var _a;
|
|
66771
|
-
|
|
66772
|
-
|
|
66109
|
+
var _a;
|
|
66110
|
+
// retryable events that haven't reached the resendLimit
|
|
66773
66111
|
var eligibleEvents = [];
|
|
66774
66112
|
retryableEvents.forEach(function (event) {
|
|
66775
66113
|
var _a;
|
|
66776
|
-
|
|
66777
66114
|
var params = event.params;
|
|
66778
66115
|
var _b = params.event,
|
|
66779
|
-
|
|
66780
|
-
|
|
66781
|
-
|
|
66116
|
+
eventId = _b.eventId,
|
|
66117
|
+
name = _b.name;
|
|
66782
66118
|
if (params.resendLimit-- > 0) {
|
|
66783
66119
|
logger.debug("resending event " + eventId + " : " + name + " with " + params.resendLimit + " retry attempts remaining");
|
|
66784
66120
|
eligibleEvents.push((_a = {}, _a[eventId] = event, _a));
|
|
66785
66121
|
return;
|
|
66786
66122
|
}
|
|
66787
|
-
|
|
66788
66123
|
logger.debug("no retry attempts remaining for event " + eventId + " : " + name);
|
|
66789
|
-
});
|
|
66790
|
-
|
|
66124
|
+
});
|
|
66125
|
+
// add the events to the front of the buffer
|
|
66791
66126
|
(_a = this._buffer).unshift.apply(_a, __spread(eligibleEvents));
|
|
66792
|
-
};
|
|
66127
|
+
};
|
|
66128
|
+
// convert buffer to map, i.e. { eventId1: { params, handler }, eventId2: { params, handlers } }
|
|
66793
66129
|
// this allows us to easily access the handlers after receiving a batch response
|
|
66794
|
-
|
|
66795
|
-
|
|
66796
66130
|
EventsBuffer.prototype._bufferToMap = function (buffer) {
|
|
66797
66131
|
return buffer.reduce(function (acc, curVal) {
|
|
66798
66132
|
var _a = __read(Object.entries(curVal), 1),
|
|
66799
|
-
|
|
66800
|
-
|
|
66801
|
-
|
|
66802
|
-
|
|
66133
|
+
_b = __read(_a[0], 2),
|
|
66134
|
+
key = _b[0],
|
|
66135
|
+
value = _b[1];
|
|
66803
66136
|
acc[key] = value;
|
|
66804
66137
|
return acc;
|
|
66805
66138
|
}, {});
|
|
66806
66139
|
};
|
|
66807
|
-
|
|
66808
66140
|
return EventsBuffer;
|
|
66809
66141
|
}();
|
|
66810
|
-
|
|
66811
66142
|
/* harmony default export */ __webpack_exports__["default"] = (EventsBuffer);
|
|
66812
66143
|
|
|
66813
66144
|
/***/ }),
|
|
@@ -66877,7 +66208,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
66877
66208
|
/**
|
|
66878
66209
|
* @deprecated use named import
|
|
66879
66210
|
*/
|
|
66880
|
-
|
|
66881
66211
|
/* harmony default export */ __webpack_exports__["default"] = (_Analytics__WEBPACK_IMPORTED_MODULE_0__["Analytics"]);
|
|
66882
66212
|
|
|
66883
66213
|
|
|
@@ -66915,7 +66245,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
66915
66245
|
resolve(value);
|
|
66916
66246
|
});
|
|
66917
66247
|
}
|
|
66918
|
-
|
|
66919
66248
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
66920
66249
|
function fulfilled(value) {
|
|
66921
66250
|
try {
|
|
@@ -66924,7 +66253,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
66924
66253
|
reject(e);
|
|
66925
66254
|
}
|
|
66926
66255
|
}
|
|
66927
|
-
|
|
66928
66256
|
function rejected(value) {
|
|
66929
66257
|
try {
|
|
66930
66258
|
step(generator["throw"](value));
|
|
@@ -66932,29 +66260,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
66932
66260
|
reject(e);
|
|
66933
66261
|
}
|
|
66934
66262
|
}
|
|
66935
|
-
|
|
66936
66263
|
function step(result) {
|
|
66937
66264
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
66938
66265
|
}
|
|
66939
|
-
|
|
66940
66266
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
66941
66267
|
});
|
|
66942
66268
|
};
|
|
66943
|
-
|
|
66944
66269
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
66945
66270
|
var _ = {
|
|
66946
|
-
|
|
66947
|
-
|
|
66948
|
-
|
|
66949
|
-
|
|
66271
|
+
label: 0,
|
|
66272
|
+
sent: function sent() {
|
|
66273
|
+
if (t[0] & 1) throw t[1];
|
|
66274
|
+
return t[1];
|
|
66275
|
+
},
|
|
66276
|
+
trys: [],
|
|
66277
|
+
ops: []
|
|
66950
66278
|
},
|
|
66951
|
-
|
|
66952
|
-
|
|
66953
|
-
|
|
66954
|
-
|
|
66955
|
-
y,
|
|
66956
|
-
t,
|
|
66957
|
-
g;
|
|
66279
|
+
f,
|
|
66280
|
+
y,
|
|
66281
|
+
t,
|
|
66282
|
+
g;
|
|
66958
66283
|
return g = {
|
|
66959
66284
|
next: verb(0),
|
|
66960
66285
|
"throw": verb(1),
|
|
@@ -66962,79 +66287,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
66962
66287
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
66963
66288
|
return this;
|
|
66964
66289
|
}), g;
|
|
66965
|
-
|
|
66966
66290
|
function verb(n) {
|
|
66967
66291
|
return function (v) {
|
|
66968
66292
|
return step([n, v]);
|
|
66969
66293
|
};
|
|
66970
66294
|
}
|
|
66971
|
-
|
|
66972
66295
|
function step(op) {
|
|
66973
66296
|
if (f) throw new TypeError("Generator is already executing.");
|
|
66974
|
-
|
|
66975
66297
|
while (_) {
|
|
66976
66298
|
try {
|
|
66977
66299
|
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;
|
|
66978
66300
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
66979
|
-
|
|
66980
66301
|
switch (op[0]) {
|
|
66981
66302
|
case 0:
|
|
66982
66303
|
case 1:
|
|
66983
66304
|
t = op;
|
|
66984
66305
|
break;
|
|
66985
|
-
|
|
66986
66306
|
case 4:
|
|
66987
66307
|
_.label++;
|
|
66988
66308
|
return {
|
|
66989
66309
|
value: op[1],
|
|
66990
66310
|
done: false
|
|
66991
66311
|
};
|
|
66992
|
-
|
|
66993
66312
|
case 5:
|
|
66994
66313
|
_.label++;
|
|
66995
66314
|
y = op[1];
|
|
66996
66315
|
op = [0];
|
|
66997
66316
|
continue;
|
|
66998
|
-
|
|
66999
66317
|
case 7:
|
|
67000
66318
|
op = _.ops.pop();
|
|
67001
|
-
|
|
67002
66319
|
_.trys.pop();
|
|
67003
|
-
|
|
67004
66320
|
continue;
|
|
67005
|
-
|
|
67006
66321
|
default:
|
|
67007
66322
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
67008
66323
|
_ = 0;
|
|
67009
66324
|
continue;
|
|
67010
66325
|
}
|
|
67011
|
-
|
|
67012
66326
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
67013
66327
|
_.label = op[1];
|
|
67014
66328
|
break;
|
|
67015
66329
|
}
|
|
67016
|
-
|
|
67017
66330
|
if (op[0] === 6 && _.label < t[1]) {
|
|
67018
66331
|
_.label = t[1];
|
|
67019
66332
|
t = op;
|
|
67020
66333
|
break;
|
|
67021
66334
|
}
|
|
67022
|
-
|
|
67023
66335
|
if (t && _.label < t[2]) {
|
|
67024
66336
|
_.label = t[2];
|
|
67025
|
-
|
|
67026
66337
|
_.ops.push(op);
|
|
67027
|
-
|
|
67028
66338
|
break;
|
|
67029
66339
|
}
|
|
67030
|
-
|
|
67031
66340
|
if (t[2]) _.ops.pop();
|
|
67032
|
-
|
|
67033
66341
|
_.trys.pop();
|
|
67034
|
-
|
|
67035
66342
|
continue;
|
|
67036
66343
|
}
|
|
67037
|
-
|
|
67038
66344
|
op = body.call(thisArg, _);
|
|
67039
66345
|
} catch (e) {
|
|
67040
66346
|
op = [6, e];
|
|
@@ -67043,7 +66349,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
67043
66349
|
f = t = 0;
|
|
67044
66350
|
}
|
|
67045
66351
|
}
|
|
67046
|
-
|
|
67047
66352
|
if (op[0] & 5) throw op[1];
|
|
67048
66353
|
return {
|
|
67049
66354
|
value: op[0] ? op[1] : void 0,
|
|
@@ -67053,7 +66358,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
67053
66358
|
};
|
|
67054
66359
|
|
|
67055
66360
|
|
|
67056
|
-
|
|
67057
66361
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('EventTracker');
|
|
67058
66362
|
var defaultOpts = {
|
|
67059
66363
|
enable: false,
|
|
@@ -67061,16 +66365,12 @@ var defaultOpts = {
|
|
|
67061
66365
|
selectorPrefix: 'data-amplify-analytics-',
|
|
67062
66366
|
provider: 'AWSPinpoint'
|
|
67063
66367
|
};
|
|
67064
|
-
|
|
67065
|
-
var EventTracker =
|
|
67066
|
-
/** @class */
|
|
67067
|
-
function () {
|
|
66368
|
+
var EventTracker = /** @class */function () {
|
|
67068
66369
|
function EventTracker(tracker, opts) {
|
|
67069
66370
|
if (!_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["JS"].browserOrNode().isBrowser || !window.addEventListener) {
|
|
67070
66371
|
logger.debug('not in the supported web environment');
|
|
67071
66372
|
return;
|
|
67072
66373
|
}
|
|
67073
|
-
|
|
67074
66374
|
this._config = Object.assign({}, defaultOpts, opts);
|
|
67075
66375
|
this._tracker = tracker;
|
|
67076
66376
|
this._delegates = {};
|
|
@@ -67078,12 +66378,9 @@ function () {
|
|
|
67078
66378
|
logger.debug('initialize pageview tracker with opts', this._config);
|
|
67079
66379
|
this.configure(this._config);
|
|
67080
66380
|
}
|
|
67081
|
-
|
|
67082
66381
|
EventTracker.prototype.configure = function (opts) {
|
|
67083
66382
|
var _this = this;
|
|
67084
|
-
|
|
67085
66383
|
Object.assign(this._config, opts);
|
|
67086
|
-
|
|
67087
66384
|
if (!this._config.enable) {
|
|
67088
66385
|
Object.keys(this._delegates).forEach(function (key) {
|
|
67089
66386
|
if (typeof _this._delegates[key].destroy === 'function') _this._delegates[key].destroy();
|
|
@@ -67091,7 +66388,6 @@ function () {
|
|
|
67091
66388
|
this._delegates = {};
|
|
67092
66389
|
} else if (this._config.enable && Object.keys(this._delegates).length === 0) {
|
|
67093
66390
|
var selector_1 = '[' + this._config.selectorPrefix + 'on]';
|
|
67094
|
-
|
|
67095
66391
|
this._config.events.forEach(function (evt) {
|
|
67096
66392
|
_this._delegates[evt] = Object(_vendor_dom_utils__WEBPACK_IMPORTED_MODULE_0__["delegate"])(document, evt, selector_1, _this._trackFunc, {
|
|
67097
66393
|
composed: true,
|
|
@@ -67099,14 +66395,11 @@ function () {
|
|
|
67099
66395
|
});
|
|
67100
66396
|
});
|
|
67101
66397
|
}
|
|
67102
|
-
|
|
67103
66398
|
return this._config;
|
|
67104
66399
|
};
|
|
67105
|
-
|
|
67106
66400
|
EventTracker.prototype._trackFunc = function (event, element) {
|
|
67107
66401
|
return __awaiter(this, void 0, void 0, function () {
|
|
67108
66402
|
var customAttrs, events, eventName, attrs, defaultAttrs, _a, attributes;
|
|
67109
|
-
|
|
67110
66403
|
return __generator(this, function (_b) {
|
|
67111
66404
|
switch (_b.label) {
|
|
67112
66405
|
case 0:
|
|
@@ -67114,31 +66407,20 @@ function () {
|
|
|
67114
66407
|
events = element.getAttribute(this._config.selectorPrefix + 'on').split(/\s*,\s*/);
|
|
67115
66408
|
eventName = element.getAttribute(this._config.selectorPrefix + 'name');
|
|
67116
66409
|
attrs = element.getAttribute(this._config.selectorPrefix + 'attrs');
|
|
67117
|
-
|
|
67118
66410
|
if (attrs) {
|
|
67119
66411
|
attrs.split(/\s*,\s*/).forEach(function (attr) {
|
|
67120
66412
|
var tmp = attr.trim().split(/\s*:\s*/);
|
|
67121
66413
|
customAttrs[tmp[0]] = tmp[1];
|
|
67122
66414
|
});
|
|
67123
66415
|
}
|
|
67124
|
-
|
|
67125
|
-
|
|
67126
|
-
/*break*/
|
|
67127
|
-
, 2];
|
|
67128
|
-
return [4
|
|
67129
|
-
/*yield*/
|
|
67130
|
-
, this._config.attributes()];
|
|
67131
|
-
|
|
66416
|
+
if (!(typeof this._config.attributes === 'function')) return [3 /*break*/, 2];
|
|
66417
|
+
return [4 /*yield*/, this._config.attributes()];
|
|
67132
66418
|
case 1:
|
|
67133
66419
|
_a = _b.sent();
|
|
67134
|
-
return [3
|
|
67135
|
-
/*break*/
|
|
67136
|
-
, 3];
|
|
67137
|
-
|
|
66420
|
+
return [3 /*break*/, 3];
|
|
67138
66421
|
case 2:
|
|
67139
66422
|
_a = this._config.attributes;
|
|
67140
66423
|
_b.label = 3;
|
|
67141
|
-
|
|
67142
66424
|
case 3:
|
|
67143
66425
|
defaultAttrs = _a;
|
|
67144
66426
|
attributes = Object.assign({
|
|
@@ -67147,12 +66429,9 @@ function () {
|
|
|
67147
66429
|
}, defaultAttrs, customAttrs);
|
|
67148
66430
|
logger.debug('events needed to be recorded', events);
|
|
67149
66431
|
logger.debug('attributes needed to be attached', customAttrs);
|
|
67150
|
-
|
|
67151
66432
|
if (events.indexOf(event.type) < 0) {
|
|
67152
66433
|
logger.debug("event " + event.type + " is not selected to be recorded");
|
|
67153
|
-
return [2
|
|
67154
|
-
/*return*/
|
|
67155
|
-
];
|
|
66434
|
+
return [2 /*return*/];
|
|
67156
66435
|
}
|
|
67157
66436
|
|
|
67158
66437
|
this._tracker({
|
|
@@ -67161,10 +66440,7 @@ function () {
|
|
|
67161
66440
|
}, this._config.provider)["catch"](function (e) {
|
|
67162
66441
|
logger.debug("Failed to record the " + event.type + " event', " + e);
|
|
67163
66442
|
});
|
|
67164
|
-
|
|
67165
|
-
return [2
|
|
67166
|
-
/*return*/
|
|
67167
|
-
];
|
|
66443
|
+
return [2 /*return*/];
|
|
67168
66444
|
}
|
|
67169
66445
|
});
|
|
67170
66446
|
});
|
|
@@ -67173,11 +66449,9 @@ function () {
|
|
|
67173
66449
|
return EventTracker;
|
|
67174
66450
|
}();
|
|
67175
66451
|
|
|
67176
|
-
|
|
67177
66452
|
/**
|
|
67178
66453
|
* @deprecated use named import
|
|
67179
66454
|
*/
|
|
67180
|
-
|
|
67181
66455
|
/* harmony default export */ __webpack_exports__["default"] = (EventTracker);
|
|
67182
66456
|
|
|
67183
66457
|
/***/ }),
|
|
@@ -67213,7 +66487,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
67213
66487
|
resolve(value);
|
|
67214
66488
|
});
|
|
67215
66489
|
}
|
|
67216
|
-
|
|
67217
66490
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
67218
66491
|
function fulfilled(value) {
|
|
67219
66492
|
try {
|
|
@@ -67222,7 +66495,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
67222
66495
|
reject(e);
|
|
67223
66496
|
}
|
|
67224
66497
|
}
|
|
67225
|
-
|
|
67226
66498
|
function rejected(value) {
|
|
67227
66499
|
try {
|
|
67228
66500
|
step(generator["throw"](value));
|
|
@@ -67230,29 +66502,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
67230
66502
|
reject(e);
|
|
67231
66503
|
}
|
|
67232
66504
|
}
|
|
67233
|
-
|
|
67234
66505
|
function step(result) {
|
|
67235
66506
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
67236
66507
|
}
|
|
67237
|
-
|
|
67238
66508
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
67239
66509
|
});
|
|
67240
66510
|
};
|
|
67241
|
-
|
|
67242
66511
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
67243
66512
|
var _ = {
|
|
67244
|
-
|
|
67245
|
-
|
|
67246
|
-
|
|
67247
|
-
|
|
66513
|
+
label: 0,
|
|
66514
|
+
sent: function sent() {
|
|
66515
|
+
if (t[0] & 1) throw t[1];
|
|
66516
|
+
return t[1];
|
|
66517
|
+
},
|
|
66518
|
+
trys: [],
|
|
66519
|
+
ops: []
|
|
67248
66520
|
},
|
|
67249
|
-
|
|
67250
|
-
|
|
67251
|
-
|
|
67252
|
-
|
|
67253
|
-
y,
|
|
67254
|
-
t,
|
|
67255
|
-
g;
|
|
66521
|
+
f,
|
|
66522
|
+
y,
|
|
66523
|
+
t,
|
|
66524
|
+
g;
|
|
67256
66525
|
return g = {
|
|
67257
66526
|
next: verb(0),
|
|
67258
66527
|
"throw": verb(1),
|
|
@@ -67260,79 +66529,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
67260
66529
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
67261
66530
|
return this;
|
|
67262
66531
|
}), g;
|
|
67263
|
-
|
|
67264
66532
|
function verb(n) {
|
|
67265
66533
|
return function (v) {
|
|
67266
66534
|
return step([n, v]);
|
|
67267
66535
|
};
|
|
67268
66536
|
}
|
|
67269
|
-
|
|
67270
66537
|
function step(op) {
|
|
67271
66538
|
if (f) throw new TypeError("Generator is already executing.");
|
|
67272
|
-
|
|
67273
66539
|
while (_) {
|
|
67274
66540
|
try {
|
|
67275
66541
|
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;
|
|
67276
66542
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
67277
|
-
|
|
67278
66543
|
switch (op[0]) {
|
|
67279
66544
|
case 0:
|
|
67280
66545
|
case 1:
|
|
67281
66546
|
t = op;
|
|
67282
66547
|
break;
|
|
67283
|
-
|
|
67284
66548
|
case 4:
|
|
67285
66549
|
_.label++;
|
|
67286
66550
|
return {
|
|
67287
66551
|
value: op[1],
|
|
67288
66552
|
done: false
|
|
67289
66553
|
};
|
|
67290
|
-
|
|
67291
66554
|
case 5:
|
|
67292
66555
|
_.label++;
|
|
67293
66556
|
y = op[1];
|
|
67294
66557
|
op = [0];
|
|
67295
66558
|
continue;
|
|
67296
|
-
|
|
67297
66559
|
case 7:
|
|
67298
66560
|
op = _.ops.pop();
|
|
67299
|
-
|
|
67300
66561
|
_.trys.pop();
|
|
67301
|
-
|
|
67302
66562
|
continue;
|
|
67303
|
-
|
|
67304
66563
|
default:
|
|
67305
66564
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
67306
66565
|
_ = 0;
|
|
67307
66566
|
continue;
|
|
67308
66567
|
}
|
|
67309
|
-
|
|
67310
66568
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
67311
66569
|
_.label = op[1];
|
|
67312
66570
|
break;
|
|
67313
66571
|
}
|
|
67314
|
-
|
|
67315
66572
|
if (op[0] === 6 && _.label < t[1]) {
|
|
67316
66573
|
_.label = t[1];
|
|
67317
66574
|
t = op;
|
|
67318
66575
|
break;
|
|
67319
66576
|
}
|
|
67320
|
-
|
|
67321
66577
|
if (t && _.label < t[2]) {
|
|
67322
66578
|
_.label = t[2];
|
|
67323
|
-
|
|
67324
66579
|
_.ops.push(op);
|
|
67325
|
-
|
|
67326
66580
|
break;
|
|
67327
66581
|
}
|
|
67328
|
-
|
|
67329
66582
|
if (t[2]) _.ops.pop();
|
|
67330
|
-
|
|
67331
66583
|
_.trys.pop();
|
|
67332
|
-
|
|
67333
66584
|
continue;
|
|
67334
66585
|
}
|
|
67335
|
-
|
|
67336
66586
|
op = body.call(thisArg, _);
|
|
67337
66587
|
} catch (e) {
|
|
67338
66588
|
op = [6, e];
|
|
@@ -67341,7 +66591,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
67341
66591
|
f = t = 0;
|
|
67342
66592
|
}
|
|
67343
66593
|
}
|
|
67344
|
-
|
|
67345
66594
|
if (op[0] & 5) throw op[1];
|
|
67346
66595
|
return {
|
|
67347
66596
|
value: op[0] ? op[1] : void 0,
|
|
@@ -67351,96 +66600,70 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
67351
66600
|
};
|
|
67352
66601
|
|
|
67353
66602
|
|
|
67354
|
-
|
|
67355
66603
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('PageViewTracker');
|
|
67356
66604
|
var PREV_URL_KEY = 'aws-amplify-analytics-prevUrl';
|
|
67357
|
-
|
|
67358
66605
|
var getUrl = function getUrl() {
|
|
67359
66606
|
if (!_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["JS"].browserOrNode().isBrowser) return '';else return window.location.origin + window.location.pathname;
|
|
67360
66607
|
};
|
|
67361
|
-
|
|
67362
66608
|
var defaultOpts = {
|
|
67363
66609
|
enable: false,
|
|
67364
66610
|
provider: 'AWSPinpoint',
|
|
67365
66611
|
getUrl: getUrl
|
|
67366
66612
|
};
|
|
67367
|
-
|
|
67368
|
-
var PageViewTracker =
|
|
67369
|
-
/** @class */
|
|
67370
|
-
function () {
|
|
66613
|
+
var PageViewTracker = /** @class */function () {
|
|
67371
66614
|
function PageViewTracker(tracker, opts) {
|
|
67372
66615
|
logger.debug('initialize pageview tracker with opts', opts);
|
|
67373
66616
|
this._config = Object.assign({}, defaultOpts, opts);
|
|
67374
66617
|
this._tracker = tracker;
|
|
67375
66618
|
this._hasEnabled = false;
|
|
67376
66619
|
this._trackFunc = this._trackFunc.bind(this);
|
|
67377
|
-
|
|
67378
66620
|
if (this._config.type === 'SPA') {
|
|
67379
66621
|
this._pageViewTrackSPA();
|
|
67380
66622
|
} else {
|
|
67381
66623
|
this._pageViewTrackDefault();
|
|
67382
66624
|
}
|
|
67383
66625
|
}
|
|
67384
|
-
|
|
67385
66626
|
PageViewTracker.prototype.configure = function (opts) {
|
|
67386
|
-
Object.assign(this._config, opts);
|
|
67387
|
-
|
|
66627
|
+
Object.assign(this._config, opts);
|
|
66628
|
+
// if spa, need to remove those listeners if disabled
|
|
67388
66629
|
if (this._config.type === 'SPA') {
|
|
67389
66630
|
this._pageViewTrackSPA();
|
|
67390
66631
|
}
|
|
67391
|
-
|
|
67392
66632
|
return this._config;
|
|
67393
66633
|
};
|
|
67394
|
-
|
|
67395
66634
|
PageViewTracker.prototype._isSameUrl = function () {
|
|
67396
66635
|
var prevUrl = sessionStorage.getItem(PREV_URL_KEY);
|
|
67397
|
-
|
|
67398
66636
|
var curUrl = this._config.getUrl();
|
|
67399
|
-
|
|
67400
66637
|
if (prevUrl === curUrl) {
|
|
67401
66638
|
logger.debug('the url is same');
|
|
67402
66639
|
return true;
|
|
67403
66640
|
} else return false;
|
|
67404
66641
|
};
|
|
67405
|
-
|
|
67406
66642
|
PageViewTracker.prototype._pageViewTrackDefault = function () {
|
|
67407
66643
|
return __awaiter(this, void 0, void 0, function () {
|
|
67408
66644
|
var url, customAttrs, _a, attributes;
|
|
67409
|
-
|
|
67410
66645
|
return __generator(this, function (_b) {
|
|
67411
66646
|
switch (_b.label) {
|
|
67412
66647
|
case 0:
|
|
67413
66648
|
if (!_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["JS"].browserOrNode().isBrowser || !window.addEventListener || !window.sessionStorage) {
|
|
67414
66649
|
logger.debug('not in the supported web enviroment');
|
|
67415
|
-
return [2
|
|
67416
|
-
/*return*/
|
|
67417
|
-
];
|
|
66650
|
+
return [2 /*return*/];
|
|
67418
66651
|
}
|
|
67419
66652
|
|
|
67420
66653
|
url = this._config.getUrl();
|
|
67421
|
-
if (!(typeof this._config.attributes === 'function')) return [3
|
|
67422
|
-
/*
|
|
67423
|
-
, 2];
|
|
67424
|
-
return [4
|
|
67425
|
-
/*yield*/
|
|
67426
|
-
, this._config.attributes()];
|
|
67427
|
-
|
|
66654
|
+
if (!(typeof this._config.attributes === 'function')) return [3 /*break*/, 2];
|
|
66655
|
+
return [4 /*yield*/, this._config.attributes()];
|
|
67428
66656
|
case 1:
|
|
67429
66657
|
_a = _b.sent();
|
|
67430
|
-
return [3
|
|
67431
|
-
/*break*/
|
|
67432
|
-
, 3];
|
|
67433
|
-
|
|
66658
|
+
return [3 /*break*/, 3];
|
|
67434
66659
|
case 2:
|
|
67435
66660
|
_a = this._config.attributes;
|
|
67436
66661
|
_b.label = 3;
|
|
67437
|
-
|
|
67438
66662
|
case 3:
|
|
67439
66663
|
customAttrs = _a;
|
|
67440
66664
|
attributes = Object.assign({
|
|
67441
66665
|
url: url
|
|
67442
66666
|
}, customAttrs);
|
|
67443
|
-
|
|
67444
66667
|
if (this._config.enable && !this._isSameUrl()) {
|
|
67445
66668
|
this._tracker({
|
|
67446
66669
|
name: this._config.eventName || 'pageView',
|
|
@@ -67448,13 +66671,9 @@ function () {
|
|
|
67448
66671
|
}, this._config.provider)["catch"](function (e) {
|
|
67449
66672
|
logger.debug('Failed to record the page view event', e);
|
|
67450
66673
|
});
|
|
67451
|
-
|
|
67452
66674
|
sessionStorage.setItem(PREV_URL_KEY, url);
|
|
67453
66675
|
}
|
|
67454
|
-
|
|
67455
|
-
return [2
|
|
67456
|
-
/*return*/
|
|
67457
|
-
];
|
|
66676
|
+
return [2 /*return*/];
|
|
67458
66677
|
}
|
|
67459
66678
|
});
|
|
67460
66679
|
});
|
|
@@ -67463,41 +66682,28 @@ function () {
|
|
|
67463
66682
|
PageViewTracker.prototype._trackFunc = function () {
|
|
67464
66683
|
return __awaiter(this, void 0, void 0, function () {
|
|
67465
66684
|
var url, customAttrs, _a, attributes;
|
|
67466
|
-
|
|
67467
66685
|
return __generator(this, function (_b) {
|
|
67468
66686
|
switch (_b.label) {
|
|
67469
66687
|
case 0:
|
|
67470
66688
|
if (!_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["JS"].browserOrNode().isBrowser || !window.addEventListener || !history.pushState || !window.sessionStorage) {
|
|
67471
66689
|
logger.debug('not in the supported web enviroment');
|
|
67472
|
-
return [2
|
|
67473
|
-
/*return*/
|
|
67474
|
-
];
|
|
66690
|
+
return [2 /*return*/];
|
|
67475
66691
|
}
|
|
67476
66692
|
|
|
67477
66693
|
url = this._config.getUrl();
|
|
67478
|
-
if (!(typeof this._config.attributes === 'function')) return [3
|
|
67479
|
-
/*
|
|
67480
|
-
, 2];
|
|
67481
|
-
return [4
|
|
67482
|
-
/*yield*/
|
|
67483
|
-
, this._config.attributes()];
|
|
67484
|
-
|
|
66694
|
+
if (!(typeof this._config.attributes === 'function')) return [3 /*break*/, 2];
|
|
66695
|
+
return [4 /*yield*/, this._config.attributes()];
|
|
67485
66696
|
case 1:
|
|
67486
66697
|
_a = _b.sent();
|
|
67487
|
-
return [3
|
|
67488
|
-
/*break*/
|
|
67489
|
-
, 3];
|
|
67490
|
-
|
|
66698
|
+
return [3 /*break*/, 3];
|
|
67491
66699
|
case 2:
|
|
67492
66700
|
_a = this._config.attributes;
|
|
67493
66701
|
_b.label = 3;
|
|
67494
|
-
|
|
67495
66702
|
case 3:
|
|
67496
66703
|
customAttrs = _a;
|
|
67497
66704
|
attributes = Object.assign({
|
|
67498
66705
|
url: url
|
|
67499
66706
|
}, customAttrs);
|
|
67500
|
-
|
|
67501
66707
|
if (!this._isSameUrl()) {
|
|
67502
66708
|
this._tracker({
|
|
67503
66709
|
name: this._config.eventName || 'pageView',
|
|
@@ -67505,13 +66711,9 @@ function () {
|
|
|
67505
66711
|
}, this._config.provider)["catch"](function (e) {
|
|
67506
66712
|
logger.debug('Failed to record the page view event', e);
|
|
67507
66713
|
});
|
|
67508
|
-
|
|
67509
66714
|
sessionStorage.setItem(PREV_URL_KEY, url);
|
|
67510
66715
|
}
|
|
67511
|
-
|
|
67512
|
-
return [2
|
|
67513
|
-
/*return*/
|
|
67514
|
-
];
|
|
66716
|
+
return [2 /*return*/];
|
|
67515
66717
|
}
|
|
67516
66718
|
});
|
|
67517
66719
|
});
|
|
@@ -67522,14 +66724,11 @@ function () {
|
|
|
67522
66724
|
logger.debug('not in the supported web enviroment');
|
|
67523
66725
|
return;
|
|
67524
66726
|
}
|
|
67525
|
-
|
|
67526
66727
|
if (this._config.enable && !this._hasEnabled) {
|
|
67527
66728
|
_utils_MethodEmbed__WEBPACK_IMPORTED_MODULE_0__["MethodEmbed"].add(history, 'pushState', this._trackFunc);
|
|
67528
66729
|
_utils_MethodEmbed__WEBPACK_IMPORTED_MODULE_0__["MethodEmbed"].add(history, 'replaceState', this._trackFunc);
|
|
67529
66730
|
window.addEventListener('popstate', this._trackFunc);
|
|
67530
|
-
|
|
67531
66731
|
this._trackFunc();
|
|
67532
|
-
|
|
67533
66732
|
this._hasEnabled = true;
|
|
67534
66733
|
} else {
|
|
67535
66734
|
_utils_MethodEmbed__WEBPACK_IMPORTED_MODULE_0__["MethodEmbed"].remove(history, 'pushState');
|
|
@@ -67538,15 +66737,12 @@ function () {
|
|
|
67538
66737
|
this._hasEnabled = false;
|
|
67539
66738
|
}
|
|
67540
66739
|
};
|
|
67541
|
-
|
|
67542
66740
|
return PageViewTracker;
|
|
67543
66741
|
}();
|
|
67544
66742
|
|
|
67545
|
-
|
|
67546
66743
|
/**
|
|
67547
66744
|
* @deprecated use named import
|
|
67548
66745
|
*/
|
|
67549
|
-
|
|
67550
66746
|
/* harmony default export */ __webpack_exports__["default"] = (PageViewTracker);
|
|
67551
66747
|
|
|
67552
66748
|
/***/ }),
|
|
@@ -67581,7 +66777,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
67581
66777
|
resolve(value);
|
|
67582
66778
|
});
|
|
67583
66779
|
}
|
|
67584
|
-
|
|
67585
66780
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
67586
66781
|
function fulfilled(value) {
|
|
67587
66782
|
try {
|
|
@@ -67590,7 +66785,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
67590
66785
|
reject(e);
|
|
67591
66786
|
}
|
|
67592
66787
|
}
|
|
67593
|
-
|
|
67594
66788
|
function rejected(value) {
|
|
67595
66789
|
try {
|
|
67596
66790
|
step(generator["throw"](value));
|
|
@@ -67598,29 +66792,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
67598
66792
|
reject(e);
|
|
67599
66793
|
}
|
|
67600
66794
|
}
|
|
67601
|
-
|
|
67602
66795
|
function step(result) {
|
|
67603
66796
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
67604
66797
|
}
|
|
67605
|
-
|
|
67606
66798
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
67607
66799
|
});
|
|
67608
66800
|
};
|
|
67609
|
-
|
|
67610
66801
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
67611
66802
|
var _ = {
|
|
67612
|
-
|
|
67613
|
-
|
|
67614
|
-
|
|
67615
|
-
|
|
66803
|
+
label: 0,
|
|
66804
|
+
sent: function sent() {
|
|
66805
|
+
if (t[0] & 1) throw t[1];
|
|
66806
|
+
return t[1];
|
|
66807
|
+
},
|
|
66808
|
+
trys: [],
|
|
66809
|
+
ops: []
|
|
67616
66810
|
},
|
|
67617
|
-
|
|
67618
|
-
|
|
67619
|
-
|
|
67620
|
-
|
|
67621
|
-
y,
|
|
67622
|
-
t,
|
|
67623
|
-
g;
|
|
66811
|
+
f,
|
|
66812
|
+
y,
|
|
66813
|
+
t,
|
|
66814
|
+
g;
|
|
67624
66815
|
return g = {
|
|
67625
66816
|
next: verb(0),
|
|
67626
66817
|
"throw": verb(1),
|
|
@@ -67628,79 +66819,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
67628
66819
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
67629
66820
|
return this;
|
|
67630
66821
|
}), g;
|
|
67631
|
-
|
|
67632
66822
|
function verb(n) {
|
|
67633
66823
|
return function (v) {
|
|
67634
66824
|
return step([n, v]);
|
|
67635
66825
|
};
|
|
67636
66826
|
}
|
|
67637
|
-
|
|
67638
66827
|
function step(op) {
|
|
67639
66828
|
if (f) throw new TypeError("Generator is already executing.");
|
|
67640
|
-
|
|
67641
66829
|
while (_) {
|
|
67642
66830
|
try {
|
|
67643
66831
|
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;
|
|
67644
66832
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
67645
|
-
|
|
67646
66833
|
switch (op[0]) {
|
|
67647
66834
|
case 0:
|
|
67648
66835
|
case 1:
|
|
67649
66836
|
t = op;
|
|
67650
66837
|
break;
|
|
67651
|
-
|
|
67652
66838
|
case 4:
|
|
67653
66839
|
_.label++;
|
|
67654
66840
|
return {
|
|
67655
66841
|
value: op[1],
|
|
67656
66842
|
done: false
|
|
67657
66843
|
};
|
|
67658
|
-
|
|
67659
66844
|
case 5:
|
|
67660
66845
|
_.label++;
|
|
67661
66846
|
y = op[1];
|
|
67662
66847
|
op = [0];
|
|
67663
66848
|
continue;
|
|
67664
|
-
|
|
67665
66849
|
case 7:
|
|
67666
66850
|
op = _.ops.pop();
|
|
67667
|
-
|
|
67668
66851
|
_.trys.pop();
|
|
67669
|
-
|
|
67670
66852
|
continue;
|
|
67671
|
-
|
|
67672
66853
|
default:
|
|
67673
66854
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
67674
66855
|
_ = 0;
|
|
67675
66856
|
continue;
|
|
67676
66857
|
}
|
|
67677
|
-
|
|
67678
66858
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
67679
66859
|
_.label = op[1];
|
|
67680
66860
|
break;
|
|
67681
66861
|
}
|
|
67682
|
-
|
|
67683
66862
|
if (op[0] === 6 && _.label < t[1]) {
|
|
67684
66863
|
_.label = t[1];
|
|
67685
66864
|
t = op;
|
|
67686
66865
|
break;
|
|
67687
66866
|
}
|
|
67688
|
-
|
|
67689
66867
|
if (t && _.label < t[2]) {
|
|
67690
66868
|
_.label = t[2];
|
|
67691
|
-
|
|
67692
66869
|
_.ops.push(op);
|
|
67693
|
-
|
|
67694
66870
|
break;
|
|
67695
66871
|
}
|
|
67696
|
-
|
|
67697
66872
|
if (t[2]) _.ops.pop();
|
|
67698
|
-
|
|
67699
66873
|
_.trys.pop();
|
|
67700
|
-
|
|
67701
66874
|
continue;
|
|
67702
66875
|
}
|
|
67703
|
-
|
|
67704
66876
|
op = body.call(thisArg, _);
|
|
67705
66877
|
} catch (e) {
|
|
67706
66878
|
op = [6, e];
|
|
@@ -67709,16 +66881,14 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
67709
66881
|
f = t = 0;
|
|
67710
66882
|
}
|
|
67711
66883
|
}
|
|
67712
|
-
|
|
67713
66884
|
if (op[0] & 5) throw op[1];
|
|
67714
66885
|
return {
|
|
67715
66886
|
value: op[0] ? op[1] : void 0,
|
|
67716
66887
|
done: true
|
|
67717
66888
|
};
|
|
67718
66889
|
}
|
|
67719
|
-
};
|
|
67720
|
-
|
|
67721
|
-
|
|
66890
|
+
};
|
|
66891
|
+
// the session tracker for web
|
|
67722
66892
|
|
|
67723
66893
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('SessionTracker');
|
|
67724
66894
|
var defaultOpts = {
|
|
@@ -67726,10 +66896,7 @@ var defaultOpts = {
|
|
|
67726
66896
|
provider: 'AWSPinpoint'
|
|
67727
66897
|
};
|
|
67728
66898
|
var initialEventSent = false;
|
|
67729
|
-
|
|
67730
|
-
var SessionTracker =
|
|
67731
|
-
/** @class */
|
|
67732
|
-
function () {
|
|
66899
|
+
var SessionTracker = /** @class */function () {
|
|
67733
66900
|
function SessionTracker(tracker, opts) {
|
|
67734
66901
|
this._config = Object.assign({}, defaultOpts, opts);
|
|
67735
66902
|
this._tracker = tracker;
|
|
@@ -67738,17 +66905,14 @@ function () {
|
|
|
67738
66905
|
this._trackBeforeUnload = this._trackBeforeUnload.bind(this);
|
|
67739
66906
|
this.configure(this._config);
|
|
67740
66907
|
}
|
|
67741
|
-
|
|
67742
66908
|
SessionTracker.prototype._envCheck = function () {
|
|
67743
66909
|
if (!_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["JS"].browserOrNode().isBrowser) {
|
|
67744
66910
|
return false;
|
|
67745
66911
|
}
|
|
67746
|
-
|
|
67747
66912
|
if (!document || !document.addEventListener) {
|
|
67748
66913
|
logger.debug('not in the supported web environment');
|
|
67749
66914
|
return false;
|
|
67750
66915
|
}
|
|
67751
|
-
|
|
67752
66916
|
if (typeof document.hidden !== 'undefined') {
|
|
67753
66917
|
this._hidden = 'hidden';
|
|
67754
66918
|
this._visibilityChange = 'visibilitychange';
|
|
@@ -67762,38 +66926,25 @@ function () {
|
|
|
67762
66926
|
logger.debug('not in the supported web environment');
|
|
67763
66927
|
return false;
|
|
67764
66928
|
}
|
|
67765
|
-
|
|
67766
66929
|
return true;
|
|
67767
66930
|
};
|
|
67768
|
-
|
|
67769
66931
|
SessionTracker.prototype._trackFunc = function () {
|
|
67770
66932
|
return __awaiter(this, void 0, void 0, function () {
|
|
67771
66933
|
var customAttrs, _a, attributes;
|
|
67772
|
-
|
|
67773
66934
|
return __generator(this, function (_b) {
|
|
67774
66935
|
switch (_b.label) {
|
|
67775
66936
|
case 0:
|
|
67776
|
-
if (!(typeof this._config.attributes === 'function')) return [3
|
|
67777
|
-
/*
|
|
67778
|
-
, 2];
|
|
67779
|
-
return [4
|
|
67780
|
-
/*yield*/
|
|
67781
|
-
, this._config.attributes()];
|
|
67782
|
-
|
|
66937
|
+
if (!(typeof this._config.attributes === 'function')) return [3 /*break*/, 2];
|
|
66938
|
+
return [4 /*yield*/, this._config.attributes()];
|
|
67783
66939
|
case 1:
|
|
67784
66940
|
_a = _b.sent();
|
|
67785
|
-
return [3
|
|
67786
|
-
/*break*/
|
|
67787
|
-
, 3];
|
|
67788
|
-
|
|
66941
|
+
return [3 /*break*/, 3];
|
|
67789
66942
|
case 2:
|
|
67790
66943
|
_a = this._config.attributes;
|
|
67791
66944
|
_b.label = 3;
|
|
67792
|
-
|
|
67793
66945
|
case 3:
|
|
67794
66946
|
customAttrs = _a;
|
|
67795
66947
|
attributes = Object.assign({}, customAttrs);
|
|
67796
|
-
|
|
67797
66948
|
if (document.visibilityState === this._hidden) {
|
|
67798
66949
|
this._tracker({
|
|
67799
66950
|
name: '_session.stop',
|
|
@@ -67809,10 +66960,7 @@ function () {
|
|
|
67809
66960
|
logger.debug('record session start event failed.', e);
|
|
67810
66961
|
});
|
|
67811
66962
|
}
|
|
67812
|
-
|
|
67813
|
-
return [2
|
|
67814
|
-
/*return*/
|
|
67815
|
-
];
|
|
66963
|
+
return [2 /*return*/];
|
|
67816
66964
|
}
|
|
67817
66965
|
});
|
|
67818
66966
|
});
|
|
@@ -67821,11 +66969,9 @@ function () {
|
|
|
67821
66969
|
SessionTracker.prototype._trackBeforeUnload = function (event) {
|
|
67822
66970
|
// before unload callback cannot be async => https://github.com/aws-amplify/amplify-js/issues/2088
|
|
67823
66971
|
var _this = this;
|
|
67824
|
-
|
|
67825
66972
|
var customAttrs = typeof this._config.attributes === 'function' ? Promise.resolve(this._config.attributes()) : Promise.resolve(this._config.attributes);
|
|
67826
66973
|
customAttrs.then(function (custom) {
|
|
67827
66974
|
var attributes = Object.assign({}, custom);
|
|
67828
|
-
|
|
67829
66975
|
_this._tracker({
|
|
67830
66976
|
name: '_session.stop',
|
|
67831
66977
|
attributes: attributes,
|
|
@@ -67834,56 +66980,38 @@ function () {
|
|
|
67834
66980
|
logger.debug('record session stop event failed.', e);
|
|
67835
66981
|
});
|
|
67836
66982
|
});
|
|
67837
|
-
};
|
|
67838
|
-
|
|
67839
|
-
|
|
66983
|
+
};
|
|
66984
|
+
// to keep configure a synchronized function
|
|
67840
66985
|
SessionTracker.prototype._sendInitialEvent = function () {
|
|
67841
66986
|
return __awaiter(this, void 0, void 0, function () {
|
|
67842
66987
|
var customAttrs, _a, attributes;
|
|
67843
|
-
|
|
67844
66988
|
return __generator(this, function (_b) {
|
|
67845
66989
|
switch (_b.label) {
|
|
67846
66990
|
case 0:
|
|
67847
66991
|
if (initialEventSent) {
|
|
67848
66992
|
logger.debug('the start session has been sent when the page is loaded');
|
|
67849
|
-
return [2
|
|
67850
|
-
/*return*/
|
|
67851
|
-
];
|
|
66993
|
+
return [2 /*return*/];
|
|
67852
66994
|
} else {
|
|
67853
66995
|
initialEventSent = true;
|
|
67854
66996
|
}
|
|
67855
|
-
|
|
67856
|
-
|
|
67857
|
-
/*break*/
|
|
67858
|
-
, 2];
|
|
67859
|
-
return [4
|
|
67860
|
-
/*yield*/
|
|
67861
|
-
, this._config.attributes()];
|
|
67862
|
-
|
|
66997
|
+
if (!(typeof this._config.attributes === 'function')) return [3 /*break*/, 2];
|
|
66998
|
+
return [4 /*yield*/, this._config.attributes()];
|
|
67863
66999
|
case 1:
|
|
67864
67000
|
_a = _b.sent();
|
|
67865
|
-
return [3
|
|
67866
|
-
/*break*/
|
|
67867
|
-
, 3];
|
|
67868
|
-
|
|
67001
|
+
return [3 /*break*/, 3];
|
|
67869
67002
|
case 2:
|
|
67870
67003
|
_a = this._config.attributes;
|
|
67871
67004
|
_b.label = 3;
|
|
67872
|
-
|
|
67873
67005
|
case 3:
|
|
67874
67006
|
customAttrs = _a;
|
|
67875
67007
|
attributes = Object.assign({}, customAttrs);
|
|
67876
|
-
|
|
67877
67008
|
this._tracker({
|
|
67878
67009
|
name: '_session.start',
|
|
67879
67010
|
attributes: attributes
|
|
67880
67011
|
}, this._config.provider)["catch"](function (e) {
|
|
67881
67012
|
logger.debug('record session start event failed.', e);
|
|
67882
67013
|
});
|
|
67883
|
-
|
|
67884
|
-
return [2
|
|
67885
|
-
/*return*/
|
|
67886
|
-
];
|
|
67014
|
+
return [2 /*return*/];
|
|
67887
67015
|
}
|
|
67888
67016
|
});
|
|
67889
67017
|
});
|
|
@@ -67893,14 +67021,11 @@ function () {
|
|
|
67893
67021
|
if (!this._envCheck()) {
|
|
67894
67022
|
return this._config;
|
|
67895
67023
|
}
|
|
67896
|
-
|
|
67897
67024
|
Object.assign(this._config, opts);
|
|
67898
|
-
|
|
67899
67025
|
if (this._config.enable && !this._hasEnabled) {
|
|
67900
67026
|
// send a start session as soon as it's enabled
|
|
67901
|
-
this._sendInitialEvent();
|
|
67902
|
-
|
|
67903
|
-
|
|
67027
|
+
this._sendInitialEvent();
|
|
67028
|
+
// listen on events
|
|
67904
67029
|
document.addEventListener(this._visibilityChange, this._trackFunc, false);
|
|
67905
67030
|
window.addEventListener('beforeunload', this._trackBeforeUnload, false);
|
|
67906
67031
|
this._hasEnabled = true;
|
|
@@ -67909,18 +67034,14 @@ function () {
|
|
|
67909
67034
|
window.removeEventListener('beforeunload', this._trackBeforeUnload, false);
|
|
67910
67035
|
this._hasEnabled = false;
|
|
67911
67036
|
}
|
|
67912
|
-
|
|
67913
67037
|
return this._config;
|
|
67914
67038
|
};
|
|
67915
|
-
|
|
67916
67039
|
return SessionTracker;
|
|
67917
67040
|
}();
|
|
67918
67041
|
|
|
67919
|
-
|
|
67920
67042
|
/**
|
|
67921
67043
|
* @deprecated use named import
|
|
67922
67044
|
*/
|
|
67923
|
-
|
|
67924
67045
|
/* harmony default export */ __webpack_exports__["default"] = (SessionTracker);
|
|
67925
67046
|
|
|
67926
67047
|
/***/ }),
|
|
@@ -67964,7 +67085,6 @@ var isAppInForeground = function isAppInForeground() {
|
|
|
67964
67085
|
};
|
|
67965
67086
|
|
|
67966
67087
|
|
|
67967
|
-
|
|
67968
67088
|
/***/ }),
|
|
67969
67089
|
|
|
67970
67090
|
/***/ "./lib-esm/utils/MethodEmbed.js":
|
|
@@ -67993,10 +67113,9 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
67993
67113
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
67994
67114
|
if (!m) return o;
|
|
67995
67115
|
var i = m.call(o),
|
|
67996
|
-
|
|
67997
|
-
|
|
67998
|
-
|
|
67999
|
-
|
|
67116
|
+
r,
|
|
67117
|
+
ar = [],
|
|
67118
|
+
e;
|
|
68000
67119
|
try {
|
|
68001
67120
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
68002
67121
|
ar.push(r.value);
|
|
@@ -68012,77 +67131,56 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
68012
67131
|
if (e) throw e.error;
|
|
68013
67132
|
}
|
|
68014
67133
|
}
|
|
68015
|
-
|
|
68016
67134
|
return ar;
|
|
68017
67135
|
};
|
|
68018
|
-
|
|
68019
67136
|
var __spread = undefined && undefined.__spread || function () {
|
|
68020
67137
|
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
68021
67138
|
ar = ar.concat(__read(arguments[i]));
|
|
68022
67139
|
}
|
|
68023
|
-
|
|
68024
67140
|
return ar;
|
|
68025
67141
|
};
|
|
68026
|
-
|
|
68027
67142
|
var lists = [];
|
|
68028
|
-
|
|
68029
|
-
var MethodEmbed =
|
|
68030
|
-
/** @class */
|
|
68031
|
-
function () {
|
|
67143
|
+
var MethodEmbed = /** @class */function () {
|
|
68032
67144
|
function MethodEmbed(context, methodName) {
|
|
68033
67145
|
this.context = context;
|
|
68034
67146
|
this.methodName = methodName;
|
|
68035
67147
|
this._originalMethod = context[methodName].bind(context);
|
|
68036
67148
|
}
|
|
68037
|
-
|
|
68038
67149
|
MethodEmbed.add = function (context, methodName, methodOverride) {
|
|
68039
67150
|
getInstance(context, methodName).set(methodOverride);
|
|
68040
67151
|
};
|
|
68041
|
-
|
|
68042
67152
|
MethodEmbed.remove = function (context, methodName) {
|
|
68043
67153
|
getInstance(context, methodName).remove();
|
|
68044
67154
|
};
|
|
68045
|
-
|
|
68046
67155
|
MethodEmbed.prototype.set = function (methodOverride) {
|
|
68047
67156
|
var _this = this;
|
|
68048
|
-
|
|
68049
67157
|
this.context[this.methodName] = function () {
|
|
68050
67158
|
var args = [];
|
|
68051
|
-
|
|
68052
67159
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
68053
67160
|
args[_i] = arguments[_i];
|
|
68054
67161
|
}
|
|
68055
|
-
|
|
68056
67162
|
return methodOverride(_this._originalMethod.apply(_this, __spread(args)));
|
|
68057
67163
|
};
|
|
68058
67164
|
};
|
|
68059
|
-
|
|
68060
67165
|
MethodEmbed.prototype.remove = function () {
|
|
68061
67166
|
this.context[this.methodName] = this._originalMethod;
|
|
68062
67167
|
};
|
|
68063
|
-
|
|
68064
67168
|
return MethodEmbed;
|
|
68065
67169
|
}();
|
|
68066
67170
|
|
|
68067
|
-
|
|
68068
|
-
|
|
68069
67171
|
function getInstance(context, methodName) {
|
|
68070
67172
|
var instance = lists.filter(function (h) {
|
|
68071
67173
|
return h.context === context && h.methodName === methodName;
|
|
68072
67174
|
})[0];
|
|
68073
|
-
|
|
68074
67175
|
if (!instance) {
|
|
68075
67176
|
instance = new MethodEmbed(context, methodName);
|
|
68076
67177
|
lists.push(instance);
|
|
68077
67178
|
}
|
|
68078
|
-
|
|
68079
67179
|
return instance;
|
|
68080
67180
|
}
|
|
68081
67181
|
/**
|
|
68082
67182
|
* @deprecated use named import
|
|
68083
67183
|
*/
|
|
68084
|
-
|
|
68085
|
-
|
|
68086
67184
|
/* harmony default export */ __webpack_exports__["default"] = (MethodEmbed);
|
|
68087
67185
|
|
|
68088
67186
|
/***/ }),
|
|
@@ -68112,15 +67210,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
68112
67210
|
* the passed element itself.
|
|
68113
67211
|
* @return {Element|undefined} The matching element or undefined.
|
|
68114
67212
|
*/
|
|
68115
|
-
|
|
68116
67213
|
function closest(element, selector, shouldCheckSelf) {
|
|
68117
67214
|
if (shouldCheckSelf === void 0) {
|
|
68118
67215
|
shouldCheckSelf = false;
|
|
68119
67216
|
}
|
|
68120
|
-
|
|
68121
67217
|
if (!(element && element.nodeType === 1 && selector)) return;
|
|
68122
67218
|
var parentElements = (shouldCheckSelf ? [element] : []).concat(Object(_parents__WEBPACK_IMPORTED_MODULE_1__["parents"])(element));
|
|
68123
|
-
|
|
68124
67219
|
for (var i = 0, parent_1; parent_1 = parentElements[i]; i++) {
|
|
68125
67220
|
if (Object(_matches__WEBPACK_IMPORTED_MODULE_0__["matches"])(parent_1, selector)) return parent_1;
|
|
68126
67221
|
}
|
|
@@ -68157,20 +67252,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
68157
67252
|
* - deep<boolean>: If true, delegate into shadow trees.
|
|
68158
67253
|
* @return {Object} The delegate object. It contains a destroy method.
|
|
68159
67254
|
*/
|
|
68160
|
-
|
|
68161
67255
|
function delegate(ancestor, eventType, selector, callback, opts) {
|
|
68162
67256
|
if (opts === void 0) {
|
|
68163
67257
|
opts = {};
|
|
68164
|
-
}
|
|
68165
|
-
|
|
68166
|
-
|
|
67258
|
+
}
|
|
67259
|
+
// Defines the event listener.
|
|
68167
67260
|
var listener = function listener(event) {
|
|
68168
|
-
var delegateTarget;
|
|
67261
|
+
var delegateTarget;
|
|
67262
|
+
// If opts.composed is true and the event originated from inside a Shadow
|
|
68169
67263
|
// tree, check the composed path nodes.
|
|
68170
|
-
|
|
68171
67264
|
if (opts['composed'] && typeof event['composedPath'] === 'function') {
|
|
68172
67265
|
var composedPath = event.composedPath();
|
|
68173
|
-
|
|
68174
67266
|
for (var i = 0, node = void 0; node = composedPath[i]; i++) {
|
|
68175
67267
|
if (node.nodeType === 1 && Object(_matches__WEBPACK_IMPORTED_MODULE_1__["matches"])(node, selector)) {
|
|
68176
67268
|
delegateTarget = node;
|
|
@@ -68180,12 +67272,10 @@ function delegate(ancestor, eventType, selector, callback, opts) {
|
|
|
68180
67272
|
// Otherwise check the parents.
|
|
68181
67273
|
delegateTarget = Object(_closest__WEBPACK_IMPORTED_MODULE_0__["closest"])(event.target, selector, true);
|
|
68182
67274
|
}
|
|
68183
|
-
|
|
68184
67275
|
if (delegateTarget) {
|
|
68185
67276
|
callback.call(delegateTarget, event, delegateTarget);
|
|
68186
67277
|
}
|
|
68187
67278
|
};
|
|
68188
|
-
|
|
68189
67279
|
ancestor.addEventListener(eventType, listener, opts['useCapture']);
|
|
68190
67280
|
return {
|
|
68191
67281
|
destroy: function destroy() {
|
|
@@ -68218,7 +67308,6 @@ function _typeof(obj) {
|
|
|
68218
67308
|
/**
|
|
68219
67309
|
* Copyright (c) 2017, Philip Walton <philip@philipwalton.com>
|
|
68220
67310
|
*/
|
|
68221
|
-
|
|
68222
67311
|
/**
|
|
68223
67312
|
* Dispatches an event on the passed element.
|
|
68224
67313
|
* @param {!Element} element The DOM element to dispatch the event on.
|
|
@@ -68232,35 +67321,30 @@ function _typeof(obj) {
|
|
|
68232
67321
|
* @return {boolean} The return value of `element.dispatchEvent`, which will
|
|
68233
67322
|
* be false if any of the event listeners called `preventDefault`.
|
|
68234
67323
|
*/
|
|
68235
|
-
|
|
68236
|
-
|
|
68237
67324
|
function dispatch(element, eventType, evtName, init_dict) {
|
|
68238
67325
|
if (evtName === void 0) {
|
|
68239
67326
|
evtName = 'Event';
|
|
68240
67327
|
}
|
|
68241
|
-
|
|
68242
67328
|
if (init_dict === void 0) {
|
|
68243
67329
|
init_dict = {};
|
|
68244
67330
|
}
|
|
68245
|
-
|
|
68246
67331
|
var event;
|
|
68247
67332
|
var isCustom;
|
|
68248
67333
|
var initDict = init_dict;
|
|
68249
|
-
var eventName = evtName;
|
|
68250
|
-
|
|
67334
|
+
var eventName = evtName;
|
|
67335
|
+
// eventName is optional
|
|
68251
67336
|
if (_typeof(eventName) === 'object') {
|
|
68252
67337
|
initDict = eventName;
|
|
68253
67338
|
eventName = 'Event';
|
|
68254
67339
|
}
|
|
68255
|
-
|
|
68256
67340
|
initDict['bubbles'] = initDict['bubbles'] || false;
|
|
68257
67341
|
initDict['cancelable'] = initDict['cancelable'] || false;
|
|
68258
|
-
initDict['composed'] = initDict['composed'] || false;
|
|
68259
|
-
|
|
67342
|
+
initDict['composed'] = initDict['composed'] || false;
|
|
67343
|
+
// If a detail property is passed, this is a custom event.
|
|
68260
67344
|
if ('detail' in initDict) isCustom = true;
|
|
68261
|
-
eventName = isCustom ? 'CustomEvent' : eventName;
|
|
67345
|
+
eventName = isCustom ? 'CustomEvent' : eventName;
|
|
67346
|
+
// Tries to create the event using constructors, if that doesn't work,
|
|
68262
67347
|
// fallback to `document.createEvent()`.
|
|
68263
|
-
|
|
68264
67348
|
try {
|
|
68265
67349
|
event = new window[eventName](eventType, initDict);
|
|
68266
67350
|
} catch (err) {
|
|
@@ -68268,7 +67352,6 @@ function dispatch(element, eventType, evtName, init_dict) {
|
|
|
68268
67352
|
var initMethod = 'init' + (isCustom ? 'Custom' : '') + 'Event';
|
|
68269
67353
|
event[initMethod](eventType, initDict['bubbles'], initDict['cancelable'], initDict['detail']);
|
|
68270
67354
|
}
|
|
68271
|
-
|
|
68272
67355
|
return element.dispatchEvent(event);
|
|
68273
67356
|
}
|
|
68274
67357
|
|
|
@@ -68287,7 +67370,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
68287
67370
|
/**
|
|
68288
67371
|
* Copyright (c) 2017, Philip Walton <philip@philipwalton.com>
|
|
68289
67372
|
*/
|
|
68290
|
-
|
|
68291
67373
|
/**
|
|
68292
67374
|
* Gets all attributes of an element as a plain JavaScriot object.
|
|
68293
67375
|
* @param {Element} element The element whose attributes to get.
|
|
@@ -68296,17 +67378,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
68296
67378
|
* object is returned.
|
|
68297
67379
|
*/
|
|
68298
67380
|
function getAttributes(element) {
|
|
68299
|
-
var attrs = {};
|
|
68300
|
-
|
|
68301
|
-
if (!(element && element.nodeType === 1)) return attrs;
|
|
68302
|
-
|
|
67381
|
+
var attrs = {};
|
|
67382
|
+
// Validate input.
|
|
67383
|
+
if (!(element && element.nodeType === 1)) return attrs;
|
|
67384
|
+
// Return an empty object if there are no attributes.
|
|
68303
67385
|
var map = element.attributes;
|
|
68304
67386
|
if (map.length === 0) return {};
|
|
68305
|
-
|
|
68306
67387
|
for (var i = 0, attr = void 0; attr = map[i]; i++) {
|
|
68307
67388
|
attrs[attr.name] = attr.value;
|
|
68308
67389
|
}
|
|
68309
|
-
|
|
68310
67390
|
return attrs;
|
|
68311
67391
|
}
|
|
68312
67392
|
|
|
@@ -68369,11 +67449,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
68369
67449
|
*/
|
|
68370
67450
|
|
|
68371
67451
|
var proto = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["JS"].browserOrNode().isBrowser && window['Element'] ? window['Element'].prototype : null;
|
|
68372
|
-
var nativeMatches = proto ? proto.matches ||
|
|
68373
|
-
|
|
68374
|
-
proto.
|
|
68375
|
-
|
|
68376
|
-
proto.
|
|
67452
|
+
var nativeMatches = proto ? proto.matches ||
|
|
67453
|
+
// @ts-ignore
|
|
67454
|
+
proto.matchesSelector ||
|
|
67455
|
+
// @ts-ignore
|
|
67456
|
+
proto.webkitMatchesSelector ||
|
|
67457
|
+
// @ts-ignore
|
|
67458
|
+
proto.mozMatchesSelector ||
|
|
67459
|
+
// @ts-ignore
|
|
67460
|
+
proto.msMatchesSelector ||
|
|
67461
|
+
// @ts-ignore
|
|
68377
67462
|
proto.oMatchesSelector : null;
|
|
68378
67463
|
/**
|
|
68379
67464
|
* Tests if a DOM elements matches any of the test DOM elements or selectors.
|
|
@@ -68382,15 +67467,12 @@ proto.oMatchesSelector : null;
|
|
|
68382
67467
|
* selector, or an array of DOM elements or CSS selectors to match against.
|
|
68383
67468
|
* @return {boolean} True of any part of the test matches.
|
|
68384
67469
|
*/
|
|
68385
|
-
|
|
68386
67470
|
function matches(element, test) {
|
|
68387
67471
|
// Validate input.
|
|
68388
67472
|
if (element && element.nodeType === 1 && test) {
|
|
68389
67473
|
// if test is a string or DOM element test it.
|
|
68390
67474
|
if (typeof test === 'string' || test.nodeType === 1) {
|
|
68391
|
-
return element === test || matchesSelector(element,
|
|
68392
|
-
/** @type {string} */
|
|
68393
|
-
test);
|
|
67475
|
+
return element === test || matchesSelector(element, /** @type {string} */test);
|
|
68394
67476
|
} else if ('length' in test) {
|
|
68395
67477
|
// if it has a length property iterate over the items
|
|
68396
67478
|
// and return true if any match.
|
|
@@ -68398,9 +67480,8 @@ function matches(element, test) {
|
|
|
68398
67480
|
if (element === item || matchesSelector(element, item)) return true;
|
|
68399
67481
|
}
|
|
68400
67482
|
}
|
|
68401
|
-
}
|
|
68402
|
-
|
|
68403
|
-
|
|
67483
|
+
}
|
|
67484
|
+
// Still here? Return false
|
|
68404
67485
|
return false;
|
|
68405
67486
|
}
|
|
68406
67487
|
/**
|
|
@@ -68410,16 +67491,13 @@ function matches(element, test) {
|
|
|
68410
67491
|
* @param {string} selector The CSS selector to test element against.
|
|
68411
67492
|
* @return {boolean} True if the selector matches.
|
|
68412
67493
|
*/
|
|
68413
|
-
|
|
68414
67494
|
function matchesSelector(element, selector) {
|
|
68415
67495
|
if (typeof selector !== 'string') return false;
|
|
68416
67496
|
if (nativeMatches) return nativeMatches.call(element, selector);
|
|
68417
67497
|
var nodes = element.parentNode.querySelectorAll(selector);
|
|
68418
|
-
|
|
68419
67498
|
for (var i = 0, node = void 0; node = nodes[i]; i++) {
|
|
68420
67499
|
if (node === element) return true;
|
|
68421
67500
|
}
|
|
68422
|
-
|
|
68423
67501
|
return false;
|
|
68424
67502
|
}
|
|
68425
67503
|
|
|
@@ -68438,7 +67516,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
68438
67516
|
/**
|
|
68439
67517
|
* Copyright (c) 2017, Philip Walton <philip@philipwalton.com>
|
|
68440
67518
|
*/
|
|
68441
|
-
|
|
68442
67519
|
/**
|
|
68443
67520
|
* Returns an array of a DOM element's parent elements.
|
|
68444
67521
|
* @param {!Element} element The DOM element whose parents to get.
|
|
@@ -68448,14 +67525,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
68448
67525
|
function parents(ele) {
|
|
68449
67526
|
var list = [];
|
|
68450
67527
|
var element = ele;
|
|
68451
|
-
|
|
68452
67528
|
while (element && element.parentNode && element.parentNode.nodeType === 1) {
|
|
68453
|
-
element =
|
|
68454
|
-
/** @type {!Element} */
|
|
68455
|
-
element.parentNode;
|
|
67529
|
+
element = /** @type {!Element} */element.parentNode;
|
|
68456
67530
|
list.push(element);
|
|
68457
67531
|
}
|
|
68458
|
-
|
|
68459
67532
|
return list;
|
|
68460
67533
|
}
|
|
68461
67534
|
|
|
@@ -68487,33 +67560,32 @@ var cache = {};
|
|
|
68487
67560
|
* @param {string} url The url to parse.
|
|
68488
67561
|
* @return {!Object} An object with the same properties as a `Location`.
|
|
68489
67562
|
*/
|
|
68490
|
-
|
|
68491
67563
|
function parseUrl(u) {
|
|
68492
|
-
var url = u;
|
|
68493
|
-
|
|
67564
|
+
var url = u;
|
|
67565
|
+
// All falsy values (as well as ".") should map to the current URL.
|
|
68494
67566
|
url = !url || url === '.' ? location.href : url;
|
|
68495
67567
|
if (cache[url]) return cache[url];
|
|
68496
|
-
a.href = url;
|
|
67568
|
+
a.href = url;
|
|
67569
|
+
// When parsing file relative paths (e.g. `../index.html`), IE will correctly
|
|
68497
67570
|
// resolve the `href` property but will keep the `..` in the `path` property.
|
|
68498
67571
|
// It will also not include the `host` or `hostname` properties. Furthermore,
|
|
68499
67572
|
// IE will sometimes return no protocol or just a colon, especially for things
|
|
68500
67573
|
// like relative protocol URLs (e.g. "//google.com").
|
|
68501
67574
|
// To workaround all of these issues, we reparse with the full URL from the
|
|
68502
67575
|
// `href` property.
|
|
68503
|
-
|
|
68504
|
-
|
|
68505
|
-
|
|
68506
|
-
|
|
68507
|
-
|
|
68508
|
-
|
|
67576
|
+
if (url.charAt(0) === '.' || url.charAt(0) === '/') return parseUrl(a.href);
|
|
67577
|
+
// Don't include default ports.
|
|
67578
|
+
var port = a.port === HTTP_PORT || a.port === HTTPS_PORT ? '' : a.port;
|
|
67579
|
+
// PhantomJS sets the port to "0" when using the file: protocol.
|
|
67580
|
+
port = port === '0' ? '' : port;
|
|
67581
|
+
// Sometimes IE incorrectly includes a port for default ports
|
|
68509
67582
|
// (e.g. `:80` or `:443`) even when no port is specified in the URL.
|
|
68510
67583
|
// http://bit.ly/1rQNoMg
|
|
68511
|
-
|
|
68512
|
-
|
|
68513
|
-
|
|
68514
|
-
|
|
67584
|
+
var host = a.host.replace(DEFAULT_PORT, '');
|
|
67585
|
+
// Not all browser support `origin` so we have to build it.
|
|
67586
|
+
var origin = a['origin'] ? a['origin'] : a.protocol + '//' + host;
|
|
67587
|
+
// Sometimes IE doesn't include the leading slash for pathname.
|
|
68515
67588
|
// http://bit.ly/1rQNoMg
|
|
68516
|
-
|
|
68517
67589
|
var pathname = a.pathname.charAt(0) === '/' ? a.pathname : '/' + a.pathname;
|
|
68518
67590
|
return cache[url] = {
|
|
68519
67591
|
hash: a.hash,
|