@openreplay/tracker 16.1.0-beta.0 → 16.1.0-beta.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.
package/dist/cjs/entry.js CHANGED
@@ -725,7 +725,9 @@ class StringDictionary {
725
725
  this.backDict = {};
726
726
  this.getKey = (str) => {
727
727
  let isNew = false;
728
- if (!this.backDict[str]) {
728
+ // avoiding potential native object properties
729
+ const safeKey = `__${str}`;
730
+ if (!this.backDict[safeKey]) {
729
731
  isNew = true;
730
732
  // shaving the first 2 digits of the timestamp (since they are irrelevant for next millennia)
731
733
  const shavedTs = Date.now() % 10 ** (13 - 2);
@@ -737,10 +739,10 @@ class StringDictionary {
737
739
  else {
738
740
  this.lastSuffix = 1;
739
741
  }
740
- this.backDict[str] = id;
742
+ this.backDict[safeKey] = id;
741
743
  this.lastTs = shavedTs;
742
744
  }
743
- return [this.backDict[str], isNew];
745
+ return [this.backDict[safeKey], isNew];
744
746
  };
745
747
  }
746
748
  }
@@ -4710,7 +4712,7 @@ class App {
4710
4712
  this.stopCallbacks = [];
4711
4713
  this.commitCallbacks = [];
4712
4714
  this.activityState = ActivityState.NotActive;
4713
- this.version = '16.1.0-beta.0'; // TODO: version compatability check inside each plugin.
4715
+ this.version = '16.1.0-beta.10'; // TODO: version compatability check inside each plugin.
4714
4716
  this.socketMode = false;
4715
4717
  this.compressionThreshold = 24 * 1000;
4716
4718
  this.bc = null;
@@ -5345,15 +5347,19 @@ class App {
5345
5347
  requestIdleCb(() => {
5346
5348
  this.messages.unshift(TabData(this.session.getTabId()));
5347
5349
  this.messages.unshift(Timestamp(this.timestamp()));
5348
- if (this.messages.length > 3) {
5349
- console.log(this.messages);
5350
- }
5351
5350
  try {
5352
5351
  this.worker?.postMessage(this.messages);
5353
5352
  }
5354
5353
  catch (e) {
5355
- console.log(this.messages);
5356
5354
  console.error(e);
5355
+ this.messages.forEach(m => {
5356
+ try {
5357
+ this.worker?.postMessage([m]);
5358
+ }
5359
+ catch (e) {
5360
+ console.error(m, e);
5361
+ }
5362
+ });
5357
5363
  }
5358
5364
  this.commitCallbacks.forEach((cb) => cb(this.messages));
5359
5365
  this.messages.length = 0;
@@ -9182,7 +9188,7 @@ class API {
9182
9188
  this.signalStartIssue = (reason, missingApi) => {
9183
9189
  const doNotTrack = this.checkDoNotTrack();
9184
9190
  console.log("Tracker couldn't start due to:", JSON.stringify({
9185
- trackerVersion: '16.1.0-beta.0',
9191
+ trackerVersion: '16.1.0-beta.10',
9186
9192
  projectKey: this.options.projectKey,
9187
9193
  doNotTrack,
9188
9194
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,