@testerpaykit/expo 0.7.0 → 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, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testerpaykit/expo",
3
- "version": "0.7.0",
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/core": "1.0.1",
24
- "@testerpaykit/api-client": "1.2.0",
25
- "@testerpaykit/ai-tester": "0.4.0"
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",
@@ -93,11 +99,5 @@
93
99
  "license": "MIT",
94
100
  "publishConfig": {
95
101
  "access": "public"
96
- },
97
- "scripts": {
98
- "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",
99
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
100
- "test": "vitest",
101
- "lint": "eslint src --ext .ts,.tsx"
102
102
  }
103
- }
103
+ }