@transfergratis/react-native-sdk 0.1.4 → 0.1.5

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 (199) hide show
  1. package/build/api/axios.d.ts +30 -0
  2. package/build/api/axios.d.ts.map +1 -0
  3. package/build/api/axios.js +92 -0
  4. package/build/api/axios.js.map +1 -0
  5. package/build/components/EnhancedCameraView.d.ts +1 -41
  6. package/build/components/EnhancedCameraView.d.ts.map +1 -1
  7. package/build/components/EnhancedCameraView.js +75 -34
  8. package/build/components/EnhancedCameraView.js.map +1 -1
  9. package/build/components/EnhancedCameraView.web.d.ts +1 -41
  10. package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
  11. package/build/components/EnhancedCameraView.web.js +28 -4
  12. package/build/components/EnhancedCameraView.web.js.map +1 -1
  13. package/build/components/KYCElements/CountrySelectionTemplate.d.ts +2 -2
  14. package/build/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
  15. package/build/components/KYCElements/CountrySelectionTemplate.js +71 -114
  16. package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
  17. package/build/components/KYCElements/FileUploadTemplate.d.ts.map +1 -1
  18. package/build/components/KYCElements/FileUploadTemplate.js +7 -3
  19. package/build/components/KYCElements/FileUploadTemplate.js.map +1 -1
  20. package/build/components/KYCElements/IDCardCapture.d.ts +7 -2
  21. package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
  22. package/build/components/KYCElements/IDCardCapture.js +253 -104
  23. package/build/components/KYCElements/IDCardCapture.js.map +1 -1
  24. package/build/components/KYCElements/InitializationStep.d.ts +5 -0
  25. package/build/components/KYCElements/InitializationStep.d.ts.map +1 -0
  26. package/build/components/KYCElements/InitializationStep.js +41 -0
  27. package/build/components/KYCElements/InitializationStep.js.map +1 -0
  28. package/build/components/KYCElements/LocationCaptureTemplate.d.ts.map +1 -1
  29. package/build/components/KYCElements/LocationCaptureTemplate.js +15 -13
  30. package/build/components/KYCElements/LocationCaptureTemplate.js.map +1 -1
  31. package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -2
  32. package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
  33. package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
  34. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -2
  35. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
  36. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
  37. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -2
  38. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
  39. package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
  40. package/build/components/KYCElements/ReviewSubmitTemplate.d.ts +12 -0
  41. package/build/components/KYCElements/ReviewSubmitTemplate.d.ts.map +1 -0
  42. package/build/components/KYCElements/ReviewSubmitTemplate.js +171 -0
  43. package/build/components/KYCElements/ReviewSubmitTemplate.js.map +1 -0
  44. package/build/components/KYCElements/SelfieCaptureTemplate.d.ts +6 -2
  45. package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
  46. package/build/components/KYCElements/SelfieCaptureTemplate.js +105 -35
  47. package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
  48. package/build/components/KYCElements/VerificationProgressTemplate.d.ts +12 -0
  49. package/build/components/KYCElements/VerificationProgressTemplate.d.ts.map +1 -0
  50. package/build/components/KYCElements/VerificationProgressTemplate.js +93 -0
  51. package/build/components/KYCElements/VerificationProgressTemplate.js.map +1 -0
  52. package/build/components/OverLay/IdCard.d.ts +1 -1
  53. package/build/components/OverLay/IdCard.d.ts.map +1 -1
  54. package/build/components/OverLay/IdCard.js +10 -6
  55. package/build/components/OverLay/IdCard.js.map +1 -1
  56. package/build/components/OverLay/SelfieOverlay.d.ts +1 -1
  57. package/build/components/OverLay/SelfieOverlay.d.ts.map +1 -1
  58. package/build/components/OverLay/SelfieOverlay.js +5 -4
  59. package/build/components/OverLay/SelfieOverlay.js.map +1 -1
  60. package/build/components/OverLay/type.d.ts +71 -1
  61. package/build/components/OverLay/type.d.ts.map +1 -1
  62. package/build/components/OverLay/type.js.map +1 -1
  63. package/build/components/TemplateKYCExample.d.ts.map +1 -1
  64. package/build/components/TemplateKYCExample.js +72 -197
  65. package/build/components/TemplateKYCExample.js.map +1 -1
  66. package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
  67. package/build/components/TemplateKYCFlowRefactored.js +63 -39
  68. package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
  69. package/build/components/example/OrientationVideoExample.d.ts.map +1 -1
  70. package/build/components/example/OrientationVideoExample.js +1 -5
  71. package/build/components/example/OrientationVideoExample.js.map +1 -1
  72. package/build/config/countriesData.d.ts +3 -0
  73. package/build/config/countriesData.d.ts.map +1 -0
  74. package/build/config/countriesData.js +79 -0
  75. package/build/config/countriesData.js.map +1 -0
  76. package/build/config/region_mapping.d.ts +3 -0
  77. package/build/config/region_mapping.d.ts.map +1 -0
  78. package/build/config/region_mapping.js +687 -0
  79. package/build/config/region_mapping.js.map +1 -0
  80. package/build/hooks/useI18n.d.ts +11 -0
  81. package/build/hooks/useI18n.d.ts.map +1 -0
  82. package/build/hooks/useI18n.js +37 -0
  83. package/build/hooks/useI18n.js.map +1 -0
  84. package/build/hooks/useOrientationVideo.d.ts +1 -2
  85. package/build/hooks/useOrientationVideo.d.ts.map +1 -1
  86. package/build/hooks/useOrientationVideo.js +2 -1
  87. package/build/hooks/useOrientationVideo.js.map +1 -1
  88. package/build/hooks/useRealtimeVerifier.d.ts +28 -0
  89. package/build/hooks/useRealtimeVerifier.d.ts.map +1 -0
  90. package/build/hooks/useRealtimeVerifier.js +91 -0
  91. package/build/hooks/useRealtimeVerifier.js.map +1 -0
  92. package/build/hooks/useTemplateKYCFlow.d.ts +1 -0
  93. package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
  94. package/build/hooks/useTemplateKYCFlow.js +337 -38
  95. package/build/hooks/useTemplateKYCFlow.js.map +1 -1
  96. package/build/i18n/en/index.d.ts +168 -0
  97. package/build/i18n/en/index.d.ts.map +1 -0
  98. package/build/i18n/en/index.js +195 -0
  99. package/build/i18n/en/index.js.map +1 -0
  100. package/build/i18n/fr/index.d.ts +168 -0
  101. package/build/i18n/fr/index.d.ts.map +1 -0
  102. package/build/i18n/fr/index.js +194 -0
  103. package/build/i18n/fr/index.js.map +1 -0
  104. package/build/i18n/index.d.ts +10 -0
  105. package/build/i18n/index.d.ts.map +1 -0
  106. package/build/i18n/index.js +56 -0
  107. package/build/i18n/index.js.map +1 -0
  108. package/build/i18n/types.d.ts +153 -0
  109. package/build/i18n/types.d.ts.map +1 -0
  110. package/build/i18n/types.js +3 -0
  111. package/build/i18n/types.js.map +1 -0
  112. package/build/i18n/usage-example.d.ts +4 -0
  113. package/build/i18n/usage-example.d.ts.map +1 -0
  114. package/build/i18n/usage-example.js +189 -0
  115. package/build/i18n/usage-example.js.map +1 -0
  116. package/build/modules/api/CardAuthentification.d.ts +22 -0
  117. package/build/modules/api/CardAuthentification.d.ts.map +1 -0
  118. package/build/modules/api/CardAuthentification.js +107 -0
  119. package/build/modules/api/CardAuthentification.js.map +1 -0
  120. package/build/modules/api/KYCService.d.ts +57 -1
  121. package/build/modules/api/KYCService.d.ts.map +1 -1
  122. package/build/modules/api/KYCService.js +348 -27
  123. package/build/modules/api/KYCService.js.map +1 -1
  124. package/build/modules/api/SelfieVerification.d.ts +3 -0
  125. package/build/modules/api/SelfieVerification.d.ts.map +1 -0
  126. package/build/modules/api/SelfieVerification.js +9 -0
  127. package/build/modules/api/SelfieVerification.js.map +1 -0
  128. package/build/modules/api/backendApi.d.ts +2 -0
  129. package/build/modules/api/backendApi.d.ts.map +1 -0
  130. package/build/modules/api/backendApi.js +6 -0
  131. package/build/modules/api/backendApi.js.map +1 -0
  132. package/build/modules/api/types.d.ts +20 -0
  133. package/build/modules/api/types.d.ts.map +1 -0
  134. package/build/modules/api/types.js +2 -0
  135. package/build/modules/api/types.js.map +1 -0
  136. package/build/types/KYC.types.d.ts +59 -7
  137. package/build/types/KYC.types.d.ts.map +1 -1
  138. package/build/types/KYC.types.js +9 -1
  139. package/build/types/KYC.types.js.map +1 -1
  140. package/build/utils/cropByObb.d.ts +11 -0
  141. package/build/utils/cropByObb.d.ts.map +1 -0
  142. package/build/utils/cropByObb.js +78 -0
  143. package/build/utils/cropByObb.js.map +1 -0
  144. package/build/utils/get-document-type-info.d.ts +13 -0
  145. package/build/utils/get-document-type-info.d.ts.map +1 -0
  146. package/build/utils/get-document-type-info.js +59 -0
  147. package/build/utils/get-document-type-info.js.map +1 -0
  148. package/build/utils/pathToBase64.d.ts +3 -0
  149. package/build/utils/pathToBase64.d.ts.map +1 -0
  150. package/build/utils/pathToBase64.js +47 -0
  151. package/build/utils/pathToBase64.js.map +1 -0
  152. package/build/utils/remove-duplicate.d.ts +2 -0
  153. package/build/utils/remove-duplicate.d.ts.map +1 -0
  154. package/build/utils/remove-duplicate.js +4 -0
  155. package/build/utils/remove-duplicate.js.map +1 -0
  156. package/package.json +3 -1
  157. package/src/api/axios.ts +144 -0
  158. package/src/components/EnhancedCameraView.tsx +96 -78
  159. package/src/components/EnhancedCameraView.web.tsx +41 -40
  160. package/src/components/KYCElements/CountrySelectionTemplate.tsx +104 -136
  161. package/src/components/KYCElements/FileUploadTemplate.tsx +14 -8
  162. package/src/components/KYCElements/IDCardCapture.tsx +311 -115
  163. package/src/components/KYCElements/InitializationStep.tsx +53 -0
  164. package/src/components/KYCElements/LocationCaptureTemplate.tsx +17 -15
  165. package/src/components/KYCElements/OrientationVideoCapture.tsx +2 -2
  166. package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +2 -2
  167. package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +2 -2
  168. package/src/components/KYCElements/ReviewSubmitTemplate.tsx +201 -0
  169. package/src/components/KYCElements/SelfieCaptureTemplate.tsx +140 -53
  170. package/src/components/KYCElements/VerificationProgressTemplate.tsx +123 -0
  171. package/src/components/OverLay/IdCard.tsx +17 -9
  172. package/src/components/OverLay/SelfieOverlay.tsx +6 -5
  173. package/src/components/OverLay/type.ts +64 -2
  174. package/src/components/TemplateKYCExample.tsx +76 -197
  175. package/src/components/TemplateKYCFlowRefactored.tsx +74 -46
  176. package/src/components/example/OrientationVideoExample.tsx +3 -7
  177. package/src/config/countriesData.ts +84 -0
  178. package/src/config/region_mapping.ts +688 -0
  179. package/src/hooks/useI18n.ts +53 -0
  180. package/src/hooks/useOrientationVideo.ts +2 -2
  181. package/src/hooks/useRealtimeVerifier.ts +128 -0
  182. package/src/hooks/useTemplateKYCFlow.tsx +375 -53
  183. package/src/i18n/README.md +288 -0
  184. package/src/i18n/en/index.ts +206 -0
  185. package/src/i18n/fr/index.ts +205 -0
  186. package/src/i18n/index.ts +65 -0
  187. package/src/i18n/types.ts +172 -0
  188. package/src/i18n/usage-example.tsx +202 -0
  189. package/src/modules/api/CardAuthentification.ts +114 -0
  190. package/src/modules/api/KYCService.ts +403 -30
  191. package/src/modules/api/SelfieVerification.ts +11 -0
  192. package/src/modules/api/backendApi.ts +8 -0
  193. package/src/modules/api/types.ts +24 -0
  194. package/src/types/KYC.types.ts +83 -14
  195. package/src/utils/cropByObb.ts +99 -0
  196. package/src/utils/get-document-type-info.ts +62 -0
  197. package/src/utils/pathToBase64.ts +47 -0
  198. package/src/utils/remove-duplicate.ts +3 -0
  199. package/src/types/nativewind.d.ts +0 -2
