@test-web/react-native-sdk 1.0.1 → 2.1.0

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.
Files changed (125) hide show
  1. package/README.md +543 -26
  2. package/assets/images/Chrome-logo.svg +1 -0
  3. package/assets/images/Firefox-logo.png +0 -0
  4. package/assets/images/IDM-logo.jpg +0 -0
  5. package/assets/images/MRZOverlay.png +0 -0
  6. package/assets/images/Safari-logo.png +0 -0
  7. package/assets/images/aadhar.png +0 -0
  8. package/assets/images/camera-bg.png +0 -0
  9. package/assets/images/card-overlay-back.png +0 -0
  10. package/assets/images/card-overlay.png +0 -0
  11. package/assets/images/card-scan-back-icon.jpg +0 -0
  12. package/assets/images/card-scan-front-icon.png +0 -0
  13. package/assets/images/card-scan-icon-aadhaar-1.png +0 -0
  14. package/assets/images/card-scan-icon-aadhaar-back.png +0 -0
  15. package/assets/images/card-scan-icon-aadhaar-scan-qr.png +0 -0
  16. package/assets/images/card-scan-icon-aadhaar.png +0 -0
  17. package/assets/images/card-scan-icon-can-pr.png +0 -0
  18. package/assets/images/card-scan-icon-default-back.png +0 -0
  19. package/assets/images/card-scan-icon-dl.png +0 -0
  20. package/assets/images/card-scan-icon-greencard-back.jpg +0 -0
  21. package/assets/images/card-scan-icon-greencard.jpg +0 -0
  22. package/assets/images/card-scan-icon-hc.png +0 -0
  23. package/assets/images/card-scan-icon-ni-argentina-back.jpg +0 -0
  24. package/assets/images/card-scan-icon-ni-argentina-old.png +0 -0
  25. package/assets/images/card-scan-icon-ni-argentina.jpg +0 -0
  26. package/assets/images/card-scan-icon-ni-barcode.jpg +0 -0
  27. package/assets/images/card-scan-icon-ni-brazil-back.jpg +0 -0
  28. package/assets/images/card-scan-icon-ni-brazil.jpg +0 -0
  29. package/assets/images/card-scan-icon-ni-dominican-republic-back.png +0 -0
  30. package/assets/images/card-scan-icon-ni-dominican-republic-front.png +0 -0
  31. package/assets/images/card-scan-icon-ni-dominican-republic-mrz.png +0 -0
  32. package/assets/images/card-scan-icon-ni-dominicanaRepublic-back.jpg +0 -0
  33. package/assets/images/card-scan-icon-ni-france-back.png +0 -0
  34. package/assets/images/card-scan-icon-ni-france-front.png +0 -0
  35. package/assets/images/card-scan-icon-ni-france-scan-mrz.png +0 -0
  36. package/assets/images/card-scan-icon-ni-germany-back.jpg +0 -0
  37. package/assets/images/card-scan-icon-ni-germany.jpg +0 -0
  38. package/assets/images/card-scan-icon-ni-paraguay-back.png +0 -0
  39. package/assets/images/card-scan-icon-ni-paraguay-front.png +0 -0
  40. package/assets/images/card-scan-icon-ni-paraguay-scan-mrz.png +0 -0
  41. package/assets/images/card-scan-icon-ni-uae-back.png +0 -0
  42. package/assets/images/card-scan-icon-ni-uae-front.png +0 -0
  43. package/assets/images/card-scan-icon-ni-uae-scan-mrz.png +0 -0
  44. package/assets/images/card-scan-icon-ni-uganda-front.png +0 -0
  45. package/assets/images/card-scan-icon-ni-uganda-scan-mrz.png +0 -0
  46. package/assets/images/card-scan-icon-ni-ukrain-back.png +0 -0
  47. package/assets/images/card-scan-icon-ni-ukrain-front.png +0 -0
  48. package/assets/images/card-scan-icon-ni-ukrain-scan-mrz.png +0 -0
  49. package/assets/images/card-scan-icon-ni.png +0 -0
  50. package/assets/images/card-scan-icon-old.jpg +0 -0
  51. package/assets/images/card-scan-icon-pan.png +0 -0
  52. package/assets/images/card-scan-icon-passport-card-back.jpg +0 -0
  53. package/assets/images/card-scan-icon-passport-card.jpg +0 -0
  54. package/assets/images/card-scan-icon-passport-old.png +0 -0
  55. package/assets/images/card-scan-icon-passport.png +0 -0
  56. package/assets/images/card-scan-icon-pr.png +0 -0
  57. package/assets/images/card-scan-icon.jpg +0 -0
  58. package/assets/images/check.png +0 -0
  59. package/assets/images/chrome-animation-GPS-permissions-setting.gif +0 -0
  60. package/assets/images/chrome-animation-camera-permissions-setting.gif +0 -0
  61. package/assets/images/denied.png +0 -0
  62. package/assets/images/dl.png +0 -0
  63. package/assets/images/driver-license.png +0 -0
  64. package/assets/images/firefox-animation-permissions-setting.gif +0 -0
  65. package/assets/images/flashlight_on.png +0 -0
  66. package/assets/images/gallery.png +0 -0
  67. package/assets/images/greencard.png +0 -0
  68. package/assets/images/header.jpg +0 -0
  69. package/assets/images/health-card.png +0 -0
  70. package/assets/images/ic_camera_front_white_36px.svg +4 -0
  71. package/assets/images/ic_camera_rear_white_36px.svg +4 -0
  72. package/assets/images/ic_fullscreen_exit_white_48px.svg +4 -0
  73. package/assets/images/ic_fullscreen_white_48px.svg +4 -0
  74. package/assets/images/ic_photo_camera_white_48px.svg +5 -0
  75. package/assets/images/id-card.png +0 -0
  76. package/assets/images/idcardimg.png +0 -0
  77. package/assets/images/idmval-barcode.png +0 -0
  78. package/assets/images/information.png +0 -0
  79. package/assets/images/loader.gif +0 -0
  80. package/assets/images/loading.svg +1 -0
  81. package/assets/images/logo.jpg +0 -0
  82. package/assets/images/logo.png +0 -0
  83. package/assets/images/mrz-back.png +0 -0
  84. package/assets/images/mrz-ni.png +0 -0
  85. package/assets/images/mrz.png +0 -0
  86. package/assets/images/mrz1.png +0 -0
  87. package/assets/images/mrz_old.png +0 -0
  88. package/assets/images/mrz_small.png +0 -0
  89. package/assets/images/national-id.png +0 -0
  90. package/assets/images/nationalID.png +0 -0
  91. package/assets/images/no-wifi.png +0 -0
  92. package/assets/images/passport-card.png +0 -0
  93. package/assets/images/passport.png +0 -0
  94. package/assets/images/permit-card.png +0 -0
  95. package/assets/images/photo-overlay.png +0 -0
  96. package/assets/images/placeholder.jpg +0 -0
  97. package/assets/images/qr-code.png +0 -0
  98. package/assets/images/right-checkmark.jpg +0 -0
  99. package/assets/images/selfie.jpg +0 -0
  100. package/assets/images/showing-sec.png +0 -0
  101. package/assets/images/spinner.gif +0 -0
  102. package/assets/images/splash-icon.png +0 -0
  103. package/assets/images/take-selfie.jpg +0 -0
  104. package/assets/images/torch_off.png +0 -0
  105. package/assets/images/warning-icon.jpg +0 -0
  106. package/assets/images/warning-stick.jpg +0 -0
  107. package/assets/images/wrong-checkmark.jpg +0 -0
  108. package/package.json +31 -4
  109. package/src/apis/index.ts +338 -17
  110. package/src/components/common/Loader.tsx +16 -2
  111. package/src/config/apiConfig.ts +6 -0
  112. package/src/index.tsx +123 -7
  113. package/src/screens/BarcodeCapture.tsx +64 -12
  114. package/src/screens/DocumentCaptureBack.tsx +133 -24
  115. package/src/screens/DocumentCaptureFront.tsx +146 -24
  116. package/src/screens/MrzCapture.tsx +77 -12
  117. package/src/screens/SelectDocuments.tsx +37 -56
  118. package/src/screens/SelfieCapture.tsx +114 -18
  119. package/src/screens/ThankYou.tsx +34 -1
  120. package/src/services/getUserData.ts +111 -0
  121. package/src/types/IDMConf.ts +81 -7
  122. package/src/utils/base64.ts +25 -0
  123. package/src/utils/flowManager.ts +138 -0
  124. package/src/utils/imageProcessor.ts +96 -0
  125. package/src/utils/index.ts +18 -0
