@openreplay/tracker 15.0.5-beta.0 → 15.0.5

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/index.js CHANGED
@@ -774,13 +774,10 @@ class ConditionsManager {
774
774
  this.conditions = [];
775
775
  this.hasStarted = false;
776
776
  this.createConditionFromFilter = (filter) => {
777
- if (filter.value.length) {
778
- const resultCondition = mapCondition(filter);
779
- if (resultCondition.type) {
780
- return resultCondition;
781
- }
777
+ const resultCondition = mapCondition(filter);
778
+ if (resultCondition.type) {
779
+ return resultCondition;
782
780
  }
783
- return undefined;
784
781
  };
785
782
  this.durationInt = null;
786
783
  }
@@ -1063,8 +1060,9 @@ const mapCondition = (condition) => {
1063
1060
  con = {
1064
1061
  type: 'session_duration',
1065
1062
  // @ts-ignore
1066
- value: condition.value[0],
1063
+ value: condition.value,
1067
1064
  key: '',
1065
+ operator: 'is',
1068
1066
  };
1069
1067
  break;
1070
1068
  case 'fetchUrl':
@@ -4705,7 +4703,7 @@ class App {
4705
4703
  this.stopCallbacks = [];
4706
4704
  this.commitCallbacks = [];
4707
4705
  this.activityState = ActivityState.NotActive;
4708
- this.version = '15.0.5-beta.0'; // TODO: version compatability check inside each plugin.
4706
+ this.version = '15.0.5'; // TODO: version compatability check inside each plugin.
4709
4707
  this.socketMode = false;
4710
4708
  this.compressionThreshold = 24 * 1000;
4711
4709
  this.bc = null;
@@ -4977,17 +4975,16 @@ class App {
4977
4975
  };
4978
4976
  this.flushBuffer = async (buffer) => {
4979
4977
  return new Promise((res) => {
4980
- let ended = false;
4981
- const messagesBatch = [buffer.shift()];
4982
- while (!ended) {
4983
- const nextMsg = buffer[0];
4984
- if (!nextMsg || nextMsg[0] === 0 /* MType.Timestamp */) {
4985
- ended = true;
4986
- }
4987
- else {
4988
- messagesBatch.push(buffer.shift());
4989
- }
4978
+ if (buffer.length === 0) {
4979
+ res(null);
4980
+ return;
4981
+ }
4982
+ // Since the first element is always a Timestamp, include it by default.
4983
+ let endIndex = 1;
4984
+ while (endIndex < buffer.length && buffer[endIndex][0] !== 0 /* MType.Timestamp */) {
4985
+ endIndex++;
4990
4986
  }
4987
+ const messagesBatch = buffer.splice(0, endIndex);
4991
4988
  this.postToWorker(messagesBatch);
4992
4989
  res(null);
4993
4990
  });
@@ -5371,7 +5368,6 @@ class App {
5371
5368
  postToWorker(messages) {
5372
5369
  this.worker?.postMessage(messages);
5373
5370
  this.commitCallbacks.forEach((cb) => cb(messages));
5374
- messages.length = 0;
5375
5371
  }
5376
5372
  timestamp() {
5377
5373
  return now() + this.delay;
@@ -8837,6 +8833,9 @@ function strMethod(method) {
8837
8833
  return typeof method === 'string' ? method.toUpperCase() : 'GET';
8838
8834
  }
8839
8835
  function Network (app, opts = {}) {
8836
+ if (opts.disabled) {
8837
+ return;
8838
+ }
8840
8839
  const options = Object.assign({
8841
8840
  failuresOnly: false,
8842
8841
  ignoreHeaders: ['cookie', 'set-cookie', 'authorization'],
@@ -9157,7 +9156,7 @@ class API {
9157
9156
  this.signalStartIssue = (reason, missingApi) => {
9158
9157
  const doNotTrack = this.checkDoNotTrack();
9159
9158
  console.log("Tracker couldn't start due to:", JSON.stringify({
9160
- trackerVersion: '15.0.5-beta.0',
9159
+ trackerVersion: '15.0.5',
9161
9160
  projectKey: this.options.projectKey,
9162
9161
  doNotTrack,
9163
9162
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
@@ -9265,7 +9264,10 @@ class API {
9265
9264
  Timing(app, options);
9266
9265
  Focus(app);
9267
9266
  Fonts(app);
9268
- Network(app, options.network);
9267
+ const skipNetwork = options.network?.disabled;
9268
+ if (!skipNetwork) {
9269
+ Network(app, options.network);
9270
+ }
9269
9271
  selection(app);
9270
9272
  window.__OPENREPLAY__ = this;
9271
9273
  if (options.flags && options.flags.onFlagsLoad) {