coveo.analytics 2.24.1 → 2.25.2
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 +55 -32
- package/dist/coveoua.debug.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/plugins/BasePlugin.d.ts +2 -2
- package/dist/definitions/version.d.ts +1 -1
- package/dist/library.es.js +54 -31
- package/dist/library.js +55 -32
- package/dist/react-native.es.js +273 -250
- package/package.json +1 -1
- package/src/client/analytics.spec.ts +4 -5
- package/src/client/analytics.ts +1 -2
- package/src/coveoua/simpleanalytics.spec.ts +2 -4
- package/src/plugins/BasePlugin.ts +4 -5
- package/src/plugins/ec.spec.ts +2 -2
- package/src/plugins/ec.ts +1 -1
- package/src/plugins/svc.spec.ts +2 -2
- package/src/plugins/svc.ts +1 -1
- package/src/react-native/react-native-runtime.ts +1 -1
- package/dist/definitions/client/crypto.d.ts +0 -1
- package/src/client/crypto.ts +0 -21
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnalyticsClient } from '../client/analytics';
|
|
2
|
-
import { uuidv4 } from '
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
3
|
declare type PluginWithId = {
|
|
4
4
|
readonly Id: string;
|
|
5
5
|
};
|
|
@@ -43,7 +43,7 @@ export declare abstract class BasePlugin {
|
|
|
43
43
|
userAgent: string;
|
|
44
44
|
screenResolution: string;
|
|
45
45
|
screenColor: string;
|
|
46
|
-
time:
|
|
46
|
+
time: number;
|
|
47
47
|
eventId: string;
|
|
48
48
|
};
|
|
49
49
|
private updateLocationForNextPageView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const libVersion = "2.
|
|
1
|
+
export declare const libVersion = "2.25.2";
|
package/dist/library.es.js
CHANGED
|
@@ -71,12 +71,6 @@ function hasSessionStorage() {
|
|
|
71
71
|
}
|
|
72
72
|
function hasCookieStorage() {
|
|
73
73
|
return hasNavigator() && navigator.cookieEnabled;
|
|
74
|
-
}
|
|
75
|
-
function hasCrypto() {
|
|
76
|
-
return typeof crypto !== 'undefined';
|
|
77
|
-
}
|
|
78
|
-
function hasCryptoRandomValues() {
|
|
79
|
-
return hasCrypto() && typeof crypto.getRandomValues !== 'undefined';
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
const eventTypesForDefaultValues = [EventType.click, EventType.custom, EventType.search, EventType.view];
|
|
@@ -334,24 +328,24 @@ const addPageViewToHistory = (pageViewValue) => __awaiter(void 0, void 0, void 0
|
|
|
334
328
|
yield store.addElementAsync(historyElement);
|
|
335
329
|
});
|
|
336
330
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
331
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
332
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
333
|
+
// generators (like Math.random()).
|
|
334
|
+
let getRandomValues;
|
|
335
|
+
const rnds8 = new Uint8Array(16);
|
|
336
|
+
function rng() {
|
|
337
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
338
|
+
if (!getRandomValues) {
|
|
339
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
340
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
341
|
+
|
|
342
|
+
if (!getRandomValues) {
|
|
343
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return getRandomValues(rnds8);
|
|
348
|
+
}
|
|
355
349
|
|
|
356
350
|
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;
|
|
357
351
|
|
|
@@ -472,6 +466,35 @@ function v35(name, version, hashfunc) {
|
|
|
472
466
|
return generateUUID;
|
|
473
467
|
}
|
|
474
468
|
|
|
469
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
470
|
+
var native = {
|
|
471
|
+
randomUUID
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
function v4(options, buf, offset) {
|
|
475
|
+
if (native.randomUUID && !buf && !options) {
|
|
476
|
+
return native.randomUUID();
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
options = options || {};
|
|
480
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
481
|
+
|
|
482
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
483
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
484
|
+
|
|
485
|
+
if (buf) {
|
|
486
|
+
offset = offset || 0;
|
|
487
|
+
|
|
488
|
+
for (let i = 0; i < 16; ++i) {
|
|
489
|
+
buf[offset + i] = rnds[i];
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
return buf;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
return unsafeStringify(rnds);
|
|
496
|
+
}
|
|
497
|
+
|
|
475
498
|
// Adapted from Chris Veness' SHA1 code at
|
|
476
499
|
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
477
500
|
function f(s, x, y, z) {
|
|
@@ -570,7 +593,7 @@ function sha1(bytes) {
|
|
|
570
593
|
const v5 = v35('v5', 0x50, sha1);
|
|
571
594
|
var uuidv5 = v5;
|
|
572
595
|
|
|
573
|
-
const libVersion = "2.
|
|
596
|
+
const libVersion = "2.25.2" ;
|
|
574
597
|
|
|
575
598
|
const keysOf = Object.keys;
|
|
576
599
|
function isObject(o) {
|
|
@@ -1047,11 +1070,11 @@ class CoveoAnalyticsClient {
|
|
|
1047
1070
|
determineVisitorId() {
|
|
1048
1071
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1049
1072
|
try {
|
|
1050
|
-
return (yield this.storage.getItem('visitorId')) ||
|
|
1073
|
+
return (yield this.storage.getItem('visitorId')) || v4();
|
|
1051
1074
|
}
|
|
1052
1075
|
catch (err) {
|
|
1053
1076
|
console.log('Could not get visitor ID from the current runtime environment storage. Using a random ID instead.', err);
|
|
1054
|
-
return
|
|
1077
|
+
return v4();
|
|
1055
1078
|
}
|
|
1056
1079
|
});
|
|
1057
1080
|
}
|
|
@@ -1097,7 +1120,7 @@ class CoveoAnalyticsClient {
|
|
|
1097
1120
|
get currentVisitorId() {
|
|
1098
1121
|
const visitorId = this.visitorId || this.storage.getItem('visitorId');
|
|
1099
1122
|
if (typeof visitorId !== 'string') {
|
|
1100
|
-
this.setCurrentVisitorId(
|
|
1123
|
+
this.setCurrentVisitorId(v4());
|
|
1101
1124
|
}
|
|
1102
1125
|
return this.visitorId;
|
|
1103
1126
|
}
|
|
@@ -2296,7 +2319,7 @@ const BasePluginEventTypes = {
|
|
|
2296
2319
|
event: 'event',
|
|
2297
2320
|
};
|
|
2298
2321
|
class BasePlugin {
|
|
2299
|
-
constructor({ client, uuidGenerator =
|
|
2322
|
+
constructor({ client, uuidGenerator = v4 }) {
|
|
2300
2323
|
this.actionData = {};
|
|
2301
2324
|
this.client = client;
|
|
2302
2325
|
this.uuidGenerator = uuidGenerator;
|
|
@@ -2335,7 +2358,7 @@ class BasePlugin {
|
|
|
2335
2358
|
userAgent: navigator.userAgent,
|
|
2336
2359
|
};
|
|
2337
2360
|
const eventContext = {
|
|
2338
|
-
time: Date.now()
|
|
2361
|
+
time: Date.now(),
|
|
2339
2362
|
eventId: this.uuidGenerator(),
|
|
2340
2363
|
};
|
|
2341
2364
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, eventContext), screenContext), navigatorContext), documentContext);
|
|
@@ -2376,7 +2399,7 @@ class BasePlugin {
|
|
|
2376
2399
|
const SVCPluginEventTypes = Object.assign({}, BasePluginEventTypes);
|
|
2377
2400
|
const allSVCEventTypes = Object.keys(SVCPluginEventTypes).map((key) => SVCPluginEventTypes[key]);
|
|
2378
2401
|
class SVCPlugin extends BasePlugin {
|
|
2379
|
-
constructor({ client, uuidGenerator =
|
|
2402
|
+
constructor({ client, uuidGenerator = v4 }) {
|
|
2380
2403
|
super({ client, uuidGenerator });
|
|
2381
2404
|
this.ticket = {};
|
|
2382
2405
|
}
|
package/dist/library.js
CHANGED
|
@@ -157,12 +157,6 @@ function hasSessionStorage() {
|
|
|
157
157
|
}
|
|
158
158
|
function hasCookieStorage() {
|
|
159
159
|
return hasNavigator() && navigator.cookieEnabled;
|
|
160
|
-
}
|
|
161
|
-
function hasCrypto() {
|
|
162
|
-
return typeof crypto !== 'undefined';
|
|
163
|
-
}
|
|
164
|
-
function hasCryptoRandomValues() {
|
|
165
|
-
return hasCrypto() && typeof crypto.getRandomValues !== 'undefined';
|
|
166
160
|
}
|
|
167
161
|
|
|
168
162
|
var eventTypesForDefaultValues = [EventType.click, EventType.custom, EventType.search, EventType.view];
|
|
@@ -481,24 +475,24 @@ var addPageViewToHistory = function (pageViewValue) { return __awaiter(void 0, v
|
|
|
481
475
|
});
|
|
482
476
|
}); };
|
|
483
477
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
}
|
|
478
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
479
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
480
|
+
// generators (like Math.random()).
|
|
481
|
+
let getRandomValues;
|
|
482
|
+
const rnds8 = new Uint8Array(16);
|
|
483
|
+
function rng() {
|
|
484
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
485
|
+
if (!getRandomValues) {
|
|
486
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
487
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
488
|
+
|
|
489
|
+
if (!getRandomValues) {
|
|
490
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
return getRandomValues(rnds8);
|
|
495
|
+
}
|
|
502
496
|
|
|
503
497
|
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;
|
|
504
498
|
|
|
@@ -619,6 +613,35 @@ function v35(name, version, hashfunc) {
|
|
|
619
613
|
return generateUUID;
|
|
620
614
|
}
|
|
621
615
|
|
|
616
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
617
|
+
var native = {
|
|
618
|
+
randomUUID
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
function v4(options, buf, offset) {
|
|
622
|
+
if (native.randomUUID && !buf && !options) {
|
|
623
|
+
return native.randomUUID();
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
options = options || {};
|
|
627
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
628
|
+
|
|
629
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
630
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
631
|
+
|
|
632
|
+
if (buf) {
|
|
633
|
+
offset = offset || 0;
|
|
634
|
+
|
|
635
|
+
for (let i = 0; i < 16; ++i) {
|
|
636
|
+
buf[offset + i] = rnds[i];
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
return buf;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
return unsafeStringify(rnds);
|
|
643
|
+
}
|
|
644
|
+
|
|
622
645
|
// Adapted from Chris Veness' SHA1 code at
|
|
623
646
|
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
624
647
|
function f(s, x, y, z) {
|
|
@@ -717,7 +740,7 @@ function sha1(bytes) {
|
|
|
717
740
|
const v5 = v35('v5', 0x50, sha1);
|
|
718
741
|
var uuidv5 = v5;
|
|
719
742
|
|
|
720
|
-
var libVersion = "2.
|
|
743
|
+
var libVersion = "2.25.2" ;
|
|
721
744
|
|
|
722
745
|
var keysOf = Object.keys;
|
|
723
746
|
function isObject(o) {
|
|
@@ -82831,11 +82854,11 @@ var CoveoAnalyticsClient = (function () {
|
|
|
82831
82854
|
case 0:
|
|
82832
82855
|
_a.trys.push([0, 2, , 3]);
|
|
82833
82856
|
return [4, this.storage.getItem('visitorId')];
|
|
82834
|
-
case 1: return [2, (_a.sent()) ||
|
|
82857
|
+
case 1: return [2, (_a.sent()) || v4()];
|
|
82835
82858
|
case 2:
|
|
82836
82859
|
err_1 = _a.sent();
|
|
82837
82860
|
console.log('Could not get visitor ID from the current runtime environment storage. Using a random ID instead.', err_1);
|
|
82838
|
-
return [2,
|
|
82861
|
+
return [2, v4()];
|
|
82839
82862
|
case 3: return [2];
|
|
82840
82863
|
}
|
|
82841
82864
|
});
|
|
@@ -82926,7 +82949,7 @@ var CoveoAnalyticsClient = (function () {
|
|
|
82926
82949
|
get: function () {
|
|
82927
82950
|
var visitorId = this.visitorId || this.storage.getItem('visitorId');
|
|
82928
82951
|
if (typeof visitorId !== 'string') {
|
|
82929
|
-
this.setCurrentVisitorId(
|
|
82952
|
+
this.setCurrentVisitorId(v4());
|
|
82930
82953
|
}
|
|
82931
82954
|
return this.visitorId;
|
|
82932
82955
|
},
|
|
@@ -83393,7 +83416,7 @@ var BasePluginEventTypes = {
|
|
|
83393
83416
|
};
|
|
83394
83417
|
var BasePlugin = (function () {
|
|
83395
83418
|
function BasePlugin(_a) {
|
|
83396
|
-
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ?
|
|
83419
|
+
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ? v4 : _b;
|
|
83397
83420
|
this.actionData = {};
|
|
83398
83421
|
this.client = client;
|
|
83399
83422
|
this.uuidGenerator = uuidGenerator;
|
|
@@ -83432,7 +83455,7 @@ var BasePlugin = (function () {
|
|
|
83432
83455
|
userAgent: navigator.userAgent,
|
|
83433
83456
|
};
|
|
83434
83457
|
var eventContext = {
|
|
83435
|
-
time: Date.now()
|
|
83458
|
+
time: Date.now(),
|
|
83436
83459
|
eventId: this.uuidGenerator(),
|
|
83437
83460
|
};
|
|
83438
83461
|
return __assign(__assign(__assign(__assign({}, eventContext), screenContext), navigatorContext), documentContext);
|
|
@@ -83476,7 +83499,7 @@ var allECEventTypes = Object.keys(ECPluginEventTypes).map(function (key) { retur
|
|
|
83476
83499
|
var ECPlugin = (function (_super) {
|
|
83477
83500
|
__extends(ECPlugin, _super);
|
|
83478
83501
|
function ECPlugin(_a) {
|
|
83479
|
-
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ?
|
|
83502
|
+
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ? v4 : _b;
|
|
83480
83503
|
var _this = _super.call(this, { client: client, uuidGenerator: uuidGenerator }) || this;
|
|
83481
83504
|
_this.products = [];
|
|
83482
83505
|
_this.impressions = [];
|
|
@@ -83604,7 +83627,7 @@ var allSVCEventTypes = Object.keys(SVCPluginEventTypes).map(function (key) { ret
|
|
|
83604
83627
|
var SVCPlugin = (function (_super) {
|
|
83605
83628
|
__extends(SVCPlugin, _super);
|
|
83606
83629
|
function SVCPlugin(_a) {
|
|
83607
|
-
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ?
|
|
83630
|
+
var client = _a.client, _b = _a.uuidGenerator, uuidGenerator = _b === void 0 ? v4 : _b;
|
|
83608
83631
|
var _this = _super.call(this, { client: client, uuidGenerator: uuidGenerator }) || this;
|
|
83609
83632
|
_this.ticket = {};
|
|
83610
83633
|
return _this;
|