package/README.md CHANGED
@@ -1,58 +1,575 @@
1
1
  # React Native IDM Scan SDK
2
2
 
3
- Complete identity verification SDK with 18 screens, 10 themes, and optimized performance.
3
+ A fully dynamic, production-ready React Native SDK for identity verification with document scanning, selfie capture, and API-driven configuration.
4
4
 
5
- ## Features
5
+ ## 🌟 Features
6
6
 
7
- 18 verification screens
8
- 10 pre-built themes
9
- Camera & location permissions
10
- ✅ Document scanning
11
- ✅ Selfie capture
12
- Responsive design
13
- TypeScript support
14
- 60-80% optimized performance
7
+ - **Fully Dynamic** - All configuration driven by API and metadata
8
+ - **Smart Document Flow** - Automatically determines required capture steps
9
+ - **18 Verification Screens** - Complete identity verification flow
10
+ - **Document Scanning** - Support for ID cards, passports, driver licenses
11
+ - **Selfie Capture** - Live selfie verification with camera integration
12
+ - **MRZ & Barcode Scanning** - Machine-readable zone and barcode support
13
+ - **10 Pre-built Themes** - Customizable UI themes
14
+ - **Camera & Location Permissions** - Built-in permission handling
15
+ - ✅ **TypeScript Support** - Full type definitions included
16
+ - ✅ **Responsive Design** - Works on all screen sizes
17
+ - ✅ **Optimized Performance** - Memoization and efficient state management
15
18
 
