@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.cjs CHANGED
@@ -99,7 +99,7 @@ var SESSION_REPLAY_MAX_OFFLINE_DELAY_MS = 3 * 24 * 60 * 60 * 1e3;
99
99
  var MOBILE_CAPTURE_INTERVAL_MS = 500;
100
100
  var MOBILE_RECORDER_KIND = "rn-view-tree";
101
101
  var SYNTHETIC_RRWEB_VERSION = "synthetic-1";
102
- var RECORDER_VERSION = true ? "14.0.99" : "0.0.0-dev";
102
+ var RECORDER_VERSION = true ? "14.0.100" : "0.0.0-dev";
103
103
  var SESSION_REPLAY_MOBILE_RECORDER_CAPABILITIES = [
104
104
  "mobile-view-tree",
105
105
  "mobile-touch-events",
@@ -302,6 +302,8 @@ function byteLength(value) {
302
302
  }
303
303
 
304
304
  // src/ChunkBuffer.ts
305
+ var MAX_ROUTES_PER_CHUNK = 32;
306
+ var MAX_ROUTE_BYTES_PER_CHUNK = 2 * 1024;
305
307
  var ReplayChunkBuffer = class {
306
308
  constructor() {
307
309
  __publicField(this, "events", []);
@@ -309,7 +311,9 @@ var ReplayChunkBuffer = class {
309
311
  __publicField(this, "startUnixMs", 0);
310
312
  __publicField(this, "endUnixMs", 0);
311
313
  __publicField(this, "hasFullSnapshot", false);
314
+ /* In the order visited: a return to a screen is what a journey is read from. */
312
315
  __publicField(this, "routes", []);
316
+ __publicField(this, "routeBytes", 0);
313
317
  __publicField(this, "fidelity", /* @__PURE__ */ new Set());
314
318
  __publicField(this, "signals", emptySignalCounts());
315
319
  __publicField(this, "droppedEvents", 0);
@@ -335,8 +339,8 @@ var ReplayChunkBuffer = class {
335
339
  if (event.type === 2 /* FullSnapshot */) {
336
340
  this.hasFullSnapshot = true;
337
341
  }
338
- if (options?.route && !this.routes.includes(options.route)) {
339
- this.routes.push(options.route);
342
+ if (options?.route) {
343
+ this.addRoute(options.route);
340
344
  }
341
345
  for (const notice of options?.fidelityNotices ?? []) {
342
346
  this.fidelity.add(notice);
@@ -384,6 +388,17 @@ var ReplayChunkBuffer = class {
384
388
  clear() {
385
389
  this.reset();
386
390
  }
391
+ addRoute(route) {
392
+ if (this.routes.length >= MAX_ROUTES_PER_CHUNK || this.routes[this.routes.length - 1] === route) {
393
+ return;
394
+ }
395
+ const bytes = byteLength(route);
396
+ if (this.routeBytes + bytes > MAX_ROUTE_BYTES_PER_CHUNK) {
397
+ return;
398
+ }
399
+ this.routeBytes += bytes;
400
+ this.routes.push(route);
401
+ }
387
402
  reset() {
388
403
  this.events = [];
389
404
  this.approximateBytes = 2;
@@ -391,6 +406,7 @@ var ReplayChunkBuffer = class {
391
406
  this.endUnixMs = 0;
392
407
  this.hasFullSnapshot = false;
393
408
  this.routes = [];
409
+ this.routeBytes = 0;
394
410
  this.fidelity.clear();
395
411
  this.signals = emptySignalCounts();
396
412
  this.droppedEvents = 0;