coveo.analytics 2.28.9 → 2.28.11

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.9" ;
731
+ var libVersion = "2.28.11" ;
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);
@@ -1807,7 +1807,7 @@
1807
1807
  case 0:
1808
1808
  _a = (this.eventTypeMapping[eventType] || {}).usesMeasurementProtocol, usesMeasurementProtocol = _a === void 0 ? false : _a;
1809
1809
  addTrackingIdStep = function (currentPayload) {
1810
- return _this.setTrackingIdFromContextWebsiteIfTrackingIdNotPresent(currentPayload);
1810
+ return _this.setTrackingIdIfTrackingIdNotPresent(currentPayload);
1811
1811
  };
1812
1812
  cleanPayloadStep = function (currentPayload) {
1813
1813
  return _this.removeEmptyPayloadValues(currentPayload, eventType);
@@ -2157,15 +2157,22 @@
2157
2157
  return payload;
2158
2158
  }
2159
2159
  };
2160
- CoveoAnalyticsClient.prototype.setTrackingIdFromContextWebsiteIfTrackingIdNotPresent = function (payload) {
2161
- var trackingId = payload.trackingId, custom = payload.custom, rest = __rest(payload, ["trackingId", "custom"]);
2162
- if (!trackingId && custom && isObject(custom) && 'context_website' in custom) {
2163
- rest['trackingId'] = custom.context_website;
2164
- return __assign({ custom: custom }, rest);
2165
- }
2166
- else {
2160
+ CoveoAnalyticsClient.prototype.setTrackingIdIfTrackingIdNotPresent = function (payload) {
2161
+ var trackingId = payload.trackingId, rest = __rest(payload, ["trackingId"]);
2162
+ if (trackingId) {
2167
2163
  return payload;
2168
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;
2169
2176
  };
2170
2177
  CoveoAnalyticsClient.prototype.limit = function (input, length) {
2171
2178
  if (typeof input !== 'string') {