coveo.analytics 2.29.4 → 2.29.6

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.
@@ -728,7 +728,7 @@
728
728
  const v5 = v35('v5', 0x50, sha1);
729
729
  var uuidv5 = v5;
730
730
 
731
- var libVersion = "2.29.4" ;
731
+ var libVersion = "2.29.6" ;
732
732
 
733
733
  var getFormattedLocation = function (location) {
734
734
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -1330,7 +1330,7 @@
1330
1330
  }
1331
1331
  AnalyticsFetchClient.prototype.sendEvent = function (eventType, payload) {
1332
1332
  return __awaiter(this, void 0, void 0, function () {
1333
- var _a, baseUrl, visitorIdProvider, preprocessRequest, visitorIdParam, _b, defaultOptions, _c, url, fetchData, _d, _e, response, visit;
1333
+ var _a, baseUrl, visitorIdProvider, preprocessRequest, visitorIdParam, _b, defaultOptions, _c, url, fetchData, _d, _e, response, error_1, visit;
1334
1334
  return __generator(this, function (_f) {
1335
1335
  switch (_f.label) {
1336
1336
  case 0:
@@ -1364,18 +1364,27 @@
1364
1364
  _f.label = 6;
1365
1365
  case 6:
1366
1366
  _c = __assign.apply(void 0, _d.concat([(_e)])), url = _c.url, fetchData = __rest(_c, ["url"]);
1367
- return [4, fetch$2(url, fetchData)];
1367
+ _f.label = 7;
1368
1368
  case 7:
1369
+ _f.trys.push([7, 9, , 10]);
1370
+ return [4, fetch$2(url, fetchData)];
1371
+ case 8:
1369
1372
  response = _f.sent();
1370
- if (!response.ok) return [3, 9];
1373
+ return [3, 10];
1374
+ case 9:
1375
+ error_1 = _f.sent();
1376
+ console.error('An error has occured when sending the event.', error_1);
1377
+ return [2];
1378
+ case 10:
1379
+ if (!response.ok) return [3, 12];
1371
1380
  return [4, response.json()];
1372
- case 8:
1381
+ case 11:
1373
1382
  visit = (_f.sent());
1374
1383
  if (visit.visitorId) {
1375
1384
  visitorIdProvider.setCurrentVisitorId(visit.visitorId);
1376
1385
  }
1377
1386
  return [2, visit];
1378
- case 9:
1387
+ case 12:
1379
1388
  try {
1380
1389
  response.json();
1381
1390
  }
@@ -1538,9 +1547,11 @@
1538
1547
  visitorIdProvider: this,
1539
1548
  preprocessRequest: this.options.preprocessRequest,
1540
1549
  };
1541
- this.runtime = this.options.runtimeEnvironment || this.initRuntime(clientsOptions);
1542
1550
  if (doNotTrack()) {
1543
- this.runtime.storage = new NullStorage();
1551
+ this.runtime = new NoopRuntime();
1552
+ }
1553
+ else {
1554
+ this.runtime = this.options.runtimeEnvironment || this.initRuntime(clientsOptions);
1544
1555
  }
1545
1556
  this.addEventTypeMapping(EventType.view, { newEventType: EventType.view, addClientIdParameter: true });
1546
1557
  this.addEventTypeMapping(EventType.click, { newEventType: EventType.click, addClientIdParameter: true });