16
- ## Installation
19
+ ---
20
+
21
+ ## 📱 Requirements
22
+
23
+ - React Native >= 0.64.0
24
+ - iOS >= 11.0
25
+ - Android >= API 21 (Android 5.0)
26
+ - Node.js >= 14.x
27
+
28
+ ---
29
+
30
+ ## 📦 Installation
31
+
32
+ ### Step 1: Install the SDK
33
+
34
+ ```bash
35
+ npm install @test-web/react-native-sdk
36
+ ```
37
+
38
+ or with Yarn:
39
+
40
+ ```bash
41
+ yarn add @test-web/react-native-sdk
42
+ ```
43
+
44
+ ### Step 2: Install Required Dependencies
17
45
 
18
46
  ```bash
19
- npm install test-react-native-sdk
20
47
  npm install @react-navigation/native @react-navigation/native-stack
21
48
  npm install react-native-screens react-native-safe-area-context
49
+ npm install react-native-vision-camera react-native-image-resizer react-native-fs
22
50
  ```
23
51
 
24
- **iOS:**
52
+ ### Step 3: Install Optional Dependencies (Recommended)
53
+
54
+ ```bash
55
+ npm install react-native-device-info react-native-geolocation-service
56
+ ```
57
+
58
+ ### Step 4: Install iOS Pods (iOS only)
59
+
25
60
  ```bash
26
61
  cd ios && pod install && cd ..
27
62
  ```
28
63
 
