@sanctum-key/react-native-sdk 1.0.60 → 1.0.62
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 +34 -0
- package/android/build/.transforms/ac63f648699cdd4b91e6ee06476f2a70/results.bin +1 -0
- package/android/build/.transforms/ac63f648699cdd4b91e6ee06476f2a70/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +9 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +45 -25
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +9 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +1 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.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 +34 -12
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$BarcodeRegion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$1$6$1.class → SanctumKeySdkModule$definition$1$7$1.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$1$6$2.class → SanctumKeySdkModule$definition$1$7$2.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$1.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunction$1.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$5.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunction$2.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$3.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunction$3.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunction$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$2.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunction$5.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunction$6.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$4.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunction$7.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunction$8.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunction$6.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunction$9.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$1.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunctionWithPromise$1.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$2.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunctionWithPromise$2.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$3.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunctionWithPromise$3.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$4.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunctionWithPromise$4.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$5.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunctionWithPromise$5.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$6.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunctionWithPromise$6.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$AsyncFunctionWithPromise$7.class → SanctumKeySdkModule$definition$lambda$24$$inlined$AsyncFunctionWithPromise$7.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$$inlined$View$1.class → SanctumKeySdkModule$definition$lambda$24$$inlined$View$1.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$lambda$15$$inlined$Prop$1.class → SanctumKeySdkModule$definition$lambda$24$lambda$23$$inlined$Prop$1.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/{SanctumKeySdkModule$definition$lambda$16$lambda$15$$inlined$Prop$2.class → SanctumKeySdkModule$definition$lambda$24$lambda$23$$inlined$Prop$2.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/sanctumkey/com/SanctumKeySdkModule.class +0 -0
- package/android/src/main/AndroidManifest.xml +9 -0
- package/android/src/main/java/kyc/sanctumkey/com/SanctumKeySdkModule.kt +147 -0
- package/build/package.json +1 -1
- package/build/src/SanctumKeySdkModule.d.ts +2 -0
- package/build/src/SanctumKeySdkModule.d.ts.map +1 -1
- package/build/src/SanctumKeySdkModule.js.map +1 -1
- package/build/src/SanctumKeySdkModule.web.d.ts +2 -0
- package/build/src/SanctumKeySdkModule.web.d.ts.map +1 -1
- package/build/src/SanctumKeySdkModule.web.js +14 -0
- package/build/src/SanctumKeySdkModule.web.js.map +1 -1
- package/build/src/components/KYCElements/CountrySelection.d.ts.map +1 -1
- package/build/src/components/KYCElements/CountrySelection.js +1 -1
- package/build/src/components/KYCElements/CountrySelection.js.map +1 -1
- package/build/src/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/CountrySelectionTemplate.js +27 -17
- package/build/src/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.js +46 -28
- package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/src/components/OverLay/IdCard.d.ts +1 -1
- package/build/src/components/OverLay/IdCard.d.ts.map +1 -1
- package/build/src/components/OverLay/IdCard.js +47 -14
- package/build/src/components/OverLay/IdCard.js.map +1 -1
- package/build/src/components/OverLay/type.d.ts +2 -0
- package/build/src/components/OverLay/type.d.ts.map +1 -1
- package/build/src/components/OverLay/type.js.map +1 -1
- package/build/src/components/Svgs/scanningLine.d.ts +4 -1
- package/build/src/components/Svgs/scanningLine.d.ts.map +1 -1
- package/build/src/components/Svgs/scanningLine.js +15 -11
- package/build/src/components/Svgs/scanningLine.js.map +1 -1
- package/build/src/components/TemplateKYCExample.d.ts +4 -1
- package/build/src/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/src/components/TemplateKYCExample.js +2 -2
- package/build/src/components/TemplateKYCExample.js.map +1 -1
- package/build/src/components/TemplateKYCFlowRefactored.d.ts +4 -2
- package/build/src/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
- package/build/src/components/TemplateKYCFlowRefactored.js +157 -8
- package/build/src/components/TemplateKYCFlowRefactored.js.map +1 -1
- package/build/src/config/region_mapping.d.ts.map +1 -1
- package/build/src/config/region_mapping.js +28 -0
- package/build/src/config/region_mapping.js.map +1 -1
- package/build/src/config/region_mapping.json +28 -0
- package/build/src/index.d.ts +2 -0
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +2 -0
- package/build/src/index.js.map +1 -1
- package/build/src/security/deviceSecurity.d.ts +30 -0
- package/build/src/security/deviceSecurity.d.ts.map +1 -0
- package/build/src/security/deviceSecurity.js +55 -0
- package/build/src/security/deviceSecurity.js.map +1 -0
- package/build/src/utils/logger.d.ts.map +1 -1
- package/build/src/utils/logger.js +5 -0
- package/build/src/utils/logger.js.map +1 -1
- package/ios/SanctumKeySdkModule.swift +93 -0
- package/package.json +1 -1
- package/src/SanctumKeySdkModule.ts +2 -0
- package/src/SanctumKeySdkModule.web.ts +16 -0
- package/src/components/KYCElements/CountrySelection.tsx +3 -1
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +73 -24
- package/src/components/KYCElements/IDCardCapture.tsx +53 -30
- package/src/components/OverLay/IdCard.tsx +72 -15
- package/src/components/OverLay/type.ts +4 -2
- package/src/components/Svgs/scanningLine.tsx +19 -12
- package/src/components/TemplateKYCExample.tsx +8 -1
- package/src/components/TemplateKYCFlowRefactored.tsx +202 -16
- package/src/config/region_mapping.json +28 -0
- package/src/config/region_mapping.ts +28 -0
- package/src/index.ts +9 -1
- package/src/security/deviceSecurity.ts +106 -0
- package/src/utils/logger.ts +5 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions, ScrollView, Platform } from 'react-native';
|
|
3
3
|
import { TemplateKYCFlowProvider, useTemplateKYCFlowContext } from '../hooks/useTemplateKYCFlow';
|
|
4
4
|
import { useI18n } from '../hooks/useI18n';
|
|
@@ -19,13 +19,126 @@ import { PersonalInformationTemplate } from './KYCElements/PersonalInformationTe
|
|
|
19
19
|
import { AdditionalDocumentsTemplate } from './KYCElements/AdditionalDocumentsTemplate';
|
|
20
20
|
import KYCConfig from '../config/KYCConfig';
|
|
21
21
|
import { logger, sdkLogger } from '../utils/logger';
|
|
22
|
-
|
|
22
|
+
import { checkDeviceSecurity, getDeviceSecurityViolations, } from '../security/deviceSecurity';
|
|
23
|
+
function deviceSecurityErrorMessage(violations, language) {
|
|
24
|
+
const french = language.toLowerCase().startsWith('fr');
|
|
25
|
+
const labels = french
|
|
26
|
+
? {
|
|
27
|
+
compromised_device: 'appareil rooté ou jailbreaké',
|
|
28
|
+
developer_mode: 'mode développeur ou débogueur activé',
|
|
29
|
+
emulator: 'émulateur ou simulateur détecté',
|
|
30
|
+
check_unavailable: 'vérification de sécurité indisponible',
|
|
31
|
+
}
|
|
32
|
+
: {
|
|
33
|
+
compromised_device: 'rooted or jailbroken device',
|
|
34
|
+
developer_mode: 'developer mode or debugger enabled',
|
|
35
|
+
emulator: 'emulator or simulator detected',
|
|
36
|
+
check_unavailable: 'device security check unavailable',
|
|
37
|
+
};
|
|
38
|
+
const details = violations.map(violation => labels[violation]).join(', ');
|
|
39
|
+
return french
|
|
40
|
+
? `La vérification d'identité ne peut pas continuer : ${details}.`
|
|
41
|
+
: `Identity verification cannot continue: ${details}.`;
|
|
42
|
+
}
|
|
43
|
+
export const TemplateKYCFlow = ({ template: providedTemplate, templateId, onComplete, onError, language = 'fr', onCancel, API_KEY, TEST_API_KEY, env = 'PRODUCTION', serverEnv, existingSessionId, initialComponentIndex, initialCountryResume, referenceId, onSessionSave, kyc_session_id, templateConfig, deviceSecurityPolicy, onDeviceSecurityCheck, }) => {
|
|
23
44
|
const { t } = useI18n();
|
|
24
45
|
const { template: loadedTemplate, isLoading, error, loadTemplate } = useTemplateLoader();
|
|
25
46
|
const [resolvedTemplateId, setResolvedTemplateId] = useState(templateId);
|
|
26
47
|
const [isResolving, setIsResolving] = useState(!templateId && !!templateConfig);
|
|
48
|
+
const securityCheckEnabled = Platform.OS !== 'web' && deviceSecurityPolicy?.enabled !== false;
|
|
49
|
+
const enforceSecurity = env === 'PRODUCTION';
|
|
50
|
+
const blockCompromisedDevices = deviceSecurityPolicy?.blockCompromisedDevices ?? enforceSecurity;
|
|
51
|
+
const blockDeveloperMode = deviceSecurityPolicy?.blockDeveloperMode ?? enforceSecurity;
|
|
52
|
+
const blockEmulators = deviceSecurityPolicy?.blockEmulators ?? enforceSecurity;
|
|
53
|
+
const failClosed = deviceSecurityPolicy?.failClosed ?? enforceSecurity;
|
|
54
|
+
const [securityStatus, setSecurityStatus] = useState(securityCheckEnabled ? 'checking' : 'allowed');
|
|
55
|
+
const [securityError, setSecurityError] = useState('');
|
|
56
|
+
const [securityRetryToken, setSecurityRetryToken] = useState(0);
|
|
57
|
+
const onErrorRef = useRef(onError);
|
|
58
|
+
const onDeviceSecurityCheckRef = useRef(onDeviceSecurityCheck);
|
|
59
|
+
useEffect(() => { onErrorRef.current = onError; }, [onError]);
|
|
60
|
+
useEffect(() => { onDeviceSecurityCheckRef.current = onDeviceSecurityCheck; }, [onDeviceSecurityCheck]);
|
|
27
61
|
// 🚨 1. Determine the active API key based on the environment
|
|
28
62
|
const activeApiKey = env === 'PRODUCTION' ? API_KEY : (TEST_API_KEY || API_KEY);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
let cancelled = false;
|
|
65
|
+
if (!securityCheckEnabled) {
|
|
66
|
+
setSecurityStatus('allowed');
|
|
67
|
+
setSecurityError('');
|
|
68
|
+
return () => { cancelled = true; };
|
|
69
|
+
}
|
|
70
|
+
setSecurityStatus('checking');
|
|
71
|
+
setSecurityError('');
|
|
72
|
+
const runSecurityCheck = async () => {
|
|
73
|
+
try {
|
|
74
|
+
const result = await checkDeviceSecurity();
|
|
75
|
+
if (cancelled)
|
|
76
|
+
return;
|
|
77
|
+
onDeviceSecurityCheckRef.current?.(result);
|
|
78
|
+
const violations = getDeviceSecurityViolations(result, {
|
|
79
|
+
blockCompromisedDevices,
|
|
80
|
+
blockDeveloperMode,
|
|
81
|
+
blockEmulators,
|
|
82
|
+
failClosed,
|
|
83
|
+
});
|
|
84
|
+
sdkLogger.info('Device security check completed', {
|
|
85
|
+
platform: result.platform,
|
|
86
|
+
supported: result.supported,
|
|
87
|
+
isCompromised: result.isCompromised,
|
|
88
|
+
isDeveloperModeEnabled: result.isDeveloperModeEnabled,
|
|
89
|
+
isEmulator: result.isEmulator,
|
|
90
|
+
riskSignals: result.riskSignals,
|
|
91
|
+
blocked: violations.length > 0,
|
|
92
|
+
});
|
|
93
|
+
if (violations.length > 0) {
|
|
94
|
+
const message = deviceSecurityErrorMessage(violations, language);
|
|
95
|
+
setSecurityError(message);
|
|
96
|
+
setSecurityStatus('blocked');
|
|
97
|
+
onErrorRef.current?.(message);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
setSecurityStatus('allowed');
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (cancelled)
|
|
104
|
+
return;
|
|
105
|
+
const unavailableResult = {
|
|
106
|
+
platform: Platform.OS === 'android' || Platform.OS === 'ios' ? Platform.OS : 'unknown',
|
|
107
|
+
supported: false,
|
|
108
|
+
isRooted: false,
|
|
109
|
+
isJailbroken: false,
|
|
110
|
+
isEmulator: false,
|
|
111
|
+
isDeveloperModeEnabled: false,
|
|
112
|
+
developerModeCheckSupported: false,
|
|
113
|
+
isDebuggerAttached: false,
|
|
114
|
+
isCompromised: false,
|
|
115
|
+
riskSignals: ['native_device_security_check_failed'],
|
|
116
|
+
checkedAt: new Date().toISOString(),
|
|
117
|
+
};
|
|
118
|
+
onDeviceSecurityCheckRef.current?.(unavailableResult);
|
|
119
|
+
sdkLogger.error('Device security check failed', { error: error?.message });
|
|
120
|
+
if (failClosed) {
|
|
121
|
+
const message = deviceSecurityErrorMessage(['check_unavailable'], language);
|
|
122
|
+
setSecurityError(message);
|
|
123
|
+
setSecurityStatus('blocked');
|
|
124
|
+
onErrorRef.current?.(message);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
setSecurityStatus('allowed');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
void runSecurityCheck();
|
|
132
|
+
return () => { cancelled = true; };
|
|
133
|
+
}, [
|
|
134
|
+
securityCheckEnabled,
|
|
135
|
+
blockCompromisedDevices,
|
|
136
|
+
blockDeveloperMode,
|
|
137
|
+
blockEmulators,
|
|
138
|
+
failClosed,
|
|
139
|
+
securityRetryToken,
|
|
140
|
+
language,
|
|
141
|
+
]);
|
|
29
142
|
useEffect(() => {
|
|
30
143
|
if (activeApiKey) {
|
|
31
144
|
if (sdkLogger.setApiKey)
|
|
@@ -38,6 +151,8 @@ export const TemplateKYCFlow = ({ template: providedTemplate, templateId, onComp
|
|
|
38
151
|
}
|
|
39
152
|
}, [serverEnv]);
|
|
40
153
|
useEffect(() => {
|
|
154
|
+
if (securityStatus !== 'allowed')
|
|
155
|
+
return;
|
|
41
156
|
// If a strict templateId is provided, use it immediately and skip geolocation
|
|
42
157
|
if (templateId) {
|
|
43
158
|
setResolvedTemplateId(templateId);
|
|
@@ -75,9 +190,9 @@ export const TemplateKYCFlow = ({ template: providedTemplate, templateId, onComp
|
|
|
75
190
|
}
|
|
76
191
|
};
|
|
77
192
|
fetchLocationAndRoute();
|
|
78
|
-
}, [templateId, templateConfig]); // Only re-run if the props change
|
|
193
|
+
}, [templateId, templateConfig, securityStatus]); // Only re-run if the props change
|
|
79
194
|
useEffect(() => {
|
|
80
|
-
if (isResolving)
|
|
195
|
+
if (isResolving || securityStatus !== 'allowed')
|
|
81
196
|
return;
|
|
82
197
|
// Updated error check to include templateConfig
|
|
83
198
|
if (!providedTemplate && !resolvedTemplateId) {
|
|
@@ -95,7 +210,7 @@ export const TemplateKYCFlow = ({ template: providedTemplate, templateId, onComp
|
|
|
95
210
|
logger.log(`Fetching template ${resolvedTemplateId} via API Key`);
|
|
96
211
|
loadTemplate(resolvedTemplateId, activeApiKey);
|
|
97
212
|
}
|
|
98
|
-
}, [resolvedTemplateId, activeApiKey, providedTemplate, loadTemplate, onError, isResolving]);
|
|
213
|
+
}, [resolvedTemplateId, activeApiKey, providedTemplate, loadTemplate, onError, isResolving, securityStatus]);
|
|
99
214
|
useEffect(() => {
|
|
100
215
|
if (error) {
|
|
101
216
|
sdkLogger.error("Template Fetch Error", { error });
|
|
@@ -119,6 +234,34 @@ export const TemplateKYCFlow = ({ template: providedTemplate, templateId, onComp
|
|
|
119
234
|
]);
|
|
120
235
|
};
|
|
121
236
|
const template = providedTemplate || loadedTemplate;
|
|
237
|
+
if (securityStatus === 'checking') {
|
|
238
|
+
return (<View style={styles.loadingContainer}>
|
|
239
|
+
<ActivityIndicator size="large" color="#2DBD60"/>
|
|
240
|
+
<Text style={styles.loadingText}>
|
|
241
|
+
{language.toLowerCase().startsWith('fr')
|
|
242
|
+
? 'Vérification de la sécurité de l’appareil…'
|
|
243
|
+
: 'Checking device security…'}
|
|
244
|
+
</Text>
|
|
245
|
+
</View>);
|
|
246
|
+
}
|
|
247
|
+
if (securityStatus === 'blocked') {
|
|
248
|
+
return (<View style={styles.errorContainer}>
|
|
249
|
+
<Text style={styles.securityTitle}>
|
|
250
|
+
{language.toLowerCase().startsWith('fr') ? 'Appareil non sécurisé' : 'Device security issue'}
|
|
251
|
+
</Text>
|
|
252
|
+
<Text style={styles.errorText}>{securityError}</Text>
|
|
253
|
+
<TouchableOpacity style={styles.retryButton} onPress={() => setSecurityRetryToken(value => value + 1)}>
|
|
254
|
+
<Text style={styles.retryButtonText}>
|
|
255
|
+
{language.toLowerCase().startsWith('fr') ? 'Réessayer' : 'Retry'}
|
|
256
|
+
</Text>
|
|
257
|
+
</TouchableOpacity>
|
|
258
|
+
{onCancel ? (<TouchableOpacity style={styles.cancelSecurityButton} onPress={onCancel}>
|
|
259
|
+
<Text style={styles.cancelSecurityButtonText}>
|
|
260
|
+
{language.toLowerCase().startsWith('fr') ? 'Annuler' : 'Cancel'}
|
|
261
|
+
</Text>
|
|
262
|
+
</TouchableOpacity>) : null}
|
|
263
|
+
</View>);
|
|
264
|
+
}
|
|
122
265
|
if (templateId && isLoading && !template) {
|
|
123
266
|
return (<View style={styles.loadingContainer}>
|
|
124
267
|
<ActivityIndicator size="large" color="#2DBD60"/>
|
|
@@ -243,9 +386,11 @@ const TemplateKYCFlowContent = ({ onCancel }) => {
|
|
|
243
386
|
</View>
|
|
244
387
|
</View>) : null}
|
|
245
388
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
389
|
+
{currentComponent.type === 'country_selection' ? (<View style={styles.selfScrollingContent}>
|
|
390
|
+
{renderCurrentComponent()}
|
|
391
|
+
</View>) : (<ScrollView style={styles.scrollView} contentContainerStyle={styles.content} showsVerticalScrollIndicator={Platform.OS === 'web'} bounces={false}>
|
|
392
|
+
{renderCurrentComponent()}
|
|
393
|
+
</ScrollView>)}
|
|
249
394
|
|
|
250
395
|
{state.isProcessing && (<View style={styles.processingContainer}>
|
|
251
396
|
<Text style={styles.processingText}>{t('common.loading')}</Text>
|
|
@@ -268,6 +413,7 @@ const styles = StyleSheet.create({
|
|
|
268
413
|
stepDescription: { fontSize: 14, color: '#666', lineHeight: 20, },
|
|
269
414
|
scrollView: { flex: 1, },
|
|
270
415
|
content: { flexGrow: 1, alignItems: 'center', paddingBottom: 20, },
|
|
416
|
+
selfScrollingContent: { flex: 1, minHeight: 0, alignItems: 'center', paddingBottom: 20, },
|
|
271
417
|
navigation: { flexDirection: 'row', justifyContent: 'space-between', padding: 20, backgroundColor: 'white', borderTopWidth: 1, borderTopColor: '#e0e0e0', },
|
|
272
418
|
navButton: { paddingHorizontal: 24, paddingVertical: 12, borderRadius: 8, minWidth: 100, alignItems: 'center', },
|
|
273
419
|
primaryButton: { backgroundColor: '#2DBD60', },
|
|
@@ -282,5 +428,8 @@ const styles = StyleSheet.create({
|
|
|
282
428
|
errorContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', padding: 20, },
|
|
283
429
|
retryButton: { marginTop: 20, paddingHorizontal: 24, paddingVertical: 12, backgroundColor: '#2DBD60', borderRadius: 8, },
|
|
284
430
|
retryButtonText: { color: '#fff', fontSize: 16, fontWeight: '600', },
|
|
431
|
+
securityTitle: { color: '#991b1b', fontSize: 22, fontWeight: '700', textAlign: 'center', },
|
|
432
|
+
cancelSecurityButton: { marginTop: 12, paddingHorizontal: 24, paddingVertical: 12, },
|
|
433
|
+
cancelSecurityButtonText: { color: '#4b5563', fontSize: 16, fontWeight: '600', },
|
|
285
434
|
});
|
|
286
435
|
//# sourceMappingURL=TemplateKYCFlowRefactored.js.map
|
|
@@ -1 +1 @@
|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Ac,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,GAAG;IACrH,WAAW,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,GAAG;IACxH,eAAe,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,GAAG;CACrE,CAAC,CAAC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions, ScrollView, Platform } from 'react-native';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\nimport { TemplateKYCFlowProvider, useTemplateKYCFlowContext } from '../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../hooks/useI18n';\nimport { showAlert } from '../utils/platformAlert';\nimport { IDCardCapture } from './KYCElements/IDCardCapture';\nimport { SelfieCaptureTemplate } from './KYCElements/SelfieCaptureTemplate';\nimport { FileUploadTemplate } from './KYCElements/FileUploadTemplate';\nimport { LocationCaptureTemplate } from './KYCElements/LocationCaptureTemplate';\nimport { CountrySelectionTemplate } from './KYCElements/CountrySelectionTemplate';\nimport { InitializationStep } from './KYCElements/InitializationStep';\nimport { ReviewSubmitTemplate } from './KYCElements/ReviewSubmitTemplate';\nimport { VerificationProgressTemplate } from './KYCElements/VerificationProgressTemplate';\nimport { useTemplateLoader } from '../hooks/useTemplateLoader';\nimport { WelcomeTemplate } from './KYCElements/WelcomeTemplate';\nimport { EmailVerificationTemplate } from './KYCElements/EmailVerificationTemplate';\nimport { PhoneVerificationTemplate } from './KYCElements/PhoneVerificationTemplate';\nimport { PersonalInformationTemplate } from './KYCElements/PersonalInformationTemplate';\nimport { AdditionalDocumentsTemplate } from './KYCElements/AdditionalDocumentsTemplate';\nimport { KycEnvironment, BackendEnvironment } from '../types/env.types';\nimport KYCConfig from '../config/KYCConfig';\nimport { logger, sdkLogger } from '../utils/logger'; \n\ninterface TemplateKYCFlowProps {\n template?: KYCTemplate; \n templateId?: string; \n onComplete?: (data: VerificationState) => void;\n onError?: (error: string) => void;\n language?: string;\n onCancel?: () => void;\n API_KEY?: string; \n TEST_API_KEY?: string;\n env?: KycEnvironment; \n serverEnv?: BackendEnvironment; \n existingSessionId?: string;\n initialComponentIndex?: number;\n initialCountryResume?: { code: string; documentType: string; region?: string };\n referenceId?: string;\n onSessionSave?: (sessionId: string) => void;\n kyc_session_id?: string;\n templateConfig?: Record<string, string>;\n}\n\nexport const TemplateKYCFlow: React.FC<TemplateKYCFlowProps> = ({\n template: providedTemplate,\n templateId,\n onComplete,\n onError,\n language = 'fr',\n onCancel,\n API_KEY,\n TEST_API_KEY,\n env = 'PRODUCTION',\n serverEnv,\n existingSessionId,\n initialComponentIndex,\n initialCountryResume,\n referenceId,\n onSessionSave,\n kyc_session_id,\n templateConfig,\n}) => {\n const { t } = useI18n();\n const { template: loadedTemplate, isLoading, error, loadTemplate } = useTemplateLoader();\n const [resolvedTemplateId, setResolvedTemplateId] = useState<string | undefined>(templateId);\n const [isResolving, setIsResolving] = useState<boolean>(!templateId && !!templateConfig);\n\n // 🚨 1. Determine the active API key based on the environment\n const activeApiKey = env === 'PRODUCTION' ? API_KEY : (TEST_API_KEY || API_KEY);\n\n useEffect(() => {\n if (activeApiKey) {\n if (sdkLogger.setApiKey) sdkLogger.setApiKey(activeApiKey);\n }\n }, [env, serverEnv, existingSessionId, activeApiKey]);\n\n useEffect(() => {\n if (serverEnv !== undefined) {\n KYCConfig.setBackendEnvironment(serverEnv);\n }\n }, [serverEnv]);\n\n\n useEffect(() => {\n // If a strict templateId is provided, use it immediately and skip geolocation\n if (templateId) {\n setResolvedTemplateId(templateId);\n setIsResolving(false);\n return;\n }\n\n // If neither templateId nor templateConfig is provided, skip to the next effect\n if (!templateConfig) {\n setIsResolving(false);\n return;\n }\n\n const fetchLocationAndRoute = async () => {\n setIsResolving(true);\n let selected = templateConfig['DEFAULT'];\n\n try {\n const response = await fetch('https://ipapi.co/json/');\n const data = await response.json();\n \n // Priority: Exact Country -> Continent -> DEFAULT\n selected = \n templateConfig[data.country_code] || \n templateConfig[data.continent_code] || \n selected;\n\n logger.info('Template dynamically resolved via location', { \n country: data.country_code, \n continent: data.continent_code, \n selected_template: selected \n });\n\n } catch (error) {\n logger.warn('Location detection failed, using default template');\n } finally {\n setResolvedTemplateId(selected);\n setIsResolving(false);\n }\n };\n\n fetchLocationAndRoute();\n }, [templateId, templateConfig]); // Only re-run if the props change\n\n\n\n useEffect(() => {\n if (isResolving) return;\n\n // Updated error check to include templateConfig\n if (!providedTemplate && !resolvedTemplateId) {\n const errorMsg = 'Either template, templateId, or templateConfig must be provided';\n logger.error(\"Template Loading Failed: Missing Props\", { errorMsg });\n onError?.(errorMsg);\n return;\n }\n\n // Load using the newly resolved ID\n if (resolvedTemplateId && !activeApiKey) {\n logger.log(`Fetching template ${resolvedTemplateId} via token authentication`);\n loadTemplate(resolvedTemplateId);\n } else if (resolvedTemplateId && activeApiKey) {\n logger.log(`Fetching template ${resolvedTemplateId} via API Key`);\n loadTemplate(resolvedTemplateId, activeApiKey);\n }\n }, [resolvedTemplateId, activeApiKey, providedTemplate, loadTemplate, onError, isResolving]);\n\n useEffect(() => {\n if (error) {\n sdkLogger.error(\"Template Fetch Error\", { error });\n onError?.(error);\n }\n }, [error, onError]);\n\n const OnCancel = () => {\n showAlert(\n t('kyc.cancelConfirmation.title'),\n t('kyc.cancelConfirmation.message'),\n [\n {\n text: t('kyc.cancelConfirmation.cancelButton'),\n style: 'cancel',\n },\n {\n text: t('kyc.cancelConfirmation.confirmButton'),\n onPress: () => {\n sdkLogger.warn(\"User confirmed flow cancellation\");\n sdkLogger.flush();\n onCancel?.();\n }\n },\n ]\n );\n };\n\n const template = providedTemplate || loadedTemplate;\n\n \n\n if (templateId && isLoading && !template) {\n return (\n <View style={styles.loadingContainer}>\n <ActivityIndicator size=\"large\" color=\"#2DBD60\" />\n <Text style={styles.loadingText}>{t('common.loading') || 'Loading template...'}</Text>\n </View>\n );\n }\n\n if (templateId && error && !template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>{error}</Text>\n <TouchableOpacity\n style={styles.retryButton}\n onPress={() => {\n sdkLogger.info(\"User retrying template fetch\");\n loadTemplate(templateId, activeApiKey);\n }}\n >\n <Text style={styles.retryButtonText}>{t('common.retry') || 'Retry'}</Text>\n </TouchableOpacity>\n </View>\n );\n }\n\n if (!template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>\n {t('errors.unknownError') || 'Template not available'}\n </Text>\n </View>\n );\n }\n\n return (\n <TemplateKYCFlowProvider\n template={template}\n onComplete={(data) => {\n sdkLogger.info(\"KYC Flow Completed\", { referenceId: data?.result?.referenceId });\n sdkLogger.flush();\n if (onComplete) onComplete(data);\n }}\n onError={(err) => {\n sdkLogger.error(\"KYC Flow Error\", { error: err });\n sdkLogger.flush();\n logger.log('Error', err)\n if (onError) onError(err);\n }}\n onCancel={OnCancel}\n initialLanguage={language}\n apiKey={activeApiKey}\n testApiKey={TEST_API_KEY} \n env={env}\n existingSessionId={existingSessionId}\n initialComponentIndex={initialComponentIndex}\n initialCountryResume={initialCountryResume}\n referenceId={referenceId}\n onSessionSave={onSessionSave}\n kyc_session_id={kyc_session_id}\n >\n <TemplateKYCFlowContent onCancel={OnCancel} />\n </TemplateKYCFlowProvider>\n );\n};\n\nconst TemplateKYCFlowContent: React.FC<{ onCancel?: () => void }> = ({ onCancel }) => {\n const { state, actions, currentComponent, progress } = useTemplateKYCFlowContext();\n const { t } = useI18n();\n\n\n useEffect(() => {\n if (state.session?.session_id) {\n sdkLogger.setSessionId(state.session.session_id);\n }\n }, [state.session?.session_id]);\n\n useEffect(() => {\n if (currentComponent) {\n sdkLogger.info(`User navigated to step ${state.currentComponentIndex + 1}: ${currentComponent.type}`, {\n componentId: currentComponent.id,\n progress: `${progress}%`\n });\n }\n }, [currentComponent?.id, state.currentComponentIndex, progress]);\n\n const updateComponentData = (componentId: number, data: unknown) => {\n actions.updateComponentData(componentId, data);\n };\n\n if (!currentComponent) {\n return (\n <View style={styles.container}>\n <Text style={styles.errorText}>{t('errors.unknownError')}</Text>\n </View>\n );\n }\n\n const renderCurrentComponent = () => {\n const commonProps = {\n component: currentComponent,\n value: state.componentData[currentComponent.id],\n onValueChange: (data: unknown) => updateComponentData(currentComponent.id, data),\n error: state.errors[currentComponent.id],\n language: state.currentLanguage,\n };\n\n if (!state.session.isInitialized) {\n return <InitializationStep session={state.session} />\n }\n\n switch (currentComponent.type) {\n case 'welcome': return <WelcomeTemplate {...commonProps} />;\n case 'id_card': return <IDCardCapture {...commonProps} />;\n case 'selfie': return <SelfieCaptureTemplate {...commonProps} />;\n case 'file_upload': return <FileUploadTemplate {...commonProps} />;\n case 'location': return <LocationCaptureTemplate {...commonProps} />;\n case 'country_selection': return <CountrySelectionTemplate {...commonProps} />;\n case 'review_submit': return <ReviewSubmitTemplate {...commonProps} />;\n case 'email_verification': return <EmailVerificationTemplate {...commonProps} />;\n case 'phone_verification': return <PhoneVerificationTemplate {...commonProps} />;\n case 'personal_information': return <PersonalInformationTemplate {...commonProps} />;\n case 'additional_documents': return <AdditionalDocumentsTemplate {...commonProps} />;\n case 'verification_progress': return <VerificationProgressTemplate {...commonProps} />;\n default:\n sdkLogger.error(\"Attempted to render unsupported component type\", { type: currentComponent.type });\n return (\n <View style={styles.unsupportedContainer}>\n <Text style={styles.unsupportedText}>\n {t('errors.unknownError')}: {currentComponent.type}\n </Text>\n </View>\n );\n }\n };\n\n return (\n <View style={{ flex: 1, position: 'relative' }}>\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n\n <SafeAreaView style={styles.container}>\n {(state.showCustomStepper && state.session.isInitialized) ? (\n <View style={styles.header}>\n <Text style={styles.progressText}>\n {t('kyc.step', {\n current: (state.template.components.findIndex(c => c.id === currentComponent.id) + 1) || (state.currentComponentIndex + 1),\n total: state.template.components.length,\n })}\n </Text>\n \n <View style={styles.progressContainer}>\n <View style={styles.progressBar}>\n <View style={[styles.progressFill, { width: `${progress}%` }]} />\n </View>\n </View>\n\n <View style={{ position: 'absolute', right: 12, top: 12 }}>\n <TouchableOpacity onPress={onCancel} disabled={!onCancel} style={{ opacity: onCancel ? 1 : 0.5 }}>\n <Text style={{ fontSize: 20, fontWeight: 'bold', color: '#333' }}>{`X`}</Text>\n </TouchableOpacity>\n </View>\n </View>\n ) : null}\n\n <ScrollView\n style={styles.scrollView}\n contentContainerStyle={styles.content}\n showsVerticalScrollIndicator={Platform.OS === 'web'}\n bounces={false}\n >\n {renderCurrentComponent()}\n </ScrollView>\n\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n </SafeAreaView>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { flex: 1, backgroundColor: '#f5f5f5', },\n header: { backgroundColor: 'white', paddingVertical: 20, paddingHorizontal: 12, borderBottomWidth: 1, borderBottomColor: '#e0e0e0', marginHorizontal: 12, marginTop: 12, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.15, shadowRadius: 1.84, elevation: 5, },\n title: { fontSize: 24, fontWeight: 'bold', color: '#333', marginBottom: 8, },\n description: { fontSize: 16, color: '#666', marginBottom: 20, },\n progressContainer: { },\n progressBar: { height: 8, backgroundColor: '#e0e0e0', borderRadius: 4, overflow: 'hidden', },\n progressFill: { height: '100%', backgroundColor: '#2DBD60', borderRadius: 4, },\n progressText: { fontSize: 14, color: 'black', fontWeight: '600', textAlign: 'left', marginBottom: 8, },\n stepInfo: { backgroundColor: '#f8f9fa', padding: 16, borderRadius: 8, borderLeftWidth: 4, borderLeftColor: '#2DBD60', },\n stepTitle: { fontSize: 18, fontWeight: '600', color: '#333', marginBottom: 8, },\n stepDescription: { fontSize: 14, color: '#666', lineHeight: 20, },\n scrollView: { flex: 1, },\n content: { flexGrow: 1, alignItems: 'center', paddingBottom: 20, },\n navigation: { flexDirection: 'row', justifyContent: 'space-between', padding: 20, backgroundColor: 'white', borderTopWidth: 1, borderTopColor: '#e0e0e0', },\n navButton: { paddingHorizontal: 24, paddingVertical: 12, borderRadius: 8, minWidth: 100, alignItems: 'center', },\n primaryButton: { backgroundColor: '#2DBD60', },\n navButtonText: { fontSize: 16, fontWeight: '600', color: 'white', },\n errorText: { color: '#dc2626', fontSize: 16, textAlign: 'center', margin: 20, },\n unsupportedContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20, },\n unsupportedText: { fontSize: 16, color: '#666', textAlign: 'center', },\n processingContainer: { position: 'absolute', flex: 1, width: Dimensions.get('window').width, height: Dimensions.get('window').height, backgroundColor: 'rgba(0, 0, 0, 0.5)', justifyContent: 'center', alignItems: 'center', zIndex: 10000000, },\n processingText: { fontSize: 16, color: '#fff', textAlign: 'center', fontWeight: 'bold', marginBottom: 10, },\n loadingContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', },\n loadingText: { marginTop: 16, fontSize: 16, color: '#666', textAlign: 'center', },\n errorContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', padding: 20, },\n retryButton: { marginTop: 20, paddingHorizontal: 24, paddingVertical: 12, backgroundColor: '#2DBD60', borderRadius: 8, },\n retryButtonText: { color: '#fff', fontSize: 16, fontWeight: '600', },\n});"]}
|
|
1
|
+
{"version":3,"file":"TemplateKYCFlowRefactored.js","sourceRoot":"","sources":["../../../src/components/TemplateKYCFlowRefactored.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS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,EAAE,KAAK,GAAG;CACjF,CAAC,CAAC","sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions, ScrollView, Platform } from 'react-native';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\nimport { TemplateKYCFlowProvider, useTemplateKYCFlowContext } from '../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../hooks/useI18n';\nimport { showAlert } from '../utils/platformAlert';\nimport { IDCardCapture } from './KYCElements/IDCardCapture';\nimport { SelfieCaptureTemplate } from './KYCElements/SelfieCaptureTemplate';\nimport { FileUploadTemplate } from './KYCElements/FileUploadTemplate';\nimport { LocationCaptureTemplate } from './KYCElements/LocationCaptureTemplate';\nimport { CountrySelectionTemplate } from './KYCElements/CountrySelectionTemplate';\nimport { InitializationStep } from './KYCElements/InitializationStep';\nimport { ReviewSubmitTemplate } from './KYCElements/ReviewSubmitTemplate';\nimport { VerificationProgressTemplate } from './KYCElements/VerificationProgressTemplate';\nimport { useTemplateLoader } from '../hooks/useTemplateLoader';\nimport { WelcomeTemplate } from './KYCElements/WelcomeTemplate';\nimport { EmailVerificationTemplate } from './KYCElements/EmailVerificationTemplate';\nimport { PhoneVerificationTemplate } from './KYCElements/PhoneVerificationTemplate';\nimport { PersonalInformationTemplate } from './KYCElements/PersonalInformationTemplate';\nimport { AdditionalDocumentsTemplate } from './KYCElements/AdditionalDocumentsTemplate';\nimport { KycEnvironment, BackendEnvironment } from '../types/env.types';\nimport KYCConfig from '../config/KYCConfig';\nimport { logger, sdkLogger } from '../utils/logger'; \nimport {\n checkDeviceSecurity,\n getDeviceSecurityViolations,\n type DeviceSecurityCheckResult,\n type DeviceSecurityPolicy,\n type DeviceSecurityViolation,\n} from '../security/deviceSecurity';\n\nexport interface TemplateKYCFlowProps {\n template?: KYCTemplate; \n templateId?: string; \n onComplete?: (data: VerificationState) => void;\n onError?: (error: string) => void;\n language?: string;\n onCancel?: () => void;\n API_KEY?: string; \n TEST_API_KEY?: string;\n env?: KycEnvironment; \n serverEnv?: BackendEnvironment; \n existingSessionId?: string;\n initialComponentIndex?: number;\n initialCountryResume?: { code: string; documentType: string; region?: string };\n referenceId?: string;\n onSessionSave?: (sessionId: string) => void;\n kyc_session_id?: string;\n templateConfig?: Record<string, string>;\n deviceSecurityPolicy?: DeviceSecurityPolicy;\n onDeviceSecurityCheck?: (result: DeviceSecurityCheckResult) => void;\n}\n\nfunction deviceSecurityErrorMessage(\n violations: DeviceSecurityViolation[],\n language: string,\n): string {\n const french = language.toLowerCase().startsWith('fr');\n const labels: Record<DeviceSecurityViolation, string> = french\n ? {\n compromised_device: 'appareil rooté ou jailbreaké',\n developer_mode: 'mode développeur ou débogueur activé',\n emulator: 'émulateur ou simulateur détecté',\n check_unavailable: 'vérification de sécurité indisponible',\n }\n : {\n compromised_device: 'rooted or jailbroken device',\n developer_mode: 'developer mode or debugger enabled',\n emulator: 'emulator or simulator detected',\n check_unavailable: 'device security check unavailable',\n };\n const details = violations.map(violation => labels[violation]).join(', ');\n\n return french\n ? `La vérification d'identité ne peut pas continuer : ${details}.`\n : `Identity verification cannot continue: ${details}.`;\n}\n\nexport const TemplateKYCFlow: React.FC<TemplateKYCFlowProps> = ({\n template: providedTemplate,\n templateId,\n onComplete,\n onError,\n language = 'fr',\n onCancel,\n API_KEY,\n TEST_API_KEY,\n env = 'PRODUCTION',\n serverEnv,\n existingSessionId,\n initialComponentIndex,\n initialCountryResume,\n referenceId,\n onSessionSave,\n kyc_session_id,\n templateConfig,\n deviceSecurityPolicy,\n onDeviceSecurityCheck,\n}) => {\n const { t } = useI18n();\n const { template: loadedTemplate, isLoading, error, loadTemplate } = useTemplateLoader();\n const [resolvedTemplateId, setResolvedTemplateId] = useState<string | undefined>(templateId);\n const [isResolving, setIsResolving] = useState<boolean>(!templateId && !!templateConfig);\n const securityCheckEnabled = Platform.OS !== 'web' && deviceSecurityPolicy?.enabled !== false;\n const enforceSecurity = env === 'PRODUCTION';\n const blockCompromisedDevices = deviceSecurityPolicy?.blockCompromisedDevices ?? enforceSecurity;\n const blockDeveloperMode = deviceSecurityPolicy?.blockDeveloperMode ?? enforceSecurity;\n const blockEmulators = deviceSecurityPolicy?.blockEmulators ?? enforceSecurity;\n const failClosed = deviceSecurityPolicy?.failClosed ?? enforceSecurity;\n const [securityStatus, setSecurityStatus] = useState<'checking' | 'allowed' | 'blocked'>(\n securityCheckEnabled ? 'checking' : 'allowed',\n );\n const [securityError, setSecurityError] = useState('');\n const [securityRetryToken, setSecurityRetryToken] = useState(0);\n const onErrorRef = useRef(onError);\n const onDeviceSecurityCheckRef = useRef(onDeviceSecurityCheck);\n\n useEffect(() => { onErrorRef.current = onError; }, [onError]);\n useEffect(() => { onDeviceSecurityCheckRef.current = onDeviceSecurityCheck; }, [onDeviceSecurityCheck]);\n\n // 🚨 1. Determine the active API key based on the environment\n const activeApiKey = env === 'PRODUCTION' ? API_KEY : (TEST_API_KEY || API_KEY);\n\n useEffect(() => {\n let cancelled = false;\n\n if (!securityCheckEnabled) {\n setSecurityStatus('allowed');\n setSecurityError('');\n return () => { cancelled = true; };\n }\n\n setSecurityStatus('checking');\n setSecurityError('');\n\n const runSecurityCheck = async () => {\n try {\n const result = await checkDeviceSecurity();\n if (cancelled) return;\n\n onDeviceSecurityCheckRef.current?.(result);\n const violations = getDeviceSecurityViolations(result, {\n blockCompromisedDevices,\n blockDeveloperMode,\n blockEmulators,\n failClosed,\n });\n\n sdkLogger.info('Device security check completed', {\n platform: result.platform,\n supported: result.supported,\n isCompromised: result.isCompromised,\n isDeveloperModeEnabled: result.isDeveloperModeEnabled,\n isEmulator: result.isEmulator,\n riskSignals: result.riskSignals,\n blocked: violations.length > 0,\n });\n\n if (violations.length > 0) {\n const message = deviceSecurityErrorMessage(violations, language);\n setSecurityError(message);\n setSecurityStatus('blocked');\n onErrorRef.current?.(message);\n return;\n }\n\n setSecurityStatus('allowed');\n } catch (error: any) {\n if (cancelled) return;\n const unavailableResult: DeviceSecurityCheckResult = {\n platform: Platform.OS === 'android' || Platform.OS === 'ios' ? Platform.OS : 'unknown',\n supported: false,\n isRooted: false,\n isJailbroken: false,\n isEmulator: false,\n isDeveloperModeEnabled: false,\n developerModeCheckSupported: false,\n isDebuggerAttached: false,\n isCompromised: false,\n riskSignals: ['native_device_security_check_failed'],\n checkedAt: new Date().toISOString(),\n };\n onDeviceSecurityCheckRef.current?.(unavailableResult);\n sdkLogger.error('Device security check failed', { error: error?.message });\n\n if (failClosed) {\n const message = deviceSecurityErrorMessage(['check_unavailable'], language);\n setSecurityError(message);\n setSecurityStatus('blocked');\n onErrorRef.current?.(message);\n } else {\n setSecurityStatus('allowed');\n }\n }\n };\n\n void runSecurityCheck();\n return () => { cancelled = true; };\n }, [\n securityCheckEnabled,\n blockCompromisedDevices,\n blockDeveloperMode,\n blockEmulators,\n failClosed,\n securityRetryToken,\n language,\n ]);\n\n useEffect(() => {\n if (activeApiKey) {\n if (sdkLogger.setApiKey) sdkLogger.setApiKey(activeApiKey);\n }\n }, [env, serverEnv, existingSessionId, activeApiKey]);\n\n useEffect(() => {\n if (serverEnv !== undefined) {\n KYCConfig.setBackendEnvironment(serverEnv);\n }\n }, [serverEnv]);\n\n\n useEffect(() => {\n if (securityStatus !== 'allowed') return;\n\n // If a strict templateId is provided, use it immediately and skip geolocation\n if (templateId) {\n setResolvedTemplateId(templateId);\n setIsResolving(false);\n return;\n }\n\n // If neither templateId nor templateConfig is provided, skip to the next effect\n if (!templateConfig) {\n setIsResolving(false);\n return;\n }\n\n const fetchLocationAndRoute = async () => {\n setIsResolving(true);\n let selected = templateConfig['DEFAULT'];\n\n try {\n const response = await fetch('https://ipapi.co/json/');\n const data = await response.json();\n \n // Priority: Exact Country -> Continent -> DEFAULT\n selected = \n templateConfig[data.country_code] || \n templateConfig[data.continent_code] || \n selected;\n\n logger.info('Template dynamically resolved via location', { \n country: data.country_code, \n continent: data.continent_code, \n selected_template: selected \n });\n\n } catch (error) {\n logger.warn('Location detection failed, using default template');\n } finally {\n setResolvedTemplateId(selected);\n setIsResolving(false);\n }\n };\n\n fetchLocationAndRoute();\n }, [templateId, templateConfig, securityStatus]); // Only re-run if the props change\n\n\n\n useEffect(() => {\n if (isResolving || securityStatus !== 'allowed') return;\n\n // Updated error check to include templateConfig\n if (!providedTemplate && !resolvedTemplateId) {\n const errorMsg = 'Either template, templateId, or templateConfig must be provided';\n logger.error(\"Template Loading Failed: Missing Props\", { errorMsg });\n onError?.(errorMsg);\n return;\n }\n\n // Load using the newly resolved ID\n if (resolvedTemplateId && !activeApiKey) {\n logger.log(`Fetching template ${resolvedTemplateId} via token authentication`);\n loadTemplate(resolvedTemplateId);\n } else if (resolvedTemplateId && activeApiKey) {\n logger.log(`Fetching template ${resolvedTemplateId} via API Key`);\n loadTemplate(resolvedTemplateId, activeApiKey);\n }\n }, [resolvedTemplateId, activeApiKey, providedTemplate, loadTemplate, onError, isResolving, securityStatus]);\n\n useEffect(() => {\n if (error) {\n sdkLogger.error(\"Template Fetch Error\", { error });\n onError?.(error);\n }\n }, [error, onError]);\n\n const OnCancel = () => {\n showAlert(\n t('kyc.cancelConfirmation.title'),\n t('kyc.cancelConfirmation.message'),\n [\n {\n text: t('kyc.cancelConfirmation.cancelButton'),\n style: 'cancel',\n },\n {\n text: t('kyc.cancelConfirmation.confirmButton'),\n onPress: () => {\n sdkLogger.warn(\"User confirmed flow cancellation\");\n sdkLogger.flush();\n onCancel?.();\n }\n },\n ]\n );\n };\n\n const template = providedTemplate || loadedTemplate;\n\n if (securityStatus === 'checking') {\n return (\n <View style={styles.loadingContainer}>\n <ActivityIndicator size=\"large\" color=\"#2DBD60\" />\n <Text style={styles.loadingText}>\n {language.toLowerCase().startsWith('fr')\n ? 'Vérification de la sécurité de l’appareil…'\n : 'Checking device security…'}\n </Text>\n </View>\n );\n }\n\n if (securityStatus === 'blocked') {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.securityTitle}>\n {language.toLowerCase().startsWith('fr') ? 'Appareil non sécurisé' : 'Device security issue'}\n </Text>\n <Text style={styles.errorText}>{securityError}</Text>\n <TouchableOpacity\n style={styles.retryButton}\n onPress={() => setSecurityRetryToken(value => value + 1)}\n >\n <Text style={styles.retryButtonText}>\n {language.toLowerCase().startsWith('fr') ? 'Réessayer' : 'Retry'}\n </Text>\n </TouchableOpacity>\n {onCancel ? (\n <TouchableOpacity style={styles.cancelSecurityButton} onPress={onCancel}>\n <Text style={styles.cancelSecurityButtonText}>\n {language.toLowerCase().startsWith('fr') ? 'Annuler' : 'Cancel'}\n </Text>\n </TouchableOpacity>\n ) : null}\n </View>\n );\n }\n\n if (templateId && isLoading && !template) {\n return (\n <View style={styles.loadingContainer}>\n <ActivityIndicator size=\"large\" color=\"#2DBD60\" />\n <Text style={styles.loadingText}>{t('common.loading') || 'Loading template...'}</Text>\n </View>\n );\n }\n\n if (templateId && error && !template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>{error}</Text>\n <TouchableOpacity\n style={styles.retryButton}\n onPress={() => {\n sdkLogger.info(\"User retrying template fetch\");\n loadTemplate(templateId, activeApiKey);\n }}\n >\n <Text style={styles.retryButtonText}>{t('common.retry') || 'Retry'}</Text>\n </TouchableOpacity>\n </View>\n );\n }\n\n if (!template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>\n {t('errors.unknownError') || 'Template not available'}\n </Text>\n </View>\n );\n }\n\n return (\n <TemplateKYCFlowProvider\n template={template}\n onComplete={(data) => {\n sdkLogger.info(\"KYC Flow Completed\", { referenceId: data?.result?.referenceId });\n sdkLogger.flush();\n if (onComplete) onComplete(data);\n }}\n onError={(err) => {\n sdkLogger.error(\"KYC Flow Error\", { error: err });\n sdkLogger.flush();\n logger.log('Error', err)\n if (onError) onError(err);\n }}\n onCancel={OnCancel}\n initialLanguage={language}\n apiKey={activeApiKey}\n testApiKey={TEST_API_KEY} \n env={env}\n existingSessionId={existingSessionId}\n initialComponentIndex={initialComponentIndex}\n initialCountryResume={initialCountryResume}\n referenceId={referenceId}\n onSessionSave={onSessionSave}\n kyc_session_id={kyc_session_id}\n >\n <TemplateKYCFlowContent onCancel={OnCancel} />\n </TemplateKYCFlowProvider>\n );\n};\n\nconst TemplateKYCFlowContent: React.FC<{ onCancel?: () => void }> = ({ onCancel }) => {\n const { state, actions, currentComponent, progress } = useTemplateKYCFlowContext();\n const { t } = useI18n();\n\n\n useEffect(() => {\n if (state.session?.session_id) {\n sdkLogger.setSessionId(state.session.session_id);\n }\n }, [state.session?.session_id]);\n\n useEffect(() => {\n if (currentComponent) {\n sdkLogger.info(`User navigated to step ${state.currentComponentIndex + 1}: ${currentComponent.type}`, {\n componentId: currentComponent.id,\n progress: `${progress}%`\n });\n }\n }, [currentComponent?.id, state.currentComponentIndex, progress]);\n\n const updateComponentData = (componentId: number, data: unknown) => {\n actions.updateComponentData(componentId, data);\n };\n\n if (!currentComponent) {\n return (\n <View style={styles.container}>\n <Text style={styles.errorText}>{t('errors.unknownError')}</Text>\n </View>\n );\n }\n\n const renderCurrentComponent = () => {\n const commonProps = {\n component: currentComponent,\n value: state.componentData[currentComponent.id],\n onValueChange: (data: unknown) => updateComponentData(currentComponent.id, data),\n error: state.errors[currentComponent.id],\n language: state.currentLanguage,\n };\n\n if (!state.session.isInitialized) {\n return <InitializationStep session={state.session} />\n }\n\n switch (currentComponent.type) {\n case 'welcome': return <WelcomeTemplate {...commonProps} />;\n case 'id_card': return <IDCardCapture {...commonProps} />;\n case 'selfie': return <SelfieCaptureTemplate {...commonProps} />;\n case 'file_upload': return <FileUploadTemplate {...commonProps} />;\n case 'location': return <LocationCaptureTemplate {...commonProps} />;\n case 'country_selection': return <CountrySelectionTemplate {...commonProps} />;\n case 'review_submit': return <ReviewSubmitTemplate {...commonProps} />;\n case 'email_verification': return <EmailVerificationTemplate {...commonProps} />;\n case 'phone_verification': return <PhoneVerificationTemplate {...commonProps} />;\n case 'personal_information': return <PersonalInformationTemplate {...commonProps} />;\n case 'additional_documents': return <AdditionalDocumentsTemplate {...commonProps} />;\n case 'verification_progress': return <VerificationProgressTemplate {...commonProps} />;\n default:\n sdkLogger.error(\"Attempted to render unsupported component type\", { type: currentComponent.type });\n return (\n <View style={styles.unsupportedContainer}>\n <Text style={styles.unsupportedText}>\n {t('errors.unknownError')}: {currentComponent.type}\n </Text>\n </View>\n );\n }\n };\n\n return (\n <View style={{ flex: 1, position: 'relative' }}>\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n\n <SafeAreaView style={styles.container}>\n {(state.showCustomStepper && state.session.isInitialized) ? (\n <View style={styles.header}>\n <Text style={styles.progressText}>\n {t('kyc.step', {\n current: (state.template.components.findIndex(c => c.id === currentComponent.id) + 1) || (state.currentComponentIndex + 1),\n total: state.template.components.length,\n })}\n </Text>\n \n <View style={styles.progressContainer}>\n <View style={styles.progressBar}>\n <View style={[styles.progressFill, { width: `${progress}%` }]} />\n </View>\n </View>\n\n <View style={{ position: 'absolute', right: 12, top: 12 }}>\n <TouchableOpacity onPress={onCancel} disabled={!onCancel} style={{ opacity: onCancel ? 1 : 0.5 }}>\n <Text style={{ fontSize: 20, fontWeight: 'bold', color: '#333' }}>{`X`}</Text>\n </TouchableOpacity>\n </View>\n </View>\n ) : null}\n\n {currentComponent.type === 'country_selection' ? (\n <View style={styles.selfScrollingContent}>\n {renderCurrentComponent()}\n </View>\n ) : (\n <ScrollView\n style={styles.scrollView}\n contentContainerStyle={styles.content}\n showsVerticalScrollIndicator={Platform.OS === 'web'}\n bounces={false}\n >\n {renderCurrentComponent()}\n </ScrollView>\n )}\n\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n </SafeAreaView>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { flex: 1, backgroundColor: '#f5f5f5', },\n header: { backgroundColor: 'white', paddingVertical: 20, paddingHorizontal: 12, borderBottomWidth: 1, borderBottomColor: '#e0e0e0', marginHorizontal: 12, marginTop: 12, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.15, shadowRadius: 1.84, elevation: 5, },\n title: { fontSize: 24, fontWeight: 'bold', color: '#333', marginBottom: 8, },\n description: { fontSize: 16, color: '#666', marginBottom: 20, },\n progressContainer: { },\n progressBar: { height: 8, backgroundColor: '#e0e0e0', borderRadius: 4, overflow: 'hidden', },\n progressFill: { height: '100%', backgroundColor: '#2DBD60', borderRadius: 4, },\n progressText: { fontSize: 14, color: 'black', fontWeight: '600', textAlign: 'left', marginBottom: 8, },\n stepInfo: { backgroundColor: '#f8f9fa', padding: 16, borderRadius: 8, borderLeftWidth: 4, borderLeftColor: '#2DBD60', },\n stepTitle: { fontSize: 18, fontWeight: '600', color: '#333', marginBottom: 8, },\n stepDescription: { fontSize: 14, color: '#666', lineHeight: 20, },\n scrollView: { flex: 1, },\n content: { flexGrow: 1, alignItems: 'center', paddingBottom: 20, },\n selfScrollingContent: { flex: 1, minHeight: 0, alignItems: 'center', paddingBottom: 20, },\n navigation: { flexDirection: 'row', justifyContent: 'space-between', padding: 20, backgroundColor: 'white', borderTopWidth: 1, borderTopColor: '#e0e0e0', },\n navButton: { paddingHorizontal: 24, paddingVertical: 12, borderRadius: 8, minWidth: 100, alignItems: 'center', },\n primaryButton: { backgroundColor: '#2DBD60', },\n navButtonText: { fontSize: 16, fontWeight: '600', color: 'white', },\n errorText: { color: '#dc2626', fontSize: 16, textAlign: 'center', margin: 20, },\n unsupportedContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20, },\n unsupportedText: { fontSize: 16, color: '#666', textAlign: 'center', },\n processingContainer: { position: 'absolute', flex: 1, width: Dimensions.get('window').width, height: Dimensions.get('window').height, backgroundColor: 'rgba(0, 0, 0, 0.5)', justifyContent: 'center', alignItems: 'center', zIndex: 10000000, },\n processingText: { fontSize: 16, color: '#fff', textAlign: 'center', fontWeight: 'bold', marginBottom: 10, },\n loadingContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', },\n loadingText: { marginTop: 16, fontSize: 16, color: '#666', textAlign: 'center', },\n errorContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', padding: 20, },\n retryButton: { marginTop: 20, paddingHorizontal: 24, paddingVertical: 12, backgroundColor: '#2DBD60', borderRadius: 8, },\n retryButtonText: { color: '#fff', fontSize: 16, fontWeight: '600', },\n securityTitle: { color: '#991b1b', fontSize: 22, fontWeight: '700', textAlign: 'center', },\n cancelSecurityButton: { marginTop: 12, paddingHorizontal: 24, paddingVertical: 12, },\n cancelSecurityButtonText: { color: '#4b5563', fontSize: 16, fontWeight: '600', },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region_mapping.d.ts","sourceRoot":"","sources":["../../../src/config/region_mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"region_mapping.d.ts","sourceRoot":"","sources":["../../../src/config/region_mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC,CAixB1F,CAAA"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
export const countryMapping = {
|
|
2
|
+
"AU": {
|
|
3
|
+
"passport": {
|
|
4
|
+
"root": [
|
|
5
|
+
{
|
|
6
|
+
"py_file": "australia_pp_01.py",
|
|
7
|
+
"front": "MRZ",
|
|
8
|
+
"mrz_type": "TD3"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"py_file": "australia_pp_02.py",
|
|
12
|
+
"front": "MRZ",
|
|
13
|
+
"mrz_type": "TD3"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
2
18
|
"BE": {
|
|
3
19
|
"passport": {
|
|
4
20
|
"root": [
|
|
@@ -589,6 +605,18 @@ export const countryMapping = {
|
|
|
589
605
|
}
|
|
590
606
|
},
|
|
591
607
|
"KE": {
|
|
608
|
+
"drivers_licence": {
|
|
609
|
+
"root": [
|
|
610
|
+
{
|
|
611
|
+
"py_file": "dl_back.py",
|
|
612
|
+
"keys_found": null
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"py_file": "dl_front.py",
|
|
616
|
+
"keys_found": null
|
|
617
|
+
}
|
|
618
|
+
]
|
|
619
|
+
},
|
|
592
620
|
"identity_card": {
|
|
593
621
|
"root": [
|
|
594
622
|
{
|