coveo.analytics 2.30.28 → 2.30.36
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/browser.mjs +49 -7
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +49 -7
- 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/utils.d.ts +1 -0
- package/dist/definitions/insight/insightClient.d.ts +2 -1
- package/dist/definitions/searchPage/searchPageEvents.d.ts +19 -14
- package/dist/definitions/version.d.ts +1 -1
- package/dist/library.cjs +49 -7
- package/dist/library.es.js +49 -7
- package/dist/library.js +49 -7
- package/dist/library.mjs +49 -7
- package/dist/react-native.es.js +49 -7
- package/package.json +1 -1
- package/src/client/analytics.spec.ts +9 -6
- package/src/client/analytics.ts +5 -9
- package/src/client/utils.spec.ts +113 -0
- package/src/client/utils.ts +65 -0
- package/src/insight/insightClient.spec.ts +20 -0
- package/src/insight/insightClient.ts +8 -0
- package/src/searchPage/searchPageEvents.ts +21 -14
package/dist/browser.mjs
CHANGED
|
@@ -596,7 +596,7 @@ function sha1(bytes) {
|
|
|
596
596
|
const v5 = v35('v5', 0x50, sha1);
|
|
597
597
|
var uuidv5 = v5;
|
|
598
598
|
|
|
599
|
-
const libVersion = "2.30.
|
|
599
|
+
const libVersion = "2.30.36" ;
|
|
600
600
|
|
|
601
601
|
const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
|
|
602
602
|
|
|
@@ -792,6 +792,48 @@ const keysOf = Object.keys;
|
|
|
792
792
|
function isObject(o) {
|
|
793
793
|
return o !== null && typeof o === 'object' && !Array.isArray(o);
|
|
794
794
|
}
|
|
795
|
+
const UTF8_HIGH_BIT = 128;
|
|
796
|
+
const UTF8_HEADER_2 = 192;
|
|
797
|
+
const UTF8_HEADER_3 = 224;
|
|
798
|
+
const UTF8_HEADER_4 = 240;
|
|
799
|
+
function utf8ByteCountFromFirstByte(firstByte) {
|
|
800
|
+
if ((firstByte & 248) === UTF8_HEADER_4) {
|
|
801
|
+
return 4;
|
|
802
|
+
}
|
|
803
|
+
if ((firstByte & UTF8_HEADER_4) === UTF8_HEADER_3) {
|
|
804
|
+
return 3;
|
|
805
|
+
}
|
|
806
|
+
if ((firstByte & UTF8_HEADER_3) === UTF8_HEADER_2) {
|
|
807
|
+
return 2;
|
|
808
|
+
}
|
|
809
|
+
return 1;
|
|
810
|
+
}
|
|
811
|
+
function truncateUrl(input, limit) {
|
|
812
|
+
if (limit < 0 || input.length <= limit) {
|
|
813
|
+
return input;
|
|
814
|
+
}
|
|
815
|
+
let end = input.indexOf('%', limit - 2);
|
|
816
|
+
if (end < 0 || end > limit) {
|
|
817
|
+
end = limit;
|
|
818
|
+
}
|
|
819
|
+
else {
|
|
820
|
+
limit = end;
|
|
821
|
+
}
|
|
822
|
+
while (end > 2 && input.charAt(end - 3) == '%') {
|
|
823
|
+
const peekByte = Number.parseInt(input.substring(end - 2, end), 16);
|
|
824
|
+
if ((peekByte & UTF8_HIGH_BIT) != UTF8_HIGH_BIT) {
|
|
825
|
+
break;
|
|
826
|
+
}
|
|
827
|
+
end -= 3;
|
|
828
|
+
if ((peekByte & UTF8_HEADER_2) != UTF8_HIGH_BIT) {
|
|
829
|
+
if (limit - end >= utf8ByteCountFromFirstByte(peekByte) * 3) {
|
|
830
|
+
end = limit;
|
|
831
|
+
}
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
return input.substring(0, end);
|
|
836
|
+
}
|
|
795
837
|
|
|
796
838
|
const ticketKeysMapping = {
|
|
797
839
|
id: 'svc_ticket_id',
|
|
@@ -1635,10 +1677,10 @@ class CoveoAnalyticsClient {
|
|
|
1635
1677
|
eventType == EventType.click ||
|
|
1636
1678
|
eventType == EventType.search ||
|
|
1637
1679
|
eventType == EventType.custom) {
|
|
1638
|
-
rest.originLevel3 = this.limit(rest.originLevel3,
|
|
1680
|
+
rest.originLevel3 = this.limit(rest.originLevel3, 1024);
|
|
1639
1681
|
}
|
|
1640
1682
|
if (eventType == EventType.view) {
|
|
1641
|
-
rest.location = this.limit(rest.location,
|
|
1683
|
+
rest.location = this.limit(rest.location, 1024);
|
|
1642
1684
|
}
|
|
1643
1685
|
if (eventType == 'pageview' || eventType == 'event') {
|
|
1644
1686
|
rest.referrer = this.limit(rest.referrer, 2048);
|
|
@@ -1675,10 +1717,7 @@ class CoveoAnalyticsClient {
|
|
|
1675
1717
|
return rest;
|
|
1676
1718
|
}
|
|
1677
1719
|
limit(input, length) {
|
|
1678
|
-
|
|
1679
|
-
return input;
|
|
1680
|
-
}
|
|
1681
|
-
return input.substring(0, length);
|
|
1720
|
+
return typeof input === 'string' ? truncateUrl(input, length) : input;
|
|
1682
1721
|
}
|
|
1683
1722
|
get baseUrl() {
|
|
1684
1723
|
return buildBaseUrl(this.options.endpoint, this.options.version, this.options.isCustomEndpoint);
|
|
@@ -3264,6 +3303,9 @@ class CoveoInsightClient {
|
|
|
3264
3303
|
return this.logCustomEvent(SearchPageEvents.showLessFoldedResults, metadata ? generateMetadataToSend(metadata, false) : undefined);
|
|
3265
3304
|
});
|
|
3266
3305
|
}
|
|
3306
|
+
logTriggerNotify(triggerNotifyMetadata, metadata) {
|
|
3307
|
+
return this.logCustomEvent(SearchPageEvents.triggerNotify, metadata ? Object.assign(Object.assign({}, generateMetadataToSend(metadata, false)), triggerNotifyMetadata) : triggerNotifyMetadata);
|
|
3308
|
+
}
|
|
3267
3309
|
getBaseCustomEventRequest(metadata) {
|
|
3268
3310
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3269
3311
|
return Object.assign(Object.assign({}, (yield this.getBaseEventRequest(metadata))), { lastSearchQueryUid: this.provider.getSearchUID() });
|