@oneuptime/react-native-replay 14.1.0 → 14.3.0

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.1.0" : "0.0.0-dev";
102
+ var RECORDER_VERSION = true ? "14.3.0" : "0.0.0-dev";
103
103
  var SESSION_REPLAY_MOBILE_RECORDER_CAPABILITIES = [
104
104
  "mobile-view-tree",
105
105
  "mobile-touch-events",
@@ -182,7 +182,8 @@ var UUID_SEGMENT = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12
182
182
  var OBJECT_ID_SEGMENT = /^[0-9a-f]{24}$/iu;
183
183
  var EMAIL_SEGMENT = /^[^@\s/]{1,64}@[^@\s/]{1,253}\.[^@\s/]{1,63}$/u;
184
184
  var LONG_DIGIT_SEGMENT = /^\d{9,}$/u;
185
- var OPAQUE_TOKEN_SEGMENT = /^[A-Za-z0-9_-]{32,}$/u;
185
+ var OPAQUE_TOKEN_SEGMENT = /^[A-Za-z0-9_+/-]{32,}={0,2}$/u;
186
+ var JWT_SEGMENT = /^eyJ[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*){1,4}$/u;
186
187
  var ABSOLUTE_URL_PATTERN = /^[A-Za-z][A-Za-z0-9+.-]*:\/\//;
187
188
  var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001F\u007F]/gu;
188
189
  function truncate(value, length) {
@@ -277,12 +278,16 @@ function sanitizeRoute(route) {
277
278
  }
278
279
  path = path.split("/").map((segment) => {
279
280
  let decoded = segment;
280
- try {
281
- decoded = decodeURIComponent(segment);
282
- } catch {
283
- decoded = segment;
281
+ for (let pass = 0; pass < 2; pass++) {
282
+ try {
283
+ decoded = decodeURIComponent(decoded);
284
+ } catch {
285
+ }
286
+ if (UUID_SEGMENT.test(decoded) || OBJECT_ID_SEGMENT.test(decoded) || EMAIL_SEGMENT.test(decoded) || LONG_DIGIT_SEGMENT.test(decoded) || OPAQUE_TOKEN_SEGMENT.test(decoded) || JWT_SEGMENT.test(decoded)) {
287
+ return "[redacted]";
288
+ }
284
289
  }
285
- return UUID_SEGMENT.test(decoded) || OBJECT_ID_SEGMENT.test(decoded) || EMAIL_SEGMENT.test(decoded) || LONG_DIGIT_SEGMENT.test(decoded) || OPAQUE_TOKEN_SEGMENT.test(decoded) ? "[redacted]" : segment;
290
+ return segment;
286
291
  }).join("/");
287
292
  return truncate(path.replace(CONTROL_CHARACTER_PATTERN, ""), 2048);
288
293
  }
@@ -574,12 +579,50 @@ function readCustomSignals(frustrationSignals) {
574
579
  }
575
580
  return signals;
576
581
  }
582
+ var ESCAPED_BYTE = /^%[0-9A-Fa-f]{2}$/;
583
+ var BEYOND_ASCII = /^[\u0080-\uffff]+$/;
584
+ var SPELLED_CHARACTER = /[%\u0080-\uffff]/;
585
+ function composed(text) {
586
+ return typeof text.normalize === "function" ? text.normalize("NFC") : text;
587
+ }
588
+ function readPathAsWritten(path) {
589
+ if (!SPELLED_CHARACTER.test(path)) {
590
+ return path;
591
+ }
592
+ let spelled = "";
593
+ let words = "";
594
+ let index = 0;
595
+ while (index < path.length) {
596
+ const escape = path.slice(index, index + 3);
597
+ if (!ESCAPED_BYTE.test(escape)) {
598
+ words += path.charAt(index);
599
+ index += 1;
600
+ continue;
601
+ }
602
+ const lead = parseInt(escape.slice(1), 16);
603
+ const length = lead < 194 ? 0 : lead < 224 ? 6 : lead < 240 ? 9 : 12;
604
+ let character = "";
605
+ try {
606
+ character = length ? decodeURIComponent(path.slice(index, index + length)) : "";
607
+ } catch {
608
+ }
609
+ if (BEYOND_ASCII.test(composed(character))) {
610
+ words += character;
611
+ index += length;
612
+ continue;
613
+ }
614
+ spelled += composed(words) + escape.toUpperCase();
615
+ words = "";
616
+ index += 3;
617
+ }
618
+ return spelled + composed(words);
619
+ }
577
620
  function canonicalPath(path) {
578
621
  let end = path.length;
579
622
  while (end > 1 && path.charAt(end - 1) === "/") {
580
623
  end--;
581
624
  }
582
- return path.slice(0, end).toLowerCase();
625
+ return readPathAsWritten(path.slice(0, end)).toLowerCase();
583
626
  }
584
627
  function matchesPagePattern(pattern, path) {
585
628
  const target = canonicalPath(path);