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