@testerpaykit/expo 0.4.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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
- import { v4 as uuidv42 } from "uuid";
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 cached = await storage.get(STORAGE_KEY_AUTH);
947
+ const cached2 = await storage.get(STORAGE_KEY_AUTH);
842
948
  let tester;
843
949
  let authReady;
844
950
  let hasCachedAuth = false;
845
- if (cached && cached.tester.projectId === config.projectId && cached.tester.code.toUpperCase() === config.testerCode.toUpperCase()) {
846
- api.setAccessToken(cached.accessToken);
847
- tester = cached.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 = uuidv42();
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: uuidv42() });
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 cached = await storage.get(STORAGE_KEY_SESSION);
1401
- if (!cached) return null;
1402
- if (cached.projectId !== projectId) return null;
1403
- if (cached.testerCode.toUpperCase() !== testerCode.toUpperCase()) return null;
1404
- const age = Date.now() - cached.createdAt;
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 cached.sessionId;
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 win = Dimensions2.get("window");
2341
+ const win2 = Dimensions2.get("window");
2232
2342
  setPos({
2233
- x: clamp(start.x + gesture.dx, 0, win.width - FAB_SIZE),
2234
- y: clamp(start.y + gesture.dy, 0, win.height - FAB_SIZE)
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: [styles2.anchor, { left: pos.x, top: pos.y }, 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
- marginBottom: 8,
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,
@@ -7199,14 +7402,21 @@ async function extractVoiceBug(tpk, audio) {
7199
7402
  {
7200
7403
  audio_base64: audio.base64,
7201
7404
  mime_type: audio.mimeType,
7202
- // Server-side handling: the route reads `language` (when set)
7203
- // and passes it through to Whisper's `language` param. Older
7204
- // server builds ignore unknown JSON keys, so this is a safe
7205
- // forward-roll — sending it never breaks an out-of-date API.
7206
- ...audio.language ? { language: audio.language } : {}
7405
+ // umkreis finding #1/#3 fixed a real bug here, 2026-08-06: this
7406
+ // used to send `language`, but the server route reads
7407
+ // `source_language` (routes/.../voice-extract.dart) — so the
7408
+ // DE/EN picker chip never actually reached Whisper, even on
7409
+ // the rare occasion a tester tapped it. `source_language` is
7410
+ // the correct, matching key; older server builds ignore
7411
+ // unknown JSON keys either way, so this is a safe forward-roll.
7412
+ ...audio.language ? { source_language: audio.language } : {}
7207
7413
  }
7208
7414
  );
7209
- return audio.language ? { ...response.data, sourceLanguage: audio.language } : response.data;
7415
+ const result = response.data;
7416
+ return {
7417
+ ...result,
7418
+ sourceLanguage: audio.language ?? result.detectedLanguage
7419
+ };
7210
7420
  }
7211
7421
 
7212
7422
  // src/VoiceBugInputSheet.tsx
@@ -7244,6 +7454,8 @@ function VoiceBugInputSheet({
7244
7454
  onExtracted,
7245
7455
  maxSeconds = 60,
7246
7456
  accentColor = "#D83232",
7457
+ sheetOpacity = 1,
7458
+ voiceLanguage,
7247
7459
  strings,
7248
7460
  style,
7249
7461
  testID = "tpk-voice-bug-sheet"
@@ -7257,7 +7469,27 @@ function VoiceBugInputSheet({
7257
7469
  const [seconds, setSeconds] = useState11(0);
7258
7470
  const [error, setError] = useState11(null);
7259
7471
  const [result, setResult] = useState11(null);
7260
- const [language, setLanguage] = useState11("auto");
7472
+ const [language, setLanguage] = useState11(
7473
+ voiceLanguage ?? "auto"
7474
+ );
7475
+ useEffect8(() => {
7476
+ if (voiceLanguage !== void 0) {
7477
+ setLanguage(voiceLanguage);
7478
+ return;
7479
+ }
7480
+ let cancelled = false;
7481
+ (async () => {
7482
+ try {
7483
+ const mod = await import("expo-localization");
7484
+ const code = mod.getLocales?.()[0]?.languageCode?.toLowerCase();
7485
+ if (!cancelled && code) setLanguage(code);
7486
+ } catch {
7487
+ }
7488
+ })();
7489
+ return () => {
7490
+ cancelled = true;
7491
+ };
7492
+ }, [voiceLanguage]);
7261
7493
  const recorderRef = useRef8(null);
7262
7494
  const tickerRef = useRef8(null);
7263
7495
  const meterAnim = useRef8(new Animated2.Value(0)).current;
@@ -7450,6 +7682,9 @@ function VoiceBugInputSheet({
7450
7682
  const isUploading = phase === "uploading";
7451
7683
  const isExtracted = phase === "extracted";
7452
7684
  const isError = phase === "error";
7685
+ const opacity = Math.max(0, Math.min(1, sheetOpacity));
7686
+ const backdropOverride = { backgroundColor: `rgba(0,0,0,${0.55 * opacity})` };
7687
+ const sheetOverride = { backgroundColor: `rgba(17,24,39,${opacity})` };
7453
7688
  return /* @__PURE__ */ React14.createElement(
7454
7689
  Modal6,
7455
7690
  {
@@ -7458,7 +7693,7 @@ function VoiceBugInputSheet({
7458
7693
  transparent: true,
7459
7694
  visible
7460
7695
  },
7461
- /* @__PURE__ */ React14.createElement(View11, { style: [styles11.backdrop, style], testID }, /* @__PURE__ */ React14.createElement(
7696
+ /* @__PURE__ */ React14.createElement(View11, { style: [styles11.backdrop, backdropOverride, style], testID }, /* @__PURE__ */ React14.createElement(
7462
7697
  Pressable9,
7463
7698
  {
7464
7699
  accessibilityRole: "button",
@@ -7467,7 +7702,7 @@ function VoiceBugInputSheet({
7467
7702
  onPress: () => void cancel(),
7468
7703
  style: styles11.backdropSpacer
7469
7704
  }
7470
- ), /* @__PURE__ */ React14.createElement(View11, { style: styles11.sheet }, /* @__PURE__ */ React14.createElement(View11, { style: styles11.grabber }), /* @__PURE__ */ React14.createElement(
7705
+ ), /* @__PURE__ */ React14.createElement(View11, { style: [styles11.sheet, sheetOverride] }, /* @__PURE__ */ React14.createElement(View11, { style: styles11.grabber }), /* @__PURE__ */ React14.createElement(
7471
7706
  Animated2.View,
7472
7707
  {
7473
7708
  style: [styles11.dimmable, { opacity: dimAnim }],
@@ -7680,8 +7915,8 @@ async function cleanupRecorder(handle) {
7680
7915
  w.stopMeter?.();
7681
7916
  w.mediaRecorder.stream.getTracks().forEach((t) => t.stop());
7682
7917
  } else {
7683
- const rec = handle.stopAndUnloadAsync;
7684
- if (rec) await rec.call(handle);
7918
+ const stop = handle.stop;
7919
+ if (stop) await stop.call(handle);
7685
7920
  }
7686
7921
  } catch {
7687
7922
  }
@@ -7758,27 +7993,46 @@ async function stopWebRecording(handle) {
7758
7993
  handle.mediaRecorder.stop();
7759
7994
  });
7760
7995
  }
7996
+ function nativeRecordingOptions(mod, os) {
7997
+ const preset = mod.RecordingPresets?.HIGH_QUALITY ?? {};
7998
+ const { android, ios, web, ...common } = preset;
7999
+ const platform = os === "ios" ? ios : os === "android" ? android : web;
8000
+ return { ...common, isMeteringEnabled: false, ...platform ?? {} };
8001
+ }
7761
8002
  async function startNativeRecording() {
7762
8003
  const mod = await import("expo-audio");
7763
8004
  const granted = (await mod.AudioModule?.requestRecordingPermissionsAsync?.())?.granted;
7764
8005
  if (granted === false) {
7765
8006
  throw new Error("Microphone permission denied.");
7766
8007
  }
7767
- if (!mod.Audio?.Recording) {
8008
+ const Recorder = mod.AudioModule?.AudioRecorder;
8009
+ if (!Recorder) {
7768
8010
  throw new Error("Install expo-audio to enable voice bug reports.");
7769
8011
  }
7770
- const rec = new mod.Audio.Recording();
7771
- await rec.prepareToRecordAsync(mod.Audio.RecordingOptionsPresets?.HIGH_QUALITY);
7772
- await rec.startAsync();
8012
+ try {
8013
+ await mod.setAudioModeAsync?.({
8014
+ allowsRecording: true,
8015
+ playsInSilentMode: true
8016
+ });
8017
+ } catch {
8018
+ }
8019
+ const rec = new Recorder(nativeRecordingOptions(mod, Platform6.OS));
8020
+ await rec.prepareToRecordAsync();
8021
+ rec.record();
7773
8022
  return rec;
7774
8023
  }
7775
8024
  async function stopNativeRecording(handle) {
7776
8025
  const rec = handle;
7777
- await rec.stopAndUnloadAsync();
7778
- const uri = rec.getURI();
8026
+ await rec.stop();
8027
+ const uri = rec.uri;
8028
+ try {
8029
+ const mod = await import("expo-audio");
8030
+ await mod.setAudioModeAsync?.({ allowsRecording: false });
8031
+ } catch {
8032
+ }
7779
8033
  if (!uri) throw new Error("Recording produced no file.");
7780
- const fs = await import("expo-file-system");
7781
- if (!fs.readAsStringAsync) {
8034
+ const fs = await legacyFileSystem();
8035
+ if (!fs?.readAsStringAsync) {
7782
8036
  throw new Error("Install expo-file-system to upload voice notes.");
7783
8037
  }
7784
8038
  const base64 = await fs.readAsStringAsync(uri, {
@@ -9751,6 +10005,7 @@ function TesterPayKitWrapper({
9751
10005
  retestCount,
9752
10006
  onShowRetests,
9753
10007
  onViewDashboard,
10008
+ buttonPosition,
9754
10009
  currentScreen,
9755
10010
  sessionStartedAt,
9756
10011
  aiCoordinatorToken,
@@ -9875,6 +10130,7 @@ function TesterPayKitWrapper({
9875
10130
  /* @__PURE__ */ React21.createElement(
9876
10131
  FloatingFeedbackButton,
9877
10132
  {
10133
+ position: buttonPosition,
9878
10134
  onReportBug,
9879
10135
  onGeneralFeedback,
9880
10136
  onViewDashboard: onViewDashboard ?? (() => void 0),
@@ -10273,29 +10529,6 @@ var defaultFileReader = {
10273
10529
  readFileAsBase64,
10274
10530
  readFileSize
10275
10531
  };
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
10532
 
10300
10533
  // src/voice.ts
10301
10534
  var VoiceNoteRecorder = class {
@@ -10304,8 +10537,8 @@ var VoiceNoteRecorder = class {
10304
10537
  this.startedAt = null;
10305
10538
  this.recorder = options.recorder ?? null;
10306
10539
  this.fileReader = {
10307
- readFileAsBase64: options.readFileAsBase64 ?? readFileAsBase642,
10308
- readFileSize: options.readFileSize ?? readFileSize2
10540
+ readFileAsBase64: options.readFileAsBase64 ?? readFileAsBase64,
10541
+ readFileSize: options.readFileSize ?? readFileSize
10309
10542
  };
10310
10543
  }
10311
10544
  async isSupported() {
@@ -10370,29 +10603,6 @@ function hasRecorder(recorder) {
10370
10603
  recorder?.prepareToRecordAsync && recorder.record && recorder.stop
10371
10604
  );
10372
10605
  }
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
10606
 
10397
10607
  // src/earnings.ts
10398
10608
  import { useEffect as useEffect16, useState as useState19, useCallback as useCallback12 } from "react";