@transfergratis/react-native-sdk 0.1.8 → 0.1.10
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/compiled_local_resources/debug/compileDebugLibraryResources/out/xml_file_paths.xml.flat +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +2 -2
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +1 -1
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +25 -25
- 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/logs/manifest-merger-debug-report.txt +35 -35
- package/build/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.js +20 -7
- package/build/components/EnhancedCameraView.js.map +1 -1
- package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/components/KYCElements/IDCardCapture.js +63 -21
- package/build/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/components/KYCElements/ReviewSubmitTemplate.js +1 -1
- package/build/components/KYCElements/ReviewSubmitTemplate.js.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.js +1 -0
- package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/VerificationProgressTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/VerificationProgressTemplate.js +10 -9
- package/build/components/KYCElements/VerificationProgressTemplate.js.map +1 -1
- package/build/components/OverLay/IdCard.js +3 -3
- package/build/components/OverLay/IdCard.js.map +1 -1
- package/build/components/OverLay/StepOverlay.d.ts.map +1 -1
- package/build/components/OverLay/StepOverlay.js +3 -1
- package/build/components/OverLay/StepOverlay.js.map +1 -1
- package/build/components/OverLay/type.d.ts +5 -0
- package/build/components/OverLay/type.d.ts.map +1 -1
- package/build/components/OverLay/type.js.map +1 -1
- package/build/components/TemplateKYCExample.js +2 -2
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/config/countriesData.d.ts.map +1 -1
- package/build/config/countriesData.js +1 -0
- package/build/config/countriesData.js.map +1 -1
- package/build/config/region_mapping.d.ts.map +1 -1
- package/build/config/region_mapping.js +98 -49
- package/build/config/region_mapping.js.map +1 -1
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +7 -6
- package/build/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/i18n/en/index.d.ts +6 -0
- package/build/i18n/en/index.d.ts.map +1 -1
- package/build/i18n/en/index.js +7 -1
- package/build/i18n/en/index.js.map +1 -1
- package/build/i18n/fr/index.d.ts +6 -0
- package/build/i18n/fr/index.d.ts.map +1 -1
- package/build/i18n/fr/index.js +7 -1
- package/build/i18n/fr/index.js.map +1 -1
- package/build/modules/api/CardAuthentification.d.ts +23 -2
- package/build/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/modules/api/CardAuthentification.js +45 -16
- package/build/modules/api/CardAuthentification.js.map +1 -1
- package/build/modules/api/KYCService.d.ts +9 -0
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +52 -29
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/camera/VisionCameraModule.d.ts.map +1 -1
- package/build/modules/camera/VisionCameraModule.js +2 -1
- package/build/modules/camera/VisionCameraModule.js.map +1 -1
- package/build/types/KYC.types.d.ts +3 -0
- package/build/types/KYC.types.d.ts.map +1 -1
- package/build/types/KYC.types.js.map +1 -1
- package/build/utils/logger.d.ts +12 -0
- package/build/utils/logger.d.ts.map +1 -0
- package/build/utils/logger.js +45 -0
- package/build/utils/logger.js.map +1 -0
- package/package.json +1 -1
- package/src/components/EnhancedCameraView.tsx +23 -9
- package/src/components/KYCElements/IDCardCapture.tsx +75 -25
- package/src/components/KYCElements/ReviewSubmitTemplate.tsx +1 -1
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +1 -0
- package/src/components/KYCElements/VerificationProgressTemplate.tsx +10 -9
- package/src/components/OverLay/IdCard.tsx +3 -3
- package/src/components/OverLay/StepOverlay.tsx +3 -1
- package/src/components/OverLay/type.ts +15 -9
- package/src/components/TemplateKYCExample.tsx +2 -2
- package/src/config/countriesData.ts +1 -0
- package/src/config/region_mapping.json +735 -0
- package/src/config/region_mapping.ts +98 -49
- package/src/hooks/useTemplateKYCFlow.tsx +7 -6
- package/src/i18n/en/index.ts +7 -1
- package/src/i18n/fr/index.ts +9 -2
- package/src/modules/api/CardAuthentification.ts +64 -30
- package/src/modules/api/KYCService.ts +57 -32
- package/src/modules/camera/VisionCameraModule.ts +2 -1
- package/src/types/KYC.types.ts +3 -0
- package/src/utils/logger.ts +48 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/config.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/caches/deviceStreaming.xml +0 -860
- package/android/.idea/gradle.xml +0 -14
- package/android/.idea/migrations.xml +0 -10
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/runConfigurations.xml +0 -17
- package/android/.idea/vcs.xml +0 -6
- 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-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
- package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
- package/android/local.properties +0 -8
- /package/android/build/.transforms/{01c28d00c798aa4846f16ce72123ebf9 → 5623d2d87812f07e4b485399524916d6}/results.bin +0 -0
- /package/android/build/.transforms/{01c28d00c798aa4846f16ce72123ebf9 → 5623d2d87812f07e4b485399524916d6}/transformed/classes/classes_dex/classes.dex +0 -0
|
@@ -7,11 +7,12 @@ import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
|
|
|
7
7
|
import { useI18n } from '../../hooks/useI18n';
|
|
8
8
|
import { Button } from '../ui/Button';
|
|
9
9
|
import { removeDuplicates } from '../../utils/remove-duplicate';
|
|
10
|
-
import { backVerification, frontVerification } from '../../modules/api/CardAuthentification';
|
|
10
|
+
import { backVerification, checkTemplateType, frontVerification } from '../../modules/api/CardAuthentification';
|
|
11
11
|
import { getDocumentTypeInfo } from '../../utils/get-document-type-info';
|
|
12
12
|
import pathToBase64 from '../../utils/pathToBase64';
|
|
13
|
-
import
|
|
13
|
+
import { truncateFields } from '../../modules/api/KYCService';
|
|
14
14
|
import { cropImageWithBBox } from '../../utils/cropByObb';
|
|
15
|
+
import { logger } from '../../utils/logger';
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
interface IIDCardPayload {
|
|
@@ -36,7 +37,7 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
36
37
|
error,
|
|
37
38
|
language = 'en',
|
|
38
39
|
}) => {
|
|
39
|
-
const { t } = useI18n();
|
|
40
|
+
const { t , locale} = useI18n();
|
|
40
41
|
const [showCamera, setShowCamera] = useState(false);
|
|
41
42
|
const [capturedImages, setCapturedImages] = useState<Record<string, IIDCardPayload>>(value || {});
|
|
42
43
|
const [cropImageUri, setCropImageUri] = useState<string>('');
|
|
@@ -60,12 +61,12 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
60
61
|
const { actions, state, } = useTemplateKYCFlowContext();
|
|
61
62
|
const config = component.config as IDCardConfig;
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
|
|
64
65
|
|
|
65
66
|
const getLocalizedText = (text: LocalizedText | Record<string, LocalizedText>): string => {
|
|
66
67
|
// console.log("text", text, JSON.stringify(component, null, 2));
|
|
67
|
-
if (text && typeof text[currentSide] === 'object' && text[currentSide][
|
|
68
|
-
return text[currentSide][
|
|
68
|
+
if (text && typeof text[currentSide] === 'object' && text[currentSide][locale]) {
|
|
69
|
+
return text[currentSide][locale] || '';
|
|
69
70
|
}
|
|
70
71
|
return "";
|
|
71
72
|
};
|
|
@@ -92,13 +93,13 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
+
logger.log("newconfig", truncateFields(newconfig));
|
|
96
97
|
return newconfig;
|
|
97
98
|
}, []);
|
|
98
99
|
|
|
99
100
|
|
|
100
101
|
useEffect(() => {
|
|
101
|
-
|
|
102
|
+
logger.log("cropImageUri", JSON.stringify(truncateFields({ box: silentCaptureResult }), null, 2));
|
|
102
103
|
if (capturedImages[currentSide]?.dir && silentCaptureResult?.bbox) {
|
|
103
104
|
cropImageWithBBox(capturedImages[currentSide].dir, silentCaptureResult.bbox)?.then((uri) => {
|
|
104
105
|
setCropImageUri(uri);
|
|
@@ -117,7 +118,7 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
117
118
|
maxRetakes: 3,
|
|
118
119
|
overlay: {
|
|
119
120
|
showGuide: true,
|
|
120
|
-
guideText: selectedDocumentType ? getDocumentTypeInfo(selectedDocumentType.type).instructions.en : getLocalizedText(component.instructions as Record<string, LocalizedText>),
|
|
121
|
+
guideText: selectedDocumentType ? (locale === 'en' ? getDocumentTypeInfo(selectedDocumentType.type).instructions.en : getDocumentTypeInfo(selectedDocumentType.type).instructions.fr) : getLocalizedText(component.instructions as Record<string, LocalizedText>),
|
|
121
122
|
bbox: selectedDocumentType && config.bbox_configs[selectedDocumentType.type] ? config.bbox_configs[selectedDocumentType.type] : {
|
|
122
123
|
xMin: 20,
|
|
123
124
|
yMin: 140,
|
|
@@ -158,6 +159,7 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
158
159
|
const getCurrentSideVerification = (currentSide: string) => {
|
|
159
160
|
const regionMapping = countryData?.regionMapping[selectedDocumentType?.type as GovernmentDocumentType];
|
|
160
161
|
const authMethod: string[] = [];
|
|
162
|
+
const mrzTypes: string[] = [];
|
|
161
163
|
|
|
162
164
|
const key = selectedDocumentType?.region?.trim()?.length > 0 ? selectedDocumentType?.region?.trim() : 'root';
|
|
163
165
|
// console.log("regionMapping", JSON.stringify(regionMapping, null, 2), selectedDocumentType?.region);
|
|
@@ -167,44 +169,80 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
167
169
|
regionMapping[key].forEach((item: any) => {
|
|
168
170
|
if (item[currentSide as keyof typeof item]) {
|
|
169
171
|
authMethod.push(item[currentSide as keyof typeof item]);
|
|
172
|
+
if (item?.mrz_type) {
|
|
173
|
+
mrzTypes.push(item?.mrz_type);
|
|
174
|
+
}
|
|
170
175
|
}
|
|
171
176
|
});
|
|
172
177
|
}
|
|
173
178
|
|
|
174
|
-
|
|
179
|
+
logger.log("regionMapping", JSON.stringify(truncateFields({ regionMapping, selectedDocumentType: selectedDocumentType?.region, key }), null, 2));
|
|
175
180
|
|
|
176
|
-
return removeDuplicates(authMethod);
|
|
181
|
+
return { authMethod: removeDuplicates(authMethod), mrzTypes: removeDuplicates(mrzTypes), regionMapping: regionMapping, key: key };
|
|
177
182
|
}
|
|
178
183
|
|
|
184
|
+
const getCorrespondingMrzType = (templatePath: string, mapping: any, selectedDocumentType: string = "root") => {
|
|
185
|
+
if (!mapping[selectedDocumentType]) return null;
|
|
186
|
+
|
|
187
|
+
// Extraire le nom du fichier depuis le template_path
|
|
188
|
+
const fileName = templatePath.split("/").pop()?.replace(".jpg", "").replace(".png", "");
|
|
189
|
+
|
|
190
|
+
if (!fileName) return null;
|
|
191
|
+
|
|
192
|
+
// Normaliser en .py
|
|
193
|
+
const pyName = `${fileName}.py`; // ex: cameroon_id_back_3_1.py
|
|
194
|
+
|
|
195
|
+
// Chercher dans la liste
|
|
196
|
+
const found = mapping[selectedDocumentType].find((item: any) => item.py_file === pyName);
|
|
197
|
+
|
|
198
|
+
return found?.mrz_type || null;
|
|
199
|
+
}
|
|
179
200
|
|
|
180
|
-
const handleSilentCapture = (result: { success: boolean; path?: string; error?: string }) => {
|
|
201
|
+
const handleSilentCapture = async (result: { success: boolean; path?: string; error?: string }) => {
|
|
181
202
|
if (silentCaptureResult.isAnalyzing) {
|
|
182
203
|
return;
|
|
183
204
|
}
|
|
184
205
|
if (result.success && result.path) {
|
|
185
206
|
setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: true, success: false, error: '' }));
|
|
207
|
+
let templatePath = silentCaptureResult.templatePath || '';
|
|
208
|
+
|
|
209
|
+
const regionMappings = getCurrentSideVerification(currentSide)
|
|
210
|
+
// logger.log("regionMappings", JSON.stringify(truncateFields({regionMappings, templatePath}), null, 2));
|
|
211
|
+
if (regionMappings.authMethod.includes('MRZ') && templatePath.length === 0) {
|
|
212
|
+
const templateType = await checkTemplateType({ path: result.path || '', docType: selectedDocumentType?.type as GovernmentDocumentType, docRegion: countryData?.code || "", postfix: currentSide });
|
|
213
|
+
|
|
214
|
+
if (templateType.template_path) {
|
|
215
|
+
templatePath = templateType.template_path;
|
|
216
|
+
logger.log("templatePath", templatePath);
|
|
217
|
+
setSilentCaptureResult((prev) => ({ ...prev, templatePath: templatePath }));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
186
220
|
if (currentSide === 'front') {
|
|
221
|
+
|
|
187
222
|
frontVerification(
|
|
188
223
|
{
|
|
189
224
|
path: result.path,
|
|
190
|
-
regionMapping:
|
|
225
|
+
regionMapping: regionMappings,
|
|
191
226
|
selectedDocumentType: selectedDocumentType?.type || '',
|
|
192
227
|
code: countryData?.code || '',
|
|
193
228
|
currentSide: currentSide,
|
|
194
|
-
|
|
229
|
+
templatePath: templatePath,
|
|
230
|
+
mrzType: getCorrespondingMrzType(templatePath, regionMappings.regionMapping, regionMappings.key || '') || '',
|
|
195
231
|
}).then((mrz) => {
|
|
196
|
-
|
|
232
|
+
logger.log("front verification result", truncateFields(mrz));
|
|
197
233
|
setSilentCaptureResult((prev) => ({
|
|
198
234
|
...prev, path: result.path,
|
|
199
235
|
bbox: (mrz as any)?.bbox, success: true,
|
|
200
236
|
mrz: JSON.stringify(mrz), isAnalyzing: false,
|
|
201
237
|
country: countryData?.code,
|
|
202
|
-
documentType: selectedDocumentType?.type
|
|
238
|
+
documentType: selectedDocumentType?.type,
|
|
239
|
+
templatePath: "",
|
|
203
240
|
}),
|
|
204
241
|
);
|
|
242
|
+
|
|
205
243
|
}).catch((e: any) => {
|
|
206
|
-
|
|
207
|
-
setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: e?.message || 'Erreur de détection du MRZ' }));
|
|
244
|
+
logger.log("error front verification", truncateFields(e));
|
|
245
|
+
setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, templatePath: templatePath, success: false, error: e?.message || 'Erreur de détection du MRZ' }));
|
|
208
246
|
// Alert.alert('Erreur', e?.message || 'Erreur de détection du MRZ');
|
|
209
247
|
})
|
|
210
248
|
} else {
|
|
@@ -214,18 +252,20 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
214
252
|
selectedDocumentType: selectedDocumentType?.type || '',
|
|
215
253
|
code: countryData?.code || '',
|
|
216
254
|
currentSide: currentSide,
|
|
217
|
-
|
|
255
|
+
templatePath: templatePath,
|
|
256
|
+
mrzType: getCorrespondingMrzType(templatePath, regionMappings.regionMapping, regionMappings.key || '') || '',
|
|
218
257
|
}).then((mrz) => {
|
|
219
|
-
|
|
258
|
+
logger.log("back verification result", truncateFields(mrz));
|
|
220
259
|
setSilentCaptureResult((prev) => ({
|
|
221
260
|
...prev, path: result.path, bbox: (mrz as any)?.bbox,
|
|
222
261
|
success: true, mrz: JSON.stringify(mrz), isAnalyzing: false,
|
|
223
262
|
country: countryData?.code,
|
|
224
|
-
documentType: selectedDocumentType?.type
|
|
263
|
+
documentType: selectedDocumentType?.type,
|
|
264
|
+
templatePath: "",
|
|
225
265
|
}));
|
|
226
266
|
}).catch((e: any) => {
|
|
227
|
-
|
|
228
|
-
setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: e?.message || 'Erreur de détection du MRZ' }));
|
|
267
|
+
logger.log("error back verification", truncateFields(e));
|
|
268
|
+
setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, templatePath: templatePath, success: false, error: e?.message || 'Erreur de détection du MRZ' }));
|
|
229
269
|
// Alert.alert('Erreur', e?.message || 'Erreur de détection du MRZ');
|
|
230
270
|
})
|
|
231
271
|
}
|
|
@@ -344,7 +384,7 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
344
384
|
}
|
|
345
385
|
|
|
346
386
|
if (showDocumentSelection.regionSelection) {
|
|
347
|
-
|
|
387
|
+
logger.log("showDocumentSelection", JSON.stringify(truncateFields(showDocumentSelection), null, 2));
|
|
348
388
|
setShowDocumentSelection({
|
|
349
389
|
documentSelection: false,
|
|
350
390
|
regionSelection: false
|
|
@@ -429,9 +469,10 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
429
469
|
actions.showCustomStepper(true);
|
|
430
470
|
}
|
|
431
471
|
},
|
|
432
|
-
selectedDocumentType: getDocumentTypeInfo(selectedDocumentType?.type || "identity_card").name.en || '',
|
|
472
|
+
selectedDocumentType: locale === 'en' ? getDocumentTypeInfo(selectedDocumentType?.type || "identity_card").name.en : getDocumentTypeInfo(selectedDocumentType?.type || "identity_card").name.fr || '',
|
|
433
473
|
step: state.currentComponentIndex + 1,
|
|
434
474
|
totalSteps: state.template.components.length,
|
|
475
|
+
side: currentSide,
|
|
435
476
|
}}
|
|
436
477
|
/>
|
|
437
478
|
}
|
|
@@ -482,6 +523,15 @@ export const IDCardCapture: React.FC<IDCardCaptureProps> = ({
|
|
|
482
523
|
}}
|
|
483
524
|
/>
|
|
484
525
|
) : null}
|
|
526
|
+
{silentCaptureResult.path ? (<Image
|
|
527
|
+
source={{ uri: silentCaptureResult.path }}
|
|
528
|
+
style={{
|
|
529
|
+
width: '100%',
|
|
530
|
+
height: 200,
|
|
531
|
+
borderRadius: 12,
|
|
532
|
+
resizeMode: 'cover',
|
|
533
|
+
}}
|
|
534
|
+
/>) : null}
|
|
485
535
|
|
|
486
536
|
</View>
|
|
487
537
|
{/* retake button */}
|
|
@@ -89,7 +89,7 @@ export const ReviewSubmitTemplate: React.FC<ReviewSubmitTemplateProps> = () => {
|
|
|
89
89
|
const colorStyle = o === 'center' ? styles.pink : o === 'right' ? styles.blue : styles.purple;
|
|
90
90
|
return (
|
|
91
91
|
<View key={o} style={[styles.tile, colorStyle, has ? styles.active : null]}>
|
|
92
|
-
<Text style={styles.tileLabel}>{
|
|
92
|
+
<Text style={styles.tileLabel}>{t(`kyc.reviewSubmit.selfieSide.${o}`)}</Text>
|
|
93
93
|
{has ? <Text style={styles.check}>✓</Text> : null}
|
|
94
94
|
</View>
|
|
95
95
|
);
|
|
@@ -253,6 +253,7 @@ export const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({
|
|
|
253
253
|
selectedDocumentType: "Selfie",
|
|
254
254
|
step: state.currentComponentIndex + 1,
|
|
255
255
|
totalSteps: state.template.components.length,
|
|
256
|
+
side: currentOrientation,
|
|
256
257
|
}} />}
|
|
257
258
|
/>
|
|
258
259
|
</View>
|
|
@@ -4,6 +4,7 @@ import { TemplateComponent } from '../../types/KYC.types';
|
|
|
4
4
|
import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
|
|
5
5
|
import { useI18n } from '../../hooks/useI18n';
|
|
6
6
|
import kycService from '../../modules/api/KYCService';
|
|
7
|
+
import { logger } from '../../utils/logger';
|
|
7
8
|
|
|
8
9
|
interface VerificationProgressTemplateProps {
|
|
9
10
|
component: TemplateComponent;
|
|
@@ -28,12 +29,12 @@ export const VerificationProgressTemplate: React.FC<VerificationProgressTemplate
|
|
|
28
29
|
// Fonction pour récupérer le résultat de vérification avec retry
|
|
29
30
|
const getVerificationResult = async (currentRetryCount = 0, maxRetries = 40) => {
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
+
logger.log(`Starting verification check (attempt ${currentRetryCount + 1}/${maxRetries + 1})`);
|
|
32
33
|
|
|
33
34
|
const result = await kycService.getVerificationResult(state.session.session_id);
|
|
34
35
|
const verificationResult = result[state.session.session_id].data;
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
logger.log('getVerificationResult result', JSON.stringify(result, null, 2));
|
|
37
38
|
|
|
38
39
|
// Vérifier le statut de vérification
|
|
39
40
|
if (verificationResult.verification_status === null || verificationResult.verification_status === "processing" || verificationResult.verification_status === "pending") {
|
|
@@ -42,7 +43,7 @@ export const VerificationProgressTemplate: React.FC<VerificationProgressTemplate
|
|
|
42
43
|
setRetryCount(nextRetryCount);
|
|
43
44
|
setIsRetrying(true);
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
logger.log(`Verification still processing, retrying in 10s... (${nextRetryCount}/${maxRetries})`);
|
|
46
47
|
|
|
47
48
|
// Nettoyer le timeout précédent s'il existe
|
|
48
49
|
if (timeoutId) {
|
|
@@ -57,7 +58,7 @@ export const VerificationProgressTemplate: React.FC<VerificationProgressTemplate
|
|
|
57
58
|
setTimeoutId(newTimeoutId);
|
|
58
59
|
return; // Sortir de la fonction pour éviter de traiter le résultat
|
|
59
60
|
} else {
|
|
60
|
-
|
|
61
|
+
logger.error('Max retries reached, verification still processing');
|
|
61
62
|
setIsRetrying(false);
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
@@ -86,7 +87,7 @@ export const VerificationProgressTemplate: React.FC<VerificationProgressTemplate
|
|
|
86
87
|
setIsRetrying(false);
|
|
87
88
|
|
|
88
89
|
} catch (error) {
|
|
89
|
-
|
|
90
|
+
logger.error('getVerificationResult error', error);
|
|
90
91
|
|
|
91
92
|
// En cas d'erreur, on peut aussi retry
|
|
92
93
|
if (currentRetryCount < maxRetries) {
|
|
@@ -94,7 +95,7 @@ export const VerificationProgressTemplate: React.FC<VerificationProgressTemplate
|
|
|
94
95
|
setRetryCount(nextRetryCount);
|
|
95
96
|
setIsRetrying(true);
|
|
96
97
|
|
|
97
|
-
|
|
98
|
+
logger.log(`Error occurred, retrying in 10s... (${nextRetryCount}/${maxRetries})`);
|
|
98
99
|
|
|
99
100
|
// Nettoyer le timeout précédent s'il existe
|
|
100
101
|
if (timeoutId) {
|
|
@@ -108,7 +109,7 @@ export const VerificationProgressTemplate: React.FC<VerificationProgressTemplate
|
|
|
108
109
|
setTimeoutId(newTimeoutId);
|
|
109
110
|
} else {
|
|
110
111
|
setIsRetrying(false);
|
|
111
|
-
|
|
112
|
+
logger.error('Max retries reached after errors');
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
};
|
|
@@ -155,7 +156,7 @@ export const VerificationProgressTemplate: React.FC<VerificationProgressTemplate
|
|
|
155
156
|
))}
|
|
156
157
|
</View>
|
|
157
158
|
<TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.goToComponent(state.template.components.find(c => c.type !== 'review_submit' && c.type !== 'verification_progress')?.id || 0)}>
|
|
158
|
-
<Text style={styles.buttonText}>{t('
|
|
159
|
+
<Text style={styles.buttonText}>{t('kyc.verificationProgress.status.retry')}</Text>
|
|
159
160
|
</TouchableOpacity>
|
|
160
161
|
<TouchableOpacity style={[styles.button, styles.secondary]}>
|
|
161
162
|
<Text style={styles.secondaryText}>{t('common.info')}</Text>
|
|
@@ -178,7 +179,7 @@ export const VerificationProgressTemplate: React.FC<VerificationProgressTemplate
|
|
|
178
179
|
<Text style={styles.title}>{t('kyc.verificationProgress.title')}</Text>
|
|
179
180
|
<Text style={styles.subtitle}>
|
|
180
181
|
{isRetrying
|
|
181
|
-
? `${t('kyc.verificationProgress.retrying'
|
|
182
|
+
? `${t('kyc.verificationProgress.retrying', { current: retryCount, max: 40 })}`
|
|
182
183
|
: t('kyc.verificationProgress.estimatedTime')
|
|
183
184
|
}
|
|
184
185
|
</Text>
|
|
@@ -141,14 +141,14 @@ const IdCardOverlay = ({ xMin: xMinProps, yMin: yMinProps, xMax: xMaxProps, yMax
|
|
|
141
141
|
|
|
142
142
|
<View style={styles.bottomIntruction}>
|
|
143
143
|
<Text style={styles.bottomTitle}>
|
|
144
|
-
{language === "en" ? "
|
|
144
|
+
{language === "en" ? "Scan the ${stepperProps?.side === 'front' ? 'front' : 'back'} side of your ${stepperProps?.selectedDocumentType}.":`Scanner de la face ${stepperProps?.side === 'front' ? 'avant' : 'arrière'} de votre ${stepperProps?.selectedDocumentType}.`}
|
|
145
145
|
|
|
146
146
|
</Text>
|
|
147
147
|
<Text style={styles.bottomSubtitle}>
|
|
148
148
|
{
|
|
149
149
|
language === "en"
|
|
150
|
-
? "
|
|
151
|
-
: "
|
|
150
|
+
? "Hold your ID card steady and make sure all corners are visible. Do not move your phone while the image is being captured."
|
|
151
|
+
: "Maintenez votre carte d'identité stable et assurez-vous que tous les coins sont visibles. Ne déplacez pas votre téléphone pendant la capture."
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
</Text>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StyleSheet, View, TouchableOpacity, Text } from "react-native";
|
|
2
|
+
import useI18n from "../../hooks/useI18n";
|
|
2
3
|
|
|
3
4
|
interface StepOverlayProps {
|
|
4
5
|
back: () => void;
|
|
@@ -7,6 +8,7 @@ interface StepOverlayProps {
|
|
|
7
8
|
totalSteps: number;
|
|
8
9
|
}
|
|
9
10
|
const StepOverlay = ({ back, selectedDocumentType, step, totalSteps }: StepOverlayProps) => {
|
|
11
|
+
const { t } = useI18n();
|
|
10
12
|
return (
|
|
11
13
|
<View style={styles.stepperContainer}>
|
|
12
14
|
<TouchableOpacity onPress={back} style={styles.back}>
|
|
@@ -16,7 +18,7 @@ const StepOverlay = ({ back, selectedDocumentType, step, totalSteps }: StepOverl
|
|
|
16
18
|
<Text style={styles.stepperItemText}>{selectedDocumentType}</Text>
|
|
17
19
|
</View>
|
|
18
20
|
<View style={styles.stepperDetails}>
|
|
19
|
-
<Text style={styles.stepperDetailsText}>
|
|
21
|
+
<Text style={styles.stepperDetailsText}>{t('kyc.step', { current: step, total: totalSteps })}</Text>
|
|
20
22
|
</View>
|
|
21
23
|
</View>
|
|
22
24
|
)
|
|
@@ -15,7 +15,7 @@ export interface IdCardOverlayProps {
|
|
|
15
15
|
orientation?: 'center' | 'left' | 'right';
|
|
16
16
|
isAnalyzing?: boolean;
|
|
17
17
|
isSuccess?: boolean;
|
|
18
|
-
language:string
|
|
18
|
+
language: string
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
|
|
@@ -24,6 +24,7 @@ interface StepperProps {
|
|
|
24
24
|
selectedDocumentType: string;
|
|
25
25
|
step: number;
|
|
26
26
|
totalSteps: number;
|
|
27
|
+
side: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export interface ExtractMrzTextResponse {
|
|
@@ -65,13 +66,13 @@ export interface EnhancedCameraViewProps {
|
|
|
65
66
|
showSwitchCamera?: boolean;
|
|
66
67
|
overlayComponent?: React.ReactNode;
|
|
67
68
|
bbox?: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
xMin: number;
|
|
70
|
+
yMin: number;
|
|
71
|
+
xMax: number;
|
|
72
|
+
yMax: number;
|
|
73
|
+
borderColor?: string;
|
|
74
|
+
borderWidth?: number;
|
|
75
|
+
cornerRadius?: number;
|
|
75
76
|
};
|
|
76
77
|
canFlip?: boolean;
|
|
77
78
|
// Video recording props
|
|
@@ -80,4 +81,9 @@ export interface EnhancedCameraViewProps {
|
|
|
80
81
|
onVideoRecordingStart?: () => void;
|
|
81
82
|
onVideoRecordingStop?: (result: { success: boolean; path?: string; error?: string }) => void;
|
|
82
83
|
videoDuration?: number;
|
|
83
|
-
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface CheckTemplateTypeResponse {
|
|
87
|
+
template_path: string;
|
|
88
|
+
lpips_score: number;
|
|
89
|
+
}
|
|
@@ -56,8 +56,8 @@ const advancedVerificationTemplate: KYCTemplate = {
|
|
|
56
56
|
buttonText: { en: "Confirm", fr: "Confirmer" }
|
|
57
57
|
},
|
|
58
58
|
config: {
|
|
59
|
-
allowed_countries: ["
|
|
60
|
-
default_country: "
|
|
59
|
+
allowed_countries: ["CM", "NG", "CI", "KE","GH"],
|
|
60
|
+
default_country: "CM",
|
|
61
61
|
required: true
|
|
62
62
|
} as const
|
|
63
63
|
},
|
|
@@ -81,4 +81,5 @@ export const countryData: Record<string, Country> = {
|
|
|
81
81
|
IS: { name: 'Islande', name_en: "Iceland", flag: '🇮🇸' },
|
|
82
82
|
IE: { name: 'Irlande', name_en: "Ireland", flag: '🇮🇪' },
|
|
83
83
|
NZ: { name: 'Nouvelle-Zélande', name_en: "New Zealand", flag: '🇳🇿' },
|
|
84
|
+
GH: { name: 'Ghana', name_en: "Ghana", flag: '🇬🇭' },
|
|
84
85
|
};
|