coveo.analytics 2.28.25 → 2.29.1

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.25" ;
731
+ var libVersion = "2.29.1" ;
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);
@@ -1265,8 +1265,8 @@
1265
1265
  };
1266
1266
  AnalyticsBeaconClient.prototype.encodeForEventType = function (eventType, payload) {
1267
1267
  return this.isEventTypeLegacy(eventType)
1268
- ? this.encodeForLegacyType(eventType, payload)
1269
- : this.encodeForFormUrlEncoded(__assign({ access_token: this.opts.token }, payload));
1268
+ ? this.encodeEventToJson(eventType, payload)
1269
+ : this.encodeEventToJson(eventType, payload, this.opts.token);
1270
1270
  };
1271
1271
  AnalyticsBeaconClient.prototype.getQueryParamsForEventType = function (eventType) {
1272
1272
  return __awaiter(this, void 0, void 0, function () {
@@ -1292,20 +1292,12 @@
1292
1292
  AnalyticsBeaconClient.prototype.isEventTypeLegacy = function (eventType) {
1293
1293
  return [EventType.click, EventType.custom, EventType.search, EventType.view].indexOf(eventType) !== -1;
1294
1294
  };
1295
- AnalyticsBeaconClient.prototype.encodeForLegacyType = function (eventType, payload) {
1296
- return "".concat(eventType, "Event=").concat(encodeURIComponent(JSON.stringify(payload)));
1297
- };
1298
- AnalyticsBeaconClient.prototype.encodeForFormUrlEncoded = function (payload) {
1299
- var _this = this;
1300
- return Object.keys(payload)
1301
- .filter(function (key) { return !!payload[key]; })
1302
- .map(function (key) { return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(_this.encodeValue(payload[key]))); })
1303
- .join('&');
1304
- };
1305
- AnalyticsBeaconClient.prototype.encodeValue = function (value) {
1306
- return typeof value === 'number' || typeof value === 'string' || typeof value === 'boolean'
1307
- ? value
1308
- : JSON.stringify(value);
1295
+ AnalyticsBeaconClient.prototype.encodeEventToJson = function (eventType, payload, access_token) {
1296
+ var encoded = "".concat(eventType, "Event=").concat(encodeURIComponent(JSON.stringify(payload)));
1297
+ if (access_token) {
1298
+ encoded = "access_token=".concat(encodeURIComponent(access_token), "&").concat(encoded);
1299
+ }
1300
+ return encoded;
1309
1301
  };
1310
1302
  return AnalyticsBeaconClient;
1311
1303
  }());