coveo.analytics 2.26.4 → 2.26.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.
@@ -724,7 +724,7 @@
724
724
  const v5 = v35('v5', 0x50, sha1);
725
725
  var uuidv5 = v5;
726
726
 
727
- var libVersion = "2.26.4" ;
727
+ var libVersion = "2.26.6" ;
728
728
 
729
729
  var getFormattedLocation = function (location) {
730
730
  return location.protocol + "//" + location.hostname + (location.pathname.indexOf('/') === 0 ? location.pathname : "/" + location.pathname) + location.search;
@@ -1793,7 +1793,7 @@
1793
1793
  cleanPayloadStep = function (currentPayload) {
1794
1794
  return _this.removeEmptyPayloadValues(currentPayload, eventType);
1795
1795
  };
1796
- validateParams = function (currentPayload) { return _this.validateParams(currentPayload); };
1796
+ validateParams = function (currentPayload) { return _this.validateParams(currentPayload, eventType); };
1797
1797
  processMeasurementProtocolConversionStep = function (currentPayload) {
1798
1798
  return usesMeasurementProtocol ? convertKeysToMeasurementProtocol(currentPayload) : currentPayload;
1799
1799
  };
@@ -2104,13 +2104,27 @@
2104
2104
  });
2105
2105
  return result;
2106
2106
  };
2107
- CoveoAnalyticsClient.prototype.validateParams = function (payload) {
2107
+ CoveoAnalyticsClient.prototype.validateParams = function (payload, eventType) {
2108
2108
  var anonymizeIp = payload.anonymizeIp, rest = __rest(payload, ["anonymizeIp"]);
2109
2109
  if (anonymizeIp !== undefined) {
2110
2110
  if (['0', 'false', 'undefined', 'null', '{}', '[]', ''].indexOf(("" + anonymizeIp).toLowerCase()) == -1) {
2111
- rest['anonymizeIp'] = 1;
2111
+ rest.anonymizeIp = 1;
2112
2112
  }
2113
2113
  }
2114
+ if (eventType == EventType.view ||
2115
+ eventType == EventType.click ||
2116
+ eventType == EventType.search ||
2117
+ eventType == EventType.custom) {
2118
+ rest.originLevel3 = this.limit(rest.originLevel3, 128);
2119
+ }
2120
+ if (eventType == EventType.view) {
2121
+ rest.location = this.limit(rest.location, 128);
2122
+ }
2123
+ if (eventType == 'pageview' || eventType == 'event') {
2124
+ rest.referrer = this.limit(rest.referrer, 2048);
2125
+ rest.location = this.limit(rest.location, 2048);
2126
+ rest.page = this.limit(rest.page, 2048);
2127
+ }
2114
2128
  return rest;
2115
2129
  };
2116
2130
  CoveoAnalyticsClient.prototype.ensureAnonymousUserWhenUsingApiKey = function (payload) {
@@ -2123,6 +2137,12 @@
2123
2137
  return payload;
2124
2138
  }
2125
2139
  };