29
- ## Quick Start
64
+ ### Step 5: Rebuild Your App
65
+
66
+ ```bash
67
+ # For Android
68
+ npx react-native run-android
69
+
70
+ # For iOS
71
+ npx react-native run-ios
72
+ ```
73
+
74
+ ---
75
+
76
+ ## ⚙️ Configuration
77
+
78
+ ### Android Setup
79
+
80
+ #### 1. Add Permissions to AndroidManifest.xml
81
+
82
+ Open `android/app/src/main/AndroidManifest.xml` and add:
83
+
84
+ ```xml
85
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
86
+
87
+ <!-- Camera Permission (Required) -->
88
+ <uses-permission android:name="android.permission.CAMERA" />
89
+
90
+ <!-- Location Permissions (Required) -->
91
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
92
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
93
+
94
+ <!-- Storage Permissions (Required for saving images) -->
95
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
96
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
97
+ android:maxSdkVersion="28" />
98
+
99
+ <!-- Internet Permission (Required for API calls) -->
100
+ <uses-permission android:name="android.permission.INTERNET" />
101
+
102
+ <!-- Camera Features (Optional but recommended) -->
103
+ <uses-feature android:name="android.hardware.camera" android:required="false" />
104
+ <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
105
+
106
+ <application>
107
+ <!-- Your app configuration -->
108
+ </application>
109
+
110
+ </manifest>
111
+ ```
112
+
113
+ #### 2. Update build.gradle
114
+
115
+ Ensure your `android/app/build.gradle` has minimum SDK version 21:
116
+
117
+ ```gradle
118
+ android {
119
+ defaultConfig {
120
+ minSdkVersion 21
121
+ targetSdkVersion 33
122
+ }
123
+ }
124
+ ```
125
+
126
+ ---
127
+
128
+ ### iOS Setup
129
+
130
+ #### 1. Add Privacy Permissions to Info.plist
131
+
132
+ Open `ios/YourAppName/Info.plist` and add:
133
+
134
+ ```xml
135
+ <key>NSCameraUsageDescription</key>
136
+ <string>We need camera access to scan your documents and capture selfie for identity verification</string>
137
+
138
+ <key>NSLocationWhenInUseUsageDescription</key>
139
+ <string>We need your location for identity verification purposes</string>
140
+
141
+ <key>NSPhotoLibraryUsageDescription</key>
142
+ <string>We need access to your photo library to save captured images</string>
143
+
144
+ <key>NSPhotoLibraryAddUsageDescription</key>
145
+ <string>We need permission to save captured images to your photo library</string>
146
+ ```
147
+
148
+ #### 2. Update Podfile
149
+
150
+ Ensure your `ios/Podfile` has minimum iOS version 11.0:
151
+
152
+ ```ruby
153
+ platform :ios, '11.0'
154
+ ```
155
+
156
+ ---
157
+
158
+ ## 🚀 Usage
159
+
160
+ ### Basic Implementation
161
+
162
+ ```typescript
163
+ import React from 'react';
164
+ import { IDMScan } from '@test-web/react-native-sdk';
165
+
166
+ export default function App() {
167
+ const config = {
168
+ clientID: 'your-client-id',
169
+ clientSecret: 'your-client-secret',
170
+ environment: 'sandbox', // or 'production'
171
+ requestData: {
172
+ requestID: 'unique-request-id',
173
+ name: 'John Doe',
174
+ dateOfBirth: '1990-01-01',
175
+ },
176
+ theme: 'light',
177
+ };
178
+
179
+ return <IDMScan idmConf={config} />;
180
+ }
181
+ ```
182
+
183
+ ### With Custom Configuration
30
184
 