@@ -0,0 +1,123 @@
1
+ import React from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
3
+ import { TemplateComponent } from '../../types/KYC.types';
4
+ import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
5
+ import { useI18n } from '../../hooks/useI18n';
6
+
7
+ interface VerificationProgressTemplateProps {
8
+ component: TemplateComponent;
9
+ value: unknown;
10
+ onValueChange: (data: unknown) => void;
11
+ error?: string;
12
+ language?: string;
13
+ }
14
+
15
+ export const VerificationProgressTemplate: React.FC<VerificationProgressTemplateProps> = () => {
16
+ const { t } = useI18n();
17
+ const { state, actions } = useTemplateKYCFlowContext();
18
+
19
+ const verification = state.verification;
20
+
21
+ const isSuccess = verification.status === 'success';
22
+ const isFailed = verification.status === 'failed';
23
+
24
+ if (isSuccess) {
25
+ return (
26
+ <View style={styles.container}>
27
+ <Text style={styles.title}>{t('kyc.verificationProgress.steps.complete')}</Text>
28
+ <Text style={styles.subtitle}>{t('kyc.verificationProgress.subtitle')}</Text>
29
+ <TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.resetTemplate()}>
30
+ <Text style={styles.buttonText}>{t('common.continue')}</Text>
31
+ </TouchableOpacity>
32
+ {verification.result?.referenceId ? (
33
+ <Text style={styles.refText}>{`Verification ID: ${verification.result.referenceId}`}</Text>
34
+ ) : null}
35
+ </View>
36
+ );
37
+ }
38
+
39
+ if (isFailed) {
40
+ return (
41
+ <View style={styles.container}>
42
+ <Text style={styles.title}>{t('kyc.verificationProgress.status.failed')}</Text>
43
+ <Text style={styles.subtitle}>{t('errors.validationError')}</Text>
44
+ <View style={styles.issuesBox}>
45
+ <Text style={styles.issuesTitle}>{t('common.error')}</Text>
46
+ {(verification.result?.issues || []).map((issue, idx) => (
47
+ <Text key={idx} style={styles.issueItem}>• {issue}</Text>
48
+ ))}
49
+ </View>
50
+ <TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.goToComponent( state.template.components.find(c=>c.type!=='review_submit' && c.type!=='verification_progress')?.id || 0)}>
51
+ <Text style={styles.buttonText}>{t('common.retry')}</Text>
52
+ </TouchableOpacity>
53
+ <TouchableOpacity style={[styles.button, styles.secondary]}>
54
+ <Text style={styles.secondaryText}>{t('common.info')}</Text>
55
+ </TouchableOpacity>
56
+ {verification.result?.referenceId ? (
57
+ <Text style={styles.refText}>{`Reference ID: ${verification.result.referenceId}`}</Text>
58
+ ) : null}
59
+ </View>
60
+ );
61
+ }
62
+
63
+ return (
64
+ <View style={styles.container}>
65
+ <Text style={styles.title}>{t('kyc.verificationProgress.title')}</Text>
66
+ <Text style={styles.subtitle}>{t('kyc.verificationProgress.estimatedTime')}</Text>
67
+
68
+ <View style={styles.timeline}>
69
+ <View style={[styles.dot, styles.done]}><Text style={styles.stepCheckmark}>✓</Text></View>
70
+ <View style={styles.line} />
71
+ <View style={[styles.dot, styles.active]}><Text style={styles.stepCheckmark}>2</Text></View>
72
+ <View style={styles.line} />
73
+ <View style={[styles.dot, styles.pending]}><Text style={styles.stepCheckmark}>3</Text></View>
74
+ </View>
75
+
76
+ <View style={styles.row}>
77
+ <Text style={styles.stepLabel}>{t('kyc.verificationProgress.status.completed')}</Text>
78
+ <Text style={styles.stepLabel}>{t('kyc.verificationProgress.steps.analyzing')}</Text>
79
+ <Text style={styles.stepLabel}>{t('kyc.verificationProgress.steps.verifying')}</Text>
80
+ </View>
81
+
82
+ <View style={styles.card}>
83
+ <Text style={styles.cardTitle}>{t('kyc.idCardCapture.title')}</Text>
84
+ <Text style={styles.cardLine}>{t('kyc.verificationProgress.steps.extracting')}</Text>
85
+ <Text style={styles.cardTitle}>{t('kyc.selfieCapture.title')}</Text>
86
+ <Text style={styles.cardLine}>{t('kyc.verificationProgress.steps.analyzing')}</Text>
87
+ <Text style={styles.cardTitle}>{t('kyc.verificationProgress.title')}</Text>
88
+ <Text style={styles.cardLine}>{t('kyc.verificationProgress.status.pending')}</Text>
89
+ </View>
90
+ </View>
91
+ );
92
+ };
93
+
94
+ const styles = StyleSheet.create({
95
+ container: { flex: 1, width: '100%', paddingHorizontal: 16, paddingVertical: 12 },
96
+ title: { fontSize: 24, fontWeight: 'bold', color: '#111827', textAlign: 'center', marginTop: 12 },
97
+ subtitle: { fontSize: 14, color: '#6B7280', textAlign: 'center', marginTop: 8 },
98
+ timeline: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginTop: 24 },
99
+ dot: { width: 38, height: 38, borderRadius: 34, justifyContent: 'center', alignItems: 'center' },
100
+ stepCheckmark: { color: 'white', fontSize: 16, fontWeight: 'bold' },
101
+ line: { flex: 1, height: 4, backgroundColor: '#E5E7EB' },
102
+ done: { backgroundColor: '#10B981' },
103
+ active: { backgroundColor: '#F59E0B' },
104
+ pending: { backgroundColor: '#E5E7EB' },
105
+ row: { flexDirection: 'row', justifyContent: 'space-between', marginTop: 8 },
106
+ stepLabel: { fontSize: 14, color: '#111827', fontWeight: '600' },
107
+ card: { backgroundColor: 'white', padding: 16, borderRadius: 16, marginTop: 24 },
108
+ cardTitle: { fontSize: 16, color: '#6B7280', marginTop: 8 },
109
+ cardLine: { fontSize: 18, color: '#111827', fontWeight: '600', marginTop: 2 },
110
+ // Success/Failure specific
111
+ button: { paddingVertical: 14, borderRadius: 10, alignItems: 'center', marginTop: 20 },
112
+ primary: { backgroundColor: '#2DBD60' },
113
+ buttonText: { color: 'white', fontSize: 16, fontWeight: '600' },
114
+ refText: { marginTop: 12, textAlign: 'center', color: '#6B7280' },
115
+ issuesBox: { backgroundColor: '#FEF2F2', borderRadius: 16, padding: 16, marginTop: 20 },
116
+ issuesTitle: { color: '#991B1B', fontWeight: '700', marginBottom: 8 },
117
+ issueItem: { color: '#991B1B', marginTop: 4 },
118
+ secondary: { backgroundColor: '#F3F4F6' },
119
+ secondaryText: { color: '#111827', fontSize: 16, fontWeight: '600' },
120
+ });
121
+
122
+
123
+
@@ -7,18 +7,18 @@ import StepOverlay from "./StepOverlay";
7
7
 
