@transfergratis/react-native-sdk 0.1.10 → 0.1.11
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 +433 -94
- package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/components/KYCElements/IDCardCapture.js +57 -9
- package/build/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/components/OverLay/IdCard.js +1 -1
- package/build/components/OverLay/IdCard.js.map +1 -1
- package/build/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/modules/api/CardAuthentification.js +10 -1
- package/build/modules/api/CardAuthentification.js.map +1 -1
- package/build/modules/api/KYCService.js +3 -3
- package/build/modules/api/KYCService.js.map +1 -1
- package/package.json +1 -1
- package/src/components/KYCElements/IDCardCapture.tsx +57 -12
- package/src/components/OverLay/IdCard.tsx +1 -1
- package/src/modules/api/CardAuthentification.ts +46 -37
- package/src/modules/api/KYCService.ts +3 -3
package/README.md
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
# TransferGratis KYC SDK
|
|
2
2
|
|
|
3
|
-
A comprehensive KYC
|
|
3
|
+
A comprehensive React Native SDK for identity verification (KYC - Know Your Customer) with Expo support, featuring advanced camera capabilities powered by react-native-vision-camera.
|
|
4
4
|
|
|
5
5
|
## 🚀 Features
|
|
6
6
|
|
|
7
7
|
✅ **Advanced Camera Integration** with react-native-vision-camera
|
|
8
|
-
✅ **Selfie Capture** with face detection overlay
|
|
8
|
+
✅ **Selfie Capture** with face detection and overlay
|
|
9
9
|
✅ **Document Capture** with auto-focus and quality controls
|
|
10
10
|
✅ **Orientation Video Processing** for liveness detection
|
|
11
11
|
✅ **File Upload** with validation
|
|
12
12
|
✅ **Custom Overlays** and instructions
|
|
13
13
|
✅ **Permission Management** with graceful fallbacks
|
|
14
|
-
✅ **Multi-Platform Support** (iOS, Android)
|
|
14
|
+
✅ **Multi-Platform Support** (iOS, Android, Web)
|
|
15
15
|
✅ **TypeScript Support** with full type definitions
|
|
16
16
|
✅ **Expo Config Plugin** for easy setup
|
|
17
|
+
✅ **JSON Template System** for configurable KYC flows
|
|
18
|
+
✅ **Multilingual Support** (French, English)
|
|
19
|
+
✅ **GPS Location Capture**
|
|
20
|
+
✅ **Country Selection** with region mapping
|
|
21
|
+
✅ **Reusable UI Components**
|
|
17
22
|
|
|
18
|
-
## 📦 Installation
|
|
23
|
+
## 📦 Installation
|
|
24
|
+
|
|
25
|
+
### Installing Dependencies
|
|
19
26
|
|
|
20
27
|
```bash
|
|
21
|
-
npm install @transfergratis/react-native-sdk react-native-vision-camera expo-location react-native-svg
|
|
28
|
+
npm install @transfergratis/react-native-sdk react-native-vision-camera expo-location expo-image-manipulator react-native-svg
|
|
22
29
|
```
|
|
23
30
|
|
|
24
|
-
### Configuration
|
|
31
|
+
### Expo Configuration (app.json / app.config.js)
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
Add the plugin to your Expo configuration file:
|
|
27
34
|
|
|
28
35
|
```json
|
|
29
36
|
{
|
|
@@ -32,21 +39,21 @@ Ajoutez le plugin à `app.json` (ou `app.config.js`) en vous basant sur l’exem
|
|
|
32
39
|
[
|
|
33
40
|
"react-native-vision-camera",
|
|
34
41
|
{
|
|
35
|
-
"cameraPermissionText": "
|
|
42
|
+
"cameraPermissionText": "This app uses the camera for KYC identity verification.",
|
|
36
43
|
"enableMicrophonePermission": true,
|
|
37
|
-
"microphonePermissionText": "
|
|
44
|
+
"microphonePermissionText": "This app uses the microphone for video recording."
|
|
38
45
|
}
|
|
39
46
|
],
|
|
40
47
|
[
|
|
41
48
|
"@transfergratis/react-native-sdk/plugin",
|
|
42
49
|
{
|
|
43
50
|
"visionCamera": {
|
|
44
|
-
"cameraPermissionText": "
|
|
45
|
-
"microphonePermissionText": "
|
|
51
|
+
"cameraPermissionText": "This app uses the camera for KYC identity verification.",
|
|
52
|
+
"microphonePermissionText": "This app uses the microphone for video recording."
|
|
46
53
|
},
|
|
47
54
|
"location": {
|
|
48
|
-
"locationPermissionText": "
|
|
49
|
-
"locationWhenInUsePermissionText": "
|
|
55
|
+
"locationPermissionText": "This app uses location to verify your identity and location.",
|
|
56
|
+
"locationWhenInUsePermissionText": "This app uses location to verify your identity and location.",
|
|
50
57
|
"enableBackgroundLocation": false
|
|
51
58
|
}
|
|
52
59
|
}
|
|
@@ -58,31 +65,190 @@ Ajoutez le plugin à `app.json` (ou `app.config.js`) en vous basant sur l’exem
|
|
|
58
65
|
|
|
59
66
|
### Android Setup
|
|
60
67
|
|
|
61
|
-
The config plugin
|
|
68
|
+
The config plugin automatically handles Android permissions. No additional setup required.
|
|
69
|
+
|
|
70
|
+
### iOS Setup
|
|
71
|
+
|
|
72
|
+
iOS permissions are also automatically handled by the Expo plugin.
|
|
62
73
|
|
|
63
74
|
## 🎯 Quick Start
|
|
64
75
|
|
|
65
|
-
###
|
|
76
|
+
### Using JSON Templates (Recommended)
|
|
77
|
+
|
|
78
|
+
The recommended approach is to use the JSON template system to configure your KYC flow:
|
|
66
79
|
|
|
67
80
|
```tsx
|
|
68
81
|
import React from 'react';
|
|
69
|
-
import {
|
|
82
|
+
import { TemplateKYCFlow, KYCTemplate, VerificationState } from '@transfergratis/react-native-sdk';
|
|
83
|
+
|
|
84
|
+
const myKYCTemplate: KYCTemplate = {
|
|
85
|
+
id: 1,
|
|
86
|
+
name: {
|
|
87
|
+
en: "Identity Verification",
|
|
88
|
+
fr: "Vérification d'Identité"
|
|
89
|
+
},
|
|
90
|
+
description: {
|
|
91
|
+
en: "Complete identity verification flow",
|
|
92
|
+
fr: "Processus complet de vérification d'identité"
|
|
93
|
+
},
|
|
94
|
+
version: "1.0.0",
|
|
95
|
+
components: [
|
|
96
|
+
{
|
|
97
|
+
id: 6,
|
|
98
|
+
type: "country_selection",
|
|
99
|
+
order: 1,
|
|
100
|
+
labels: {
|
|
101
|
+
en: "Select your country",
|
|
102
|
+
fr: "Sélectionnez votre pays"
|
|
103
|
+
},
|
|
104
|
+
instructions: {
|
|
105
|
+
en: "Choose your country of residence.",
|
|
106
|
+
fr: "Choisissez votre pays de résidence."
|
|
107
|
+
},
|
|
108
|
+
ui: {
|
|
109
|
+
icon: "country-icon.png",
|
|
110
|
+
themeColor: "#2DBD60",
|
|
111
|
+
buttonText: { en: "Confirm", fr: "Confirmer" }
|
|
112
|
+
},
|
|
113
|
+
config: {
|
|
114
|
+
allowed_countries: ["CM", "NG", "CI", "KE", "GH"],
|
|
115
|
+
default_country: "CM",
|
|
116
|
+
required: true
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: 1,
|
|
121
|
+
type: "id_card",
|
|
122
|
+
order: 2,
|
|
123
|
+
templateId: 1,
|
|
124
|
+
labels: {
|
|
125
|
+
front: {
|
|
126
|
+
en: "Upload front of ID card",
|
|
127
|
+
fr: "Téléversez le recto de votre carte d'identité"
|
|
128
|
+
},
|
|
129
|
+
back: {
|
|
130
|
+
en: "Upload back of ID card",
|
|
131
|
+
fr: "Téléversez le verso de votre carte d'identité"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
instructions: {
|
|
135
|
+
front: {
|
|
136
|
+
en: "Take a clear photo of the front of your ID.",
|
|
137
|
+
fr: "Prenez une photo nette du recto de votre pièce."
|
|
138
|
+
},
|
|
139
|
+
back: {
|
|
140
|
+
en: "Take a clear photo of the back of your ID.",
|
|
141
|
+
fr: "Prenez une photo nette du verso de votre pièce."
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
ui: {
|
|
145
|
+
front: {
|
|
146
|
+
themeColor: "#2DBD60",
|
|
147
|
+
buttonText: { en: "Next", fr: "Suivant" }
|
|
148
|
+
},
|
|
149
|
+
back: {
|
|
150
|
+
themeColor: "#2DBD60",
|
|
151
|
+
buttonText: { en: "Next", fr: "Suivant" }
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
config: {
|
|
155
|
+
sides: ["front", "back"],
|
|
156
|
+
allowed_formats: ["jpg", "png"],
|
|
157
|
+
max_size_mb: 5,
|
|
158
|
+
document_types: ["identity_card", "passport", "drivers_licence", "national_id"],
|
|
159
|
+
bbox_configs: {
|
|
160
|
+
identity_card: {
|
|
161
|
+
xMin: 20,
|
|
162
|
+
yMin: 140,
|
|
163
|
+
xMax: 370,
|
|
164
|
+
yMax: 340,
|
|
165
|
+
borderColor: "#2DBD60",
|
|
166
|
+
borderWidth: 4,
|
|
167
|
+
cornerRadius: 12
|
|
168
|
+
},
|
|
169
|
+
passport: {
|
|
170
|
+
xMin: 15,
|
|
171
|
+
yMin: 130,
|
|
172
|
+
xMax: 375,
|
|
173
|
+
yMax: 350,
|
|
174
|
+
borderColor: "#007AFF",
|
|
175
|
+
borderWidth: 4,
|
|
176
|
+
cornerRadius: 8
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: 3,
|
|
183
|
+
type: "selfie",
|
|
184
|
+
order: 3,
|
|
185
|
+
templateId: 1,
|
|
186
|
+
labels: {
|
|
187
|
+
en: "Take selfies from different angles",
|
|
188
|
+
fr: "Prenez des selfies sous différents angles"
|
|
189
|
+
},
|
|
190
|
+
instructions: {
|
|
191
|
+
en: "Take selfies from front, left, and right angles.",
|
|
192
|
+
fr: "Prenez des selfies de face, profil gauche et profil droit."
|
|
193
|
+
},
|
|
194
|
+
ui: {
|
|
195
|
+
icon: "selfie-icon.png",
|
|
196
|
+
themeColor: "#2DBD60",
|
|
197
|
+
buttonText: { en: "Next", fr: "Suivant" }
|
|
198
|
+
},
|
|
199
|
+
config: {
|
|
200
|
+
liveness_check: true,
|
|
201
|
+
max_attempts: 3,
|
|
202
|
+
orientations: ["center", "left", "right"]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
};
|
|
70
207
|
|
|
71
208
|
export default function App() {
|
|
209
|
+
const handleComplete = (result: VerificationState) => {
|
|
210
|
+
console.log('KYC completed:', result);
|
|
211
|
+
// Process verification result
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const handleError = (error: string) => {
|
|
215
|
+
console.error('KYC error:', error);
|
|
216
|
+
// Handle error
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const handleCancel = () => {
|
|
220
|
+
console.log('KYC cancelled');
|
|
221
|
+
// Handle cancellation
|
|
222
|
+
};
|
|
223
|
+
|
|
72
224
|
return (
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
onComplete={
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}}
|
|
225
|
+
<TemplateKYCFlow
|
|
226
|
+
template={myKYCTemplate}
|
|
227
|
+
onComplete={handleComplete}
|
|
228
|
+
onError={handleError}
|
|
229
|
+
onCancel={handleCancel}
|
|
230
|
+
language="en" // or "fr" for French
|
|
231
|
+
API_KEY="your-api-key-here"
|
|
81
232
|
/>
|
|
82
233
|
);
|
|
83
234
|
}
|
|
84
235
|
```
|
|
85
236
|
|
|
237
|
+
### Basic Usage (Simple Component)
|
|
238
|
+
|
|
239
|
+
For simple usage without templates:
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
import React from 'react';
|
|
243
|
+
import { LauchTransferGratisKYC } from '@transfergratis/react-native-sdk';
|
|
244
|
+
|
|
245
|
+
export default function App() {
|
|
246
|
+
return (
|
|
247
|
+
<LauchTransferGratisKYC />
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
86
252
|
### Advanced Camera Usage
|
|
87
253
|
|
|
88
254
|
```tsx
|
|
@@ -123,11 +289,26 @@ export default function CameraExample() {
|
|
|
123
289
|
|
|
124
290
|
## 📚 API Reference
|
|
125
291
|
|
|
126
|
-
### Components
|
|
292
|
+
### Main Components
|
|
293
|
+
|
|
294
|
+
#### `TemplateKYCFlow`
|
|
295
|
+
|
|
296
|
+
The main component for JSON template-based KYC flows.
|
|
297
|
+
|
|
298
|
+
```tsx
|
|
299
|
+
interface TemplateKYCFlowProps {
|
|
300
|
+
template: KYCTemplate;
|
|
301
|
+
onComplete?: (data: VerificationState) => void;
|
|
302
|
+
onError?: (error: string) => void;
|
|
303
|
+
onCancel?: () => void;
|
|
304
|
+
language?: string; // 'fr' | 'en'
|
|
305
|
+
API_KEY?: string;
|
|
306
|
+
}
|
|
307
|
+
```
|
|
127
308
|
|
|
128
309
|
#### `EnhancedCameraView`
|
|
129
310
|
|
|
130
|
-
|
|
311
|
+
Advanced camera component with full Vision Camera integration.
|
|
131
312
|
|
|
132
313
|
```tsx
|
|
133
314
|
interface EnhancedCameraViewProps {
|
|
@@ -144,12 +325,21 @@ interface EnhancedCameraViewProps {
|
|
|
144
325
|
showCaptureButton?: boolean;
|
|
145
326
|
showSwitchCamera?: boolean;
|
|
146
327
|
overlayComponent?: React.ReactNode;
|
|
328
|
+
bbox?: IBbox;
|
|
329
|
+
canFlip?: boolean;
|
|
330
|
+
enableVideo?: boolean;
|
|
331
|
+
isRecording?: boolean;
|
|
332
|
+
onVideoRecordingStart?: () => void;
|
|
333
|
+
onVideoRecordingStop?: () => void;
|
|
334
|
+
videoDuration?: number;
|
|
335
|
+
onSilentCapture?: (result: ISilentCaptureResult) => void;
|
|
336
|
+
silentCaptureResult?: ISilentCaptureResult;
|
|
147
337
|
}
|
|
148
338
|
```
|
|
149
339
|
|
|
150
340
|
#### `VisionCameraView`
|
|
151
341
|
|
|
152
|
-
|
|
342
|
+
Simplified camera component for basic use cases.
|
|
153
343
|
|
|
154
344
|
```tsx
|
|
155
345
|
interface VisionCameraViewProps {
|
|
@@ -166,20 +356,122 @@ interface VisionCameraViewProps {
|
|
|
166
356
|
}
|
|
167
357
|
```
|
|
168
358
|
|
|
169
|
-
####
|
|
359
|
+
#### Specialized KYC Components
|
|
360
|
+
|
|
361
|
+
##### `IDCardCapture`
|
|
170
362
|
|
|
171
|
-
|
|
363
|
+
Identity document capture with automatic validation.
|
|
172
364
|
|
|
173
365
|
```tsx
|
|
174
|
-
|
|
175
|
-
|
|
366
|
+
interface IDCardCaptureProps {
|
|
367
|
+
component: TemplateComponent;
|
|
368
|
+
value?: Record<string, IIDCardPayload>;
|
|
369
|
+
onValueChange: (value: Record<string, IIDCardPayload | string>) => void;
|
|
370
|
+
error?: string;
|
|
371
|
+
language?: string;
|
|
372
|
+
currentSide?: string;
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
##### `SelfieCaptureTemplate`
|
|
377
|
+
|
|
378
|
+
Selfie capture with liveness detection.
|
|
379
|
+
|
|
380
|
+
```tsx
|
|
381
|
+
interface SelfieCaptureTemplateProps {
|
|
382
|
+
component: TemplateComponent;
|
|
383
|
+
value?: any;
|
|
384
|
+
onValueChange: (value: any) => void;
|
|
385
|
+
error?: string;
|
|
386
|
+
language?: string;
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
##### `FileUploadTemplate`
|
|
391
|
+
|
|
392
|
+
File upload with validation.
|
|
393
|
+
|
|
394
|
+
```tsx
|
|
395
|
+
interface FileUploadTemplateProps {
|
|
396
|
+
component: TemplateComponent;
|
|
397
|
+
value?: any;
|
|
398
|
+
onValueChange: (value: any) => void;
|
|
399
|
+
error?: string;
|
|
400
|
+
language?: string;
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
##### `LocationCaptureTemplate`
|
|
405
|
+
|
|
406
|
+
GPS location capture.
|
|
407
|
+
|
|
408
|
+
```tsx
|
|
409
|
+
interface LocationCaptureTemplateProps {
|
|
410
|
+
component: TemplateComponent;
|
|
411
|
+
value?: LocationData;
|
|
412
|
+
onValueChange: (value: LocationData) => void;
|
|
413
|
+
error?: string;
|
|
414
|
+
language?: string;
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
##### `CountrySelectionTemplate`
|
|
419
|
+
|
|
420
|
+
Country selection with region mapping.
|
|
421
|
+
|
|
422
|
+
```tsx
|
|
423
|
+
interface CountrySelectionTemplateProps {
|
|
424
|
+
component: TemplateComponent;
|
|
425
|
+
value?: Country;
|
|
426
|
+
onValueChange: (value: Country) => void;
|
|
427
|
+
error?: string;
|
|
428
|
+
language?: string;
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
#### `OrientationVideoCapture`
|
|
433
|
+
|
|
434
|
+
Component for liveness detection via orientation video.
|
|
435
|
+
|
|
436
|
+
```tsx
|
|
437
|
+
interface OrientationVideoCaptureProps {
|
|
438
|
+
config: OrientationVideoConfig;
|
|
439
|
+
onComplete: (result: OrientationVideoResult) => void;
|
|
440
|
+
onError: (error: string) => void;
|
|
441
|
+
kycService: KYCService;
|
|
442
|
+
}
|
|
176
443
|
```
|
|
177
444
|
|
|
178
445
|
### Modules
|
|
179
446
|
|
|
447
|
+
#### `KYCService`
|
|
448
|
+
|
|
449
|
+
Main service for KYC API calls.
|
|
450
|
+
|
|
451
|
+
```tsx
|
|
452
|
+
import { KYCService } from '@transfergratis/react-native-sdk';
|
|
453
|
+
|
|
454
|
+
const kycService = new KYCService('https://api.yourdomain.com', 'your-api-key');
|
|
455
|
+
|
|
456
|
+
// Create a new session
|
|
457
|
+
const session = await kycService.newSession(token);
|
|
458
|
+
|
|
459
|
+
// Submit a verification step
|
|
460
|
+
await kycService.verificationSession({
|
|
461
|
+
session_id: session.id,
|
|
462
|
+
step: 'id_card',
|
|
463
|
+
data: { /* step data */ },
|
|
464
|
+
templateId: 1,
|
|
465
|
+
action: 'submit'
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
// Get verification result
|
|
469
|
+
const result = await kycService.getVerificationResult(session_id);
|
|
470
|
+
```
|
|
471
|
+
|
|
180
472
|
#### `VisionCameraModule`
|
|
181
473
|
|
|
182
|
-
|
|
474
|
+
Module for camera operations and permissions.
|
|
183
475
|
|
|
184
476
|
```tsx
|
|
185
477
|
import { VisionCameraModule } from '@transfergratis/react-native-sdk';
|
|
@@ -187,6 +479,9 @@ import { VisionCameraModule } from '@transfergratis/react-native-sdk';
|
|
|
187
479
|
// Request permissions
|
|
188
480
|
const hasPermissions = await VisionCameraModule.requestAllPermissions();
|
|
189
481
|
|
|
482
|
+
// Check permissions
|
|
483
|
+
const hasAllPermissions = await VisionCameraModule.hasAllPermissions();
|
|
484
|
+
|
|
190
485
|
// Get camera devices
|
|
191
486
|
const frontCamera = await VisionCameraModule.getFrontCameraDevice();
|
|
192
487
|
const backCamera = await VisionCameraModule.getBackCameraDevice();
|
|
@@ -195,6 +490,43 @@ const backCamera = await VisionCameraModule.getBackCameraDevice();
|
|
|
195
490
|
const isAvailable = await VisionCameraModule.isCameraAvailable();
|
|
196
491
|
```
|
|
197
492
|
|
|
493
|
+
### Hooks
|
|
494
|
+
|
|
495
|
+
#### `useTemplateKYCFlow`
|
|
496
|
+
|
|
497
|
+
Hook for managing template-based KYC flow.
|
|
498
|
+
|
|
499
|
+
```tsx
|
|
500
|
+
import { useTemplateKYCFlow, TemplateKYCFlowProvider } from '@transfergratis/react-native-sdk';
|
|
501
|
+
|
|
502
|
+
// In your component
|
|
503
|
+
const { state, actions, currentComponent, progress } = useTemplateKYCFlow();
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
#### `useOrientationVideo`
|
|
507
|
+
|
|
508
|
+
Hook for orientation video capture.
|
|
509
|
+
|
|
510
|
+
```tsx
|
|
511
|
+
import { useOrientationVideo, KYCService } from '@transfergratis/react-native-sdk';
|
|
512
|
+
|
|
513
|
+
const kycService = new KYCService('https://api.yourdomain.com', 'your-api-key');
|
|
514
|
+
const { state, actions } = useOrientationVideo(kycService, {
|
|
515
|
+
duration: 10,
|
|
516
|
+
maxRetakes: 2,
|
|
517
|
+
});
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
#### `useLocation`
|
|
521
|
+
|
|
522
|
+
Hook for location capture.
|
|
523
|
+
|
|
524
|
+
```tsx
|
|
525
|
+
import { useLocation } from '@transfergratis/react-native-sdk';
|
|
526
|
+
|
|
527
|
+
const { location, error, requestPermission, getCurrentLocation } = useLocation();
|
|
528
|
+
```
|
|
529
|
+
|
|
198
530
|
## 🎨 Customization
|
|
199
531
|
|
|
200
532
|
### Custom Overlay Example
|
|
@@ -255,7 +587,7 @@ const styles = StyleSheet.create({
|
|
|
255
587
|
|
|
256
588
|
### Orientation Video Processing
|
|
257
589
|
|
|
258
|
-
The SDK
|
|
590
|
+
The SDK includes advanced liveness detection through orientation video processing. This feature captures and analyzes short videos to verify that a real person is present during the KYC process.
|
|
259
591
|
|
|
260
592
|
#### Basic Usage
|
|
261
593
|
|
|
@@ -282,11 +614,9 @@ export default function LivenessDetection() {
|
|
|
282
614
|
}}
|
|
283
615
|
onComplete={(result) => {
|
|
284
616
|
console.log('Liveness detection result:', result);
|
|
285
|
-
// Handle successful processing
|
|
286
617
|
}}
|
|
287
618
|
onError={(error) => {
|
|
288
619
|
console.error('Liveness detection error:', error);
|
|
289
|
-
// Handle error
|
|
290
620
|
}}
|
|
291
621
|
kycService={kycService}
|
|
292
622
|
/>
|
|
@@ -294,7 +624,7 @@ export default function LivenessDetection() {
|
|
|
294
624
|
}
|
|
295
625
|
```
|
|
296
626
|
|
|
297
|
-
#### Using the
|
|
627
|
+
#### Using the Hook
|
|
298
628
|
|
|
299
629
|
```tsx
|
|
300
630
|
import React from 'react';
|
|
@@ -324,7 +654,7 @@ export default function LivenessDetectionHook() {
|
|
|
324
654
|
|
|
325
655
|
#### API Response Format
|
|
326
656
|
|
|
327
|
-
|
|
657
|
+
Orientation video processing returns detailed results for each face orientation:
|
|
328
658
|
|
|
329
659
|
```json
|
|
330
660
|
{
|
|
@@ -343,9 +673,7 @@ The orientation video processing returns detailed results for each face orientat
|
|
|
343
673
|
}
|
|
344
674
|
```
|
|
345
675
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
## 🔧 Configuration Plugin
|
|
676
|
+
## 🔧 Plugin Configuration
|
|
349
677
|
|
|
350
678
|
The SDK includes an Expo config plugin for automatic setup of native permissions and dependencies.
|
|
351
679
|
|
|
@@ -357,6 +685,12 @@ interface VisionCameraPluginProps {
|
|
|
357
685
|
microphonePermissionText?: string;
|
|
358
686
|
enableFrameProcessors?: boolean;
|
|
359
687
|
}
|
|
688
|
+
|
|
689
|
+
interface LocationPluginProps {
|
|
690
|
+
locationPermissionText?: string;
|
|
691
|
+
locationWhenInUsePermissionText?: string;
|
|
692
|
+
enableBackgroundLocation?: boolean;
|
|
693
|
+
}
|
|
360
694
|
```
|
|
361
695
|
|
|
362
696
|
### Manual Plugin Usage
|
|
@@ -389,16 +723,28 @@ npm install
|
|
|
389
723
|
npm run ios # or npm run android
|
|
390
724
|
```
|
|
391
725
|
|
|
392
|
-
|
|
726
|
+
### Testing
|
|
727
|
+
|
|
728
|
+
```bash
|
|
729
|
+
npm test
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
### Linting
|
|
733
|
+
|
|
734
|
+
```bash
|
|
735
|
+
npm run lint
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
## 🚀 npm Publishing
|
|
393
739
|
|
|
394
|
-
###
|
|
740
|
+
### Prerequisites
|
|
395
741
|
|
|
396
|
-
-
|
|
397
|
-
- Node 18+
|
|
742
|
+
- npm account with publish rights for the `@transfergratis/react-native-sdk` package
|
|
743
|
+
- Node 18+ and npm 9+
|
|
398
744
|
|
|
399
|
-
###
|
|
745
|
+
### Release Steps
|
|
400
746
|
|
|
401
|
-
1
|
|
747
|
+
1. **Install and clean**
|
|
402
748
|
|
|
403
749
|
```bash
|
|
404
750
|
cd transfergratis-sdk
|
|
@@ -406,13 +752,13 @@ npm ci
|
|
|
406
752
|
npm run clean
|
|
407
753
|
```
|
|
408
754
|
|
|
409
|
-
2
|
|
755
|
+
2. **Build the SDK**
|
|
410
756
|
|
|
411
757
|
```bash
|
|
412
758
|
npm run build
|
|
413
759
|
```
|
|
414
760
|
|
|
415
|
-
3
|
|
761
|
+
3. **Verify content to be published**
|
|
416
762
|
|
|
417
763
|
```bash
|
|
418
764
|
npm publish --dry-run
|
|
@@ -420,98 +766,85 @@ npm pack
|
|
|
420
766
|
tar -tf transfergratis-react-native-sdk-*.tgz | cat
|
|
421
767
|
```
|
|
422
768
|
|
|
423
|
-
4
|
|
769
|
+
4. **Bump version**
|
|
424
770
|
|
|
425
771
|
```bash
|
|
426
772
|
# patch | minor | major | prerelease
|
|
427
773
|
npm version patch -m "release: %s"
|
|
428
774
|
```
|
|
429
775
|
|
|
430
|
-
5
|
|
776
|
+
5. **npm login (if needed)**
|
|
431
777
|
|
|
432
778
|
```bash
|
|
433
779
|
npm whoami || npm login
|
|
434
780
|
```
|
|
435
781
|
|
|
436
|
-
6
|
|
782
|
+
6. **Publish to npm (public)**
|
|
437
783
|
|
|
438
784
|
```bash
|
|
439
785
|
npm publish --access public
|
|
440
786
|
```
|
|
441
787
|
|
|
442
|
-
-
|
|
788
|
+
- With 2FA:
|
|
443
789
|
|
|
444
790
|
```bash
|
|
445
791
|
npm publish --access public --otp=123456
|
|
446
792
|
```
|
|
447
793
|
|
|
448
|
-
-
|
|
794
|
+
- Publish a pre-release (beta tag):
|
|
449
795
|
|
|
450
796
|
```bash
|
|
451
797
|
npm publish --tag beta --access public
|
|
452
798
|
```
|
|
453
799
|
|
|
454
|
-
7
|
|
800
|
+
7. **Push git tags**
|
|
455
801
|
|
|
456
802
|
```bash
|
|
457
803
|
git push && git push --tags
|
|
458
804
|
```
|
|
459
805
|
|
|
460
|
-
8
|
|
806
|
+
8. **Verify published version**
|
|
461
807
|
|
|
462
808
|
```bash
|
|
463
809
|
npm info @transfergratis/react-native-sdk version
|
|
464
810
|
```
|
|
465
811
|
|
|
466
|
-
## 📝
|
|
812
|
+
## 📝 Supported Document Types
|
|
467
813
|
|
|
468
|
-
|
|
814
|
+
The SDK supports several government document types:
|
|
469
815
|
|
|
470
|
-
|
|
816
|
+
- `identity_card` - Identity card
|
|
817
|
+
- `passport` - Passport
|
|
818
|
+
- `drivers_licence` - Driver's license
|
|
819
|
+
- `health_insurance_card` - Health insurance card
|
|
820
|
+
- `permanent_residence` - Permanent residence permit
|
|
821
|
+
- `national_id` - National ID card
|
|
822
|
+
- `work_permit` - Work permit
|
|
471
823
|
|
|
472
|
-
|
|
473
|
-
// Old (Legacy)
|
|
474
|
-
import { NativeCameraView } from 'transfergratis-sdk';
|
|
475
|
-
|
|
476
|
-
<NativeCameraView
|
|
477
|
-
instructions="Take a photo"
|
|
478
|
-
showCamera={true}
|
|
479
|
-
onCapture={(event) => {
|
|
480
|
-
if (event.action === 'capture') {
|
|
481
|
-
console.log(event.imagePath);
|
|
482
|
-
}
|
|
483
|
-
}}
|
|
484
|
-
/>
|
|
824
|
+
## 🌍 Multilingual Support
|
|
485
825
|
|
|
486
|
-
|
|
487
|
-
import { EnhancedCameraView } from 'transfergratis-sdk';
|
|
488
|
-
|
|
489
|
-
<EnhancedCameraView
|
|
490
|
-
instructions="Take a photo"
|
|
491
|
-
showCamera={true}
|
|
492
|
-
onCapture={(result) => {
|
|
493
|
-
if (result.success) {
|
|
494
|
-
console.log(result.path);
|
|
495
|
-
}
|
|
496
|
-
}}
|
|
497
|
-
/>
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
### Module Changes
|
|
826
|
+
The SDK currently supports French and English. Texts can be customized via the JSON template system using `LocalizedText` objects:
|
|
501
827
|
|
|
502
828
|
```tsx
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
const hasPermissions = await VisionCameraModule.requestAllPermissions();
|
|
829
|
+
{
|
|
830
|
+
labels: {
|
|
831
|
+
en: "Upload your ID card",
|
|
832
|
+
fr: "Téléversez votre carte d'identité"
|
|
833
|
+
}
|
|
834
|
+
}
|
|
510
835
|
```
|
|
511
836
|
|
|
512
837
|
## 🚨 Breaking Changes
|
|
513
838
|
|
|
514
|
-
###
|
|
839
|
+
### v0.1.10
|
|
840
|
+
|
|
841
|
+
- **JSON Template System**: New JSON-based configuration system
|
|
842
|
+
- **Specialized KYC Components**: New components for each KYC flow step
|
|
843
|
+
- **Web Support**: Added support for web applications
|
|
844
|
+
- **Liveness Detection Improvements**: Enhanced orientation video processing
|
|
845
|
+
- **Multilingual Support**: Improved support for multiple languages
|
|
846
|
+
|
|
847
|
+
### v0.1.0
|
|
515
848
|
|
|
516
849
|
- **Camera Implementation**: Switched from custom native views to react-native-vision-camera
|
|
517
850
|
- **Permissions**: Now requires both camera and microphone permissions
|
|
@@ -534,6 +867,12 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
534
867
|
|
|
535
868
|
For support, email support@transfergratis.com or open an issue on GitHub.
|
|
536
869
|
|
|
870
|
+
## 📚 Additional Resources
|
|
871
|
+
|
|
872
|
+
- [Vision Camera Documentation](https://react-native-vision-camera.com/)
|
|
873
|
+
- [Expo Documentation](https://docs.expo.dev/)
|
|
874
|
+
- [GitHub Repository](https://github.com/TransfergratisOrg/KYC-User-Frontend)
|
|
875
|
+
|
|
537
876
|
---
|
|
538
877
|
|
|
539
878
|
Built with ❤️ by the TransferGratis Team
|