@transfergratis/react-native-sdk 0.1.23 → 0.1.25
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/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +12 -5
- package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
- package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +61 -59
- package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +12 -5
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +26 -34
- package/android/src/main/AndroidManifest.xml +13 -5
- package/build/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.js +26 -3
- package/build/components/EnhancedCameraView.js.map +1 -1
- package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.web.js +21 -0
- package/build/components/EnhancedCameraView.web.js.map +1 -1
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts +12 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js +283 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js.map +1 -0
- package/build/components/KYCElements/CameraCapture.d.ts.map +1 -1
- package/build/components/KYCElements/CameraCapture.js +4 -3
- package/build/components/KYCElements/CameraCapture.js.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts +5 -2
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.js +360 -101
- package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js +193 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/FileUpload.d.ts.map +1 -1
- package/build/components/KYCElements/FileUpload.js +5 -4
- package/build/components/KYCElements/FileUpload.js.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.js +5 -4
- package/build/components/KYCElements/FileUploadTemplate.js.map +1 -1
- package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/components/KYCElements/IDCardCapture.js +356 -227
- package/build/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.js +78 -37
- package/build/components/KYCElements/LocationCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.js +5 -4
- package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js +120 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js +185 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/SelfieCapture.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCapture.js +4 -3
- package/build/components/KYCElements/SelfieCapture.js.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.js +189 -42
- package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/WelcomeTemplate.d.ts +12 -0
- package/build/components/KYCElements/WelcomeTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/WelcomeTemplate.js +243 -0
- package/build/components/KYCElements/WelcomeTemplate.js.map +1 -0
- package/build/components/TemplateKYCExample.d.ts +8 -2
- package/build/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/components/TemplateKYCExample.js +10 -97
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts +6 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.js +108 -11
- package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
- package/build/components/example/DynamicTemplateExample.d.ts +10 -0
- package/build/components/example/DynamicTemplateExample.d.ts.map +1 -0
- package/build/components/example/DynamicTemplateExample.js +241 -0
- package/build/components/example/DynamicTemplateExample.js.map +1 -0
- package/build/config/KYCConfig.d.ts +14 -0
- package/build/config/KYCConfig.d.ts.map +1 -0
- package/build/config/KYCConfig.js +26 -0
- package/build/config/KYCConfig.js.map +1 -0
- package/build/config/allowedDomains.d.ts +30 -0
- package/build/config/allowedDomains.d.ts.map +1 -0
- package/build/config/allowedDomains.js +112 -0
- package/build/config/allowedDomains.js.map +1 -0
- package/build/hooks/useOrientationVideo.d.ts +2 -1
- package/build/hooks/useOrientationVideo.d.ts.map +1 -1
- package/build/hooks/useOrientationVideo.js +3 -3
- package/build/hooks/useOrientationVideo.js.map +1 -1
- package/build/hooks/useTemplateKYCFlow.d.ts +6 -1
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +317 -34
- package/build/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/hooks/useTemplateLoader.d.ts +14 -0
- package/build/hooks/useTemplateLoader.d.ts.map +1 -0
- package/build/hooks/useTemplateLoader.js +85 -0
- package/build/hooks/useTemplateLoader.js.map +1 -0
- package/build/i18n/en/index.d.ts +49 -0
- package/build/i18n/en/index.d.ts.map +1 -1
- package/build/i18n/en/index.js +50 -1
- package/build/i18n/en/index.js.map +1 -1
- package/build/i18n/fr/index.d.ts +35 -0
- package/build/i18n/fr/index.d.ts.map +1 -1
- package/build/i18n/fr/index.js +36 -1
- package/build/i18n/fr/index.js.map +1 -1
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10 -0
- package/build/index.js.map +1 -1
- package/build/modules/api/CardAuthentification.d.ts +24 -3
- package/build/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/modules/api/CardAuthentification.js +69 -10
- package/build/modules/api/CardAuthentification.js.map +1 -1
- package/build/modules/api/KYCService.d.ts +7 -7
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +108 -39
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/api/SelfieVerification.d.ts +3 -1
- package/build/modules/api/SelfieVerification.d.ts.map +1 -1
- package/build/modules/api/SelfieVerification.js +17 -1
- package/build/modules/api/SelfieVerification.js.map +1 -1
- package/build/modules/api/TemplateService.d.ts +44 -0
- package/build/modules/api/TemplateService.d.ts.map +1 -0
- package/build/modules/api/TemplateService.js +145 -0
- package/build/modules/api/TemplateService.js.map +1 -0
- package/build/types/KYC.types.d.ts +265 -4
- package/build/types/KYC.types.d.ts.map +1 -1
- package/build/types/KYC.types.js +15 -0
- package/build/types/KYC.types.js.map +1 -1
- package/build/types/env.types.d.ts +13 -0
- package/build/types/env.types.d.ts.map +1 -0
- package/build/types/env.types.js +2 -0
- package/build/types/env.types.js.map +1 -0
- package/build/utils/cropByObb.d.ts +1 -0
- package/build/utils/cropByObb.d.ts.map +1 -1
- package/build/utils/cropByObb.js +70 -0
- package/build/utils/cropByObb.js.map +1 -1
- package/build/utils/deviceDetection.d.ts +6 -0
- package/build/utils/deviceDetection.d.ts.map +1 -0
- package/build/utils/deviceDetection.js +12 -0
- package/build/utils/deviceDetection.js.map +1 -0
- package/build/utils/platformAlert.d.ts +20 -0
- package/build/utils/platformAlert.d.ts.map +1 -0
- package/build/utils/platformAlert.js +67 -0
- package/build/utils/platformAlert.js.map +1 -0
- package/build/utils/template-transformer.d.ts +10 -0
- package/build/utils/template-transformer.d.ts.map +1 -0
- package/build/utils/template-transformer.js +365 -0
- package/build/utils/template-transformer.js.map +1 -0
- package/build/web/WebKYCEntry.d.ts.map +1 -1
- package/build/web/WebKYCEntry.js +158 -32
- package/build/web/WebKYCEntry.js.map +1 -1
- package/package.json +1 -1
- package/plugin/build/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.ts +3 -4
- package/src/components/EnhancedCameraView.tsx +31 -2
- package/src/components/EnhancedCameraView.web.tsx +24 -0
- package/src/components/KYCElements/AdditionalDocumentsTemplate.tsx +346 -0
- package/src/components/KYCElements/CameraCapture.tsx +4 -3
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +410 -113
- package/src/components/KYCElements/EmailVerificationTemplate.tsx +264 -0
- package/src/components/KYCElements/FileUpload.tsx +5 -4
- package/src/components/KYCElements/FileUploadTemplate.tsx +5 -4
- package/src/components/KYCElements/IDCardCapture.tsx +397 -254
- package/src/components/KYCElements/LocationCaptureTemplate.tsx +95 -44
- package/src/components/KYCElements/OrientationVideoCapture.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +6 -3
- package/src/components/KYCElements/PersonalInformationTemplate.tsx +158 -0
- package/src/components/KYCElements/PhoneVerificationTemplate.tsx +253 -0
- package/src/components/KYCElements/SelfieCapture.tsx +4 -3
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +201 -44
- package/src/components/KYCElements/WelcomeTemplate.tsx +289 -0
- package/src/components/TemplateKYCExample.tsx +37 -108
- package/src/components/TemplateKYCFlowRefactored.tsx +148 -12
- package/src/components/example/DynamicTemplateExample.tsx +289 -0
- package/src/config/KYCConfig.ts +34 -0
- package/src/config/allowedDomains.ts +133 -0
- package/src/hooks/useOrientationVideo.ts +5 -4
- package/src/hooks/useTemplateKYCFlow.tsx +347 -32
- package/src/hooks/useTemplateLoader.ts +102 -0
- package/src/i18n/en/index.ts +53 -2
- package/src/i18n/fr/index.ts +37 -1
- package/src/index.ts +14 -0
- package/src/modules/api/CardAuthentification.ts +76 -11
- package/src/modules/api/KYCService.ts +129 -45
- package/src/modules/api/SelfieVerification.ts +25 -3
- package/src/modules/api/TemplateService.ts +167 -0
- package/src/types/KYC.types.ts +331 -3
- package/src/types/env.types.ts +13 -0
- package/src/utils/cropByObb.ts +83 -3
- package/src/utils/deviceDetection.ts +11 -0
- package/src/utils/platformAlert.ts +86 -0
- package/src/utils/template-transformer.ts +445 -0
- package/src/web/WebKYCEntry.tsx +199 -50
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { View, Text, StyleSheet,
|
|
2
|
+
import { View, Text, StyleSheet, Platform } from 'react-native';
|
|
3
3
|
import { LocationConfig, TemplateComponent } from '../../types/KYC.types';
|
|
4
4
|
import ShieldIcon from '../Svgs/Schield';
|
|
5
5
|
import GpsIcon from '../Svgs/GpsIcon';
|
|
@@ -7,6 +7,7 @@ import { Button } from '../ui/Button';
|
|
|
7
7
|
import * as Location from 'expo-location';
|
|
8
8
|
import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
|
|
9
9
|
import { useI18n } from '../../hooks/useI18n';
|
|
10
|
+
import { showAlert } from '../../utils/platformAlert';
|
|
10
11
|
|
|
11
12
|
interface LocationCaptureTemplateProps {
|
|
12
13
|
component: TemplateComponent;
|
|
@@ -31,6 +32,12 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
|
|
|
31
32
|
|
|
32
33
|
const requestLocationPermission = async (): Promise<boolean> => {
|
|
33
34
|
try {
|
|
35
|
+
// On web, use browser's geolocation API directly
|
|
36
|
+
if (Platform.OS === 'web') {
|
|
37
|
+
return await requestWebGeolocationPermission();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// On native, use expo-location
|
|
34
41
|
const { status } = await Location.requestForegroundPermissionsAsync();
|
|
35
42
|
return status === 'granted';
|
|
36
43
|
} catch (err) {
|
|
@@ -39,13 +46,42 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
|
|
|
39
46
|
}
|
|
40
47
|
};
|
|
41
48
|
|
|
49
|
+
const requestWebGeolocationPermission = async (): Promise<boolean> => {
|
|
50
|
+
if (!navigator.geolocation) {
|
|
51
|
+
console.error('Geolocation is not supported by this browser');
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
// Check if permission API is available
|
|
57
|
+
if ('permissions' in navigator) {
|
|
58
|
+
const result = await navigator.permissions.query({ name: 'geolocation' as PermissionName });
|
|
59
|
+
return result.state === 'granted' || result.state === 'prompt';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Fallback: assume we can request permission
|
|
63
|
+
return true;
|
|
64
|
+
} catch (err) {
|
|
65
|
+
console.warn('Could not check geolocation permission:', err);
|
|
66
|
+
// Assume we can try to request
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
42
71
|
const getCurrentLocation = async () => {
|
|
43
72
|
try {
|
|
44
73
|
setIsRequesting(true);
|
|
45
74
|
|
|
75
|
+
// Web platform: use browser geolocation API
|
|
76
|
+
if (Platform.OS === 'web') {
|
|
77
|
+
await getWebGeolocation();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Native platform: use expo-location
|
|
46
82
|
const hasLocationPermission = await requestLocationPermission();
|
|
47
83
|
if (!hasLocationPermission) {
|
|
48
|
-
|
|
84
|
+
showAlert(
|
|
49
85
|
t('kyc.locationCapture.permissionDeniedTitle'),
|
|
50
86
|
t('kyc.locationCapture.permissionDeniedMessage')
|
|
51
87
|
);
|
|
@@ -56,7 +92,7 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
|
|
|
56
92
|
// Vérifier si la localisation est activée
|
|
57
93
|
const isLocationEnabled = await Location.hasServicesEnabledAsync();
|
|
58
94
|
if (!isLocationEnabled) {
|
|
59
|
-
|
|
95
|
+
showAlert(
|
|
60
96
|
t('kyc.locationCapture.locationDisabledTitle'),
|
|
61
97
|
t('kyc.locationCapture.locationDisabledMessage')
|
|
62
98
|
);
|
|
@@ -83,15 +119,66 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
|
|
|
83
119
|
|
|
84
120
|
} catch (error) {
|
|
85
121
|
console.error('Erreur lors de la récupération de la localisation:', error);
|
|
86
|
-
|
|
122
|
+
showAlert(t('kyc.locationCapture.errorTitle'), t('kyc.locationCapture.errorMessage'));
|
|
87
123
|
} finally {
|
|
88
124
|
setIsRequesting(false);
|
|
89
125
|
}
|
|
90
126
|
};
|
|
91
127
|
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
128
|
+
const getWebGeolocation = async () => {
|
|
129
|
+
return new Promise<void>((resolve, reject) => {
|
|
130
|
+
if (!navigator.geolocation) {
|
|
131
|
+
showAlert(
|
|
132
|
+
t('kyc.locationCapture.errorTitle'),
|
|
133
|
+
'Geolocation is not supported by your browser. Please use a modern browser or enable location services.'
|
|
134
|
+
);
|
|
135
|
+
reject(new Error('Geolocation not supported'));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const options: PositionOptions = {
|
|
140
|
+
enableHighAccuracy: config.accuracy === 'high',
|
|
141
|
+
timeout: 10000,
|
|
142
|
+
maximumAge: 0,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
navigator.geolocation.getCurrentPosition(
|
|
146
|
+
(position) => {
|
|
147
|
+
const locationData = {
|
|
148
|
+
latitude: position.coords.latitude,
|
|
149
|
+
longitude: position.coords.longitude,
|
|
150
|
+
accuracy: position.coords.accuracy,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
setCurrentLocation(locationData);
|
|
154
|
+
onValueChange(locationData);
|
|
155
|
+
resolve();
|
|
156
|
+
},
|
|
157
|
+
(error) => {
|
|
158
|
+
console.error('Geolocation error:', error);
|
|
159
|
+
|
|
160
|
+
let errorMessage = t('kyc.locationCapture.errorMessage');
|
|
161
|
+
|
|
162
|
+
switch (error.code) {
|
|
163
|
+
case error.PERMISSION_DENIED:
|
|
164
|
+
errorMessage = Platform.OS === 'web'
|
|
165
|
+
? 'Location permission denied. Please enable location access in your browser settings and try again.'
|
|
166
|
+
: t('kyc.locationCapture.permissionDeniedMessage');
|
|
167
|
+
break;
|
|
168
|
+
case error.POSITION_UNAVAILABLE:
|
|
169
|
+
errorMessage = 'Location information is unavailable. Please check your device settings.';
|
|
170
|
+
break;
|
|
171
|
+
case error.TIMEOUT:
|
|
172
|
+
errorMessage = 'Location request timed out. Please try again.';
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
showAlert(t('kyc.locationCapture.errorTitle'), errorMessage);
|
|
177
|
+
reject(error);
|
|
178
|
+
},
|
|
179
|
+
options
|
|
180
|
+
);
|
|
181
|
+
});
|
|
95
182
|
};
|
|
96
183
|
|
|
97
184
|
// Passer automatiquement à l'étape suivante quand la localisation est obtenue
|
|
@@ -135,26 +222,7 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
|
|
|
135
222
|
</Text>
|
|
136
223
|
</View>
|
|
137
224
|
|
|
138
|
-
{currentLocation
|
|
139
|
-
<View style={styles.locationInfo}>
|
|
140
|
-
<Text style={styles.locationTitle}>{t('kyc.locationCapture.obtained')}</Text>
|
|
141
|
-
<Text style={styles.locationDetails}>
|
|
142
|
-
{t('kyc.locationCapture.latitudeLabel')}: {currentLocation.latitude.toFixed(6)}
|
|
143
|
-
</Text>
|
|
144
|
-
<Text style={styles.locationDetails}>
|
|
145
|
-
{t('kyc.locationCapture.longitudeLabel')}: {currentLocation.longitude.toFixed(6)}
|
|
146
|
-
</Text>
|
|
147
|
-
<Text style={styles.locationDetails}>
|
|
148
|
-
{t('kyc.locationCapture.accuracyLabel')}: {currentLocation.accuracy.toFixed(1)}m
|
|
149
|
-
</Text>
|
|
150
|
-
<Button
|
|
151
|
-
title={t('kyc.locationCapture.resetButton')}
|
|
152
|
-
fullWidth
|
|
153
|
-
onPress={resetLocation}
|
|
154
|
-
style={{ paddingVertical: 20, marginTop: 24, backgroundColor: '#6B7280' }}
|
|
155
|
-
/>
|
|
156
|
-
</View>
|
|
157
|
-
) : (
|
|
225
|
+
{!currentLocation && (
|
|
158
226
|
<Button
|
|
159
227
|
title={isRequesting ? t('kyc.locationCapture.fetching') : t('kyc.locationCapture.enableButton')}
|
|
160
228
|
fullWidth
|
|
@@ -184,23 +252,6 @@ const styles = StyleSheet.create({
|
|
|
184
252
|
shadowOpacity: 0.15,
|
|
185
253
|
maxWidth: 760,
|
|
186
254
|
},
|
|
187
|
-
locationInfo: {
|
|
188
|
-
alignItems: 'center',
|
|
189
|
-
width: '100%',
|
|
190
|
-
marginTop: 24,
|
|
191
|
-
},
|
|
192
|
-
locationTitle: {
|
|
193
|
-
fontSize: 20,
|
|
194
|
-
fontWeight: '600',
|
|
195
|
-
color: '#2DBD60',
|
|
196
|
-
marginBottom: 16,
|
|
197
|
-
},
|
|
198
|
-
locationDetails: {
|
|
199
|
-
fontSize: 14,
|
|
200
|
-
color: '#666',
|
|
201
|
-
marginBottom: 4,
|
|
202
|
-
fontFamily: 'monospace',
|
|
203
|
-
},
|
|
204
255
|
title: {
|
|
205
256
|
fontSize: 24,
|
|
206
257
|
fontWeight: 'bold',
|
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
Text,
|
|
5
5
|
StyleSheet,
|
|
6
6
|
TouchableOpacity,
|
|
7
|
-
Alert,
|
|
8
7
|
ActivityIndicator,
|
|
9
8
|
Animated,
|
|
10
9
|
} from 'react-native';
|
|
10
|
+
import { showAlert } from '../../utils/platformAlert';
|
|
11
11
|
import Svg, { Rect, Path, Mask, Defs } from 'react-native-svg';
|
|
12
12
|
import { Camera, useCameraDevice } from 'react-native-vision-camera';
|
|
13
13
|
import { OrientationVideoConfig, OrientationVideoState } from '../../types/KYC.types';
|
|
14
|
+
import { KycEnvironment } from '../../types/env.types';
|
|
14
15
|
import kycService from '../../modules/api/KYCService';
|
|
15
16
|
import VisionCameraModule from '../../modules/camera/VisionCameraModule';
|
|
16
17
|
import SideSelfieIcon from '../Svgs/sideSelfieIcon';
|
|
@@ -20,6 +21,7 @@ interface OrientationVideoCaptureProps {
|
|
|
20
21
|
onComplete: (result: any) => void;
|
|
21
22
|
onError: (error: string) => void;
|
|
22
23
|
kycService: typeof kycService;
|
|
24
|
+
env?: KycEnvironment;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
const defaultConfig: OrientationVideoConfig = {
|
|
@@ -42,6 +44,7 @@ export const OrientationVideoCapture: React.FC<OrientationVideoCaptureProps> = (
|
|
|
42
44
|
onComplete,
|
|
43
45
|
onError,
|
|
44
46
|
kycService,
|
|
47
|
+
env = 'PRODUCTION',
|
|
45
48
|
}) => {
|
|
46
49
|
const finalConfig = { ...defaultConfig, ...config };
|
|
47
50
|
|
|
@@ -174,7 +177,7 @@ export const OrientationVideoCapture: React.FC<OrientationVideoCaptureProps> = (
|
|
|
174
177
|
setState(prev => ({ ...prev, isProcessing: true, error: null }));
|
|
175
178
|
|
|
176
179
|
try {
|
|
177
|
-
const result = await kycService.processOrientationVideo(videoUri);
|
|
180
|
+
const result = await kycService.processOrientationVideo(videoUri, env);
|
|
178
181
|
|
|
179
182
|
if (result.success && result.data) {
|
|
180
183
|
setState(prev => ({
|
|
@@ -204,7 +207,7 @@ export const OrientationVideoCapture: React.FC<OrientationVideoCaptureProps> = (
|
|
|
204
207
|
|
|
205
208
|
const retake = () => {
|
|
206
209
|
if (state.retakeCount >= finalConfig.maxRetakes) {
|
|
207
|
-
|
|
210
|
+
showAlert('Max Retakes Reached', 'You have reached the maximum number of retakes.');
|
|
208
211
|
return;
|
|
209
212
|
}
|
|
210
213
|
|
|
@@ -4,14 +4,15 @@ import {
|
|
|
4
4
|
Text,
|
|
5
5
|
StyleSheet,
|
|
6
6
|
TouchableOpacity,
|
|
7
|
-
Alert,
|
|
8
7
|
ActivityIndicator,
|
|
9
8
|
Animated,
|
|
10
9
|
Dimensions,
|
|
11
10
|
} from 'react-native';
|
|
11
|
+
import { showAlert } from '../../utils/platformAlert';
|
|
12
12
|
import Svg, { Rect, Path, Mask, Defs } from 'react-native-svg';
|
|
13
13
|
import { EnhancedCameraView } from '../EnhancedCameraView';
|
|
14
14
|
import { OrientationVideoConfig, OrientationVideoState } from '../../types/KYC.types';
|
|
15
|
+
import { KycEnvironment } from '../../types/env.types';
|
|
15
16
|
import kycService from '../../modules/api/KYCService';
|
|
16
17
|
import FrontSelfieIcon from '../Svgs/frontSelfieIcon';
|
|
17
18
|
import ScanningLine from '../Svgs/scanningLine';
|
|
@@ -21,6 +22,7 @@ interface OrientationVideoCaptureEnhancedProps {
|
|
|
21
22
|
onComplete: (result: any) => void;
|
|
22
23
|
onError: (error: string) => void;
|
|
23
24
|
kycService: typeof kycService;
|
|
25
|
+
env?: KycEnvironment;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
const defaultConfig: OrientationVideoConfig = {
|
|
@@ -43,6 +45,7 @@ export const OrientationVideoCaptureEnhanced: React.FC<OrientationVideoCaptureEn
|
|
|
43
45
|
onComplete,
|
|
44
46
|
onError,
|
|
45
47
|
kycService,
|
|
48
|
+
env = 'PRODUCTION',
|
|
46
49
|
}) => {
|
|
47
50
|
const finalConfig = { ...defaultConfig, ...config };
|
|
48
51
|
const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
|
|
@@ -153,7 +156,7 @@ export const OrientationVideoCaptureEnhanced: React.FC<OrientationVideoCaptureEn
|
|
|
153
156
|
setState(prev => ({ ...prev, isProcessing: true, error: null }));
|
|
154
157
|
|
|
155
158
|
try {
|
|
156
|
-
const result = await kycService.processOrientationVideo(videoUri);
|
|
159
|
+
const result = await kycService.processOrientationVideo(videoUri, env);
|
|
157
160
|
|
|
158
161
|
if (result.success && result.data) {
|
|
159
162
|
setState(prev => ({
|
|
@@ -183,7 +186,7 @@ export const OrientationVideoCaptureEnhanced: React.FC<OrientationVideoCaptureEn
|
|
|
183
186
|
|
|
184
187
|
const retake = () => {
|
|
185
188
|
if (state.retakeCount >= finalConfig.maxRetakes) {
|
|
186
|
-
|
|
189
|
+
showAlert('Max Retakes Reached', 'You have reached the maximum number of retakes.');
|
|
187
190
|
return;
|
|
188
191
|
}
|
|
189
192
|
|
|
@@ -4,13 +4,14 @@ import {
|
|
|
4
4
|
Text,
|
|
5
5
|
StyleSheet,
|
|
6
6
|
TouchableOpacity,
|
|
7
|
-
Alert,
|
|
8
7
|
ActivityIndicator,
|
|
9
8
|
Animated,
|
|
10
9
|
} from 'react-native';
|
|
10
|
+
import { showAlert } from '../../utils/platformAlert';
|
|
11
11
|
import Svg, { Rect, Path, Mask, Defs } from 'react-native-svg';
|
|
12
12
|
import { EnhancedCameraView } from '../EnhancedCameraView';
|
|
13
13
|
import { OrientationVideoConfig, OrientationVideoState } from '../../types/KYC.types';
|
|
14
|
+
import { KycEnvironment } from '../../types/env.types';
|
|
14
15
|
import SideSelfieIcon from '../Svgs/sideSelfieIcon';
|
|
15
16
|
import kycService from '../../modules/api/KYCService';
|
|
16
17
|
|
|
@@ -19,6 +20,7 @@ interface OrientationVideoCaptureFinalProps {
|
|
|
19
20
|
onComplete: (result: any) => void;
|
|
20
21
|
onError: (error: string) => void;
|
|
21
22
|
kycService: typeof kycService;
|
|
23
|
+
env?: KycEnvironment;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const defaultConfig: OrientationVideoConfig = {
|
|
@@ -41,6 +43,7 @@ export const OrientationVideoCaptureFinal: React.FC<OrientationVideoCaptureFinal
|
|
|
41
43
|
onComplete,
|
|
42
44
|
onError,
|
|
43
45
|
kycService,
|
|
46
|
+
env = 'PRODUCTION',
|
|
44
47
|
}) => {
|
|
45
48
|
const finalConfig = { ...defaultConfig, ...config };
|
|
46
49
|
|
|
@@ -127,7 +130,7 @@ export const OrientationVideoCaptureFinal: React.FC<OrientationVideoCaptureFinal
|
|
|
127
130
|
setState(prev => ({ ...prev, isProcessing: true, error: null }));
|
|
128
131
|
|
|
129
132
|
try {
|
|
130
|
-
const result = await kycService.processOrientationVideo(videoUri);
|
|
133
|
+
const result = await kycService.processOrientationVideo(videoUri, env);
|
|
131
134
|
|
|
132
135
|
if (result.success && result.data) {
|
|
133
136
|
setState(prev => ({
|
|
@@ -157,7 +160,7 @@ export const OrientationVideoCaptureFinal: React.FC<OrientationVideoCaptureFinal
|
|
|
157
160
|
|
|
158
161
|
const retake = () => {
|
|
159
162
|
if (state.retakeCount >= finalConfig.maxRetakes) {
|
|
160
|
-
|
|
163
|
+
showAlert('Max Retakes Reached', 'You have reached the maximum number of retakes.');
|
|
161
164
|
return;
|
|
162
165
|
}
|
|
163
166
|
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TextInput, KeyboardAvoidingView, Platform, ScrollView } from 'react-native';
|
|
3
|
+
import { TemplateComponent, PersonalInformationConfig, LocalizedText } from '../../types/KYC.types';
|
|
4
|
+
import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
|
|
5
|
+
import { useI18n } from '../../hooks/useI18n';
|
|
6
|
+
import { Button } from '../ui/Button';
|
|
7
|
+
|
|
8
|
+
interface PersonalInformationTemplateProps {
|
|
9
|
+
component: TemplateComponent;
|
|
10
|
+
value?: any;
|
|
11
|
+
onValueChange: (data: any) => void;
|
|
12
|
+
error?: string;
|
|
13
|
+
language?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const PersonalInformationTemplate: React.FC<PersonalInformationTemplateProps> = ({
|
|
17
|
+
component,
|
|
18
|
+
value,
|
|
19
|
+
onValueChange,
|
|
20
|
+
error,
|
|
21
|
+
}) => {
|
|
22
|
+
const { actions, getLocalizedText } = useTemplateKYCFlowContext();
|
|
23
|
+
const { t } = useI18n();
|
|
24
|
+
const config = component.config as PersonalInformationConfig;
|
|
25
|
+
const [formData, setFormData] = useState<Record<string, string>>({});
|
|
26
|
+
|
|
27
|
+
const title = getLocalizedText(component.labels as LocalizedText);
|
|
28
|
+
const instructions = getLocalizedText(component.instructions as LocalizedText);
|
|
29
|
+
const buttonText = getLocalizedText((component.ui as any).buttonText) || t('common.submit');
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (value) {
|
|
33
|
+
setFormData(value);
|
|
34
|
+
}
|
|
35
|
+
}, [value]);
|
|
36
|
+
|
|
37
|
+
const handleChange = (fieldId: string, text: string) => {
|
|
38
|
+
const newData = { ...formData, [fieldId]: text };
|
|
39
|
+
setFormData(newData);
|
|
40
|
+
onValueChange(newData);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const handleCreate = () => {
|
|
44
|
+
actions.nextComponent();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const isFormValid = () => {
|
|
48
|
+
if (!config.fields) return true;
|
|
49
|
+
return config.fields.every(field => {
|
|
50
|
+
if (field.required && !formData[field.id]) return false;
|
|
51
|
+
return true;
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<KeyboardAvoidingView
|
|
57
|
+
behavior={Platform.OS === "ios" ? "padding" : "height"}
|
|
58
|
+
style={styles.keyboardAvoidingView}
|
|
59
|
+
>
|
|
60
|
+
<ScrollView contentContainerStyle={styles.scrollContainer} showsVerticalScrollIndicator={false}>
|
|
61
|
+
<View style={styles.container}>
|
|
62
|
+
<Text style={styles.title}>{title}</Text>
|
|
63
|
+
<Text style={styles.instructions}>{instructions}</Text>
|
|
64
|
+
|
|
65
|
+
<View style={styles.formContainer}>
|
|
66
|
+
{config.fields && config.fields.map((field) => (
|
|
67
|
+
<View key={field.id} style={styles.fieldContainer}>
|
|
68
|
+
<Text style={styles.label}>
|
|
69
|
+
{field.label} {field.type === 'date' && field.dateFormat ? `(${field.dateFormat})` : ''} {field.required && '*'}
|
|
70
|
+
</Text>
|
|
71
|
+
<TextInput
|
|
72
|
+
style={styles.input}
|
|
73
|
+
placeholder={field.placeholder || field.label}
|
|
74
|
+
value={formData[field.id] || ''}
|
|
75
|
+
onChangeText={(text) => handleChange(field.id, text)}
|
|
76
|
+
autoCapitalize="words"
|
|
77
|
+
/>
|
|
78
|
+
</View>
|
|
79
|
+
))}
|
|
80
|
+
</View>
|
|
81
|
+
|
|
82
|
+
{error && <Text style={styles.errorText}>{error}</Text>}
|
|
83
|
+
|
|
84
|
+
<Button
|
|
85
|
+
title={buttonText}
|
|
86
|
+
onPress={handleCreate}
|
|
87
|
+
fullWidth
|
|
88
|
+
style={styles.button}
|
|
89
|
+
disabled={!isFormValid()}
|
|
90
|
+
/>
|
|
91
|
+
</View>
|
|
92
|
+
</ScrollView>
|
|
93
|
+
</KeyboardAvoidingView>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const styles = StyleSheet.create({
|
|
98
|
+
keyboardAvoidingView: {
|
|
99
|
+
flex: 1,
|
|
100
|
+
width: '100%',
|
|
101
|
+
},
|
|
102
|
+
scrollContainer: {
|
|
103
|
+
flexGrow: 1,
|
|
104
|
+
justifyContent: 'center',
|
|
105
|
+
paddingBottom: 20,
|
|
106
|
+
},
|
|
107
|
+
container: {
|
|
108
|
+
padding: 20,
|
|
109
|
+
backgroundColor: 'white',
|
|
110
|
+
borderRadius: 12,
|
|
111
|
+
margin: 16,
|
|
112
|
+
shadowColor: '#000',
|
|
113
|
+
shadowOffset: { width: 0, height: 2 },
|
|
114
|
+
shadowOpacity: 0.1,
|
|
115
|
+
shadowRadius: 4,
|
|
116
|
+
elevation: 3,
|
|
117
|
+
width: '95%',
|
|
118
|
+
},
|
|
119
|
+
title: {
|
|
120
|
+
fontSize: 22,
|
|
121
|
+
fontWeight: 'bold',
|
|
122
|
+
marginBottom: 10,
|
|
123
|
+
color: '#333',
|
|
124
|
+
},
|
|
125
|
+
instructions: {
|
|
126
|
+
fontSize: 16,
|
|
127
|
+
color: '#666',
|
|
128
|
+
marginBottom: 20,
|
|
129
|
+
lineHeight: 22,
|
|
130
|
+
},
|
|
131
|
+
formContainer: {
|
|
132
|
+
marginBottom: 20,
|
|
133
|
+
},
|
|
134
|
+
fieldContainer: {
|
|
135
|
+
marginBottom: 16,
|
|
136
|
+
},
|
|
137
|
+
label: {
|
|
138
|
+
fontSize: 14,
|
|
139
|
+
fontWeight: '600',
|
|
140
|
+
color: '#333',
|
|
141
|
+
marginBottom: 6,
|
|
142
|
+
},
|
|
143
|
+
input: {
|
|
144
|
+
borderWidth: 1,
|
|
145
|
+
borderColor: '#ddd',
|
|
146
|
+
padding: 12,
|
|
147
|
+
borderRadius: 8,
|
|
148
|
+
fontSize: 16,
|
|
149
|
+
backgroundColor: '#f9f9f9',
|
|
150
|
+
},
|
|
151
|
+
errorText: {
|
|
152
|
+
color: 'red',
|
|
153
|
+
marginBottom: 10,
|
|
154
|
+
},
|
|
155
|
+
button: {
|
|
156
|
+
marginTop: 10,
|
|
157
|
+
},
|
|
158
|
+
});
|