@transfergratis/react-native-sdk 0.1.3 → 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 (308) hide show
  1. package/android/.idea/caches/deviceStreaming.xml +860 -0
  2. package/android/build/.transforms/{7ec900c0f64f5f1a7c88998dd44001b8 → 01c28d00c798aa4846f16ce72123ebf9}/transformed/classes/classes_dex/classes.dex +0 -0
  3. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +1 -0
  4. package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
  5. package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
  6. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  7. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +2 -2
  8. package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
  9. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +51 -48
  10. package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
  11. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +1 -0
  12. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  13. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  14. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  15. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  16. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  17. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  18. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  19. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  20. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  21. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  22. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  23. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  24. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  25. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  26. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  27. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  28. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  29. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  30. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  31. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  32. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  33. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +1 -1
  34. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  35. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  36. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  37. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  38. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  39. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  40. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  43. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  44. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  45. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  46. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  48. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  49. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  50. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  51. package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
  52. package/android/build/outputs/logs/manifest-merger-debug-report.txt +27 -23
  53. package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule.class +0 -0
  54. package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkView.class +0 -0
  55. package/android/build.gradle +1 -5
  56. package/android/src/main/AndroidManifest.xml +1 -0
  57. package/build/api/axios.d.ts +30 -0
  58. package/build/api/axios.d.ts.map +1 -0
  59. package/build/api/axios.js +92 -0
  60. package/build/api/axios.js.map +1 -0
  61. package/build/components/EnhancedCameraView.d.ts +1 -41
  62. package/build/components/EnhancedCameraView.d.ts.map +1 -1
  63. package/build/components/EnhancedCameraView.js +76 -35
  64. package/build/components/EnhancedCameraView.js.map +1 -1
  65. package/build/components/EnhancedCameraView.web.d.ts +1 -41
  66. package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
  67. package/build/components/EnhancedCameraView.web.js +28 -4
  68. package/build/components/EnhancedCameraView.web.js.map +1 -1
  69. package/build/components/KYCElements/CountrySelectionTemplate.d.ts +2 -2
  70. package/build/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
  71. package/build/components/KYCElements/CountrySelectionTemplate.js +71 -114
  72. package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
  73. package/build/components/KYCElements/FileUploadTemplate.d.ts.map +1 -1
  74. package/build/components/KYCElements/FileUploadTemplate.js +7 -3
  75. package/build/components/KYCElements/FileUploadTemplate.js.map +1 -1
  76. package/build/components/KYCElements/IDCardCapture.d.ts +7 -2
  77. package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
  78. package/build/components/KYCElements/IDCardCapture.js +253 -104
  79. package/build/components/KYCElements/IDCardCapture.js.map +1 -1
  80. package/build/components/KYCElements/InitializationStep.d.ts +5 -0
  81. package/build/components/KYCElements/InitializationStep.d.ts.map +1 -0
  82. package/build/components/KYCElements/InitializationStep.js +41 -0
  83. package/build/components/KYCElements/InitializationStep.js.map +1 -0
  84. package/build/components/KYCElements/LocationCaptureTemplate.d.ts.map +1 -1
  85. package/build/components/KYCElements/LocationCaptureTemplate.js +15 -13
  86. package/build/components/KYCElements/LocationCaptureTemplate.js.map +1 -1
  87. package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -2
  88. package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
  89. package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
  90. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -2
  91. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
  92. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
  93. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -2
  94. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
  95. package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
  96. package/build/components/KYCElements/ReviewSubmitTemplate.d.ts +12 -0
  97. package/build/components/KYCElements/ReviewSubmitTemplate.d.ts.map +1 -0
  98. package/build/components/KYCElements/ReviewSubmitTemplate.js +171 -0
  99. package/build/components/KYCElements/ReviewSubmitTemplate.js.map +1 -0
  100. package/build/components/KYCElements/SelfieCaptureTemplate.d.ts +6 -2
  101. package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
  102. package/build/components/KYCElements/SelfieCaptureTemplate.js +105 -35
  103. package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
  104. package/build/components/KYCElements/VerificationProgressTemplate.d.ts +12 -0
  105. package/build/components/KYCElements/VerificationProgressTemplate.d.ts.map +1 -0
  106. package/build/components/KYCElements/VerificationProgressTemplate.js +93 -0
  107. package/build/components/KYCElements/VerificationProgressTemplate.js.map +1 -0
  108. package/build/components/OverLay/IdCard.d.ts +1 -1
  109. package/build/components/OverLay/IdCard.d.ts.map +1 -1
  110. package/build/components/OverLay/IdCard.js +10 -6
  111. package/build/components/OverLay/IdCard.js.map +1 -1
  112. package/build/components/OverLay/SelfieOverlay.d.ts +1 -1
  113. package/build/components/OverLay/SelfieOverlay.d.ts.map +1 -1
  114. package/build/components/OverLay/SelfieOverlay.js +5 -4
  115. package/build/components/OverLay/SelfieOverlay.js.map +1 -1
  116. package/build/components/OverLay/type.d.ts +71 -1
  117. package/build/components/OverLay/type.d.ts.map +1 -1
  118. package/build/components/OverLay/type.js.map +1 -1
  119. package/build/components/TemplateKYCExample.d.ts.map +1 -1
  120. package/build/components/TemplateKYCExample.js +72 -197
  121. package/build/components/TemplateKYCExample.js.map +1 -1
  122. package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
  123. package/build/components/TemplateKYCFlowRefactored.js +63 -39
  124. package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
  125. package/build/components/VisionCameraView.js +1 -1
  126. package/build/components/VisionCameraView.js.map +1 -1
  127. package/build/components/example/OrientationVideoExample.d.ts.map +1 -1
  128. package/build/components/example/OrientationVideoExample.js +1 -5
  129. package/build/components/example/OrientationVideoExample.js.map +1 -1
  130. package/build/components/ui/Button.js +1 -1
  131. package/build/components/ui/Button.js.map +1 -1
  132. package/build/config/countriesData.d.ts +3 -0
  133. package/build/config/countriesData.d.ts.map +1 -0
  134. package/build/config/countriesData.js +79 -0
  135. package/build/config/countriesData.js.map +1 -0
  136. package/build/config/region_mapping.d.ts +3 -0
  137. package/build/config/region_mapping.d.ts.map +1 -0
  138. package/build/config/region_mapping.js +687 -0
  139. package/build/config/region_mapping.js.map +1 -0
  140. package/build/hooks/useI18n.d.ts +11 -0
  141. package/build/hooks/useI18n.d.ts.map +1 -0
  142. package/build/hooks/useI18n.js +37 -0
  143. package/build/hooks/useI18n.js.map +1 -0
  144. package/build/hooks/useOrientationVideo.d.ts +1 -2
  145. package/build/hooks/useOrientationVideo.d.ts.map +1 -1
  146. package/build/hooks/useOrientationVideo.js +2 -1
  147. package/build/hooks/useOrientationVideo.js.map +1 -1
  148. package/build/hooks/useRealtimeVerifier.d.ts +28 -0
  149. package/build/hooks/useRealtimeVerifier.d.ts.map +1 -0
  150. package/build/hooks/useRealtimeVerifier.js +91 -0
  151. package/build/hooks/useRealtimeVerifier.js.map +1 -0
  152. package/build/hooks/useTemplateKYCFlow.d.ts +1 -0
  153. package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
  154. package/build/hooks/useTemplateKYCFlow.js +337 -38
  155. package/build/hooks/useTemplateKYCFlow.js.map +1 -1
  156. package/build/i18n/en/index.d.ts +168 -0
  157. package/build/i18n/en/index.d.ts.map +1 -0
  158. package/build/i18n/en/index.js +195 -0
  159. package/build/i18n/en/index.js.map +1 -0
  160. package/build/i18n/fr/index.d.ts +168 -0
  161. package/build/i18n/fr/index.d.ts.map +1 -0
  162. package/build/i18n/fr/index.js +194 -0
  163. package/build/i18n/fr/index.js.map +1 -0
  164. package/build/i18n/index.d.ts +10 -0
  165. package/build/i18n/index.d.ts.map +1 -0
  166. package/build/i18n/index.js +56 -0
  167. package/build/i18n/index.js.map +1 -0
  168. package/build/i18n/types.d.ts +153 -0
  169. package/build/i18n/types.d.ts.map +1 -0
  170. package/build/i18n/types.js +3 -0
  171. package/build/i18n/types.js.map +1 -0
  172. package/build/i18n/usage-example.d.ts +4 -0
  173. package/build/i18n/usage-example.d.ts.map +1 -0
  174. package/build/i18n/usage-example.js +189 -0
  175. package/build/i18n/usage-example.js.map +1 -0
  176. package/build/modules/api/CardAuthentification.d.ts +22 -0
  177. package/build/modules/api/CardAuthentification.d.ts.map +1 -0
  178. package/build/modules/api/CardAuthentification.js +107 -0
  179. package/build/modules/api/CardAuthentification.js.map +1 -0
  180. package/build/modules/api/KYCService.d.ts +57 -1
  181. package/build/modules/api/KYCService.d.ts.map +1 -1
  182. package/build/modules/api/KYCService.js +348 -27
  183. package/build/modules/api/KYCService.js.map +1 -1
  184. package/build/modules/api/SelfieVerification.d.ts +3 -0
  185. package/build/modules/api/SelfieVerification.d.ts.map +1 -0
  186. package/build/modules/api/SelfieVerification.js +9 -0
  187. package/build/modules/api/SelfieVerification.js.map +1 -0
  188. package/build/modules/api/backendApi.d.ts +2 -0
  189. package/build/modules/api/backendApi.d.ts.map +1 -0
  190. package/build/modules/api/backendApi.js +6 -0
  191. package/build/modules/api/backendApi.js.map +1 -0
  192. package/build/modules/api/types.d.ts +20 -0
  193. package/build/modules/api/types.d.ts.map +1 -0
  194. package/build/modules/api/types.js +2 -0
  195. package/build/modules/api/types.js.map +1 -0
  196. package/build/modules/camera/VisionCameraModule.d.ts +1 -1
  197. package/build/modules/camera/VisionCameraModule.d.ts.map +1 -1
  198. package/build/modules/camera/VisionCameraModule.js +8 -2
  199. package/build/modules/camera/VisionCameraModule.js.map +1 -1
  200. package/build/types/KYC.types.d.ts +59 -7
  201. package/build/types/KYC.types.d.ts.map +1 -1
  202. package/build/types/KYC.types.js +9 -1
  203. package/build/types/KYC.types.js.map +1 -1
  204. package/build/utils/cropByObb.d.ts +11 -0
  205. package/build/utils/cropByObb.d.ts.map +1 -0
  206. package/build/utils/cropByObb.js +78 -0
  207. package/build/utils/cropByObb.js.map +1 -0
  208. package/build/utils/get-document-type-info.d.ts +13 -0
  209. package/build/utils/get-document-type-info.d.ts.map +1 -0
  210. package/build/utils/get-document-type-info.js +59 -0
  211. package/build/utils/get-document-type-info.js.map +1 -0
  212. package/build/utils/pathToBase64.d.ts +3 -0
  213. package/build/utils/pathToBase64.d.ts.map +1 -0
  214. package/build/utils/pathToBase64.js +47 -0
  215. package/build/utils/pathToBase64.js.map +1 -0
  216. package/build/utils/remove-duplicate.d.ts +2 -0
  217. package/build/utils/remove-duplicate.d.ts.map +1 -0
  218. package/build/utils/remove-duplicate.js +4 -0
  219. package/build/utils/remove-duplicate.js.map +1 -0
  220. package/package.json +3 -1
  221. package/src/api/axios.ts +144 -0
  222. package/src/components/EnhancedCameraView.tsx +96 -78
  223. package/src/components/EnhancedCameraView.web.tsx +41 -40
  224. package/src/components/KYCElements/CountrySelectionTemplate.tsx +104 -136
  225. package/src/components/KYCElements/FileUploadTemplate.tsx +14 -8
  226. package/src/components/KYCElements/IDCardCapture.tsx +311 -115
  227. package/src/components/KYCElements/InitializationStep.tsx +53 -0
  228. package/src/components/KYCElements/LocationCaptureTemplate.tsx +17 -15
  229. package/src/components/KYCElements/OrientationVideoCapture.tsx +2 -2
  230. package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +2 -2
  231. package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +2 -2
  232. package/src/components/KYCElements/ReviewSubmitTemplate.tsx +201 -0
  233. package/src/components/KYCElements/SelfieCaptureTemplate.tsx +140 -53
  234. package/src/components/KYCElements/VerificationProgressTemplate.tsx +123 -0
  235. package/src/components/OverLay/IdCard.tsx +17 -9
  236. package/src/components/OverLay/SelfieOverlay.tsx +6 -5
  237. package/src/components/OverLay/type.ts +64 -2
  238. package/src/components/TemplateKYCExample.tsx +76 -197
  239. package/src/components/TemplateKYCFlowRefactored.tsx +74 -46
  240. package/src/components/VisionCameraView.tsx +1 -1
  241. package/src/components/example/OrientationVideoExample.tsx +3 -7
  242. package/src/components/ui/Button.tsx +1 -1
  243. package/src/config/countriesData.ts +84 -0
  244. package/src/config/region_mapping.ts +688 -0
  245. package/src/hooks/useI18n.ts +53 -0
  246. package/src/hooks/useOrientationVideo.ts +2 -2
  247. package/src/hooks/useRealtimeVerifier.ts +128 -0
  248. package/src/hooks/useTemplateKYCFlow.tsx +375 -53
  249. package/src/i18n/README.md +288 -0
  250. package/src/i18n/en/index.ts +206 -0
  251. package/src/i18n/fr/index.ts +205 -0
  252. package/src/i18n/index.ts +65 -0
  253. package/src/i18n/types.ts +172 -0
  254. package/src/i18n/usage-example.tsx +202 -0
  255. package/src/modules/api/CardAuthentification.ts +114 -0
  256. package/src/modules/api/KYCService.ts +403 -30
  257. package/src/modules/api/SelfieVerification.ts +11 -0
  258. package/src/modules/api/backendApi.ts +8 -0
  259. package/src/modules/api/types.ts +24 -0
  260. package/src/modules/camera/VisionCameraModule.ts +16 -7
  261. package/src/types/KYC.types.ts +83 -14
  262. package/src/utils/cropByObb.ts +99 -0
  263. package/src/utils/get-document-type-info.ts +62 -0
  264. package/src/utils/pathToBase64.ts +47 -0
  265. package/src/utils/remove-duplicate.ts +3 -0
  266. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/results.bin +0 -1
  267. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/BuildConfig.dex +0 -0
  268. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$1.dex +0 -0
  269. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$2.dex +0 -0
  270. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$1.dex +0 -0
  271. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$2.dex +0 -0
  272. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$3.dex +0 -0
  273. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$4.dex +0 -0
  274. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$5.dex +0 -0
  275. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$6.dex +0 -0
  276. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$1.dex +0 -0
  277. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$2.dex +0 -0
  278. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$3.dex +0 -0
  279. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$4.dex +0 -0
  280. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$View$1.dex +0 -0
  281. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$lambda$4$$inlined$Prop$1.dex +0 -0
  282. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$lambda$4$$inlined$Prop$2.dex +0 -0
  283. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkModule.dex +0 -0
  284. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/kyc/transfergratis/com/TransfergratisSdkView.dex +0 -0
  285. package/android/build/.transforms/d6df0e53bfc3165a876965af720f910a/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  286. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/BuildConfig.class +0 -0
  287. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$1.class +0 -0
  288. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$2.class +0 -0
  289. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$1.class +0 -0
  290. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$2.class +0 -0
  291. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$3.class +0 -0
  292. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$4.class +0 -0
  293. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$5.class +0 -0
  294. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$6.class +0 -0
  295. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$1.class +0 -0
  296. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$2.class +0 -0
  297. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$3.class +0 -0
  298. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$4.class +0 -0
  299. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$View$1.class +0 -0
  300. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$lambda$4$$inlined$Prop$1.class +0 -0
  301. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$lambda$4$$inlined$Prop$2.class +0 -0
  302. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkModule.class +0 -0
  303. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/kyc/transfergratis/com/TransfergratisSdkView.class +0 -0
  304. package/android/build/tmp/kotlin-classes/debug/META-INF/transfergratis-sdk_debug.kotlin_module +0 -0
  305. package/src/types/nativewind.d.ts +0 -2
  306. /package/android/build/.transforms/{7ec900c0f64f5f1a7c88998dd44001b8 → 01c28d00c798aa4846f16ce72123ebf9}/results.bin +0 -0
  307. /package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/{transfergratis-sdk_debug.kotlin_module → transfergratis-react-native-sdk_debug.kotlin_module} +0 -0
  308. /package/android/build/{intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/META-INF/transfergratis-sdk_debug.kotlin_module → tmp/kotlin-classes/debug/META-INF/transfergratis-react-native-sdk_debug.kotlin_module} +0 -0