31
185
  ```typescript
32
186
  import React from 'react';
33
- import { IDMScan } from 'test-react-native-sdk';
187
+ import { IDMScan } from '@test-web/react-native-sdk';
188
+
189
+ export default function App() {
190
+ const idmConfiguration = {
191
+ clientID: process.env.IDM_CLIENT_ID,
192
+ clientSecret: process.env.IDM_CLIENT_SECRET,
193
+ environment: 'sandbox',
194
+ requestData: {
195
+ requestID: generateUniqueId(),
196
+ name: 'John Doe',
197
+ dateOfBirth: '1990-01-01',
198
+ countryCode: 'US',
199
+ mobile: '+1234567890',
200
+ callbackURL: 'https://your-api.com/callback',
201
+ },
202
+ theme: 'ocean',
203
+ };
204
+
205
+ return <IDMScan idmConf={idmConfiguration} />;
206
+ }
207
+ ```
208
+
209
+ ---
210
+
211
+ ## 🎨 Available Themes
212
+
213
+ The SDK comes with 10 pre-built themes:
214
+
215
+ | Theme Name | Usage |
216
+ |------------|-------|
217
+ | Light | `theme: 'light'` |
218
+ | Dark | `theme: 'dark'` |
219
+ | Ocean | `theme: 'ocean'` |
220
+ | Sunset | `theme: 'sunset'` |
221
+ | Forest | `theme: 'forest'` |
222
+ | Pastel | `theme: 'pastel'` |
223
+ | High Contrast | `theme: 'highContrast'` |
224
+ | Professional | `theme: 'professional'` |
225
+ | Sakura | `theme: 'sakura'` |
226
+ | Midnight | `theme: 'midnight'` |
227
+
228
+ ### Custom Theme Example
229
+
230
+ ```typescript
231
+ import { IDMScan } from '@test-web/react-native-sdk';
232
+
233
+ const customTheme = {
234
+ colors: {
235
+ primary: '#FF6B6B',
236
+ secondary: '#4ECDC4',
237
+ background: '#FFFFFF',
238
+ text: '#2C3E50',
239
+ subtitle: '#7F8C8D',
240
+ border: '#BDC3C7',
241
+ error: '#E74C3C',
242
+ success: '#2ECC71',
243
+ },
244
+ spacing: {
245
+ xs: 4,
246
+ sm: 8,
247
+ md: 16,
248
+ lg: 24,
249
+ xl: 32,
250
+ },
251
+ };
34
252
 
35
253
  export default function App() {
36
- return <IDMScan idmConf={{ theme: 'light' }} />;
254
+ return <IDMScan idmConf={{ ...config, theme: customTheme }} />;
255
+ }
256
+ ```
257
+
258
+ ---
259
+
260
+ ## 🔄 Dynamic Flow
261
+
262
+ The SDK automatically determines the verification flow based on document metadata:
263
+
264
+ ### Flow Examples
265
+
266
+ #### Example 1: Driver's License (Front Only)
267
+ ```json
268
+ {
269
+ "document_flow": ["F"],
270
+ "barcode": "None"
271
+ }
272
+ ```
273
+ **Flow:** Selfie → Front Document → Complete
274
+
275
+ #### Example 2: Passport (Front + MRZ)
276
+ ```json
277
+ {
278
+ "document_flow": ["F"],
279
+ "barcode": "TD3"
280
+ }
281
+ ```
282
+ **Flow:** Selfie → Front Document → MRZ Scan → Complete
283
+
284
+ #### Example 3: National ID (Front + Back + Barcode)
285
+ ```json
286
+ {
287
+ "document_flow": ["F", "B"],
288
+ "barcode": "PDF417 B"
37
289
  }
38
290
  ```
291
+ **Flow:** Selfie → Front Document → Back Document → Barcode Scan → Complete
39
292
 
