@switchlabs/verify-ai-react-native 0.1.3 → 0.1.5

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.
@@ -1,5 +1,5 @@
1
1
  import { VerifyAIClient } from '../client';
2
- import type { OfflineQueue } from '../storage/offlineQueue';
2
+ import { OfflineQueue } from '../storage/offlineQueue';
3
3
  import type { VerifyAIConfig, VerificationRequest, VerificationResult, VerificationListParams, VerificationListResponse } from '../types';
4
4
  export interface UseVerifyAIReturn {
5
5
  /** Submit a verification. Uses offline queue if offlineMode is enabled and request fails. */
@@ -1,16 +1,7 @@
1
1
  import { useMemo, useCallback, useState, useEffect } from 'react';
2
2
  import { AppState } from 'react-native';
3
3
  import { VerifyAIClient } from '../client';
4
- // Lazy-load OfflineQueue to avoid hard dependency on @react-native-async-storage/async-storage.
5
- // Consumers who don't use offlineMode won't need it installed.
6
- let OfflineQueueClass = null;
7
- try {
8
- // eslint-disable-next-line @typescript-eslint/no-require-imports
9
- OfflineQueueClass = require('../storage/offlineQueue').OfflineQueue;
10
- }
11
- catch {
12
- // AsyncStorage not installed — offlineMode will be unavailable
13
- }
4
+ import { OfflineQueue } from '../storage/offlineQueue';
14
5
  /**
15
6
  * React hook for Verify AI. Provides verification methods,
16
7
  * loading/error state, and optional offline queue management.
@@ -35,7 +26,7 @@ catch {
35
26
  */
36
27
  export function useVerifyAI(config) {
37
28
  const client = useMemo(() => new VerifyAIClient(config), [config.apiKey, config.baseUrl, config.timeout]);
38
- const offlineQueue = useMemo(() => (config.offlineMode && OfflineQueueClass ? new OfflineQueueClass(client) : null), [client, config.offlineMode]);
29
+ const offlineQueue = useMemo(() => (config.offlineMode ? new OfflineQueue(client) : null), [client, config.offlineMode]);
39
30
  const [loading, setLoading] = useState(false);
40
31
  const [error, setError] = useState(null);
41
32
  const [lastResult, setLastResult] = useState(null);
package/lib/index.d.ts CHANGED
@@ -3,5 +3,5 @@ export { useVerifyAI } from './hooks/useVerifyAI';
3
3
  export type { UseVerifyAIReturn } from './hooks/useVerifyAI';
4
4
  export { VerifyAIScanner } from './components/VerifyAIScanner';
5
5
  export type { VerifyAIScannerProps } from './components/VerifyAIScanner';
6
- export type { OfflineQueue } from './storage/offlineQueue';
6
+ export { OfflineQueue } from './storage/offlineQueue';
7
7
  export type { VerifyAIConfig, VerificationRequest, VerificationResult, VerificationListResponse, VerificationListParams, QueueItem, VerifyAIError, ScannerStatus, ScannerOverlayConfig, } from './types';
package/lib/index.js CHANGED
@@ -4,3 +4,5 @@ export { VerifyAIClient, VerifyAIRequestError } from './client';
4
4
  export { useVerifyAI } from './hooks/useVerifyAI';
5
5
  // Components
6
6
  export { VerifyAIScanner } from './components/VerifyAIScanner';
7
+ // Offline Queue
8
+ export { OfflineQueue } from './storage/offlineQueue';
package/package.json CHANGED
@@ -1,34 +1,9 @@
1
1
  {
2
2
  "name": "@switchlabs/verify-ai-react-native",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "React Native SDK for Verify AI - photo verification with AI vision processing",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
- "source": "./src/index.ts",
8
- "react-native": "./src/index.ts",
9
- "exports": {
10
- ".": {
11
- "react-native": "./src/index.ts",
12
- "types": "./lib/index.d.ts",
13
- "default": "./lib/index.js"
14
- },
15
- "./scanner": {
16
- "react-native": "./src/components/VerifyAIScanner.tsx",
17
- "types": "./lib/components/VerifyAIScanner.d.ts",
18
- "default": "./lib/components/VerifyAIScanner.js"
19
- },
20
- "./offline": {
21
- "react-native": "./src/storage/offlineQueue.ts",
22
- "types": "./lib/storage/offlineQueue.d.ts",
23
- "default": "./lib/storage/offlineQueue.js"
24
- }
25
- },
26
- "typesVersions": {
27
- "*": {
28
- "scanner": ["./lib/components/VerifyAIScanner.d.ts"],
29
- "offline": ["./lib/storage/offlineQueue.d.ts"]
30
- }
31
- },
32
7
  "files": [
33
8
  "src",
34
9
  "lib"
@@ -1,7 +1,7 @@
1
1
  import { useRef, useMemo, useCallback, useState, useEffect } from 'react';
2
2
  import { AppState, type AppStateStatus } from 'react-native';
3
3
  import { VerifyAIClient } from '../client';
4
- import type { OfflineQueue } from '../storage/offlineQueue';
4
+ import { OfflineQueue } from '../storage/offlineQueue';
5
5
  import type {
6
6
  VerifyAIConfig,
7
7
  VerificationRequest,
@@ -10,16 +10,6 @@ import type {
10
10
  VerificationListResponse,
11
11
  } from '../types';
12
12
 
13
- // Lazy-load OfflineQueue to avoid hard dependency on @react-native-async-storage/async-storage.
14
- // Consumers who don't use offlineMode won't need it installed.
15
- let OfflineQueueClass: (new (client: VerifyAIClient) => OfflineQueue) | null = null;
16
- try {
17
- // eslint-disable-next-line @typescript-eslint/no-require-imports
18
- OfflineQueueClass = require('../storage/offlineQueue').OfflineQueue;
19
- } catch {
20
- // AsyncStorage not installed — offlineMode will be unavailable
21
- }
22
-
23
13
  export interface UseVerifyAIReturn {
24
14
  /** Submit a verification. Uses offline queue if offlineMode is enabled and request fails. */
25
15
  verify: (request: VerificationRequest) => Promise<VerificationResult | null>;
@@ -68,7 +58,7 @@ export interface UseVerifyAIReturn {
68
58
  export function useVerifyAI(config: VerifyAIConfig): UseVerifyAIReturn {
69
59
  const client = useMemo(() => new VerifyAIClient(config), [config.apiKey, config.baseUrl, config.timeout]);
70
60
  const offlineQueue = useMemo(
71
- () => (config.offlineMode && OfflineQueueClass ? new OfflineQueueClass(client) : null),
61
+ () => (config.offlineMode ? new OfflineQueue(client) : null),
72
62
  [client, config.offlineMode]
73
63
  );
74
64
 
package/src/index.ts CHANGED
@@ -9,8 +9,8 @@ export type { UseVerifyAIReturn } from './hooks/useVerifyAI';
9
9
  export { VerifyAIScanner } from './components/VerifyAIScanner';
10
10
  export type { VerifyAIScannerProps } from './components/VerifyAIScanner';
11
11
 
12
- // Offline Queue — import { OfflineQueue } from '@switchlabs/verify-ai-react-native/offline'
13
- export type { OfflineQueue } from './storage/offlineQueue';
12
+ // Offline Queue
13
+ export { OfflineQueue } from './storage/offlineQueue';
14
14
 
15
15
  // Types
16
16
  export type {