@switchlabs/verify-ai-react-native 2.4.11 → 2.4.15

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/README.md CHANGED
@@ -56,15 +56,32 @@ function ScannerScreen() {
56
56
  const { verify } = useVerifyAI({ apiKey: 'vai_your_api_key' });
57
57
  return (
58
58
  <VerifyAIScanner
59
+ policy="scooter_parking"
59
60
  onCapture={(base64) =>
60
61
  verify({ image: base64, policy: 'scooter_parking' })
61
62
  }
62
63
  onResult={(result) => console.log(result.is_compliant ? 'PASS' : 'FAIL')}
64
+ onClose={(result) => console.log('closed', result?.id)}
65
+ showCloseButton
66
+ overlay={{
67
+ instructions: 'Center the scooter in the frame',
68
+ processingMessage: 'Checking parking compliance...',
69
+ failureMessage: 'Parking issue detected',
70
+ retryMessage: 'Try again. {remaining} attempts left.',
71
+ terminalResultDisplayMs: 3000,
72
+ terminalActionLabel: 'Continue',
73
+ }}
63
74
  />
64
75
  );
65
76
  }
66
77
  ```
67
78
 
79
+ Passing `policy` enables policy-aware default copy and guide overlays for
80
+ `scooter`, `bike`, and `forest` parking policies. Override copy through
81
+ `overlay.instructions`, `processingMessage`, `successMessage`, `failureMessage`,
82
+ `retryMessage`, `exhaustedMessage`, `terminalActionLabel`, and
83
+ `terminalResultDisplayMs`.
84
+
68
85
  ## Offline Mode
69
86
 
70
87
  Requires `@react-native-async-storage/async-storage` to be installed.
@@ -5,16 +5,22 @@ import type { TelemetryReporter } from '../telemetry/TelemetryReporter';
5
5
  export interface VerifyAIScannerProps {
6
6
  /** Called with base64 image data when the user captures a photo. */
7
7
  onCapture: (base64: string) => Promise<VerificationResult | null>;
8
+ /** Optional policy ID used for policy-aware default scanner copy. */
9
+ policy?: string;
8
10
  /** Called when a terminal verification result is reached. */
9
11
  onResult?: (result: VerificationResult) => void;
10
12
  /** Called when an error occurs. */
11
13
  onError?: (error: Error) => void;
14
+ /** Called when the user presses the persistent close button. */
15
+ onClose?: (result: VerificationResult | null) => void;
12
16
  /** Overlay configuration for the camera view. */
13
17
  overlay?: ScannerOverlayConfig;
14
18
  /** Custom style for the container. */
15
19
  style?: ViewStyle;
16
20
  /** Whether to show the default capture button. Set false to use your own. */
17
21
  showCaptureButton?: boolean;
22
+ /** Whether to show the persistent close button. */
23
+ showCloseButton?: boolean;
18
24
  /** Ref to imperatively trigger capture from parent. */
19
25
  captureRef?: React.MutableRefObject<(() => void) | null>;
20
26
  /** Whether to enable the camera torch/flashlight. */
@@ -43,4 +49,4 @@ export interface VerifyAIScannerProps {
43
49
  * />
44
50
  * ```
45
51
  */
46
- export declare function VerifyAIScanner({ onCapture, onResult, onError, overlay, style, showCaptureButton, captureRef, enableTorch, telemetry: telemetryProp, }: VerifyAIScannerProps): import("react/jsx-runtime").JSX.Element;
52
+ export declare function VerifyAIScanner({ onCapture, policy, onResult, onError, onClose, overlay: overlayProp, style, showCaptureButton, showCloseButton, captureRef, enableTorch, telemetry: telemetryProp, }: VerifyAIScannerProps): import("react/jsx-runtime").JSX.Element;