coveo.analytics 2.30.27 → 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.
@@ -728,7 +728,7 @@
728
728
  const v5 = v35('v5', 0x50, sha1);
729
729
  var uuidv5 = v5;
730
730
 
731
- var libVersion = "2.30.27" ;
731
+ var libVersion = "2.30.36" ;
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);
@@ -954,6 +954,48 @@
954
954
  function coerceToNumber(input) {
955
955
  return typeof input === 'string' && input != '' && !Number.isNaN(+input) ? +input : input;
956
956
  }
957
+ var UTF8_HIGH_BIT = 128;
958
+ var UTF8_HEADER_2 = 192;
959
+ var UTF8_HEADER_3 = 224;
960
+ var UTF8_HEADER_4 = 240;
961
+ function utf8ByteCountFromFirstByte(firstByte) {
962
+ if ((firstByte & 248) === UTF8_HEADER_4) {
963
+ return 4;
964
+ }
965
+ if ((firstByte & UTF8_HEADER_4) === UTF8_HEADER_3) {
966
+ return 3;
967
+ }
968
+ if ((firstByte & UTF8_HEADER_3) === UTF8_HEADER_2) {
969
+ return 2;
970
+ }
971
+ return 1;
972
+ }
973
+ function truncateUrl(input, limit) {
974
+ if (limit < 0 || input.length <= limit) {
975
+ return input;
976
+ }
977
+ var end = input.indexOf('%', limit - 2);
978
+ if (end < 0 || end > limit) {
979
+ end = limit;
980
+ }
981
+ else {
982
+ limit = end;
983
+ }
984
+ while (end > 2 && input.charAt(end - 3) == '%') {
985
+ var peekByte = Number.parseInt(input.substring(end - 2, end), 16);
986
+ if ((peekByte & UTF8_HIGH_BIT) != UTF8_HIGH_BIT) {
987
+ break;
988
+ }
989
+ end -= 3;
990
+ if ((peekByte & UTF8_HEADER_2) != UTF8_HIGH_BIT) {
991
+ if (limit - end >= utf8ByteCountFromFirstByte(peekByte) * 3) {
992
+ end = limit;
993
+ }
994
+ break;
995
+ }
996
+ }
997
+ return input.substring(0, end);
998
+ }
957
999
 
958
1000
  var ticketKeysMapping = {
959
1001
  id: 'svc_ticket_id',
@@ -2170,10 +2212,10 @@
2170
2212
  eventType == EventType.click ||
2171
2213
  eventType == EventType.search ||
2172
2214
  eventType == EventType.custom) {
2173
- rest.originLevel3 = this.limit(rest.originLevel3, 128);
2215
+ rest.originLevel3 = this.limit(rest.originLevel3, 1024);
2174
2216
  }
2175
2217
  if (eventType == EventType.view) {
2176
- rest.location = this.limit(rest.location, 128);
2218
+ rest.location = this.limit(rest.location, 1024);
2177
2219
  }
2178
2220
  if (eventType == 'pageview' || eventType == 'event') {
2179
2221
  rest.referrer = this.limit(rest.referrer, 2048);
@@ -2210,10 +2252,7 @@
2210
2252
  return rest;
2211
2253
  };
2212
2254
  CoveoAnalyticsClient.prototype.limit = function (input, length) {
2213
- if (typeof input !== 'string') {
2214
- return input;
2215
- }
2216
- return input.substring(0, length);
2255
+ return typeof input === 'string' ? truncateUrl(input, length) : input;
2217
2256
  };
2218
2257
  Object.defineProperty(CoveoAnalyticsClient.prototype, "baseUrl", {
2219
2258
  get: function () {
@@ -4787,6 +4826,9 @@
4787
4826
  });
4788
4827
  });
4789
4828
  };
4829
+ CoveoInsightClient.prototype.logTriggerNotify = function (triggerNotifyMetadata, metadata) {
4830
+ return this.logCustomEvent(SearchPageEvents.triggerNotify, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), triggerNotifyMetadata) : triggerNotifyMetadata);
4831
+ };
4790
4832
  CoveoInsightClient.prototype.getBaseCustomEventRequest = function (metadata) {
4791
4833
  return __awaiter(this, void 0, void 0, function () {
4792
4834
  var _a;