@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.
Files changed (207) hide show
  1. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +12 -5
  2. package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
  3. package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
  4. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  5. package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
  6. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +61 -59
  7. package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
  8. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +12 -5
  9. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  10. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  11. package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
  12. package/android/build/outputs/logs/manifest-merger-debug-report.txt +26 -34
  13. package/android/src/main/AndroidManifest.xml +13 -5
  14. package/build/components/EnhancedCameraView.d.ts.map +1 -1
  15. package/build/components/EnhancedCameraView.js +26 -3
  16. package/build/components/EnhancedCameraView.js.map +1 -1
  17. package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
  18. package/build/components/EnhancedCameraView.web.js +21 -0
  19. package/build/components/EnhancedCameraView.web.js.map +1 -1
  20. package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts +12 -0
  21. package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts.map +1 -0
  22. package/build/components/KYCElements/AdditionalDocumentsTemplate.js +283 -0
  23. package/build/components/KYCElements/AdditionalDocumentsTemplate.js.map +1 -0
  24. package/build/components/KYCElements/CameraCapture.d.ts.map +1 -1
  25. package/build/components/KYCElements/CameraCapture.js +4 -3
  26. package/build/components/KYCElements/CameraCapture.js.map +1 -1
  27. package/build/components/KYCElements/CountrySelectionTemplate.d.ts +5 -2
  28. package/build/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
  29. package/build/components/KYCElements/CountrySelectionTemplate.js +360 -101
  30. package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
  31. package/build/components/KYCElements/EmailVerificationTemplate.d.ts +12 -0
  32. package/build/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -0
  33. package/build/components/KYCElements/EmailVerificationTemplate.js +193 -0
  34. package/build/components/KYCElements/EmailVerificationTemplate.js.map +1 -0
  35. package/build/components/KYCElements/FileUpload.d.ts.map +1 -1
  36. package/build/components/KYCElements/FileUpload.js +5 -4
  37. package/build/components/KYCElements/FileUpload.js.map +1 -1
  38. package/build/components/KYCElements/FileUploadTemplate.d.ts.map +1 -1
  39. package/build/components/KYCElements/FileUploadTemplate.js +5 -4
  40. package/build/components/KYCElements/FileUploadTemplate.js.map +1 -1
  41. package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
  42. package/build/components/KYCElements/IDCardCapture.js +356 -227
  43. package/build/components/KYCElements/IDCardCapture.js.map +1 -1
  44. package/build/components/KYCElements/LocationCaptureTemplate.d.ts.map +1 -1
  45. package/build/components/KYCElements/LocationCaptureTemplate.js +78 -37
  46. package/build/components/KYCElements/LocationCaptureTemplate.js.map +1 -1
  47. package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -0
  48. package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
  49. package/build/components/KYCElements/OrientationVideoCapture.js +5 -4
  50. package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
  51. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -0
  52. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
  53. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js +5 -4
  54. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
  55. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -0
  56. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
  57. package/build/components/KYCElements/OrientationVideoCaptureFinal.js +5 -4
  58. package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
  59. package/build/components/KYCElements/PersonalInformationTemplate.d.ts +12 -0
  60. package/build/components/KYCElements/PersonalInformationTemplate.d.ts.map +1 -0
  61. package/build/components/KYCElements/PersonalInformationTemplate.js +120 -0
  62. package/build/components/KYCElements/PersonalInformationTemplate.js.map +1 -0
  63. package/build/components/KYCElements/PhoneVerificationTemplate.d.ts +12 -0
  64. package/build/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -0
  65. package/build/components/KYCElements/PhoneVerificationTemplate.js +185 -0
  66. package/build/components/KYCElements/PhoneVerificationTemplate.js.map +1 -0
  67. package/build/components/KYCElements/SelfieCapture.d.ts.map +1 -1
  68. package/build/components/KYCElements/SelfieCapture.js +4 -3
  69. package/build/components/KYCElements/SelfieCapture.js.map +1 -1
  70. package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
  71. package/build/components/KYCElements/SelfieCaptureTemplate.js +189 -42
  72. package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
  73. package/build/components/KYCElements/WelcomeTemplate.d.ts +12 -0
  74. package/build/components/KYCElements/WelcomeTemplate.d.ts.map +1 -0
  75. package/build/components/KYCElements/WelcomeTemplate.js +243 -0
  76. package/build/components/KYCElements/WelcomeTemplate.js.map +1 -0
  77. package/build/components/TemplateKYCExample.d.ts +8 -2
  78. package/build/components/TemplateKYCExample.d.ts.map +1 -1
  79. package/build/components/TemplateKYCExample.js +10 -97
  80. package/build/components/TemplateKYCExample.js.map +1 -1
  81. package/build/components/TemplateKYCFlowRefactored.d.ts +6 -1
  82. package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
  83. package/build/components/TemplateKYCFlowRefactored.js +108 -11
  84. package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
  85. package/build/components/example/DynamicTemplateExample.d.ts +10 -0
  86. package/build/components/example/DynamicTemplateExample.d.ts.map +1 -0
  87. package/build/components/example/DynamicTemplateExample.js +241 -0
  88. package/build/components/example/DynamicTemplateExample.js.map +1 -0
  89. package/build/config/KYCConfig.d.ts +14 -0
  90. package/build/config/KYCConfig.d.ts.map +1 -0
  91. package/build/config/KYCConfig.js +26 -0
  92. package/build/config/KYCConfig.js.map +1 -0
  93. package/build/config/allowedDomains.d.ts +30 -0
  94. package/build/config/allowedDomains.d.ts.map +1 -0
  95. package/build/config/allowedDomains.js +112 -0
  96. package/build/config/allowedDomains.js.map +1 -0
  97. package/build/hooks/useOrientationVideo.d.ts +2 -1
  98. package/build/hooks/useOrientationVideo.d.ts.map +1 -1
  99. package/build/hooks/useOrientationVideo.js +3 -3
  100. package/build/hooks/useOrientationVideo.js.map +1 -1
  101. package/build/hooks/useTemplateKYCFlow.d.ts +6 -1
  102. package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
  103. package/build/hooks/useTemplateKYCFlow.js +317 -34
  104. package/build/hooks/useTemplateKYCFlow.js.map +1 -1
  105. package/build/hooks/useTemplateLoader.d.ts +14 -0
  106. package/build/hooks/useTemplateLoader.d.ts.map +1 -0
  107. package/build/hooks/useTemplateLoader.js +85 -0
  108. package/build/hooks/useTemplateLoader.js.map +1 -0
  109. package/build/i18n/en/index.d.ts +49 -0
  110. package/build/i18n/en/index.d.ts.map +1 -1
  111. package/build/i18n/en/index.js +50 -1
  112. package/build/i18n/en/index.js.map +1 -1
  113. package/build/i18n/fr/index.d.ts +35 -0
  114. package/build/i18n/fr/index.d.ts.map +1 -1
  115. package/build/i18n/fr/index.js +36 -1
  116. package/build/i18n/fr/index.js.map +1 -1
  117. package/build/index.d.ts +6 -0
  118. package/build/index.d.ts.map +1 -1
  119. package/build/index.js +10 -0
  120. package/build/index.js.map +1 -1
  121. package/build/modules/api/CardAuthentification.d.ts +24 -3
  122. package/build/modules/api/CardAuthentification.d.ts.map +1 -1
  123. package/build/modules/api/CardAuthentification.js +69 -10
  124. package/build/modules/api/CardAuthentification.js.map +1 -1
  125. package/build/modules/api/KYCService.d.ts +7 -7
  126. package/build/modules/api/KYCService.d.ts.map +1 -1
  127. package/build/modules/api/KYCService.js +108 -39
  128. package/build/modules/api/KYCService.js.map +1 -1
  129. package/build/modules/api/SelfieVerification.d.ts +3 -1
  130. package/build/modules/api/SelfieVerification.d.ts.map +1 -1
  131. package/build/modules/api/SelfieVerification.js +17 -1
  132. package/build/modules/api/SelfieVerification.js.map +1 -1
  133. package/build/modules/api/TemplateService.d.ts +44 -0
  134. package/build/modules/api/TemplateService.d.ts.map +1 -0
  135. package/build/modules/api/TemplateService.js +145 -0
  136. package/build/modules/api/TemplateService.js.map +1 -0
  137. package/build/types/KYC.types.d.ts +265 -4
  138. package/build/types/KYC.types.d.ts.map +1 -1
  139. package/build/types/KYC.types.js +15 -0
  140. package/build/types/KYC.types.js.map +1 -1
  141. package/build/types/env.types.d.ts +13 -0
  142. package/build/types/env.types.d.ts.map +1 -0
  143. package/build/types/env.types.js +2 -0
  144. package/build/types/env.types.js.map +1 -0
  145. package/build/utils/cropByObb.d.ts +1 -0
  146. package/build/utils/cropByObb.d.ts.map +1 -1
  147. package/build/utils/cropByObb.js +70 -0
  148. package/build/utils/cropByObb.js.map +1 -1
  149. package/build/utils/deviceDetection.d.ts +6 -0
  150. package/build/utils/deviceDetection.d.ts.map +1 -0
  151. package/build/utils/deviceDetection.js +12 -0
  152. package/build/utils/deviceDetection.js.map +1 -0
  153. package/build/utils/platformAlert.d.ts +20 -0
  154. package/build/utils/platformAlert.d.ts.map +1 -0
  155. package/build/utils/platformAlert.js +67 -0
  156. package/build/utils/platformAlert.js.map +1 -0
  157. package/build/utils/template-transformer.d.ts +10 -0
  158. package/build/utils/template-transformer.d.ts.map +1 -0
  159. package/build/utils/template-transformer.js +365 -0
  160. package/build/utils/template-transformer.js.map +1 -0
  161. package/build/web/WebKYCEntry.d.ts.map +1 -1
  162. package/build/web/WebKYCEntry.js +158 -32
  163. package/build/web/WebKYCEntry.js.map +1 -1
  164. package/package.json +1 -1
  165. package/plugin/build/withVisionCamera.js +3 -4
  166. package/plugin/src/withVisionCamera.js +3 -4
  167. package/plugin/src/withVisionCamera.ts +3 -4
  168. package/src/components/EnhancedCameraView.tsx +31 -2
  169. package/src/components/EnhancedCameraView.web.tsx +24 -0
  170. package/src/components/KYCElements/AdditionalDocumentsTemplate.tsx +346 -0
  171. package/src/components/KYCElements/CameraCapture.tsx +4 -3
  172. package/src/components/KYCElements/CountrySelectionTemplate.tsx +410 -113
  173. package/src/components/KYCElements/EmailVerificationTemplate.tsx +264 -0
  174. package/src/components/KYCElements/FileUpload.tsx +5 -4
  175. package/src/components/KYCElements/FileUploadTemplate.tsx +5 -4
  176. package/src/components/KYCElements/IDCardCapture.tsx +397 -254
  177. package/src/components/KYCElements/LocationCaptureTemplate.tsx +95 -44
  178. package/src/components/KYCElements/OrientationVideoCapture.tsx +6 -3
  179. package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +6 -3
  180. package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +6 -3
  181. package/src/components/KYCElements/PersonalInformationTemplate.tsx +158 -0
  182. package/src/components/KYCElements/PhoneVerificationTemplate.tsx +253 -0
  183. package/src/components/KYCElements/SelfieCapture.tsx +4 -3
  184. package/src/components/KYCElements/SelfieCaptureTemplate.tsx +201 -44
  185. package/src/components/KYCElements/WelcomeTemplate.tsx +289 -0
  186. package/src/components/TemplateKYCExample.tsx +37 -108
  187. package/src/components/TemplateKYCFlowRefactored.tsx +148 -12
  188. package/src/components/example/DynamicTemplateExample.tsx +289 -0
  189. package/src/config/KYCConfig.ts +34 -0
  190. package/src/config/allowedDomains.ts +133 -0
  191. package/src/hooks/useOrientationVideo.ts +5 -4
  192. package/src/hooks/useTemplateKYCFlow.tsx +347 -32
  193. package/src/hooks/useTemplateLoader.ts +102 -0
  194. package/src/i18n/en/index.ts +53 -2
  195. package/src/i18n/fr/index.ts +37 -1
  196. package/src/index.ts +14 -0
  197. package/src/modules/api/CardAuthentification.ts +76 -11
  198. package/src/modules/api/KYCService.ts +129 -45
  199. package/src/modules/api/SelfieVerification.ts +25 -3
  200. package/src/modules/api/TemplateService.ts +167 -0
  201. package/src/types/KYC.types.ts +331 -3
  202. package/src/types/env.types.ts +13 -0
  203. package/src/utils/cropByObb.ts +83 -3
  204. package/src/utils/deviceDetection.ts +11 -0
  205. package/src/utils/platformAlert.ts +86 -0
  206. package/src/utils/template-transformer.ts +445 -0
  207. 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<{ onComplete: (data: VerificationState) => void, onCancel: () => void, onError: (error: string) => void, language: string, API_KEY: string|undefined }> = ({ onComplete, onCancel, onError, language, API_KEY }) => {
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
- // Gérer l'erreur
164
+ onError(error);
242
165
  };
243
- // console.log('API_KEY', API_KEY);
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 , paddingVertical:25}}>
247
- <View style={{ flex: 1 }}>
248
- <TemplateKYCFlow
249
- template={advancedVerificationTemplate}
250
- onComplete={handleComplete}
251
- onError={handleError}
252
- onCancel={handleCancel}
253
- language={language} // ou "en" pour l'anglais
254
- API_KEY={API_KEY}
255
- />
256
- </View>
257
- </SafeAreaView>
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
-