40
- ## Themes
293
+ ---
294
+
295
+ ## 📚 API Reference
296
+
297
+ ### IDMConf Interface
298
+
299
+ ```typescript
300
+ interface IDMConf {
301
+ // Required
302
+ clientID: string;
303
+ clientSecret: string;
304
+ environment: 'sandbox' | 'production';
305
+ requestData: RequestData;
306
+
307
+ // Optional
308
+ theme?: 'light' | 'dark' | Theme;
309
+ userDetails?: UserDetails;
310
+ accessToken?: string;
311
+ verificationCode?: string;
312
+ configuration?: Configuration;
313
+ countryDetails?: CountryDetail[];
314
+ selectedCountryDetails?: SelectedCountryDetail;
315
+ requestConfiguration?: RequestConfiguration;
316
+ }
317
+
318
+ interface RequestData {
319
+ requestID: string;
320
+ name?: string;
321
+ dateOfBirth?: string;
322
+ countryCode?: string;
323
+ mobile?: string;
324
+ callbackURL?: string;
325
+ redirectURL?: string;
326
+ }
327
+ ```
328
+
329
+ ### Exported Components
330
+
331
+ ```typescript
332
+ import {
333
+ IDMScan, // Main SDK component
334
+ Button, // Themed button component
335
+ ThemedText, // Themed text component
336
+ Loader, // Loading indicator
337
+ Header, // Header component
338
+ Footer, // Footer component
339
+ CustomOverlay, // Overlay component
340
+ } from '@test-web/react-native-sdk';
341
+ ```
342
+
343
+ ### Exported Hooks
344
+
345
+ ```typescript
346
+ import {
347
+ useTheme, // Access current theme
348
+ useOrientation, // Detect device orientation
349
+ useKeyboard, // Keyboard visibility state
350
+ useIDM, // Access IDM configuration
351
+ } from '@test-web/react-native-sdk';
352
+ ```
353
+
354
+ ### Exported Utilities
355
+
356
+ ```typescript
357
+ import {
358
+ debounce, // Debounce function calls
359
+ throttle, // Throttle function calls
360
+ memoize, // Memoize function results
361
+ base64Encode, // Encode to base64
362
+ base64Decode, // Decode from base64
363
+ getDocumentLabel, // Get document type label
364
+ FlowManager, // Flow management class
365
+ createFlowManager, // Create flow manager
366
+ processImageToBase64, // Process images
367
+ } from '@test-web/react-native-sdk';
368
+ ```
369
+
370
+ ### API Services
371
+
372
+ ```typescript
373
+ import { ScanServices } from '@test-web/react-native-sdk';
374
+
375
+ // Available APIs
376
+ ScanServices.getUserDataAPI();
377
+ ScanServices.generateAccessToken(config);
378
+ ScanServices.generateRequest(config, requestData);
379
+ ScanServices.getConfiguration(config, verificationCode);
380
+ ScanServices.getCountries(config);
381
+ ScanServices.captureDocumentFront(config, photoData);
382
+ ScanServices.captureDocumentBack(config, photoData);
383
+ ScanServices.captureBarcode(config, barcodeData);
384
+ ScanServices.captureMRZ(config, mrzData);
385
+ ScanServices.completeVerification(config);
386
+ ```
387
+
388
+ ---
389
+
390
+ ## 🔧 Troubleshooting
391
+
392
+ ### Common Issues
393
+
394
+ #### 1. Camera Permission Denied
395
+
396
+ **Problem:** Camera not working or permission denied error.
397
+
398
+ **Solution:**
399
+ - Ensure you've added camera permissions to `AndroidManifest.xml` (Android)
400
+ - Ensure you've added `NSCameraUsageDescription` to `Info.plist` (iOS)
401
+ - Request permissions at runtime before using the SDK
402
+
403
+ #### 2. Location Not Available
404
+
405
+ **Problem:** Location permission errors.
406
+
407
+ **Solution:**
408
+ - Check location permissions in manifest/plist
409
+ - Ensure GPS is enabled on device
410
+ - Verify react-native-geolocation-service is installed
411
+
412
+ #### 3. Navigation Error
413
+
414
+ **Problem:** `Couldn't find a navigation object` error.
415
+
416
+ **Solution:**
417
+ - Ensure all navigation dependencies are installed
418
+ - Run `pod install` for iOS
419
+ - Clean and rebuild the app
420
+
421
+ #### 4. iOS Build Failed
422
+
423
+ **Problem:** Build fails on iOS after installation.
424
+
425
+ **Solution:**
426
+ ```bash
427
+ cd ios && pod install && cd ..
428
+ # Clean build folder in Xcode
429
+ # Product → Clean Build Folder
430
+ # Rebuild the app
431
+ ```
432
+
433
+ #### 5. Android Build Failed
434
+
435
+ **Problem:** Build fails on Android with dependency errors.
436
+
437
+ **Solution:**
438
+ ```bash
439
+ cd android && ./gradlew clean && cd ..
440
+ # Rebuild the app
441
+ ```
442
+
443
+ #### 6. Image Processing Fails
444
+
445
+ **Problem:** Images not uploading or processing errors.
446
+
447
+ **Solution:**
448
+ - Ensure react-native-image-resizer is installed
449
+ - Ensure react-native-fs is installed
450
+ - Check storage permissions
451
+
452
+ ---
453
+
454
+ ## 🎯 Advanced Usage
455
+
456
+ ### Using Context
457
+
458
+ ```typescript
459
+ import { useIDM } from '@test-web/react-native-sdk';
460
+
461
+ function MyComponent() {
462
+ const { idmConf, updateIDMConf } = useIDM();
463
+
464
+ // Access configuration
465
+ console.log(idmConf.verificationCode);
466
+
467
+ // Update configuration
468
+ updateIDMConf({ theme: 'dark' });
469
+ }
470
+ ```
471
+
472
+ ### Flow Manager
473
+
474
+ ```typescript
475
+ import { createFlowManager } from '@test-web/react-native-sdk';
476
+
477
+ const metadata = idmConf.selectedCountryDetails?.selectedMetaData;
478
+ const flowManager = createFlowManager(metadata);
479
+
480
+ // Check requirements
481
+ const needsBack = flowManager.requiresBackCapture();
482
+ const needsBarcode = flowManager.requiresBarcodeCapture();
483
+ const needsMRZ = flowManager.requiresMRZCapture();
484
+
485
+ // Get next screen
486
+ const nextScreen = flowManager.getNextScreenAfterFront();
487
+ ```
488
+
489
+ ### Image Processing
41
490
 
