coveo.analytics 2.28.8 → 2.28.10

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.28.8" ;
731
+ var libVersion = "2.28.10" ;
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);
@@ -1148,6 +1148,7 @@
1148
1148
  'searchUid',
1149
1149
  'permanentId',
1150
1150
  'contentLocale',
1151
+ 'trackingId',
1151
1152
  ];
1152
1153
  var baseMeasurementProtocolKeysMapping = __assign(__assign(__assign(__assign({}, globalParamKeysMapping), eventKeysMapping), contextInformationMapping), coveoExtensionsKeys.reduce(function (all, key) {
1153
1154
  var _a;
@@ -1799,12 +1800,15 @@
1799
1800
  };
1800
1801
  CoveoAnalyticsClient.prototype.resolvePayloadForParameters = function (eventType, parameters) {
1801
1802
  return __awaiter(this, void 0, void 0, function () {
1802
- var _a, usesMeasurementProtocol, cleanPayloadStep, validateParams, processMeasurementProtocolConversionStep, removeUnknownParameters, processCustomParameters, payloadToSend;
1803
+ var _a, usesMeasurementProtocol, addTrackingIdStep, cleanPayloadStep, validateParams, processMeasurementProtocolConversionStep, removeUnknownParameters, processCustomParameters, payloadToSend;
1803
1804
  var _this = this;
1804
1805
  return __generator(this, function (_b) {
1805
1806
  switch (_b.label) {
1806
1807
  case 0:
1807
1808
  _a = (this.eventTypeMapping[eventType] || {}).usesMeasurementProtocol, usesMeasurementProtocol = _a === void 0 ? false : _a;
1809
+ addTrackingIdStep = function (currentPayload) {
1810
+ return _this.setTrackingIdIfTrackingIdNotPresent(currentPayload);
1811
+ };
1808
1812
  cleanPayloadStep = function (currentPayload) {
1809
1813
  return _this.removeEmptyPayloadValues(currentPayload, eventType);
1810
1814
  };
@@ -1821,6 +1825,7 @@
1821
1825
  : _this.mapCustomParametersToCustomData(currentPayload);
1822
1826
  };
1823
1827
  return [4, [
1828
+ addTrackingIdStep,
1824
1829
  cleanPayloadStep,
1825
1830
  validateParams,
1826
1831
  processMeasurementProtocolConversionStep,
@@ -2152,6 +2157,23 @@
2152
2157
  return payload;
2153
2158
  }
2154
2159
  };
2160
+ CoveoAnalyticsClient.prototype.setTrackingIdIfTrackingIdNotPresent = function (payload) {
2161
+ var trackingId = payload.trackingId, rest = __rest(payload, ["trackingId"]);
2162
+ if (trackingId) {
2163
+ return payload;
2164
+ }
2165
+ if (rest.hasOwnProperty('custom') && isObject(rest.custom)) {
2166
+ if (rest.custom.hasOwnProperty('context_website') || rest.custom.hasOwnProperty('siteName')) {
2167
+ rest['trackingId'] = rest.custom.context_website || rest.custom.siteName;
2168
+ }
2169
+ }
2170
+ if (rest.hasOwnProperty('customData') && isObject(rest.customData)) {
2171
+ if (rest.customData.hasOwnProperty('context_website') || rest.customData.hasOwnProperty('siteName')) {
2172
+ rest['trackingId'] = rest.customData.context_website || rest.customData.siteName;
2173
+ }
2174
+ }
2175
+ return rest;
2176
+ };
2155
2177
  CoveoAnalyticsClient.prototype.limit = function (input, length) {
2156
2178
  if (typeof input !== 'string') {
2157
2179
  return input;