@testerpaykit/expo 0.7.3 → 0.7.5
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/CHANGELOG.md +56 -0
- package/dist/index.d.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +136 -43
- package/dist/index.mjs +136 -43
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@testerpaykit/expo` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.7.5 — 2026-10-24
|
|
6
|
+
|
|
7
|
+
**A spoken bug report opens on Review, ready to submit.**
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- After a voice report (long-press the FAB, speak, extraction returns) the
|
|
11
|
+
bug-report sheet opened on step 0, Bug Type. Type, title, description,
|
|
12
|
+
expected/actual behaviour and frequency were already filled in, but the
|
|
13
|
+
tester still had to tap through Bug Type, Severity, Details and Steps to
|
|
14
|
+
reach Submit. The Flutter SDK has always opened this path on Review.
|
|
15
|
+
Found in BingeBuddy (2026-10-24), compared side by side with Bonblick.
|
|
16
|
+
|
|
17
|
+
Now the voice path opens the sheet on Review (step 4) with the extracted
|
|
18
|
+
fields and the Submit button. Back still walks through every step, so the
|
|
19
|
+
tester can correct anything before sending. "Report bug" from the FAB
|
|
20
|
+
menu and shake-to-report open on step 0 as before.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- `BugReportSheet` takes an optional `initialStep` (0–4, default 0) for
|
|
24
|
+
hosts that render the sheet themselves.
|
|
25
|
+
|
|
26
|
+
## 0.7.4 — 2026-10-22
|
|
27
|
+
|
|
28
|
+
**A failed request is no longer a crash, and one crash is one report.**
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- Every unhandled promise rejection was sent as a `crash` report, including
|
|
32
|
+
failed requests: offline, server down, CORS, aborted. The coordinator
|
|
33
|
+
console (which bundles this SDK with crash capture on) sent 312 identical
|
|
34
|
+
reports titled "A network error occurred." in 30 days, from two testers,
|
|
35
|
+
up to 108 an hour. Each one was a fetch that never reached the API, not a
|
|
36
|
+
bug in the app.
|
|
37
|
+
|
|
38
|
+
Now an unhandled rejection whose reason is a failed request is recorded as
|
|
39
|
+
an `http` breadcrumb (`unhandled network error`) instead. This covers the
|
|
40
|
+
fetch messages of Chrome ("Failed to fetch"), Safari ("Load failed",
|
|
41
|
+
"A network error occurred."), Firefox and React Native, axios network,
|
|
42
|
+
timeout and cancel errors, and `AbortError` / `TimeoutError`. Only the
|
|
43
|
+
whole message counts, so an app error that merely mentions the network is
|
|
44
|
+
still reported. A *fatal* error is always reported.
|
|
45
|
+
- The same crash was reported once per occurrence. A crash in a render loop
|
|
46
|
+
or a polling timer sent a report every time. Now each crash signature
|
|
47
|
+
(title plus top stack frame) is reported once per session;
|
|
48
|
+
`rotateSession()` starts counting again.
|
|
49
|
+
- A cached crash could be sent twice. Every captured crash started its own
|
|
50
|
+
flush, two flushes running at once both sent the same cached crash, and
|
|
51
|
+
two crashes in the same tick could overwrite each other in storage (one
|
|
52
|
+
lost, the other sent twice). Flushes and queue writes now run one after
|
|
53
|
+
another.
|
|
54
|
+
- Each upload attempt of a crash got a new idempotency key, so the server
|
|
55
|
+
could not drop a repeat. The cached crash's id is now the key for every
|
|
56
|
+
attempt.
|
|
57
|
+
- Crashes an older SDK left queued are cleaned up on the next flush:
|
|
58
|
+
failed-request "crashes" and repeats of an already sent crash are dropped
|
|
59
|
+
instead of sent.
|
|
60
|
+
|
|
5
61
|
## 0.7.3 — 2026-10-20
|
|
6
62
|
|
|
7
63
|
**An expired login no longer turns the SDK off for good.**
|
package/dist/index.d.mts
CHANGED
|
@@ -112,7 +112,10 @@ interface CrashInfo {
|
|
|
112
112
|
declare function installCrashHandler(options: CrashHandlerOptions): () => void;
|
|
113
113
|
|
|
114
114
|
interface CachedCrash {
|
|
115
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Local id for review / retry bookkeeping. Also the idempotency key of
|
|
117
|
+
* every upload attempt, so the server drops a repeated send.
|
|
118
|
+
*/
|
|
116
119
|
id: string;
|
|
117
120
|
/** ISO timestamp when the crash was captured. */
|
|
118
121
|
capturedAt: string;
|
|
@@ -121,12 +124,14 @@ interface CachedCrash {
|
|
|
121
124
|
}
|
|
122
125
|
declare class CrashQueue {
|
|
123
126
|
private readonly storage;
|
|
127
|
+
private tail;
|
|
124
128
|
constructor(storage: TpkStorage);
|
|
125
129
|
enqueue(info: CrashInfo): Promise<CachedCrash>;
|
|
126
130
|
pending(): Promise<CachedCrash[]>;
|
|
127
131
|
size(): Promise<number>;
|
|
128
132
|
remove(id: string): Promise<void>;
|
|
129
133
|
private read;
|
|
134
|
+
private exclusive;
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
interface QueuedEntry {
|
|
@@ -610,6 +615,9 @@ declare class TpkExpo {
|
|
|
610
615
|
private readonly sessionEvents;
|
|
611
616
|
private uninstallDurableSync;
|
|
612
617
|
private uninstallTaskBinding;
|
|
618
|
+
private readonly capturedCrashes;
|
|
619
|
+
private readonly submittedCrashes;
|
|
620
|
+
private crashFlush;
|
|
613
621
|
private constructor();
|
|
614
622
|
/** Active server session id. Updated by init or rotate. Used to route telemetry. */
|
|
615
623
|
sessionId: string;
|
|
@@ -726,8 +734,12 @@ declare class TpkExpo {
|
|
|
726
734
|
/**
|
|
727
735
|
* Try uploading cached crashes. Failed uploads remain cached so a
|
|
728
736
|
* future launch can surface them for review or retry.
|
|
737
|
+
*
|
|
738
|
+
* Flushes run one after another: two at once both read the same
|
|
739
|
+
* cached crash and both sent it.
|
|
729
740
|
*/
|
|
730
741
|
flushCachedCrashes(): Promise<number>;
|
|
742
|
+
private drainCrashQueue;
|
|
731
743
|
/** Flush pending session events + breadcrumbs to timeline endpoints. */
|
|
732
744
|
flushTelemetry(): Promise<FlushTelemetryResult>;
|
|
733
745
|
/** End the active server-side tester session. */
|
|
@@ -1016,6 +1028,11 @@ interface BugReportSheetProps {
|
|
|
1016
1028
|
* VoiceBugInputSheet extraction (title / description / expected
|
|
1017
1029
|
* / actual / frequency / category). */
|
|
1018
1030
|
initialDraft?: Partial<BugReportDraft>;
|
|
1031
|
+
/** Step the wizard opens on (default 0). The voice flow passes 4 so
|
|
1032
|
+
* the tester lands on Review with the extracted fields and can
|
|
1033
|
+
* submit right away; Back still walks through every step. Mirrors
|
|
1034
|
+
* Flutter's `BugReportDialog(initialStep: 4)`. */
|
|
1035
|
+
initialStep?: StepIndex;
|
|
1019
1036
|
/** Max attachments + total size, mirrors Flutter's safeguards. */
|
|
1020
1037
|
maxAttachments?: number;
|
|
1021
1038
|
maxTotalSizeMB?: number;
|
|
@@ -1024,7 +1041,8 @@ interface BugReportSheetProps {
|
|
|
1024
1041
|
declare function createBugReportDraft(input?: CreateBugReportDraftInput): BugReportDraft;
|
|
1025
1042
|
declare function canSubmitBugReportDraft(draft: BugReportDraft): boolean;
|
|
1026
1043
|
declare function submitBugReportDraft(tpk: Pick<TpkExpo, 'submitBug' | 'attachToBugReport'>, draft: BugReportDraft): Promise<SubmitBugResult>;
|
|
1027
|
-
|
|
1044
|
+
type StepIndex = 0 | 1 | 2 | 3 | 4;
|
|
1045
|
+
declare function BugReportSheet({ visible, tpk, currentScreen, captureRootRef, autoCaptureOnOpen, onOpenVoiceBug, onClose, onSubmitted, onError, defaultSeverity, initialDraft: initialDraftPatch, initialStep, maxAttachments, maxTotalSizeMB, style, }: BugReportSheetProps): React.ReactElement;
|
|
1028
1046
|
|
|
1029
1047
|
interface DeviceSnapshot {
|
|
1030
1048
|
platform: 'ios' | 'android' | 'web' | 'macos' | 'windows';
|
package/dist/index.d.ts
CHANGED
|
@@ -112,7 +112,10 @@ interface CrashInfo {
|
|
|
112
112
|
declare function installCrashHandler(options: CrashHandlerOptions): () => void;
|
|
113
113
|
|
|
114
114
|
interface CachedCrash {
|
|
115
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Local id for review / retry bookkeeping. Also the idempotency key of
|
|
117
|
+
* every upload attempt, so the server drops a repeated send.
|
|
118
|
+
*/
|
|
116
119
|
id: string;
|
|
117
120
|
/** ISO timestamp when the crash was captured. */
|
|
118
121
|
capturedAt: string;
|
|
@@ -121,12 +124,14 @@ interface CachedCrash {
|
|
|
121
124
|
}
|
|
122
125
|
declare class CrashQueue {
|
|
123
126
|
private readonly storage;
|
|
127
|
+
private tail;
|
|
124
128
|
constructor(storage: TpkStorage);
|
|
125
129
|
enqueue(info: CrashInfo): Promise<CachedCrash>;
|
|
126
130
|
pending(): Promise<CachedCrash[]>;
|
|
127
131
|
size(): Promise<number>;
|
|
128
132
|
remove(id: string): Promise<void>;
|
|
129
133
|
private read;
|
|
134
|
+
private exclusive;
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
interface QueuedEntry {
|
|
@@ -610,6 +615,9 @@ declare class TpkExpo {
|
|
|
610
615
|
private readonly sessionEvents;
|
|
611
616
|
private uninstallDurableSync;
|
|
612
617
|
private uninstallTaskBinding;
|
|
618
|
+
private readonly capturedCrashes;
|
|
619
|
+
private readonly submittedCrashes;
|
|
620
|
+
private crashFlush;
|
|
613
621
|
private constructor();
|
|
614
622
|
/** Active server session id. Updated by init or rotate. Used to route telemetry. */
|
|
615
623
|
sessionId: string;
|
|
@@ -726,8 +734,12 @@ declare class TpkExpo {
|
|
|
726
734
|
/**
|
|
727
735
|
* Try uploading cached crashes. Failed uploads remain cached so a
|
|
728
736
|
* future launch can surface them for review or retry.
|
|
737
|
+
*
|
|
738
|
+
* Flushes run one after another: two at once both read the same
|
|
739
|
+
* cached crash and both sent it.
|
|
729
740
|
*/
|
|
730
741
|
flushCachedCrashes(): Promise<number>;
|
|
742
|
+
private drainCrashQueue;
|
|
731
743
|
/** Flush pending session events + breadcrumbs to timeline endpoints. */
|
|
732
744
|
flushTelemetry(): Promise<FlushTelemetryResult>;
|
|
733
745
|
/** End the active server-side tester session. */
|
|
@@ -1016,6 +1028,11 @@ interface BugReportSheetProps {
|
|
|
1016
1028
|
* VoiceBugInputSheet extraction (title / description / expected
|
|
1017
1029
|
* / actual / frequency / category). */
|
|
1018
1030
|
initialDraft?: Partial<BugReportDraft>;
|
|
1031
|
+
/** Step the wizard opens on (default 0). The voice flow passes 4 so
|
|
1032
|
+
* the tester lands on Review with the extracted fields and can
|
|
1033
|
+
* submit right away; Back still walks through every step. Mirrors
|
|
1034
|
+
* Flutter's `BugReportDialog(initialStep: 4)`. */
|
|
1035
|
+
initialStep?: StepIndex;
|
|
1019
1036
|
/** Max attachments + total size, mirrors Flutter's safeguards. */
|
|
1020
1037
|
maxAttachments?: number;
|
|
1021
1038
|
maxTotalSizeMB?: number;
|
|
@@ -1024,7 +1041,8 @@ interface BugReportSheetProps {
|
|
|
1024
1041
|
declare function createBugReportDraft(input?: CreateBugReportDraftInput): BugReportDraft;
|
|
1025
1042
|
declare function canSubmitBugReportDraft(draft: BugReportDraft): boolean;
|
|
1026
1043
|
declare function submitBugReportDraft(tpk: Pick<TpkExpo, 'submitBug' | 'attachToBugReport'>, draft: BugReportDraft): Promise<SubmitBugResult>;
|
|
1027
|
-
|
|
1044
|
+
type StepIndex = 0 | 1 | 2 | 3 | 4;
|
|
1045
|
+
declare function BugReportSheet({ visible, tpk, currentScreen, captureRootRef, autoCaptureOnOpen, onOpenVoiceBug, onClose, onSubmitted, onError, defaultSeverity, initialDraft: initialDraftPatch, initialStep, maxAttachments, maxTotalSizeMB, style, }: BugReportSheetProps): React.ReactElement;
|
|
1028
1046
|
|
|
1029
1047
|
interface DeviceSnapshot {
|
|
1030
1048
|
platform: 'ios' | 'android' | 'web' | 'macos' | 'windows';
|
package/dist/index.js
CHANGED
|
@@ -567,15 +567,26 @@ function installCrashHandler(options) {
|
|
|
567
567
|
const chainPrevious = options.chainPrevious ?? true;
|
|
568
568
|
const errorUtils = globalThis.ErrorUtils;
|
|
569
569
|
const previousHandler = errorUtils?.getGlobalHandler();
|
|
570
|
-
const
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
breadcrumbs: options.breadcrumbs?.snapshot()
|
|
576
|
-
};
|
|
577
|
-
Promise.resolve(options.onCrash(info)).catch(() => {
|
|
570
|
+
const noteNetworkError = (reason) => {
|
|
571
|
+
options.breadcrumbs?.record({
|
|
572
|
+
action: "http",
|
|
573
|
+
target: "unhandled network error",
|
|
574
|
+
data: { error: errorMessage(reason) }
|
|
578
575
|
});
|
|
576
|
+
};
|
|
577
|
+
const handler = (error, isFatal) => {
|
|
578
|
+
if (!isFatal && isNetworkError(error)) {
|
|
579
|
+
noteNetworkError(error);
|
|
580
|
+
} else {
|
|
581
|
+
const info = {
|
|
582
|
+
message: error?.message ?? String(error),
|
|
583
|
+
stack: error?.stack,
|
|
584
|
+
isFatal: !!isFatal,
|
|
585
|
+
breadcrumbs: options.breadcrumbs?.snapshot()
|
|
586
|
+
};
|
|
587
|
+
Promise.resolve(options.onCrash(info)).catch(() => {
|
|
588
|
+
});
|
|
589
|
+
}
|
|
579
590
|
if (chainPrevious && previousHandler) {
|
|
580
591
|
previousHandler(error, isFatal);
|
|
581
592
|
}
|
|
@@ -583,6 +594,10 @@ function installCrashHandler(options) {
|
|
|
583
594
|
errorUtils?.setGlobalHandler(handler);
|
|
584
595
|
const handleRejection = (event) => {
|
|
585
596
|
const reason = event?.reason;
|
|
597
|
+
if (isNetworkError(reason)) {
|
|
598
|
+
noteNetworkError(reason);
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
586
601
|
const err = reason instanceof Error ? reason : new Error(typeof reason === "string" ? reason : "unhandled rejection");
|
|
587
602
|
handler(err, false);
|
|
588
603
|
};
|
|
@@ -593,23 +608,68 @@ function installCrashHandler(options) {
|
|
|
593
608
|
target?.removeEventListener?.("unhandledrejection", handleRejection);
|
|
594
609
|
};
|
|
595
610
|
}
|
|
611
|
+
function isNetworkError(value) {
|
|
612
|
+
if (typeof value === "string") return NETWORK_MESSAGE.test(value);
|
|
613
|
+
if (typeof value !== "object" || value === null) return false;
|
|
614
|
+
const { name, code, message } = value;
|
|
615
|
+
if (typeof code === "string" && NETWORK_CODES.has(code)) return true;
|
|
616
|
+
if (typeof name === "string" && NETWORK_NAMES.has(name)) return true;
|
|
617
|
+
return typeof message === "string" && NETWORK_MESSAGE.test(message);
|
|
618
|
+
}
|
|
619
|
+
var NETWORK_CODES = /* @__PURE__ */ new Set(["ERR_NETWORK", "ECONNABORTED", "ETIMEDOUT", "ERR_CANCELED"]);
|
|
620
|
+
var NETWORK_NAMES = /* @__PURE__ */ new Set(["NetworkError", "AbortError", "TimeoutError", "CanceledError"]);
|
|
621
|
+
var NETWORK_MESSAGE = new RegExp(
|
|
622
|
+
"^(" + [
|
|
623
|
+
"Failed to fetch",
|
|
624
|
+
"Load failed",
|
|
625
|
+
"A network error occurred\\.?",
|
|
626
|
+
"NetworkError when attempting to fetch resource\\.?",
|
|
627
|
+
"Network request failed",
|
|
628
|
+
"Network Error",
|
|
629
|
+
"The network connection was lost\\.?",
|
|
630
|
+
"The Internet connection appears to be offline\\.?"
|
|
631
|
+
].join("|") + ")$",
|
|
632
|
+
"i"
|
|
633
|
+
);
|
|
634
|
+
function crashSignature(info) {
|
|
635
|
+
return `${info.message}
|
|
636
|
+
${topFrame(info.stack)}`;
|
|
637
|
+
}
|
|
638
|
+
function topFrame(stack) {
|
|
639
|
+
for (const line of stack?.split("\n") ?? []) {
|
|
640
|
+
const frame = line.trim();
|
|
641
|
+
if (/^at\s/.test(frame) || /@.*:\d+(:\d+)?$/.test(frame)) return frame;
|
|
642
|
+
}
|
|
643
|
+
return "";
|
|
644
|
+
}
|
|
645
|
+
function errorMessage(value) {
|
|
646
|
+
if (typeof value === "string") return value;
|
|
647
|
+
const message = value?.message;
|
|
648
|
+
return typeof message === "string" ? message : String(value);
|
|
649
|
+
}
|
|
596
650
|
|
|
597
651
|
// src/crashQueue.ts
|
|
598
652
|
var CRASH_QUEUE_KEY = "queue/crashes";
|
|
599
653
|
var CrashQueue = class {
|
|
600
654
|
constructor(storage) {
|
|
601
655
|
this.storage = storage;
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
656
|
+
// enqueue and remove read, change and write the whole list. Run them
|
|
657
|
+
// one after another: interleaved, a write lost a crash or brought a
|
|
658
|
+
// removed (already sent) one back, which was then sent again.
|
|
659
|
+
this.tail = Promise.resolve();
|
|
660
|
+
}
|
|
661
|
+
enqueue(info) {
|
|
662
|
+
return this.exclusive(async () => {
|
|
663
|
+
const queue = await this.read() ?? [];
|
|
664
|
+
const entry = {
|
|
665
|
+
id: uuidv4(),
|
|
666
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
667
|
+
info
|
|
668
|
+
};
|
|
669
|
+
queue.push(entry);
|
|
670
|
+
await this.storage.set(CRASH_QUEUE_KEY, queue);
|
|
671
|
+
return entry;
|
|
672
|
+
});
|
|
613
673
|
}
|
|
614
674
|
async pending() {
|
|
615
675
|
return await this.read() ?? [];
|
|
@@ -617,22 +677,27 @@ var CrashQueue = class {
|
|
|
617
677
|
async size() {
|
|
618
678
|
return (await this.read())?.length ?? 0;
|
|
619
679
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
680
|
+
remove(id) {
|
|
681
|
+
return this.exclusive(async () => {
|
|
682
|
+
const queue = await this.read() ?? [];
|
|
683
|
+
const next = queue.filter((entry) => entry.id !== id);
|
|
684
|
+
if (next.length === 0) {
|
|
685
|
+
await this.storage.remove(CRASH_QUEUE_KEY);
|
|
686
|
+
} else {
|
|
687
|
+
await this.storage.set(CRASH_QUEUE_KEY, next);
|
|
688
|
+
}
|
|
689
|
+
});
|
|
628
690
|
}
|
|
629
691
|
async read() {
|
|
630
692
|
return this.storage.get(CRASH_QUEUE_KEY);
|
|
631
693
|
}
|
|
694
|
+
exclusive(op) {
|
|
695
|
+
const run = this.tail.then(op);
|
|
696
|
+
this.tail = run.catch(() => {
|
|
697
|
+
});
|
|
698
|
+
return run;
|
|
699
|
+
}
|
|
632
700
|
};
|
|
633
|
-
function cryptoRandomId() {
|
|
634
|
-
return Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
635
|
-
}
|
|
636
701
|
|
|
637
702
|
// src/queue.ts
|
|
638
703
|
var QUEUE_KEY = "queue/bug-reports";
|
|
@@ -644,7 +709,7 @@ var SubmitQueue = class {
|
|
|
644
709
|
async enqueue(payload, options) {
|
|
645
710
|
const queue = await this.read() ?? [];
|
|
646
711
|
const entry = {
|
|
647
|
-
id:
|
|
712
|
+
id: cryptoRandomId(),
|
|
648
713
|
// Reuse the caller's key when supplied — that's how the first
|
|
649
714
|
// submit attempt's key carries through to the queued retry, so
|
|
650
715
|
// the server's dedup matches across attempts. When the caller
|
|
@@ -714,7 +779,7 @@ var AttachmentQueue = class {
|
|
|
714
779
|
async enqueue(bugReportId, attachment) {
|
|
715
780
|
const queue = await this.read() ?? [];
|
|
716
781
|
const entry = {
|
|
717
|
-
id:
|
|
782
|
+
id: cryptoRandomId(),
|
|
718
783
|
bugReportId,
|
|
719
784
|
queuedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
720
785
|
attachment
|
|
@@ -784,7 +849,7 @@ function describe(e) {
|
|
|
784
849
|
return String(e);
|
|
785
850
|
}
|
|
786
851
|
}
|
|
787
|
-
function
|
|
852
|
+
function cryptoRandomId() {
|
|
788
853
|
return Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
789
854
|
}
|
|
790
855
|
|
|
@@ -1143,7 +1208,7 @@ function findAssignmentForTask(tasks, key) {
|
|
|
1143
1208
|
}
|
|
1144
1209
|
|
|
1145
1210
|
// package.json
|
|
1146
|
-
var version = "0.7.
|
|
1211
|
+
var version = "0.7.5";
|
|
1147
1212
|
|
|
1148
1213
|
// src/version.ts
|
|
1149
1214
|
var SDK_VERSION = `@testerpaykit/expo/${version}`;
|
|
@@ -1176,6 +1241,12 @@ var TpkExpo = class _TpkExpo {
|
|
|
1176
1241
|
this.sessionEvents = [];
|
|
1177
1242
|
this.uninstallDurableSync = null;
|
|
1178
1243
|
this.uninstallTaskBinding = null;
|
|
1244
|
+
// Crash signatures seen / sent in this session. The console sent 312
|
|
1245
|
+
// identical crash reports in 30 days (2026-10-22): one report per
|
|
1246
|
+
// occurrence of the same crash adds nothing after the first.
|
|
1247
|
+
this.capturedCrashes = /* @__PURE__ */ new Set();
|
|
1248
|
+
this.submittedCrashes = /* @__PURE__ */ new Set();
|
|
1249
|
+
this.crashFlush = Promise.resolve();
|
|
1179
1250
|
/** Active server session id. Updated by init or rotate. Used to route telemetry. */
|
|
1180
1251
|
this.sessionId = "";
|
|
1181
1252
|
this._ready = ready;
|
|
@@ -1553,13 +1624,28 @@ var TpkExpo = class _TpkExpo {
|
|
|
1553
1624
|
/**
|
|
1554
1625
|
* Try uploading cached crashes. Failed uploads remain cached so a
|
|
1555
1626
|
* future launch can surface them for review or retry.
|
|
1627
|
+
*
|
|
1628
|
+
* Flushes run one after another: two at once both read the same
|
|
1629
|
+
* cached crash and both sent it.
|
|
1556
1630
|
*/
|
|
1557
|
-
|
|
1631
|
+
flushCachedCrashes() {
|
|
1632
|
+
const run = this.crashFlush.then(() => this.drainCrashQueue());
|
|
1633
|
+
this.crashFlush = run.catch(() => {
|
|
1634
|
+
});
|
|
1635
|
+
return run;
|
|
1636
|
+
}
|
|
1637
|
+
async drainCrashQueue() {
|
|
1558
1638
|
const crashes = await this.crashQueue.pending();
|
|
1559
1639
|
let submitted = 0;
|
|
1560
1640
|
for (const crash of crashes) {
|
|
1641
|
+
const signature = crashSignature(crash.info);
|
|
1642
|
+
if (isNetworkError(crash.info.message) || this.submittedCrashes.has(signature)) {
|
|
1643
|
+
await this.crashQueue.remove(crash.id);
|
|
1644
|
+
continue;
|
|
1645
|
+
}
|
|
1561
1646
|
try {
|
|
1562
|
-
await this.submitCrashReport(crash.info);
|
|
1647
|
+
await this.submitCrashReport(crash.info, crash.id);
|
|
1648
|
+
this.submittedCrashes.add(signature);
|
|
1563
1649
|
await this.crashQueue.remove(crash.id);
|
|
1564
1650
|
submitted++;
|
|
1565
1651
|
} catch {
|
|
@@ -1616,6 +1702,8 @@ var TpkExpo = class _TpkExpo {
|
|
|
1616
1702
|
this.config.projectId,
|
|
1617
1703
|
this.config.testerCode
|
|
1618
1704
|
);
|
|
1705
|
+
this.capturedCrashes.clear();
|
|
1706
|
+
this.submittedCrashes.clear();
|
|
1619
1707
|
this.breadcrumbs.record({ action: "tpk", target: "session_rotated" });
|
|
1620
1708
|
}
|
|
1621
1709
|
/** Drop the cached anon-tester JWT — next init() re-acquires one. */
|
|
@@ -1718,6 +1806,9 @@ var TpkExpo = class _TpkExpo {
|
|
|
1718
1806
|
}
|
|
1719
1807
|
/** Persist crash context before attempting a best-effort upload. */
|
|
1720
1808
|
async captureCrash(info) {
|
|
1809
|
+
const signature = crashSignature(info);
|
|
1810
|
+
if (this.capturedCrashes.has(signature)) return;
|
|
1811
|
+
this.capturedCrashes.add(signature);
|
|
1721
1812
|
this.breadcrumbs.record({
|
|
1722
1813
|
action: "crash",
|
|
1723
1814
|
target: truncate(info.message, 120),
|
|
@@ -1727,7 +1818,7 @@ var TpkExpo = class _TpkExpo {
|
|
|
1727
1818
|
await this.flushCachedCrashes();
|
|
1728
1819
|
}
|
|
1729
1820
|
/** Auto-built crash submit — called from the cached crash flusher. */
|
|
1730
|
-
async submitCrashReport(info) {
|
|
1821
|
+
async submitCrashReport(info, crashId) {
|
|
1731
1822
|
const payload = await this.buildPayload({
|
|
1732
1823
|
type: "crash",
|
|
1733
1824
|
severity: info.isFatal ? "high" : "medium",
|
|
@@ -1736,7 +1827,7 @@ var TpkExpo = class _TpkExpo {
|
|
|
1736
1827
|
description: composeCrashDescription(info),
|
|
1737
1828
|
currentScreen: lastScreen(this.breadcrumbs) ?? "unknown"
|
|
1738
1829
|
});
|
|
1739
|
-
await this.api.submitBugReport(payload, { idempotencyKey:
|
|
1830
|
+
await this.api.submitBugReport(payload, { idempotencyKey: crashId });
|
|
1740
1831
|
this.breadcrumbs.record({ action: "tpk", target: "crash_submitted" });
|
|
1741
1832
|
}
|
|
1742
1833
|
};
|
|
@@ -3305,6 +3396,7 @@ function BugReportSheet({
|
|
|
3305
3396
|
onError,
|
|
3306
3397
|
defaultSeverity = "medium",
|
|
3307
3398
|
initialDraft: initialDraftPatch,
|
|
3399
|
+
initialStep = 0,
|
|
3308
3400
|
maxAttachments = DEFAULT_MAX_ATTACHMENTS,
|
|
3309
3401
|
maxTotalSizeMB = DEFAULT_MAX_TOTAL_MB,
|
|
3310
3402
|
style
|
|
@@ -3322,7 +3414,7 @@ function BugReportSheet({
|
|
|
3322
3414
|
reproductionSteps: initialDraftPatch.reproductionSteps ?? base.reproductionSteps
|
|
3323
3415
|
};
|
|
3324
3416
|
}, [currentScreen, defaultSeverity, initialDraftPatch]);
|
|
3325
|
-
const [step, setStep] = (0, import_react7.useState)(
|
|
3417
|
+
const [step, setStep] = (0, import_react7.useState)(initialStep);
|
|
3326
3418
|
const [draft, setDraft] = (0, import_react7.useState)(initialDraft);
|
|
3327
3419
|
const [stepInput, setStepInput] = (0, import_react7.useState)("");
|
|
3328
3420
|
const [submitting, setSubmitting] = (0, import_react7.useState)(false);
|
|
@@ -3330,13 +3422,13 @@ function BugReportSheet({
|
|
|
3330
3422
|
const [submitBanner, setSubmitBanner] = (0, import_react7.useState)(null);
|
|
3331
3423
|
(0, import_react7.useEffect)(() => {
|
|
3332
3424
|
if (visible) {
|
|
3333
|
-
setStep(
|
|
3425
|
+
setStep(initialStep);
|
|
3334
3426
|
setDraft(initialDraft);
|
|
3335
3427
|
setStepInput("");
|
|
3336
3428
|
setAttachmentError(null);
|
|
3337
3429
|
setSubmitBanner(null);
|
|
3338
3430
|
}
|
|
3339
|
-
}, [visible, initialDraft]);
|
|
3431
|
+
}, [visible, initialDraft, initialStep]);
|
|
3340
3432
|
const totalSizeMB = (0, import_react7.useMemo)(() => {
|
|
3341
3433
|
const bytes = draft.attachments.reduce(
|
|
3342
3434
|
(sum, a) => sum + (a.byteLength ?? Math.ceil(a.base64.length * 0.75)),
|
|
@@ -9767,7 +9859,7 @@ function AiRemoteControl({
|
|
|
9767
9859
|
}) {
|
|
9768
9860
|
const [status, setStatus] = (0, import_react22.useState)("choosing");
|
|
9769
9861
|
const [actionCount, setActionCount] = (0, import_react22.useState)(0);
|
|
9770
|
-
const [
|
|
9862
|
+
const [errorMessage2, setErrorMessage] = (0, import_react22.useState)(null);
|
|
9771
9863
|
const [sessionId, setSessionId] = (0, import_react22.useState)(null);
|
|
9772
9864
|
const [personas, setPersonas] = (0, import_react22.useState)([]);
|
|
9773
9865
|
const [selectedPersona, setSelectedPersona] = (0, import_react22.useState)("junior_tester");
|
|
@@ -10016,7 +10108,7 @@ function AiRemoteControl({
|
|
|
10016
10108
|
style: styles17.startButton
|
|
10017
10109
|
},
|
|
10018
10110
|
/* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: styles17.stopText }, "Start AI test")
|
|
10019
|
-
))) : /* @__PURE__ */ import_react22.default.createElement(import_react22.default.Fragment, null, /* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: styles17.subtitle }, status === "starting" && "Starting up\u2026", status === "running" && `Action ${actionCount} \u2014 exploring`, status === "paused" && "Paused (you took over)", status === "ended" && "Session ended", status === "error" && (
|
|
10111
|
+
))) : /* @__PURE__ */ import_react22.default.createElement(import_react22.default.Fragment, null, /* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: styles17.subtitle }, status === "starting" && "Starting up\u2026", status === "running" && `Action ${actionCount} \u2014 exploring`, status === "paused" && "Paused (you took over)", status === "ended" && "Session ended", status === "error" && (errorMessage2 ?? "Error")), status === "running" || status === "paused" ? /* @__PURE__ */ import_react22.default.createElement(import_react_native22.Text, { style: styles17.hint }, "Tap anywhere outside to pause. Use Stop to end the session.") : null, /* @__PURE__ */ import_react22.default.createElement(
|
|
10020
10112
|
import_react_native22.Pressable,
|
|
10021
10113
|
{
|
|
10022
10114
|
accessibilityRole: "button",
|
|
@@ -10312,6 +10404,7 @@ function TesterPayKitWrapper({
|
|
|
10312
10404
|
currentScreen,
|
|
10313
10405
|
captureRootRef: rootRef,
|
|
10314
10406
|
initialDraft: bugInitialDraft ?? void 0,
|
|
10407
|
+
initialStep: bugInitialDraft ? 4 : 0,
|
|
10315
10408
|
onOpenVoiceBug: () => {
|
|
10316
10409
|
setBugOpen(false);
|
|
10317
10410
|
setVoiceOpen(true);
|
package/dist/index.mjs
CHANGED
|
@@ -362,15 +362,26 @@ function installCrashHandler(options) {
|
|
|
362
362
|
const chainPrevious = options.chainPrevious ?? true;
|
|
363
363
|
const errorUtils = globalThis.ErrorUtils;
|
|
364
364
|
const previousHandler = errorUtils?.getGlobalHandler();
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
breadcrumbs: options.breadcrumbs?.snapshot()
|
|
371
|
-
};
|
|
372
|
-
Promise.resolve(options.onCrash(info)).catch(() => {
|
|
365
|
+
const noteNetworkError = (reason) => {
|
|
366
|
+
options.breadcrumbs?.record({
|
|
367
|
+
action: "http",
|
|
368
|
+
target: "unhandled network error",
|
|
369
|
+
data: { error: errorMessage(reason) }
|
|
373
370
|
});
|
|
371
|
+
};
|
|
372
|
+
const handler = (error, isFatal) => {
|
|
373
|
+
if (!isFatal && isNetworkError(error)) {
|
|
374
|
+
noteNetworkError(error);
|
|
375
|
+
} else {
|
|
376
|
+
const info = {
|
|
377
|
+
message: error?.message ?? String(error),
|
|
378
|
+
stack: error?.stack,
|
|
379
|
+
isFatal: !!isFatal,
|
|
380
|
+
breadcrumbs: options.breadcrumbs?.snapshot()
|
|
381
|
+
};
|
|
382
|
+
Promise.resolve(options.onCrash(info)).catch(() => {
|
|
383
|
+
});
|
|
384
|
+
}
|
|
374
385
|
if (chainPrevious && previousHandler) {
|
|
375
386
|
previousHandler(error, isFatal);
|
|
376
387
|
}
|
|
@@ -378,6 +389,10 @@ function installCrashHandler(options) {
|
|
|
378
389
|
errorUtils?.setGlobalHandler(handler);
|
|
379
390
|
const handleRejection = (event) => {
|
|
380
391
|
const reason = event?.reason;
|
|
392
|
+
if (isNetworkError(reason)) {
|
|
393
|
+
noteNetworkError(reason);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
381
396
|
const err = reason instanceof Error ? reason : new Error(typeof reason === "string" ? reason : "unhandled rejection");
|
|
382
397
|
handler(err, false);
|
|
383
398
|
};
|
|
@@ -388,23 +403,68 @@ function installCrashHandler(options) {
|
|
|
388
403
|
target?.removeEventListener?.("unhandledrejection", handleRejection);
|
|
389
404
|
};
|
|
390
405
|
}
|
|
406
|
+
function isNetworkError(value) {
|
|
407
|
+
if (typeof value === "string") return NETWORK_MESSAGE.test(value);
|
|
408
|
+
if (typeof value !== "object" || value === null) return false;
|
|
409
|
+
const { name, code, message } = value;
|
|
410
|
+
if (typeof code === "string" && NETWORK_CODES.has(code)) return true;
|
|
411
|
+
if (typeof name === "string" && NETWORK_NAMES.has(name)) return true;
|
|
412
|
+
return typeof message === "string" && NETWORK_MESSAGE.test(message);
|
|
413
|
+
}
|
|
414
|
+
var NETWORK_CODES = /* @__PURE__ */ new Set(["ERR_NETWORK", "ECONNABORTED", "ETIMEDOUT", "ERR_CANCELED"]);
|
|
415
|
+
var NETWORK_NAMES = /* @__PURE__ */ new Set(["NetworkError", "AbortError", "TimeoutError", "CanceledError"]);
|
|
416
|
+
var NETWORK_MESSAGE = new RegExp(
|
|
417
|
+
"^(" + [
|
|
418
|
+
"Failed to fetch",
|
|
419
|
+
"Load failed",
|
|
420
|
+
"A network error occurred\\.?",
|
|
421
|
+
"NetworkError when attempting to fetch resource\\.?",
|
|
422
|
+
"Network request failed",
|
|
423
|
+
"Network Error",
|
|
424
|
+
"The network connection was lost\\.?",
|
|
425
|
+
"The Internet connection appears to be offline\\.?"
|
|
426
|
+
].join("|") + ")$",
|
|
427
|
+
"i"
|
|
428
|
+
);
|
|
429
|
+
function crashSignature(info) {
|
|
430
|
+
return `${info.message}
|
|
431
|
+
${topFrame(info.stack)}`;
|
|
432
|
+
}
|
|
433
|
+
function topFrame(stack) {
|
|
434
|
+
for (const line of stack?.split("\n") ?? []) {
|
|
435
|
+
const frame = line.trim();
|
|
436
|
+
if (/^at\s/.test(frame) || /@.*:\d+(:\d+)?$/.test(frame)) return frame;
|
|
437
|
+
}
|
|
438
|
+
return "";
|
|
439
|
+
}
|
|
440
|
+
function errorMessage(value) {
|
|
441
|
+
if (typeof value === "string") return value;
|
|
442
|
+
const message = value?.message;
|
|
443
|
+
return typeof message === "string" ? message : String(value);
|
|
444
|
+
}
|
|
391
445
|
|
|
392
446
|
// src/crashQueue.ts
|
|
393
447
|
var CRASH_QUEUE_KEY = "queue/crashes";
|
|
394
448
|
var CrashQueue = class {
|
|
395
449
|
constructor(storage) {
|
|
396
450
|
this.storage = storage;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
451
|
+
// enqueue and remove read, change and write the whole list. Run them
|
|
452
|
+
// one after another: interleaved, a write lost a crash or brought a
|
|
453
|
+
// removed (already sent) one back, which was then sent again.
|
|
454
|
+
this.tail = Promise.resolve();
|
|
455
|
+
}
|
|
456
|
+
enqueue(info) {
|
|
457
|
+
return this.exclusive(async () => {
|
|
458
|
+
const queue = await this.read() ?? [];
|
|
459
|
+
const entry = {
|
|
460
|
+
id: uuidv4(),
|
|
461
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
462
|
+
info
|
|
463
|
+
};
|
|
464
|
+
queue.push(entry);
|
|
465
|
+
await this.storage.set(CRASH_QUEUE_KEY, queue);
|
|
466
|
+
return entry;
|
|
467
|
+
});
|
|
408
468
|
}
|
|
409
469
|
async pending() {
|
|
410
470
|
return await this.read() ?? [];
|
|
@@ -412,22 +472,27 @@ var CrashQueue = class {
|
|
|
412
472
|
async size() {
|
|
413
473
|
return (await this.read())?.length ?? 0;
|
|
414
474
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
475
|
+
remove(id) {
|
|
476
|
+
return this.exclusive(async () => {
|
|
477
|
+
const queue = await this.read() ?? [];
|
|
478
|
+
const next = queue.filter((entry) => entry.id !== id);
|
|
479
|
+
if (next.length === 0) {
|
|
480
|
+
await this.storage.remove(CRASH_QUEUE_KEY);
|
|
481
|
+
} else {
|
|
482
|
+
await this.storage.set(CRASH_QUEUE_KEY, next);
|
|
483
|
+
}
|
|
484
|
+
});
|
|
423
485
|
}
|
|
424
486
|
async read() {
|
|
425
487
|
return this.storage.get(CRASH_QUEUE_KEY);
|
|
426
488
|
}
|
|
489
|
+
exclusive(op) {
|
|
490
|
+
const run = this.tail.then(op);
|
|
491
|
+
this.tail = run.catch(() => {
|
|
492
|
+
});
|
|
493
|
+
return run;
|
|
494
|
+
}
|
|
427
495
|
};
|
|
428
|
-
function cryptoRandomId() {
|
|
429
|
-
return Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
430
|
-
}
|
|
431
496
|
|
|
432
497
|
// src/queue.ts
|
|
433
498
|
var QUEUE_KEY = "queue/bug-reports";
|
|
@@ -439,7 +504,7 @@ var SubmitQueue = class {
|
|
|
439
504
|
async enqueue(payload, options) {
|
|
440
505
|
const queue = await this.read() ?? [];
|
|
441
506
|
const entry = {
|
|
442
|
-
id:
|
|
507
|
+
id: cryptoRandomId(),
|
|
443
508
|
// Reuse the caller's key when supplied — that's how the first
|
|
444
509
|
// submit attempt's key carries through to the queued retry, so
|
|
445
510
|
// the server's dedup matches across attempts. When the caller
|
|
@@ -509,7 +574,7 @@ var AttachmentQueue = class {
|
|
|
509
574
|
async enqueue(bugReportId, attachment) {
|
|
510
575
|
const queue = await this.read() ?? [];
|
|
511
576
|
const entry = {
|
|
512
|
-
id:
|
|
577
|
+
id: cryptoRandomId(),
|
|
513
578
|
bugReportId,
|
|
514
579
|
queuedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
515
580
|
attachment
|
|
@@ -579,7 +644,7 @@ function describe(e) {
|
|
|
579
644
|
return String(e);
|
|
580
645
|
}
|
|
581
646
|
}
|
|
582
|
-
function
|
|
647
|
+
function cryptoRandomId() {
|
|
583
648
|
return Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
584
649
|
}
|
|
585
650
|
|
|
@@ -938,7 +1003,7 @@ function findAssignmentForTask(tasks, key) {
|
|
|
938
1003
|
}
|
|
939
1004
|
|
|
940
1005
|
// package.json
|
|
941
|
-
var version = "0.7.
|
|
1006
|
+
var version = "0.7.5";
|
|
942
1007
|
|
|
943
1008
|
// src/version.ts
|
|
944
1009
|
var SDK_VERSION = `@testerpaykit/expo/${version}`;
|
|
@@ -971,6 +1036,12 @@ var TpkExpo = class _TpkExpo {
|
|
|
971
1036
|
this.sessionEvents = [];
|
|
972
1037
|
this.uninstallDurableSync = null;
|
|
973
1038
|
this.uninstallTaskBinding = null;
|
|
1039
|
+
// Crash signatures seen / sent in this session. The console sent 312
|
|
1040
|
+
// identical crash reports in 30 days (2026-10-22): one report per
|
|
1041
|
+
// occurrence of the same crash adds nothing after the first.
|
|
1042
|
+
this.capturedCrashes = /* @__PURE__ */ new Set();
|
|
1043
|
+
this.submittedCrashes = /* @__PURE__ */ new Set();
|
|
1044
|
+
this.crashFlush = Promise.resolve();
|
|
974
1045
|
/** Active server session id. Updated by init or rotate. Used to route telemetry. */
|
|
975
1046
|
this.sessionId = "";
|
|
976
1047
|
this._ready = ready;
|
|
@@ -1348,13 +1419,28 @@ var TpkExpo = class _TpkExpo {
|
|
|
1348
1419
|
/**
|
|
1349
1420
|
* Try uploading cached crashes. Failed uploads remain cached so a
|
|
1350
1421
|
* future launch can surface them for review or retry.
|
|
1422
|
+
*
|
|
1423
|
+
* Flushes run one after another: two at once both read the same
|
|
1424
|
+
* cached crash and both sent it.
|
|
1351
1425
|
*/
|
|
1352
|
-
|
|
1426
|
+
flushCachedCrashes() {
|
|
1427
|
+
const run = this.crashFlush.then(() => this.drainCrashQueue());
|
|
1428
|
+
this.crashFlush = run.catch(() => {
|
|
1429
|
+
});
|
|
1430
|
+
return run;
|
|
1431
|
+
}
|
|
1432
|
+
async drainCrashQueue() {
|
|
1353
1433
|
const crashes = await this.crashQueue.pending();
|
|
1354
1434
|
let submitted = 0;
|
|
1355
1435
|
for (const crash of crashes) {
|
|
1436
|
+
const signature = crashSignature(crash.info);
|
|
1437
|
+
if (isNetworkError(crash.info.message) || this.submittedCrashes.has(signature)) {
|
|
1438
|
+
await this.crashQueue.remove(crash.id);
|
|
1439
|
+
continue;
|
|
1440
|
+
}
|
|
1356
1441
|
try {
|
|
1357
|
-
await this.submitCrashReport(crash.info);
|
|
1442
|
+
await this.submitCrashReport(crash.info, crash.id);
|
|
1443
|
+
this.submittedCrashes.add(signature);
|
|
1358
1444
|
await this.crashQueue.remove(crash.id);
|
|
1359
1445
|
submitted++;
|
|
1360
1446
|
} catch {
|
|
@@ -1411,6 +1497,8 @@ var TpkExpo = class _TpkExpo {
|
|
|
1411
1497
|
this.config.projectId,
|
|
1412
1498
|
this.config.testerCode
|
|
1413
1499
|
);
|
|
1500
|
+
this.capturedCrashes.clear();
|
|
1501
|
+
this.submittedCrashes.clear();
|
|
1414
1502
|
this.breadcrumbs.record({ action: "tpk", target: "session_rotated" });
|
|
1415
1503
|
}
|
|
1416
1504
|
/** Drop the cached anon-tester JWT — next init() re-acquires one. */
|
|
@@ -1513,6 +1601,9 @@ var TpkExpo = class _TpkExpo {
|
|
|
1513
1601
|
}
|
|
1514
1602
|
/** Persist crash context before attempting a best-effort upload. */
|
|
1515
1603
|
async captureCrash(info) {
|
|
1604
|
+
const signature = crashSignature(info);
|
|
1605
|
+
if (this.capturedCrashes.has(signature)) return;
|
|
1606
|
+
this.capturedCrashes.add(signature);
|
|
1516
1607
|
this.breadcrumbs.record({
|
|
1517
1608
|
action: "crash",
|
|
1518
1609
|
target: truncate(info.message, 120),
|
|
@@ -1522,7 +1613,7 @@ var TpkExpo = class _TpkExpo {
|
|
|
1522
1613
|
await this.flushCachedCrashes();
|
|
1523
1614
|
}
|
|
1524
1615
|
/** Auto-built crash submit — called from the cached crash flusher. */
|
|
1525
|
-
async submitCrashReport(info) {
|
|
1616
|
+
async submitCrashReport(info, crashId) {
|
|
1526
1617
|
const payload = await this.buildPayload({
|
|
1527
1618
|
type: "crash",
|
|
1528
1619
|
severity: info.isFatal ? "high" : "medium",
|
|
@@ -1531,7 +1622,7 @@ var TpkExpo = class _TpkExpo {
|
|
|
1531
1622
|
description: composeCrashDescription(info),
|
|
1532
1623
|
currentScreen: lastScreen(this.breadcrumbs) ?? "unknown"
|
|
1533
1624
|
});
|
|
1534
|
-
await this.api.submitBugReport(payload, { idempotencyKey:
|
|
1625
|
+
await this.api.submitBugReport(payload, { idempotencyKey: crashId });
|
|
1535
1626
|
this.breadcrumbs.record({ action: "tpk", target: "crash_submitted" });
|
|
1536
1627
|
}
|
|
1537
1628
|
};
|
|
@@ -3141,6 +3232,7 @@ function BugReportSheet({
|
|
|
3141
3232
|
onError,
|
|
3142
3233
|
defaultSeverity = "medium",
|
|
3143
3234
|
initialDraft: initialDraftPatch,
|
|
3235
|
+
initialStep = 0,
|
|
3144
3236
|
maxAttachments = DEFAULT_MAX_ATTACHMENTS,
|
|
3145
3237
|
maxTotalSizeMB = DEFAULT_MAX_TOTAL_MB,
|
|
3146
3238
|
style
|
|
@@ -3158,7 +3250,7 @@ function BugReportSheet({
|
|
|
3158
3250
|
reproductionSteps: initialDraftPatch.reproductionSteps ?? base.reproductionSteps
|
|
3159
3251
|
};
|
|
3160
3252
|
}, [currentScreen, defaultSeverity, initialDraftPatch]);
|
|
3161
|
-
const [step, setStep] = useState4(
|
|
3253
|
+
const [step, setStep] = useState4(initialStep);
|
|
3162
3254
|
const [draft, setDraft] = useState4(initialDraft);
|
|
3163
3255
|
const [stepInput, setStepInput] = useState4("");
|
|
3164
3256
|
const [submitting, setSubmitting] = useState4(false);
|
|
@@ -3166,13 +3258,13 @@ function BugReportSheet({
|
|
|
3166
3258
|
const [submitBanner, setSubmitBanner] = useState4(null);
|
|
3167
3259
|
useEffect4(() => {
|
|
3168
3260
|
if (visible) {
|
|
3169
|
-
setStep(
|
|
3261
|
+
setStep(initialStep);
|
|
3170
3262
|
setDraft(initialDraft);
|
|
3171
3263
|
setStepInput("");
|
|
3172
3264
|
setAttachmentError(null);
|
|
3173
3265
|
setSubmitBanner(null);
|
|
3174
3266
|
}
|
|
3175
|
-
}, [visible, initialDraft]);
|
|
3267
|
+
}, [visible, initialDraft, initialStep]);
|
|
3176
3268
|
const totalSizeMB = useMemo3(() => {
|
|
3177
3269
|
const bytes = draft.attachments.reduce(
|
|
3178
3270
|
(sum, a) => sum + (a.byteLength ?? Math.ceil(a.base64.length * 0.75)),
|
|
@@ -9736,7 +9828,7 @@ function AiRemoteControl({
|
|
|
9736
9828
|
}) {
|
|
9737
9829
|
const [status, setStatus] = useState17("choosing");
|
|
9738
9830
|
const [actionCount, setActionCount] = useState17(0);
|
|
9739
|
-
const [
|
|
9831
|
+
const [errorMessage2, setErrorMessage] = useState17(null);
|
|
9740
9832
|
const [sessionId, setSessionId] = useState17(null);
|
|
9741
9833
|
const [personas, setPersonas] = useState17([]);
|
|
9742
9834
|
const [selectedPersona, setSelectedPersona] = useState17("junior_tester");
|
|
@@ -9985,7 +10077,7 @@ function AiRemoteControl({
|
|
|
9985
10077
|
style: styles17.startButton
|
|
9986
10078
|
},
|
|
9987
10079
|
/* @__PURE__ */ React20.createElement(Text16, { style: styles17.stopText }, "Start AI test")
|
|
9988
|
-
))) : /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Text16, { style: styles17.subtitle }, status === "starting" && "Starting up\u2026", status === "running" && `Action ${actionCount} \u2014 exploring`, status === "paused" && "Paused (you took over)", status === "ended" && "Session ended", status === "error" && (
|
|
10080
|
+
))) : /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Text16, { style: styles17.subtitle }, status === "starting" && "Starting up\u2026", status === "running" && `Action ${actionCount} \u2014 exploring`, status === "paused" && "Paused (you took over)", status === "ended" && "Session ended", status === "error" && (errorMessage2 ?? "Error")), status === "running" || status === "paused" ? /* @__PURE__ */ React20.createElement(Text16, { style: styles17.hint }, "Tap anywhere outside to pause. Use Stop to end the session.") : null, /* @__PURE__ */ React20.createElement(
|
|
9989
10081
|
Pressable15,
|
|
9990
10082
|
{
|
|
9991
10083
|
accessibilityRole: "button",
|
|
@@ -10281,6 +10373,7 @@ function TesterPayKitWrapper({
|
|
|
10281
10373
|
currentScreen,
|
|
10282
10374
|
captureRootRef: rootRef,
|
|
10283
10375
|
initialDraft: bugInitialDraft ?? void 0,
|
|
10376
|
+
initialStep: bugInitialDraft ? 4 : 0,
|
|
10284
10377
|
onOpenVoiceBug: () => {
|
|
10285
10378
|
setBugOpen(false);
|
|
10286
10379
|
setVoiceOpen(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testerpaykit/expo",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "TesterPayKit Expo / React-Native bindings — shake-to-report, device info, bug-report hook",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -78,7 +78,9 @@
|
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/react": "^19.3.0",
|
|
81
|
+
"@types/react-dom": "^19.3.0",
|
|
81
82
|
"jsdom": "^30.1.3",
|
|
83
|
+
"react-dom": "^19.3.1",
|
|
82
84
|
"tsup": "^9.0.0",
|
|
83
85
|
"typescript": "^6.0.3",
|
|
84
86
|
"vitest": "^5.0.5"
|