42
491
  ```typescript
43
- import { IDMScan, themes } from 'test-react-native-sdk';
492
+ import { processImageToBase64 } from '@test-web/react-native-sdk';
44
493
 
45
- <IDMScan idmConf={{ theme: themes.ocean }} />
46
- <IDMScan idmConf={{ theme: themes.dark }} />
47
- <IDMScan idmConf={{ theme: themes.sunset }} />
494
+ const base64Image = await processImageToBase64(imagePath, {
495
+ width: 810,
496
+ height: 1080,
497
+ quality: 70,
498
+ format: 'JPEG',
499
+ });
48
500
  ```
49
501
 
50
- Available: `light`, `dark`, `ocean`, `sunset`, `forest`, `pastel`, `highContrast`, `professional`, `sakura`, `midnight`
502
+ ---
503
+
504
+ ## 📊 Performance
505
+
506
+ The SDK includes several performance optimizations:
507
+
508
+ - **Memoization** - Components and calculations are memoized
509
+ - **Lazy Loading** - Heavy dependencies loaded only when needed
510
+ - **Image Optimization** - Images resized before upload (810x1080, 70% quality)
511
+ - **Efficient State** - Minimal re-renders with optimized context
512
+ - **API Caching** - Countries and configuration cached after first fetch
513
+
514
+ ---
515
+
516
+ ## 🔒 Security
517
+
518
+ - OAuth2 authentication with client credentials
519
+ - Secure token management
520
+ - HTTPS for all API calls
521
+ - No sensitive data stored locally
522
+ - Proper error handling without exposing internals
523
+
524
+ ---
525
+
526
+ ## 📄 License
527
+
528
+ MIT License
529
+
530
+ Copyright (c) 2024 Your Company
531
+
532
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
533
+
534
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
535
+
536
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
537
+
538
+ ---
539
+
540
+ ## 📞 Support
541
+
542
+ - **Email:** hello@yourcompany.com
543
+ - **GitHub:** https://github.com/yourcompany/react-native-sdk
544
+ - **Documentation:** https://docs.yourcompany.com
545
+
546
+ ---
547
+
548
+ ## 🎉 What's New in v2.0.0
549
+
550
+ ### Major Changes
551
+ - ✅ **Fully Dynamic** - All configuration driven by API
552
+ - ✅ **Metadata-Driven Navigation** - Automatic flow determination
553
+ - ✅ **Real API Integration** - All APIs implemented
554
+ - ✅ **Enhanced Type System** - Complete TypeScript coverage
555
+ - ✅ **Performance Optimizations** - Memoization and efficient rendering
556
+ - ✅ **Image Processing** - Automatic resize and compression
557
+ - ✅ **Flow Manager** - Smart navigation based on document type
558
+ - ✅ **Better Error Handling** - Comprehensive error management
559
+ - ✅ **Loading States** - User feedback throughout the flow
560
+
561
+ ### Breaking Changes from v1.x
562
+ - `clientID`, `clientSecret`, `environment`, and `requestData` are now required
563
+ - Static country data removed (now fetched from API)
564
+ - Navigation flow is now metadata-driven
51
565
 
