@testerpaykit/expo 0.6.1 → 0.7.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.mjs CHANGED
@@ -2762,6 +2762,9 @@ import {
2762
2762
  View as View3
2763
2763
  } from "react-native";
2764
2764
 
2765
+ // src/screenshot.ts
2766
+ import { AppState as AppState2 } from "react-native";
2767
+
2765
2768
  // src/sensitive-redaction.ts
2766
2769
  var STYLE_ID = "tpk-sensitive-redaction-style";
2767
2770
  var MODE_STYLE_RULES = {
@@ -2831,13 +2834,29 @@ async function withNativeCapture(fn) {
2831
2834
  }
2832
2835
 
2833
2836
  // src/screenshot.ts
2837
+ function isForeground() {
2838
+ const state = AppState2?.currentState;
2839
+ return state == null || state === "active";
2840
+ }
2834
2841
  async function captureView(viewRef, options = {}) {
2835
2842
  const format = options.format ?? "png";
2843
+ if (!isForeground()) {
2844
+ console.debug(
2845
+ "[testerpaykit/expo] screenshot skipped: app is not in the foreground."
2846
+ );
2847
+ return null;
2848
+ }
2836
2849
  const redact = options.redactSensitive !== false;
2837
2850
  const teardownCss = redact ? applySensitiveRedaction() : null;
2838
2851
  if (redact) beginNativeCapture();
2839
2852
  try {
2840
2853
  if (redact) await Promise.resolve();
2854
+ if (!isForeground()) {
2855
+ console.debug(
2856
+ "[testerpaykit/expo] screenshot skipped: app left the foreground while preparing."
2857
+ );
2858
+ return null;
2859
+ }
2841
2860
  const mod = await import("react-native-view-shot");
2842
2861
  const captureRef = (mod.default ?? mod).captureRef ?? mod.captureRef;
2843
2862
  const base64 = await captureRef(viewRef, {
@@ -7402,14 +7421,21 @@ async function extractVoiceBug(tpk, audio) {
7402
7421
  {
7403
7422
  audio_base64: audio.base64,
7404
7423
  mime_type: audio.mimeType,
7405
- // Server-side handling: the route reads `language` (when set)
7406
- // and passes it through to Whisper's `language` param. Older
7407
- // server builds ignore unknown JSON keys, so this is a safe
7408
- // forward-roll — sending it never breaks an out-of-date API.
7409
- ...audio.language ? { language: audio.language } : {}
7424
+ // umkreis finding #1/#3 fixed a real bug here, 2026-08-06: this
7425
+ // used to send `language`, but the server route reads
7426
+ // `source_language` (routes/.../voice-extract.dart) — so the
7427
+ // DE/EN picker chip never actually reached Whisper, even on
7428
+ // the rare occasion a tester tapped it. `source_language` is
7429
+ // the correct, matching key; older server builds ignore
7430
+ // unknown JSON keys either way, so this is a safe forward-roll.
7431
+ ...audio.language ? { source_language: audio.language } : {}
7410
7432
  }
7411
7433
  );
7412
- return audio.language ? { ...response.data, sourceLanguage: audio.language } : response.data;
7434
+ const result = response.data;
7435
+ return {
7436
+ ...result,
7437
+ sourceLanguage: audio.language ?? result.detectedLanguage
7438
+ };
7413
7439
  }
7414
7440
 
7415
7441
  // src/VoiceBugInputSheet.tsx
@@ -7447,6 +7473,8 @@ function VoiceBugInputSheet({
7447
7473
  onExtracted,
7448
7474
  maxSeconds = 60,
7449
7475
  accentColor = "#D83232",
7476
+ sheetOpacity = 1,
7477
+ voiceLanguage,
7450
7478
  strings,
7451
7479
  style,
7452
7480
  testID = "tpk-voice-bug-sheet"
@@ -7460,7 +7488,27 @@ function VoiceBugInputSheet({
7460
7488
  const [seconds, setSeconds] = useState11(0);
7461
7489
  const [error, setError] = useState11(null);
7462
7490
  const [result, setResult] = useState11(null);
7463
- const [language, setLanguage] = useState11("auto");
7491
+ const [language, setLanguage] = useState11(
7492
+ voiceLanguage ?? "auto"
7493
+ );
7494
+ useEffect8(() => {
7495
+ if (voiceLanguage !== void 0) {
7496
+ setLanguage(voiceLanguage);
7497
+ return;
7498
+ }
7499
+ let cancelled = false;
7500
+ (async () => {
7501
+ try {
7502
+ const mod = await import("expo-localization");
7503
+ const code = mod.getLocales?.()[0]?.languageCode?.toLowerCase();
7504
+ if (!cancelled && code) setLanguage(code);
7505
+ } catch {
7506
+ }
7507
+ })();
7508
+ return () => {
7509
+ cancelled = true;
7510
+ };
7511
+ }, [voiceLanguage]);
7464
7512
  const recorderRef = useRef8(null);
7465
7513
  const tickerRef = useRef8(null);
7466
7514
  const meterAnim = useRef8(new Animated2.Value(0)).current;
@@ -7653,6 +7701,9 @@ function VoiceBugInputSheet({
7653
7701
  const isUploading = phase === "uploading";
7654
7702
  const isExtracted = phase === "extracted";
7655
7703
  const isError = phase === "error";
7704
+ const opacity = Math.max(0, Math.min(1, sheetOpacity));
7705
+ const backdropOverride = { backgroundColor: `rgba(0,0,0,${0.55 * opacity})` };
7706
+ const sheetOverride = { backgroundColor: `rgba(17,24,39,${opacity})` };
7656
7707
  return /* @__PURE__ */ React14.createElement(
7657
7708
  Modal6,
7658
7709
  {
@@ -7661,7 +7712,7 @@ function VoiceBugInputSheet({
7661
7712
  transparent: true,
7662
7713
  visible
7663
7714
  },
7664
- /* @__PURE__ */ React14.createElement(View11, { style: [styles11.backdrop, style], testID }, /* @__PURE__ */ React14.createElement(
7715
+ /* @__PURE__ */ React14.createElement(View11, { style: [styles11.backdrop, backdropOverride, style], testID }, /* @__PURE__ */ React14.createElement(
7665
7716
  Pressable9,
7666
7717
  {
7667
7718
  accessibilityRole: "button",
@@ -7670,7 +7721,7 @@ function VoiceBugInputSheet({
7670
7721
  onPress: () => void cancel(),
7671
7722
  style: styles11.backdropSpacer
7672
7723
  }
7673
- ), /* @__PURE__ */ React14.createElement(View11, { style: styles11.sheet }, /* @__PURE__ */ React14.createElement(View11, { style: styles11.grabber }), /* @__PURE__ */ React14.createElement(
7724
+ ), /* @__PURE__ */ React14.createElement(View11, { style: [styles11.sheet, sheetOverride] }, /* @__PURE__ */ React14.createElement(View11, { style: styles11.grabber }), /* @__PURE__ */ React14.createElement(
7674
7725
  Animated2.View,
7675
7726
  {
7676
7727
  style: [styles11.dimmable, { opacity: dimAnim }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testerpaykit/expo",
3
- "version": "0.6.1",
3
+ "version": "0.7.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",
@@ -19,10 +19,16 @@
19
19
  "README.md",
20
20
  "CHANGELOG.md"
21
21
  ],
22
+ "scripts": {
23
+ "build": "tsup src/index.ts --format cjs,esm --dts --external react --external react-native --external expo-sensors --external expo-device --external expo-application --external @react-native-async-storage/async-storage --external react-native-svg --external react-native-view-shot --external react-native-record-screen --external expo-file-system --external @expo/vector-icons --external react-native-draggable-flatlist --external @shopify/react-native-skia",
24
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
25
+ "test": "vitest",
26
+ "lint": "eslint src --ext .ts,.tsx"
27
+ },
22
28
  "dependencies": {
23
- "@testerpaykit/ai-tester": "0.4.0",
24
- "@testerpaykit/api-client": "1.2.0",
25
- "@testerpaykit/core": "1.0.1"
29
+ "@testerpaykit/ai-tester": "workspace:*",
30
+ "@testerpaykit/api-client": "workspace:*",
31
+ "@testerpaykit/core": "workspace:*"
26
32
  },
27
33
  "peerDependencies": {
28
34
  "@expo/vector-icons": ">=14.0.0",
@@ -32,6 +38,7 @@
32
38
  "expo-audio": ">=1.0.0",
33
39
  "expo-device": ">=6.0.0",
34
40
  "expo-file-system": ">=16.0.0",
41
+ "expo-localization": ">=15.0.0",
35
42
  "expo-sensors": ">=12.0.0",
36
43
  "react": ">=18.0.0",
37
44
  "react-native": ">=0.72.0",
@@ -62,6 +69,9 @@
62
69
  "expo-file-system": {
63
70
  "optional": true
64
71
  },
72
+ "expo-localization": {
73
+ "optional": true
74
+ },
65
75
  "react-native-svg": {
66
76
  "optional": true
67
77
  },
@@ -89,11 +99,5 @@
89
99
  "license": "MIT",
90
100
  "publishConfig": {
91
101
  "access": "public"
92
- },
93
- "scripts": {
94
- "build": "tsup src/index.ts --format cjs,esm --dts --external react --external react-native --external expo-sensors --external expo-device --external expo-application --external @react-native-async-storage/async-storage --external react-native-svg --external react-native-view-shot --external react-native-record-screen --external expo-file-system --external @expo/vector-icons --external react-native-draggable-flatlist --external @shopify/react-native-skia",
95
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
96
- "test": "vitest",
97
- "lint": "eslint src --ext .ts,.tsx"
98
102
  }
99
- }
103
+ }