coveo.analytics 2.28.13 → 2.28.15
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 +17 -6
- 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 +1 -1
- package/dist/definitions/client/analyticsBeaconClient.d.ts +1 -0
- package/dist/definitions/client/runtimeEnvironment.d.ts +6 -0
- package/dist/definitions/react-native/react-native-runtime.d.ts +1 -0
- package/dist/definitions/src/react-native/react-native-runtime.d.ts +1 -0
- package/dist/definitions/version.d.ts +1 -1
- package/dist/{library.js → library.cjs} +17 -6
- package/dist/react-native.es.js +20 -6
- package/modules/package.json +11 -0
- package/package.json +6 -5
- package/src/client/analytics.ts +3 -3
- package/src/client/analyticsBeaconClient.ts +5 -3
- package/src/client/runtimeEnvironment.ts +14 -0
- package/src/react-native/react-native-runtime.ts +4 -0
- package/dist/library.es.js +0 -3112
package/dist/coveoua.debug.js
CHANGED
|
@@ -728,7 +728,7 @@
|
|
|
728
728
|
const v5 = v35('v5', 0x50, sha1);
|
|
729
729
|
var uuidv5 = v5;
|
|
730
730
|
|
|
731
|
-
var libVersion = "2.28.
|
|
731
|
+
var libVersion = "2.28.15" ;
|
|
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);
|
|
@@ -1208,7 +1208,7 @@
|
|
|
1208
1208
|
return __generator(this, function (_e) {
|
|
1209
1209
|
switch (_e.label) {
|
|
1210
1210
|
case 0:
|
|
1211
|
-
if (!
|
|
1211
|
+
if (!this.isAvailable()) {
|
|
1212
1212
|
throw new Error("navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like \"sendbeacon-polyfill\".");
|
|
1213
1213
|
}
|
|
1214
1214
|
_a = this.opts, baseUrl = _a.baseUrl, preprocessRequest = _a.preprocessRequest;
|
|
@@ -1233,13 +1233,15 @@
|
|
|
1233
1233
|
_e.label = 4;
|
|
1234
1234
|
case 4:
|
|
1235
1235
|
_b = __assign.apply(void 0, _c.concat([(_d)])), url = _b.url, body = _b.body;
|
|
1236
|
-
console.log("Sending beacon for \"".concat(eventType, "\" with: "), JSON.stringify(payload));
|
|
1237
1236
|
navigator.sendBeacon(url, body);
|
|
1238
1237
|
return [2];
|
|
1239
1238
|
}
|
|
1240
1239
|
});
|
|
1241
1240
|
});
|
|
1242
1241
|
};
|
|
1242
|
+
AnalyticsBeaconClient.prototype.isAvailable = function () {
|
|
1243
|
+
return 'sendBeacon' in navigator;
|
|
1244
|
+
};
|
|
1243
1245
|
AnalyticsBeaconClient.prototype.deleteHttpCookieVisitorId = function () {
|
|
1244
1246
|
return Promise.resolve();
|
|
1245
1247
|
};
|
|
@@ -1439,6 +1441,9 @@
|
|
|
1439
1441
|
}
|
|
1440
1442
|
});
|
|
1441
1443
|
}
|
|
1444
|
+
BrowserRuntime.prototype.getClientDependingOnEventType = function (eventType) {
|
|
1445
|
+
return eventType === 'click' && this.beaconClient.isAvailable() ? this.beaconClient : this.client;
|
|
1446
|
+
};
|
|
1442
1447
|
return BrowserRuntime;
|
|
1443
1448
|
}());
|
|
1444
1449
|
var NodeJSRuntime = (function () {
|
|
@@ -1446,6 +1451,9 @@
|
|
|
1446
1451
|
this.storage = storage || new NullStorage();
|
|
1447
1452
|
this.client = new AnalyticsFetchClient(clientOptions);
|
|
1448
1453
|
}
|
|
1454
|
+
NodeJSRuntime.prototype.getClientDependingOnEventType = function (eventType) {
|
|
1455
|
+
return this.client;
|
|
1456
|
+
};
|
|
1449
1457
|
return NodeJSRuntime;
|
|
1450
1458
|
}());
|
|
1451
1459
|
var NoopRuntime = (function () {
|
|
@@ -1453,6 +1461,9 @@
|
|
|
1453
1461
|
this.storage = new NullStorage();
|
|
1454
1462
|
this.client = new NoopAnalyticsClient();
|
|
1455
1463
|
}
|
|
1464
|
+
NoopRuntime.prototype.getClientDependingOnEventType = function (eventType) {
|
|
1465
|
+
return this.client;
|
|
1466
|
+
};
|
|
1456
1467
|
return NoopRuntime;
|
|
1457
1468
|
}());
|
|
1458
1469
|
|
|
@@ -1885,7 +1896,7 @@
|
|
|
1885
1896
|
return [4, this.deferExecution()];
|
|
1886
1897
|
case 2:
|
|
1887
1898
|
_a.sent();
|
|
1888
|
-
return [4, this.
|
|
1899
|
+
return [4, this.sendFromBuffer()];
|
|
1889
1900
|
case 3: return [2, (_a.sent())];
|
|
1890
1901
|
}
|
|
1891
1902
|
});
|
|
@@ -1912,14 +1923,14 @@
|
|
|
1912
1923
|
CoveoAnalyticsClient.prototype.deferExecution = function () {
|
|
1913
1924
|
return new Promise(function (resolve) { return setTimeout(resolve, 0); });
|
|
1914
1925
|
};
|
|
1915
|
-
CoveoAnalyticsClient.prototype.
|
|
1926
|
+
CoveoAnalyticsClient.prototype.sendFromBuffer = function () {
|
|
1916
1927
|
return __awaiter(this, void 0, void 0, function () {
|
|
1917
1928
|
var popped, eventType, payload;
|
|
1918
1929
|
return __generator(this, function (_a) {
|
|
1919
1930
|
popped = this.bufferedRequests.shift();
|
|
1920
1931
|
if (popped) {
|
|
1921
1932
|
eventType = popped.eventType, payload = popped.payload;
|
|
1922
|
-
return [2, this.runtime.
|
|
1933
|
+
return [2, this.runtime.getClientDependingOnEventType(eventType).sendEvent(eventType, payload)];
|
|
1923
1934
|
}
|
|
1924
1935
|
return [2];
|
|
1925
1936
|
});
|