@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/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.
|
|
63
|
+
var RECORDER_VERSION = true ? "14.0.107" : "0.0.0-dev";
|
|
64
64
|
var SESSION_REPLAY_MOBILE_RECORDER_CAPABILITIES = [
|
|
65
65
|
"mobile-view-tree",
|
|
66
66
|
"mobile-touch-events",
|
|
@@ -105,6 +105,12 @@ var SessionReplayFidelityNotice = /* @__PURE__ */ ((SessionReplayFidelityNotice2
|
|
|
105
105
|
SessionReplayFidelityNotice2["SnapshotTooLarge"] = "snapshot-too-large";
|
|
106
106
|
return SessionReplayFidelityNotice2;
|
|
107
107
|
})(SessionReplayFidelityNotice || {});
|
|
108
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNALS = 20;
|
|
109
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNAL_NAME_LENGTH = 40;
|
|
110
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNAL_MATCH_LENGTH = 200;
|
|
111
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNAL_EVENT_NAME_LENGTH = 64;
|
|
112
|
+
var SESSION_REPLAY_CUSTOM_SIGNAL_COOLDOWN_MS = 1e3;
|
|
113
|
+
var SESSION_REPLAY_MAX_CUSTOM_SIGNAL_EVENTS_PER_CHUNK = 50;
|
|
108
114
|
var ROUTE_CUSTOM_EVENT_TAG = "oneuptime.route";
|
|
109
115
|
var ERROR_CUSTOM_EVENT_TAG = "oneuptime.error";
|
|
110
116
|
var CUSTOM_EVENT_TAG = "oneuptime.custom";
|
|
@@ -113,6 +119,7 @@ var TAGS_CUSTOM_EVENT_TAG = "oneuptime.tags";
|
|
|
113
119
|
var VISIBILITY_CUSTOM_EVENT_TAG = "oneuptime.visibility";
|
|
114
120
|
var TOUCH_CUSTOM_EVENT_TAG = "oneuptime.touch";
|
|
115
121
|
var SESSION_ROTATED_CUSTOM_EVENT_TAG = "oneuptime.session-rotated";
|
|
122
|
+
var CUSTOM_SIGNAL_CUSTOM_EVENT_TAG = "oneuptime.signal";
|
|
116
123
|
var IDLE_PAUSED_CUSTOM_EVENT_TAG = "oneuptime.idle-paused";
|
|
117
124
|
var IDLE_RESUMED_CUSTOM_EVENT_TAG = "oneuptime.idle-resumed";
|
|
118
125
|
|
|
@@ -278,6 +285,7 @@ var ReplayChunkBuffer = class {
|
|
|
278
285
|
__publicField(this, "fidelity", /* @__PURE__ */ new Set());
|
|
279
286
|
__publicField(this, "signals", emptySignalCounts());
|
|
280
287
|
__publicField(this, "droppedEvents", 0);
|
|
288
|
+
__publicField(this, "customSignalEvents", 0);
|
|
281
289
|
}
|
|
282
290
|
append(event, options) {
|
|
283
291
|
let serialized;
|
|
@@ -310,8 +318,43 @@ var ReplayChunkBuffer = class {
|
|
|
310
318
|
const current = this.signals[options.signal] ?? 0;
|
|
311
319
|
this.signals[options.signal] = current + 1;
|
|
312
320
|
}
|
|
321
|
+
if (options?.customSignal) {
|
|
322
|
+
this.countCustomSignal(
|
|
323
|
+
options.customSignal.name,
|
|
324
|
+
options.customSignal.isFrustration
|
|
325
|
+
);
|
|
326
|
+
}
|
|
313
327
|
return true;
|
|
314
328
|
}
|
|
329
|
+
/*
|
|
330
|
+
* Whether this chunk takes another signal marker. Capped like the
|
|
331
|
+
* browser's: a signal that fires in a loop is one moment a second (the
|
|
332
|
+
* matcher's cooldown), and fifty of them a chunk is plenty to see it.
|
|
333
|
+
*/
|
|
334
|
+
hasRoomForCustomSignal() {
|
|
335
|
+
return this.customSignalEvents < SESSION_REPLAY_MAX_CUSTOM_SIGNAL_EVENTS_PER_CHUNK;
|
|
336
|
+
}
|
|
337
|
+
countCustomSignal(name, isFrustration) {
|
|
338
|
+
this.customSignalEvents += 1;
|
|
339
|
+
const counts = this.signals.customSignals ?? [];
|
|
340
|
+
let entry = counts.find(
|
|
341
|
+
(candidate) => {
|
|
342
|
+
return candidate.name === name;
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
if (!entry) {
|
|
346
|
+
if (counts.length >= SESSION_REPLAY_MAX_CUSTOM_SIGNALS) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
entry = { name, count: 0, frustrationCount: 0 };
|
|
350
|
+
counts.push(entry);
|
|
351
|
+
}
|
|
352
|
+
entry.count += 1;
|
|
353
|
+
if (isFrustration) {
|
|
354
|
+
entry.frustrationCount += 1;
|
|
355
|
+
}
|
|
356
|
+
this.signals.customSignals = counts;
|
|
357
|
+
}
|
|
315
358
|
appendMany(events, options) {
|
|
316
359
|
let accepted = 0;
|
|
317
360
|
for (const event of events) {
|
|
@@ -339,7 +382,7 @@ var ReplayChunkBuffer = class {
|
|
|
339
382
|
endUnixMs: this.endUnixMs,
|
|
340
383
|
hasFullSnapshot: this.hasFullSnapshot,
|
|
341
384
|
routes: this.routes.slice(),
|
|
342
|
-
signals:
|
|
385
|
+
signals: this.copySignals(),
|
|
343
386
|
fidelityNotices: Array.from(this.fidelity),
|
|
344
387
|
droppedEvents: this.droppedEvents
|
|
345
388
|
};
|
|
@@ -349,6 +392,18 @@ var ReplayChunkBuffer = class {
|
|
|
349
392
|
clear() {
|
|
350
393
|
this.reset();
|
|
351
394
|
}
|
|
395
|
+
/* The counts, with each signal's own entry copied too. */
|
|
396
|
+
copySignals() {
|
|
397
|
+
const signals = { ...this.signals };
|
|
398
|
+
if (this.signals.customSignals) {
|
|
399
|
+
signals.customSignals = this.signals.customSignals.map(
|
|
400
|
+
(entry) => {
|
|
401
|
+
return { ...entry };
|
|
402
|
+
}
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
return signals;
|
|
406
|
+
}
|
|
352
407
|
addRoute(route) {
|
|
353
408
|
if (this.routes.length >= MAX_ROUTES_PER_CHUNK || this.routes[this.routes.length - 1] === route) {
|
|
354
409
|
return;
|
|
@@ -371,6 +426,7 @@ var ReplayChunkBuffer = class {
|
|
|
371
426
|
this.fidelity.clear();
|
|
372
427
|
this.signals = emptySignalCounts();
|
|
373
428
|
this.droppedEvents = 0;
|
|
429
|
+
this.customSignalEvents = 0;
|
|
374
430
|
}
|
|
375
431
|
};
|
|
376
432
|
var RollingReplayBuffer = class {
|
|
@@ -416,6 +472,189 @@ var RollingReplayBuffer = class {
|
|
|
416
472
|
}
|
|
417
473
|
};
|
|
418
474
|
|
|
475
|
+
// src/CustomSignals.ts
|
|
476
|
+
var TRIGGERS = [
|
|
477
|
+
"click",
|
|
478
|
+
"page",
|
|
479
|
+
"event",
|
|
480
|
+
"error"
|
|
481
|
+
];
|
|
482
|
+
function asRecord(value) {
|
|
483
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
484
|
+
}
|
|
485
|
+
function isTrigger(value) {
|
|
486
|
+
return typeof value === "string" && TRIGGERS.indexOf(value) !== -1;
|
|
487
|
+
}
|
|
488
|
+
function readCustomSignal(value) {
|
|
489
|
+
const record = asRecord(value);
|
|
490
|
+
const name = typeof record["name"] === "string" ? record["name"].trim() : "";
|
|
491
|
+
const trigger = record["trigger"];
|
|
492
|
+
const match = typeof record["match"] === "string" ? record["match"].trim() : "";
|
|
493
|
+
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) !== "*") {
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
return {
|
|
497
|
+
name,
|
|
498
|
+
trigger,
|
|
499
|
+
match,
|
|
500
|
+
isFrustration: record["isFrustration"] !== false,
|
|
501
|
+
isEnabled: record["isEnabled"] !== false
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
function readCustomSignals(frustrationSignals) {
|
|
505
|
+
const list = asRecord(frustrationSignals)["customSignals"];
|
|
506
|
+
const read = [];
|
|
507
|
+
const seenNames = [];
|
|
508
|
+
if (Array.isArray(list)) {
|
|
509
|
+
for (const entry of list) {
|
|
510
|
+
const signal = readCustomSignal(entry);
|
|
511
|
+
if (!signal) {
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
const key = signal.name.toLowerCase();
|
|
515
|
+
if (seenNames.indexOf(key) !== -1) {
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
seenNames.push(key);
|
|
519
|
+
read.push(signal);
|
|
520
|
+
if (read.length >= SESSION_REPLAY_MAX_CUSTOM_SIGNALS) {
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
const signals = [];
|
|
526
|
+
for (const signal of read) {
|
|
527
|
+
if (signal.isEnabled && signal.trigger !== "click") {
|
|
528
|
+
signals.push({
|
|
529
|
+
name: signal.name,
|
|
530
|
+
trigger: signal.trigger,
|
|
531
|
+
match: signal.match,
|
|
532
|
+
isFrustration: signal.isFrustration
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return signals;
|
|
537
|
+
}
|
|
538
|
+
function canonicalPath(path) {
|
|
539
|
+
let end = path.length;
|
|
540
|
+
while (end > 1 && path.charAt(end - 1) === "/") {
|
|
541
|
+
end--;
|
|
542
|
+
}
|
|
543
|
+
return path.slice(0, end).toLowerCase();
|
|
544
|
+
}
|
|
545
|
+
function matchesPagePattern(pattern, path) {
|
|
546
|
+
const target = canonicalPath(path);
|
|
547
|
+
const pieces = canonicalPath(pattern.trim()).split("*");
|
|
548
|
+
if (pieces.length === 1) {
|
|
549
|
+
return target === pieces[0];
|
|
550
|
+
}
|
|
551
|
+
const first = pieces[0] || "";
|
|
552
|
+
const last = pieces[pieces.length - 1] || "";
|
|
553
|
+
if (target.slice(0, first.length) !== first) {
|
|
554
|
+
return false;
|
|
555
|
+
}
|
|
556
|
+
let position = first.length;
|
|
557
|
+
for (let index = 1; index < pieces.length - 1; index++) {
|
|
558
|
+
const piece = pieces[index] || "";
|
|
559
|
+
if (piece.length === 0) {
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
const found = target.indexOf(piece, position);
|
|
563
|
+
if (found === -1) {
|
|
564
|
+
return false;
|
|
565
|
+
}
|
|
566
|
+
position = found + piece.length;
|
|
567
|
+
}
|
|
568
|
+
return target.length - position >= last.length && target.slice(target.length - last.length) === last;
|
|
569
|
+
}
|
|
570
|
+
function matchesErrorText(match, text) {
|
|
571
|
+
return match.length > 0 && text.toLowerCase().indexOf(match.toLowerCase()) !== -1;
|
|
572
|
+
}
|
|
573
|
+
function matchesEventName(match, name) {
|
|
574
|
+
return match.trim().toLowerCase() === name.trim().toLowerCase();
|
|
575
|
+
}
|
|
576
|
+
function routeMatchPath(route) {
|
|
577
|
+
let path = typeof route === "string" ? route.trim() : "";
|
|
578
|
+
const scheme = path.indexOf("://");
|
|
579
|
+
if (scheme > 0 && scheme < 32) {
|
|
580
|
+
const pathStart = path.indexOf("/", scheme + 3);
|
|
581
|
+
path = pathStart === -1 ? "/" : path.slice(pathStart);
|
|
582
|
+
}
|
|
583
|
+
let end = path.length;
|
|
584
|
+
for (const separator of ["?", "#"]) {
|
|
585
|
+
const at = path.indexOf(separator);
|
|
586
|
+
if (at !== -1 && at < end) {
|
|
587
|
+
end = at;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
path = path.slice(0, end);
|
|
591
|
+
return path.charAt(0) === "/" ? path : `/${path}`;
|
|
592
|
+
}
|
|
593
|
+
var CustomSignalMatcher = class {
|
|
594
|
+
constructor() {
|
|
595
|
+
__publicField(this, "lastFiredAt", /* @__PURE__ */ new Map());
|
|
596
|
+
}
|
|
597
|
+
matchPage(signals, route, atUnixMs) {
|
|
598
|
+
const path = routeMatchPath(route);
|
|
599
|
+
return this.collect(
|
|
600
|
+
signals,
|
|
601
|
+
"page",
|
|
602
|
+
atUnixMs,
|
|
603
|
+
(signal) => {
|
|
604
|
+
return matchesPagePattern(signal.match, path);
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
matchEvent(signals, eventName, atUnixMs) {
|
|
609
|
+
return this.collect(
|
|
610
|
+
signals,
|
|
611
|
+
"event",
|
|
612
|
+
atUnixMs,
|
|
613
|
+
(signal) => {
|
|
614
|
+
return matchesEventName(signal.match, eventName);
|
|
615
|
+
}
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
matchErrorText(signals, text, atUnixMs) {
|
|
619
|
+
if (!text) {
|
|
620
|
+
return [];
|
|
621
|
+
}
|
|
622
|
+
return this.collect(
|
|
623
|
+
signals,
|
|
624
|
+
"error",
|
|
625
|
+
atUnixMs,
|
|
626
|
+
(signal) => {
|
|
627
|
+
return matchesErrorText(signal.match, text);
|
|
628
|
+
}
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
/* A new session starts with no signal cooling down. */
|
|
632
|
+
reset() {
|
|
633
|
+
this.lastFiredAt.clear();
|
|
634
|
+
}
|
|
635
|
+
collect(signals, trigger, atUnixMs, matches) {
|
|
636
|
+
const hits = [];
|
|
637
|
+
for (const signal of signals) {
|
|
638
|
+
if (signal.trigger !== trigger || !matches(signal)) {
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
const key = signal.name.toLowerCase();
|
|
642
|
+
const last = this.lastFiredAt.get(key);
|
|
643
|
+
if (last !== void 0 && atUnixMs >= last && atUnixMs - last < SESSION_REPLAY_CUSTOM_SIGNAL_COOLDOWN_MS) {
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
this.lastFiredAt.set(key, atUnixMs);
|
|
647
|
+
hits.push({
|
|
648
|
+
name: signal.name,
|
|
649
|
+
trigger,
|
|
650
|
+
isFrustration: signal.isFrustration,
|
|
651
|
+
atUnixMs
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
return hits;
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
|
|
419
658
|
// src/Config.ts
|
|
420
659
|
var CONFIG_FETCH_TIMEOUT_MS = 5e3;
|
|
421
660
|
var MOBILE_APP_IDENTIFIER_LABEL_PATTERN = /^[a-z0-9_-]+$/u;
|
|
@@ -530,6 +769,7 @@ function failClosed(reason) {
|
|
|
530
769
|
captureUserIdentity: false,
|
|
531
770
|
configEpoch: 0,
|
|
532
771
|
isTargeted: false,
|
|
772
|
+
frustrationSignals: { customSignals: [] },
|
|
533
773
|
disabledReason: reason
|
|
534
774
|
};
|
|
535
775
|
}
|
|
@@ -551,7 +791,14 @@ function normalizeReplayConfig(value) {
|
|
|
551
791
|
samplePercentage,
|
|
552
792
|
captureUserIdentity: config.captureUserIdentity === true,
|
|
553
793
|
configEpoch: typeof config.configEpoch === "number" && Number.isSafeInteger(config.configEpoch) && config.configEpoch >= 0 ? config.configEpoch : 0,
|
|
554
|
-
isTargeted: config.isTargeted === true
|
|
794
|
+
isTargeted: config.isTargeted === true,
|
|
795
|
+
/*
|
|
796
|
+
* A server from before frustration settings sends none: no signals of
|
|
797
|
+
* the application's own, which is what such an application has.
|
|
798
|
+
*/
|
|
799
|
+
frustrationSignals: {
|
|
800
|
+
customSignals: readCustomSignals(config.frustrationSignals)
|
|
801
|
+
}
|
|
555
802
|
};
|
|
556
803
|
if (typeof config.disabledReason === "string") {
|
|
557
804
|
resolved.disabledReason = config.disabledReason.slice(0, 100);
|
|
@@ -2987,6 +3234,18 @@ var SAFE_ERROR_NAMES = /* @__PURE__ */ new Set([
|
|
|
2987
3234
|
"TypeError",
|
|
2988
3235
|
"URIError"
|
|
2989
3236
|
]);
|
|
3237
|
+
function errorText(error) {
|
|
3238
|
+
if (typeof error === "string") {
|
|
3239
|
+
return error;
|
|
3240
|
+
}
|
|
3241
|
+
if (error && typeof error === "object") {
|
|
3242
|
+
const message = error.message;
|
|
3243
|
+
if (typeof message === "string") {
|
|
3244
|
+
return message;
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
return "";
|
|
3248
|
+
}
|
|
2990
3249
|
function defaultNow() {
|
|
2991
3250
|
return Date.now();
|
|
2992
3251
|
}
|
|
@@ -3052,6 +3311,8 @@ var MobileReplayRecorder = class {
|
|
|
3052
3311
|
__publicField(this, "now");
|
|
3053
3312
|
__publicField(this, "serializer", new ViewTreeSerializer());
|
|
3054
3313
|
__publicField(this, "chunkBuffer", new ReplayChunkBuffer());
|
|
3314
|
+
/* The application's own page, event and error signals (issue #6443). */
|
|
3315
|
+
__publicField(this, "customSignalMatcher", new CustomSignalMatcher());
|
|
3055
3316
|
__publicField(this, "rollingBuffer", new RollingReplayBuffer());
|
|
3056
3317
|
__publicField(this, "diagnosticsStatus", "idle");
|
|
3057
3318
|
__publicField(this, "diagnosticsEvents", []);
|
|
@@ -3276,6 +3537,7 @@ var MobileReplayRecorder = class {
|
|
|
3276
3537
|
this.resetTouchSequences();
|
|
3277
3538
|
this.idlePause = null;
|
|
3278
3539
|
this.idleResumeBacklog = null;
|
|
3540
|
+
this.customSignalMatcher.reset();
|
|
3279
3541
|
const validated = validateStartOptions(options);
|
|
3280
3542
|
if (!validated) {
|
|
3281
3543
|
this.disable("invalid-start-options");
|
|
@@ -3602,6 +3864,15 @@ var MobileReplayRecorder = class {
|
|
|
3602
3864
|
{ name: eventName, properties: sanitizedProperties },
|
|
3603
3865
|
"customEventCount"
|
|
3604
3866
|
);
|
|
3867
|
+
if (this.recordCustomSignals(
|
|
3868
|
+
this.customSignalMatcher.matchEvent(
|
|
3869
|
+
this.customSignals(),
|
|
3870
|
+
eventName,
|
|
3871
|
+
this.now()
|
|
3872
|
+
)
|
|
3873
|
+
)) {
|
|
3874
|
+
void this.trigger("frustration" /* Frustration */);
|
|
3875
|
+
}
|
|
3605
3876
|
});
|
|
3606
3877
|
}
|
|
3607
3878
|
async setRoute(route) {
|
|
@@ -3633,9 +3904,19 @@ var MobileReplayRecorder = class {
|
|
|
3633
3904
|
},
|
|
3634
3905
|
"routeCount"
|
|
3635
3906
|
);
|
|
3907
|
+
const frustrated = this.recordCustomSignals(
|
|
3908
|
+
this.customSignalMatcher.matchPage(
|
|
3909
|
+
this.customSignals(),
|
|
3910
|
+
route,
|
|
3911
|
+
this.now()
|
|
3912
|
+
)
|
|
3913
|
+
);
|
|
3636
3914
|
await this.closeCurrent(false);
|
|
3637
3915
|
this.forceFullSnapshot = true;
|
|
3638
3916
|
await this.captureTick(true);
|
|
3917
|
+
if (frustrated) {
|
|
3918
|
+
await this.trigger("frustration" /* Frustration */);
|
|
3919
|
+
}
|
|
3639
3920
|
}
|
|
3640
3921
|
async captureSession(reason = "manual") {
|
|
3641
3922
|
await this.identityQueue;
|
|
@@ -3680,6 +3961,13 @@ var MobileReplayRecorder = class {
|
|
|
3680
3961
|
{ kind: "error", name, message: "[masked]" },
|
|
3681
3962
|
"errorCount"
|
|
3682
3963
|
);
|
|
3964
|
+
this.recordCustomSignals(
|
|
3965
|
+
this.customSignalMatcher.matchErrorText(
|
|
3966
|
+
this.customSignals(),
|
|
3967
|
+
errorText(error),
|
|
3968
|
+
this.now()
|
|
3969
|
+
)
|
|
3970
|
+
);
|
|
3683
3971
|
await this.trigger("error" /* Error */);
|
|
3684
3972
|
}
|
|
3685
3973
|
recordTouch(touch) {
|
|
@@ -4083,6 +4371,50 @@ var MobileReplayRecorder = class {
|
|
|
4083
4371
|
}
|
|
4084
4372
|
}
|
|
4085
4373
|
}
|
|
4374
|
+
/* The page, event and error signals the application's policy defines. */
|
|
4375
|
+
customSignals() {
|
|
4376
|
+
return this.config?.frustrationSignals.customSignals ?? [];
|
|
4377
|
+
}
|
|
4378
|
+
/*
|
|
4379
|
+
* Marks each hit in the stream and counts it on the chunk, as the browser
|
|
4380
|
+
* recorder does. Returns whether one of them counts as frustration, which
|
|
4381
|
+
* starts an upload under "On error or frustration" like an error does.
|
|
4382
|
+
*
|
|
4383
|
+
* Nothing while the recorder records nothing: before start, while
|
|
4384
|
+
* waiting, paused for idle or after a session ended idle - a hit then
|
|
4385
|
+
* belongs to no recording, and must not start an upload of footage that
|
|
4386
|
+
* ended minutes before it.
|
|
4387
|
+
*/
|
|
4388
|
+
recordCustomSignals(hits) {
|
|
4389
|
+
if (hits.length === 0 || !this.running || !this.acceptingEvents || this.sealedForIdle || this.isIdlePaused()) {
|
|
4390
|
+
return false;
|
|
4391
|
+
}
|
|
4392
|
+
let frustrated = false;
|
|
4393
|
+
for (const hit of hits) {
|
|
4394
|
+
if (!this.chunkBuffer.hasRoomForCustomSignal()) {
|
|
4395
|
+
this.diagnostic("custom-signal-cap-reached");
|
|
4396
|
+
break;
|
|
4397
|
+
}
|
|
4398
|
+
const payload = {
|
|
4399
|
+
name: hit.name,
|
|
4400
|
+
trigger: hit.trigger,
|
|
4401
|
+
isFrustration: hit.isFrustration,
|
|
4402
|
+
atUnixMs: hit.atUnixMs
|
|
4403
|
+
};
|
|
4404
|
+
this.appendEvent(
|
|
4405
|
+
createCustomEvent(
|
|
4406
|
+
CUSTOM_SIGNAL_CUSTOM_EVENT_TAG,
|
|
4407
|
+
payload,
|
|
4408
|
+
hit.atUnixMs
|
|
4409
|
+
),
|
|
4410
|
+
void 0,
|
|
4411
|
+
false,
|
|
4412
|
+
{ name: hit.name, isFrustration: hit.isFrustration }
|
|
4413
|
+
);
|
|
4414
|
+
frustrated = frustrated || hit.isFrustration;
|
|
4415
|
+
}
|
|
4416
|
+
return frustrated;
|
|
4417
|
+
}
|
|
4086
4418
|
appendCustom(tag, payload, signal, allowWhenQuiesced = false) {
|
|
4087
4419
|
this.appendEvent(
|
|
4088
4420
|
createCustomEvent(tag, payload, this.now()),
|
|
@@ -4090,7 +4422,7 @@ var MobileReplayRecorder = class {
|
|
|
4090
4422
|
allowWhenQuiesced
|
|
4091
4423
|
);
|
|
4092
4424
|
}
|
|
4093
|
-
appendEvent(event, signal, allowWhenQuiesced = false) {
|
|
4425
|
+
appendEvent(event, signal, allowWhenQuiesced = false, customSignal) {
|
|
4094
4426
|
if (!this.running || !this.acceptingEvents && !allowWhenQuiesced) {
|
|
4095
4427
|
return;
|
|
4096
4428
|
}
|
|
@@ -4115,6 +4447,9 @@ var MobileReplayRecorder = class {
|
|
|
4115
4447
|
if (signal) {
|
|
4116
4448
|
appendOptions.signal = signal;
|
|
4117
4449
|
}
|
|
4450
|
+
if (customSignal) {
|
|
4451
|
+
appendOptions.customSignal = customSignal;
|
|
4452
|
+
}
|
|
4118
4453
|
if (this.idleResumeBacklog !== null) {
|
|
4119
4454
|
if (this.idleResumeBacklog.length < MAX_EVENTS_HELD_FOR_RESUME) {
|
|
4120
4455
|
this.idleResumeBacklog.push({ event, options: appendOptions });
|