@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.js CHANGED
@@ -204,9 +204,115 @@ __export(index_exports, {
204
204
  });
205
205
  module.exports = __toCommonJS(index_exports);
206
206
 
207
+ // src/setup-check.ts
208
+ var PROBES = [
209
+ {
210
+ probe: () => import("react-native-view-shot"),
211
+ module: "react-native-view-shot",
212
+ feature: "automatic screenshots on bug reports"
213
+ },
214
+ {
215
+ probe: () => import("react-native-record-screen"),
216
+ module: "react-native-record-screen",
217
+ feature: "screen recording attachments"
218
+ },
219
+ {
220
+ probe: () => import("@shopify/react-native-skia"),
221
+ module: "@shopify/react-native-skia",
222
+ feature: "screenshot annotation editor"
223
+ },
224
+ {
225
+ probe: () => import("react-native-draggable-flatlist"),
226
+ module: "react-native-draggable-flatlist",
227
+ feature: "annotation layer reordering"
228
+ },
229
+ {
230
+ probe: () => import("expo-audio"),
231
+ module: "expo-audio",
232
+ feature: "voice bug reports (recording)"
233
+ },
234
+ {
235
+ probe: () => import("expo-file-system"),
236
+ module: "expo-file-system",
237
+ feature: "voice note / recording upload"
238
+ },
239
+ {
240
+ probe: () => import("expo-sensors"),
241
+ module: "expo-sensors",
242
+ feature: "shake-to-report"
243
+ },
244
+ {
245
+ probe: () => import("expo-device"),
246
+ module: "expo-device",
247
+ feature: "device metadata on reports"
248
+ }
249
+ ];
250
+ var ran = false;
251
+ function runSetupCheck() {
252
+ if (ran) return;
253
+ ran = true;
254
+ if (typeof __DEV__ !== "undefined" && !__DEV__) return;
255
+ void (async () => {
256
+ const missing = [];
257
+ for (const entry of PROBES) {
258
+ try {
259
+ await entry.probe();
260
+ } catch {
261
+ missing.push(entry);
262
+ }
263
+ }
264
+ if (missing.length === 0) return;
265
+ const lines = missing.map((m) => ` - ${m.module} \u2192 ${m.feature} is OFF`).join("\n");
266
+ console.log(
267
+ `[testerpaykit/expo] optional modules missing (features disabled):
268
+ ${lines}
269
+ Install the ones whose feature you want; the SDK works without them.`
270
+ );
271
+ })();
272
+ }
273
+
207
274
  // src/client.ts
208
275
  var import_api_client = require("@testerpaykit/api-client");
209
- var import_uuid2 = require("uuid");
276
+
277
+ // src/uuid.ts
278
+ function bytesToUuid(bytes) {
279
+ bytes[6] = bytes[6] & 15 | 64;
280
+ bytes[8] = bytes[8] & 63 | 128;
281
+ const hex = [];
282
+ for (let i = 0; i < 256; i++) hex.push((i + 256).toString(16).slice(1));
283
+ 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]];
284
+ }
285
+ var expoCryptoModule;
286
+ void (async () => {
287
+ try {
288
+ expoCryptoModule = await import("expo-crypto");
289
+ } catch {
290
+ expoCryptoModule = null;
291
+ }
292
+ })();
293
+ function expoCrypto() {
294
+ return expoCryptoModule;
295
+ }
296
+ function uuidv4() {
297
+ const c = globalThis.crypto;
298
+ if (typeof c?.randomUUID === "function") return c.randomUUID();
299
+ if (typeof c?.getRandomValues === "function") {
300
+ return bytesToUuid(c.getRandomValues(new Uint8Array(16)));
301
+ }
302
+ const ec = expoCrypto();
303
+ if (typeof ec?.randomUUID === "function") return ec.randomUUID();
304
+ if (typeof ec?.getRandomValues === "function") {
305
+ return bytesToUuid(ec.getRandomValues(new Uint8Array(16)));
306
+ }
307
+ const bytes = new Uint8Array(16);
308
+ const now = Date.now();
309
+ for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);
310
+ bytes[0] ^= now & 255;
311
+ bytes[1] ^= now >> 8 & 255;
312
+ return bytesToUuid(bytes);
313
+ }
314
+
315
+ // src/client.ts
210
316
  var import_react_native2 = require("react-native");
