@oneuptime/react-native-replay 14.0.99 → 14.0.100

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/index.js CHANGED
@@ -60,7 +60,7 @@ var SESSION_REPLAY_MAX_OFFLINE_DELAY_MS = 3 * 24 * 60 * 60 * 1e3;
60
60
  var MOBILE_CAPTURE_INTERVAL_MS = 500;
61
61
  var MOBILE_RECORDER_KIND = "rn-view-tree";
62
62
  var SYNTHETIC_RRWEB_VERSION = "synthetic-1";
63
- var RECORDER_VERSION = true ? "14.0.99" : "0.0.0-dev";
63
+ var RECORDER_VERSION = true ? "14.0.100" : "0.0.0-dev";
64
64
  var SESSION_REPLAY_MOBILE_RECORDER_CAPABILITIES = [
65
65
  "mobile-view-tree",
66
66
  "mobile-touch-events",
@@ -263,6 +263,8 @@ function byteLength(value) {
263
263
  }
264
264
 
265
265
  // src/ChunkBuffer.ts
266
+ var MAX_ROUTES_PER_CHUNK = 32;
267
+ var MAX_ROUTE_BYTES_PER_CHUNK = 2 * 1024;
266
268
  var ReplayChunkBuffer = class {
267
269
  constructor() {
268
270
  __publicField(this, "events", []);
@@ -270,7 +272,9 @@ var ReplayChunkBuffer = class {
270
272
  __publicField(this, "startUnixMs", 0);
271
273
  __publicField(this, "endUnixMs", 0);
272
274
  __publicField(this, "hasFullSnapshot", false);
275
+ /* In the order visited: a return to a screen is what a journey is read from. */
273
276
  __publicField(this, "routes", []);
277
+ __publicField(this, "routeBytes", 0);
274
278
  __publicField(this, "fidelity", /* @__PURE__ */ new Set());
275
279
  __publicField(this, "signals", emptySignalCounts());
276
280
  __publicField(this, "droppedEvents", 0);
@@ -296,8 +300,8 @@ var ReplayChunkBuffer = class {
296
300
  if (event.type === 2 /* FullSnapshot */) {
297
301
  this.hasFullSnapshot = true;
298
302
  }
299
- if (options?.route && !this.routes.includes(options.route)) {
300
- this.routes.push(options.route);
303
+ if (options?.route) {
304
+ this.addRoute(options.route);
301
305
  }
302
306
  for (const notice of options?.fidelityNotices ?? []) {
303
307
  this.fidelity.add(notice);
@@ -345,6 +349,17 @@ var ReplayChunkBuffer = class {
345
349
  clear() {
346
350
  this.reset();
347
351
  }
352
+ addRoute(route) {
353
+ if (this.routes.length >= MAX_ROUTES_PER_CHUNK || this.routes[this.routes.length - 1] === route) {
354
+ return;
355
+ }
356
+ const bytes = byteLength(route);
357
+ if (this.routeBytes + bytes > MAX_ROUTE_BYTES_PER_CHUNK) {
358
+ return;
359
+ }
360
+ this.routeBytes += bytes;
361
+ this.routes.push(route);
362
+ }
348
363
  reset() {
349
364
  this.events = [];
350
365
  this.approximateBytes = 2;
@@ -352,6 +367,7 @@ var ReplayChunkBuffer = class {
352
367
  this.endUnixMs = 0;
353
368
  this.hasFullSnapshot = false;
354
369
  this.routes = [];
370
+ this.routeBytes = 0;
355
371
  this.fidelity.clear();
356
372
  this.signals = emptySignalCounts();
357
373
  this.droppedEvents = 0;