52
- ## Documentation
566
+ ### Migration from v1.x
567
+ See migration guide in the repository for detailed instructions.
53
568
 
54
- See [SETUP.md](./SETUP.md) for complete installation and integration guide.
569
+ ---
55
570
 
56
- ## License
571
+ **Made with ❤️ by Your Company**
57
572
 
58
- MIT
573
+ **Version:** 2.0.0
574
+ **Status:** Production Ready
575
+ **Last Updated:** December 22, 2024
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" height="112" width="112"><defs><linearGradient id="a" x1="3.2173" y1="15" x2="44.7812" y2="15" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#d93025"/><stop offset="1" stop-color="#ea4335"/></linearGradient><linearGradient id="b" x1="20.7219" y1="47.6791" x2="41.5039" y2="11.6837" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fcc934"/><stop offset="1" stop-color="#fbbc04"/></linearGradient><linearGradient id="c" x1="26.5981" y1="46.5015" x2="5.8161" y2="10.506" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1e8e3e"/><stop offset="1" stop-color="#34a853"/></linearGradient></defs><circle cx="24" cy="23.9947" r="12" style="fill:#fff"/><path d="M3.2154,36A24,24,0,1,0,12,3.2154,24,24,0,0,0,3.2154,36ZM34.3923,18A12,12,0,1,1,18,13.6077,12,12,0,0,1,34.3923,18Z" style="fill:none"/><path d="M24,12H44.7812a23.9939,23.9939,0,0,0-41.5639.0029L13.6079,30l.0093-.0024A11.9852,11.9852,0,0,1,24,12Z" style="fill:url(#a)"/><circle cx="24" cy="24" r="9.5" style="fill:#1a73e8"/><path d="M34.3913,30.0029,24.0007,48A23.994,23.994,0,0,0,44.78,12.0031H23.9989l-.0025.0093A11.985,11.985,0,0,1,34.3913,30.0029Z" style="fill:url(#b)"/><path d="M13.6086,30.0031,3.218,12.006A23.994,23.994,0,0,0,24.0025,48L34.3931,30.0029l-.0067-.0068a11.9852,11.9852,0,0,1-20.7778.007Z" style="fill:url(#c)"/></svg>
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file