211
317
 
212
318
  // src/storage.ts
@@ -479,7 +585,6 @@ function cryptoRandomId() {
479
585
  }
480
586
 
481
587
  // src/queue.ts
482
- var import_uuid = require("uuid");
483
588
  var QUEUE_KEY = "queue/bug-reports";
484
589
  var ATTACHMENT_QUEUE_KEY = "queue/attachments";
485
590
  var SubmitQueue = class {
@@ -494,7 +599,7 @@ var SubmitQueue = class {
494
599
  // submit attempt's key carries through to the queued retry, so
495
600
  // the server's dedup matches across attempts. When the caller
496
601
  // didn't pre-mint one (e.g. crash submit path), mint here.
497
- idempotencyKey: options?.idempotencyKey ?? (0, import_uuid.v4)(),
602
+ idempotencyKey: options?.idempotencyKey ?? uuidv4(),
498
603
  queuedAt: (/* @__PURE__ */ new Date()).toISOString(),
499
604
  payload
500
605
  };
@@ -1029,6 +1134,7 @@ var TpkExpo = class _TpkExpo {
1029
1134
  return this._ready;
1030
1135
  }
1031
1136
  static async init(config) {
1137
+ runSetupCheck();
1032
1138
  const storage = config.storage ?? new ExpoStorage();
1033
1139
  const api = new import_api_client.TesterPayKitApiClient({
1034
1140
  baseURL: config.apiBaseUrl,
@@ -1038,13 +1144,13 @@ var TpkExpo = class _TpkExpo {
1038
1144
  const queue = new SubmitQueue(storage);
1039
1145
  const attachmentQueue = new AttachmentQueue(storage);
1040
1146
  const crashQueue = new CrashQueue(storage);
1041
- const cached = await storage.get(STORAGE_KEY_AUTH);
1147
+ const cached2 = await storage.get(STORAGE_KEY_AUTH);
1042
1148
  let tester;
1043
1149
  let authReady;
1044
1150
  let hasCachedAuth = false;
1045
- if (cached && cached.tester.projectId === config.projectId && cached.tester.code.toUpperCase() === config.testerCode.toUpperCase()) {
1046
- api.setAccessToken(cached.accessToken);
1047
- tester = cached.tester;
1151
+ if (cached2 && cached2.tester.projectId === config.projectId && cached2.tester.code.toUpperCase() === config.testerCode.toUpperCase()) {
1152
+ api.setAccessToken(cached2.accessToken);
1153
+ tester = cached2.tester;
1048
1154
  hasCachedAuth = true;
1049
1155
  authReady = Promise.resolve();
1050
1156
  } else {
@@ -1142,7 +1248,7 @@ var TpkExpo = class _TpkExpo {
1142
1248
  */
1143
1249
  async submitBug(input) {
1144
1250
  const payload = await this.buildPayload(input);
1145
- const idempotencyKey = (0, import_uuid2.v4)();
1251
+ const idempotencyKey = uuidv4();
1146
1252
  try {
1147
1253
  const response = await this.api.submitBugReport(payload, {
1148
1254
  idempotencyKey
@@ -1387,6 +1493,9 @@ var TpkExpo = class _TpkExpo {
1387
1493
  }
1388
1494
  /** Flush pending session events + breadcrumbs to timeline endpoints. */
1389
1495
  async flushTelemetry() {
1496
+ if (!this.sessionId) {
1497
+ return { eventsInserted: 0, breadcrumbsInserted: 0 };
1498
+ }
1390
1499
  const pendingEvents = [...this.sessionEvents];
1391
1500
  const pendingBreadcrumbs = this.breadcrumbs.pendingSnapshot();
1392
1501
  let eventsInserted = 0;
@@ -1545,7 +1654,7 @@ var TpkExpo = class _TpkExpo {
1545
1654
  description: composeCrashDescription(info),
1546
1655
  currentScreen: lastScreen(this.breadcrumbs) ?? "unknown"
1547
1656
  });
1548
- await this.api.submitBugReport(payload, { idempotencyKey: (0, import_uuid2.v4)() });
1657
+ await this.api.submitBugReport(payload, { idempotencyKey: uuidv4() });
1549
1658
  this.breadcrumbs.record({ action: "tpk", target: "crash_submitted" });
1550
1659
  }
1551
1660
  };
@@ -1597,13 +1706,13 @@ async function startServerSession(api, projectId) {
1597
1706
  return session.id;
1598
1707
  }
1599
1708
  async function loadPersistedSession(storage, projectId, testerCode) {
1600
- const cached = await storage.get(STORAGE_KEY_SESSION);
1601
- if (!cached) return null;
1602
- if (cached.projectId !== projectId) return null;
1603
- if (cached.testerCode.toUpperCase() !== testerCode.toUpperCase()) return null;
1604
- const age = Date.now() - cached.createdAt;
1709
+ const cached2 = await storage.get(STORAGE_KEY_SESSION);
1710
+ if (!cached2) return null;
1711
+ if (cached2.projectId !== projectId) return null;
1712
+ if (cached2.testerCode.toUpperCase() !== testerCode.toUpperCase()) return null;
1713
+ const age = Date.now() - cached2.createdAt;
1605
1714
  if (age > SESSION_TTL_MS) return null;
1606
- return cached.sessionId;
1715
+ return cached2.sessionId;
1607
1716
  }
1608
1717
  async function persistSession(storage, sessionId, projectId, testerCode) {
1609
1718
  const value = {
@@ -2404,10 +2513,10 @@ function FloatingFeedbackButton({
2404
2513
  onPanResponderMove: (_, gesture) => {
2405
2514
  const start = dragStartRef.current;
2406
2515
  if (!start) return;
2407
- const win = import_react_native5.Dimensions.get("window");
2516
+ const win2 = import_react_native5.Dimensions.get("window");
2408
2517
  setPos({
2409
- x: clamp(start.x + gesture.dx, 0, win.width - FAB_SIZE),
2410
- y: clamp(start.y + gesture.dy, 0, win.height - FAB_SIZE)
2518
+ x: clamp(start.x + gesture.dx, 0, win2.width - FAB_SIZE),
2519
+ y: clamp(start.y + gesture.dy, 0, win2.height - FAB_SIZE)
2411
2520
  });
2412
2521
  },
2413
2522
  onPanResponderRelease: () => {
@@ -2547,6 +2656,11 @@ function FloatingFeedbackButton({
2547
2656
  inputRange: [0, 1],
2548
2657
  outputRange: ["0deg", "45deg"]
2549
2658
  });
2659
+ const win = (0, import_react_native5.useWindowDimensions)();
2660
+ const openUp = pos.y + FAB_SIZE / 2 > win.height / 2;
2661
+ const openLeft = pos.x + FAB_SIZE / 2 > win.width / 2;
2662
+ const anchorHorizontal = openLeft ? { right: win.width - pos.x - FAB_SIZE, alignItems: "flex-end" } : { left: pos.x, alignItems: "flex-start" };
2663
+ const anchorPos = openUp ? { ...anchorHorizontal, bottom: win.height - pos.y - FAB_SIZE } : { ...anchorHorizontal, top: pos.y };
2550
2664
  return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement(WidgetTour, { visible: tourVisible, onDone: handleTourDone }), expanded && /* @__PURE__ */ import_react6.default.createElement(
2551
2665
  import_react_native5.Pressable,
2552
2666
  {
@@ -2558,7 +2672,12 @@ function FloatingFeedbackButton({
2558
2672
  import_react_native5.View,
2559
2673
  {
2560
2674
  pointerEvents: "box-none",
2561
- style: [styles2.anchor, { left: pos.x, top: pos.y }, style],
2675
+ style: [
2676
+ styles2.anchor,
2677
+ anchorPos,
2678
+ !openUp && styles2.anchorDown,
2679
+ style
2680
+ ],
2562
2681
  testID
2563
2682
  },
2564
2683
  /* @__PURE__ */ import_react6.default.createElement(
@@ -2567,6 +2686,9 @@ function FloatingFeedbackButton({
2567
2686
  pointerEvents: expanded ? "auto" : "none",
2568
2687
  style: [
2569
2688
  styles2.menu,
2689
+ // Never wider than the window minus a margin — labels wrap
2690
+ // instead of clipping on narrow devices.
2691
+ { maxWidth: win.width - 24 },
2570
2692
  {
2571
2693
  opacity: expandAnim,
2572
2694
  transform: [
@@ -2692,8 +2814,13 @@ var styles2 = import_react_native5.StyleSheet.create({
2692
2814
  alignItems: "flex-start",
2693
2815
  zIndex: 9999
2694
2816
  },
2817
+ // Upper-half FAB: same child order (menu, FAB), reversed layout so
2818
+ // the FAB renders on top and the menu extends downward below it.
2819
+ anchorDown: {
2820
+ flexDirection: "column-reverse"
2821
+ },
2695
2822
  menu: {
2696
- marginBottom: 8,
2823
+ marginVertical: 8,
2697
2824
  minWidth: 220,
2698
2825
  backgroundColor: "#FFFFFF",
2699
2826
  borderRadius: 12,
@@ -3080,12 +3207,14 @@ function BugReportSheet({
3080
3207
  const [stepInput, setStepInput] = (0, import_react7.useState)("");
3081
3208
  const [submitting, setSubmitting] = (0, import_react7.useState)(false);
3082
3209
  const [attachmentError, setAttachmentError] = (0, import_react7.useState)(null);
3210
+ const [submitBanner, setSubmitBanner] = (0, import_react7.useState)(null);
3083
3211
  (0, import_react7.useEffect)(() => {
3084
3212
  if (visible) {
3085
3213
  setStep(0);
3086
3214
  setDraft(initialDraft);
3087
3215
  setStepInput("");
3088
3216
  setAttachmentError(null);
3217
+ setSubmitBanner(null);
3089
3218
  }
3090
3219
  }, [visible, initialDraft]);
3091
3220
  const totalSizeMB = (0, import_react7.useMemo)(() => {
@@ -3121,14 +3250,22 @@ function BugReportSheet({
3121
3250
  return;
3122
3251
  }
3123
3252
  setSubmitting(true);
3253
+ setSubmitBanner(null);
3124
3254
  try {
3125
3255
  const response = await submitBugReportDraft(tpk, draft);
3126
3256
  onSubmitted?.(response);
3257
+ if (response.outcome === "failedPermanent") {
3258
+ setSubmitBanner(
3259
+ "Could not submit \u2014 the server rejected the report (your tester session may have expired). Your draft is kept; please try again."
3260
+ );
3261
+ return;
3262
+ }
3127
3263
  onClose();
3128
3264
  } catch (cause) {
3129
3265
  onError?.(
3130
3266
  cause instanceof Error ? cause : new Error("Bug report failed.")
3131
3267
  );
3268
+ setSubmitBanner("Bug report failed \u2014 please try again.");
3132
3269
  } finally {
3133
3270
  setSubmitting(false);
3134
3271
  }
@@ -3341,7 +3478,15 @@ function BugReportSheet({
3341
3478
  }),
3342
3479
  onReorder: (next) => patchDraft({ reproductionSteps: next })
3343
3480
  }
3344
- ), step === 4 && /* @__PURE__ */ import_react7.default.createElement(ReviewStep, { draft })), /* @__PURE__ */ import_react7.default.createElement(
3481
+ ), step === 4 && /* @__PURE__ */ import_react7.default.createElement(ReviewStep, { draft })), submitBanner && /* @__PURE__ */ import_react7.default.createElement(
3482
+ import_react_native6.View,
3483
+ {
3484
+ accessibilityRole: "alert",
3485
+ accessibilityLabel: submitBanner,
3486
+ style: styles3.submitBanner
3487
+ },
3488
+ /* @__PURE__ */ import_react7.default.createElement(import_react_native6.Text, { style: styles3.submitBannerText }, submitBanner)
3489
+ ), /* @__PURE__ */ import_react7.default.createElement(
3345
3490
  Footer,
3346
3491
  {
3347
3492
  step,
@@ -3703,14 +3848,14 @@ function ReviewStep({
3703
3848
  value: draft.description || "(empty)",
3704
3849
  multiline: true
3705
3850
  }
3706
- ), draft.expectedBehavior.trim() && /* @__PURE__ */ import_react7.default.createElement(
3851
+ ), draft.expectedBehavior.trim().length > 0 && /* @__PURE__ */ import_react7.default.createElement(
3707
3852
  ReviewLine,
3708
3853
  {
3709
3854
  label: "Expected",
3710
3855
  value: draft.expectedBehavior,
3711
3856
  multiline: true
3712
3857
  }
3713
- ), draft.actualBehavior.trim() && /* @__PURE__ */ import_react7.default.createElement(
3858
+ ), draft.actualBehavior.trim().length > 0 && /* @__PURE__ */ import_react7.default.createElement(
3714
3859
  ReviewLine,
3715
3860
  {
3716
3861
  label: "Actual",
@@ -3723,7 +3868,7 @@ function ReviewStep({
3723
3868
  label: "Frequency",
3724
3869
  value: FREQUENCIES.find((f) => f.value === draft.frequency)?.label ?? draft.frequency
3725
3870
  }
3726
- ), draft.affectedComponent && /* @__PURE__ */ import_react7.default.createElement(
3871
+ ), !!draft.affectedComponent && /* @__PURE__ */ import_react7.default.createElement(
3727
3872
  ReviewLine,
3728
3873
  {
3729
3874
  label: "Affected component",
@@ -4226,6 +4371,20 @@ var styles3 = import_react_native6.StyleSheet.create({
4226
4371
  flexDirection: "row",
4227
4372
  alignItems: "center"
4228
4373
  },
4374
+ submitBanner: {
4375
+ marginHorizontal: 16,
4376
+ marginBottom: 8,
4377
+ padding: 12,
4378
+ borderRadius: 10,
4379
+ backgroundColor: "#FEF2F2",
4380
+ borderWidth: 1,
4381
+ borderColor: "#FECACA"
4382
+ },
4383
+ submitBannerText: {
4384
+ color: "#B91C1C",
4385
+ fontSize: 13,
4386
+ fontWeight: "600"
4387
+ },
4229
4388
  footer: {
4230
4389
  flexDirection: "row",
4231
4390
  gap: 10,
@@ -7272,6 +7431,49 @@ var styles10 = import_react_native14.StyleSheet.create({
7272
7431
  }
7273
7432
  });
7274
7433
 
7434
+ // src/fs-legacy.ts
7435
+ var cached;
7436
+ async function legacyFileSystem() {
7437
+ if (cached !== void 0) return cached;
7438
+ try {
7439
+ const legacy = await import("expo-file-system/legacy");
7440
+ const fs = legacy.default ?? legacy;
7441
+ if (fs?.readAsStringAsync) {
7442
+ cached = fs;
7443
+ return cached;
7444
+ }
7445
+ } catch {
7446
+ }
7447
+ try {
7448
+ const mod = await import("expo-file-system");
7449
+ cached = mod.default ?? mod;
7450
+ } catch {
7451
+ cached = null;
7452
+ }
7453
+ return cached;
7454
+ }
7455
+ async function readFileAsBase64(uri) {
7456
+ try {
7457
+ const fs = await legacyFileSystem();
7458
+ if (!fs?.readAsStringAsync) return null;
7459
+ return await fs.readAsStringAsync(uri, {
7460
+ encoding: fs.EncodingType?.Base64 ?? "base64"
7461
+ });
7462
+ } catch {
7463
+ return null;
7464
+ }
7465
+ }
7466
+ async function readFileSize(uri) {
7467
+ try {
7468
+ const fs = await legacyFileSystem();
7469
+ if (!fs?.getInfoAsync) return 0;
7470
+ const info = await fs.getInfoAsync(uri);
7471
+ return info.size ?? 0;
7472
+ } catch {
7473
+ return 0;
7474
+ }
7475
+ }
7476
+
7275
7477
  // src/VoiceBugInputSheet.tsx
7276
7478
  var import_react16 = __toESM(require("react"));
7277
7479
  var import_react_native15 = require("react-native");
@@ -7289,14 +7491,21 @@ async function extractVoiceBug(tpk, audio) {
7289
7491
  {
7290
7492
  audio_base64: audio.base64,
7291
7493
  mime_type: audio.mimeType,
7292
- // Server-side handling: the route reads `language` (when set)
7293
- // and passes it through to Whisper's `language` param. Older
7294
- // server builds ignore unknown JSON keys, so this is a safe
7295
- // forward-roll — sending it never breaks an out-of-date API.
7296
- ...audio.language ? { language: audio.language } : {}
7494
+ // umkreis finding #1/#3 fixed a real bug here, 2026-08-06: this
7495
+ // used to send `language`, but the server route reads
7496
+ // `source_language` (routes/.../voice-extract.dart) — so the
7497
+ // DE/EN picker chip never actually reached Whisper, even on
7498
+ // the rare occasion a tester tapped it. `source_language` is
7499
+ // the correct, matching key; older server builds ignore
7500
+ // unknown JSON keys either way, so this is a safe forward-roll.
7501
+ ...audio.language ? { source_language: audio.language } : {}
7297
7502
  }
7298
7503
  );
7299
- return audio.language ? { ...response.data, sourceLanguage: audio.language } : response.data;
7504
+ const result = response.data;
7505
+ return {
7506
+ ...result,
7507
+ sourceLanguage: audio.language ?? result.detectedLanguage
7508
+ };
7300
7509
  }
7301
7510
 
7302
7511
  // src/VoiceBugInputSheet.tsx
@@ -7334,6 +7543,8 @@ function VoiceBugInputSheet({
7334
7543
  onExtracted,
7335
7544
  maxSeconds = 60,
7336
7545
  accentColor = "#D83232",
7546
+ sheetOpacity = 1,
7547
+ voiceLanguage,
7337
7548
  strings,
7338
7549
  style,
7339
7550
  testID = "tpk-voice-bug-sheet"
@@ -7347,7 +7558,27 @@ function VoiceBugInputSheet({
7347
7558
  const [seconds, setSeconds] = (0, import_react16.useState)(0);
7348
7559
  const [error, setError] = (0, import_react16.useState)(null);
7349
7560
  const [result, setResult] = (0, import_react16.useState)(null);
7350
- const [language, setLanguage] = (0, import_react16.useState)("auto");
7561
+ const [language, setLanguage] = (0, import_react16.useState)(
7562
+ voiceLanguage ?? "auto"
7563
+ );
7564
+ (0, import_react16.useEffect)(() => {
7565
+ if (voiceLanguage !== void 0) {
7566
+ setLanguage(voiceLanguage);
7567
+ return;
7568
+ }
7569
+ let cancelled = false;
7570
+ (async () => {
7571
+ try {
7572
+ const mod = await import("expo-localization");
7573
+ const code = mod.getLocales?.()[0]?.languageCode?.toLowerCase();
7574
+ if (!cancelled && code) setLanguage(code);
7575
+ } catch {
7576
+ }
7577
+ })();
7578
+ return () => {
7579
+ cancelled = true;
7580
+ };
7581
+ }, [voiceLanguage]);
7351
7582
  const recorderRef = (0, import_react16.useRef)(null);
7352
7583
  const tickerRef = (0, import_react16.useRef)(null);
7353
7584
  const meterAnim = (0, import_react16.useRef)(new import_react_native15.Animated.Value(0)).current;
@@ -7540,6 +7771,9 @@ function VoiceBugInputSheet({
7540
7771
  const isUploading = phase === "uploading";
7541
7772
  const isExtracted = phase === "extracted";
7542
7773
  const isError = phase === "error";
7774
+ const opacity = Math.max(0, Math.min(1, sheetOpacity));
7775
+ const backdropOverride = { backgroundColor: `rgba(0,0,0,${0.55 * opacity})` };
7776
+ const sheetOverride = { backgroundColor: `rgba(17,24,39,${opacity})` };
7543
7777
  return /* @__PURE__ */ import_react16.default.createElement(
7544
7778
  import_react_native15.Modal,
7545
7779
  {
@@ -7548,7 +7782,7 @@ function VoiceBugInputSheet({
7548
7782
  transparent: true,
7549
7783
  visible
7550
7784
  },
7551
- /* @__PURE__ */ import_react16.default.createElement(import_react_native15.View, { style: [styles11.backdrop, style], testID }, /* @__PURE__ */ import_react16.default.createElement(
7785
+ /* @__PURE__ */ import_react16.default.createElement(import_react_native15.View, { style: [styles11.backdrop, backdropOverride, style], testID }, /* @__PURE__ */ import_react16.default.createElement(
7552
7786
  import_react_native15.Pressable,
7553
7787
  {
7554
7788
  accessibilityRole: "button",
@@ -7557,7 +7791,7 @@ function VoiceBugInputSheet({
7557
7791
  onPress: () => void cancel(),
7558
7792
  style: styles11.backdropSpacer
7559
7793
  }
7560
- ), /* @__PURE__ */ import_react16.default.createElement(import_react_native15.View, { style: styles11.sheet }, /* @__PURE__ */ import_react16.default.createElement(import_react_native15.View, { style: styles11.grabber }), /* @__PURE__ */ import_react16.default.createElement(
7794
+ ), /* @__PURE__ */ import_react16.default.createElement(import_react_native15.View, { style: [styles11.sheet, sheetOverride] }, /* @__PURE__ */ import_react16.default.createElement(import_react_native15.View, { style: styles11.grabber }), /* @__PURE__ */ import_react16.default.createElement(
7561
7795
  import_react_native15.Animated.View,
7562
7796
  {
7563
7797
  style: [styles11.dimmable, { opacity: dimAnim }],
@@ -7770,8 +8004,8 @@ async function cleanupRecorder(handle) {
7770
8004
  w.stopMeter?.();
7771
8005
  w.mediaRecorder.stream.getTracks().forEach((t) => t.stop());
7772
8006
  } else {
7773
- const rec = handle.stopAndUnloadAsync;
7774
- if (rec) await rec.call(handle);
8007
+ const stop = handle.stop;
8008
+ if (stop) await stop.call(handle);
7775
8009
  }
7776
8010
  } catch {
7777
8011
  }
@@ -7848,27 +8082,46 @@ async function stopWebRecording(handle) {
7848
8082
  handle.mediaRecorder.stop();
7849
8083
  });
7850
8084
  }
8085
+ function nativeRecordingOptions(mod, os) {
8086
+ const preset = mod.RecordingPresets?.HIGH_QUALITY ?? {};
8087
+ const { android, ios, web, ...common } = preset;
8088
+ const platform = os === "ios" ? ios : os === "android" ? android : web;
8089
+ return { ...common, isMeteringEnabled: false, ...platform ?? {} };
8090
+ }
7851
8091
  async function startNativeRecording() {
7852
8092
  const mod = await import("expo-audio");
7853
8093
  const granted = (await mod.AudioModule?.requestRecordingPermissionsAsync?.())?.granted;
7854
8094
  if (granted === false) {
7855
8095
  throw new Error("Microphone permission denied.");
7856
8096
  }
7857
- if (!mod.Audio?.Recording) {
8097
+ const Recorder = mod.AudioModule?.AudioRecorder;
8098
+ if (!Recorder) {
7858
8099
  throw new Error("Install expo-audio to enable voice bug reports.");
7859
8100
  }
7860
- const rec = new mod.Audio.Recording();
7861
- await rec.prepareToRecordAsync(mod.Audio.RecordingOptionsPresets?.HIGH_QUALITY);
7862
- await rec.startAsync();
8101
+ try {
8102
+ await mod.setAudioModeAsync?.({
8103
+ allowsRecording: true,
8104
+ playsInSilentMode: true
8105
+ });
8106
+ } catch {
8107
+ }
8108
+ const rec = new Recorder(nativeRecordingOptions(mod, import_react_native15.Platform.OS));
8109
+ await rec.prepareToRecordAsync();
8110
+ rec.record();
7863
8111
  return rec;
7864
8112
  }
7865
8113
  async function stopNativeRecording(handle) {
7866
8114
  const rec = handle;
7867
- await rec.stopAndUnloadAsync();
7868
- const uri = rec.getURI();
8115
+ await rec.stop();
8116
+ const uri = rec.uri;
8117
+ try {
8118
+ const mod = await import("expo-audio");
8119
+ await mod.setAudioModeAsync?.({ allowsRecording: false });
8120
+ } catch {
8121
+ }
7869
8122
  if (!uri) throw new Error("Recording produced no file.");
7870
- const fs = await import("expo-file-system");
7871
- if (!fs.readAsStringAsync) {
8123
+ const fs = await legacyFileSystem();
8124
+ if (!fs?.readAsStringAsync) {
7872
8125
  throw new Error("Install expo-file-system to upload voice notes.");
7873
8126
  }
7874
8127
  const base64 = await fs.readAsStringAsync(uri, {
@@ -9778,6 +10031,7 @@ function TesterPayKitWrapper({
9778
10031
  retestCount,
9779
10032
  onShowRetests,
9780
10033
  onViewDashboard,
10034
+ buttonPosition,
9781
10035
  currentScreen,
9782
10036
  sessionStartedAt,
9783
10037
  aiCoordinatorToken,
@@ -9902,6 +10156,7 @@ function TesterPayKitWrapper({
9902
10156
  /* @__PURE__ */ import_react23.default.createElement(
9903
10157
  FloatingFeedbackButton,
9904
10158
  {
10159
+ position: buttonPosition,
9905
10160
  onReportBug,
9906
10161
  onGeneralFeedback,
9907
10162
  onViewDashboard: onViewDashboard ?? (() => void 0),
@@ -10292,29 +10547,6 @@ var defaultFileReader = {
10292
10547
  readFileAsBase64,
10293
10548
  readFileSize
10294
10549
  };
10295
- async function readFileAsBase64(uri) {
10296
- try {
10297
- const mod = await import("expo-file-system");
10298
- const fs = mod.default ?? mod;
10299
- const readAsString = fs.readAsStringAsync;
10300
- if (!readAsString) return null;
10301
- return await readAsString(uri, { encoding: "base64" });
10302
- } catch {
10303
- return null;
10304
- }
10305
- }
10306
- async function readFileSize(uri) {
10307
- try {
10308
- const mod = await import("expo-file-system");
10309
- const fs = mod.default ?? mod;
10310
- const getInfo = fs.getInfoAsync;
10311
- if (!getInfo) return 0;
10312
- const info = await getInfo(uri);
10313
- return info.size ?? 0;
10314
- } catch {
10315
- return 0;
10316
- }
10317
- }
10318
10550
 
10319
10551
  // src/voice.ts
10320
10552
  var VoiceNoteRecorder = class {
@@ -10323,8 +10555,8 @@ var VoiceNoteRecorder = class {
10323
10555
  this.startedAt = null;
10324
10556
  this.recorder = options.recorder ?? null;
10325
10557
  this.fileReader = {
10326
- readFileAsBase64: options.readFileAsBase64 ?? readFileAsBase642,
10327
- readFileSize: options.readFileSize ?? readFileSize2
10558
+ readFileAsBase64: options.readFileAsBase64 ?? readFileAsBase64,
10559
+ readFileSize: options.readFileSize ?? readFileSize
10328
10560
  };
10329
10561
  }
10330
10562
  async isSupported() {
@@ -10389,29 +10621,6 @@ function hasRecorder(recorder) {
10389
10621
  recorder?.prepareToRecordAsync && recorder.record && recorder.stop
10390
10622
  );
10391
10623
  }
10392
- async function readFileAsBase642(uri) {
10393
- try {
10394
- const mod = await import("expo-file-system");
10395
- const fs = mod.default ?? mod;
10396
- const readAsString = fs.readAsStringAsync;
10397
- if (!readAsString) return null;
10398
- return await readAsString(uri, { encoding: "base64" });
10399
- } catch {
10400
- return null;
10401
- }
10402
- }
10403
- async function readFileSize2(uri) {
10404
- try {
10405
- const mod = await import("expo-file-system");
10406
- const fs = mod.default ?? mod;
10407
- const getInfo = fs.getInfoAsync;
10408
- if (!getInfo) return 0;
10409
- const info = await getInfo(uri);
10410
- return info.size ?? 0;
10411
- } catch {
10412
- return 0;
10413
- }
10414
- }
10415
10624
 
10416
10625
  // src/earnings.ts
10417
10626
  var import_react25 = require("react");