2140
+ CoveoAnalyticsClient.prototype.limit = function (input, length) {
2141
+ if (typeof input !== 'string') {
2142
+ return input;
2143
+ }
2144
+ return input.substring(0, length);
2145
+ };
2126
2146
  Object.defineProperty(CoveoAnalyticsClient.prototype, "baseUrl", {
2127
2147
  get: function () {
2128
2148
  return buildBaseUrl(this.options.endpoint, this.options.version);
@@ -4284,6 +4304,50 @@
4284
4304
  CoveoInsightClient.prototype.logCaseDetach = function (resultUriHash, metadata) {
4285
4305
  return this.logCustomEvent(SearchPageEvents.caseDetach, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), { resultUriHash: resultUriHash }) : { resultUriHash: resultUriHash });
4286
4306
  };
4307
+ CoveoInsightClient.prototype.logLikeSmartSnippet = function (metadata) {
4308
+ return this.logCustomEvent(SearchPageEvents.likeSmartSnippet, metadata ? generateMetadataToSend(metadata, false) : undefined);
4309
+ };
4310
+ CoveoInsightClient.prototype.logDislikeSmartSnippet = function (metadata) {
4311
+ return this.logCustomEvent(SearchPageEvents.dislikeSmartSnippet, metadata ? generateMetadataToSend(metadata, false) : undefined);
4312
+ };
4313
+ CoveoInsightClient.prototype.logExpandSmartSnippet = function (metadata) {
4314
+ return this.logCustomEvent(SearchPageEvents.expandSmartSnippet, metadata ? generateMetadataToSend(metadata, false) : undefined);
4315
+ };
4316
+ CoveoInsightClient.prototype.logCollapseSmartSnippet = function (metadata) {
4317
+ return this.logCustomEvent(SearchPageEvents.collapseSmartSnippet, metadata ? generateMetadataToSend(metadata, false) : undefined);
4318
+ };
4319
+ CoveoInsightClient.prototype.logOpenSmartSnippetFeedbackModal = function (metadata) {
4320
+ return this.logCustomEvent(SearchPageEvents.openSmartSnippetFeedbackModal, metadata ? generateMetadataToSend(metadata, false) : undefined);
4321
+ };
4322
+ CoveoInsightClient.prototype.logCloseSmartSnippetFeedbackModal = function (metadata) {
4323
+ return this.logCustomEvent(SearchPageEvents.closeSmartSnippetFeedbackModal, metadata ? generateMetadataToSend(metadata, false) : undefined);
4324
+ };
4325
+ CoveoInsightClient.prototype.logSmartSnippetFeedbackReason = function (reason, details, metadata) {
4326
+ return this.logCustomEvent(SearchPageEvents.sendSmartSnippetReason, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), { reason: reason, details: details }) : { reason: reason, details: details });
4327
+ };
4328
+ CoveoInsightClient.prototype.logExpandSmartSnippetSuggestion = function (snippet, metadata) {
4329
+ var snippetMetadata = 'documentId' in snippet ? snippet : { documentId: snippet };
4330
+ return this.logCustomEvent(SearchPageEvents.expandSmartSnippetSuggestion, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), snippetMetadata) : snippetMetadata);
4331
+ };
4332
+ CoveoInsightClient.prototype.logCollapseSmartSnippetSuggestion = function (snippet, metadata) {
4333
+ var snippetMetadata = 'documentId' in snippet ? snippet : { documentId: snippet };
4334
+ return this.logCustomEvent(SearchPageEvents.collapseSmartSnippetSuggestion, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), snippetMetadata) : snippetMetadata);
4335
+ };
4336
+ CoveoInsightClient.prototype.logOpenSmartSnippetSource = function (info, identifier, metadata) {
4337
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetSource, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
4338
+ };
4339
+ CoveoInsightClient.prototype.logOpenSmartSnippetSuggestionSource = function (info, snippet, metadata) {
4340
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetSuggestionSource, info, { contentIDKey: snippet.documentId.contentIdKey, contentIDValue: snippet.documentId.contentIdValue }, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), snippet) : snippet);
4341
+ };
4342
+ CoveoInsightClient.prototype.logOpenSmartSnippetInlineLink = function (info, identifierAndLink, metadata) {
4343
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetInlineLink, info, { contentIDKey: identifierAndLink.contentIDKey, contentIDValue: identifierAndLink.contentIDValue }, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), identifierAndLink) : identifierAndLink);
4344
+ };
4345
+ CoveoInsightClient.prototype.logOpenSmartSnippetSuggestionInlineLink = function (info, snippetAndLink, metadata) {
4346
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetSuggestionInlineLink, info, {
4347
+ contentIDKey: snippetAndLink.documentId.contentIdKey,
4348
+ contentIDValue: snippetAndLink.documentId.contentIdValue,
4349
+ }, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), snippetAndLink) : snippetAndLink);
4350
+ };
4287
4351
  CoveoInsightClient.prototype.logCustomEvent = function (event, metadata) {
4288
4352
  return __awaiter(this, void 0, void 0, function () {
4289
4353
  var customData, payload, _a;