@oneuptime/react-native-replay 14.0.105 → 14.0.107
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/README.md +24 -2
- package/android/.gradle/9.8.1/checksums/checksums.lock +0 -0
- package/android/.gradle/9.8.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/9.8.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/9.8.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/9.8.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/dist/index.cjs +339 -4
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +339 -4
- package/dist/index.js.map +3 -3
- package/dist/types/ChunkBuffer.d.ts +10 -2
- package/dist/types/ChunkBuffer.d.ts.map +1 -1
- package/dist/types/Config.d.ts +5 -1
- package/dist/types/Config.d.ts.map +1 -1
- package/dist/types/Contract.d.ts +58 -0
- package/dist/types/Contract.d.ts.map +1 -1
- package/dist/types/CustomSignals.d.ts +22 -0
- package/dist/types/CustomSignals.d.ts.map +1 -0
- package/dist/types/MobileReplayRecorder.d.ts +3 -0
- package/dist/types/MobileReplayRecorder.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,8 +70,8 @@ await OneUptimeReplay.start({
|
|
|
70
70
|
token: "YOUR_TELEMETRY_INGESTION_KEY",
|
|
71
71
|
appIdentifier: "YOUR_RUM_APPLICATION_IDENTIFIER",
|
|
72
72
|
mobileAppIdentifier: "com.example.checkout",
|
|
73
|
-
appName: "Checkout",
|
|
74
|
-
appVersion: "2.4.1",
|
|
73
|
+
appName: "Checkout", // optional metadata override
|
|
74
|
+
appVersion: "2.4.1", // optional metadata override
|
|
75
75
|
userRef: "support-user-42", // optional targeting reference
|
|
76
76
|
});
|
|
77
77
|
|
|
@@ -184,6 +184,28 @@ it can be safely restored. The SDK never takes ownership of an application
|
|
|
184
184
|
handler it cannot restore. In error-triggered mode a bounded 60-second/2 MiB
|
|
185
185
|
pre-roll is uploaded after a manual or JavaScript error trigger.
|
|
186
186
|
|
|
187
|
+
## Frustration signals of your own
|
|
188
|
+
|
|
189
|
+
A RUM application can name signals of its own on its **Frustration Signals**
|
|
190
|
+
page in OneUptime, and this SDK detects three kinds of them with no code change:
|
|
191
|
+
|
|
192
|
+
| signal | fires when |
|
|
193
|
+
| ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
194
|
+
| page | `setRoute()` moves to a route whose path matches the pattern (`*` stands for any characters; case, query and fragment are ignored) |
|
|
195
|
+
| event | `track()` is called with that event name (case is ignored) |
|
|
196
|
+
| error | a JavaScript error or `captureError()` carries a message containing the given words (case is ignored) |
|
|
197
|
+
|
|
198
|
+
A hit is recorded as a marker carrying the signal's **name** only - never the
|
|
199
|
+
route, the event's properties or the error's text, which are only compared on
|
|
200
|
+
the device - and counted on the chunk. A signal that counts as frustration
|
|
201
|
+
starts the upload in error-triggered mode, like an error. The same name fires
|
|
202
|
+
at most once a second, and a chunk holds at most 50 markers. Nothing is
|
|
203
|
+
detected while capture is paused because nobody is using the app.
|
|
204
|
+
|
|
205
|
+
Signals that react to a click on an element are CSS selectors on a web page,
|
|
206
|
+
and the built-in rage, dead and error clicks and refresh rage are about a mouse
|
|
207
|
+
on a web page: the browser recorder detects those, and this SDK leaves them out.
|
|
208
|
+
|
|
187
209
|
## Diagnostics
|
|
188
210
|
|
|
189
211
|
```ts
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
2
|
-
gradle.version=9.
|
|
1
|
+
#Tue Nov 10 18:35:10 GMT 2026
|
|
2
|
+
gradle.version=9.8.1
|
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.
|
|
102
|
+
var RECORDER_VERSION = true ? "14.0.107" : "0.0.0-dev";
|
|
103
103
|
var SESSION_REPLAY_MOBILE_RECORDER_CAPABILITIES = [
|
|
104
104
|
"mobile-view-tree",
|
|
105
105
|
"mobile-touch-events",
|
|
@@ -144,6 +144,12 @@ var SessionReplayFidelityNotice = /* @__PURE__ */ ((SessionReplayFidelityNotice2
|
|
|
144
144
|
SessionReplayFidelityNotice2["SnapshotTooLarge"] = "snapshot-too-large";
|
|
145
145
|
return SessionReplayFidelityNotice2;
|
|
146
146
|
})(SessionReplayFidelityNotice || {});
|
|
147
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNALS = 20;
|
|
148
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNAL_NAME_LENGTH = 40;
|
|
149
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNAL_MATCH_LENGTH = 200;
|
|
150
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNAL_EVENT_NAME_LENGTH = 64;
|
|
151
|
+
var SESSION_REPLAY_CUSTOM_SIGNAL_COOLDOWN_MS = 1e3;
|
|
152
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNAL_EVENTS_PER_CHUNK = 50;
|
|
147
153
|
var ROUTE_CUSTOM_EVENT_TAG = "oneuptime.route";
|
|
148
154
|
var ERROR_CUSTOM_EVENT_TAG = "oneuptime.error";
|
|
149
155
|
var CUSTOM_EVENT_TAG = "oneuptime.custom";
|
|
@@ -152,6 +158,7 @@ var TAGS_CUSTOM_EVENT_TAG = "oneuptime.tags";
|
|
|
152
158
|
var VISIBILITY_CUSTOM_EVENT_TAG = "oneuptime.visibility";
|
|
153
159
|
var TOUCH_CUSTOM_EVENT_TAG = "oneuptime.touch";
|
|
154
160
|
var SESSION_ROTATED_CUSTOM_EVENT_TAG = "oneuptime.session-rotated";
|
|
161
|
+
var CUSTOM_SIGNAL_CUSTOM_EVENT_TAG = "oneuptime.signal";
|
|
155
162
|
var IDLE_PAUSED_CUSTOM_EVENT_TAG = "oneuptime.idle-paused";
|
|
156
163
|
var IDLE_RESUMED_CUSTOM_EVENT_TAG = "oneuptime.idle-resumed";
|
|
157
164
|
|
|
@@ -317,6 +324,7 @@ var ReplayChunkBuffer = class {
|
|
|
317
324
|
__publicField(this, "fidelity", /* @__PURE__ */ new Set());
|
|
318
325
|
__publicField(this, "signals", emptySignalCounts());
|
|
319
326
|
__publicField(this, "droppedEvents", 0);
|
|
327
|
+
__publicField(this, "customSignalEvents", 0);
|
|
320
328
|
}
|
|
321
329
|
append(event, options) {
|
|
322
330
|
let serialized;
|
|
@@ -349,8 +357,43 @@ var ReplayChunkBuffer = class {
|
|
|
349
357
|
const current = this.signals[options.signal] ?? 0;
|
|
350
358
|
this.signals[options.signal] = current + 1;
|
|
351
359
|
}
|
|
360
|
+
if (options?.customSignal) {
|
|
361
|
+
this.countCustomSignal(
|
|
362
|
+
options.customSignal.name,
|
|
363
|
+
options.customSignal.isFrustration
|
|
364
|
+
);
|
|
365
|
+
}
|
|
352
366
|
return true;
|
|
353
367
|
}
|
|
368
|
+
/*
|
|
369
|
+
* Whether this chunk takes another signal marker. Capped like the
|
|
370
|
+
* browser's: a signal that fires in a loop is one moment a second (the
|
|
371
|
+
* matcher's cooldown), and fifty of them a chunk is plenty to see it.
|
|
372
|
+
*/
|
|
373
|
+
hasRoomForCustomSignal() {
|
|
374
|
+
return this.customSignalEvents < SESSION_REPLAY_MAX_CUSTOM_SIGNAL_EVENTS_PER_CHUNK;
|
|
375
|
+
}
|
|
376
|
+
countCustomSignal(name, isFrustration) {
|
|
377
|
+
this.customSignalEvents += 1;
|
|
378
|
+
const counts = this.signals.customSignals ?? [];
|
|
379
|
+
let entry = counts.find(
|
|
380
|
+
(candidate) => {
|
|
381
|
+
return candidate.name === name;
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
if (!entry) {
|
|
385
|
+
if (counts.length >= SESSION_REPLAY_MAX_CUSTOM_SIGNALS) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
entry = { name, count: 0, frustrationCount: 0 };
|
|
389
|
+
counts.push(entry);
|
|
390
|
+
}
|
|
391
|
+
entry.count += 1;
|
|
392
|
+
if (isFrustration) {
|
|
393
|
+
entry.frustrationCount += 1;
|
|
394
|
+
}
|
|
395
|
+
this.signals.customSignals = counts;
|
|
396
|
+
}
|
|
354
397
|
appendMany(events, options) {
|
|
355
398
|
let accepted = 0;
|
|
356
399
|
for (const event of events) {
|
|
@@ -378,7 +421,7 @@ var ReplayChunkBuffer = class {
|
|
|
378
421
|
endUnixMs: this.endUnixMs,
|
|
379
422
|
hasFullSnapshot: this.hasFullSnapshot,
|
|
380
423
|
routes: this.routes.slice(),
|
|
381
|
-
signals:
|
|
424
|
+
signals: this.copySignals(),
|
|
382
425
|
fidelityNotices: Array.from(this.fidelity),
|
|
383
426
|
droppedEvents: this.droppedEvents
|
|
384
427
|
};
|
|
@@ -388,6 +431,18 @@ var ReplayChunkBuffer = class {
|
|
|
388
431
|
clear() {
|
|
389
432
|
this.reset();
|
|
390
433
|
}
|
|
434
|
+
/* The counts, with each signal's own entry copied too. */
|
|
435
|
+
copySignals() {
|
|
436
|
+
const signals = { ...this.signals };
|
|
437
|
+
if (this.signals.customSignals) {
|
|
438
|
+
signals.customSignals = this.signals.customSignals.map(
|
|
439
|
+
(entry) => {
|
|
440
|
+
return { ...entry };
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
return signals;
|
|
445
|
+
}
|
|
391
446
|
addRoute(route) {
|
|
392
447
|
if (this.routes.length >= MAX_ROUTES_PER_CHUNK || this.routes[this.routes.length - 1] === route) {
|
|
393
448
|
return;
|
|
@@ -410,6 +465,7 @@ var ReplayChunkBuffer = class {
|
|
|
410
465
|
this.fidelity.clear();
|
|
411
466
|
this.signals = emptySignalCounts();
|
|
412
467
|
this.droppedEvents = 0;
|
|
468
|
+
this.customSignalEvents = 0;
|
|
413
469
|
}
|
|
414
470
|
};
|
|
415
471
|
var RollingReplayBuffer = class {
|
|
@@ -455,6 +511,189 @@ var RollingReplayBuffer = class {
|
|
|
455
511
|
}
|
|
456
512
|
};
|
|
457
513
|
|
|
514
|
+
// src/CustomSignals.ts
|
|
515
|
+
var TRIGGERS = [
|
|
516
|
+
"click",
|
|
517
|
+
"page",
|
|
518
|
+
"event",
|
|
519
|
+
"error"
|
|
520
|
+
];
|
|
521
|
+
function asRecord(value) {
|
|
522
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
523
|
+
}
|
|
524
|
+
function isTrigger(value) {
|
|
525
|
+
return typeof value === "string" && TRIGGERS.indexOf(value) !== -1;
|
|
526
|
+
}
|
|
527
|
+
function readCustomSignal(value) {
|
|
528
|
+
const record = asRecord(value);
|
|
529
|
+
const name = typeof record["name"] === "string" ? record["name"].trim() : "";
|
|
530
|
+
const trigger = record["trigger"];
|
|
531
|
+
const match = typeof record["match"] === "string" ? record["match"].trim() : "";
|
|
532
|
+
if (name.length === 0 || name.length > SESSION_REPLAY_MAX_CUSTOM_SIGNAL_NAME_LENGTH || !isTrigger(trigger) || match.length === 0 || match.length > (trigger === "event" ? SESSION_REPLAY_MAX_CUSTOM_SIGNAL_EVENT_NAME_LENGTH : SESSION_REPLAY_MAX_CUSTOM_SIGNAL_MATCH_LENGTH) || trigger === "page" && match.charAt(0) !== "/" && match.charAt(0) !== "*") {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
return {
|
|
536
|
+
name,
|
|
537
|
+
trigger,
|
|
538
|
+
match,
|
|
539
|
+
isFrustration: record["isFrustration"] !== false,
|
|
540
|
+
isEnabled: record["isEnabled"] !== false
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
function readCustomSignals(frustrationSignals) {
|
|
544
|
+
const list = asRecord(frustrationSignals)["customSignals"];
|
|
545
|
+
const read = [];
|
|
546
|
+
const seenNames = [];
|
|
547
|
+
if (Array.isArray(list)) {
|
|
548
|
+
for (const entry of list) {
|
|
549
|
+
const signal = readCustomSignal(entry);
|
|
550
|
+
if (!signal) {
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
const key = signal.name.toLowerCase();
|
|
554
|
+
if (seenNames.indexOf(key) !== -1) {
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
seenNames.push(key);
|
|
558
|
+
read.push(signal);
|
|
559
|
+
if (read.length >= SESSION_REPLAY_MAX_CUSTOM_SIGNALS) {
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
const signals = [];
|
|
565
|
+
for (const signal of read) {
|
|
566
|
+
if (signal.isEnabled && signal.trigger !== "click") {
|
|
567
|
+
signals.push({
|
|
568
|
+
name: signal.name,
|
|
569
|
+
trigger: signal.trigger,
|
|
570
|
+
match: signal.match,
|
|
571
|
+
isFrustration: signal.isFrustration
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
return signals;
|
|
576
|
+
}
|
|
577
|
+
function canonicalPath(path) {
|
|
578
|
+
let end = path.length;
|
|
579
|
+
while (end > 1 && path.charAt(end - 1) === "/") {
|
|
580
|
+
end--;
|
|
581
|
+
}
|
|
582
|
+
return path.slice(0, end).toLowerCase();
|
|
583
|
+
}
|
|
584
|
+
function matchesPagePattern(pattern, path) {
|
|
585
|
+
const target = canonicalPath(path);
|
|
586
|
+
const pieces = canonicalPath(pattern.trim()).split("*");
|
|
587
|
+
if (pieces.length === 1) {
|
|
588
|
+
return target === pieces[0];
|
|
589
|
+
}
|
|
590
|
+
const first = pieces[0] || "";
|
|
591
|
+
const last = pieces[pieces.length - 1] || "";
|
|
592
|
+
if (target.slice(0, first.length) !== first) {
|
|
593
|
+
return false;
|
|
594
|
+
}
|
|
595
|
+
let position = first.length;
|
|
596
|
+
for (let index = 1; index < pieces.length - 1; index++) {
|
|
597
|
+
const piece = pieces[index] || "";
|
|
598
|
+
if (piece.length === 0) {
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
const found = target.indexOf(piece, position);
|
|
602
|
+
if (found === -1) {
|
|
603
|
+
return false;
|
|
604
|
+
}
|
|
605
|
+
position = found + piece.length;
|
|
606
|
+
}
|
|
607
|
+
return target.length - position >= last.length && target.slice(target.length - last.length) === last;
|
|
608
|
+
}
|
|
609
|
+
function matchesErrorText(match, text) {
|
|
610
|
+
return match.length > 0 && text.toLowerCase().indexOf(match.toLowerCase()) !== -1;
|
|
611
|
+
}
|
|
612
|
+
function matchesEventName(match, name) {
|
|
613
|
+
return match.trim().toLowerCase() === name.trim().toLowerCase();
|
|
614
|
+
}
|
|
615
|
+
function routeMatchPath(route) {
|
|
616
|
+
let path = typeof route === "string" ? route.trim() : "";
|
|
617
|
+
const scheme = path.indexOf("://");
|
|
618
|
+
if (scheme > 0 && scheme < 32) {
|
|
619
|
+
const pathStart = path.indexOf("/", scheme + 3);
|
|
620
|
+
path = pathStart === -1 ? "/" : path.slice(pathStart);
|
|
621
|
+
}
|
|
622
|
+
let end = path.length;
|
|
623
|
+
for (const separator of ["?", "#"]) {
|
|
624
|
+
const at = path.indexOf(separator);
|
|
625
|
+
if (at !== -1 && at < end) {
|
|
626
|
+
end = at;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
path = path.slice(0, end);
|
|
630
|
+
return path.charAt(0) === "/" ? path : `/${path}`;
|
|
631
|
+
}
|
|
632
|
+
var CustomSignalMatcher = class {
|
|
633
|
+
constructor() {
|
|
634
|
+
__publicField(this, "lastFiredAt", /* @__PURE__ */ new Map());
|
|
635
|
+
}
|
|
636
|
+
matchPage(signals, route, atUnixMs) {
|
|
637
|
+
const path = routeMatchPath(route);
|
|
638
|
+
return this.collect(
|
|
639
|
+
signals,
|
|
640
|
+
"page",
|
|
641
|
+
atUnixMs,
|
|
642
|
+
(signal) => {
|
|
643
|
+
return matchesPagePattern(signal.match, path);
|
|
644
|
+
}
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
matchEvent(signals, eventName, atUnixMs) {
|
|
648
|
+
return this.collect(
|
|
649
|
+
signals,
|
|
650
|
+
"event",
|
|
651
|
+
atUnixMs,
|
|
652
|
+
(signal) => {
|
|
653
|
+
return matchesEventName(signal.match, eventName);
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
matchErrorText(signals, text, atUnixMs) {
|
|
658
|
+
if (!text) {
|
|
659
|
+
return [];
|
|
660
|
+
}
|
|
661
|
+
return this.collect(
|
|
662
|
+
signals,
|
|
663
|
+
"error",
|
|
664
|
+
atUnixMs,
|
|
665
|
+
(signal) => {
|
|
666
|
+
return matchesErrorText(signal.match, text);
|
|
667
|
+
}
|
|
668
|
+
);
|
|
669
|
+
}
|
|
670
|
+
/* A new session starts with no signal cooling down. */
|
|
671
|
+
reset() {
|
|
672
|
+
this.lastFiredAt.clear();
|
|
673
|
+
}
|
|
674
|
+
collect(signals, trigger, atUnixMs, matches) {
|
|
675
|
+
const hits = [];
|
|
676
|
+
for (const signal of signals) {
|
|
677
|
+
if (signal.trigger !== trigger || !matches(signal)) {
|
|
678
|
+
continue;
|
|
679
|
+
}
|
|
680
|
+
const key = signal.name.toLowerCase();
|
|
681
|
+
const last = this.lastFiredAt.get(key);
|
|
682
|
+
if (last !== void 0 && atUnixMs >= last && atUnixMs - last < SESSION_REPLAY_CUSTOM_SIGNAL_COOLDOWN_MS) {
|
|
683
|
+
continue;
|
|
684
|
+
}
|
|
685
|
+
this.lastFiredAt.set(key, atUnixMs);
|
|
686
|
+
hits.push({
|
|
687
|
+
name: signal.name,
|
|
688
|
+
trigger,
|
|
689
|
+
isFrustration: signal.isFrustration,
|
|
690
|
+
atUnixMs
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
return hits;
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
|
|
458
697
|
// src/Config.ts
|
|
459
698
|
var CONFIG_FETCH_TIMEOUT_MS = 5e3;
|
|
460
699
|
var MOBILE_APP_IDENTIFIER_LABEL_PATTERN = /^[a-z0-9_-]+$/u;
|
|
@@ -569,6 +808,7 @@ function failClosed(reason) {
|
|
|
569
808
|
captureUserIdentity: false,
|
|
570
809
|
configEpoch: 0,
|
|
571
810
|
isTargeted: false,
|
|
811
|
+
frustrationSignals: { customSignals: [] },
|
|
572
812
|
disabledReason: reason
|
|
573
813
|
};
|
|
574
814
|
}
|
|
@@ -590,7 +830,14 @@ function normalizeReplayConfig(value) {
|
|
|
590
830
|
samplePercentage,
|
|
591
831
|
captureUserIdentity: config.captureUserIdentity === true,
|
|
592
832
|
configEpoch: typeof config.configEpoch === "number" && Number.isSafeInteger(config.configEpoch) && config.configEpoch >= 0 ? config.configEpoch : 0,
|
|
593
|
-
isTargeted: config.isTargeted === true
|
|
833
|
+
isTargeted: config.isTargeted === true,
|
|
834
|
+
/*
|
|
835
|
+
* A server from before frustration settings sends none: no signals of
|
|
836
|
+
* the application's own, which is what such an application has.
|
|
837
|
+
*/
|
|
838
|
+
frustrationSignals: {
|
|
839
|
+
customSignals: readCustomSignals(config.frustrationSignals)
|
|
840
|
+
}
|
|
594
841
|
};
|
|
595
842
|
if (typeof config.disabledReason === "string") {
|
|
596
843
|
resolved.disabledReason = config.disabledReason.slice(0, 100);
|
|
@@ -3026,6 +3273,18 @@ var SAFE_ERROR_NAMES = /* @__PURE__ */ new Set([
|
|
|
3026
3273
|
"TypeError",
|
|
3027
3274
|
"URIError"
|
|
3028
3275
|
]);
|
|
3276
|
+
function errorText(error) {
|
|
3277
|
+
if (typeof error === "string") {
|
|
3278
|
+
return error;
|
|
3279
|
+
}
|
|
3280
|
+
if (error && typeof error === "object") {
|
|
3281
|
+
const message = error.message;
|
|
3282
|
+
if (typeof message === "string") {
|
|
3283
|
+
return message;
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
return "";
|
|
3287
|
+
}
|
|
3029
3288
|
function defaultNow() {
|
|
3030
3289
|
return Date.now();
|
|
3031
3290
|
}
|
|
@@ -3091,6 +3350,8 @@ var MobileReplayRecorder = class {
|
|
|
3091
3350
|
__publicField(this, "now");
|
|
3092
3351
|
__publicField(this, "serializer", new ViewTreeSerializer());
|
|
3093
3352
|
__publicField(this, "chunkBuffer", new ReplayChunkBuffer());
|
|
3353
|
+
/* The application's own page, event and error signals (issue #6443). */
|
|
3354
|
+
__publicField(this, "customSignalMatcher", new CustomSignalMatcher());
|
|
3094
3355
|
__publicField(this, "rollingBuffer", new RollingReplayBuffer());
|
|
3095
3356
|
__publicField(this, "diagnosticsStatus", "idle");
|
|
3096
3357
|
__publicField(this, "diagnosticsEvents", []);
|
|
@@ -3315,6 +3576,7 @@ var MobileReplayRecorder = class {
|
|
|
3315
3576
|
this.resetTouchSequences();
|
|
3316
3577
|
this.idlePause = null;
|
|
3317
3578
|
this.idleResumeBacklog = null;
|
|
3579
|
+
this.customSignalMatcher.reset();
|
|
3318
3580
|
const validated = validateStartOptions(options);
|
|
3319
3581
|
if (!validated) {
|
|
3320
3582
|
this.disable("invalid-start-options");
|
|
@@ -3641,6 +3903,15 @@ var MobileReplayRecorder = class {
|
|
|
3641
3903
|
{ name: eventName, properties: sanitizedProperties },
|
|
3642
3904
|
"customEventCount"
|
|
3643
3905
|
);
|
|
3906
|
+
if (this.recordCustomSignals(
|
|
3907
|
+
this.customSignalMatcher.matchEvent(
|
|
3908
|
+
this.customSignals(),
|
|
3909
|
+
eventName,
|
|
3910
|
+
this.now()
|
|
3911
|
+
)
|
|
3912
|
+
)) {
|
|
3913
|
+
void this.trigger("frustration" /* Frustration */);
|
|
3914
|
+
}
|
|
3644
3915
|
});
|
|
3645
3916
|
}
|
|
3646
3917
|
async setRoute(route) {
|
|
@@ -3672,9 +3943,19 @@ var MobileReplayRecorder = class {
|
|
|
3672
3943
|
},
|
|
3673
3944
|
"routeCount"
|
|
3674
3945
|
);
|
|
3946
|
+
const frustrated = this.recordCustomSignals(
|
|
3947
|
+
this.customSignalMatcher.matchPage(
|
|
3948
|
+
this.customSignals(),
|
|
3949
|
+
route,
|
|
3950
|
+
this.now()
|
|
3951
|
+
)
|
|
3952
|
+
);
|
|
3675
3953
|
await this.closeCurrent(false);
|
|
3676
3954
|
this.forceFullSnapshot = true;
|
|
3677
3955
|
await this.captureTick(true);
|
|
3956
|
+
if (frustrated) {
|
|
3957
|
+
await this.trigger("frustration" /* Frustration */);
|
|
3958
|
+
}
|
|
3678
3959
|
}
|
|
3679
3960
|
async captureSession(reason = "manual") {
|
|
3680
3961
|
await this.identityQueue;
|
|
@@ -3719,6 +4000,13 @@ var MobileReplayRecorder = class {
|
|
|
3719
4000
|
{ kind: "error", name, message: "[masked]" },
|
|
3720
4001
|
"errorCount"
|
|
3721
4002
|
);
|
|
4003
|
+
this.recordCustomSignals(
|
|
4004
|
+
this.customSignalMatcher.matchErrorText(
|
|
4005
|
+
this.customSignals(),
|
|
4006
|
+
errorText(error),
|
|
4007
|
+
this.now()
|
|
4008
|
+
)
|
|
4009
|
+
);
|
|
3722
4010
|
await this.trigger("error" /* Error */);
|
|
3723
4011
|
}
|
|
3724
4012
|
recordTouch(touch) {
|
|
@@ -4122,6 +4410,50 @@ var MobileReplayRecorder = class {
|
|
|
4122
4410
|
}
|
|
4123
4411
|
}
|
|
4124
4412
|
}
|
|
4413
|
+
/* The page, event and error signals the application's policy defines. */
|
|
4414
|
+
customSignals() {
|
|
4415
|
+
return this.config?.frustrationSignals.customSignals ?? [];
|
|
4416
|
+
}
|
|
4417
|
+
/*
|
|
4418
|
+
* Marks each hit in the stream and counts it on the chunk, as the browser
|
|
4419
|
+
* recorder does. Returns whether one of them counts as frustration, which
|
|
4420
|
+
* starts an upload under "On error or frustration" like an error does.
|
|
4421
|
+
*
|
|
4422
|
+
* Nothing while the recorder records nothing: before start, while
|
|
4423
|
+
* waiting, paused for idle or after a session ended idle - a hit then
|
|
4424
|
+
* belongs to no recording, and must not start an upload of footage that
|
|
4425
|
+
* ended minutes before it.
|
|
4426
|
+
*/
|
|
4427
|
+
recordCustomSignals(hits) {
|
|
4428
|
+
if (hits.length === 0 || !this.running || !this.acceptingEvents || this.sealedForIdle || this.isIdlePaused()) {
|
|
4429
|
+
return false;
|
|
4430
|
+
}
|
|
4431
|
+
let frustrated = false;
|
|
4432
|
+
for (const hit of hits) {
|
|
4433
|
+
if (!this.chunkBuffer.hasRoomForCustomSignal()) {
|
|
4434
|
+
this.diagnostic("custom-signal-cap-reached");
|
|
4435
|
+
break;
|
|
4436
|
+
}
|
|
4437
|
+
const payload = {
|
|
4438
|
+
name: hit.name,
|
|
4439
|
+
trigger: hit.trigger,
|
|
4440
|
+
isFrustration: hit.isFrustration,
|
|
4441
|
+
atUnixMs: hit.atUnixMs
|
|
4442
|
+
};
|
|
4443
|
+
this.appendEvent(
|
|
4444
|
+
createCustomEvent(
|
|
4445
|
+
CUSTOM_SIGNAL_CUSTOM_EVENT_TAG,
|
|
4446
|
+
payload,
|
|
4447
|
+
hit.atUnixMs
|
|
4448
|
+
),
|
|
4449
|
+
void 0,
|
|
4450
|
+
false,
|
|
4451
|
+
{ name: hit.name, isFrustration: hit.isFrustration }
|
|
4452
|
+
);
|
|
4453
|
+
frustrated = frustrated || hit.isFrustration;
|
|
4454
|
+
}
|
|
4455
|
+
return frustrated;
|
|
4456
|
+
}
|
|
4125
4457
|
appendCustom(tag, payload, signal, allowWhenQuiesced = false) {
|
|
4126
4458
|
this.appendEvent(
|
|
4127
4459
|
createCustomEvent(tag, payload, this.now()),
|
|
@@ -4129,7 +4461,7 @@ var MobileReplayRecorder = class {
|
|
|
4129
4461
|
allowWhenQuiesced
|
|
4130
4462
|
);
|
|
4131
4463
|
}
|
|
4132
|
-
appendEvent(event, signal, allowWhenQuiesced = false) {
|
|
4464
|
+
appendEvent(event, signal, allowWhenQuiesced = false, customSignal) {
|
|
4133
4465
|
if (!this.running || !this.acceptingEvents && !allowWhenQuiesced) {
|
|
4134
4466
|
return;
|
|
4135
4467
|
}
|
|
@@ -4154,6 +4486,9 @@ var MobileReplayRecorder = class {
|
|
|
4154
4486
|
if (signal) {
|
|
4155
4487
|
appendOptions.signal = signal;
|
|
4156
4488
|
}
|
|
4489
|
+
if (customSignal) {
|
|
4490
|
+
appendOptions.customSignal = customSignal;
|
|
4491
|
+
}
|
|
4157
4492
|
if (this.idleResumeBacklog !== null) {
|
|
4158
4493
|
if (this.idleResumeBacklog.length < MAX_EVENTS_HELD_FOR_RESUME) {
|
|
4159
4494
|
this.idleResumeBacklog.push({ event, options: appendOptions });
|