@transfergratis/react-native-sdk 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +12 -5
- package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
- package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +61 -59
- package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +12 -5
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +26 -34
- package/android/src/main/AndroidManifest.xml +13 -5
- package/build/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.js +26 -3
- package/build/components/EnhancedCameraView.js.map +1 -1
- package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.web.js +21 -0
- package/build/components/EnhancedCameraView.web.js.map +1 -1
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts +12 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js +283 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js.map +1 -0
- package/build/components/KYCElements/CameraCapture.d.ts.map +1 -1
- package/build/components/KYCElements/CameraCapture.js +4 -3
- package/build/components/KYCElements/CameraCapture.js.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts +5 -2
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.js +360 -101
- package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js +193 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/FileUpload.d.ts.map +1 -1
- package/build/components/KYCElements/FileUpload.js +5 -4
- package/build/components/KYCElements/FileUpload.js.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.js +5 -4
- package/build/components/KYCElements/FileUploadTemplate.js.map +1 -1
- package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/components/KYCElements/IDCardCapture.js +356 -227
- package/build/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.js +78 -37
- package/build/components/KYCElements/LocationCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.js +5 -4
- package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js +120 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js +185 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/SelfieCapture.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCapture.js +4 -3
- package/build/components/KYCElements/SelfieCapture.js.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.js +189 -42
- package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/WelcomeTemplate.d.ts +12 -0
- package/build/components/KYCElements/WelcomeTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/WelcomeTemplate.js +243 -0
- package/build/components/KYCElements/WelcomeTemplate.js.map +1 -0
- package/build/components/TemplateKYCExample.d.ts +8 -2
- package/build/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/components/TemplateKYCExample.js +10 -97
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts +6 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.js +108 -11
- package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
- package/build/components/example/DynamicTemplateExample.d.ts +10 -0
- package/build/components/example/DynamicTemplateExample.d.ts.map +1 -0
- package/build/components/example/DynamicTemplateExample.js +241 -0
- package/build/components/example/DynamicTemplateExample.js.map +1 -0
- package/build/config/KYCConfig.d.ts +14 -0
- package/build/config/KYCConfig.d.ts.map +1 -0
- package/build/config/KYCConfig.js +26 -0
- package/build/config/KYCConfig.js.map +1 -0
- package/build/config/allowedDomains.d.ts +30 -0
- package/build/config/allowedDomains.d.ts.map +1 -0
- package/build/config/allowedDomains.js +112 -0
- package/build/config/allowedDomains.js.map +1 -0
- package/build/hooks/useOrientationVideo.d.ts +2 -1
- package/build/hooks/useOrientationVideo.d.ts.map +1 -1
- package/build/hooks/useOrientationVideo.js +3 -3
- package/build/hooks/useOrientationVideo.js.map +1 -1
- package/build/hooks/useTemplateKYCFlow.d.ts +6 -1
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +317 -34
- package/build/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/hooks/useTemplateLoader.d.ts +14 -0
- package/build/hooks/useTemplateLoader.d.ts.map +1 -0
- package/build/hooks/useTemplateLoader.js +85 -0
- package/build/hooks/useTemplateLoader.js.map +1 -0
- package/build/i18n/en/index.d.ts +49 -0
- package/build/i18n/en/index.d.ts.map +1 -1
- package/build/i18n/en/index.js +50 -1
- package/build/i18n/en/index.js.map +1 -1
- package/build/i18n/fr/index.d.ts +35 -0
- package/build/i18n/fr/index.d.ts.map +1 -1
- package/build/i18n/fr/index.js +36 -1
- package/build/i18n/fr/index.js.map +1 -1
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10 -0
- package/build/index.js.map +1 -1
- package/build/modules/api/CardAuthentification.d.ts +24 -3
- package/build/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/modules/api/CardAuthentification.js +69 -10
- package/build/modules/api/CardAuthentification.js.map +1 -1
- package/build/modules/api/KYCService.d.ts +7 -7
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +108 -39
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/api/SelfieVerification.d.ts +3 -1
- package/build/modules/api/SelfieVerification.d.ts.map +1 -1
- package/build/modules/api/SelfieVerification.js +17 -1
- package/build/modules/api/SelfieVerification.js.map +1 -1
- package/build/modules/api/TemplateService.d.ts +44 -0
- package/build/modules/api/TemplateService.d.ts.map +1 -0
- package/build/modules/api/TemplateService.js +145 -0
- package/build/modules/api/TemplateService.js.map +1 -0
- package/build/types/KYC.types.d.ts +265 -4
- package/build/types/KYC.types.d.ts.map +1 -1
- package/build/types/KYC.types.js +15 -0
- package/build/types/KYC.types.js.map +1 -1
- package/build/types/env.types.d.ts +13 -0
- package/build/types/env.types.d.ts.map +1 -0
- package/build/types/env.types.js +2 -0
- package/build/types/env.types.js.map +1 -0
- package/build/utils/cropByObb.d.ts +1 -0
- package/build/utils/cropByObb.d.ts.map +1 -1
- package/build/utils/cropByObb.js +70 -0
- package/build/utils/cropByObb.js.map +1 -1
- package/build/utils/deviceDetection.d.ts +6 -0
- package/build/utils/deviceDetection.d.ts.map +1 -0
- package/build/utils/deviceDetection.js +12 -0
- package/build/utils/deviceDetection.js.map +1 -0
- package/build/utils/platformAlert.d.ts +20 -0
- package/build/utils/platformAlert.d.ts.map +1 -0
- package/build/utils/platformAlert.js +67 -0
- package/build/utils/platformAlert.js.map +1 -0
- package/build/utils/template-transformer.d.ts +10 -0
- package/build/utils/template-transformer.d.ts.map +1 -0
- package/build/utils/template-transformer.js +365 -0
- package/build/utils/template-transformer.js.map +1 -0
- package/build/web/WebKYCEntry.d.ts.map +1 -1
- package/build/web/WebKYCEntry.js +158 -32
- package/build/web/WebKYCEntry.js.map +1 -1
- package/package.json +1 -1
- package/plugin/build/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.ts +3 -4
- package/src/components/EnhancedCameraView.tsx +31 -2
- package/src/components/EnhancedCameraView.web.tsx +24 -0
- package/src/components/KYCElements/AdditionalDocumentsTemplate.tsx +346 -0
- package/src/components/KYCElements/CameraCapture.tsx +4 -3
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +410 -113
- package/src/components/KYCElements/EmailVerificationTemplate.tsx +264 -0
- package/src/components/KYCElements/FileUpload.tsx +5 -4
- package/src/components/KYCElements/FileUploadTemplate.tsx +5 -4
- package/src/components/KYCElements/IDCardCapture.tsx +397 -254
- package/src/components/KYCElements/LocationCaptureTemplate.tsx +95 -44
- package/src/components/KYCElements/OrientationVideoCapture.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +6 -3
- package/src/components/KYCElements/PersonalInformationTemplate.tsx +158 -0
- package/src/components/KYCElements/PhoneVerificationTemplate.tsx +253 -0
- package/src/components/KYCElements/SelfieCapture.tsx +4 -3
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +201 -44
- package/src/components/KYCElements/WelcomeTemplate.tsx +289 -0
- package/src/components/TemplateKYCExample.tsx +37 -108
- package/src/components/TemplateKYCFlowRefactored.tsx +148 -12
- package/src/components/example/DynamicTemplateExample.tsx +289 -0
- package/src/config/KYCConfig.ts +34 -0
- package/src/config/allowedDomains.ts +133 -0
- package/src/hooks/useOrientationVideo.ts +5 -4
- package/src/hooks/useTemplateKYCFlow.tsx +347 -32
- package/src/hooks/useTemplateLoader.ts +102 -0
- package/src/i18n/en/index.ts +53 -2
- package/src/i18n/fr/index.ts +37 -1
- package/src/index.ts +14 -0
- package/src/modules/api/CardAuthentification.ts +76 -11
- package/src/modules/api/KYCService.ts +129 -45
- package/src/modules/api/SelfieVerification.ts +25 -3
- package/src/modules/api/TemplateService.ts +167 -0
- package/src/types/KYC.types.ts +331 -3
- package/src/types/env.types.ts +13 -0
- package/src/utils/cropByObb.ts +83 -3
- package/src/utils/deviceDetection.ts +11 -0
- package/src/utils/platformAlert.ts +86 -0
- package/src/utils/template-transformer.ts +445 -0
- package/src/web/WebKYCEntry.tsx +199 -50
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import { TemplateComponent, WelcomeConfig, LocalizedText } from '../../types/KYC.types';
|
|
4
|
+
import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
|
|
5
|
+
import { useI18n } from '../../hooks/useI18n';
|
|
6
|
+
import { Button } from '../ui/Button';
|
|
7
|
+
import ShieldIcon from '../Svgs/Schield';
|
|
8
|
+
|
|
9
|
+
interface WelcomeTemplateProps {
|
|
10
|
+
component: TemplateComponent;
|
|
11
|
+
value?: any;
|
|
12
|
+
onValueChange: (data: any) => void;
|
|
13
|
+
error?: string;
|
|
14
|
+
language?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const WelcomeTemplate: React.FC<WelcomeTemplateProps> = ({
|
|
18
|
+
component,
|
|
19
|
+
value,
|
|
20
|
+
onValueChange,
|
|
21
|
+
error,
|
|
22
|
+
}) => {
|
|
23
|
+
const { t } = useI18n();
|
|
24
|
+
const { getLocalizedText, actions } = useTemplateKYCFlowContext();
|
|
25
|
+
const config = component.config as WelcomeConfig;
|
|
26
|
+
|
|
27
|
+
// Consentements cochés par défaut
|
|
28
|
+
const privacyConsent = true;
|
|
29
|
+
const termsConsent = true;
|
|
30
|
+
const [shouldProceed, setShouldProceed] = useState(false);
|
|
31
|
+
|
|
32
|
+
// Get localized text
|
|
33
|
+
const title = getLocalizedText(component.labels as LocalizedText);
|
|
34
|
+
const description = getLocalizedText(component.instructions as LocalizedText);
|
|
35
|
+
const welcomeMessage = config.welcomeMessage || description;
|
|
36
|
+
const buttonText = config.buttonText || getLocalizedText((component.ui as any).buttonText || { en: 'Get Started', fr: 'Commencer' });
|
|
37
|
+
|
|
38
|
+
// Passer à l'étape suivante après que les données sont mises à jour
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (shouldProceed && value && value.consentGiven) {
|
|
41
|
+
// Petit délai pour s'assurer que le state est bien mis à jour
|
|
42
|
+
const timer = setTimeout(() => {
|
|
43
|
+
actions.nextComponent();
|
|
44
|
+
setShouldProceed(false);
|
|
45
|
+
}, 100);
|
|
46
|
+
|
|
47
|
+
return () => clearTimeout(timer);
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}, [value, shouldProceed, actions]);
|
|
51
|
+
|
|
52
|
+
const handleGetStarted = () => {
|
|
53
|
+
// Mark component as complete
|
|
54
|
+
const consentData = { consentGiven: true, privacyConsent, termsConsent };
|
|
55
|
+
onValueChange(consentData);
|
|
56
|
+
setShouldProceed(true);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<View style={styles.container}>
|
|
61
|
+
<View style={{ flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
|
62
|
+
{/* Icon Section */}
|
|
63
|
+
<View style={{ position: 'relative', width: 70 }}>
|
|
64
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', width: 60, height: 60, backgroundColor: '#2DBE60', borderRadius: 100 }}>
|
|
65
|
+
<ShieldIcon />
|
|
66
|
+
</View>
|
|
67
|
+
<View style={{ position: 'absolute', top: '60%', right: 0, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', width: 40, height: 40, backgroundColor: 'white', borderRadius: 100, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.15, shadowRadius: 1.84, elevation: 5 }}>
|
|
68
|
+
<Text style={{ fontSize: 20, color: '#2DBE60' }}>✓</Text>
|
|
69
|
+
</View>
|
|
70
|
+
</View>
|
|
71
|
+
|
|
72
|
+
{/* Title and Description */}
|
|
73
|
+
<View style={{ flexDirection: 'column', alignItems: 'center', justifyContent: 'center', marginTop: 36 }}>
|
|
74
|
+
<Text style={styles.title}>{title}</Text>
|
|
75
|
+
{welcomeMessage && (
|
|
76
|
+
<Text style={styles.description}>
|
|
77
|
+
{welcomeMessage}
|
|
78
|
+
</Text>
|
|
79
|
+
)}
|
|
80
|
+
</View>
|
|
81
|
+
|
|
82
|
+
{/* Requirements List */}
|
|
83
|
+
{config.requirements && config.requirements.length > 0 && (
|
|
84
|
+
<View style={styles.requirementsSection}>
|
|
85
|
+
<Text style={styles.sectionTitle}>
|
|
86
|
+
{t('kyc.welcome.requirements') || `What you'll need:`}
|
|
87
|
+
</Text>
|
|
88
|
+
{config.requirements.map((requirement, index) => (
|
|
89
|
+
<View key={index} style={styles.requirementItem}>
|
|
90
|
+
<Text style={styles.checkmark}>✓</Text>
|
|
91
|
+
<Text style={styles.requirementText}>{requirement}</Text>
|
|
92
|
+
</View>
|
|
93
|
+
))}
|
|
94
|
+
</View>
|
|
95
|
+
)}
|
|
96
|
+
|
|
97
|
+
{/* Estimated Time */}
|
|
98
|
+
{config.showEstimatedTime !== false && config.estimatedTime && (
|
|
99
|
+
<View style={styles.timeSection}>
|
|
100
|
+
<Text style={styles.timeLabel}>
|
|
101
|
+
{t('kyc.welcome.estimatedTime') || 'Estimated time:'}
|
|
102
|
+
</Text>
|
|
103
|
+
<Text style={styles.timeValue}>{config.estimatedTime}</Text>
|
|
104
|
+
</View>
|
|
105
|
+
)}
|
|
106
|
+
|
|
107
|
+
{/* Consent Options - Hidden by default as they're pre-checked */}
|
|
108
|
+
{(config.consentOptions?.showPrivacyPolicy || config.consentOptions?.showTermsOfService || config.consentOptions?.showMarketingConsent) && (
|
|
109
|
+
<View style={styles.consentSection}>
|
|
110
|
+
{config.consentOptions.showPrivacyPolicy && (
|
|
111
|
+
<View style={styles.consentItem}>
|
|
112
|
+
<View style={[styles.checkbox, styles.checkboxChecked]}>
|
|
113
|
+
<Text style={styles.checkmarkSmall}>✓</Text>
|
|
114
|
+
</View>
|
|
115
|
+
<Text style={styles.consentText}>
|
|
116
|
+
{t('kyc.welcome.privacyPolicy') || 'I agree to the Privacy Policy'}
|
|
117
|
+
</Text>
|
|
118
|
+
</View>
|
|
119
|
+
)}
|
|
120
|
+
|
|
121
|
+
{config.consentOptions.showTermsOfService && (
|
|
122
|
+
<View style={styles.consentItem}>
|
|
123
|
+
<View style={[styles.checkbox, styles.checkboxChecked]}>
|
|
124
|
+
<Text style={styles.checkmarkSmall}>✓</Text>
|
|
125
|
+
</View>
|
|
126
|
+
<Text style={styles.consentText}>
|
|
127
|
+
{t('kyc.welcome.termsOfService') || 'I agree to the Terms of Service'}
|
|
128
|
+
</Text>
|
|
129
|
+
</View>
|
|
130
|
+
)}
|
|
131
|
+
|
|
132
|
+
{config.consentOptions.showMarketingConsent && (
|
|
133
|
+
<View style={styles.consentItem}>
|
|
134
|
+
<View style={[styles.checkbox, styles.checkboxChecked]}>
|
|
135
|
+
<Text style={styles.checkmarkSmall}>✓</Text>
|
|
136
|
+
</View>
|
|
137
|
+
<Text style={styles.consentText}>
|
|
138
|
+
{t('kyc.welcome.marketingConsent') || 'I agree to receive marketing communications'}
|
|
139
|
+
</Text>
|
|
140
|
+
</View>
|
|
141
|
+
)}
|
|
142
|
+
</View>
|
|
143
|
+
)}
|
|
144
|
+
|
|
145
|
+
{error && (
|
|
146
|
+
<View style={styles.errorContainer}>
|
|
147
|
+
<Text style={styles.errorText}>{error}</Text>
|
|
148
|
+
</View>
|
|
149
|
+
)}
|
|
150
|
+
|
|
151
|
+
{/* Get Started Button */}
|
|
152
|
+
<Button
|
|
153
|
+
title={buttonText}
|
|
154
|
+
fullWidth
|
|
155
|
+
onPress={handleGetStarted}
|
|
156
|
+
style={{ paddingVertical: 20, marginTop: 36 }}
|
|
157
|
+
/>
|
|
158
|
+
|
|
159
|
+
<View style={{ height: 12 }} />
|
|
160
|
+
</View>
|
|
161
|
+
</View>
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const styles = StyleSheet.create({
|
|
166
|
+
container: {
|
|
167
|
+
padding: 16,
|
|
168
|
+
backgroundColor: 'white',
|
|
169
|
+
marginHorizontal: 12,
|
|
170
|
+
marginTop: 12,
|
|
171
|
+
borderRadius: 12,
|
|
172
|
+
shadowColor: '#000',
|
|
173
|
+
shadowOffset: { width: 0, height: 2 },
|
|
174
|
+
shadowOpacity: 0.15,
|
|
175
|
+
shadowRadius: 1.84,
|
|
176
|
+
elevation: 3,
|
|
177
|
+
maxWidth: 760,
|
|
178
|
+
},
|
|
179
|
+
title: {
|
|
180
|
+
fontSize: 24,
|
|
181
|
+
fontWeight: 'bold',
|
|
182
|
+
color: '#333',
|
|
183
|
+
marginBottom: 8,
|
|
184
|
+
textAlign: 'center',
|
|
185
|
+
},
|
|
186
|
+
description: {
|
|
187
|
+
fontSize: 16,
|
|
188
|
+
color: '#666',
|
|
189
|
+
textAlign: 'center',
|
|
190
|
+
marginBottom: 24,
|
|
191
|
+
lineHeight: 22,
|
|
192
|
+
},
|
|
193
|
+
requirementsSection: {
|
|
194
|
+
backgroundColor: '#F9FAFB',
|
|
195
|
+
padding: 12,
|
|
196
|
+
borderRadius: 12,
|
|
197
|
+
width: '100%',
|
|
198
|
+
marginTop: 24,
|
|
199
|
+
},
|
|
200
|
+
sectionTitle: {
|
|
201
|
+
fontSize: 16,
|
|
202
|
+
fontWeight: 'bold',
|
|
203
|
+
color: 'black',
|
|
204
|
+
marginBottom: 12,
|
|
205
|
+
textAlign: 'left',
|
|
206
|
+
},
|
|
207
|
+
requirementItem: {
|
|
208
|
+
flexDirection: 'row',
|
|
209
|
+
alignItems: 'center',
|
|
210
|
+
marginBottom: 8,
|
|
211
|
+
},
|
|
212
|
+
checkmark: {
|
|
213
|
+
fontSize: 18,
|
|
214
|
+
color: '#2DBD60',
|
|
215
|
+
marginRight: 12,
|
|
216
|
+
fontWeight: 'bold',
|
|
217
|
+
},
|
|
218
|
+
requirementText: {
|
|
219
|
+
flex: 1,
|
|
220
|
+
fontSize: 16,
|
|
221
|
+
color: '#666',
|
|
222
|
+
textAlign: 'left',
|
|
223
|
+
lineHeight: 22,
|
|
224
|
+
},
|
|
225
|
+
timeSection: {
|
|
226
|
+
backgroundColor: '#F9FAFB',
|
|
227
|
+
padding: 12,
|
|
228
|
+
borderRadius: 12,
|
|
229
|
+
marginTop: 16,
|
|
230
|
+
alignItems: 'center',
|
|
231
|
+
width: '100%',
|
|
232
|
+
},
|
|
233
|
+
timeLabel: {
|
|
234
|
+
fontSize: 14,
|
|
235
|
+
color: '#666',
|
|
236
|
+
marginBottom: 4,
|
|
237
|
+
},
|
|
238
|
+
timeValue: {
|
|
239
|
+
fontSize: 20,
|
|
240
|
+
fontWeight: 'bold',
|
|
241
|
+
color: '#2DBD60',
|
|
242
|
+
},
|
|
243
|
+
consentSection: {
|
|
244
|
+
width: '100%',
|
|
245
|
+
marginTop: 24,
|
|
246
|
+
},
|
|
247
|
+
consentItem: {
|
|
248
|
+
flexDirection: 'row',
|
|
249
|
+
alignItems: 'center',
|
|
250
|
+
marginBottom: 12,
|
|
251
|
+
},
|
|
252
|
+
checkbox: {
|
|
253
|
+
width: 20,
|
|
254
|
+
height: 20,
|
|
255
|
+
borderWidth: 2,
|
|
256
|
+
borderColor: '#ddd',
|
|
257
|
+
borderRadius: 4,
|
|
258
|
+
marginRight: 12,
|
|
259
|
+
alignItems: 'center',
|
|
260
|
+
justifyContent: 'center',
|
|
261
|
+
},
|
|
262
|
+
checkboxChecked: {
|
|
263
|
+
backgroundColor: '#2DBD60',
|
|
264
|
+
borderColor: '#2DBD60',
|
|
265
|
+
},
|
|
266
|
+
checkmarkSmall: {
|
|
267
|
+
fontSize: 14,
|
|
268
|
+
color: 'white',
|
|
269
|
+
fontWeight: 'bold',
|
|
270
|
+
},
|
|
271
|
+
consentText: {
|
|
272
|
+
flex: 1,
|
|
273
|
+
fontSize: 15,
|
|
274
|
+
color: '#333',
|
|
275
|
+
lineHeight: 22,
|
|
276
|
+
},
|
|
277
|
+
errorContainer: {
|
|
278
|
+
backgroundColor: '#fee',
|
|
279
|
+
padding: 12,
|
|
280
|
+
borderRadius: 8,
|
|
281
|
+
marginTop: 16,
|
|
282
|
+
width: '100%',
|
|
283
|
+
},
|
|
284
|
+
errorText: {
|
|
285
|
+
color: '#dc2626',
|
|
286
|
+
fontSize: 14,
|
|
287
|
+
textAlign: 'center',
|
|
288
|
+
},
|
|
289
|
+
});
|
|
@@ -2,8 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { View, SafeAreaView } from 'react-native';
|
|
3
3
|
import { TemplateKYCFlow } from './TemplateKYCFlowRefactored';
|
|
4
4
|
import { KYCTemplate, VerificationState } from '../types/KYC.types';
|
|
5
|
+
import { KycEnvironment } from '../types/env.types';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
|
|
6
|
-
// Template JSON basé sur votre exemple
|
|
7
10
|
const advancedVerificationTemplate: KYCTemplate = {
|
|
8
11
|
id: 1,
|
|
9
12
|
name: {
|
|
@@ -103,74 +106,7 @@ const advancedVerificationTemplate: KYCTemplate = {
|
|
|
103
106
|
allowed_formats: ["jpg", "png"],
|
|
104
107
|
max_size_mb: 5,
|
|
105
108
|
document_types: ["drivers_licence", "passport", "drivers_licence", "national_id"],
|
|
106
|
-
bbox_configs: {
|
|
107
|
-
drivers_licence: {
|
|
108
|
-
xMin: 20,
|
|
109
|
-
yMin: 140,
|
|
110
|
-
xMax: 370,
|
|
111
|
-
yMax: 340,
|
|
112
|
-
borderColor: "#2DBD60",
|
|
113
|
-
borderWidth: 4,
|
|
114
|
-
cornerRadius: 12
|
|
115
|
-
},
|
|
116
|
-
passport: {
|
|
117
|
-
xMin: 15,
|
|
118
|
-
yMin: 130,
|
|
119
|
-
xMax: 375,
|
|
120
|
-
yMax: 350,
|
|
121
|
-
borderColor: "#007AFF",
|
|
122
|
-
borderWidth: 4,
|
|
123
|
-
cornerRadius: 8
|
|
124
|
-
},
|
|
125
|
-
identity_card: {
|
|
126
|
-
xMin: 20,
|
|
127
|
-
yMin: 140,
|
|
128
|
-
xMax: 370,
|
|
129
|
-
yMax: 340,
|
|
130
|
-
borderColor: "#2DBD60",
|
|
131
|
-
borderWidth: 4,
|
|
132
|
-
cornerRadius: 12
|
|
133
|
-
},
|
|
134
|
-
health_insurance_card: {
|
|
135
|
-
xMin: 20,
|
|
136
|
-
yMin: 140,
|
|
137
|
-
xMax: 370,
|
|
138
|
-
yMax: 340,
|
|
139
|
-
borderColor: "#2DBD60",
|
|
140
|
-
borderWidth: 4,
|
|
141
|
-
cornerRadius: 12
|
|
142
|
-
},
|
|
143
|
-
national_id: {
|
|
144
|
-
xMin: 20,
|
|
145
|
-
yMin: 140,
|
|
146
|
-
xMax: 370,
|
|
147
|
-
yMax: 340,
|
|
148
|
-
borderColor: "#5856D6",
|
|
149
|
-
borderWidth: 4,
|
|
150
|
-
cornerRadius: 12
|
|
151
|
-
},
|
|
152
|
-
permanent_residence: {
|
|
153
|
-
xMin: 20,
|
|
154
|
-
yMin: 140,
|
|
155
|
-
xMax: 370,
|
|
156
|
-
yMax: 340,
|
|
157
|
-
borderColor: "#2DBD60",
|
|
158
|
-
borderWidth: 4,
|
|
159
|
-
cornerRadius: 12
|
|
160
|
-
},
|
|
161
|
-
|
|
162
109
|
|
|
163
|
-
work_permit: {
|
|
164
|
-
xMin: 20,
|
|
165
|
-
yMin: 140,
|
|
166
|
-
xMax: 370,
|
|
167
|
-
yMax: 340,
|
|
168
|
-
borderColor: "#2DBD60",
|
|
169
|
-
borderWidth: 4,
|
|
170
|
-
cornerRadius: 12
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
}
|
|
174
110
|
} as const
|
|
175
111
|
},
|
|
176
112
|
{
|
|
@@ -197,34 +133,21 @@ const advancedVerificationTemplate: KYCTemplate = {
|
|
|
197
133
|
orientations: ["center", "left", "right"]
|
|
198
134
|
} as const
|
|
199
135
|
},
|
|
200
|
-
// {
|
|
201
|
-
// id: 4,
|
|
202
|
-
// type: "file_upload" as const,
|
|
203
|
-
// order: 6,
|
|
204
|
-
// labels: {
|
|
205
|
-
// en: "Upload proof of address",
|
|
206
|
-
// fr: "Téléversez un justificatif de domicile"
|
|
207
|
-
// },
|
|
208
|
-
// instructions: {
|
|
209
|
-
// en: "Upload a recent utility bill or bank statement (PDF, JPG, PNG).",
|
|
210
|
-
// fr: "Téléversez une facture récente ou un relevé bancaire (PDF, JPG, PNG)."
|
|
211
|
-
// },
|
|
212
|
-
// ui: {
|
|
213
|
-
// icon: "file-upload-icon.png",
|
|
214
|
-
// themeColor: "#2DBD60",
|
|
215
|
-
// buttonText: { en: "Upload", fr: "Téléverser" }
|
|
216
|
-
// },
|
|
217
|
-
// config: {
|
|
218
|
-
// allowed_formats: ["pdf", "jpg", "png"],
|
|
219
|
-
// max_size_mb: 10,
|
|
220
|
-
// required: true
|
|
221
|
-
// } as const
|
|
222
|
-
// },
|
|
223
|
-
|
|
224
136
|
]
|
|
225
137
|
};
|
|
226
138
|
|
|
227
|
-
export const TemplateKYCExample: React.FC<{
|
|
139
|
+
export const TemplateKYCExample: React.FC<{
|
|
140
|
+
onComplete: (data: VerificationState) => void;
|
|
141
|
+
onCancel: () => void;
|
|
142
|
+
onError: (error: string) => void;
|
|
143
|
+
language: string;
|
|
144
|
+
API_KEY?: string;
|
|
145
|
+
templateId?: string;
|
|
146
|
+
template?: KYCTemplate;
|
|
147
|
+
env?: KycEnvironment;
|
|
148
|
+
existingSessionId?: string;
|
|
149
|
+
initialStep?: number;
|
|
150
|
+
}> = ({ onComplete, onCancel, onError, language, API_KEY, templateId, template, env = 'PRODUCTION', existingSessionId, initialStep }) => {
|
|
228
151
|
const handleComplete = (data: VerificationState) => {
|
|
229
152
|
console.log('KYC Template completed with data:', data);
|
|
230
153
|
onComplete(data);
|
|
@@ -238,24 +161,30 @@ export const TemplateKYCExample: React.FC<{ onComplete: (data: VerificationState
|
|
|
238
161
|
|
|
239
162
|
const handleError = (error: string) => {
|
|
240
163
|
console.error('KYC Template error:', error);
|
|
241
|
-
|
|
164
|
+
onError(error);
|
|
242
165
|
};
|
|
243
|
-
|
|
166
|
+
|
|
167
|
+
// Transform backend template to SDK format
|
|
168
|
+
// Determine which template to use: prefer templateId for dynamic loading, then template prop, then fallback to hardcoded
|
|
169
|
+
const templateToUse = templateId ? undefined : (template || advancedVerificationTemplate);
|
|
244
170
|
|
|
245
171
|
return (
|
|
246
|
-
<SafeAreaView style={{ flex: 1
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
172
|
+
<SafeAreaView style={{ flex: 1, paddingVertical: 25 }}>
|
|
173
|
+
<View style={{ flex: 1 }}>
|
|
174
|
+
<TemplateKYCFlow
|
|
175
|
+
template={templateToUse}
|
|
176
|
+
templateId={templateId}
|
|
177
|
+
onComplete={handleComplete}
|
|
178
|
+
onError={handleError}
|
|
179
|
+
onCancel={handleCancel}
|
|
180
|
+
language={language} // ou "en" pour l'anglais
|
|
181
|
+
API_KEY={API_KEY}
|
|
182
|
+
env={env}
|
|
183
|
+
existingSessionId={existingSessionId}
|
|
184
|
+
initialStep={initialStep}
|
|
185
|
+
/>
|
|
186
|
+
</View>
|
|
187
|
+
</SafeAreaView>
|
|
258
188
|
);
|
|
259
189
|
};
|
|
260
190
|
|
|
261
|
-
|