@transfergratis/react-native-sdk 0.1.22 → 0.1.24
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/src/main/AndroidManifest.xml +9 -4
- 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/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/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 +193 -237
- 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.js +3 -2
- package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js +3 -2
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js +3 -2
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
- 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 +182 -39
- 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 +4 -2
- package/build/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/components/TemplateKYCExample.js +5 -68
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts +2 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.js +95 -9
- 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/allowedDomains.d.ts +30 -0
- package/build/config/allowedDomains.d.ts.map +1 -0
- package/build/config/allowedDomains.js +127 -0
- package/build/config/allowedDomains.js.map +1 -0
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +68 -43
- 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 +9 -0
- package/build/i18n/en/index.d.ts.map +1 -1
- package/build/i18n/en/index.js +9 -0
- package/build/i18n/en/index.js.map +1 -1
- package/build/i18n/fr/index.d.ts +9 -0
- package/build/i18n/fr/index.d.ts.map +1 -1
- package/build/i18n/fr/index.js +9 -0
- package/build/i18n/fr/index.js.map +1 -1
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/modules/api/CardAuthentification.js +1 -0
- package/build/modules/api/CardAuthentification.js.map +1 -1
- package/build/modules/api/KYCService.d.ts +4 -1
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +17 -5
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/api/TemplateService.d.ts +45 -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/modules/api/types.d.ts +1 -0
- package/build/modules/api/types.d.ts.map +1 -1
- package/build/modules/api/types.js.map +1 -1
- package/build/types/KYC.types.d.ts +144 -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/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/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 +353 -0
- package/build/utils/template-transformer.js.map +1 -0
- package/build/web/WebKYCEntry.d.ts.map +1 -1
- package/build/web/WebKYCEntry.js +102 -20
- package/build/web/WebKYCEntry.js.map +1 -1
- package/package.json +1 -1
- package/src/components/EnhancedCameraView.tsx +31 -2
- package/src/components/EnhancedCameraView.web.tsx +24 -0
- package/src/components/KYCElements/CameraCapture.tsx +4 -3
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +410 -113
- package/src/components/KYCElements/FileUpload.tsx +5 -4
- package/src/components/KYCElements/FileUploadTemplate.tsx +5 -4
- package/src/components/KYCElements/IDCardCapture.tsx +196 -254
- package/src/components/KYCElements/LocationCaptureTemplate.tsx +95 -44
- package/src/components/KYCElements/OrientationVideoCapture.tsx +2 -2
- package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +2 -2
- package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +2 -2
- package/src/components/KYCElements/SelfieCapture.tsx +4 -3
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +195 -41
- package/src/components/KYCElements/WelcomeTemplate.tsx +289 -0
- package/src/components/TemplateKYCExample.tsx +16 -71
- package/src/components/TemplateKYCFlowRefactored.tsx +121 -11
- package/src/components/example/DynamicTemplateExample.tsx +289 -0
- package/src/config/allowedDomains.ts +152 -0
- package/src/hooks/useTemplateKYCFlow.tsx +71 -46
- package/src/hooks/useTemplateLoader.ts +102 -0
- package/src/i18n/en/index.ts +10 -0
- package/src/i18n/fr/index.ts +9 -0
- package/src/index.ts +11 -0
- package/src/modules/api/CardAuthentification.ts +1 -1
- package/src/modules/api/KYCService.ts +18 -8
- package/src/modules/api/TemplateService.ts +167 -0
- package/src/modules/api/types.ts +1 -0
- package/src/types/KYC.types.ts +188 -3
- package/src/utils/cropByObb.ts +83 -3
- package/src/utils/platformAlert.ts +85 -0
- package/src/utils/template-transformer.ts +433 -0
- package/src/web/WebKYCEntry.tsx +122 -24
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
|
|
4
|
+
import { useI18n } from '../../hooks/useI18n';
|
|
5
|
+
import { Button } from '../ui/Button';
|
|
6
|
+
import ShieldIcon from '../Svgs/Schield';
|
|
7
|
+
export const WelcomeTemplate = ({ component, value, onValueChange, error, }) => {
|
|
8
|
+
const { t } = useI18n();
|
|
9
|
+
const { getLocalizedText, actions } = useTemplateKYCFlowContext();
|
|
10
|
+
const config = component.config;
|
|
11
|
+
// Consentements cochés par défaut
|
|
12
|
+
const privacyConsent = true;
|
|
13
|
+
const termsConsent = true;
|
|
14
|
+
const [shouldProceed, setShouldProceed] = useState(false);
|
|
15
|
+
// Get localized text
|
|
16
|
+
const title = getLocalizedText(component.labels);
|
|
17
|
+
const description = getLocalizedText(component.instructions);
|
|
18
|
+
const welcomeMessage = config.welcomeMessage || description;
|
|
19
|
+
const buttonText = config.buttonText || getLocalizedText(component.ui.buttonText || { en: 'Get Started', fr: 'Commencer' });
|
|
20
|
+
// Passer à l'étape suivante après que les données sont mises à jour
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (shouldProceed && value && value.consentGiven) {
|
|
23
|
+
// Petit délai pour s'assurer que le state est bien mis à jour
|
|
24
|
+
const timer = setTimeout(() => {
|
|
25
|
+
actions.nextComponent();
|
|
26
|
+
setShouldProceed(false);
|
|
27
|
+
}, 100);
|
|
28
|
+
return () => clearTimeout(timer);
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}, [value, shouldProceed, actions]);
|
|
32
|
+
const handleGetStarted = () => {
|
|
33
|
+
// Mark component as complete
|
|
34
|
+
const consentData = { consentGiven: true, privacyConsent, termsConsent };
|
|
35
|
+
onValueChange(consentData);
|
|
36
|
+
setShouldProceed(true);
|
|
37
|
+
};
|
|
38
|
+
return (<View style={styles.container}>
|
|
39
|
+
<View style={{ flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
|
|
40
|
+
{/* Icon Section */}
|
|
41
|
+
<View style={{ position: 'relative', width: 70 }}>
|
|
42
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', width: 60, height: 60, backgroundColor: '#2DBE60', borderRadius: 100 }}>
|
|
43
|
+
<ShieldIcon />
|
|
44
|
+
</View>
|
|
45
|
+
<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 }}>
|
|
46
|
+
<Text style={{ fontSize: 20, color: '#2DBE60' }}>✓</Text>
|
|
47
|
+
</View>
|
|
48
|
+
</View>
|
|
49
|
+
|
|
50
|
+
{/* Title and Description */}
|
|
51
|
+
<View style={{ flexDirection: 'column', alignItems: 'center', justifyContent: 'center', marginTop: 36 }}>
|
|
52
|
+
<Text style={styles.title}>{title}</Text>
|
|
53
|
+
{welcomeMessage && (<Text style={styles.description}>
|
|
54
|
+
{welcomeMessage}
|
|
55
|
+
</Text>)}
|
|
56
|
+
</View>
|
|
57
|
+
|
|
58
|
+
{/* Requirements List */}
|
|
59
|
+
{config.requirements && config.requirements.length > 0 && (<View style={styles.requirementsSection}>
|
|
60
|
+
<Text style={styles.sectionTitle}>
|
|
61
|
+
{t('kyc.welcome.requirements') || `What you'll need:`}
|
|
62
|
+
</Text>
|
|
63
|
+
{config.requirements.map((requirement, index) => (<View key={index} style={styles.requirementItem}>
|
|
64
|
+
<Text style={styles.checkmark}>✓</Text>
|
|
65
|
+
<Text style={styles.requirementText}>{requirement}</Text>
|
|
66
|
+
</View>))}
|
|
67
|
+
</View>)}
|
|
68
|
+
|
|
69
|
+
{/* Estimated Time */}
|
|
70
|
+
{config.showEstimatedTime !== false && config.estimatedTime && (<View style={styles.timeSection}>
|
|
71
|
+
<Text style={styles.timeLabel}>
|
|
72
|
+
{t('kyc.welcome.estimatedTime') || 'Estimated time:'}
|
|
73
|
+
</Text>
|
|
74
|
+
<Text style={styles.timeValue}>{config.estimatedTime}</Text>
|
|
75
|
+
</View>)}
|
|
76
|
+
|
|
77
|
+
{/* Consent Options - Hidden by default as they're pre-checked */}
|
|
78
|
+
{(config.consentOptions?.showPrivacyPolicy || config.consentOptions?.showTermsOfService || config.consentOptions?.showMarketingConsent) && (<View style={styles.consentSection}>
|
|
79
|
+
{config.consentOptions.showPrivacyPolicy && (<View style={styles.consentItem}>
|
|
80
|
+
<View style={[styles.checkbox, styles.checkboxChecked]}>
|
|
81
|
+
<Text style={styles.checkmarkSmall}>✓</Text>
|
|
82
|
+
</View>
|
|
83
|
+
<Text style={styles.consentText}>
|
|
84
|
+
{t('kyc.welcome.privacyPolicy') || 'I agree to the Privacy Policy'}
|
|
85
|
+
</Text>
|
|
86
|
+
</View>)}
|
|
87
|
+
|
|
88
|
+
{config.consentOptions.showTermsOfService && (<View style={styles.consentItem}>
|
|
89
|
+
<View style={[styles.checkbox, styles.checkboxChecked]}>
|
|
90
|
+
<Text style={styles.checkmarkSmall}>✓</Text>
|
|
91
|
+
</View>
|
|
92
|
+
<Text style={styles.consentText}>
|
|
93
|
+
{t('kyc.welcome.termsOfService') || 'I agree to the Terms of Service'}
|
|
94
|
+
</Text>
|
|
95
|
+
</View>)}
|
|
96
|
+
|
|
97
|
+
{config.consentOptions.showMarketingConsent && (<View style={styles.consentItem}>
|
|
98
|
+
<View style={[styles.checkbox, styles.checkboxChecked]}>
|
|
99
|
+
<Text style={styles.checkmarkSmall}>✓</Text>
|
|
100
|
+
</View>
|
|
101
|
+
<Text style={styles.consentText}>
|
|
102
|
+
{t('kyc.welcome.marketingConsent') || 'I agree to receive marketing communications'}
|
|
103
|
+
</Text>
|
|
104
|
+
</View>)}
|
|
105
|
+
</View>)}
|
|
106
|
+
|
|
107
|
+
{error && (<View style={styles.errorContainer}>
|
|
108
|
+
<Text style={styles.errorText}>{error}</Text>
|
|
109
|
+
</View>)}
|
|
110
|
+
|
|
111
|
+
{/* Get Started Button */}
|
|
112
|
+
<Button title={buttonText} fullWidth onPress={handleGetStarted} style={{ paddingVertical: 20, marginTop: 36 }}/>
|
|
113
|
+
|
|
114
|
+
<View style={{ height: 12 }}/>
|
|
115
|
+
</View>
|
|
116
|
+
</View>);
|
|
117
|
+
};
|
|
118
|
+
const styles = StyleSheet.create({
|
|
119
|
+
container: {
|
|
120
|
+
padding: 16,
|
|
121
|
+
backgroundColor: 'white',
|
|
122
|
+
marginHorizontal: 12,
|
|
123
|
+
marginTop: 12,
|
|
124
|
+
borderRadius: 12,
|
|
125
|
+
shadowColor: '#000',
|
|
126
|
+
shadowOffset: { width: 0, height: 2 },
|
|
127
|
+
shadowOpacity: 0.15,
|
|
128
|
+
shadowRadius: 1.84,
|
|
129
|
+
elevation: 3,
|
|
130
|
+
maxWidth: 760,
|
|
131
|
+
},
|
|
132
|
+
title: {
|
|
133
|
+
fontSize: 24,
|
|
134
|
+
fontWeight: 'bold',
|
|
135
|
+
color: '#333',
|
|
136
|
+
marginBottom: 8,
|
|
137
|
+
textAlign: 'center',
|
|
138
|
+
},
|
|
139
|
+
description: {
|
|
140
|
+
fontSize: 16,
|
|
141
|
+
color: '#666',
|
|
142
|
+
textAlign: 'center',
|
|
143
|
+
marginBottom: 24,
|
|
144
|
+
lineHeight: 22,
|
|
145
|
+
},
|
|
146
|
+
requirementsSection: {
|
|
147
|
+
backgroundColor: '#F9FAFB',
|
|
148
|
+
padding: 12,
|
|
149
|
+
borderRadius: 12,
|
|
150
|
+
width: '100%',
|
|
151
|
+
marginTop: 24,
|
|
152
|
+
},
|
|
153
|
+
sectionTitle: {
|
|
154
|
+
fontSize: 16,
|
|
155
|
+
fontWeight: 'bold',
|
|
156
|
+
color: 'black',
|
|
157
|
+
marginBottom: 12,
|
|
158
|
+
textAlign: 'left',
|
|
159
|
+
},
|
|
160
|
+
requirementItem: {
|
|
161
|
+
flexDirection: 'row',
|
|
162
|
+
alignItems: 'center',
|
|
163
|
+
marginBottom: 8,
|
|
164
|
+
},
|
|
165
|
+
checkmark: {
|
|
166
|
+
fontSize: 18,
|
|
167
|
+
color: '#2DBD60',
|
|
168
|
+
marginRight: 12,
|
|
169
|
+
fontWeight: 'bold',
|
|
170
|
+
},
|
|
171
|
+
requirementText: {
|
|
172
|
+
flex: 1,
|
|
173
|
+
fontSize: 16,
|
|
174
|
+
color: '#666',
|
|
175
|
+
textAlign: 'left',
|
|
176
|
+
lineHeight: 22,
|
|
177
|
+
},
|
|
178
|
+
timeSection: {
|
|
179
|
+
backgroundColor: '#F9FAFB',
|
|
180
|
+
padding: 12,
|
|
181
|
+
borderRadius: 12,
|
|
182
|
+
marginTop: 16,
|
|
183
|
+
alignItems: 'center',
|
|
184
|
+
width: '100%',
|
|
185
|
+
},
|
|
186
|
+
timeLabel: {
|
|
187
|
+
fontSize: 14,
|
|
188
|
+
color: '#666',
|
|
189
|
+
marginBottom: 4,
|
|
190
|
+
},
|
|
191
|
+
timeValue: {
|
|
192
|
+
fontSize: 20,
|
|
193
|
+
fontWeight: 'bold',
|
|
194
|
+
color: '#2DBD60',
|
|
195
|
+
},
|
|
196
|
+
consentSection: {
|
|
197
|
+
width: '100%',
|
|
198
|
+
marginTop: 24,
|
|
199
|
+
},
|
|
200
|
+
consentItem: {
|
|
201
|
+
flexDirection: 'row',
|
|
202
|
+
alignItems: 'center',
|
|
203
|
+
marginBottom: 12,
|
|
204
|
+
},
|
|
205
|
+
checkbox: {
|
|
206
|
+
width: 20,
|
|
207
|
+
height: 20,
|
|
208
|
+
borderWidth: 2,
|
|
209
|
+
borderColor: '#ddd',
|
|
210
|
+
borderRadius: 4,
|
|
211
|
+
marginRight: 12,
|
|
212
|
+
alignItems: 'center',
|
|
213
|
+
justifyContent: 'center',
|
|
214
|
+
},
|
|
215
|
+
checkboxChecked: {
|
|
216
|
+
backgroundColor: '#2DBD60',
|
|
217
|
+
borderColor: '#2DBD60',
|
|
218
|
+
},
|
|
219
|
+
checkmarkSmall: {
|
|
220
|
+
fontSize: 14,
|
|
221
|
+
color: 'white',
|
|
222
|
+
fontWeight: 'bold',
|
|
223
|
+
},
|
|
224
|
+
consentText: {
|
|
225
|
+
flex: 1,
|
|
226
|
+
fontSize: 15,
|
|
227
|
+
color: '#333',
|
|
228
|
+
lineHeight: 22,
|
|
229
|
+
},
|
|
230
|
+
errorContainer: {
|
|
231
|
+
backgroundColor: '#fee',
|
|
232
|
+
padding: 12,
|
|
233
|
+
borderRadius: 8,
|
|
234
|
+
marginTop: 16,
|
|
235
|
+
width: '100%',
|
|
236
|
+
},
|
|
237
|
+
errorText: {
|
|
238
|
+
color: '#dc2626',
|
|
239
|
+
fontSize: 14,
|
|
240
|
+
textAlign: 'center',
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
//# sourceMappingURL=WelcomeTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WelcomeTemplate.js","sourceRoot":"","sources":["../../../src/components/KYCElements/WelcomeTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAUzC,MAAM,CAAC,MAAM,eAAe,GAAmC,CAAC,EAC9D,SAAS,EACT,KAAK,EACL,aAAa,EACb,KAAK,GACN,EAAE,EAAE;IACH,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACxB,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,yBAAyB,EAAE,CAAC;IAClE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAuB,CAAC;IAEjD,kCAAkC;IAClC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EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,YAAY,EAAE,EAAE;KACjB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,MAAM;QACnB,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,EAAE;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,eAAe,EAAE;QACf,eAAe,EAAE,SAAS;QAC1B,WAAW,EAAE,SAAS;KACvB;IACD,cAAc,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,MAAM;KACnB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,EAAE;KACf;IACD,cAAc,EAAE;QACd,eAAe,EAAE,MAAM;QACvB,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,MAAM;KACd;IACD,SAAS,EAAE;QACT,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC","sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { View, Text, StyleSheet } from 'react-native';\nimport { TemplateComponent, WelcomeConfig, LocalizedText } from '../../types/KYC.types';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport { Button } from '../ui/Button';\nimport ShieldIcon from '../Svgs/Schield';\n\ninterface WelcomeTemplateProps {\n component: TemplateComponent;\n value?: any;\n onValueChange: (data: any) => void;\n error?: string;\n language?: string;\n}\n\nexport const WelcomeTemplate: React.FC<WelcomeTemplateProps> = ({\n component,\n value,\n onValueChange,\n error,\n}) => {\n const { t } = useI18n();\n const { getLocalizedText, actions } = useTemplateKYCFlowContext();\n const config = component.config as WelcomeConfig;\n\n // Consentements cochés par défaut\n const privacyConsent = true;\n const termsConsent = true;\n const [shouldProceed, setShouldProceed] = useState(false);\n\n // Get localized text\n const title = getLocalizedText(component.labels as LocalizedText);\n const description = getLocalizedText(component.instructions as LocalizedText);\n const welcomeMessage = config.welcomeMessage || description;\n const buttonText = config.buttonText || getLocalizedText((component.ui as any).buttonText || { en: 'Get Started', fr: 'Commencer' });\n\n // Passer à l'étape suivante après que les données sont mises à jour\n useEffect(() => {\n if (shouldProceed && value && value.consentGiven) {\n // Petit délai pour s'assurer que le state est bien mis à jour\n const timer = setTimeout(() => {\n actions.nextComponent();\n setShouldProceed(false);\n }, 100);\n\n return () => clearTimeout(timer);\n }\n return undefined;\n }, [value, shouldProceed, actions]);\n\n const handleGetStarted = () => {\n // Mark component as complete\n const consentData = { consentGiven: true, privacyConsent, termsConsent };\n onValueChange(consentData);\n setShouldProceed(true);\n };\n\n return (\n <View style={styles.container}>\n <View style={{ flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>\n {/* Icon Section */}\n <View style={{ position: 'relative', width: 70 }}>\n <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', width: 60, height: 60, backgroundColor: '#2DBE60', borderRadius: 100 }}>\n <ShieldIcon />\n </View>\n <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 }}>\n <Text style={{ fontSize: 20, color: '#2DBE60' }}>✓</Text>\n </View>\n </View>\n\n {/* Title and Description */}\n <View style={{ flexDirection: 'column', alignItems: 'center', justifyContent: 'center', marginTop: 36 }}>\n <Text style={styles.title}>{title}</Text>\n {welcomeMessage && (\n <Text style={styles.description}>\n {welcomeMessage}\n </Text>\n )}\n </View>\n\n {/* Requirements List */}\n {config.requirements && config.requirements.length > 0 && (\n <View style={styles.requirementsSection}>\n <Text style={styles.sectionTitle}>\n {t('kyc.welcome.requirements') || `What you'll need:`}\n </Text>\n {config.requirements.map((requirement, index) => (\n <View key={index} style={styles.requirementItem}>\n <Text style={styles.checkmark}>✓</Text>\n <Text style={styles.requirementText}>{requirement}</Text>\n </View>\n ))}\n </View>\n )}\n\n {/* Estimated Time */}\n {config.showEstimatedTime !== false && config.estimatedTime && (\n <View style={styles.timeSection}>\n <Text style={styles.timeLabel}>\n {t('kyc.welcome.estimatedTime') || 'Estimated time:'}\n </Text>\n <Text style={styles.timeValue}>{config.estimatedTime}</Text>\n </View>\n )}\n\n {/* Consent Options - Hidden by default as they're pre-checked */}\n {(config.consentOptions?.showPrivacyPolicy || config.consentOptions?.showTermsOfService || config.consentOptions?.showMarketingConsent) && (\n <View style={styles.consentSection}>\n {config.consentOptions.showPrivacyPolicy && (\n <View style={styles.consentItem}>\n <View style={[styles.checkbox, styles.checkboxChecked]}>\n <Text style={styles.checkmarkSmall}>✓</Text>\n </View>\n <Text style={styles.consentText}>\n {t('kyc.welcome.privacyPolicy') || 'I agree to the Privacy Policy'}\n </Text>\n </View>\n )}\n\n {config.consentOptions.showTermsOfService && (\n <View style={styles.consentItem}>\n <View style={[styles.checkbox, styles.checkboxChecked]}>\n <Text style={styles.checkmarkSmall}>✓</Text>\n </View>\n <Text style={styles.consentText}>\n {t('kyc.welcome.termsOfService') || 'I agree to the Terms of Service'}\n </Text>\n </View>\n )}\n\n {config.consentOptions.showMarketingConsent && (\n <View style={styles.consentItem}>\n <View style={[styles.checkbox, styles.checkboxChecked]}>\n <Text style={styles.checkmarkSmall}>✓</Text>\n </View>\n <Text style={styles.consentText}>\n {t('kyc.welcome.marketingConsent') || 'I agree to receive marketing communications'}\n </Text>\n </View>\n )}\n </View>\n )}\n\n {error && (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>{error}</Text>\n </View>\n )}\n\n {/* Get Started Button */}\n <Button\n title={buttonText}\n fullWidth\n onPress={handleGetStarted}\n style={{ paddingVertical: 20, marginTop: 36 }}\n />\n\n <View style={{ height: 12 }} />\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n padding: 16,\n backgroundColor: 'white',\n marginHorizontal: 12,\n marginTop: 12,\n borderRadius: 12,\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.15,\n shadowRadius: 1.84,\n elevation: 3,\n maxWidth: 760,\n },\n title: {\n fontSize: 24,\n fontWeight: 'bold',\n color: '#333',\n marginBottom: 8,\n textAlign: 'center',\n },\n description: {\n fontSize: 16,\n color: '#666',\n textAlign: 'center',\n marginBottom: 24,\n lineHeight: 22,\n },\n requirementsSection: {\n backgroundColor: '#F9FAFB',\n padding: 12,\n borderRadius: 12,\n width: '100%',\n marginTop: 24,\n },\n sectionTitle: {\n fontSize: 16,\n fontWeight: 'bold',\n color: 'black',\n marginBottom: 12,\n textAlign: 'left',\n },\n requirementItem: {\n flexDirection: 'row',\n alignItems: 'center',\n marginBottom: 8,\n },\n checkmark: {\n fontSize: 18,\n color: '#2DBD60',\n marginRight: 12,\n fontWeight: 'bold',\n },\n requirementText: {\n flex: 1,\n fontSize: 16,\n color: '#666',\n textAlign: 'left',\n lineHeight: 22,\n },\n timeSection: {\n backgroundColor: '#F9FAFB',\n padding: 12,\n borderRadius: 12,\n marginTop: 16,\n alignItems: 'center',\n width: '100%',\n },\n timeLabel: {\n fontSize: 14,\n color: '#666',\n marginBottom: 4,\n },\n timeValue: {\n fontSize: 20,\n fontWeight: 'bold',\n color: '#2DBD60',\n },\n consentSection: {\n width: '100%',\n marginTop: 24,\n },\n consentItem: {\n flexDirection: 'row',\n alignItems: 'center',\n marginBottom: 12,\n },\n checkbox: {\n width: 20,\n height: 20,\n borderWidth: 2,\n borderColor: '#ddd',\n borderRadius: 4,\n marginRight: 12,\n alignItems: 'center',\n justifyContent: 'center',\n },\n checkboxChecked: {\n backgroundColor: '#2DBD60',\n borderColor: '#2DBD60',\n },\n checkmarkSmall: {\n fontSize: 14,\n color: 'white',\n fontWeight: 'bold',\n },\n consentText: {\n flex: 1,\n fontSize: 15,\n color: '#333',\n lineHeight: 22,\n },\n errorContainer: {\n backgroundColor: '#fee',\n padding: 12,\n borderRadius: 8,\n marginTop: 16,\n width: '100%',\n },\n errorText: {\n color: '#dc2626',\n fontSize: 14,\n textAlign: 'center',\n },\n});"]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { VerificationState } from '../types/KYC.types';
|
|
2
|
+
import { KYCTemplate, VerificationState } from '../types/KYC.types';
|
|
3
3
|
export declare const TemplateKYCExample: React.FC<{
|
|
4
4
|
onComplete: (data: VerificationState) => void;
|
|
5
5
|
onCancel: () => void;
|
|
6
6
|
onError: (error: string) => void;
|
|
7
7
|
language: string;
|
|
8
|
-
API_KEY
|
|
8
|
+
API_KEY?: string;
|
|
9
|
+
templateId?: string;
|
|
10
|
+
template?: KYCTemplate;
|
|
9
11
|
}>;
|
|
10
12
|
//# sourceMappingURL=TemplateKYCExample.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateKYCExample.d.ts","sourceRoot":"","sources":["../../src/components/TemplateKYCExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,
|
|
1
|
+
{"version":3,"file":"TemplateKYCExample.d.ts","sourceRoot":"","sources":["../../src/components/TemplateKYCExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AA4JpE,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC;IACxC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB,CAmCA,CAAC"}
|
|
@@ -101,71 +101,6 @@ const advancedVerificationTemplate = {
|
|
|
101
101
|
allowed_formats: ["jpg", "png"],
|
|
102
102
|
max_size_mb: 5,
|
|
103
103
|
document_types: ["drivers_licence", "passport", "drivers_licence", "national_id"],
|
|
104
|
-
bbox_configs: {
|
|
105
|
-
drivers_licence: {
|
|
106
|
-
xMin: 20,
|
|
107
|
-
yMin: 140,
|
|
108
|
-
xMax: 370,
|
|
109
|
-
yMax: 340,
|
|
110
|
-
borderColor: "#2DBD60",
|
|
111
|
-
borderWidth: 4,
|
|
112
|
-
cornerRadius: 12
|
|
113
|
-
},
|
|
114
|
-
passport: {
|
|
115
|
-
xMin: 15,
|
|
116
|
-
yMin: 130,
|
|
117
|
-
xMax: 375,
|
|
118
|
-
yMax: 350,
|
|
119
|
-
borderColor: "#007AFF",
|
|
120
|
-
borderWidth: 4,
|
|
121
|
-
cornerRadius: 8
|
|
122
|
-
},
|
|
123
|
-
identity_card: {
|
|
124
|
-
xMin: 20,
|
|
125
|
-
yMin: 140,
|
|
126
|
-
xMax: 370,
|
|
127
|
-
yMax: 340,
|
|
128
|
-
borderColor: "#2DBD60",
|
|
129
|
-
borderWidth: 4,
|
|
130
|
-
cornerRadius: 12
|
|
131
|
-
},
|
|
132
|
-
health_insurance_card: {
|
|
133
|
-
xMin: 20,
|
|
134
|
-
yMin: 140,
|
|
135
|
-
xMax: 370,
|
|
136
|
-
yMax: 340,
|
|
137
|
-
borderColor: "#2DBD60",
|
|
138
|
-
borderWidth: 4,
|
|
139
|
-
cornerRadius: 12
|
|
140
|
-
},
|
|
141
|
-
national_id: {
|
|
142
|
-
xMin: 20,
|
|
143
|
-
yMin: 140,
|
|
144
|
-
xMax: 370,
|
|
145
|
-
yMax: 340,
|
|
146
|
-
borderColor: "#5856D6",
|
|
147
|
-
borderWidth: 4,
|
|
148
|
-
cornerRadius: 12
|
|
149
|
-
},
|
|
150
|
-
permanent_residence: {
|
|
151
|
-
xMin: 20,
|
|
152
|
-
yMin: 140,
|
|
153
|
-
xMax: 370,
|
|
154
|
-
yMax: 340,
|
|
155
|
-
borderColor: "#2DBD60",
|
|
156
|
-
borderWidth: 4,
|
|
157
|
-
cornerRadius: 12
|
|
158
|
-
},
|
|
159
|
-
work_permit: {
|
|
160
|
-
xMin: 20,
|
|
161
|
-
yMin: 140,
|
|
162
|
-
xMax: 370,
|
|
163
|
-
yMax: 340,
|
|
164
|
-
borderColor: "#2DBD60",
|
|
165
|
-
borderWidth: 4,
|
|
166
|
-
cornerRadius: 12
|
|
167
|
-
},
|
|
168
|
-
}
|
|
169
104
|
}
|
|
170
105
|
},
|
|
171
106
|
{
|
|
@@ -217,7 +152,7 @@ const advancedVerificationTemplate = {
|
|
|
217
152
|
// },
|
|
218
153
|
]
|
|
219
154
|
};
|
|
220
|
-
export const TemplateKYCExample = ({ onComplete, onCancel, onError, language, API_KEY }) => {
|
|
155
|
+
export const TemplateKYCExample = ({ onComplete, onCancel, onError, language, API_KEY, templateId, template }) => {
|
|
221
156
|
const handleComplete = (data) => {
|
|
222
157
|
console.log('KYC Template completed with data:', data);
|
|
223
158
|
onComplete(data);
|
|
@@ -229,11 +164,13 @@ export const TemplateKYCExample = ({ onComplete, onCancel, onError, language, AP
|
|
|
229
164
|
};
|
|
230
165
|
const handleError = (error) => {
|
|
231
166
|
console.error('KYC Template error:', error);
|
|
232
|
-
|
|
167
|
+
onError(error);
|
|
233
168
|
};
|
|
169
|
+
// Determine which template to use: prefer templateId for dynamic loading, then template prop, then fallback to hardcoded
|
|
170
|
+
const templateToUse = templateId ? undefined : (template || advancedVerificationTemplate);
|
|
234
171
|
return (<SafeAreaView style={{ flex: 1, paddingVertical: 25 }}>
|
|
235
172
|
<View style={{ flex: 1 }}>
|
|
236
|
-
<TemplateKYCFlow template={
|
|
173
|
+
<TemplateKYCFlow template={templateToUse} templateId={templateId} onComplete={handleComplete} onError={handleError} onCancel={handleCancel} language={language} // ou "en" pour l'anglais
|
|
237
174
|
API_KEY={API_KEY}/>
|
|
238
175
|
</View>
|
|
239
176
|
</SafeAreaView>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateKYCExample.js","sourceRoot":"","sources":["../../src/components/TemplateKYCExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,uCAAuC;AACvC,MAAM,4BAA4B,GAAgB;IAChD,EAAE,EAAE,CAAC;IACL,IAAI,EAAE;QACJ,EAAE,EAAE,uBAAuB;QAC3B,EAAE,EAAE,sBAAsB;KAC3B;IACD,WAAW,EAAE;QACX,EAAE,EAAE,qCAAqC;QACzC,EAAE,EAAE,6CAA6C;KAClD;IACD,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE;QACV;YACE,EAAE,EAAE,CAAC;YACL,IAAI,EAAE,UAAmB;YACzB,KAAK,EAAE,CAAC;YACR,MAAM,EAAE;gBACN,EAAE,EAAE,sBAAsB;gBAC1B,EAAE,EAAE,4BAA4B;aACjC;YACD,YAAY,EAAE;gBACZ,EAAE,EAAE,oDAAoD;gBACxD,EAAE,EAAE,8EAA8E;aACnF;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,mBAAmB;gBACzB,UAAU,EAAE,SAAS;gBACrB,UAAU,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,yBAAyB,EAAE;aACrE;YACD,MAAM,EAAE;gBACN,QAAQ,EAAE,MAAM;gBAChB,QAAQ,EAAE,IAAI;a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,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { View, SafeAreaView } from 'react-native';\nimport { TemplateKYCFlow } from './TemplateKYCFlowRefactored';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\n\n// Template JSON basé sur votre exemple\nconst advancedVerificationTemplate: KYCTemplate = {\n id: 1,\n name: {\n en: \"Advanced Verification\",\n fr: \"Vérification Avancée\"\n },\n description: {\n en: \"Extended identity verification flow\",\n fr: \"Processus de vérification d'identité étendu\"\n },\n version: \"1.1.0\",\n components: [\n {\n id: 5,\n type: \"location\" as const,\n order: 1,\n labels: {\n en: \"Enable your location\",\n fr: \"Activez votre localisation\"\n },\n instructions: {\n en: \"We need your GPS location for compliance purposes.\",\n fr: \"Nous avons besoin de votre localisation GPS pour des raisons réglementaires.\"\n },\n ui: {\n icon: \"location-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Enable Location\", fr: \"Activer la localisation\" }\n },\n config: {\n accuracy: \"high\",\n required: true\n } as const\n },\n {\n id: 6,\n type: \"country_selection\" as const,\n order: 2,\n labels: {\n en: \"Select your country\",\n fr: \"Sélectionnez votre pays\"\n },\n instructions: {\n en: \"Choose your country of residence.\",\n fr: \"Choisissez votre pays de résidence.\"\n },\n ui: {\n icon: \"country-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Confirm\", fr: \"Confirmer\" }\n },\n config: {\n allowed_countries: [\"CM\", \"NG\", \"CI\", \"KE\", \"GH\"],\n default_country: \"CM\",\n required: true\n } as const\n },\n {\n id: 1,\n type: \"id_card\" as const,\n order: 3,\n templateId: 1,\n labels: {\n front: {\n en: \"Upload front of ID card\",\n fr: \"Téléversez le recto de votre carte d'identité\"\n },\n back: {\n en: \"Upload back of ID card\",\n fr: \"Téléversez le verso de votre carte d'identité\"\n },\n },\n instructions: {\n front: {\n en: \"Take a clear photo of the front of your ID.\",\n fr: \"Prenez une photo nette du recto de votre pièce.\"\n },\n back: {\n en: \"Take a clear photo of the back of your ID.\",\n fr: \"Prenez une photo nette du verso de votre pièce.\"\n },\n },\n ui: {\n front: {\n icon: \"id-card-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Next\", fr: \"Suivant\" }\n },\n back: {\n icon: \"id-card-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Next\", fr: \"Suivant\" }\n },\n },\n config: {\n sides: [\"front\", \"back\"],\n allowed_formats: [\"jpg\", \"png\"],\n max_size_mb: 5,\n document_types: [\"drivers_licence\", \"passport\", \"drivers_licence\", \"national_id\"],\n bbox_configs: {\n drivers_licence: {\n xMin: 20,\n yMin: 140,\n xMax: 370,\n yMax: 340,\n borderColor: \"#2DBD60\",\n borderWidth: 4,\n cornerRadius: 12\n },\n passport: {\n xMin: 15,\n yMin: 130,\n xMax: 375,\n yMax: 350,\n borderColor: \"#007AFF\",\n borderWidth: 4,\n cornerRadius: 8\n },\n identity_card: {\n xMin: 20,\n yMin: 140,\n xMax: 370,\n yMax: 340,\n borderColor: \"#2DBD60\",\n borderWidth: 4,\n cornerRadius: 12\n },\n health_insurance_card: {\n xMin: 20,\n yMin: 140,\n xMax: 370,\n yMax: 340,\n borderColor: \"#2DBD60\",\n borderWidth: 4,\n cornerRadius: 12\n },\n national_id: {\n xMin: 20,\n yMin: 140,\n xMax: 370,\n yMax: 340,\n borderColor: \"#5856D6\",\n borderWidth: 4,\n cornerRadius: 12\n },\n permanent_residence: {\n xMin: 20,\n yMin: 140,\n xMax: 370,\n yMax: 340,\n borderColor: \"#2DBD60\",\n borderWidth: 4,\n cornerRadius: 12\n },\n\n\n work_permit: {\n xMin: 20,\n yMin: 140,\n xMax: 370,\n yMax: 340,\n borderColor: \"#2DBD60\",\n borderWidth: 4,\n cornerRadius: 12\n },\n\n }\n } as const\n },\n {\n id: 3,\n type: \"selfie\" as const,\n order: 5,\n templateId: 1,\n labels: {\n en: \"Take selfies from different angles\",\n fr: \"Prenez des selfies sous différents angles\"\n },\n instructions: {\n en: \"Take selfies from front, left, and right angles.\",\n fr: \"Prenez des selfies de face, profil gauche et profil droit.\"\n },\n ui: {\n icon: \"selfie-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Next\", fr: \"Suivant\" }\n },\n config: {\n liveness_check: true,\n max_attempts: 3,\n orientations: [\"center\", \"left\", \"right\"]\n } as const\n },\n // {\n // id: 4,\n // type: \"file_upload\" as const,\n // order: 6,\n // labels: {\n // en: \"Upload proof of address\",\n // fr: \"Téléversez un justificatif de domicile\"\n // },\n // instructions: {\n // en: \"Upload a recent utility bill or bank statement (PDF, JPG, PNG).\",\n // fr: \"Téléversez une facture récente ou un relevé bancaire (PDF, JPG, PNG).\"\n // },\n // ui: {\n // icon: \"file-upload-icon.png\",\n // themeColor: \"#2DBD60\",\n // buttonText: { en: \"Upload\", fr: \"Téléverser\" }\n // },\n // config: {\n // allowed_formats: [\"pdf\", \"jpg\", \"png\"],\n // max_size_mb: 10,\n // required: true\n // } as const\n // },\n\n ]\n};\n\nexport const TemplateKYCExample: React.FC<{ onComplete: (data: VerificationState) => void, onCancel: () => void, onError: (error: string) => void, language: string, API_KEY: string|undefined }> = ({ onComplete, onCancel, onError, language, API_KEY }) => {\n const handleComplete = (data: VerificationState) => {\n console.log('KYC Template completed with data:', data);\n onComplete(data);\n // Ici vous pouvez envoyer les données à votre API\n };\n\n const handleCancel = () => {\n console.log('KYC Template flow cancelled');\n onCancel();\n };\n\n const handleError = (error: string) => {\n console.error('KYC Template error:', error);\n // Gérer l'erreur\n };\n\n return (\n <SafeAreaView style={{ flex: 1 , paddingVertical:25}}>\n <View style={{ flex: 1 }}>\n <TemplateKYCFlow\n template={advancedVerificationTemplate}\n onComplete={handleComplete}\n onError={handleError}\n onCancel={handleCancel}\n language={language} // ou \"en\" pour l'anglais\n API_KEY={API_KEY}\n />\n </View>\n </SafeAreaView>\n );\n};\n\n "]}
|
|
1
|
+
{"version":3,"file":"TemplateKYCExample.js","sourceRoot":"","sources":["../../src/components/TemplateK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B,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAC3C,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE;QACpC,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,yHAAyH;IACzH,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,4BAA4B,CAAC,CAAC;IAE1F,OAAO,CACL,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAG,eAAe,EAAC,EAAE,EAAC,CAAC,CACrD;IAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CACvB;MAAA,CAAC,eAAe,CACd,QAAQ,CAAC,CAAC,aAAa,CAAC,CACxB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,UAAU,CAAC,CAAC,cAAc,CAAC,CAC3B,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,QAAQ,CAAC,CAAC,YAAY,CAAC,CACvB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,yBAAyB;KAC7C,OAAO,CAAC,CAAC,OAAO,CAAC,EAErB;IAAA,EAAE,IAAI,CACR;EAAA,EAAE,YAAY,CAAC,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { View, SafeAreaView } from 'react-native';\nimport { TemplateKYCFlow } from './TemplateKYCFlowRefactored';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\n\n// Template JSON basé sur votre exemple\nconst advancedVerificationTemplate: KYCTemplate = {\n id: 1,\n name: {\n en: \"Advanced Verification\",\n fr: \"Vérification Avancée\"\n },\n description: {\n en: \"Extended identity verification flow\",\n fr: \"Processus de vérification d'identité étendu\"\n },\n version: \"1.1.0\",\n components: [\n {\n id: 5,\n type: \"location\" as const,\n order: 1,\n labels: {\n en: \"Enable your location\",\n fr: \"Activez votre localisation\"\n },\n instructions: {\n en: \"We need your GPS location for compliance purposes.\",\n fr: \"Nous avons besoin de votre localisation GPS pour des raisons réglementaires.\"\n },\n ui: {\n icon: \"location-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Enable Location\", fr: \"Activer la localisation\" }\n },\n config: {\n accuracy: \"high\",\n required: true\n } as const\n },\n {\n id: 6,\n type: \"country_selection\" as const,\n order: 2,\n labels: {\n en: \"Select your country\",\n fr: \"Sélectionnez votre pays\"\n },\n instructions: {\n en: \"Choose your country of residence.\",\n fr: \"Choisissez votre pays de résidence.\"\n },\n ui: {\n icon: \"country-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Confirm\", fr: \"Confirmer\" }\n },\n config: {\n allowed_countries: [\"CM\", \"NG\", \"CI\", \"KE\", \"GH\"],\n default_country: \"CM\",\n required: true\n } as const\n },\n {\n id: 1,\n type: \"id_card\" as const,\n order: 3,\n templateId: 1,\n labels: {\n front: {\n en: \"Upload front of ID card\",\n fr: \"Téléversez le recto de votre carte d'identité\"\n },\n back: {\n en: \"Upload back of ID card\",\n fr: \"Téléversez le verso de votre carte d'identité\"\n },\n },\n instructions: {\n front: {\n en: \"Take a clear photo of the front of your ID.\",\n fr: \"Prenez une photo nette du recto de votre pièce.\"\n },\n back: {\n en: \"Take a clear photo of the back of your ID.\",\n fr: \"Prenez une photo nette du verso de votre pièce.\"\n },\n },\n ui: {\n front: {\n icon: \"id-card-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Next\", fr: \"Suivant\" }\n },\n back: {\n icon: \"id-card-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Next\", fr: \"Suivant\" }\n },\n },\n config: {\n sides: [\"front\", \"back\"],\n allowed_formats: [\"jpg\", \"png\"],\n max_size_mb: 5,\n document_types: [\"drivers_licence\", \"passport\", \"drivers_licence\", \"national_id\"],\n \n } as const\n },\n {\n id: 3,\n type: \"selfie\" as const,\n order: 5,\n templateId: 1,\n labels: {\n en: \"Take selfies from different angles\",\n fr: \"Prenez des selfies sous différents angles\"\n },\n instructions: {\n en: \"Take selfies from front, left, and right angles.\",\n fr: \"Prenez des selfies de face, profil gauche et profil droit.\"\n },\n ui: {\n icon: \"selfie-icon.png\",\n themeColor: \"#2DBD60\",\n buttonText: { en: \"Next\", fr: \"Suivant\" }\n },\n config: {\n liveness_check: true,\n max_attempts: 3,\n orientations: [\"center\", \"left\", \"right\"]\n } as const\n },\n // {\n // id: 4,\n // type: \"file_upload\" as const,\n // order: 6,\n // labels: {\n // en: \"Upload proof of address\",\n // fr: \"Téléversez un justificatif de domicile\"\n // },\n // instructions: {\n // en: \"Upload a recent utility bill or bank statement (PDF, JPG, PNG).\",\n // fr: \"Téléversez une facture récente ou un relevé bancaire (PDF, JPG, PNG).\"\n // },\n // ui: {\n // icon: \"file-upload-icon.png\",\n // themeColor: \"#2DBD60\",\n // buttonText: { en: \"Upload\", fr: \"Téléverser\" }\n // },\n // config: {\n // allowed_formats: [\"pdf\", \"jpg\", \"png\"],\n // max_size_mb: 10,\n // required: true\n // } as const\n // },\n\n ]\n};\n\nexport const TemplateKYCExample: React.FC<{ \n onComplete: (data: VerificationState) => void; \n onCancel: () => void; \n onError: (error: string) => void; \n language: string; \n API_KEY?: string;\n templateId?: string;\n template?: KYCTemplate;\n}> = ({ onComplete, onCancel, onError, language, API_KEY, templateId, template }) => {\n const handleComplete = (data: VerificationState) => {\n console.log('KYC Template completed with data:', data);\n onComplete(data);\n // Ici vous pouvez envoyer les données à votre API\n };\n\n const handleCancel = () => {\n console.log('KYC Template flow cancelled');\n onCancel();\n };\n\n const handleError = (error: string) => {\n console.error('KYC Template error:', error);\n onError(error);\n };\n\n // Determine which template to use: prefer templateId for dynamic loading, then template prop, then fallback to hardcoded\n const templateToUse = templateId ? undefined : (template || advancedVerificationTemplate);\n\n return (\n <SafeAreaView style={{ flex: 1 , paddingVertical:25}}>\n <View style={{ flex: 1 }}>\n <TemplateKYCFlow\n template={templateToUse}\n templateId={templateId}\n onComplete={handleComplete}\n onError={handleError}\n onCancel={handleCancel}\n language={language} // ou \"en\" pour l'anglais\n API_KEY={API_KEY}\n />\n </View>\n </SafeAreaView>\n );\n};\n\n "]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { KYCTemplate, VerificationState } from '../types/KYC.types';
|
|
3
3
|
interface TemplateKYCFlowProps {
|
|
4
|
-
template
|
|
4
|
+
template?: KYCTemplate;
|
|
5
|
+
templateId?: string;
|
|
5
6
|
onComplete?: (data: VerificationState) => void;
|
|
6
7
|
onError?: (error: string) => void;
|
|
7
8
|
language?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateKYCFlowRefactored.d.ts","sourceRoot":"","sources":["../../src/components/TemplateKYCFlowRefactored.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TemplateKYCFlowRefactored.d.ts","sourceRoot":"","sources":["../../src/components/TemplateKYCFlowRefactored.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAepE,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsG1D,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions,
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
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';
|
|
5
|
+
import { showAlert } from '../utils/platformAlert';
|
|
5
6
|
import { IDCardCapture } from './KYCElements/IDCardCapture';
|
|
6
7
|
import { SelfieCaptureTemplate } from './KYCElements/SelfieCaptureTemplate';
|
|
7
8
|
import { FileUploadTemplate } from './KYCElements/FileUploadTemplate';
|
|
@@ -10,10 +11,34 @@ import { CountrySelectionTemplate } from './KYCElements/CountrySelectionTemplate
|
|
|
10
11
|
import { InitializationStep } from './KYCElements/InitializationStep';
|
|
11
12
|
import { ReviewSubmitTemplate } from './KYCElements/ReviewSubmitTemplate';
|
|
12
13
|
import { VerificationProgressTemplate } from './KYCElements/VerificationProgressTemplate';
|
|
13
|
-
|
|
14
|
+
import { useTemplateLoader } from '../hooks/useTemplateLoader';
|
|
15
|
+
import { WelcomeTemplate } from './KYCElements/WelcomeTemplate';
|
|
16
|
+
export const TemplateKYCFlow = ({ template: providedTemplate, templateId, onComplete, onError, language = 'fr', onCancel, API_KEY, }) => {
|
|
14
17
|
const { t } = useI18n();
|
|
18
|
+
const { template: loadedTemplate, isLoading, error, loadTemplate } = useTemplateLoader();
|
|
19
|
+
// Validate props
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!providedTemplate && !templateId) {
|
|
22
|
+
const errorMsg = 'Either template or templateId must be provided';
|
|
23
|
+
onError?.(errorMsg);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (templateId && !API_KEY) {
|
|
27
|
+
// Try to load without API key (will use token authentication)
|
|
28
|
+
loadTemplate(templateId);
|
|
29
|
+
}
|
|
30
|
+
else if (templateId && API_KEY) {
|
|
31
|
+
loadTemplate(templateId, API_KEY);
|
|
32
|
+
}
|
|
33
|
+
}, [templateId, API_KEY, providedTemplate, loadTemplate, onError]);
|
|
34
|
+
// Handle loading errors
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (error) {
|
|
37
|
+
onError?.(error);
|
|
38
|
+
}
|
|
39
|
+
}, [error, onError]);
|
|
15
40
|
const OnCancel = () => {
|
|
16
|
-
|
|
41
|
+
showAlert(t('kyc.cancelConfirmation.title'), t('kyc.cancelConfirmation.message'), [
|
|
17
42
|
{ text: t('kyc.cancelConfirmation.cancelButton'), style: 'cancel' },
|
|
18
43
|
{
|
|
19
44
|
text: t('kyc.cancelConfirmation.confirmButton'),
|
|
@@ -23,6 +48,32 @@ export const TemplateKYCFlow = ({ template, onComplete, onError, language = 'fr'
|
|
|
23
48
|
},
|
|
24
49
|
]);
|
|
25
50
|
};
|
|
51
|
+
// Determine which template to use
|
|
52
|
+
const template = providedTemplate || loadedTemplate;
|
|
53
|
+
// Show loading state while fetching template
|
|
54
|
+
if (templateId && isLoading && !template) {
|
|
55
|
+
return (<View style={styles.loadingContainer}>
|
|
56
|
+
<ActivityIndicator size="large" color="#2DBD60"/>
|
|
57
|
+
<Text style={styles.loadingText}>{t('common.loading') || 'Loading template...'}</Text>
|
|
58
|
+
</View>);
|
|
59
|
+
}
|
|
60
|
+
// Show error state if template failed to load
|
|
61
|
+
if (templateId && error && !template) {
|
|
62
|
+
return (<View style={styles.errorContainer}>
|
|
63
|
+
<Text style={styles.errorText}>{error}</Text>
|
|
64
|
+
<TouchableOpacity style={styles.retryButton} onPress={() => loadTemplate(templateId, API_KEY)}>
|
|
65
|
+
<Text style={styles.retryButtonText}>{t('common.retry') || 'Retry'}</Text>
|
|
66
|
+
</TouchableOpacity>
|
|
67
|
+
</View>);
|
|
68
|
+
}
|
|
69
|
+
// Show error if no template available
|
|
70
|
+
if (!template) {
|
|
71
|
+
return (<View style={styles.errorContainer}>
|
|
72
|
+
<Text style={styles.errorText}>
|
|
73
|
+
{t('errors.unknownError') || 'Template not available'}
|
|
74
|
+
</Text>
|
|
75
|
+
</View>);
|
|
76
|
+
}
|
|
26
77
|
return (<TemplateKYCFlowProvider template={template} onComplete={onComplete} onError={onError} onCancel={OnCancel} initialLanguage={language} apiKey={API_KEY}>
|
|
27
78
|
<TemplateKYCFlowContent onCancel={OnCancel}/>
|
|
28
79
|
</TemplateKYCFlowProvider>);
|
|
@@ -51,6 +102,8 @@ const TemplateKYCFlowContent = ({ onCancel }) => {
|
|
|
51
102
|
return <InitializationStep session={state.session}/>;
|
|
52
103
|
}
|
|
53
104
|
switch (currentComponent.type) {
|
|
105
|
+
case 'welcome':
|
|
106
|
+
return <WelcomeTemplate {...commonProps}/>;
|
|
54
107
|
case 'id_card':
|
|
55
108
|
return <IDCardCapture {...commonProps}/>;
|
|
56
109
|
case 'selfie':
|
|
@@ -103,9 +156,9 @@ const TemplateKYCFlowContent = ({ onCancel }) => {
|
|
|
103
156
|
</View>) : null}
|
|
104
157
|
|
|
105
158
|
{/* Contenu principal */}
|
|
106
|
-
<
|
|
159
|
+
<ScrollView style={styles.scrollView} contentContainerStyle={styles.content} showsVerticalScrollIndicator={Platform.OS === 'web'} bounces={false}>
|
|
107
160
|
{renderCurrentComponent()}
|
|
108
|
-
</
|
|
161
|
+
</ScrollView>
|
|
109
162
|
|
|
110
163
|
{state.isProcessing && (<View style={styles.processingContainer}>
|
|
111
164
|
<Text style={styles.processingText}>{t('common.loading')}</Text>
|
|
@@ -184,11 +237,13 @@ const styles = StyleSheet.create({
|
|
|
184
237
|
color: '#666',
|
|
185
238
|
lineHeight: 20,
|
|
186
239
|
},
|
|
187
|
-
|
|
240
|
+
scrollView: {
|
|
188
241
|
flex: 1,
|
|
189
|
-
|
|
242
|
+
},
|
|
243
|
+
content: {
|
|
244
|
+
flexGrow: 1,
|
|
190
245
|
alignItems: 'center',
|
|
191
|
-
|
|
246
|
+
paddingBottom: 20, // Add padding for better mobile scrolling
|
|
192
247
|
},
|
|
193
248
|
navigation: {
|
|
194
249
|
flexDirection: 'row',
|
|
@@ -247,5 +302,36 @@ const styles = StyleSheet.create({
|
|
|
247
302
|
fontWeight: 'bold',
|
|
248
303
|
marginBottom: 10,
|
|
249
304
|
},
|
|
305
|
+
loadingContainer: {
|
|
306
|
+
flex: 1,
|
|
307
|
+
justifyContent: 'center',
|
|
308
|
+
alignItems: 'center',
|
|
309
|
+
backgroundColor: '#f5f5f5',
|
|
310
|
+
},
|
|
311
|
+
loadingText: {
|
|
312
|
+
marginTop: 16,
|
|
313
|
+
fontSize: 16,
|
|
314
|
+
color: '#666',
|
|
315
|
+
textAlign: 'center',
|
|
316
|
+
},
|
|
317
|
+
errorContainer: {
|
|
318
|
+
flex: 1,
|
|
319
|
+
justifyContent: 'center',
|
|
320
|
+
alignItems: 'center',
|
|
321
|
+
backgroundColor: '#f5f5f5',
|
|
322
|
+
padding: 20,
|
|
323
|
+
},
|
|
324
|
+
retryButton: {
|
|
325
|
+
marginTop: 20,
|
|
326
|
+
paddingHorizontal: 24,
|
|
327
|
+
paddingVertical: 12,
|
|
328
|
+
backgroundColor: '#2DBD60',
|
|
329
|
+
borderRadius: 8,
|
|
330
|
+
},
|
|
331
|
+
retryButtonText: {
|
|
332
|
+
color: '#fff',
|
|
333
|
+
fontSize: 16,
|
|
334
|
+
fontWeight: '600',
|
|
335
|
+
},
|
|
250
336
|
});
|
|
251
337
|
//# sourceMappingURL=TemplateKYCFlowRefactored.js.map
|