@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
@@ -2,13 +2,16 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { View, StyleSheet, TouchableOpacity, Text } from 'react-native';
3
3
  import { Camera, useCameraDevice } from 'react-native-vision-camera';
4
4
  import VisionCameraModule from '../modules/camera/VisionCameraModule';
5
- export const EnhancedCameraView = ({ instructions = 'Position yourself in the frame and tap the capture button', showCamera, cameraType: initialCameraType = 'front', style, onCapture, onError, onClose, enableFlash = false, enableHdr = false, quality = 'high', showCaptureButton = true, showSwitchCamera = true, overlayComponent, bbox, canFlip = true, enableVideo = false, isRecording = false, onVideoRecordingStart, onVideoRecordingStop, videoDuration = 10, }) => {
5
+ import { useI18n } from '../hooks/useI18n';
6
+ export const EnhancedCameraView = ({ instructions = 'Position yourself in the frame and tap the capture button', showCamera, cameraType: initialCameraType = 'front', style, onCapture, onError, onClose, enableFlash = false, enableHdr = false, quality = 'high', showCaptureButton = true, showSwitchCamera = true, overlayComponent, bbox, canFlip = true, enableVideo = false, isRecording = false, onVideoRecordingStart, onVideoRecordingStop, videoDuration = 10, onSilentCapture, silentCaptureResult, }) => {
7
+ const { t } = useI18n();
6
8
  const camera = useRef(null);
7
9
  const [cameraType, setCameraType] = useState(initialCameraType);
8
10
  const [hasPermission, setHasPermission] = useState(false);
9
11
  const [isInitialized, setIsInitialized] = useState(false);
10
12
  const [flash, setFlash] = useState('off');
11
13
  const device = useCameraDevice(cameraType);
14
+ console.log({ setCameraType, setFlash });
12
15
  // Check permissions on component mount
13
16
  useEffect(() => {
14
17
  if (showCamera) {
@@ -21,7 +24,7 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
21
24
  if (!hasAllPermissions) {
22
25
  const granted = await VisionCameraModule.requestAllPermissions();
23
26
  if (!granted) {
24
- onError?.({ message: 'Camera permissions not granted' });
27
+ onError?.({ message: t('camera.permissionRequired') });
25
28
  return;
26
29
  }
27
30
  }
@@ -29,7 +32,7 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
29
32
  }
30
33
  catch (error) {
31
34
  console.error('Error checking permissions:', error);
32
- onError?.({ message: 'Error checking camera permissions' });
35
+ onError?.({ message: t('camera.errorOccurred') });
33
36
  }
34
37
  };
35
38
  const onInitialized = useCallback(() => {
@@ -38,33 +41,63 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
38
41
  }, []);
39
42
  const onCameraError = useCallback((error) => {
40
43
  console.error('Camera error:', error);
41
- onError?.({ message: error.message || 'Camera error occurred' });
42
- }, [onError]);
44
+ onError?.({ message: error.message || t('camera.errorOccurred') });
45
+ }, [onError, t]);
46
+ const captureSilentPhoto = useCallback(async () => {
47
+ if (!camera.current || !isInitialized) {
48
+ onError?.({ message: t('camera.notReady') });
49
+ return;
50
+ }
51
+ console.log('silentCaptureResult', silentCaptureResult);
52
+ if (silentCaptureResult?.isAnalyzing || silentCaptureResult?.success) {
53
+ return;
54
+ }
55
+ try {
56
+ const photo = await camera.current.takePhoto({
57
+ enableShutterSound: true,
58
+ flash: enableFlash ? flash : 'off',
59
+ });
60
+ const result = await VisionCameraModule.processPhotoResult(photo);
61
+ onSilentCapture?.(result);
62
+ }
63
+ catch (error) {
64
+ }
65
+ }, [isInitialized, onError, onSilentCapture]);
66
+ // Automatically take a silent photo every 5 seconds when ready
67
+ useEffect(() => {
68
+ if (!showCamera || !isInitialized) {
69
+ return;
70
+ }
71
+ const intervalId = setInterval(() => {
72
+ captureSilentPhoto();
73
+ }, 5000);
74
+ return () => clearInterval(intervalId);
75
+ }, [showCamera, isInitialized, captureSilentPhoto]);
43
76
  const capturePhoto = useCallback(async () => {
44
77
  try {
45
78
  if (!camera.current || !isInitialized) {
46
- onError?.({ message: 'Camera not ready' });
79
+ onError?.({ message: t('camera.notReady') });
47
80
  return;
48
81
  }
49
82
  const photo = await camera.current.takePhoto({
50
83
  enableShutterSound: true,
51
84
  flash: enableFlash ? flash : 'off',
52
85
  });
53
- const result = VisionCameraModule.processPhotoResult(photo);
86
+ const result = await VisionCameraModule.processPhotoResult(photo);
54
87
  onCapture?.(result);
55
88
  }
56
89
  catch (error) {
57
90
  console.error('Error taking photo:', error);
58
91
  onCapture?.({
59
92
  success: false,
60
- error: error instanceof Error ? error.message : 'Failed to capture photo',
93
+ error: error instanceof Error ? error.message : t('camera.failedToCapture'),
61
94
  });
62
95
  }
63
96
  }, [isInitialized, quality, flash, enableFlash, onCapture, onError]);
64
97
  const startVideoRecording = useCallback(async () => {
65
98
  try {
66
99
  if (!camera.current || !isInitialized) {
67
- onError?.({ message: 'Camera not ready' });
100
+ onError?.({ message: t('camera.notReady') });
68
101
  return;
69
102
  }
70
103
  await camera.current.startRecording({
@@ -78,7 +111,7 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
78
111
  console.error('Recording error:', error);
79
112
  onVideoRecordingStop?.({
80
113
  success: false,
81
- error: error.message || 'Failed to record video',
114
+ error: error.message || t('camera.failedToStartRecording'),
82
115
  });
83
116
  },
84
117
  });
@@ -88,47 +121,47 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
88
121
  console.error('Error starting video recording:', error);
89
122
  onVideoRecordingStop?.({
90
123
  success: false,
91
- error: error instanceof Error ? error.message : 'Failed to start video recording',
124
+ error: error instanceof Error ? error.message : t('camera.failedToStartRecording'),
92
125
  });
93
126
  }
94
127
  }, [isInitialized, onVideoRecordingStart, onVideoRecordingStop, onError]);
95
128
  const stopVideoRecording = useCallback(async () => {
96
129
  try {
97
130
  if (!camera.current) {
98
- onError?.({ message: 'Camera not ready' });
131
+ onError?.({ message: t('camera.notReady') });
99
132
  return;
100
133
  }
101
134
  await camera.current.stopRecording();
102
135
  }
103
136
  catch (error) {
104
137
  console.error('Error stopping video recording:', error);
105
- onError?.({ message: 'Failed to stop video recording' });
138
+ onError?.({ message: t('camera.failedToStopRecording') });
106
139
  }
107
140
  }, [onError]);
108
- const switchCamera = useCallback(() => {
109
- setCameraType(current => current === 'front' ? 'back' : 'front');
110
- }, []);
111
- const toggleFlash = useCallback(() => {
112
- setFlash(current => {
113
- switch (current) {
114
- case 'off': return 'on';
115
- case 'on': return 'auto';
116
- case 'auto': return 'off';
117
- default: return 'off';
118
- }
119
- });
120
- }, []);
141
+ // const switchCamera = useCallback(() => {
142
+ // setCameraType(current => current === 'front' ? 'back' : 'front');
143
+ // }, []);
144
+ // const toggleFlash = useCallback(() => {
145
+ // setFlash(current => {
146
+ // switch (current) {
147
+ // case 'off': return 'on';
148
+ // case 'on': return 'auto';
149
+ // case 'auto': return 'off';
150
+ // default: return 'off';
151
+ // }
152
+ // });
153
+ // }, []);
121
154
  if (!hasPermission) {
122
155
  return (<View style={[styles.container, style]}>
123
156
  <Text style={styles.permissionMessage}>
124
- Camera permission required. Please grant permission to continue.
157
+ {t('camera.permissionRequired')}
125
158
  </Text>
126
159
  </View>);
127
160
  }
128
161
  if (!device) {
129
162
  return (<View style={[styles.container, style]}>
130
163
  <Text style={styles.errorMessage}>
131
- Camera device not available
164
+ {t('camera.deviceNotAvailable')}
132
165
  </Text>
133
166
  </View>);
134
167
  }
@@ -150,7 +183,7 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
150
183
 
151
184
  {/* Bounding box overlay */}
