@testerpaykit/expo 0.4.1 → 0.6.1
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 +40 -0
- package/README.md +46 -3
- package/app.plugin.js +65 -0
- package/dist/index.d.mts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +259 -82
- package/dist/index.mjs +259 -81
- package/package.json +3 -4
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,117 @@ import {
|
|
|
2
2
|
installNetworkCapture
|
|
3
3
|
} from "./chunk-AGHDTD54.mjs";
|
|
4
4
|
|
|
5
|
+
// src/setup-check.ts
|
|
6
|
+
var PROBES = [
|
|
7
|
+
{
|
|
8
|
+
probe: () => import("react-native-view-shot"),
|
|
9
|
+
module: "react-native-view-shot",
|
|
10
|
+
feature: "automatic screenshots on bug reports"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
probe: () => import("react-native-record-screen"),
|
|
14
|
+
module: "react-native-record-screen",
|
|
15
|
+
feature: "screen recording attachments"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
probe: () => import("@shopify/react-native-skia"),
|
|
19
|
+
module: "@shopify/react-native-skia",
|
|
20
|
+
feature: "screenshot annotation editor"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
probe: () => import("react-native-draggable-flatlist"),
|
|
24
|
+
module: "react-native-draggable-flatlist",
|
|
25
|
+
feature: "annotation layer reordering"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
probe: () => import("expo-audio"),
|
|
29
|
+
module: "expo-audio",
|
|
30
|
+
feature: "voice bug reports (recording)"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
probe: () => import("expo-file-system"),
|
|
34
|
+
module: "expo-file-system",
|
|
35
|
+
feature: "voice note / recording upload"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
probe: () => import("expo-sensors"),
|
|
39
|
+
module: "expo-sensors",
|
|
40
|
+
feature: "shake-to-report"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
probe: () => import("expo-device"),
|
|
44
|
+
module: "expo-device",
|
|
45
|
+
feature: "device metadata on reports"
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
var ran = false;
|
|
49
|
+
function runSetupCheck() {
|
|
50
|
+
if (ran) return;
|
|
51
|
+
ran = true;
|
|
52
|
+
if (typeof __DEV__ !== "undefined" && !__DEV__) return;
|
|
53
|
+
void (async () => {
|
|
54
|
+
const missing = [];
|
|
55
|
+
for (const entry of PROBES) {
|
|
56
|
+
try {
|
|
57
|
+
await entry.probe();
|
|
58
|
+
} catch {
|
|
59
|
+
missing.push(entry);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (missing.length === 0) return;
|
|
63
|
+
const lines = missing.map((m) => ` - ${m.module} \u2192 ${m.feature} is OFF`).join("\n");
|
|
64
|
+
console.log(
|
|
65
|
+
`[testerpaykit/expo] optional modules missing (features disabled):
|
|
66
|
+
${lines}
|
|
67
|
+
Install the ones whose feature you want; the SDK works without them.`
|
|
68
|
+
);
|
|
69
|
+
})();
|
|
70
|
+
}
|
|
71
|
+
|
|
5
72
|
// src/client.ts
|
|
6
73
|
import {
|
|
7
74
|
TesterPayKitApiClient
|
|
8
75
|
} from "@testerpaykit/api-client";
|
|
9
|
-
|
|
76
|
+
|
|
77
|
+
// src/uuid.ts
|
|
78
|
+
function bytesToUuid(bytes) {
|
|
79
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
80
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
81
|
+
const hex = [];
|
|
82
|
+
for (let i = 0; i < 256; i++) hex.push((i + 256).toString(16).slice(1));
|
|
83
|
+
return hex[bytes[0]] + hex[bytes[1]] + hex[bytes[2]] + hex[bytes[3]] + "-" + hex[bytes[4]] + hex[bytes[5]] + "-" + hex[bytes[6]] + hex[bytes[7]] + "-" + hex[bytes[8]] + hex[bytes[9]] + "-" + hex[bytes[10]] + hex[bytes[11]] + hex[bytes[12]] + hex[bytes[13]] + hex[bytes[14]] + hex[bytes[15]];
|
|
84
|
+
}
|
|
85
|
+
var expoCryptoModule;
|
|
86
|
+
void (async () => {
|
|
87
|
+
try {
|
|
88
|
+
expoCryptoModule = await import("expo-crypto");
|
|
89
|
+
} catch {
|
|
90
|
+
expoCryptoModule = null;
|
|
91
|
+
}
|
|
92
|
+
})();
|
|
93
|
+
function expoCrypto() {
|
|
94
|
+
return expoCryptoModule;
|
|
95
|
+
}
|
|
96
|
+
function uuidv4() {
|
|
97
|
+
const c = globalThis.crypto;
|
|
98
|
+
if (typeof c?.randomUUID === "function") return c.randomUUID();
|
|
99
|
+
if (typeof c?.getRandomValues === "function") {
|
|
100
|
+
return bytesToUuid(c.getRandomValues(new Uint8Array(16)));
|
|
101
|
+
}
|
|
102
|
+
const ec = expoCrypto();
|
|
103
|
+
if (typeof ec?.randomUUID === "function") return ec.randomUUID();
|
|
104
|
+
if (typeof ec?.getRandomValues === "function") {
|
|
105
|
+
return bytesToUuid(ec.getRandomValues(new Uint8Array(16)));
|
|
106
|
+
}
|
|
107
|
+
const bytes = new Uint8Array(16);
|
|
108
|
+
const now = Date.now();
|
|
109
|
+
for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);
|
|
110
|
+
bytes[0] ^= now & 255;
|
|
111
|
+
bytes[1] ^= now >> 8 & 255;
|
|
112
|
+
return bytesToUuid(bytes);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// src/client.ts
|
|
10
116
|
import { AppState } from "react-native";
|
|
11
117
|
|
|
12
118
|
// src/storage.ts
|
|
@@ -279,7 +385,6 @@ function cryptoRandomId() {
|
|
|
279
385
|
}
|
|
280
386
|
|
|
281
387
|
// src/queue.ts
|
|
282
|
-
import { v4 as uuidv4 } from "uuid";
|
|
283
388
|
var QUEUE_KEY = "queue/bug-reports";
|
|
284
389
|
var ATTACHMENT_QUEUE_KEY = "queue/attachments";
|
|
285
390
|
var SubmitQueue = class {
|
|
@@ -829,6 +934,7 @@ var TpkExpo = class _TpkExpo {
|
|
|
829
934
|
return this._ready;
|
|
830
935
|
}
|
|
831
936
|
static async init(config) {
|
|
937
|
+
runSetupCheck();
|
|
832
938
|
const storage = config.storage ?? new ExpoStorage();
|
|
833
939
|
const api = new TesterPayKitApiClient({
|
|
834
940
|
baseURL: config.apiBaseUrl,
|
|
@@ -838,13 +944,13 @@ var TpkExpo = class _TpkExpo {
|
|
|
838
944
|
const queue = new SubmitQueue(storage);
|
|
839
945
|
const attachmentQueue = new AttachmentQueue(storage);
|
|
840
946
|
const crashQueue = new CrashQueue(storage);
|
|
841
|
-
const
|
|
947
|
+
const cached2 = await storage.get(STORAGE_KEY_AUTH);
|
|
842
948
|
let tester;
|
|
843
949
|
let authReady;
|
|
844
950
|
let hasCachedAuth = false;
|
|
845
|
-
if (
|
|
846
|
-
api.setAccessToken(
|
|
847
|
-
tester =
|
|
951
|
+
if (cached2 && cached2.tester.projectId === config.projectId && cached2.tester.code.toUpperCase() === config.testerCode.toUpperCase()) {
|
|
952
|
+
api.setAccessToken(cached2.accessToken);
|
|
953
|
+
tester = cached2.tester;
|
|
848
954
|
hasCachedAuth = true;
|
|
849
955
|
authReady = Promise.resolve();
|
|
850
956
|
} else {
|
|
@@ -942,7 +1048,7 @@ var TpkExpo = class _TpkExpo {
|
|
|
942
1048
|
*/
|
|
943
1049
|
async submitBug(input) {
|
|
944
1050
|
const payload = await this.buildPayload(input);
|
|
945
|
-
const idempotencyKey =
|
|
1051
|
+
const idempotencyKey = uuidv4();
|
|
946
1052
|
try {
|
|
947
1053
|
const response = await this.api.submitBugReport(payload, {
|
|
948
1054
|
idempotencyKey
|
|
@@ -1187,6 +1293,9 @@ var TpkExpo = class _TpkExpo {
|
|
|
1187
1293
|
}
|
|
1188
1294
|
/** Flush pending session events + breadcrumbs to timeline endpoints. */
|
|
1189
1295
|
async flushTelemetry() {
|
|
1296
|
+
if (!this.sessionId) {
|
|
1297
|
+
return { eventsInserted: 0, breadcrumbsInserted: 0 };
|
|
1298
|
+
}
|
|
1190
1299
|
const pendingEvents = [...this.sessionEvents];
|
|
1191
1300
|
const pendingBreadcrumbs = this.breadcrumbs.pendingSnapshot();
|
|
1192
1301
|
let eventsInserted = 0;
|
|
@@ -1345,7 +1454,7 @@ var TpkExpo = class _TpkExpo {
|
|
|
1345
1454
|
description: composeCrashDescription(info),
|
|
1346
1455
|
currentScreen: lastScreen(this.breadcrumbs) ?? "unknown"
|
|
1347
1456
|
});
|
|
1348
|
-
await this.api.submitBugReport(payload, { idempotencyKey:
|
|
1457
|
+
await this.api.submitBugReport(payload, { idempotencyKey: uuidv4() });
|
|
1349
1458
|
this.breadcrumbs.record({ action: "tpk", target: "crash_submitted" });
|
|
1350
1459
|
}
|
|
1351
1460
|
};
|
|
@@ -1397,13 +1506,13 @@ async function startServerSession(api, projectId) {
|
|
|
1397
1506
|
return session.id;
|
|
1398
1507
|
}
|
|
1399
1508
|
async function loadPersistedSession(storage, projectId, testerCode) {
|
|
1400
|
-
const
|
|
1401
|
-
if (!
|
|
1402
|
-
if (
|
|
1403
|
-
if (
|
|
1404
|
-
const age = Date.now() -
|
|
1509
|
+
const cached2 = await storage.get(STORAGE_KEY_SESSION);
|
|
1510
|
+
if (!cached2) return null;
|
|
1511
|
+
if (cached2.projectId !== projectId) return null;
|
|
1512
|
+
if (cached2.testerCode.toUpperCase() !== testerCode.toUpperCase()) return null;
|
|
1513
|
+
const age = Date.now() - cached2.createdAt;
|
|
1405
1514
|
if (age > SESSION_TTL_MS) return null;
|
|
1406
|
-
return
|
|
1515
|
+
return cached2.sessionId;
|
|
1407
1516
|
}
|
|
1408
1517
|
async function persistSession(storage, sessionId, projectId, testerCode) {
|
|
1409
1518
|
const value = {
|
|
@@ -1565,6 +1674,7 @@ import {
|
|
|
1565
1674
|
Pressable as Pressable2,
|
|
1566
1675
|
StyleSheet as StyleSheet2,
|
|
1567
1676
|
Text as Text3,
|
|
1677
|
+
useWindowDimensions,
|
|
1568
1678
|
View as View2
|
|
1569
1679
|
} from "react-native";
|
|
1570
1680
|
|
|
@@ -2228,10 +2338,10 @@ function FloatingFeedbackButton({
|
|
|
2228
2338
|
onPanResponderMove: (_, gesture) => {
|
|
2229
2339
|
const start = dragStartRef.current;
|
|
2230
2340
|
if (!start) return;
|
|
2231
|
-
const
|
|
2341
|
+
const win2 = Dimensions2.get("window");
|
|
2232
2342
|
setPos({
|
|
2233
|
-
x: clamp(start.x + gesture.dx, 0,
|
|
2234
|
-
y: clamp(start.y + gesture.dy, 0,
|
|
2343
|
+
x: clamp(start.x + gesture.dx, 0, win2.width - FAB_SIZE),
|
|
2344
|
+
y: clamp(start.y + gesture.dy, 0, win2.height - FAB_SIZE)
|
|
2235
2345
|
});
|
|
2236
2346
|
},
|
|
2237
2347
|
onPanResponderRelease: () => {
|
|
@@ -2371,6 +2481,11 @@ function FloatingFeedbackButton({
|
|
|
2371
2481
|
inputRange: [0, 1],
|
|
2372
2482
|
outputRange: ["0deg", "45deg"]
|
|
2373
2483
|
});
|
|
2484
|
+
const win = useWindowDimensions();
|
|
2485
|
+
const openUp = pos.y + FAB_SIZE / 2 > win.height / 2;
|
|
2486
|
+
const openLeft = pos.x + FAB_SIZE / 2 > win.width / 2;
|
|
2487
|
+
const anchorHorizontal = openLeft ? { right: win.width - pos.x - FAB_SIZE, alignItems: "flex-end" } : { left: pos.x, alignItems: "flex-start" };
|
|
2488
|
+
const anchorPos = openUp ? { ...anchorHorizontal, bottom: win.height - pos.y - FAB_SIZE } : { ...anchorHorizontal, top: pos.y };
|
|
2374
2489
|
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(WidgetTour, { visible: tourVisible, onDone: handleTourDone }), expanded && /* @__PURE__ */ React5.createElement(
|
|
2375
2490
|
Pressable2,
|
|
2376
2491
|
{
|
|
@@ -2382,7 +2497,12 @@ function FloatingFeedbackButton({
|
|
|
2382
2497
|
View2,
|
|
2383
2498
|
{
|
|
2384
2499
|
pointerEvents: "box-none",
|
|
2385
|
-
style: [
|
|
2500
|
+
style: [
|
|
2501
|
+
styles2.anchor,
|
|
2502
|
+
anchorPos,
|
|
2503
|
+
!openUp && styles2.anchorDown,
|
|
2504
|
+
style
|
|
2505
|
+
],
|
|
2386
2506
|
testID
|
|
2387
2507
|
},
|
|
2388
2508
|
/* @__PURE__ */ React5.createElement(
|
|
@@ -2391,6 +2511,9 @@ function FloatingFeedbackButton({
|
|
|
2391
2511
|
pointerEvents: expanded ? "auto" : "none",
|
|
2392
2512
|
style: [
|
|
2393
2513
|
styles2.menu,
|
|
2514
|
+
// Never wider than the window minus a margin — labels wrap
|
|
2515
|
+
// instead of clipping on narrow devices.
|
|
2516
|
+
{ maxWidth: win.width - 24 },
|
|
2394
2517
|
{
|
|
2395
2518
|
opacity: expandAnim,
|
|
2396
2519
|
transform: [
|
|
@@ -2516,8 +2639,13 @@ var styles2 = StyleSheet2.create({
|
|
|
2516
2639
|
alignItems: "flex-start",
|
|
2517
2640
|
zIndex: 9999
|
|
2518
2641
|
},
|
|
2642
|
+
// Upper-half FAB: same child order (menu, FAB), reversed layout so
|
|
2643
|
+
// the FAB renders on top and the menu extends downward below it.
|
|
2644
|
+
anchorDown: {
|
|
2645
|
+
flexDirection: "column-reverse"
|
|
2646
|
+
},
|
|
2519
2647
|
menu: {
|
|
2520
|
-
|
|
2648
|
+
marginVertical: 8,
|
|
2521
2649
|
minWidth: 220,
|
|
2522
2650
|
backgroundColor: "#FFFFFF",
|
|
2523
2651
|
borderRadius: 12,
|
|
@@ -2920,12 +3048,14 @@ function BugReportSheet({
|
|
|
2920
3048
|
const [stepInput, setStepInput] = useState4("");
|
|
2921
3049
|
const [submitting, setSubmitting] = useState4(false);
|
|
2922
3050
|
const [attachmentError, setAttachmentError] = useState4(null);
|
|
3051
|
+
const [submitBanner, setSubmitBanner] = useState4(null);
|
|
2923
3052
|
useEffect4(() => {
|
|
2924
3053
|
if (visible) {
|
|
2925
3054
|
setStep(0);
|
|
2926
3055
|
setDraft(initialDraft);
|
|
2927
3056
|
setStepInput("");
|
|
2928
3057
|
setAttachmentError(null);
|
|
3058
|
+
setSubmitBanner(null);
|
|
2929
3059
|
}
|
|
2930
3060
|
}, [visible, initialDraft]);
|
|
2931
3061
|
const totalSizeMB = useMemo3(() => {
|
|
@@ -2961,14 +3091,22 @@ function BugReportSheet({
|
|
|
2961
3091
|
return;
|
|
2962
3092
|
}
|
|
2963
3093
|
setSubmitting(true);
|
|
3094
|
+
setSubmitBanner(null);
|
|
2964
3095
|
try {
|
|
2965
3096
|
const response = await submitBugReportDraft(tpk, draft);
|
|
2966
3097
|
onSubmitted?.(response);
|
|
3098
|
+
if (response.outcome === "failedPermanent") {
|
|
3099
|
+
setSubmitBanner(
|
|
3100
|
+
"Could not submit \u2014 the server rejected the report (your tester session may have expired). Your draft is kept; please try again."
|
|
3101
|
+
);
|
|
3102
|
+
return;
|
|
3103
|
+
}
|
|
2967
3104
|
onClose();
|
|
2968
3105
|
} catch (cause) {
|
|
2969
3106
|
onError?.(
|
|
2970
3107
|
cause instanceof Error ? cause : new Error("Bug report failed.")
|
|
2971
3108
|
);
|
|
3109
|
+
setSubmitBanner("Bug report failed \u2014 please try again.");
|
|
2972
3110
|
} finally {
|
|
2973
3111
|
setSubmitting(false);
|
|
2974
3112
|
}
|
|
@@ -3181,7 +3319,15 @@ function BugReportSheet({
|
|
|
3181
3319
|
}),
|
|
3182
3320
|
onReorder: (next) => patchDraft({ reproductionSteps: next })
|
|
3183
3321
|
}
|
|
3184
|
-
), step === 4 && /* @__PURE__ */ React6.createElement(ReviewStep, { draft })), /* @__PURE__ */ React6.createElement(
|
|
3322
|
+
), step === 4 && /* @__PURE__ */ React6.createElement(ReviewStep, { draft })), submitBanner && /* @__PURE__ */ React6.createElement(
|
|
3323
|
+
View3,
|
|
3324
|
+
{
|
|
3325
|
+
accessibilityRole: "alert",
|
|
3326
|
+
accessibilityLabel: submitBanner,
|
|
3327
|
+
style: styles3.submitBanner
|
|
3328
|
+
},
|
|
3329
|
+
/* @__PURE__ */ React6.createElement(Text4, { style: styles3.submitBannerText }, submitBanner)
|
|
3330
|
+
), /* @__PURE__ */ React6.createElement(
|
|
3185
3331
|
Footer,
|
|
3186
3332
|
{
|
|
3187
3333
|
step,
|
|
@@ -3543,14 +3689,14 @@ function ReviewStep({
|
|
|
3543
3689
|
value: draft.description || "(empty)",
|
|
3544
3690
|
multiline: true
|
|
3545
3691
|
}
|
|
3546
|
-
), draft.expectedBehavior.trim() && /* @__PURE__ */ React6.createElement(
|
|
3692
|
+
), draft.expectedBehavior.trim().length > 0 && /* @__PURE__ */ React6.createElement(
|
|
3547
3693
|
ReviewLine,
|
|
3548
3694
|
{
|
|
3549
3695
|
label: "Expected",
|
|
3550
3696
|
value: draft.expectedBehavior,
|
|
3551
3697
|
multiline: true
|
|
3552
3698
|
}
|
|
3553
|
-
), draft.actualBehavior.trim() && /* @__PURE__ */ React6.createElement(
|
|
3699
|
+
), draft.actualBehavior.trim().length > 0 && /* @__PURE__ */ React6.createElement(
|
|
3554
3700
|
ReviewLine,
|
|
3555
3701
|
{
|
|
3556
3702
|
label: "Actual",
|
|
@@ -3563,7 +3709,7 @@ function ReviewStep({
|
|
|
3563
3709
|
label: "Frequency",
|
|
3564
3710
|
value: FREQUENCIES.find((f) => f.value === draft.frequency)?.label ?? draft.frequency
|
|
3565
3711
|
}
|
|
3566
|
-
), draft.affectedComponent && /* @__PURE__ */ React6.createElement(
|
|
3712
|
+
), !!draft.affectedComponent && /* @__PURE__ */ React6.createElement(
|
|
3567
3713
|
ReviewLine,
|
|
3568
3714
|
{
|
|
3569
3715
|
label: "Affected component",
|
|
@@ -4066,6 +4212,20 @@ var styles3 = StyleSheet3.create({
|
|
|
4066
4212
|
flexDirection: "row",
|
|
4067
4213
|
alignItems: "center"
|
|
4068
4214
|
},
|
|
4215
|
+
submitBanner: {
|
|
4216
|
+
marginHorizontal: 16,
|
|
4217
|
+
marginBottom: 8,
|
|
4218
|
+
padding: 12,
|
|
4219
|
+
borderRadius: 10,
|
|
4220
|
+
backgroundColor: "#FEF2F2",
|
|
4221
|
+
borderWidth: 1,
|
|
4222
|
+
borderColor: "#FECACA"
|
|
4223
|
+
},
|
|
4224
|
+
submitBannerText: {
|
|
4225
|
+
color: "#B91C1C",
|
|
4226
|
+
fontSize: 13,
|
|
4227
|
+
fontWeight: "600"
|
|
4228
|
+
},
|
|
4069
4229
|
footer: {
|
|
4070
4230
|
flexDirection: "row",
|
|
4071
4231
|
gap: 10,
|
|
@@ -7165,6 +7325,49 @@ var styles10 = StyleSheet10.create({
|
|
|
7165
7325
|
}
|
|
7166
7326
|
});
|
|
7167
7327
|
|
|
7328
|
+
// src/fs-legacy.ts
|
|
7329
|
+
var cached;
|
|
7330
|
+
async function legacyFileSystem() {
|
|
7331
|
+
if (cached !== void 0) return cached;
|
|
7332
|
+
try {
|
|
7333
|
+
const legacy = await import("expo-file-system/legacy");
|
|
7334
|
+
const fs = legacy.default ?? legacy;
|
|
7335
|
+
if (fs?.readAsStringAsync) {
|
|
7336
|
+
cached = fs;
|
|
7337
|
+
return cached;
|
|
7338
|
+
}
|
|
7339
|
+
} catch {
|
|
7340
|
+
}
|
|
7341
|
+
try {
|
|
7342
|
+
const mod = await import("expo-file-system");
|
|
7343
|
+
cached = mod.default ?? mod;
|
|
7344
|
+
} catch {
|
|
7345
|
+
cached = null;
|
|
7346
|
+
}
|
|
7347
|
+
return cached;
|
|
7348
|
+
}
|
|
7349
|
+
async function readFileAsBase64(uri) {
|
|
7350
|
+
try {
|
|
7351
|
+
const fs = await legacyFileSystem();
|
|
7352
|
+
if (!fs?.readAsStringAsync) return null;
|
|
7353
|
+
return await fs.readAsStringAsync(uri, {
|
|
7354
|
+
encoding: fs.EncodingType?.Base64 ?? "base64"
|
|
7355
|
+
});
|
|
7356
|
+
} catch {
|
|
7357
|
+
return null;
|
|
7358
|
+
}
|
|
7359
|
+
}
|
|
7360
|
+
async function readFileSize(uri) {
|
|
7361
|
+
try {
|
|
7362
|
+
const fs = await legacyFileSystem();
|
|
7363
|
+
if (!fs?.getInfoAsync) return 0;
|
|
7364
|
+
const info = await fs.getInfoAsync(uri);
|
|
7365
|
+
return info.size ?? 0;
|
|
7366
|
+
} catch {
|
|
7367
|
+
return 0;
|
|
7368
|
+
}
|
|
7369
|
+
}
|
|
7370
|
+
|
|
7168
7371
|
// src/VoiceBugInputSheet.tsx
|
|
7169
7372
|
import React14, {
|
|
7170
7373
|
useCallback as useCallback7,
|
|
@@ -7680,8 +7883,8 @@ async function cleanupRecorder(handle) {
|
|
|
7680
7883
|
w.stopMeter?.();
|
|
7681
7884
|
w.mediaRecorder.stream.getTracks().forEach((t) => t.stop());
|
|
7682
7885
|
} else {
|
|
7683
|
-
const
|
|
7684
|
-
if (
|
|
7886
|
+
const stop = handle.stop;
|
|
7887
|
+
if (stop) await stop.call(handle);
|
|
7685
7888
|
}
|
|
7686
7889
|
} catch {
|
|
7687
7890
|
}
|
|
@@ -7758,27 +7961,46 @@ async function stopWebRecording(handle) {
|
|
|
7758
7961
|
handle.mediaRecorder.stop();
|
|
7759
7962
|
});
|
|
7760
7963
|
}
|
|
7964
|
+
function nativeRecordingOptions(mod, os) {
|
|
7965
|
+
const preset = mod.RecordingPresets?.HIGH_QUALITY ?? {};
|
|
7966
|
+
const { android, ios, web, ...common } = preset;
|
|
7967
|
+
const platform = os === "ios" ? ios : os === "android" ? android : web;
|
|
7968
|
+
return { ...common, isMeteringEnabled: false, ...platform ?? {} };
|
|
7969
|
+
}
|
|
7761
7970
|
async function startNativeRecording() {
|
|
7762
7971
|
const mod = await import("expo-audio");
|
|
7763
7972
|
const granted = (await mod.AudioModule?.requestRecordingPermissionsAsync?.())?.granted;
|
|
7764
7973
|
if (granted === false) {
|
|
7765
7974
|
throw new Error("Microphone permission denied.");
|
|
7766
7975
|
}
|
|
7767
|
-
|
|
7976
|
+
const Recorder = mod.AudioModule?.AudioRecorder;
|
|
7977
|
+
if (!Recorder) {
|
|
7768
7978
|
throw new Error("Install expo-audio to enable voice bug reports.");
|
|
7769
7979
|
}
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7980
|
+
try {
|
|
7981
|
+
await mod.setAudioModeAsync?.({
|
|
7982
|
+
allowsRecording: true,
|
|
7983
|
+
playsInSilentMode: true
|
|
7984
|
+
});
|
|
7985
|
+
} catch {
|
|
7986
|
+
}
|
|
7987
|
+
const rec = new Recorder(nativeRecordingOptions(mod, Platform6.OS));
|
|
7988
|
+
await rec.prepareToRecordAsync();
|
|
7989
|
+
rec.record();
|
|
7773
7990
|
return rec;
|
|
7774
7991
|
}
|
|
7775
7992
|
async function stopNativeRecording(handle) {
|
|
7776
7993
|
const rec = handle;
|
|
7777
|
-
await rec.
|
|
7778
|
-
const uri = rec.
|
|
7994
|
+
await rec.stop();
|
|
7995
|
+
const uri = rec.uri;
|
|
7996
|
+
try {
|
|
7997
|
+
const mod = await import("expo-audio");
|
|
7998
|
+
await mod.setAudioModeAsync?.({ allowsRecording: false });
|
|
7999
|
+
} catch {
|
|
8000
|
+
}
|
|
7779
8001
|
if (!uri) throw new Error("Recording produced no file.");
|
|
7780
|
-
const fs = await
|
|
7781
|
-
if (!fs
|
|
8002
|
+
const fs = await legacyFileSystem();
|
|
8003
|
+
if (!fs?.readAsStringAsync) {
|
|
7782
8004
|
throw new Error("Install expo-file-system to upload voice notes.");
|
|
7783
8005
|
}
|
|
7784
8006
|
const base64 = await fs.readAsStringAsync(uri, {
|
|
@@ -9751,6 +9973,7 @@ function TesterPayKitWrapper({
|
|
|
9751
9973
|
retestCount,
|
|
9752
9974
|
onShowRetests,
|
|
9753
9975
|
onViewDashboard,
|
|
9976
|
+
buttonPosition,
|
|
9754
9977
|
currentScreen,
|
|
9755
9978
|
sessionStartedAt,
|
|
9756
9979
|
aiCoordinatorToken,
|
|
@@ -9875,6 +10098,7 @@ function TesterPayKitWrapper({
|
|
|
9875
10098
|
/* @__PURE__ */ React21.createElement(
|
|
9876
10099
|
FloatingFeedbackButton,
|
|
9877
10100
|
{
|
|
10101
|
+
position: buttonPosition,
|
|
9878
10102
|
onReportBug,
|
|
9879
10103
|
onGeneralFeedback,
|
|
9880
10104
|
onViewDashboard: onViewDashboard ?? (() => void 0),
|
|
@@ -10273,29 +10497,6 @@ var defaultFileReader = {
|
|
|
10273
10497
|
readFileAsBase64,
|
|
10274
10498
|
readFileSize
|
|
10275
10499
|
};
|
|
10276
|
-
async function readFileAsBase64(uri) {
|
|
10277
|
-
try {
|
|
10278
|
-
const mod = await import("expo-file-system");
|
|
10279
|
-
const fs = mod.default ?? mod;
|
|
10280
|
-
const readAsString = fs.readAsStringAsync;
|
|
10281
|
-
if (!readAsString) return null;
|
|
10282
|
-
return await readAsString(uri, { encoding: "base64" });
|
|
10283
|
-
} catch {
|
|
10284
|
-
return null;
|
|
10285
|
-
}
|
|
10286
|
-
}
|
|
10287
|
-
async function readFileSize(uri) {
|
|
10288
|
-
try {
|
|
10289
|
-
const mod = await import("expo-file-system");
|
|
10290
|
-
const fs = mod.default ?? mod;
|
|
10291
|
-
const getInfo = fs.getInfoAsync;
|
|
10292
|
-
if (!getInfo) return 0;
|
|
10293
|
-
const info = await getInfo(uri);
|
|
10294
|
-
return info.size ?? 0;
|
|
10295
|
-
} catch {
|
|
10296
|
-
return 0;
|
|
10297
|
-
}
|
|
10298
|
-
}
|
|
10299
10500
|
|
|
10300
10501
|
// src/voice.ts
|
|
10301
10502
|
var VoiceNoteRecorder = class {
|
|
@@ -10304,8 +10505,8 @@ var VoiceNoteRecorder = class {
|
|
|
10304
10505
|
this.startedAt = null;
|
|
10305
10506
|
this.recorder = options.recorder ?? null;
|
|
10306
10507
|
this.fileReader = {
|
|
10307
|
-
readFileAsBase64: options.readFileAsBase64 ??
|
|
10308
|
-
readFileSize: options.readFileSize ??
|
|
10508
|
+
readFileAsBase64: options.readFileAsBase64 ?? readFileAsBase64,
|
|
10509
|
+
readFileSize: options.readFileSize ?? readFileSize
|
|
10309
10510
|
};
|
|
10310
10511
|
}
|
|
10311
10512
|
async isSupported() {
|
|
@@ -10370,29 +10571,6 @@ function hasRecorder(recorder) {
|
|
|
10370
10571
|
recorder?.prepareToRecordAsync && recorder.record && recorder.stop
|
|
10371
10572
|
);
|
|
10372
10573
|
}
|
|
10373
|
-
async function readFileAsBase642(uri) {
|
|
10374
|
-
try {
|
|
10375
|
-
const mod = await import("expo-file-system");
|
|
10376
|
-
const fs = mod.default ?? mod;
|
|
10377
|
-
const readAsString = fs.readAsStringAsync;
|
|
10378
|
-
if (!readAsString) return null;
|
|
10379
|
-
return await readAsString(uri, { encoding: "base64" });
|
|
10380
|
-
} catch {
|
|
10381
|
-
return null;
|
|
10382
|
-
}
|
|
10383
|
-
}
|
|
10384
|
-
async function readFileSize2(uri) {
|
|
10385
|
-
try {
|
|
10386
|
-
const mod = await import("expo-file-system");
|
|
10387
|
-
const fs = mod.default ?? mod;
|
|
10388
|
-
const getInfo = fs.getInfoAsync;
|
|
10389
|
-
if (!getInfo) return 0;
|
|
10390
|
-
const info = await getInfo(uri);
|
|
10391
|
-
return info.size ?? 0;
|
|
10392
|
-
} catch {
|
|
10393
|
-
return 0;
|
|
10394
|
-
}
|
|
10395
|
-
}
|
|
10396
10574
|
|
|
10397
10575
|
// src/earnings.ts
|
|
10398
10576
|
import { useEffect as useEffect16, useState as useState19, useCallback as useCallback12 } from "react";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testerpaykit/expo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
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",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
+
"app.plugin.js",
|
|
18
19
|
"README.md",
|
|
19
20
|
"CHANGELOG.md"
|
|
20
21
|
],
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"uuid": "^9.0.1",
|
|
23
23
|
"@testerpaykit/ai-tester": "0.4.0",
|
|
24
|
-
"@testerpaykit/api-client": "1.
|
|
24
|
+
"@testerpaykit/api-client": "1.2.0",
|
|
25
25
|
"@testerpaykit/core": "1.0.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/react": "^18.2.0",
|
|
77
|
-
"@types/uuid": "^9.0.7",
|
|
78
77
|
"jsdom": "^23.2.0",
|
|
79
78
|
"tsup": "^8.0.1",
|
|
80
79
|
"typescript": "^5.3.0",
|