@openreplay/tracker 16.1.3 → 16.1.4

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.
package/dist/lib/index.js CHANGED
@@ -4740,7 +4740,7 @@ class App {
4740
4740
  this.stopCallbacks = [];
4741
4741
  this.commitCallbacks = [];
4742
4742
  this.activityState = ActivityState.NotActive;
4743
- this.version = '16.1.3'; // TODO: version compatability check inside each plugin.
4743
+ this.version = '16.1.4'; // TODO: version compatability check inside each plugin.
4744
4744
  this.socketMode = false;
4745
4745
  this.compressionThreshold = 24 * 1000;
4746
4746
  this.bc = null;
@@ -8063,7 +8063,10 @@ function obscure(value) {
8063
8063
  const digits = numDigits(value);
8064
8064
  return "9".repeat(digits);
8065
8065
  }
8066
- return value.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g, '*');
8066
+ if (typeof value === "string") {
8067
+ return value.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g, '*');
8068
+ }
8069
+ return value;
8067
8070
  }
8068
8071
  function filterHeaders(headers) {
8069
8072
  const filteredHeaders = {};
@@ -8107,18 +8110,25 @@ function filterBody(body) {
8107
8110
  return JSON.stringify(parsedBody);
8108
8111
  }
8109
8112
  else {
8110
- try {
8111
- const params = new URLSearchParams(body);
8112
- for (const key of params.keys()) {
8113
- if (sensitiveParams.has(key.toLowerCase())) {
8114
- const value = obscure(params.get(key));
8115
- params.set(key, value);
8113
+ const isUrlSearch = typeof body === "string" && body.includes("?") && body.includes("=");
8114
+ if (isUrlSearch) {
8115
+ try {
8116
+ const params = new URLSearchParams(body);
8117
+ for (const key of params.keys()) {
8118
+ if (sensitiveParams.has(key.toLowerCase())) {
8119
+ const value = obscure(params.get(key));
8120
+ params.set(key, value);
8121
+ }
8116
8122
  }
8123
+ return params.toString();
8124
+ }
8125
+ catch (e) {
8126
+ // not url query ?
8127
+ return body;
8117
8128
  }
8118
- return params.toString();
8119
8129
  }
8120
- catch (e) {
8121
- // not string or url query
8130
+ else {
8131
+ // not json or url query
8122
8132
  return body;
8123
8133
  }
8124
8134
  }
@@ -9366,7 +9376,7 @@ class API {
9366
9376
  this.signalStartIssue = (reason, missingApi) => {
9367
9377
  const doNotTrack = this.checkDoNotTrack();
9368
9378
  console.log("Tracker couldn't start due to:", JSON.stringify({
9369
- trackerVersion: '16.1.3',
9379
+ trackerVersion: '16.1.4',
9370
9380
  projectKey: this.options.projectKey,
9371
9381
  doNotTrack,
9372
9382
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,