152
185
  {bbox && (<View style={styles.bboxOverlay}>
153
- <View style={[
186
+ <View style={[
154
187
  styles.bbox,
155
188
  {
156
189
  left: `${bbox.xMin}%`,
@@ -168,14 +201,16 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
168
201
  {/* Camera controls */}
169
202
  <View style={styles.controlsContainer}>
170
203
  {/* Flash button */}
171
- {enableFlash && (<TouchableOpacity style={styles.controlButton} onPress={toggleFlash}>
204
+ {/* {enableFlash && (
205
+ <TouchableOpacity style={styles.controlButton} onPress={toggleFlash}>
172
206
  <Text style={styles.controlButtonText}>
173
207
  {flash === 'off' ? '⚡' : flash === 'on' ? '⚡️' : '✨'}
174
208
  </Text>
175
- </TouchableOpacity>)}
209
+ </TouchableOpacity>
210
+ )} */}
176
211
 
177
212
  {/* Capture button */}
178
- {showCaptureButton && !enableVideo && (<TouchableOpacity style={styles.captureButton} onPress={capturePhoto} disabled={!isInitialized}>
213
+ {showCaptureButton && !enableVideo && silentCaptureResult?.success && (<TouchableOpacity style={styles.captureButton} onPress={capturePhoto} disabled={!isInitialized}>
179
214
  <View style={[
180
215
  styles.captureButtonInner,
181
216
  !isInitialized && styles.captureButtonDisabled
@@ -183,7 +218,7 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
183
218
  </TouchableOpacity>)}
184
219
 
185
220
  {/* Video recording button */}
186
- {showCaptureButton && enableVideo && (<TouchableOpacity style={[
221
+ {showCaptureButton && enableVideo && silentCaptureResult?.success && (<TouchableOpacity style={[
187
222
  styles.captureButton,
188
223
  isRecording && styles.recordingButton
189
224
  ]} onPress={isRecording ? stopVideoRecording : startVideoRecording} disabled={!isInitialized}>
@@ -195,9 +230,15 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
195
230
  </TouchableOpacity>)}
196
231
 
197
232
  {/* Switch camera button */}
198
- {showSwitchCamera && canFlip && (<TouchableOpacity style={styles.controlButton} onPress={switchCamera}>
233
+ {/* {showSwitchCamera && canFlip && (
234
+ <TouchableOpacity style={styles.controlButton} onPress={switchCamera}>
199
235
  <Text style={styles.controlButtonText}>🔄</Text>
200
- </TouchableOpacity>)}
236
+ </TouchableOpacity>
237
+ )} */}
238
+
239
+ {silentCaptureResult?.isAnalyzing && (<View style={{ backgroundColor: 'rgba(0, 0, 0, 0.7)', padding: 10, borderRadius: 10 }}>
240
+ <Text style={{ color: 'white', fontSize: 16, fontWeight: 'bold' }}>{t('camera.analyzing')}</Text>
241
+ </View>)}
201
242
  </View>
202
243
  </View>);
203
244
  };
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedCameraView.js","sourceRoot":"","sources":["../../src/components/EnhancedCameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,kBAAkB,MAAM,sCAAsC,CAAC;AAkCtE,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,YAAY,GAAG,2DAA2D,EAC1E,UAAU,EACV,UAAU,EAAE,iBAAiB,GAAG,OAAO,EACvC,KAAK,EACL,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,MAAM,EAChB,iBAAiB,GAAG,IAAI,EACxB,gBAAgB,GAAG,IAAI,EACvB,gBAAgB,EAChB,IAAI,EACJ,OAAO,GAAG,IAAI,EACd,WAAW,GAAG,KAAK,EACnB,WAAW,GAAG,KAAK,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,GAAG,EAAE,GACnB,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,MAAM,CAAS,IAAI,CAAC,CAAC;IACpC,MAA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AE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,OAAO;KACrB;IACD,kBAAkB,EAAE;QAClB,eAAe,EAAE,OAAO;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;KACjB;IACD,qBAAqB,EAAE;QACrB,eAAe,EAAE,0BAA0B;KAC5C;IACD,eAAe,EAAE;QACf,eAAe,EAAE,wBAAwB;QACzC,WAAW,EAAE,SAAS;KACvB;IACD,oBAAoB,EAAE;QACpB,eAAe,EAAE,SAAS;KAC3B;IACD,iBAAiB,EAAE;QACjB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,EAAE;KACX;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,EAAE;KACX;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,aAAa,EAAE,MAAM;KACtB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,OAAO;QACpB,eAAe,EAAE,aAAa;KAC/B;CACF,CAAC,CAAC","sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { View, StyleSheet, TouchableOpacity, Text, ViewStyle } from 'react-native';\nimport { Camera, useCameraDevice } from 'react-native-vision-camera';\nimport VisionCameraModule from '../modules/camera/VisionCameraModule';\n\nexport interface EnhancedCameraViewProps {\n instructions?: string;\n showCamera: boolean;\n cameraType?: 'front' | 'back';\n style?: ViewStyle;\n onCapture?: (result: { success: boolean; path?: string; error?: string }) => void;\n onError?: (event: { message: string }) => void;\n onClose?: () => void;\n enableFlash?: boolean;\n enableHdr?: boolean;\n quality?: 'low' | 'medium' | 'high';\n showCaptureButton?: boolean;\n showSwitchCamera?: boolean;\n overlayComponent?: React.ReactNode;\n bbox?: {\n xMin: number;\n yMin: number;\n xMax: number;\n yMax: number;\n borderColor?: string;\n borderWidth?: number;\n cornerRadius?: number;\n };\n canFlip?: boolean;\n // Video recording props\n enableVideo?: boolean;\n isRecording?: boolean;\n onVideoRecordingStart?: () => void;\n onVideoRecordingStop?: (result: { success: boolean; path?: string; error?: string }) => void;\n videoDuration?: number;\n}\n\nexport const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({\n instructions = 'Position yourself in the frame and tap the capture button',\n showCamera,\n cameraType: initialCameraType = 'front',\n style,\n onCapture,\n onError,\n onClose,\n enableFlash = false,\n enableHdr = false,\n quality = 'high',\n showCaptureButton = true,\n showSwitchCamera = true,\n overlayComponent,\n bbox,\n canFlip = true,\n enableVideo = false,\n isRecording = false,\n onVideoRecordingStart,\n onVideoRecordingStop,\n videoDuration = 10,\n}) => {\n const camera = useRef<Camera>(null);\n const [cameraType, setCameraType] = useState<'front' | 'back'>(initialCameraType);\n const [hasPermission, setHasPermission] = useState(false);\n const [isInitialized, setIsInitialized] = useState(false);\n const [flash, setFlash] = useState<'off' | 'on' | 'auto'>('off');\n\n const device = useCameraDevice(cameraType);\n\n // Check permissions on component mount\n useEffect(() => {\n if (showCamera) {\n checkPermissions();\n }\n }, [showCamera]);\n\n const checkPermissions = async () => {\n try {\n const hasAllPermissions = await VisionCameraModule.hasAllPermissions();\n if (!hasAllPermissions) {\n const granted = await VisionCameraModule.requestAllPermissions();\n if (!granted) {\n onError?.({ message: 'Camera permissions not granted' });\n return;\n }\n }\n setHasPermission(true);\n } catch (error) {\n console.error('Error checking permissions:', error);\n onError?.({ message: 'Error checking camera permissions' });\n }\n };\n\n const onInitialized = useCallback(() => {\n console.log('Camera initialized!');\n setIsInitialized(true);\n }, []);\n\n const onCameraError = useCallback((error: any) => {\n console.error('Camera error:', error);\n onError?.({ message: error.message || 'Camera error occurred' });\n }, [onError]);\n\n const capturePhoto = useCallback(async () => {\n try {\n if (!camera.current || !isInitialized) {\n onError?.({ message: 'Camera not ready' });\n return;\n }\n\n const photo = await camera.current.takePhoto({\n enableShutterSound: true,\n flash: enableFlash ? flash : 'off',\n });\n\n const result = VisionCameraModule.processPhotoResult(photo);\n onCapture?.(result);\n } catch (error) {\n console.error('Error taking photo:', error);\n onCapture?.({\n success: false,\n error: error instanceof Error ? error.message : 'Failed to capture photo',\n });\n }\n }, [isInitialized, quality, flash, enableFlash, onCapture, onError]);\n\n const startVideoRecording = useCallback(async () => {\n try {\n if (!camera.current || !isInitialized) {\n onError?.({ message: 'Camera not ready' });\n return;\n }\n\n await camera.current.startRecording({\n onRecordingFinished: (video: any) => {\n onVideoRecordingStop?.({\n success: true,\n path: video.path,\n });\n },\n onRecordingError: (error: any) => {\n console.error('Recording error:', error);\n onVideoRecordingStop?.({\n success: false,\n error: error.message || 'Failed to record video',\n });\n },\n });\n\n onVideoRecordingStart?.();\n } catch (error) {\n console.error('Error starting video recording:', error);\n onVideoRecordingStop?.({\n success: false,\n error: error instanceof Error ? error.message : 'Failed to start video recording',\n });\n }\n }, [isInitialized, onVideoRecordingStart, onVideoRecordingStop, onError]);\n\n const stopVideoRecording = useCallback(async () => {\n try {\n if (!camera.current) {\n onError?.({ message: 'Camera not ready' });\n return;\n }\n\n await camera.current.stopRecording();\n } catch (error) {\n console.error('Error stopping video recording:', error);\n onError?.({ message: 'Failed to stop video recording' });\n }\n }, [onError]);\n\n const switchCamera = useCallback(() => {\n setCameraType(current => current === 'front' ? 'back' : 'front');\n }, []);\n\n const toggleFlash = useCallback(() => {\n setFlash(current => {\n switch (current) {\n case 'off': return 'on';\n case 'on': return 'auto';\n case 'auto': return 'off';\n default: return 'off';\n }\n });\n }, []);\n\n if (!hasPermission) {\n return (\n <View style={[styles.container, style]}>\n <Text style={styles.permissionMessage}>\n Camera permission required. Please grant permission to continue.\n </Text>\n </View>\n );\n }\n\n if (!device) {\n return (\n <View style={[styles.container, style]}>\n <Text style={styles.errorMessage}>\n Camera device not available\n </Text>\n </View>\n );\n }\n\n if (!showCamera) {\n return <View style={[styles.container, style]} />;\n }\n\n return (\n <View style={[styles.container, style]}>\n <Camera\n ref={camera}\n style={StyleSheet.absoluteFill}\n device={device}\n isActive={showCamera}\n photo={true}\n video={enableVideo}\n audio={enableVideo}\n onInitialized={onInitialized}\n onError={onCameraError}\n />\n\n {/* Instructions */}\n {/* {instructions && (\n <View style={styles.instructionsOverlay}>\n <Text style={styles.instructions}>{instructions}</Text>\n </View>\n )} */}\n\n {/* Custom overlay component */}\n {overlayComponent}\n\n {/* Bounding box overlay */}\n {bbox && (\n <View style={styles.bboxOverlay}>\n <View\n style={[\n styles.bbox,\n {\n left: `${bbox.xMin}%`,\n top: `${bbox.yMin}%`,\n width: `${bbox.xMax - bbox.xMin}%`,\n height: `${bbox.yMax - bbox.yMin}%`,\n borderColor: bbox.borderColor || '#2DBD60',\n borderWidth: bbox.borderWidth || 3,\n borderRadius: bbox.cornerRadius || 8,\n }\n ]}\n />\n </View>\n )}\n\n\n {/* Camera controls */}\n <View style={styles.controlsContainer}>\n {/* Flash button */}\n {enableFlash && (\n <TouchableOpacity style={styles.controlButton} onPress={toggleFlash}>\n <Text style={styles.controlButtonText}>\n {flash === 'off' ? '⚡' : flash === 'on' ? '⚡️' : '✨'}\n </Text>\n </TouchableOpacity>\n )}\n\n {/* Capture button */}\n {showCaptureButton && !enableVideo && (\n <TouchableOpacity\n style={styles.captureButton}\n onPress={capturePhoto}\n disabled={!isInitialized}\n >\n <View style={[\n styles.captureButtonInner,\n !isInitialized && styles.captureButtonDisabled\n ]} />\n </TouchableOpacity>\n )}\n\n {/* Video recording button */}\n {showCaptureButton && enableVideo && (\n <TouchableOpacity\n style={[\n styles.captureButton,\n isRecording && styles.recordingButton\n ]}\n onPress={isRecording ? stopVideoRecording : startVideoRecording}\n disabled={!isInitialized}\n >\n <View style={[\n styles.captureButtonInner,\n !isInitialized && styles.captureButtonDisabled,\n isRecording && styles.recordingButtonInner\n ]} />\n </TouchableOpacity>\n )}\n\n {/* Switch camera button */}\n {showSwitchCamera && canFlip && (\n <TouchableOpacity style={styles.controlButton} onPress={switchCamera}>\n <Text style={styles.controlButtonText}>🔄</Text>\n </TouchableOpacity>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n },\n instructionsOverlay: {\n position: 'absolute',\n top: 60,\n left: 20,\n right: 20,\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n padding: 15,\n // borderRadius: 10,\n zIndex: 1,\n },\n instructions: {\n color: 'white',\n fontSize: 16,\n textAlign: 'center',\n fontWeight: '500',\n },\n closeButton: {\n position: 'absolute',\n top: 50,\n right: 20,\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n width: 40,\n height: 40,\n borderRadius: 20,\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: 2,\n },\n closeButtonText: {\n color: 'white',\n fontSize: 20,\n fontWeight: 'bold',\n },\n controlsContainer: {\n position: 'absolute',\n bottom: 40,\n left: 0,\n right: 0,\n flexDirection: 'row',\n justifyContent: 'space-around',\n alignItems: 'center',\n paddingHorizontal: 40,\n zIndex: 1,\n },\n controlButton: {\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n width: 50,\n height: 50,\n borderRadius: 25,\n justifyContent: 'center',\n alignItems: 'center',\n },\n controlButtonText: {\n fontSize: 24,\n },\n captureButton: {\n backgroundColor: 'rgba(255, 255, 255, 0.3)',\n width: 80,\n height: 80,\n borderRadius: 40,\n justifyContent: 'center',\n alignItems: 'center',\n borderWidth: 3,\n borderColor: 'white',\n },\n captureButtonInner: {\n backgroundColor: 'white',\n width: 60,\n height: 60,\n borderRadius: 30,\n },\n captureButtonDisabled: {\n backgroundColor: 'rgba(255, 255, 255, 0.5)',\n },\n recordingButton: {\n backgroundColor: 'rgba(255, 59, 48, 0.3)',\n borderColor: '#FF3B30',\n },\n recordingButtonInner: {\n backgroundColor: '#FF3B30',\n },\n permissionMessage: {\n color: 'white',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n errorMessage: {\n color: 'red',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n bboxOverlay: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n pointerEvents: 'none',\n },\n bbox: {\n position: 'absolute',\n borderStyle: 'solid',\n backgroundColor: 'transparent',\n },\n});"]}
1
+ {"version":3,"file":"EnhancedCameraView.js","sourceRoot":"","sources":["../../src/components/EnhancedCameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,kBAAkB,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAM3C,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,YAAY,GAAG,2DAA2D,EAC1E,UAAU,EACV,UAAU,EAAE,iBAAiB,GAAG,OAAO,EACvC,KAAK,EACL,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,MAAM,EAChB,iBAAiB,GAAG,IAAI,EACxB,gBAAgB,GAAG,IAAI,EACvB,gBAAgB,EAChB,IAAI,EACJ,OAAO,GAAG,IAAI,EACd,WAAW,GAAG,KAAK,EACnB,WAAW,GAAG,KAAK,EACnB,qBAAqB,EACrB,oB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AE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,OAAO;KACrB;IACD,kBAAkB,EAAE;QAClB,eAAe,EAAE,OAAO;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;KACjB;IACD,qBAAqB,EAAE;QACrB,eAAe,EAAE,0BAA0B;KAC5C;IACD,eAAe,EAAE;QACf,eAAe,EAAE,wBAAwB;QACzC,WAAW,EAAE,SAAS;KACvB;IACD,oBAAoB,EAAE;QACpB,eAAe,EAAE,SAAS;KAC3B;IACD,iBAAiB,EAAE;QACjB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,EAAE;KACX;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,EAAE;KACX;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,aAAa,EAAE,MAAM;KACtB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,OAAO;QACpB,eAAe,EAAE,aAAa;KAC/B;CACF,CAAC,CAAC","sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { View, StyleSheet, TouchableOpacity, Text } from 'react-native';\nimport { Camera, useCameraDevice } from 'react-native-vision-camera';\nimport VisionCameraModule from '../modules/camera/VisionCameraModule';\nimport { useI18n } from '../hooks/useI18n';\nimport { EnhancedCameraViewProps } from './OverLay/type';\n\n\n\n\nexport const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({\n instructions = 'Position yourself in the frame and tap the capture button',\n showCamera,\n cameraType: initialCameraType = 'front',\n style,\n onCapture,\n onError,\n onClose,\n enableFlash = false,\n enableHdr = false,\n quality = 'high',\n showCaptureButton = true,\n showSwitchCamera = true,\n overlayComponent,\n bbox,\n canFlip = true,\n enableVideo = false,\n isRecording = false,\n onVideoRecordingStart,\n onVideoRecordingStop,\n videoDuration = 10,\n onSilentCapture,\n silentCaptureResult,\n}) => {\n const { t } = useI18n();\n const camera = useRef<Camera>(null);\n const [cameraType, setCameraType] = useState<'front' | 'back'>(initialCameraType);\n const [hasPermission, setHasPermission] = useState(false);\n const [isInitialized, setIsInitialized] = useState(false);\n const [flash, setFlash] = useState<'off' | 'on' | 'auto'>('off');\n\n const device = useCameraDevice(cameraType);\n console.log({ setCameraType, setFlash });\n\n // Check permissions on component mount\n useEffect(() => {\n if (showCamera) {\n checkPermissions();\n }\n }, [showCamera]);\n\n const checkPermissions = async () => {\n try {\n const hasAllPermissions = await VisionCameraModule.hasAllPermissions();\n if (!hasAllPermissions) {\n const granted = await VisionCameraModule.requestAllPermissions();\n if (!granted) {\n onError?.({ message: t('camera.permissionRequired') });\n return;\n }\n }\n setHasPermission(true);\n } catch (error) {\n console.error('Error checking permissions:', error);\n onError?.({ message: t('camera.errorOccurred') });\n }\n };\n\n const onInitialized = useCallback(() => {\n console.log('Camera initialized!');\n setIsInitialized(true);\n }, []);\n\n const onCameraError = useCallback((error: any) => {\n console.error('Camera error:', error);\n onError?.({ message: error.message || t('camera.errorOccurred') });\n }, [onError, t]);\n\n const captureSilentPhoto = useCallback(async () => {\n if (!camera.current || !isInitialized) {\n onError?.({ message: t('camera.notReady') });\n return;\n }\n console.log('silentCaptureResult', silentCaptureResult);\n if (silentCaptureResult?.isAnalyzing || silentCaptureResult?.success) {\n return;\n }\n try {\n const photo = await camera.current.takePhoto({\n enableShutterSound: true,\n flash: enableFlash ? flash : 'off',\n });\n\n const result = await VisionCameraModule.processPhotoResult(photo);\n onSilentCapture?.(result);\n } catch (error) {\n\n }\n }, [isInitialized, onError, onSilentCapture]);\n\n // Automatically take a silent photo every 5 seconds when ready\n useEffect(() => {\n if (!showCamera || !isInitialized) {\n return;\n }\n\n const intervalId = setInterval(() => {\n captureSilentPhoto();\n }, 5000);\n\n return () => clearInterval(intervalId);\n }, [showCamera, isInitialized, captureSilentPhoto]);\n\n const capturePhoto = useCallback(async () => {\n try {\n if (!camera.current || !isInitialized) {\n onError?.({ message: t('camera.notReady') });\n return;\n }\n\n const photo = await camera.current.takePhoto({\n enableShutterSound: true,\n flash: enableFlash ? flash : 'off',\n });\n\n const result = await VisionCameraModule.processPhotoResult(photo);\n onCapture?.(result);\n } catch (error) {\n console.error('Error taking photo:', error);\n onCapture?.({\n success: false,\n error: error instanceof Error ? error.message : t('camera.failedToCapture'),\n });\n }\n }, [isInitialized, quality, flash, enableFlash, onCapture, onError]);\n\n const startVideoRecording = useCallback(async () => {\n try {\n if (!camera.current || !isInitialized) {\n onError?.({ message: t('camera.notReady') });\n return;\n }\n\n await camera.current.startRecording({\n onRecordingFinished: (video: any) => {\n onVideoRecordingStop?.({\n success: true,\n path: video.path,\n });\n },\n onRecordingError: (error: any) => {\n console.error('Recording error:', error);\n onVideoRecordingStop?.({\n success: false,\n error: error.message || t('camera.failedToStartRecording'),\n });\n },\n });\n\n onVideoRecordingStart?.();\n } catch (error) {\n console.error('Error starting video recording:', error);\n onVideoRecordingStop?.({\n success: false,\n error: error instanceof Error ? error.message : t('camera.failedToStartRecording'),\n });\n }\n }, [isInitialized, onVideoRecordingStart, onVideoRecordingStop, onError]);\n\n const stopVideoRecording = useCallback(async () => {\n try {\n if (!camera.current) {\n onError?.({ message: t('camera.notReady') });\n return;\n }\n\n await camera.current.stopRecording();\n } catch (error) {\n console.error('Error stopping video recording:', error);\n onError?.({ message: t('camera.failedToStopRecording') });\n }\n }, [onError]);\n\n // const switchCamera = useCallback(() => {\n // setCameraType(current => current === 'front' ? 'back' : 'front');\n // }, []);\n\n // const toggleFlash = useCallback(() => {\n // setFlash(current => {\n // switch (current) {\n // case 'off': return 'on';\n // case 'on': return 'auto';\n // case 'auto': return 'off';\n // default: return 'off';\n // }\n // });\n // }, []);\n\n if (!hasPermission) {\n return (\n <View style={[styles.container, style]}>\n <Text style={styles.permissionMessage}>\n {t('camera.permissionRequired')}\n </Text>\n </View>\n );\n }\n\n if (!device) {\n return (\n <View style={[styles.container, style]}>\n <Text style={styles.errorMessage}>\n {t('camera.deviceNotAvailable')}\n </Text>\n </View>\n );\n }\n\n if (!showCamera) {\n return <View style={[styles.container, style]} />;\n }\n\n return (\n <View style={[styles.container, style]}>\n <Camera\n ref={camera}\n style={StyleSheet.absoluteFill}\n device={device}\n isActive={showCamera}\n photo={true}\n video={enableVideo}\n audio={enableVideo}\n onInitialized={onInitialized}\n onError={onCameraError}\n />\n\n {/* Instructions */}\n {/* {instructions && (\n <View style={styles.instructionsOverlay}>\n <Text style={styles.instructions}>{instructions}</Text>\n </View>\n )} */}\n\n {/* Custom overlay component */}\n {overlayComponent}\n\n {/* Bounding box overlay */}\n {bbox && (\n <View style={styles.bboxOverlay}>\n <View\n style={[\n styles.bbox,\n {\n left: `${bbox.xMin}%`,\n top: `${bbox.yMin}%`,\n width: `${bbox.xMax - bbox.xMin}%`,\n height: `${bbox.yMax - bbox.yMin}%`,\n borderColor: bbox.borderColor || '#2DBD60',\n borderWidth: bbox.borderWidth || 3,\n borderRadius: bbox.cornerRadius || 8,\n }\n ]}\n />\n </View>\n )}\n\n\n {/* Camera controls */}\n <View style={styles.controlsContainer}>\n {/* Flash button */}\n {/* {enableFlash && (\n <TouchableOpacity style={styles.controlButton} onPress={toggleFlash}>\n <Text style={styles.controlButtonText}>\n {flash === 'off' ? '⚡' : flash === 'on' ? '⚡️' : '✨'}\n </Text>\n </TouchableOpacity>\n )} */}\n\n {/* Capture button */}\n {showCaptureButton && !enableVideo && silentCaptureResult?.success && (\n <TouchableOpacity\n style={styles.captureButton}\n onPress={capturePhoto}\n disabled={!isInitialized}\n >\n <View style={[\n styles.captureButtonInner,\n !isInitialized && styles.captureButtonDisabled\n ]} />\n </TouchableOpacity>\n )}\n\n {/* Video recording button */}\n {showCaptureButton && enableVideo && silentCaptureResult?.success && (\n <TouchableOpacity\n style={[\n styles.captureButton,\n isRecording && styles.recordingButton\n ]}\n onPress={isRecording ? stopVideoRecording : startVideoRecording}\n disabled={!isInitialized}\n >\n <View style={[\n styles.captureButtonInner,\n !isInitialized && styles.captureButtonDisabled,\n isRecording && styles.recordingButtonInner\n ]} />\n </TouchableOpacity>\n )}\n\n {/* Switch camera button */}\n {/* {showSwitchCamera && canFlip && (\n <TouchableOpacity style={styles.controlButton} onPress={switchCamera}>\n <Text style={styles.controlButtonText}>🔄</Text>\n </TouchableOpacity>\n )} */}\n\n {silentCaptureResult?.isAnalyzing && (\n <View style={{ backgroundColor: 'rgba(0, 0, 0, 0.7)', padding: 10, borderRadius: 10 }}>\n <Text style={{ color: 'white', fontSize: 16, fontWeight: 'bold' }}>{t('camera.analyzing')}</Text>\n </View>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n },\n instructionsOverlay: {\n position: 'absolute',\n top: 60,\n left: 20,\n right: 20,\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n padding: 15,\n // borderRadius: 10,\n zIndex: 1,\n },\n instructions: {\n color: 'white',\n fontSize: 16,\n textAlign: 'center',\n fontWeight: '500',\n },\n closeButton: {\n position: 'absolute',\n top: 50,\n right: 20,\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n width: 40,\n height: 40,\n borderRadius: 20,\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: 2,\n },\n closeButtonText: {\n color: 'white',\n fontSize: 20,\n fontWeight: 'bold',\n },\n controlsContainer: {\n position: 'absolute',\n bottom: 40,\n left: 0,\n right: 0,\n flexDirection: 'row',\n justifyContent: 'space-around',\n alignItems: 'center',\n paddingHorizontal: 40,\n zIndex: 1,\n },\n controlButton: {\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n width: 50,\n height: 50,\n borderRadius: 25,\n justifyContent: 'center',\n alignItems: 'center',\n },\n controlButtonText: {\n fontSize: 24,\n },\n captureButton: {\n backgroundColor: 'rgba(255, 255, 255, 0.3)',\n width: 80,\n height: 80,\n borderRadius: 40,\n justifyContent: 'center',\n alignItems: 'center',\n borderWidth: 3,\n borderColor: 'white',\n },\n captureButtonInner: {\n backgroundColor: 'white',\n width: 60,\n height: 60,\n borderRadius: 30,\n },\n captureButtonDisabled: {\n backgroundColor: 'rgba(255, 255, 255, 0.5)',\n },\n recordingButton: {\n backgroundColor: 'rgba(255, 59, 48, 0.3)',\n borderColor: '#FF3B30',\n },\n recordingButtonInner: {\n backgroundColor: '#FF3B30',\n },\n permissionMessage: {\n color: 'white',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n errorMessage: {\n color: 'red',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n bboxOverlay: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n pointerEvents: 'none',\n },\n bbox: {\n position: 'absolute',\n borderStyle: 'solid',\n backgroundColor: 'transparent',\n },\n});"]}
@@ -1,44 +1,4 @@
1
1
  import React from 'react';
2
- import { ViewStyle } from 'react-native';
3
- export interface EnhancedCameraViewProps {
4
- instructions?: string;
5
- showCamera: boolean;
6
- cameraType?: 'front' | 'back';
7
- style?: ViewStyle;
8
- onCapture?: (result: {
9
- success: boolean;
10
- path?: string;
11
- error?: string;
12
- }) => void;
13
- onError?: (event: {
14
- message: string;
15
- }) => void;
16
- onClose?: () => void;
17
- enableFlash?: boolean;
18
- enableHdr?: boolean;
19
- quality?: 'low' | 'medium' | 'high';
20
- showCaptureButton?: boolean;
21
- showSwitchCamera?: boolean;
22
- overlayComponent?: React.ReactNode;
23
- bbox?: {
24
- xMin: number;
25
- yMin: number;
26
- xMax: number;
27
- yMax: number;
28
- borderColor?: string;
29
- borderWidth?: number;
30
- cornerRadius?: number;
31
- };
32
- canFlip?: boolean;
33
- enableVideo?: boolean;
34
- isRecording?: boolean;
35
- onVideoRecordingStart?: () => void;
36
- onVideoRecordingStop?: (result: {
37
- success: boolean;
38
- path?: string;
39
- error?: string;
40
- }) => void;
41
- videoDuration?: number;
42
- }
2
+ import { EnhancedCameraViewProps } from './OverLay/type';
43
3
  export declare const EnhancedCameraView: React.FC<EnhancedCameraViewProps>;
44
4
  //# sourceMappingURL=EnhancedCameraView.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedCameraView.web.d.ts","sourceRoot":"","sources":["../../src/components/EnhancedCameraView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAA4C,SAAS,EAAY,MAAM,cAAc,CAAC;AAE7F,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAClF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7F,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAgXhE,CAAC"}
1
+ {"version":3,"file":"EnhancedCameraView.web.d.ts","sourceRoot":"","sources":["../../src/components/EnhancedCameraView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA+YhE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { View, StyleSheet, TouchableOpacity, Text, Platform } from 'react-native';
3
- export const EnhancedCameraView = ({ instructions = 'Position yourself in the frame and tap the capture button', showCamera, cameraType: initialCameraType = 'front', style, onCapture, onError, onClose, enableFlash = false, enableHdr = false, quality = 'high', showCaptureButton = true, showSwitchCamera = true, overlayComponent, bbox, canFlip = true, enableVideo = false, isRecording = false, onVideoRecordingStart, onVideoRecordingStop, videoDuration = 10, }) => {
3
+ export const EnhancedCameraView = ({ instructions = 'Position yourself in the frame and tap the capture button', showCamera, cameraType: initialCameraType = 'front', style, onCapture, onError, onClose, enableFlash = false, enableHdr = false, quality = 'high', showCaptureButton = true, showSwitchCamera = true, overlayComponent, bbox, canFlip = true, enableVideo = false, isRecording = false, onVideoRecordingStart, onVideoRecordingStop, videoDuration = 10, onSilentCapture, silentCaptureResult, }) => {
4
4
  // Vérification de plateforme - ce composant est uniquement pour le web
5
5
  if (Platform.OS !== 'web') {
6
6
  console.warn('EnhancedCameraView.web.tsx should only be used on web platform');
@@ -85,6 +85,20 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
85
85
  }, [onError]);
86
86
  console.log('isInitialized', onInitialized, onCameraError);
87
87
  const capturePhoto = useCallback(async () => {
88
+ try {
89
+ onCapture && onCapture({
90
+ success: true
91
+ });
92
+ }
93
+ catch (error) {
94
+ console.error('Error taking photo:', error);
95
+ onCapture?.({
96
+ success: false,
97
+ error: error instanceof Error ? error.message : 'Failed to capture photo',
98
+ });
99
+ }
100
+ }, [isInitialized, onCapture, onError]);
101
+ const captureSilentPhoto = useCallback(async () => {
88
102
  try {
89
103
  if (!videoRef.current || !canvasRef.current || !isInitialized) {
90
104
  onError?.({ message: 'Camera not ready' });
@@ -104,7 +118,7 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
104
118
  context.drawImage(video, 0, 0);
105
119
  // Convert to base64
106
120
  const imageDataUrl = canvas.toDataURL('image/jpeg', 0.8);
107
- onCapture?.({
121
+ onSilentCapture?.({
108
122
  success: true,
109
123
  path: imageDataUrl,
110
124
  });
@@ -116,7 +130,17 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
116
130
  error: error instanceof Error ? error.message : 'Failed to capture photo',
117
131
  });
118
132
  }
119
- }, [isInitialized, onCapture, onError]);
133
+ }, [isInitialized, onError, onSilentCapture]);
134
+ // Automatically take a silent photo every 5 seconds when ready
135
+ useEffect(() => {
136
+ if (!showCamera || !isInitialized) {
137
+ return;
138
+ }
139
+ const intervalId = setInterval(() => {
140
+ captureSilentPhoto();
141
+ }, 5000);
142
+ return () => clearInterval(intervalId);
143
+ }, [showCamera, isInitialized, captureSilentPhoto]);
120
144
  const startVideoRecording = useCallback(async () => {
121
145
  try {
122
146
  if (!stream || !isInitialized) {
@@ -258,7 +282,7 @@ export const EnhancedCameraView = ({ instructions = 'Position yourself in the fr
258
282
  </TouchableOpacity>)}
259
283
 
260
284
  {/* Capture button */}
261
- {showCaptureButton && !enableVideo && (<TouchableOpacity style={styles.captureButton} onPress={capturePhoto} disabled={!isInitialized}>
285
+ {showCaptureButton && !enableVideo && silentCaptureResult?.success && (<TouchableOpacity style={styles.captureButton} onPress={capturePhoto} disabled={!isInitialized}>
262
286
  <View style={[
263
287
  styles.captureButtonInner,
264
288
  !isInitialized && styles.captureButtonDisabled
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedCameraView.web.js","sourceRoot":"","sources":["../../src/components/EnhancedCameraView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAC;AAkC7F,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,YAAY,GAAG,2DAA2D,EAC1E,UAAU,EACV,UAAU,EAAE,iBAAiB,GAAG,OAAO,EACvC,KAAK,EACL,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,MAAM,EAChB,iBAAiB,GAAG,IAAI,EACxB,gBAAgB,GAAG,IAAI,EACvB,gBAAgB,EAChB,IAAI,EACJ,OAAO,GAAG,IAAI,E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;QACxB,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,OAAO;KACrB;IACD,kBAAkB,EAAE;QAClB,eAAe,EAAE,OAAO;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;KACjB;IACD,qBAAqB,EAAE;QACrB,eAAe,EAAE,0BAA0B;KAC5C;IACD,eAAe,EAAE;QACf,eAAe,EAAE,wBAAwB;QACzC,WAAW,EAAE,SAAS;KACvB;IACD,oBAAoB,EAAE;QACpB,eAAe,EAAE,SAAS;KAC3B;IACD,iBAAiB,EAAE;QACjB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,EAAE;KACX;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,EAAE;KACX;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,aAAa,EAAE,MAAM;KACtB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,OAAO;QACpB,eAAe,EAAE,aAAa;KAC/B;CACF,CAAC,CAAC","sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { View, StyleSheet, TouchableOpacity, Text, ViewStyle, Platform } from 'react-native';\n\nexport interface EnhancedCameraViewProps {\n instructions?: string;\n showCamera: boolean;\n cameraType?: 'front' | 'back';\n style?: ViewStyle;\n onCapture?: (result: { success: boolean; path?: string; error?: string }) => void;\n onError?: (event: { message: string }) => void;\n onClose?: () => void;\n enableFlash?: boolean;\n enableHdr?: boolean;\n quality?: 'low' | 'medium' | 'high';\n showCaptureButton?: boolean;\n showSwitchCamera?: boolean;\n overlayComponent?: React.ReactNode;\n bbox?: {\n xMin: number;\n yMin: number;\n xMax: number;\n yMax: number;\n borderColor?: string;\n borderWidth?: number;\n cornerRadius?: number;\n };\n canFlip?: boolean;\n // Video recording props\n enableVideo?: boolean;\n isRecording?: boolean;\n onVideoRecordingStart?: () => void;\n onVideoRecordingStop?: (result: { success: boolean; path?: string; error?: string }) => void;\n videoDuration?: number;\n}\n\nexport const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({\n instructions = 'Position yourself in the frame and tap the capture button',\n showCamera,\n cameraType: initialCameraType = 'front',\n style,\n onCapture,\n onError,\n onClose,\n enableFlash = false,\n enableHdr = false,\n quality = 'high',\n showCaptureButton = true,\n showSwitchCamera = true,\n overlayComponent,\n bbox,\n canFlip = true,\n enableVideo = false,\n isRecording = false,\n onVideoRecordingStart,\n onVideoRecordingStop,\n videoDuration = 10,\n}) => {\n // Vérification de plateforme - ce composant est uniquement pour le web\n if (Platform.OS !== 'web') {\n console.warn('EnhancedCameraView.web.tsx should only be used on web platform');\n return null;\n }\n const videoRef = useRef<HTMLVideoElement>(null);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const [cameraType, setCameraType] = useState<'front' | 'back'>(initialCameraType);\n const [hasPermission, setHasPermission] = useState(false);\n const [isInitialized, setIsInitialized] = useState(false);\n const [flash, setFlash] = useState<'off' | 'on' | 'auto'>('off');\n const [stream, setStream] = useState<MediaStream | null>(null);\n const [isRecordingVideo, setIsRecordingVideo] = useState(false);\n const [mediaRecorder, setMediaRecorder] = useState<MediaRecorder | null>(null);\n const [recordedChunks, setRecordedChunks] = useState<Blob[]>([]);\n\n console.log('cameraType', cameraType, recordedChunks);\n // Check permissions on component mount\n useEffect(() => {\n if (showCamera) {\n checkPermissions();\n }\n }, [showCamera]);\n\n // Cleanup stream on unmount\n useEffect(() => {\n return () => {\n if (stream) {\n stream.getTracks().forEach(track => track.stop());\n }\n };\n }, [stream]);\n\n const checkPermissions = async () => {\n try {\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n onError?.({ message: 'Camera not supported in this browser' });\n return;\n }\n\n // Test camera permission\n const stream = await navigator.mediaDevices.getUserMedia({ video: true });\n stream.getTracks().forEach(track => track.stop());\n \n setHasPermission(true);\n await startCamera();\n } catch (error) {\n console.error('Error checking permissions:', error);\n onError?.({ message: 'Camera permissions not granted' });\n }\n };\n\n const startCamera = async () => {\n try {\n if (stream) {\n stream.getTracks().forEach(track => track.stop());\n }\n\n const constraints = {\n video: {\n facingMode: cameraType === 'front' ? 'user' : 'environment',\n width: { ideal: quality === 'high' ? 1920 : quality === 'medium' ? 1280 : 640 },\n height: { ideal: quality === 'high' ? 1080 : quality === 'medium' ? 720 : 480 },\n },\n audio: enableVideo,\n };\n\n const newStream = await navigator.mediaDevices.getUserMedia(constraints);\n setStream(newStream);\n\n if (videoRef.current) {\n videoRef.current.srcObject = newStream;\n videoRef.current.onloadedmetadata = () => {\n setIsInitialized(true);\n };\n }\n } catch (error) {\n console.error('Error starting camera:', error);\n onError?.({ message: 'Failed to start camera' });\n }\n };\n\n const onInitialized = useCallback(() => {\n console.log('Camera initialized!');\n setIsInitialized(true);\n }, []);\n\n const onCameraError = useCallback((error: any) => {\n console.error('Camera error:', error);\n onError?.({ message: error.message || 'Camera error occurred' });\n }, [onError]);\n\n console.log('isInitialized', onInitialized, onCameraError);\n\n const capturePhoto = useCallback(async () => {\n try {\n if (!videoRef.current || !canvasRef.current || !isInitialized) {\n onError?.({ message: 'Camera not ready' });\n return;\n }\n\n const video = videoRef.current;\n const canvas = canvasRef.current;\n const context = canvas.getContext('2d');\n\n if (!context) {\n onError?.({ message: 'Canvas context not available' });\n return;\n }\n\n // Set canvas dimensions to match video\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n\n // Draw the current video frame to canvas\n context.drawImage(video, 0, 0);\n\n // Convert to base64\n const imageDataUrl = canvas.toDataURL('image/jpeg', 0.8);\n \n onCapture?.({\n success: true,\n path: imageDataUrl,\n });\n } catch (error) {\n console.error('Error taking photo:', error);\n onCapture?.({\n success: false,\n error: error instanceof Error ? error.message : 'Failed to capture photo',\n });\n }\n }, [isInitialized, onCapture, onError]);\n\n const startVideoRecording = useCallback(async () => {\n try {\n if (!stream || !isInitialized) {\n onError?.({ message: 'Camera not ready' });\n return;\n }\n\n const chunks: Blob[] = [];\n setRecordedChunks(chunks);\n\n const recorder = new MediaRecorder(stream, {\n mimeType: 'video/webm;codecs=vp9',\n });\n\n recorder.ondataavailable = (event) => {\n if (event.data.size > 0) {\n chunks.push(event.data);\n }\n };\n\n recorder.onstop = () => {\n const blob = new Blob(chunks, { type: 'video/webm' });\n const url = URL.createObjectURL(blob);\n \n onVideoRecordingStop?.({\n success: true,\n path: url,\n });\n \n setRecordedChunks([]);\n setIsRecordingVideo(false);\n };\n\n recorder.onerror = (event) => {\n console.error('Recording error:', event);\n onVideoRecordingStop?.({\n success: false,\n error: 'Failed to record video',\n });\n setIsRecordingVideo(false);\n };\n\n setMediaRecorder(recorder);\n recorder.start();\n setIsRecordingVideo(true);\n onVideoRecordingStart?.();\n\n // Auto-stop after videoDuration seconds\n setTimeout(() => {\n if (recorder.state === 'recording') {\n recorder.stop();\n }\n }, videoDuration * 1000);\n\n } catch (error) {\n console.error('Error starting video recording:', error);\n onVideoRecordingStop?.({\n success: false,\n error: error instanceof Error ? error.message : 'Failed to start video recording',\n });\n }\n }, [isInitialized, stream, videoDuration, onVideoRecordingStart, onVideoRecordingStop, onError]);\n\n const stopVideoRecording = useCallback(async () => {\n try {\n if (mediaRecorder && mediaRecorder.state === 'recording') {\n mediaRecorder.stop();\n }\n } catch (error) {\n console.error('Error stopping video recording:', error);\n onError?.({ message: 'Failed to stop video recording' });\n }\n }, [mediaRecorder, onError]);\n\n const switchCamera = useCallback(async () => {\n setCameraType(current => current === 'front' ? 'back' : 'front');\n // Restart camera with new facing mode\n await startCamera();\n }, [cameraType]);\n\n const toggleFlash = useCallback(() => {\n setFlash(current => {\n switch (current) {\n case 'off': return 'on';\n case 'on': return 'auto';\n case 'auto': return 'off';\n default: return 'off';\n }\n });\n }, []);\n\n if (!hasPermission) {\n return (\n <View style={[styles.container, style]}>\n <Text style={styles.permissionMessage}>\n Camera permission required. Please grant permission to continue.\n </Text>\n </View>\n );\n }\n\n if (!showCamera) {\n return <View style={[styles.container, style]} />;\n }\n\n return (\n <View style={[styles.container, style]}>\n {/* Video element */}\n <video\n ref={videoRef}\n style={{\n position: 'absolute',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n }}\n autoPlay\n playsInline\n muted\n />\n\n {/* Hidden canvas for photo capture */}\n <canvas\n ref={canvasRef}\n style={{\n position: 'absolute',\n left: '-9999px',\n top: '-9999px',\n }}\n />\n\n {/* Instructions */}\n {/* {instructions && (\n <View style={styles.instructionsOverlay}>\n <Text style={styles.instructions}>{instructions}</Text>\n </View>\n )} */}\n\n {/* Custom overlay component */}\n {overlayComponent}\n\n {/* Bounding box overlay */}\n {bbox && (\n <View style={styles.bboxOverlay}>\n <View\n style={[\n styles.bbox,\n {\n left: `${bbox.xMin}%`,\n top: `${bbox.yMin}%`,\n width: `${bbox.xMax - bbox.xMin}%`,\n height: `${bbox.yMax - bbox.yMin}%`,\n borderColor: bbox.borderColor || '#2DBD60',\n borderWidth: bbox.borderWidth || 3,\n borderRadius: bbox.cornerRadius || 8,\n }\n ]}\n />\n </View>\n )}\n\n {/* Camera controls */}\n <View style={styles.controlsContainer}>\n {/* Flash button */}\n {enableFlash && (\n <TouchableOpacity style={styles.controlButton} onPress={toggleFlash}>\n <Text style={styles.controlButtonText}>\n {flash === 'off' ? '⚡' : flash === 'on' ? '⚡️' : '✨'}\n </Text>\n </TouchableOpacity>\n )}\n\n {/* Capture button */}\n {showCaptureButton && !enableVideo && (\n <TouchableOpacity\n style={styles.captureButton}\n onPress={capturePhoto}\n disabled={!isInitialized}\n >\n <View style={[\n styles.captureButtonInner,\n !isInitialized && styles.captureButtonDisabled\n ]} />\n </TouchableOpacity>\n )}\n\n {/* Video recording button */}\n {showCaptureButton && enableVideo && (\n <TouchableOpacity\n style={[\n styles.captureButton,\n isRecordingVideo && styles.recordingButton\n ]}\n onPress={isRecordingVideo ? stopVideoRecording : startVideoRecording}\n disabled={!isInitialized}\n >\n <View style={[\n styles.captureButtonInner,\n !isInitialized && styles.captureButtonDisabled,\n isRecordingVideo && styles.recordingButtonInner\n ]} />\n </TouchableOpacity>\n )}\n\n {/* Switch camera button */}\n {showSwitchCamera && canFlip && (\n <TouchableOpacity style={styles.controlButton} onPress={switchCamera}>\n <Text style={styles.controlButtonText}>🔄</Text>\n </TouchableOpacity>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n },\n instructionsOverlay: {\n position: 'absolute',\n top: 60,\n left: 20,\n right: 20,\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n padding: 15,\n borderRadius: 10,\n zIndex: 1,\n },\n instructions: {\n color: 'white',\n fontSize: 16,\n textAlign: 'center',\n fontWeight: '500',\n },\n closeButton: {\n position: 'absolute',\n top: 50,\n right: 20,\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n width: 40,\n height: 40,\n borderRadius: 20,\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: 2,\n },\n closeButtonText: {\n color: 'white',\n fontSize: 20,\n fontWeight: 'bold',\n },\n controlsContainer: {\n position: 'absolute',\n bottom: 40,\n left: 0,\n right: 0,\n flexDirection: 'row',\n justifyContent: 'space-around',\n alignItems: 'center',\n paddingHorizontal: 40,\n zIndex: 1,\n },\n controlButton: {\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n width: 50,\n height: 50,\n borderRadius: 25,\n justifyContent: 'center',\n alignItems: 'center',\n },\n controlButtonText: {\n fontSize: 24,\n },\n captureButton: {\n backgroundColor: 'rgba(255, 255, 255, 0.3)',\n width: 80,\n height: 80,\n borderRadius: 40,\n justifyContent: 'center',\n alignItems: 'center',\n borderWidth: 3,\n borderColor: 'white',\n },\n captureButtonInner: {\n backgroundColor: 'white',\n width: 60,\n height: 60,\n borderRadius: 30,\n },\n captureButtonDisabled: {\n backgroundColor: 'rgba(255, 255, 255, 0.5)',\n },\n recordingButton: {\n backgroundColor: 'rgba(255, 59, 48, 0.3)',\n borderColor: '#FF3B30',\n },\n recordingButtonInner: {\n backgroundColor: '#FF3B30',\n },\n permissionMessage: {\n color: 'white',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n errorMessage: {\n color: 'red',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n bboxOverlay: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n pointerEvents: 'none',\n },\n bbox: {\n position: 'absolute',\n borderStyle: 'solid',\n backgroundColor: 'transparent',\n },\n}); "]}
1
+ {"version":3,"file":"EnhancedCameraView.web.js","sourceRoot":"","sources":["../../src/components/EnhancedCameraView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIlF,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,YAAY,GAAG,2DAA2D,EAC1E,UAAU,EACV,UAAU,EAAE,iBAAiB,GAAG,OAAO,EACvC,KAAK,EACL,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,MAAM,EAChB,iBAAiB,GAAG,IAAI,EACxB,gBAAgB,GAAG,IAAI,EACvB,gBAAgB,EAChB,IAAI,EACJ,OAAO,GAAG,IAAI,EACd,WAAW,GAAG,KAAK,EACnB,WAAW,GAAG,KAAK,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,GAAG,EAAE,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,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,EAAE;KACX;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,MAAM,EAAE,EAAE;KACX;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,aAAa,EAAE,MAAM;KACtB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,OAAO;QACpB,eAAe,EAAE,aAAa;KAC/B;CACF,CAAC,CAAC","sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { View, StyleSheet, TouchableOpacity, Text, Platform } from 'react-native';\nimport { EnhancedCameraViewProps } from './OverLay/type';\n\n\nexport const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({\n instructions = 'Position yourself in the frame and tap the capture button',\n showCamera,\n cameraType: initialCameraType = 'front',\n style,\n onCapture,\n onError,\n onClose,\n enableFlash = false,\n enableHdr = false,\n quality = 'high',\n showCaptureButton = true,\n showSwitchCamera = true,\n overlayComponent,\n bbox,\n canFlip = true,\n enableVideo = false,\n isRecording = false,\n onVideoRecordingStart,\n onVideoRecordingStop,\n videoDuration = 10,\n onSilentCapture,\n silentCaptureResult,\n}) => {\n // Vérification de plateforme - ce composant est uniquement pour le web\n if (Platform.OS !== 'web') {\n console.warn('EnhancedCameraView.web.tsx should only be used on web platform');\n return null;\n }\n const videoRef = useRef<HTMLVideoElement>(null);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const [cameraType, setCameraType] = useState<'front' | 'back'>(initialCameraType);\n const [hasPermission, setHasPermission] = useState(false);\n const [isInitialized, setIsInitialized] = useState(false);\n const [flash, setFlash] = useState<'off' | 'on' | 'auto'>('off');\n const [stream, setStream] = useState<MediaStream | null>(null);\n const [isRecordingVideo, setIsRecordingVideo] = useState(false);\n const [mediaRecorder, setMediaRecorder] = useState<MediaRecorder | null>(null);\n const [recordedChunks, setRecordedChunks] = useState<Blob[]>([]);\n\n console.log('cameraType', cameraType, recordedChunks);\n // Check permissions on component mount\n useEffect(() => {\n if (showCamera) {\n checkPermissions();\n }\n }, [showCamera]);\n\n // Cleanup stream on unmount\n useEffect(() => {\n return () => {\n if (stream) {\n stream.getTracks().forEach(track => track.stop());\n }\n };\n }, [stream]);\n\n const checkPermissions = async () => {\n try {\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n onError?.({ message: 'Camera not supported in this browser' });\n return;\n }\n\n // Test camera permission\n const stream = await navigator.mediaDevices.getUserMedia({ video: true });\n stream.getTracks().forEach(track => track.stop());\n\n setHasPermission(true);\n await startCamera();\n } catch (error) {\n console.error('Error checking permissions:', error);\n onError?.({ message: 'Camera permissions not granted' });\n }\n };\n\n const startCamera = async () => {\n try {\n if (stream) {\n stream.getTracks().forEach(track => track.stop());\n }\n\n const constraints = {\n video: {\n facingMode: cameraType === 'front' ? 'user' : 'environment',\n width: { ideal: quality === 'high' ? 1920 : quality === 'medium' ? 1280 : 640 },\n height: { ideal: quality === 'high' ? 1080 : quality === 'medium' ? 720 : 480 },\n },\n audio: enableVideo,\n };\n\n const newStream = await navigator.mediaDevices.getUserMedia(constraints);\n setStream(newStream);\n\n if (videoRef.current) {\n videoRef.current.srcObject = newStream;\n videoRef.current.onloadedmetadata = () => {\n setIsInitialized(true);\n };\n }\n } catch (error) {\n console.error('Error starting camera:', error);\n onError?.({ message: 'Failed to start camera' });\n }\n };\n\n const onInitialized = useCallback(() => {\n console.log('Camera initialized!');\n setIsInitialized(true);\n }, []);\n\n const onCameraError = useCallback((error: any) => {\n console.error('Camera error:', error);\n onError?.({ message: error.message || 'Camera error occurred' });\n }, [onError]);\n\n console.log('isInitialized', onInitialized, onCameraError);\n\n const capturePhoto = useCallback(async () => {\n try {\n onCapture && onCapture({\n success: true\n })\n } catch (error) {\n console.error('Error taking photo:', error);\n onCapture?.({\n success: false,\n error: error instanceof Error ? error.message : 'Failed to capture photo',\n });\n }\n }, [isInitialized, onCapture, onError]);\n\n\n const captureSilentPhoto = useCallback(async () => {\n try {\n if (!videoRef.current || !canvasRef.current || !isInitialized) {\n onError?.({ message: 'Camera not ready' });\n return;\n }\n\n const video = videoRef.current;\n const canvas = canvasRef.current;\n const context = canvas.getContext('2d');\n\n if (!context) {\n onError?.({ message: 'Canvas context not available' });\n return;\n }\n\n // Set canvas dimensions to match video\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n\n // Draw the current video frame to canvas\n context.drawImage(video, 0, 0);\n\n // Convert to base64\n const imageDataUrl = canvas.toDataURL('image/jpeg', 0.8);\n\n onSilentCapture?.({\n success: true,\n path: imageDataUrl,\n });\n } catch (error) {\n console.error('Error taking photo:', error);\n onCapture?.({\n success: false,\n error: error instanceof Error ? error.message : 'Failed to capture photo',\n });\n }\n }, [isInitialized, onError, onSilentCapture]);\n\n\n // Automatically take a silent photo every 5 seconds when ready\n useEffect(() => {\n if (!showCamera || !isInitialized) {\n return;\n }\n\n const intervalId = setInterval(() => {\n captureSilentPhoto();\n }, 5000);\n\n return () => clearInterval(intervalId);\n }, [showCamera, isInitialized, captureSilentPhoto]);\n\n const startVideoRecording = useCallback(async () => {\n try {\n if (!stream || !isInitialized) {\n onError?.({ message: 'Camera not ready' });\n return;\n }\n\n const chunks: Blob[] = [];\n setRecordedChunks(chunks);\n\n const recorder = new MediaRecorder(stream, {\n mimeType: 'video/webm;codecs=vp9',\n });\n\n recorder.ondataavailable = (event) => {\n if (event.data.size > 0) {\n chunks.push(event.data);\n }\n };\n\n recorder.onstop = () => {\n const blob = new Blob(chunks, { type: 'video/webm' });\n const url = URL.createObjectURL(blob);\n\n onVideoRecordingStop?.({\n success: true,\n path: url,\n });\n\n setRecordedChunks([]);\n setIsRecordingVideo(false);\n };\n\n recorder.onerror = (event) => {\n console.error('Recording error:', event);\n onVideoRecordingStop?.({\n success: false,\n error: 'Failed to record video',\n });\n setIsRecordingVideo(false);\n };\n\n setMediaRecorder(recorder);\n recorder.start();\n setIsRecordingVideo(true);\n onVideoRecordingStart?.();\n\n // Auto-stop after videoDuration seconds\n setTimeout(() => {\n if (recorder.state === 'recording') {\n recorder.stop();\n }\n }, videoDuration * 1000);\n\n } catch (error) {\n console.error('Error starting video recording:', error);\n onVideoRecordingStop?.({\n success: false,\n error: error instanceof Error ? error.message : 'Failed to start video recording',\n });\n }\n }, [isInitialized, stream, videoDuration, onVideoRecordingStart, onVideoRecordingStop, onError]);\n\n const stopVideoRecording = useCallback(async () => {\n try {\n if (mediaRecorder && mediaRecorder.state === 'recording') {\n mediaRecorder.stop();\n }\n } catch (error) {\n console.error('Error stopping video recording:', error);\n onError?.({ message: 'Failed to stop video recording' });\n }\n }, [mediaRecorder, onError]);\n\n const switchCamera = useCallback(async () => {\n setCameraType(current => current === 'front' ? 'back' : 'front');\n // Restart camera with new facing mode\n await startCamera();\n }, [cameraType]);\n\n const toggleFlash = useCallback(() => {\n setFlash(current => {\n switch (current) {\n case 'off': return 'on';\n case 'on': return 'auto';\n case 'auto': return 'off';\n default: return 'off';\n }\n });\n }, []);\n\n if (!hasPermission) {\n return (\n <View style={[styles.container, style]}>\n <Text style={styles.permissionMessage}>\n Camera permission required. Please grant permission to continue.\n </Text>\n </View>\n );\n }\n\n if (!showCamera) {\n return <View style={[styles.container, style]} />;\n }\n\n return (\n <View style={[styles.container, style]}>\n {/* Video element */}\n <video\n ref={videoRef}\n style={{\n position: 'absolute',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n }}\n autoPlay\n playsInline\n muted\n />\n\n {/* Hidden canvas for photo capture */}\n <canvas\n ref={canvasRef}\n style={{\n position: 'absolute',\n left: '-9999px',\n top: '-9999px',\n }}\n />\n\n {/* Instructions */}\n {/* {instructions && (\n <View style={styles.instructionsOverlay}>\n <Text style={styles.instructions}>{instructions}</Text>\n </View>\n )} */}\n\n {/* Custom overlay component */}\n {overlayComponent}\n\n {/* Bounding box overlay */}\n {bbox && (\n <View style={styles.bboxOverlay}>\n <View\n style={[\n styles.bbox,\n {\n left: `${bbox.xMin}%`,\n top: `${bbox.yMin}%`,\n width: `${bbox.xMax - bbox.xMin}%`,\n height: `${bbox.yMax - bbox.yMin}%`,\n borderColor: bbox.borderColor || '#2DBD60',\n borderWidth: bbox.borderWidth || 3,\n borderRadius: bbox.cornerRadius || 8,\n }\n ]}\n />\n </View>\n )}\n\n {/* Camera controls */}\n <View style={styles.controlsContainer}>\n {/* Flash button */}\n {enableFlash && (\n <TouchableOpacity style={styles.controlButton} onPress={toggleFlash}>\n <Text style={styles.controlButtonText}>\n {flash === 'off' ? '⚡' : flash === 'on' ? '⚡️' : '✨'}\n </Text>\n </TouchableOpacity>\n )}\n\n {/* Capture button */}\n {showCaptureButton && !enableVideo && silentCaptureResult?.success && (\n <TouchableOpacity\n style={styles.captureButton}\n onPress={capturePhoto}\n disabled={!isInitialized}\n >\n <View style={[\n styles.captureButtonInner,\n !isInitialized && styles.captureButtonDisabled\n ]} />\n </TouchableOpacity>\n )}\n\n {/* Video recording button */}\n {showCaptureButton && enableVideo && (\n <TouchableOpacity\n style={[\n styles.captureButton,\n isRecordingVideo && styles.recordingButton\n ]}\n onPress={isRecordingVideo ? stopVideoRecording : startVideoRecording}\n disabled={!isInitialized}\n >\n <View style={[\n styles.captureButtonInner,\n !isInitialized && styles.captureButtonDisabled,\n isRecordingVideo && styles.recordingButtonInner\n ]} />\n </TouchableOpacity>\n )}\n\n {/* Switch camera button */}\n {showSwitchCamera && canFlip && (\n <TouchableOpacity style={styles.controlButton} onPress={switchCamera}>\n <Text style={styles.controlButtonText}>🔄</Text>\n </TouchableOpacity>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n },\n instructionsOverlay: {\n position: 'absolute',\n top: 60,\n left: 20,\n right: 20,\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n padding: 15,\n borderRadius: 10,\n zIndex: 1,\n },\n instructions: {\n color: 'white',\n fontSize: 16,\n textAlign: 'center',\n fontWeight: '500',\n },\n closeButton: {\n position: 'absolute',\n top: 50,\n right: 20,\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n width: 40,\n height: 40,\n borderRadius: 20,\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: 2,\n },\n closeButtonText: {\n color: 'white',\n fontSize: 20,\n fontWeight: 'bold',\n },\n controlsContainer: {\n position: 'absolute',\n bottom: 40,\n left: 0,\n right: 0,\n flexDirection: 'row',\n justifyContent: 'space-around',\n alignItems: 'center',\n paddingHorizontal: 40,\n zIndex: 1,\n },\n controlButton: {\n backgroundColor: 'rgba(0, 0, 0, 0.7)',\n width: 50,\n height: 50,\n borderRadius: 25,\n justifyContent: 'center',\n alignItems: 'center',\n },\n controlButtonText: {\n fontSize: 24,\n },\n captureButton: {\n backgroundColor: 'rgba(255, 255, 255, 0.3)',\n width: 80,\n height: 80,\n borderRadius: 40,\n justifyContent: 'center',\n alignItems: 'center',\n borderWidth: 3,\n borderColor: 'white',\n },\n captureButtonInner: {\n backgroundColor: 'white',\n width: 60,\n height: 60,\n borderRadius: 30,\n },\n captureButtonDisabled: {\n backgroundColor: 'rgba(255, 255, 255, 0.5)',\n },\n recordingButton: {\n backgroundColor: 'rgba(255, 59, 48, 0.3)',\n borderColor: '#FF3B30',\n },\n recordingButtonInner: {\n backgroundColor: '#FF3B30',\n },\n permissionMessage: {\n color: 'white',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n errorMessage: {\n color: 'red',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n bboxOverlay: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n pointerEvents: 'none',\n },\n bbox: {\n position: 'absolute',\n borderStyle: 'solid',\n backgroundColor: 'transparent',\n },\n}); "]}
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { TemplateComponent } from '../../types/KYC.types';
2
+ import { TemplateComponent, Country } from '../../types/KYC.types';
3
3
  interface CountrySelectionTemplateProps {
4
4
  component: TemplateComponent;
5
5
  value?: string;
6
- onValueChange: (value: string) => void;
6
+ onValueChange: (value: Country) => void;
7
7
  error?: string;
8
8
  language?: string;
9
9
  }