@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/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");
@@ -7770,8 +7972,8 @@ async function cleanupRecorder(handle) {
7770
7972
  w.stopMeter?.();
7771
7973
  w.mediaRecorder.stream.getTracks().forEach((t) => t.stop());
7772
7974
  } else {
7773
- const rec = handle.stopAndUnloadAsync;
7774
- if (rec) await rec.call(handle);
7975
+ const stop = handle.stop;
7976
+ if (stop) await stop.call(handle);
7775
7977
  }
7776
7978
  } catch {
7777
7979
  }
@@ -7848,27 +8050,46 @@ async function stopWebRecording(handle) {
7848
8050
  handle.mediaRecorder.stop();
7849
8051
  });
7850
8052
  }
8053
+ function nativeRecordingOptions(mod, os) {
8054
+ const preset = mod.RecordingPresets?.HIGH_QUALITY ?? {};
8055
+ const { android, ios, web, ...common } = preset;
8056
+ const platform = os === "ios" ? ios : os === "android" ? android : web;
8057
+ return { ...common, isMeteringEnabled: false, ...platform ?? {} };
8058
+ }
7851
8059
  async function startNativeRecording() {
7852
8060
  const mod = await import("expo-audio");
7853
8061
  const granted = (await mod.AudioModule?.requestRecordingPermissionsAsync?.())?.granted;
7854
8062
  if (granted === false) {
7855
8063
  throw new Error("Microphone permission denied.");
7856
8064
  }
7857
- if (!mod.Audio?.Recording) {
8065
+ const Recorder = mod.AudioModule?.AudioRecorder;
8066
+ if (!Recorder) {
7858
8067
  throw new Error("Install expo-audio to enable voice bug reports.");
7859
8068
  }
7860
- const rec = new mod.Audio.Recording();
7861
- await rec.prepareToRecordAsync(mod.Audio.RecordingOptionsPresets?.HIGH_QUALITY);
7862
- await rec.startAsync();
8069
+ try {
8070
+ await mod.setAudioModeAsync?.({
8071
+ allowsRecording: true,
8072
+ playsInSilentMode: true
8073
+ });
8074
+ } catch {
8075
+ }
8076
+ const rec = new Recorder(nativeRecordingOptions(mod, import_react_native15.Platform.OS));
8077
+ await rec.prepareToRecordAsync();
8078
+ rec.record();
7863
8079
  return rec;
7864
8080
  }
7865
8081
  async function stopNativeRecording(handle) {
7866
8082
  const rec = handle;
7867
- await rec.stopAndUnloadAsync();
7868
- const uri = rec.getURI();
8083
+ await rec.stop();
8084
+ const uri = rec.uri;
8085
+ try {
8086
+ const mod = await import("expo-audio");
8087
+ await mod.setAudioModeAsync?.({ allowsRecording: false });
8088
+ } catch {
8089
+ }
7869
8090
  if (!uri) throw new Error("Recording produced no file.");
7870
- const fs = await import("expo-file-system");
7871
- if (!fs.readAsStringAsync) {
8091
+ const fs = await legacyFileSystem();
8092
+ if (!fs?.readAsStringAsync) {
7872
8093
  throw new Error("Install expo-file-system to upload voice notes.");
7873
8094
  }
7874
8095
  const base64 = await fs.readAsStringAsync(uri, {
@@ -9778,6 +9999,7 @@ function TesterPayKitWrapper({
9778
9999
  retestCount,
9779
10000
  onShowRetests,
9780
10001
  onViewDashboard,
10002
+ buttonPosition,
9781
10003
  currentScreen,
9782
10004
  sessionStartedAt,
9783
10005
  aiCoordinatorToken,
@@ -9902,6 +10124,7 @@ function TesterPayKitWrapper({
9902
10124
  /* @__PURE__ */ import_react23.default.createElement(
9903
10125
  FloatingFeedbackButton,
9904
10126
  {
10127
+ position: buttonPosition,
9905
10128
  onReportBug,
9906
10129
  onGeneralFeedback,
9907
10130
  onViewDashboard: onViewDashboard ?? (() => void 0),
@@ -10292,29 +10515,6 @@ var defaultFileReader = {
10292
10515
  readFileAsBase64,
10293
10516
  readFileSize
10294
10517
  };
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
10518
 
10319
10519
  // src/voice.ts
10320
10520
  var VoiceNoteRecorder = class {
@@ -10323,8 +10523,8 @@ var VoiceNoteRecorder = class {
10323
10523
  this.startedAt = null;
10324
10524
  this.recorder = options.recorder ?? null;
10325
10525
  this.fileReader = {
10326
- readFileAsBase64: options.readFileAsBase64 ?? readFileAsBase642,
10327
- readFileSize: options.readFileSize ?? readFileSize2
10526
+ readFileAsBase64: options.readFileAsBase64 ?? readFileAsBase64,
10527
+ readFileSize: options.readFileSize ?? readFileSize
10328
10528
  };
10329
10529
  }
10330
10530
  async isSupported() {
@@ -10389,29 +10589,6 @@ function hasRecorder(recorder) {
10389
10589
  recorder?.prepareToRecordAsync && recorder.record && recorder.stop
10390
10590
  );
10391
10591
  }
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
10592
 
10416
10593
  // src/earnings.ts
10417
10594
  var import_react25 = require("react");