8
8
 
9
9
 
10
- const IdCardOverlay = ({ xMin: xMinProps, yMin: yMinProps, xMax: xMaxProps, yMax: yMaxProps, cornerOpacity, instructions, cornerColor = "#4CAF50", stepperProps }: IdCardOverlayProps) => {
10
+ const IdCardOverlay = ({ xMin: xMinProps, yMin: yMinProps, xMax: xMaxProps, yMax: yMaxProps, cornerOpacity, instructions, cornerColor = "#4CAF50", stepperProps, isSuccess, language }: IdCardOverlayProps) => {
11
11
  const screenWidth = Dimensions.get('window').width;
12
12
  const screenHeight = Dimensions.get('window').height;
13
13
 
14
14
  const boxWidth = xMaxProps - xMinProps;
15
15
  const boxHeight = yMaxProps - yMinProps;
16
16
 
17
-
18
17
 
19
18
 
20
-
21
-
19
+
20
+
21
+
22
22
  // Calculer les coordonnées pour centrer le cadre
23
23
  const xMin = (screenWidth - boxWidth) / 2;
24
24
  const yMin = (screenHeight - boxHeight) / 3;
@@ -30,7 +30,7 @@ const IdCardOverlay = ({ xMin: xMinProps, yMin: yMinProps, xMax: xMaxProps, yMax
30
30
  {stepperProps ? (
31
31
  <StepOverlay {...stepperProps} />
32
32
  ) : null}
33
-
33
+
34
34
  <Animated.View style={[styles.topIntruction]}>
35
35
  <Text style={styles.topIntructionText}>
36
36
  💡 {instructions}
@@ -134,15 +134,23 @@ const IdCardOverlay = ({ xMin: xMinProps, yMin: yMinProps, xMax: xMaxProps, yMax
134
134
  opacity={cornerOpacity}
135
135
  />
136
136
  </Svg>
137
-
138
- <ScanningLine yMin={yMin} screenWidth={screenWidth} height={screenHeight} yMax={yMax} />
137
+ {isSuccess ? null : (
138
+ <ScanningLine yMin={yMin} screenWidth={screenWidth} height={screenHeight} yMax={yMax} />
139
+ )}
140
+ {/* <ScanningLine yMin={yMin} screenWidth={screenWidth} height={screenHeight} yMax={yMax} /> */}
139
141
 
140
142
  <View style={styles.bottomIntruction}>
141
143
  <Text style={styles.bottomTitle}>
142
- Mesurez 100cm de hauteur.
144
+ {language === "en" ? "Measure 100cm in height.":"Mesurez 100cm de hauteur."}
145
+
143
146
  </Text>
144
147
  <Text style={styles.bottomSubtitle}>
145
- Ne pas déplacer la caméra pendant la capture. • Ne pas déplacer la caméra pendant la capture.
148
+ {
149
+ language === "en"
150
+ ? "Do not move the camera during capture. • Do not move the camera during capture."
151
+ : "Ne pas déplacer la caméra pendant la capture. • Ne pas déplacer la caméra pendant la capture."
152
+ }
153
+
146
154
  </Text>
147
155
  </View>
148
156
  </View>)
@@ -6,7 +6,7 @@ import FrontSelfieIcon from "../Svgs/frontSelfieIcon";
6
6
  import StepOverlay from "./StepOverlay";
7
7
  import SideSelfieIcon from "../Svgs/sideSelfieIcon";
8
8
 
9
- const SelfieOverlay = ({ xMin, yMin, xMax, yMax, cornerOpacity, instructions, cornerColor = "#4CAF50", stepperProps, instructionsTile, instructionsSubtitle, orientation }: IdCardOverlayProps) => {
9
+ const SelfieOverlay = ({ xMin, yMin, xMax, yMax, cornerOpacity, instructions, cornerColor = "#4CAF50", stepperProps, instructionsTile, instructionsSubtitle, orientation, isSuccess }: IdCardOverlayProps) => {
10
10
  const screenWidth = Dimensions.get('window').width;
11
11
  const screenHeight = Dimensions.get('window').height;
12
12
 
@@ -65,7 +65,7 @@ const SelfieOverlay = ({ xMin, yMin, xMax, yMax, cornerOpacity, instructions, co
65
65
  fill="rgba(0, 0, 0, 0.5)"
66
66
  mask="url(#faceMask)"
67
67
  />
68
- <ScanningLine yMin={scanningYMin} screenWidth={screenWidth} height={screenHeight} yMax={scanningYMax} />
68
+ {isSuccess ? null : <ScanningLine yMin={scanningYMin} screenWidth={screenWidth} height={screenHeight} yMax={scanningYMax} />}
69
69
  </Svg>
70
70
 
71
71
  {/* Container de l'icône - centré automatiquement */}
@@ -75,17 +75,17 @@ const SelfieOverlay = ({ xMin, yMin, xMax, yMax, cornerOpacity, instructions, co
75
75
  width: iconWidth,
76
76
  height: iconHeight,
77
77
  }]}>
78
- {orientation === "front" ? <FrontSelfieIcon /> : <SideSelfieIcon />}
78
+ {orientation === "center" ? <FrontSelfieIcon /> : <SideSelfieIcon />}
79
79
  </View>
80
80
 
81
81
  {/* Flèche directionnelle pour les orientations latérales */}
82
- {orientation !== "front" ? (
82
+ {orientation !== "center" ? (
83
83
  <View style={[
84
84
  styles.arrowContainer,
85
85
  {
86
86
  top: iconY + iconHeight / 2 - 50, // Centré verticalement par rapport à l'icône
87
87
  left: orientation === "left" ? iconX - 72 : 'auto',
88
- right: orientation === "right" ? iconX-75: 'auto'
88
+ right: orientation === "right" ? iconX - 75 : 'auto'
89
89
  }
90
90
  ]}>
91
91
  <Image
@@ -99,6 +99,7 @@ const SelfieOverlay = ({ xMin, yMin, xMax, yMax, cornerOpacity, instructions, co
99
99
  </View>
100
100
  ) : null}
101
101
 
102
+
102
103
  <View style={styles.bottomIntruction}>
103
104
  <Text style={styles.bottomTitle}>
104
105
  {instructionsTile}
@@ -1,3 +1,6 @@
1
+ import { ViewStyle } from "react-native";
2
+ import { ISilentCaptureResult } from "../../types/KYC.types";
3
+
1
4
  export interface IdCardOverlayProps {
2
5
  xMin: number;
3
6
  yMin: number;
@@ -9,7 +12,10 @@ export interface IdCardOverlayProps {
9
12
  stepperProps?: StepperProps;
10
13
  instructionsTile?: string;
11
14
  instructionsSubtitle?: string;
12
- orientation?: 'front' | 'left' | 'right';
15
+ orientation?: 'center' | 'left' | 'right';
16
+ isAnalyzing?: boolean;
17
+ isSuccess?: boolean;
18
+ language:string
13
19
  }
14
20
 
15
21
 
@@ -18,4 +24,60 @@ interface StepperProps {
18
24
  selectedDocumentType: string;
19
25
  step: number;
20
26
  totalSteps: number;
21
- }
27
+ }
28
+
29
+ export interface ExtractMrzTextResponse {
30
+ parsed_data: {
31
+ mrz_type: string;
32
+ document_code: string;
33
+ issuer_code: string;
34
+ surname: string;
35
+ given_name: string;
36
+ document_number: string;
37
+ document_number_checkdigit: string;
38
+ nationality_code: string;
39
+ birth_date: string;
40
+ sex: string;
41
+ expiry_date: string;
42
+ optional_data: string;
43
+ mrz_text: string;
44
+ status: string;
45
+ },
46
+ success: boolean;
47
+ }
48
+
49
+
50
+
51
+ export interface EnhancedCameraViewProps {
52
+ instructions?: string;
53
+ showCamera: boolean;
54
+ cameraType?: 'front' | 'back';
55
+ style?: ViewStyle;
56
+ onCapture?: (result: { success: boolean; path?: string; error?: string }) => void;
57
+ onSilentCapture?: (result: { success: boolean; path?: string; error?: string }) => void;
58
+ silentCaptureResult?: ISilentCaptureResult;
59
+ onError?: (event: { message: string }) => void;
60
+ onClose?: () => void;
61
+ enableFlash?: boolean;
62
+ enableHdr?: boolean;
63
+ quality?: 'low' | 'medium' | 'high';
64
+ showCaptureButton?: boolean;
65
+ showSwitchCamera?: boolean;
66
+ overlayComponent?: React.ReactNode;
67
+ bbox?: {
68
+ xMin: number;
69
+ yMin: number;
70
+ xMax: number;
71
+ yMax: number;
72
+ borderColor?: string;
73
+ borderWidth?: number;
74
+ cornerRadius?: number;
75
+ };
76
+ canFlip?: boolean;
77
+ // Video recording props
78
+ enableVideo?: boolean;
79
+ isRecording?: boolean;
80
+ onVideoRecordingStart?: () => void;
81
+ onVideoRecordingStop?: (result: { success: boolean; path?: string; error?: string }) => void;
82
+ videoDuration?: number;
83
+ }
@@ -39,147 +39,72 @@ const advancedVerificationTemplate: KYCTemplate = {
39
39
  } as const
40
40
  },
41
41
  {
42
- id: 1,
43
- type: "id_card" as const,
42
+ id: 6,
43
+ type: "country_selection" as const,
44
44
  order: 2,
45
- templateId: 1,
46
45
  labels: {
47
- en: "Upload front of ID card",
48
- fr: "Téléversez le recto de votre carte d'identité"
46
+ en: "Select your country",
47
+ fr: "Sélectionnez votre pays"
49
48
  },
50
49
  instructions: {
51
- en: "Take a clear photo of the front of your ID.",
52
- fr: "Prenez une photo nette du recto de votre pièce."
50
+ en: "Choose your country of residence.",
51
+ fr: "Choisissez votre pays de résidence."
53
52
  },
54
53
  ui: {
55
- icon: "id-card-icon.png",
54
+ icon: "country-icon.png",
56
55
  themeColor: "#2DBD60",
57
- buttonText: { en: "Next", fr: "Suivant" }
56
+ buttonText: { en: "Confirm", fr: "Confirmer" }
58
57
  },
59
58
  config: {
60
- sides: ["front"],
61
- allowed_formats: ["jpg", "png"],
62
- max_size_mb: 5,
63
- document_types: ["id_card", "passport", "drivers_license", "national_id"],
64
- bbox_configs: {
65
- id_card: {
66
- xMin: 20,
67
- yMin: 140,
68
- xMax: 370,
69
- yMax: 340,
70
- borderColor: "#2DBD60",
71
- borderWidth: 4,
72
- cornerRadius: 12
73
- },
74
- passport: {
75
- xMin: 15,
76
- yMin: 130,
77
- xMax: 375,
78
- yMax: 350,
79
- borderColor: "#007AFF",
80
- borderWidth: 4,
81
- cornerRadius: 8
82
- },
83
- drivers_license: {
84
- xMin: 25,
85
- yMin: 150,
86
- xMax: 365,
87
- yMax: 330,
88
- borderColor: "#FF9500",
89
- borderWidth: 4,
90
- cornerRadius: 10
91
- },
92
- national_id: {
93
- xMin: 20,
94
- yMin: 140,
95
- xMax: 370,
96
- yMax: 340,
97
- borderColor: "#5856D6",
98
- borderWidth: 4,
99
- cornerRadius: 12
100
- },
101
- residence_permit: {
102
- xMin: 20,
103
- yMin: 140,
104
- xMax: 370,
105
- yMax: 340,
106
- borderColor: "#2DBD60",
107
- borderWidth: 4,
108
- cornerRadius: 12
109
- },
110
- voter_id: {
111
- xMin: 20,
112
- yMin: 140,
113
- xMax: 370,
114
- yMax: 340,
115
- borderColor: "#2DBD60",
116
- borderWidth: 4,
117
- cornerRadius: 12
118
- },
119
- military_id: {
120
- xMin: 20,
121
- yMin: 140,
122
- xMax: 370,
123
- yMax: 340,
124
- borderColor: "#2DBD60",
125
- borderWidth: 4,
126
- cornerRadius: 12
127
- },
128
- student_id: {
129
- xMin: 20,
130
- yMin: 140,
131
- xMax: 370,
132
- yMax: 340,
133
- borderColor: "#2DBD60",
134
- borderWidth: 4,
135
- cornerRadius: 12
136
- },
137
- work_permit: {
138
- xMin: 20,
139
- yMin: 140,
140
- xMax: 370,
141
- yMax: 340,
142
- borderColor: "#2DBD60",
143
- borderWidth: 4,
144
- cornerRadius: 12
145
- },
146
- other: {
147
- xMin: 20,
148
- yMin: 140,
149
- xMax: 370,
150
- yMax: 340,
151
- borderColor: "#2DBD60",
152
- borderWidth: 4,
153
- cornerRadius: 12
154
- }
155
- }
59
+ allowed_countries: ["CA", "FR", "CM", "US", "DE", "CI", "SN", "NG", "MA", "DZ"],
60
+ default_country: "CA",
61
+ required: true
156
62
  } as const
157
63
  },
158
64
  {
159
- id: 2,
65
+ id: 1,
160
66
  type: "id_card" as const,
161
67
  order: 3,
162
68
  templateId: 1,
163
69
  labels: {
164
- en: "Upload back of ID card",
165
- fr: "Téléversez le verso de votre carte d'identité"
70
+ front: {
71
+ en: "Upload front of ID card",
72
+ fr: "Téléversez le recto de votre carte d'identité"
73
+ },
74
+ back: {
75
+ en: "Upload back of ID card",
76
+ fr: "Téléversez le verso de votre carte d'identité"
77
+ },
166
78
  },
167
79
  instructions: {
168
- en: "Take a clear photo of the back of your ID.",
169
- fr: "Prenez une photo nette du verso de votre pièce."
80
+ front: {
81
+ en: "Take a clear photo of the front of your ID.",
82
+ fr: "Prenez une photo nette du recto de votre pièce."
83
+ },
84
+ back: {
85
+ en: "Take a clear photo of the back of your ID.",
86
+ fr: "Prenez une photo nette du verso de votre pièce."
87
+ },
170
88
  },
171
89
  ui: {
172
- icon: "id-card-icon.png",
173
- themeColor: "#2DBD60",
174
- buttonText: { en: "Next", fr: "Suivant" }
90
+ front: {
91
+ icon: "id-card-icon.png",
92
+ themeColor: "#2DBD60",
93
+ buttonText: { en: "Next", fr: "Suivant" }
94
+ },
95
+ back: {
96
+ icon: "id-card-icon.png",
97
+ themeColor: "#2DBD60",
98
+ buttonText: { en: "Next", fr: "Suivant" }
99
+ },
175
100
  },
176
101
  config: {
177
- sides: ["back"],
102
+ sides: ["front", "back"],
178
103
  allowed_formats: ["jpg", "png"],
179
104
  max_size_mb: 5,
180
- document_types: ["id_card", "passport", "drivers_license", "national_id"],
105
+ document_types: ["drivers_licence", "passport", "drivers_licence", "national_id"],
181
106
  bbox_configs: {
182
- id_card: {
107
+ drivers_licence: {
183
108
  xMin: 20,
184
109
  yMin: 140,
185
110
  xMax: 370,
@@ -197,25 +122,7 @@ const advancedVerificationTemplate: KYCTemplate = {
197
122
  borderWidth: 4,
198
123
  cornerRadius: 8
199
124
  },
200
- drivers_license: {
201
- xMin: 25,
202
- yMin: 150,
203
- xMax: 365,
204
- yMax: 330,
205
- borderColor: "#FF9500",
206
- borderWidth: 4,
207
- cornerRadius: 10
208
- },
209
- national_id: {
210
- xMin: 20,
211
- yMin: 140,
212
- xMax: 370,
213
- yMax: 340,
214
- borderColor: "#5856D6",
215
- borderWidth: 4,
216
- cornerRadius: 12
217
- },
218
- residence_permit: {
125
+ identity_card: {
219
126
  xMin: 20,
220
127
  yMin: 140,
221
128
  xMax: 370,
@@ -224,7 +131,7 @@ const advancedVerificationTemplate: KYCTemplate = {
224
131
  borderWidth: 4,
225
132
  cornerRadius: 12
226
133
  },
227
- voter_id: {
134
+ health_insurance_card: {
228
135
  xMin: 20,
229
136
  yMin: 140,
230
137
  xMax: 370,
@@ -233,16 +140,16 @@ const advancedVerificationTemplate: KYCTemplate = {
233
140
  borderWidth: 4,
234
141
  cornerRadius: 12
235
142
  },
236
- military_id: {
143
+ national_id: {
237
144
  xMin: 20,
238
145
  yMin: 140,
239
146
  xMax: 370,
240
147
  yMax: 340,
241
- borderColor: "#2DBD60",
148
+ borderColor: "#5856D6",
242
149
  borderWidth: 4,
243
150
  cornerRadius: 12
244
151
  },
245
- student_id: {
152
+ permanent_residence: {
246
153
  xMin: 20,
247
154
  yMin: 140,
248
155
  xMax: 370,
@@ -251,6 +158,8 @@ const advancedVerificationTemplate: KYCTemplate = {
251
158
  borderWidth: 4,
252
159
  cornerRadius: 12
253
160
  },
161
+
162
+
254
163
  work_permit: {
255
164
  xMin: 20,
256
165
  yMin: 140,
@@ -260,22 +169,14 @@ const advancedVerificationTemplate: KYCTemplate = {
260
169
  borderWidth: 4,
261
170
  cornerRadius: 12
262
171
  },
263
- other: {
264
- xMin: 20,
265
- yMin: 140,
266
- xMax: 370,
267
- yMax: 340,
268
- borderColor: "#2DBD60",
269
- borderWidth: 4,
270
- cornerRadius: 12
271
- }
172
+
272
173
  }
273
174
  } as const
274
175
  },
275
176
  {
276
177
  id: 3,
277
178
  type: "selfie" as const,
278
- order: 4,
179
+ order: 5,
279
180
  templateId: 1,
280
181
  labels: {
281
182
  en: "Take selfies from different angles",
@@ -293,55 +194,33 @@ const advancedVerificationTemplate: KYCTemplate = {
293
194
  config: {
294
195
  liveness_check: true,
295
196
  max_attempts: 3,
296
- orientations: ["front", "left", "right"]
197
+ orientations: ["center", "left", "right"]
297
198
  } as const
298
199
  },
299
- {
300
- id: 4,
301
- type: "file_upload" as const,
302
- order: 5,
303
- labels: {
304
- en: "Upload proof of address",
305
- fr: "Téléversez un justificatif de domicile"
306
- },
307
- instructions: {
308
- en: "Upload a recent utility bill or bank statement (PDF, JPG, PNG).",
309
- fr: "Téléversez une facture récente ou un relevé bancaire (PDF, JPG, PNG)."
310
- },
311
- ui: {
312
- icon: "file-upload-icon.png",
313
- themeColor: "#2DBD60",
314
- buttonText: { en: "Upload", fr: "Téléverser" }
315
- },
316
- config: {
317
- allowed_formats: ["pdf", "jpg", "png"],
318
- max_size_mb: 10,
319
- required: true
320
- } as const
321
- },
322
- {
323
- id: 6,
324
- type: "country_selection" as const,
325
- order: 6,
326
- labels: {
327
- en: "Select your country",
328
- fr: "Sélectionnez votre pays"
329
- },
330
- instructions: {
331
- en: "Choose your country of residence.",
332
- fr: "Choisissez votre pays de résidence."
333
- },
334
- ui: {
335
- icon: "country-icon.png",
336
- themeColor: "#2DBD60",
337
- buttonText: { en: "Confirm", fr: "Confirmer" }
338
- },
339
- config: {
340
- allowed_countries: ["FR", "CM", "US", "DE"],
341
- default_country: "FR",
342
- required: true
343
- } as const
344
- }
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
+
345
224
  ]
346
225
  };
347
226
 
@@ -369,7 +248,7 @@ export const TemplateKYCExample: React.FC<{ onComplete: (data: Record<number, an
369
248
  onComplete={handleComplete}
370
249
  onError={handleError}
371
250
  onCancel={handleCancel}
372
- language="fr" // ou "en" pour l'anglais
251
+ language="en" // ou "en" pour l'anglais
373
252
  />
374
253
  </View>
375
254
  );