@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.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.1.0" : "0.0.0-dev";
63
+ var RECORDER_VERSION = true ? "14.3.0" : "0.0.0-dev";
64
64
  var SESSION_REPLAY_MOBILE_RECORDER_CAPABILITIES = [
65
65
  "mobile-view-tree",
66
66
  "mobile-touch-events",
@@ -143,7 +143,8 @@ var UUID_SEGMENT = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12
143
143
  var OBJECT_ID_SEGMENT = /^[0-9a-f]{24}$/iu;
144
144
  var EMAIL_SEGMENT = /^[^@\s/]{1,64}@[^@\s/]{1,253}\.[^@\s/]{1,63}$/u;
145
145
  var LONG_DIGIT_SEGMENT = /^\d{9,}$/u;
146
- var OPAQUE_TOKEN_SEGMENT = /^[A-Za-z0-9_-]{32,}$/u;
146
+ var OPAQUE_TOKEN_SEGMENT = /^[A-Za-z0-9_+/-]{32,}={0,2}$/u;
147
+ var JWT_SEGMENT = /^eyJ[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*){1,4}$/u;
147
148
  var ABSOLUTE_URL_PATTERN = /^[A-Za-z][A-Za-z0-9+.-]*:\/\//;
148
149
  var CONTROL_CHARACTER_PATTERN = /[\u0000-\u001F\u007F]/gu;
149
150
  function truncate(value, length) {
@@ -238,12 +239,16 @@ function sanitizeRoute(route) {
238
239
  }
239
240
  path = path.split("/").map((segment) => {
240
241
  let decoded = segment;
241
- try {
242
- decoded = decodeURIComponent(segment);
243
- } catch {
244
- decoded = segment;
242
+ for (let pass = 0; pass < 2; pass++) {
243
+ try {
244
+ decoded = decodeURIComponent(decoded);
245
+ } catch {
246
+ }
247
+ 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)) {
248
+ return "[redacted]";
249
+ }
245
250
  }
246
- 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;
251
+ return segment;
247
252
  }).join("/");
248
253
  return truncate(path.replace(CONTROL_CHARACTER_PATTERN, ""), 2048);
249
254
  }
@@ -535,12 +540,50 @@ function readCustomSignals(frustrationSignals) {
535
540
  }
536
541
  return signals;
537
542
  }
543
+ var ESCAPED_BYTE = /^%[0-9A-Fa-f]{2}$/;
544
+ var BEYOND_ASCII = /^[\u0080-\uffff]+$/;
545
+ var SPELLED_CHARACTER = /[%\u0080-\uffff]/;
546
+ function composed(text) {
547
+ return typeof text.normalize === "function" ? text.normalize("NFC") : text;
548
+ }
549
+ function readPathAsWritten(path) {
550
+ if (!SPELLED_CHARACTER.test(path)) {
551
+ return path;
552
+ }
553
+ let spelled = "";
554
+ let words = "";
555
+ let index = 0;
556
+ while (index < path.length) {
557
+ const escape = path.slice(index, index + 3);
558
+ if (!ESCAPED_BYTE.test(escape)) {
559
+ words += path.charAt(index);
560
+ index += 1;
561
+ continue;
562
+ }
563
+ const lead = parseInt(escape.slice(1), 16);
564
+ const length = lead < 194 ? 0 : lead < 224 ? 6 : lead < 240 ? 9 : 12;
565
+ let character = "";
566
+ try {
567
+ character = length ? decodeURIComponent(path.slice(index, index + length)) : "";
568
+ } catch {
569
+ }
570
+ if (BEYOND_ASCII.test(composed(character))) {
571
+ words += character;
572
+ index += length;
573
+ continue;
574
+ }
575
+ spelled += composed(words) + escape.toUpperCase();
576
+ words = "";
577
+ index += 3;
578
+ }
579
+ return spelled + composed(words);
580
+ }
538
581
  function canonicalPath(path) {
539
582
  let end = path.length;
540
583
  while (end > 1 && path.charAt(end - 1) === "/") {
541
584
  end--;
542
585
  }
543
- return path.slice(0, end).toLowerCase();
586
+ return readPathAsWritten(path.slice(0, end)).toLowerCase();
544
587
  }
545
588
  function matchesPagePattern(pattern, path) {
546
589
  const target = canonicalPath(path);