@@ -6,6 +6,7 @@ import GpsIcon from '../Svgs/GpsIcon';
6
6
  import { Button } from '../ui/Button';
7
7
  import * as Location from 'expo-location';
8
8
  import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
9
+ import { useI18n } from '../../hooks/useI18n';
9
10
 
10
11
  interface LocationCaptureTemplateProps {
11
12
  component: TemplateComponent;
@@ -22,6 +23,7 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
22
23
  error,
23
24
  language = 'en',
24
25
  }) => {
26
+ const { t } = useI18n();
25
27
  const [isRequesting, setIsRequesting] = useState(false);
26
28
  const [currentLocation, setCurrentLocation] = useState<{ latitude: number; longitude: number; accuracy: number } | null>(value || null);
27
29
  const { actions } = useTemplateKYCFlowContext();
@@ -44,8 +46,8 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
44
46
  const hasLocationPermission = await requestLocationPermission();
45
47
  if (!hasLocationPermission) {
46
48
  Alert.alert(
47
- 'Permission refusée',
48
- 'La permission de localisation est nécessaire pour continuer.'
49
+ t('kyc.locationCapture.permissionDeniedTitle'),
50
+ t('kyc.locationCapture.permissionDeniedMessage')
49
51
  );
50
52
  setIsRequesting(false);
51
53
  return;
@@ -55,8 +57,8 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
55
57
  const isLocationEnabled = await Location.hasServicesEnabledAsync();
56
58
  if (!isLocationEnabled) {
57
59
  Alert.alert(
58
- 'Localisation désactivée',
59
- 'Veuillez activer la localisation sur votre appareil pour continuer.'
60
+ t('kyc.locationCapture.locationDisabledTitle'),
61
+ t('kyc.locationCapture.locationDisabledMessage')
60
62
  );
61
63
  setIsRequesting(false);
62
64
  return;
@@ -81,7 +83,7 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
81
83
 
82
84
  } catch (error) {
83
85
  console.error('Erreur lors de la récupération de la localisation:', error);
84
- Alert.alert('Erreur', 'Impossible de récupérer votre localisation. Veuillez réessayer.');
86
+ Alert.alert(t('kyc.locationCapture.errorTitle'), t('kyc.locationCapture.errorMessage'));
85
87
  } finally {
86
88
  setIsRequesting(false);
87
89
  }
@@ -119,34 +121,34 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
119
121
  </View>
120
122
  </View>
121
123
  <View style={{ flexDirection: 'column', alignItems: 'center', justifyContent: 'center', marginTop: 36 }}>
122
- <Text style={{ fontSize: 24, fontWeight: 'bold', color: '#333', marginBottom: 8 }}>Secure Your Verification</Text>
124
+ <Text style={{ fontSize: 24, fontWeight: 'bold', color: '#333', marginBottom: 8 }}>{t('kyc.locationCapture.title')}</Text>
123
125
  <Text style={{ fontSize: 16, color: '#666', textAlign: 'center', marginBottom: 24, lineHeight: 22 }}>
124
- Allow location access to help us protect your account and prevent fraudulent activity during verification.
126
+ {t('kyc.locationCapture.description')}
125
127
  </Text>
126
128
  </View>
127
129
  <View style={{ flexDirection: 'column', marginTop: 36, backgroundColor: "#F9FAFB", padding: 12, borderRadius: 12, width: '100%', }}>
128
130
  <Text style={{ fontSize: 16, color: 'black', fontWeight: 'bold', textAlign: 'left', lineHeight: 22 }}>
129
- {`How this helps:`}
131
+ {t('kyc.locationCapture.howThisHelps')}
130
132
  </Text>
131
133
  <Text style={{ fontSize: 16, color: '#666', textAlign: 'left', lineHeight: 22 }}>
132
- {`• Verifies your device location matches your identity\n• Detects and prevents unauthorized access\n• Ensures compliance with security regulations`}
134
+ {t('kyc.locationCapture.howThisHelpsList')}
133
135
  </Text>
134
136
  </View>
135
137
 
136
138
  {currentLocation ? (
137
139
  <View style={styles.locationInfo}>
138
- <Text style={styles.locationTitle}>Localisation obtenue</Text>
140
+ <Text style={styles.locationTitle}>{t('kyc.locationCapture.obtained')}</Text>
139
141
  <Text style={styles.locationDetails}>
140
- Latitude: {currentLocation.latitude.toFixed(6)}
142
+ {t('kyc.locationCapture.latitudeLabel')}: {currentLocation.latitude.toFixed(6)}
141
143
  </Text>
142
144
  <Text style={styles.locationDetails}>
143
- Longitude: {currentLocation.longitude.toFixed(6)}
145
+ {t('kyc.locationCapture.longitudeLabel')}: {currentLocation.longitude.toFixed(6)}
144
146
  </Text>
145
147
  <Text style={styles.locationDetails}>
146
- Précision: {currentLocation.accuracy.toFixed(1)}m
148
+ {t('kyc.locationCapture.accuracyLabel')}: {currentLocation.accuracy.toFixed(1)}m
147
149
  </Text>
148
150
  <Button
149
- title="Réinitialiser"
151
+ title={t('kyc.locationCapture.resetButton')}
150
152
  fullWidth
151
153
  onPress={resetLocation}
152
154
  style={{ paddingVertical: 20, marginTop: 24, backgroundColor: '#6B7280' }}
@@ -154,7 +156,7 @@ export const LocationCaptureTemplate: React.FC<LocationCaptureTemplateProps> = (
154
156
  </View>
155
157
  ) : (
156
158
  <Button
157
- title={isRequesting ? "Récupération..." : "Enable Location Access"}
159
+ title={isRequesting ? t('kyc.locationCapture.fetching') : t('kyc.locationCapture.enableButton')}
158
160
  fullWidth
159
161
  onPress={getCurrentLocation}
160
162
  disabled={isRequesting}
@@ -11,7 +11,7 @@ import {
11
11
  import Svg, { Rect, Path, Mask, Defs } from 'react-native-svg';
12
12
  import { Camera, useCameraDevice } from 'react-native-vision-camera';
13
13
  import { OrientationVideoConfig, OrientationVideoState } from '../../types/KYC.types';
14
- import KYCService from '../../modules/api/KYCService';
14
+ import kycService from '../../modules/api/KYCService';
15
15
  import VisionCameraModule from '../../modules/camera/VisionCameraModule';
16
16
  import SideSelfieIcon from '../Svgs/sideSelfieIcon';
17
17
 
@@ -19,7 +19,7 @@ interface OrientationVideoCaptureProps {
19
19
  config?: Partial<OrientationVideoConfig>;
20
20
  onComplete: (result: any) => void;
21
21
  onError: (error: string) => void;
22
- kycService: KYCService;
22
+ kycService: typeof kycService;
23
23
  }
24
24
 
25
25
  const defaultConfig: OrientationVideoConfig = {
@@ -12,7 +12,7 @@ import {
12
12
  import Svg, { Rect, Path, Mask, Defs } from 'react-native-svg';
13
13
  import { EnhancedCameraView } from '../EnhancedCameraView';
14
14
  import { OrientationVideoConfig, OrientationVideoState } from '../../types/KYC.types';
15
- import KYCService from '../../modules/api/KYCService';
15
+ import kycService from '../../modules/api/KYCService';
16
16
  import FrontSelfieIcon from '../Svgs/frontSelfieIcon';
17
17
  import ScanningLine from '../Svgs/scanningLine';
18
18
 
@@ -20,7 +20,7 @@ interface OrientationVideoCaptureEnhancedProps {
20
20
  config?: Partial<OrientationVideoConfig>;
21
21
  onComplete: (result: any) => void;
22
22
  onError: (error: string) => void;
23
- kycService: KYCService;
23
+ kycService: typeof kycService;
24
24
  }
25
25
 
26
26
  const defaultConfig: OrientationVideoConfig = {
@@ -11,14 +11,14 @@ import {
11
11
  import Svg, { Rect, Path, Mask, Defs } from 'react-native-svg';
12
12
  import { EnhancedCameraView } from '../EnhancedCameraView';
13
13
  import { OrientationVideoConfig, OrientationVideoState } from '../../types/KYC.types';
14
- import KYCService from '../../modules/api/KYCService';
15
14
  import SideSelfieIcon from '../Svgs/sideSelfieIcon';
15
+ import kycService from '../../modules/api/KYCService';
16
16
 
17
17
  interface OrientationVideoCaptureFinalProps {
18
18
  config?: Partial<OrientationVideoConfig>;
19
19
  onComplete: (result: any) => void;
20
20
  onError: (error: string) => void;
21
- kycService: KYCService;
21
+ kycService: typeof kycService;
22
22
  }
23
23
 
24
24
  const defaultConfig: OrientationVideoConfig = {
@@ -0,0 +1,201 @@
1
+ import React, { useMemo } from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity, ScrollView } 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 ReviewSubmitTemplateProps {
8
+ component: TemplateComponent;
9
+ value: unknown;
10
+ onValueChange: (data: unknown) => void;
11
+ error?: string;
12
+ language?: string;
13
+ }
14
+
15
+ export const ReviewSubmitTemplate: React.FC<ReviewSubmitTemplateProps> = () => {
16
+ const { t } = useI18n();
17
+ const { state, actions, getLocalizedText } = useTemplateKYCFlowContext();
18
+
19
+ const idSection = useMemo(() => {
20
+ const idComp = state.template.components.find(c => c.type === 'id_card');
21
+ return idComp ? state.componentData[idComp.id] : null;
22
+ }, [state.template.components, state.componentData]);
23
+
24
+ // Helper to coerce possibly-nested localized configs into the expected shape
25
+ const coerceLocalized = (value: any, fallback: { en: string; fr: string }) => {
26
+ if (value && typeof value === 'object') {
27
+ if (typeof value.en === 'string' || typeof value.fr === 'string') {
28
+ return {
29
+ en: typeof value.en === 'string' ? value.en : fallback.en,
30
+ fr: typeof value.fr === 'string' ? value.fr : fallback.fr,
31
+ ...value,
32
+ } as { [key: string]: string; en: string; fr: string };
33
+ }
34
+ }
35
+ return fallback;
36
+ };
37
+
38
+ // const reviewComp = useMemo(() => {
39
+ // return state.template.components.find(c => c.type === 'review_submit');
40
+ // }, [state.template.components]);
41
+
42
+ const dynamicComponents = useMemo(() => {
43
+ return state.template.components.filter(c => c.type !== 'review_submit' && c.type !== 'verification_progress');
44
+ }, [state.template.components]);
45
+
46
+ const handleSubmit = async () => {
47
+ await actions.nextComponent();
48
+ };
49
+
50
+ return (
51
+ <View style={styles.container}>
52
+ <Text style={styles.title}>{t('kyc.reviewSubmit.title')}</Text>
53
+ <Text style={styles.subtitle}>{t('kyc.reviewSubmit.subtitle')}</Text>
54
+
55
+ <ScrollView contentContainerStyle={styles.scrollContent}>
56
+ {dynamicComponents.map((comp) => {
57
+ const compData = state.componentData[comp.id] || {};
58
+ const isCompleted = state.completedComponents.includes(comp.id);
59
+ if (comp.type === 'id_card') {
60
+ const hasFront = !!(compData.front || compData.front_base64 || compData.front_mrz);
61
+ const hasBack = !!(compData.back || compData.back_base64 || compData.back_mrz);
62
+ return (
63
+ <View key={comp.id} style={styles.section}>
64
+ <Text style={styles.sectionTitle}>{t('kyc.reviewSubmit.documentInfo')}</Text>
65
+ <View style={styles.row}>
66
+ <View style={[styles.tile, hasFront ? styles.active : null]}>
67
+ <Text style={styles.tileLabel}>{t('kyc.idCardCapture.frontSide')}</Text>
68
+ {hasFront ? <Text style={styles.check}>✓</Text> : null}
69
+ </View>
70
+ <View style={[styles.tile, hasBack ? styles.active : null]}>
71
+ <Text style={styles.tileLabel}>{t('kyc.idCardCapture.backSide')}</Text>
72
+ {hasBack ? <Text style={styles.check}>✓</Text> : null}
73
+ </View>
74
+ </View>
75
+ {idSection?.documentType ? (
76
+ <Text style={styles.caption}>{idSection.documentType}</Text>
77
+ ) : null}
78
+ </View>
79
+ );
80
+ }
81
+ if (comp.type === 'selfie') {
82
+ const orientations = ((comp.config as any)?.orientations || ['center', 'right', 'left']) as string[];
83
+ return (
84
+ <View key={comp.id} style={styles.section}>
85
+ <Text style={styles.sectionTitle}>{t('kyc.selfieCapture.title')}</Text>
86
+ <View style={styles.row}>
87
+ {orientations.map((o) => {
88
+ const has = !!compData[o];
89
+ const colorStyle = o === 'center' ? styles.pink : o === 'right' ? styles.blue : styles.purple;
90
+ return (
91
+ <View key={o} style={[styles.tile, colorStyle, has ? styles.active : null]}>
92
+ <Text style={styles.tileLabel}>{o.charAt(0).toUpperCase() + o.slice(1)}</Text>
93
+ {has ? <Text style={styles.check}>✓</Text> : null}
94
+ </View>
95
+ );
96
+ })}
97
+ </View>
98
+ <Text style={styles.caption}>{t('kyc.selfieCapture.success')}</Text>
99
+ </View>
100
+ );
101
+ }
102
+ // Generic fallback for other component types
103
+ return (
104
+ <View key={comp.id} style={styles.section}>
105
+ <Text style={styles.sectionTitle}>{getLocalizedText(coerceLocalized(comp.labels, { en: comp.type, fr: comp.type }))}</Text>
106
+ <Text style={styles.caption}>{isCompleted ? t('common.success') : t('kyc.verificationProgress.status.pending')}</Text>
107
+ </View>
108
+ );
109
+ })}
110
+ </ScrollView>
111
+
112
+ <TouchableOpacity style={[styles.button, styles.primary]} onPress={handleSubmit}>
113
+ <Text style={styles.buttonText}>{t('kyc.reviewSubmit.submitButton')}</Text>
114
+ </TouchableOpacity>
115
+ </View>
116
+ );
117
+ };
118
+
119
+ const styles = StyleSheet.create({
120
+ container: {
121
+ flex: 1,
122
+ width: '100%',
123
+ paddingHorizontal: 16,
124
+ paddingVertical: 12,
125
+ },
126
+ title: {
127
+ fontSize: 24,
128
+ fontWeight: 'bold',
129
+ color: '#111827',
130
+ marginBottom: 4,
131
+ },
132
+ subtitle: {
133
+ fontSize: 14,
134
+ color: '#6B7280',
135
+ marginBottom: 16,
136
+ },
137
+ section: {
138
+ backgroundColor: 'white',
139
+ borderRadius: 16,
140
+ padding: 16,
141
+ marginBottom: 16,
142
+ },
143
+ sectionTitle: {
144
+ fontSize: 18,
145
+ fontWeight: '700',
146
+ color: '#111827',
147
+ marginBottom: 12,
148
+ },
149
+ scrollContent: {
150
+ paddingBottom: 24,
151
+ },
152
+ row: {
153
+ flexDirection: 'row',
154
+ gap: 12,
155
+ },
156
+ tile: {
157
+ flex: 1,
158
+ height: 110,
159
+ borderRadius: 16,
160
+ backgroundColor: '#F3F4F6',
161
+ alignItems: 'center',
162
+ justifyContent: 'center',
163
+ },
164
+ tileLabel: {
165
+ fontSize: 14,
166
+ color: '#111827',
167
+ marginBottom: 8,
168
+ },
169
+ check: {
170
+ fontSize: 18,
171
+ color: '#10B981',
172
+ fontWeight: '700',
173
+ },
174
+ active: {
175
+ backgroundColor: '#DDE9FF',
176
+ },
177
+ pink: { backgroundColor: '#FDE2E7' },
178
+ blue: { backgroundColor: '#DDE9FF' },
179
+ purple: { backgroundColor: '#EDE2FF' },
180
+ caption: {
181
+ marginTop: 10,
182
+ fontSize: 12,
183
+ color: '#6B7280',
184
+ },
185
+ button: {
186
+ paddingVertical: 14,
187
+ borderRadius: 10,
188
+ alignItems: 'center',
189
+ marginTop: 12,
190
+ },
191
+ primary: {
192
+ backgroundColor: '#2DBD60',
193
+ },
194
+ buttonText: {
195
+ color: 'white',
196
+ fontSize: 16,
197
+ fontWeight: '600',
198
+ },
199
+ });
200
+
201
+
@@ -1,15 +1,22 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { View, Text, StyleSheet, Alert, ScrollView } from 'react-native';
3
- import { TemplateComponent, SelfieConfig, LocalizedText } from '../../types/KYC.types';
3
+ import { TemplateComponent, SelfieConfig, LocalizedText, ISilentCaptureResult, OrientationType } from '../../types/KYC.types';
4
4
  import { EnhancedCameraView } from '../EnhancedCameraView';
5
5
  import { Button } from '../ui/Button';
6
6
  import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
7
+ import { useI18n } from '../../hooks/useI18n';
7
8
  import SelfieOverlay from '../OverLay/SelfieOverlay';
9
+ import selfieVerification from '../../modules/api/SelfieVerification';
10
+ import pathToBase64 from '../../utils/pathToBase64';
8
11
 
12
+ interface IImagePayload {
13
+ dir: string;
14
+ file: string;
15
+ }
9
16
  interface SelfieCaptureTemplateProps {
10
17
  component: TemplateComponent;
11
- value: Record<string, string> | undefined;
12
- onValueChange: (value: Record<string, string>) => void;
18
+ value: Record<string, IImagePayload> | undefined;
19
+ onValueChange: (value: Record<string, IImagePayload>) => void;
13
20
  error?: string;
14
21
  language: string;
15
22
  }
@@ -21,30 +28,41 @@ export const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({
21
28
  error,
22
29
  language,
23
30
  }) => {
31
+ const { t } = useI18n();
24
32
  const config = component.config as SelfieConfig;
25
- const maxAttempts = config.max_attempts || 3;
26
- const orientations = config.orientations || ['front'];
33
+ const orientations: OrientationType[] = (config.orientations || ['center']) as OrientationType[];
27
34
  const { actions, state, } = useTemplateKYCFlowContext();
28
35
 
36
+ const [silentCaptureResult, setSilentCaptureResult] = useState<ISilentCaptureResult>({ success: false, isAnalyzing: false });
37
+
38
+
29
39
  const [showCamera, setShowCamera] = useState(false);
30
- const [currentOrientation, setCurrentOrientation] = useState<string>(orientations[0]);
31
- const [capturedImages, setCapturedImages] = useState<Record<string, string>>(value || {});
32
- const [attempts, setAttempts] = useState(0);
40
+ const [currentOrientation, setCurrentOrientation] = useState<OrientationType>(orientations[0]);
41
+ const [capturedImages, setCapturedImages] = useState<Record<string, IImagePayload>>(value || {});
33
42
 
34
- const getLocalizedText = (text: LocalizedText): string => {
35
- return text[language] || text.en || '';
43
+ const getLocalizedText = (text: LocalizedText | Record<string, LocalizedText>): string => {
44
+ if (!text) return '';
45
+ // If text is a nested record (e.g., per theme/device), try to pick a default then localize
46
+ const maybeNested = text as Record<string, LocalizedText>;
47
+ if (maybeNested && typeof maybeNested === 'object' && 'en' in maybeNested === false && 'fr' in maybeNested === false) {
48
+ const firstKey = Object.keys(maybeNested)[0];
49
+ const nested = maybeNested[firstKey] as LocalizedText;
50
+ return nested?.[language] || nested?.en || '';
51
+ }
52
+ const loc = text as LocalizedText;
53
+ return loc[language] || loc.en || '';
36
54
  };
37
55
 
38
- const getOrientationInstructions = (orientation: string): string => {
56
+ const getOrientationInstructions = (orientation: OrientationType): string => {
39
57
  switch (orientation) {
40
- case 'front':
41
- return 'Prenez un selfie de face, regardez droit devant vous';
58
+ case 'center':
59
+ return state.currentLanguage === "en" ? "Take a selfie of face, look straight ahead you" : "Prenez un selfie de face, regardez droit devant vous";
42
60
  case 'left':
43
- return 'Tournez votre tête vers la gauche, gardez les épaules droites';
61
+ return state.currentLanguage === "en" ? "Turn your head to the left, keep your shoulders straight" : "Tournez votre tête vers la gauche, gardez les épaules droites";
44
62
  case 'right':
45
- return 'Tournez votre tête vers la droite, gardez les épaules droites';
63
+ return state.currentLanguage === "en" ? "Turn your head to the right, keep your shoulders straight" : "Tournez votre tête vers la droite, gardez les épaules droites";
46
64
  default:
47
- return getLocalizedText(component.instructions);
65
+ return getLocalizedText(component.instructions as LocalizedText);
48
66
  }
49
67
  };
50
68
 
@@ -52,58 +70,115 @@ export const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({
52
70
  actions.showCustomStepper(!showCamera);
53
71
  }, [showCamera]);
54
72
 
55
- const getOrientationLabel = (orientation: string): string => {
73
+ const getOrientationLabel = (orientation: OrientationType): string => {
56
74
  switch (orientation) {
57
- case 'front':
58
- return 'Selfie de face';
75
+ case 'center':
76
+ return state.currentLanguage === "en" ? "Selfie de face" : "Selfie de face";
59
77
  case 'left':
60
- return 'Selfie profil gauche';
78
+ return state.currentLanguage === "en" ? "Selfie profil gauche" : "Selfie profil gauche";
61
79
  case 'right':
62
- return 'Selfie profil droit';
80
+ return state.currentLanguage === "en" ? "Selfie profil droit" : "Selfie profil droit";
63
81
  default:
64
- return getLocalizedText(component.labels);
82
+ return getLocalizedText(component.labels as LocalizedText);
65
83
  }
66
84
  };
85
+ const getOrientationOpposite = (orientation: OrientationType): OrientationType => {
86
+ switch (orientation) {
87
+ case 'center':
88
+
89
+ return 'center';
90
+ case 'left':
91
+ return 'left';
92
+ case 'right':
93
+ return 'right';
94
+ default:
95
+ return orientation;
96
+ }
97
+ }
67
98
 
68
- const getInstructions = (orientation: string): { title: string, subtitle: string } => {
99
+ const getInstructions = (orientation: OrientationType): { title: string, subtitle: string } => {
100
+ const lang = state.currentLanguage;
69
101
  switch (orientation) {
70
- case 'front':
71
- return { title: 'Center your face', subtitle: 'Align your face to the center of the selfie area and then take a photo' };
102
+ case 'center':
103
+ return {
104
+ title:
105
+
106
+ lang === "en" ? 'Center your face' : 'Mettez votre face au centre',
107
+ subtitle: lang === "en"
108
+ ? 'Align your face to the center of the selfie area and then take a photo'
109
+ : 'Alignez votre visage au centre de la zone selfie puis prenez une photo'
110
+ };
72
111
  case 'left':
73
- return { title: 'Turn your head left', subtitle: 'Slowly turn your head to the left while keeping your face in the selfie area' };
112
+ return {
113
+ title:
114
+ lang === 'en'
115
+ ? 'Turn your head left'
116
+ : 'Tournez la tête vers la gauche',
117
+ subtitle:
118
+ lang === 'en'
119
+ ? 'Slowly turn your head to the left while keeping your face in the selfie area'
120
+ : 'Tournez lentement la tête vers la gauche en gardant votre visage dans la zone selfie'
121
+ };
74
122
  case 'right':
75
- return { title: 'Turn your head right', subtitle: 'Slowly turn your head to the right while keeping your face in the selfie area' };
123
+ return {
124
+ title:
125
+ lang === 'en'
126
+ ? 'Turn your head right'
127
+ : 'Tournez la tête vers la droite',
128
+ subtitle:
129
+ lang === 'en'
130
+ ? 'Slowly turn your head to the right while keeping your face in the selfie area'
131
+ : 'Tournez lentement la tête vers la droite en gardant votre visage dans la zone selfie'
132
+ };
76
133
  default:
77
- return { title: getLocalizedText(component.labels), subtitle: getLocalizedText(component.instructions) };
134
+ return { title: getLocalizedText(component.labels as LocalizedText), subtitle: getLocalizedText(component.instructions as LocalizedText) };
78
135
  }
79
136
  };
80
137
 
81
- const handleCapture = (result: { success: boolean; path?: string; error?: string }) => {
138
+ const handleSilentCapture = (result: { success: boolean; path?: string; error?: string }) => {
139
+ if (silentCaptureResult.isAnalyzing) {
140
+ return;
141
+ }
82
142
  if (result.success && result.path) {
83
- const newImages = { ...capturedImages, [currentOrientation]: result.path };
143
+ setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: true, success: false, error: '' }));
144
+ selfieVerification(result.path).then((response) => {
145
+ if (response.length > 0) {
146
+ const res = response[0];
147
+ if (res?.orientation_direction === getOrientationOpposite(currentOrientation) && res?.capture) {
148
+ setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: true, error: '', path: result.path }));
149
+ } else {
150
+ setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: 'Le selfie n\'est pas correct' }));
151
+ }
152
+ } else {
153
+ setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: 'Le selfie n\'est pas correct' }));
154
+ }
155
+ }).catch((e: any) => {
156
+
157
+ setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: e?.message || 'Erreur de vérification du selfie' }));
158
+ });
159
+ }
160
+ }
161
+
162
+ const handleCapture = async (result: { success: boolean; path?: string; error?: string }) => {
163
+ console.log("handleCapturessss", silentCaptureResult);
164
+
165
+ if (silentCaptureResult.success && silentCaptureResult.path) {
166
+ const base64 = await pathToBase64(silentCaptureResult.path);
167
+ // Keep backward-compatible structure for UI validation and add *_base64 fields for backend payload
168
+ const newImages: Record<string, any> = {
169
+ ...capturedImages,
170
+ [currentOrientation]: { dir: silentCaptureResult.path, file: base64 } as IImagePayload,
171
+ };
84
172
  setCapturedImages(newImages);
85
173
  onValueChange(newImages);
86
174
  setShowCamera(false);
87
- setAttempts(0);
175
+
88
176
 
89
177
  // Passer à l'orientation suivante si disponible
90
- const currentIndex = orientations.indexOf(currentOrientation as any);
178
+ const currentIndex = orientations.indexOf(currentOrientation as OrientationType);
91
179
  if (currentIndex < orientations.length - 1) {
92
180
  setCurrentOrientation(orientations[currentIndex + 1]);
93
181
  }
94
- } else {
95
- const newAttempts = attempts + 1;
96
- setAttempts(newAttempts);
97
-
98
- if (newAttempts >= maxAttempts) {
99
- Alert.alert(
100
- 'Limite atteinte',
101
- `Vous avez atteint le nombre maximum de tentatives (${maxAttempts}).`
102
- );
103
- setShowCamera(false);
104
- } else {
105
- Alert.alert('Erreur', result.error || 'Impossible de prendre le selfie');
106
- }
107
182
  }
108
183
  };
109
184
 
@@ -113,13 +188,15 @@ export const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({
113
188
  };
114
189
 
115
190
 
116
- const isOrientationCompleted = (orientation: string): boolean => {
191
+ const isOrientationCompleted = (orientation: OrientationType): boolean => {
117
192
  return !!capturedImages[orientation];
118
193
  };
119
194
 
120
195
  const isAllOrientationsCompleted = (): boolean => {
121
196
  return orientations.every(orientation => isOrientationCompleted(orientation));
122
197
  };
198
+ console.log("Current Orientation", currentOrientation);
199
+
123
200
 
124
201
  if (showCamera) {
125
202
  return (
@@ -136,6 +213,8 @@ export const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({
136
213
  showCaptureButton={true}
137
214
  showSwitchCamera={false}
138
215
  enableFlash={false}
216
+ silentCaptureResult={silentCaptureResult}
217
+ onSilentCapture={handleSilentCapture}
139
218
  overlayComponent={<SelfieOverlay
140
219
  xMin={20}
141
220
  yMin={140}
@@ -143,7 +222,8 @@ export const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({
143
222
  yMax={340}
144
223
  cornerOpacity={1}
145
224
  instructions={""}
146
- orientation={currentOrientation as 'front' | 'left' | 'right'}
225
+ language={state.currentLanguage}
226
+ orientation={currentOrientation as 'center' | 'left' | 'right'}
147
227
  instructionsTile={getInstructions(currentOrientation).title}
148
228
  instructionsSubtitle={getInstructions(currentOrientation).subtitle}
149
229
  stepperProps={{
@@ -167,8 +247,8 @@ export const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({
167
247
  height: '100%',
168
248
  }]}>
169
249
  <View style={styles.container}>
170
- <Text style={styles.title}>{getLocalizedText(component.labels)}</Text>
171
- <Text style={styles.description}>{getLocalizedText(component.instructions)}</Text>
250
+ <Text style={styles.title}>{getLocalizedText(component.labels as LocalizedText)}</Text>
251
+ <Text style={styles.description}>{getLocalizedText(component.instructions as LocalizedText)}</Text>
172
252
 
173
253
  <ScrollView style={styles.orientationsContainer} showsVerticalScrollIndicator={false}>
174
254
  <View style={{ flexDirection: 'column', alignItems: 'center', gap: 10 }}>
@@ -207,25 +287,32 @@ export const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({
207
287
  ))}
208
288
  <View style={{ backgroundColor: "#F6CB0D1A", width: "100%", padding: 10, borderRadius: 10 }} >
209
289
  <Text style={{ color: '#997E06', fontSize: 16, fontWeight: 'bold' }}>
210
- Tips for a good selfie:
290
+ {state.currentLanguage === "en"
291
+ ? "Tips for a good selfie:"
292
+ : "Conseils pour une bonne photo selfie :"}
211
293
  </Text>
212
294
  <View style={{ paddingLeft: 10, paddingTop: 4 }}>
213
295
  <Text style={{ color: '#997E06', fontSize: 14, fontWeight: 'bold' }}>
214
- {`• Remove glasses and hat \n• Look directly at the camera \n• Ensure good lighting \n`}
296
+ {state.currentLanguage === "en"
297
+ ? `• Remove glasses and hat \n• Look directly at the camera \n• Ensure good lighting \n`
298
+ : `• Retirez vos lunettes et votre chapeau \n• Regardez directement la caméra \n• Assurez-vous d'une bonne luminosité \n`
299
+ }
215
300
  </Text>
216
301
  </View>
217
302
  </View>
218
303
  <View style={{ height: 10 }} />
219
304
  {isAllOrientationsCompleted() ? <>
220
- <Button title="Continuer" fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={() => {
305
+ <Button title={t('common.continue')} fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={async () => {
221
306
  onValueChange(capturedImages);
222
307
  actions.nextComponent();
223
308
  }} />
224
309
  </> : (
225
- <Button title="Start Selfie" fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={() => {
310
+ <Button title={t('kyc.selfieCapture.captureButton')} fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={() => {
226
311
  if (isAllOrientationsCompleted()) {
227
312
  onValueChange(capturedImages);
313
+ actions.nextComponent();
228
314
  } else {
315
+ setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: '' }));
229
316
  setShowCamera(true);
230
317
  }
231
318
  }} />