coveo.analytics 2.23.10 → 2.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +330 -56
- package/dist/coveoua.debug.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/client/analytics.d.ts +3 -0
- package/dist/definitions/client/noopAnalytics.d.ts +1 -0
- package/dist/definitions/cookieutils.d.ts +1 -1
- package/dist/definitions/coveoua/simpleanalytics.d.ts +1 -0
- package/dist/definitions/plugins/BasePlugin.d.ts +1 -1
- package/dist/definitions/src/coveoua/simpleanalytics.d.ts +1 -0
- package/dist/definitions/storage.d.ts +1 -1
- package/dist/definitions/version.d.ts +1 -0
- package/dist/library.es.js +309 -53
- package/dist/library.js +324 -53
- package/dist/react-native.es.js +81819 -59
- package/package.json +5 -2
- package/src/client/analytics.spec.ts +42 -12
- package/src/client/analytics.ts +22 -1
- package/src/client/analyticsBeaconClient.spec.ts +1 -1
- package/src/client/noopAnalytics.ts +4 -0
- package/src/cookieutils.ts +21 -42
- package/src/coveoua/browser.ts +2 -2
- package/src/coveoua/plugins.ts +1 -1
- package/src/coveoua/simpleanalytics.spec.ts +11 -5
- package/src/coveoua/simpleanalytics.ts +6 -0
- package/src/plugins/BasePlugin.ts +3 -4
- package/src/plugins/ec.spec.ts +1 -1
- package/src/plugins/ec.ts +1 -1
- package/src/plugins/svc.spec.ts +1 -1
- package/src/plugins/svc.ts +1 -1
- package/src/react-native/react-native-runtime.ts +1 -1
- package/src/storage.spec.ts +8 -0
- package/src/storage.ts +3 -3
- package/src/version.ts +1 -0
- package/dist/definitions/client/crypto.d.ts +0 -1
- package/src/client/crypto.ts +0 -21
package/dist/coveoua.debug.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.coveoua = factory());
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/******************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
9
9
|
|
|
10
10
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
function __extends(d, b) {
|
|
31
|
+
if (typeof b !== "function" && b !== null)
|
|
32
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
31
33
|
extendStatics(d, b);
|
|
32
34
|
function __() { this.constructor = d; }
|
|
33
35
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -94,6 +96,7 @@
|
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
|
|
99
|
+
/** @deprecated */
|
|
97
100
|
function __spreadArrays() {
|
|
98
101
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
99
102
|
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
@@ -138,12 +141,6 @@
|
|
|
138
141
|
}
|
|
139
142
|
function hasCookieStorage() {
|
|
140
143
|
return hasNavigator() && navigator.cookieEnabled;
|
|
141
|
-
}
|
|
142
|
-
function hasCrypto() {
|
|
143
|
-
return typeof crypto !== 'undefined';
|
|
144
|
-
}
|
|
145
|
-
function hasCryptoRandomValues() {
|
|
146
|
-
return hasCrypto() && typeof crypto.getRandomValues !== 'undefined';
|
|
147
144
|
}
|
|
148
145
|
|
|
149
146
|
var eventTypesForDefaultValues = [EventType.click, EventType.custom, EventType.search, EventType.view];
|
|
@@ -155,29 +152,20 @@
|
|
|
155
152
|
var Cookie = (function () {
|
|
156
153
|
function Cookie() {
|
|
157
154
|
}
|
|
158
|
-
Cookie.set = function (name, value,
|
|
159
|
-
var domain,
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
expires = '; expires=' + date.toGMTString();
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
expires = '';
|
|
155
|
+
Cookie.set = function (name, value, expire) {
|
|
156
|
+
var domain, expirationDate, domainParts, host;
|
|
157
|
+
if (expire) {
|
|
158
|
+
expirationDate = new Date();
|
|
159
|
+
expirationDate.setTime(expirationDate.getTime() + expire);
|
|
167
160
|
}
|
|
168
161
|
host = window.location.hostname;
|
|
169
162
|
if (host.indexOf('.') === -1) {
|
|
170
|
-
|
|
163
|
+
writeCookie(name, value, expirationDate);
|
|
171
164
|
}
|
|
172
165
|
else {
|
|
173
166
|
domainParts = host.split('.');
|
|
174
|
-
domainParts.
|
|
175
|
-
|
|
176
|
-
writeCookie({ name: name, value: value, expires: expires, domain: domain });
|
|
177
|
-
if (Cookie.get(name) == null || Cookie.get(name) != value) {
|
|
178
|
-
domain = '.' + host;
|
|
179
|
-
writeCookie({ name: name, value: value, expires: expires, domain: domain });
|
|
180
|
-
}
|
|
167
|
+
domain = domainParts[domainParts.length - 2] + '.' + domainParts[domainParts.length - 1];
|
|
168
|
+
writeCookie(name, value, expirationDate, domain);
|
|
181
169
|
}
|
|
182
170
|
};
|
|
183
171
|
Cookie.get = function (name) {
|
|
@@ -186,7 +174,7 @@
|
|
|
186
174
|
for (var i = 0; i < cookieArray.length; i++) {
|
|
187
175
|
var cookie = cookieArray[i];
|
|
188
176
|
cookie = cookie.replace(/^\s+/, '');
|
|
189
|
-
if (cookie.
|
|
177
|
+
if (cookie.lastIndexOf(cookiePrefix, 0) === 0) {
|
|
190
178
|
return cookie.substring(cookiePrefix.length, cookie.length);
|
|
191
179
|
}
|
|
192
180
|
}
|
|
@@ -197,9 +185,12 @@
|
|
|
197
185
|
};
|
|
198
186
|
return Cookie;
|
|
199
187
|
}());
|
|
200
|
-
function writeCookie(
|
|
201
|
-
|
|
202
|
-
|
|
188
|
+
function writeCookie(name, value, expirationDate, domain) {
|
|
189
|
+
document.cookie =
|
|
190
|
+
name + "=" + value +
|
|
191
|
+
(expirationDate ? ";expires=" + expirationDate.toUTCString() : '') +
|
|
192
|
+
(domain ? ";domain=" + domain : '') +
|
|
193
|
+
';SameSite=Lax';
|
|
203
194
|
}
|
|
204
195
|
|
|
205
196
|
var preferredStorage = null;
|
|
@@ -224,8 +215,8 @@
|
|
|
224
215
|
CookieStorage.prototype.removeItem = function (key) {
|
|
225
216
|
Cookie.erase("" + CookieStorage.prefix + key);
|
|
226
217
|
};
|
|
227
|
-
CookieStorage.prototype.setItem = function (key, data) {
|
|
228
|
-
Cookie.set("" + CookieStorage.prefix + key, data);
|
|
218
|
+
CookieStorage.prototype.setItem = function (key, data, expire) {
|
|
219
|
+
Cookie.set("" + CookieStorage.prefix + key, data, expire);
|
|
229
220
|
};
|
|
230
221
|
CookieStorage.prefix = 'coveo_';
|
|
231
222
|
return CookieStorage;
|
|
@@ -243,7 +234,7 @@
|
|
|
243
234
|
};
|
|
244
235
|
CookieAndLocalStorage.prototype.setItem = function (key, data) {
|
|
245
236
|
localStorage.setItem(key, data);
|
|
246
|
-
this.cookieStorage.setItem(key, data);
|
|
237
|
+
this.cookieStorage.setItem(key, data, 31556926000);
|
|
247
238
|
};
|
|
248
239
|
return CookieAndLocalStorage;
|
|
249
240
|
}());
|
|
@@ -468,25 +459,273 @@
|
|
|
468
459
|
});
|
|
469
460
|
}); };
|
|
470
461
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
462
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
463
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
464
|
+
// generators (like Math.random()).
|
|
465
|
+
let getRandomValues;
|
|
466
|
+
const rnds8 = new Uint8Array(16);
|
|
467
|
+
function rng() {
|
|
468
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
469
|
+
if (!getRandomValues) {
|
|
470
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
471
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
472
|
+
|
|
473
|
+
if (!getRandomValues) {
|
|
474
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return getRandomValues(rnds8);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
482
|
+
|
|
483
|
+
function validate(uuid) {
|
|
484
|
+
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
489
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
490
|
+
*/
|
|
491
|
+
|
|
492
|
+
const byteToHex = [];
|
|
493
|
+
|
|
494
|
+
for (let i = 0; i < 256; ++i) {
|
|
495
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function unsafeStringify(arr, offset = 0) {
|
|
499
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
500
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
501
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function parse(uuid) {
|
|
505
|
+
if (!validate(uuid)) {
|
|
506
|
+
throw TypeError('Invalid UUID');
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
let v;
|
|
510
|
+
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
|
511
|
+
|
|
512
|
+
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
513
|
+
arr[1] = v >>> 16 & 0xff;
|
|
514
|
+
arr[2] = v >>> 8 & 0xff;
|
|
515
|
+
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
|
516
|
+
|
|
517
|
+
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
518
|
+
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
|
519
|
+
|
|
520
|
+
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
521
|
+
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
|
522
|
+
|
|
523
|
+
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
524
|
+
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
|
525
|
+
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
|
526
|
+
|
|
527
|
+
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
|
528
|
+
arr[11] = v / 0x100000000 & 0xff;
|
|
529
|
+
arr[12] = v >>> 24 & 0xff;
|
|
530
|
+
arr[13] = v >>> 16 & 0xff;
|
|
531
|
+
arr[14] = v >>> 8 & 0xff;
|
|
532
|
+
arr[15] = v & 0xff;
|
|
533
|
+
return arr;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function stringToBytes(str) {
|
|
537
|
+
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
538
|
+
|
|
539
|
+
const bytes = [];
|
|
540
|
+
|
|
541
|
+
for (let i = 0; i < str.length; ++i) {
|
|
542
|
+
bytes.push(str.charCodeAt(i));
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
return bytes;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
549
|
+
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
550
|
+
function v35(name, version, hashfunc) {
|
|
551
|
+
function generateUUID(value, namespace, buf, offset) {
|
|
552
|
+
var _namespace;
|
|
553
|
+
|
|
554
|
+
if (typeof value === 'string') {
|
|
555
|
+
value = stringToBytes(value);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (typeof namespace === 'string') {
|
|
559
|
+
namespace = parse(namespace);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
|
563
|
+
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
564
|
+
} // Compute hash of namespace and value, Per 4.3
|
|
565
|
+
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
566
|
+
// hashfunc([...namespace, ... value])`
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
let bytes = new Uint8Array(16 + value.length);
|
|
570
|
+
bytes.set(namespace);
|
|
571
|
+
bytes.set(value, namespace.length);
|
|
572
|
+
bytes = hashfunc(bytes);
|
|
573
|
+
bytes[6] = bytes[6] & 0x0f | version;
|
|
574
|
+
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
575
|
+
|
|
576
|
+
if (buf) {
|
|
577
|
+
offset = offset || 0;
|
|
578
|
+
|
|
579
|
+
for (let i = 0; i < 16; ++i) {
|
|
580
|
+
buf[offset + i] = bytes[i];
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
return buf;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
return unsafeStringify(bytes);
|
|
587
|
+
} // Function#name is not settable on some platforms (#270)
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
try {
|
|
591
|
+
generateUUID.name = name; // eslint-disable-next-line no-empty
|
|
592
|
+
} catch (err) {} // For CommonJS default export support
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
generateUUID.DNS = DNS;
|
|
596
|
+
generateUUID.URL = URL;
|
|
597
|
+
return generateUUID;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
601
|
+
var native = {
|
|
602
|
+
randomUUID
|
|
488
603
|
};
|
|
489
604
|
|
|
605
|
+
function v4(options, buf, offset) {
|
|
606
|
+
if (native.randomUUID && !buf && !options) {
|
|
607
|
+
return native.randomUUID();
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
options = options || {};
|
|
611
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
612
|
+
|
|
613
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
614
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
615
|
+
|
|
616
|
+
if (buf) {
|
|
617
|
+
offset = offset || 0;
|
|
618
|
+
|
|
619
|
+
for (let i = 0; i < 16; ++i) {
|
|
620
|
+
buf[offset + i] = rnds[i];
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
return buf;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
return unsafeStringify(rnds);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// Adapted from Chris Veness' SHA1 code at
|
|
630
|
+
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
631
|
+
function f(s, x, y, z) {
|
|
632
|
+
switch (s) {
|
|
633
|
+
case 0:
|
|
634
|
+
return x & y ^ ~x & z;
|
|
635
|
+
|
|
636
|
+
case 1:
|
|
637
|
+
return x ^ y ^ z;
|
|
638
|
+
|
|
639
|
+
case 2:
|
|
640
|
+
return x & y ^ x & z ^ y & z;
|
|
641
|
+
|
|
642
|
+
case 3:
|
|
643
|
+
return x ^ y ^ z;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
function ROTL(x, n) {
|
|
648
|
+
return x << n | x >>> 32 - n;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function sha1(bytes) {
|
|
652
|
+
const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
653
|
+
const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
|
654
|
+
|
|
655
|
+
if (typeof bytes === 'string') {
|
|
656
|
+
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
657
|
+
|
|
658
|
+
bytes = [];
|
|
659
|
+
|
|
660
|
+
for (let i = 0; i < msg.length; ++i) {
|
|
661
|
+
bytes.push(msg.charCodeAt(i));
|
|
662
|
+
}
|
|
663
|
+
} else if (!Array.isArray(bytes)) {
|
|
664
|
+
// Convert Array-like to Array
|
|
665
|
+
bytes = Array.prototype.slice.call(bytes);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
bytes.push(0x80);
|
|
669
|
+
const l = bytes.length / 4 + 2;
|
|
670
|
+
const N = Math.ceil(l / 16);
|
|
671
|
+
const M = new Array(N);
|
|
672
|
+
|
|
673
|
+
for (let i = 0; i < N; ++i) {
|
|
674
|
+
const arr = new Uint32Array(16);
|
|
675
|
+
|
|
676
|
+
for (let j = 0; j < 16; ++j) {
|
|
677
|
+
arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
M[i] = arr;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
|
684
|
+
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
|
685
|
+
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
|
686
|
+
|
|
687
|
+
for (let i = 0; i < N; ++i) {
|
|
688
|
+
const W = new Uint32Array(80);
|
|
689
|
+
|
|
690
|
+
for (let t = 0; t < 16; ++t) {
|
|
691
|
+
W[t] = M[i][t];
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
for (let t = 16; t < 80; ++t) {
|
|
695
|
+
W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
let a = H[0];
|
|
699
|
+
let b = H[1];
|
|
700
|
+
let c = H[2];
|
|
701
|
+
let d = H[3];
|
|
702
|
+
let e = H[4];
|
|
703
|
+
|
|
704
|
+
for (let t = 0; t < 80; ++t) {
|
|
705
|
+
const s = Math.floor(t / 20);
|
|
706
|
+
const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
|
|
707
|
+
e = d;
|
|
708
|
+
d = c;
|
|
709
|
+
c = ROTL(b, 30) >>> 0;
|
|
710
|
+
b = a;
|
|
711
|
+
a = T;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
H[0] = H[0] + a >>> 0;
|
|
715
|
+
H[1] = H[1] + b >>> 0;
|
|
716
|
+
H[2] = H[2] + c >>> 0;
|
|
717
|
+
H[3] = H[3] + d >>> 0;
|
|
718
|
+
H[4] = H[4] + e >>> 0;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
const v5 = v35('v5', 0x50, sha1);
|
|
725
|
+
var uuidv5 = v5;
|
|
726
|
+
|
|
727
|
+
var libVersion = "2.25.1" ;
|
|
728
|
+
|
|
490
729
|
var keysOf = Object.keys;
|
|
491
730
|
function isObject(o) {
|
|
492
731
|
return o !== null && typeof o === 'object' && !Array.isArray(o);
|
|
@@ -1029,6 +1268,7 @@
|
|
|
1029
1268
|
var endpointIsCoveoProxy = endpoint.indexOf('.cloud.coveo.com') !== -1;
|
|
1030
1269
|
return "" + endpoint + (endpointIsCoveoProxy ? '' : '/rest') + "/" + apiVersion;
|
|
1031
1270
|
}
|
|
1271
|
+
var COVEO_NAMESPACE = '38824e1f-37f5-42d3-8372-a4b8fa9df946';
|
|
1032
1272
|
var CoveoAnalyticsClient = (function () {
|
|
1033
1273
|
function CoveoAnalyticsClient(opts) {
|
|
1034
1274
|
if (!opts) {
|
|
@@ -1065,6 +1305,13 @@
|
|
|
1065
1305
|
enumerable: false,
|
|
1066
1306
|
configurable: true
|
|
1067
1307
|
});
|
|
1308
|
+
Object.defineProperty(CoveoAnalyticsClient.prototype, "version", {
|
|
1309
|
+
get: function () {
|
|
1310
|
+
return libVersion;
|
|
1311
|
+
},
|
|
1312
|
+
enumerable: false,
|
|
1313
|
+
configurable: true
|
|
1314
|
+
});
|
|
1068
1315
|
CoveoAnalyticsClient.prototype.initRuntime = function (clientsOptions) {
|
|
1069
1316
|
var _this = this;
|
|
1070
1317
|
if (hasWindow() && hasDocument()) {
|
|
@@ -1094,11 +1341,11 @@
|
|
|
1094
1341
|
case 0:
|
|
1095
1342
|
_a.trys.push([0, 2, , 3]);
|
|
1096
1343
|
return [4, this.storage.getItem('visitorId')];
|
|
1097
|
-
case 1: return [2, (_a.sent()) ||
|
|
1344
|
+
case 1: return [2, (_a.sent()) || v4()];
|
|
1098
1345
|
case 2:
|
|
1099
1346
|
err_1 = _a.sent();
|
|
1100
1347
|
console.log('Could not get visitor ID from the current runtime environment storage. Using a random ID instead.', err_1);
|
|
1101
|
-
return [2,
|
|
1348
|
+
return [2, v4()];
|
|
1102
1349
|
case 3: return [2];
|
|
1103
1350
|
}
|
|
1104
1351
|
});
|
|
@@ -1137,6 +1384,22 @@
|
|
|
1137
1384
|
});
|
|
1138
1385
|
});
|
|
1139
1386
|
};
|
|
1387
|
+
CoveoAnalyticsClient.prototype.setClientId = function (value, namespace) {
|
|
1388
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1389
|
+
return __generator(this, function (_a) {
|
|
1390
|
+
if (validate(value)) {
|
|
1391
|
+
this.setCurrentVisitorId(value);
|
|
1392
|
+
}
|
|
1393
|
+
else {
|
|
1394
|
+
if (!namespace) {
|
|
1395
|
+
throw Error('Cannot generate uuid client id without a specific namespace string.');
|
|
1396
|
+
}
|
|
1397
|
+
this.setCurrentVisitorId(uuidv5(value, uuidv5(namespace, COVEO_NAMESPACE)));
|
|
1398
|
+
}
|
|
1399
|
+
return [2];
|
|
1400
|
+
});
|
|
1401
|
+
});
|
|
1402
|
+
};
|
|
1140
1403
|
CoveoAnalyticsClient.prototype.getParameters = function (eventType) {
|
|
1141
1404
|
var payload = [];
|
|
1142
1405
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -1173,7 +1436,7 @@
|
|
|
1173
1436
|
get: function () {
|
|
1174
1437
|
var visitorId = this.visitorId || this.storage.getItem('visitorId');
|
|
1175
1438
|
if (typeof visitorId !== 'string') {
|
|
1176
|
-
this.setCurrentVisitorId(
|
|
1439
|
+
this.setCurrentVisitorId(v4());
|
|
1177
1440
|
}
|
|
1178
1441
|
return this.visitorId;
|
|
1179
1442
|
},
|
|
@@ -1640,7 +1903,7 @@
|
|
|
1640
1903
|
};
|
|
1641
1904
|
var BasePlugin = (function () {
|
|
1642
1905
|
function BasePlugin(_a) {
|
|
1643
|
-
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ?
|
|
1906
|
+
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ? v4 : _b;
|
|
1644
1907
|
this.actionData = {};
|
|
1645
1908
|
this.client = client;
|
|
1646
1909
|
this.uuidGenerator = uuidGenerator;
|
|
@@ -1723,7 +1986,7 @@
|
|
|
1723
1986
|
var ECPlugin = (function (_super) {
|
|
1724
1987
|
__extends(ECPlugin, _super);
|
|
1725
1988
|
function ECPlugin(_a) {
|
|
1726
|
-
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ?
|
|
1989
|
+
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ? v4 : _b;
|
|
1727
1990
|
var _this = _super.call(this, { client: client, uuidGenerator: uuidGenerator }) || this;
|
|
1728
1991
|
_this.products = [];
|
|
1729
1992
|
_this.impressions = [];
|
|
@@ -1851,7 +2114,7 @@
|
|
|
1851
2114
|
var SVCPlugin = (function (_super) {
|
|
1852
2115
|
__extends(SVCPlugin, _super);
|
|
1853
2116
|
function SVCPlugin(_a) {
|
|
1854
|
-
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ?
|
|
2117
|
+
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ? v4 : _b;
|
|
1855
2118
|
var _this = _super.call(this, { client: client, uuidGenerator: uuidGenerator }) || this;
|
|
1856
2119
|
_this.ticket = {};
|
|
1857
2120
|
return _this;
|
|
@@ -2079,6 +2342,9 @@
|
|
|
2079
2342
|
this.plugins = new Plugins();
|
|
2080
2343
|
this.params = {};
|
|
2081
2344
|
};
|
|
2345
|
+
CoveoUA.prototype.version = function () {
|
|
2346
|
+
return libVersion;
|
|
2347
|
+
};
|
|
2082
2348
|
return CoveoUA;
|
|
2083
2349
|
}());
|
|
2084
2350
|
var coveoua$1 = new CoveoUA();
|
|
@@ -2106,6 +2372,7 @@
|
|
|
2106
2372
|
'reset',
|
|
2107
2373
|
'require',
|
|
2108
2374
|
'provide',
|
|
2375
|
+
'version',
|
|
2109
2376
|
];
|
|
2110
2377
|
throw new Error("The action \"" + command + "\" does not exist. Available actions: " + actions.join(', ') + ".");
|
|
2111
2378
|
}
|
|
@@ -2297,6 +2564,13 @@
|
|
|
2297
2564
|
NoopAnalytics.prototype.registerBeforeSendEventHook = function () { };
|
|
2298
2565
|
NoopAnalytics.prototype.registerAfterSendEventHook = function () { };
|
|
2299
2566
|
NoopAnalytics.prototype.addEventTypeMapping = function () { };
|
|
2567
|
+
Object.defineProperty(NoopAnalytics.prototype, "version", {
|
|
2568
|
+
get: function () {
|
|
2569
|
+
return libVersion;
|
|
2570
|
+
},
|
|
2571
|
+
enumerable: false,
|
|
2572
|
+
configurable: true
|
|
2573
|
+
});
|
|
2300
2574
|
return NoopAnalytics;
|
|
2301
2575
|
}());
|
|
2302
2576
|
|
|
@@ -3943,11 +4217,11 @@
|
|
|
3943
4217
|
});
|
|
3944
4218
|
|
|
3945
4219
|
var promise = window['Promise'];
|
|
3946
|
-
if (!(promise instanceof Function)) {
|
|
4220
|
+
if (!(promise instanceof Function) && !global) {
|
|
3947
4221
|
console.error("This script uses window.Promise which is not supported in your browser. Consider adding a polyfill like \"es6-promise\".");
|
|
3948
4222
|
}
|
|
3949
4223
|
var fetch$1 = window['fetch'];
|
|
3950
|
-
if (!(fetch$1 instanceof Function)) {
|
|
4224
|
+
if (!(fetch$1 instanceof Function) && !global) {
|
|
3951
4225
|
console.error("This script uses window.fetch which is not supported in your browser. Consider adding a polyfill like \"fetch\".");
|
|
3952
4226
|
}
|
|
3953
4227
|
var coveoua = self.coveoua || handleOneAnalyticsEvent;
|