@sanctum-key/react-native-sdk 1.0.6 → 1.0.8

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 (206) hide show
  1. package/README.md +3 -3
  2. package/android/build/.transforms/{f62cb96b2d1f78ca96ab35932dd530dc → c9d62bb333688ab562f51958998d5a48}/transformed/classes/classes_dex/classes.dex +0 -0
  3. package/android/build/generated/source/buildConfig/debug/kyc/{transfergratis → SanctumKey}/com/BuildConfig.java +2 -2
  4. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +1 -1
  5. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +1 -1
  6. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  7. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  8. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +2 -2
  9. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/kyc/SanctumKey/com/BuildConfig.class +0 -0
  10. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +1 -1
  11. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +1 -1
  12. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  13. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -1
  14. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  15. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  16. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  17. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  18. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  19. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  20. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  21. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  22. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  23. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  24. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  25. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  26. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  27. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  28. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  29. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  30. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  31. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  32. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  33. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  34. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  35. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  36. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  37. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  38. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  39. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  40. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  43. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  44. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  45. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  46. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  48. package/android/build/outputs/logs/manifest-merger-debug-report.txt +1 -1
  49. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  50. package/android/build/tmp/kotlin-classes/debug/kyc/SanctumKey/com/SanctumKeySdkModule$definition$1$5$1.class +0 -0
  51. package/android/build/tmp/kotlin-classes/debug/kyc/SanctumKey/com/SanctumKeySdkModule$definition$1$5$2.class +0 -0
  52. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$1.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$1.class} +0 -0
  53. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$2.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$2.class} +0 -0
  54. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$3.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$3.class} +0 -0
  55. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$4.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$4.class} +0 -0
  56. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$5.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$5.class} +0 -0
  57. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$6.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$6.class} +0 -0
  58. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$1.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$1.class} +0 -0
  59. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$2.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$2.class} +0 -0
  60. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$3.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$3.class} +0 -0
  61. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$4.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$4.class} +0 -0
  62. package/android/build/tmp/kotlin-classes/debug/kyc/SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$View$1.class +0 -0
  63. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$lambda$4$$inlined$Prop$1.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$lambda$4$$inlined$Prop$1.class} +0 -0
  64. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$lambda$4$$inlined$Prop$2.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$lambda$4$$inlined$Prop$2.class} +0 -0
  65. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule.class → SanctumKey/com/SanctumKeySdkModule.class} +0 -0
  66. package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkView.class → SanctumKey/com/SanctumKeySdkView.class} +0 -0
  67. package/android/build.gradle +2 -2
  68. package/android/src/main/AndroidManifest.xml +1 -1
  69. package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkModule.kt +6 -6
  70. package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkView.kt +2 -2
  71. package/build/package.json +9 -7
  72. package/build/src/App.d.ts +2 -2
  73. package/build/src/App.d.ts.map +1 -1
  74. package/build/src/App.js +2 -2
  75. package/build/src/App.js.map +1 -1
  76. package/build/src/{TransfergratisSdk.types.d.ts → SanctumKeySdk.types.d.ts} +3 -3
  77. package/build/src/SanctumKeySdk.types.d.ts.map +1 -0
  78. package/build/src/SanctumKeySdk.types.js +2 -0
  79. package/build/src/SanctumKeySdk.types.js.map +1 -0
  80. package/build/src/{TransfergratisSdkModule.d.ts → SanctumKeySdkModule.d.ts} +4 -4
  81. package/build/src/SanctumKeySdkModule.d.ts.map +1 -0
  82. package/build/src/{TransfergratisSdkModule.js → SanctumKeySdkModule.js} +2 -2
  83. package/build/src/SanctumKeySdkModule.js.map +1 -0
  84. package/build/src/{TransfergratisSdkModule.web.d.ts → SanctumKeySdkModule.web.d.ts} +4 -4
  85. package/build/src/SanctumKeySdkModule.web.d.ts.map +1 -0
  86. package/build/src/{TransfergratisSdkModule.web.js → SanctumKeySdkModule.web.js} +3 -3
  87. package/build/src/SanctumKeySdkModule.web.js.map +1 -0
  88. package/build/src/SanctumKeySdkView.d.ts +4 -0
  89. package/build/src/SanctumKeySdkView.d.ts.map +1 -0
  90. package/build/src/SanctumKeySdkView.js +7 -0
  91. package/build/src/SanctumKeySdkView.js.map +1 -0
  92. package/build/src/SanctumKeySdkView.web.d.ts +4 -0
  93. package/build/src/SanctumKeySdkView.web.d.ts.map +1 -0
  94. package/build/src/{TransfergratisSdkView.web.js → SanctumKeySdkView.web.js} +2 -2
  95. package/build/src/SanctumKeySdkView.web.js.map +1 -0
  96. package/build/src/api/axios.js +2 -2
  97. package/build/src/api/axios.js.map +1 -1
  98. package/build/src/components/EnhancedCameraView.d.ts.map +1 -1
  99. package/build/src/components/EnhancedCameraView.js +107 -330
  100. package/build/src/components/EnhancedCameraView.js.map +1 -1
  101. package/build/src/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -1
  102. package/build/src/components/KYCElements/EmailVerificationTemplate.js +114 -15
  103. package/build/src/components/KYCElements/EmailVerificationTemplate.js.map +1 -1
  104. package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
  105. package/build/src/components/KYCElements/IDCardCapture.js +166 -695
  106. package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
  107. package/build/src/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -1
  108. package/build/src/components/KYCElements/PhoneVerificationTemplate.js +282 -40
  109. package/build/src/components/KYCElements/PhoneVerificationTemplate.js.map +1 -1
  110. package/build/src/components/KYCElements/SelfieCapture.d.ts +1 -1
  111. package/build/src/components/KYCElements/SelfieCapture.d.ts.map +1 -1
  112. package/build/src/components/KYCElements/SelfieCapture.js +130 -192
  113. package/build/src/components/KYCElements/SelfieCapture.js.map +1 -1
  114. package/build/src/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
  115. package/build/src/components/KYCElements/SelfieCaptureTemplate.js +131 -433
  116. package/build/src/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
  117. package/build/src/components/NativeCameraView.js +1 -1
  118. package/build/src/components/NativeCameraView.js.map +1 -1
  119. package/build/src/components/OverLay/IdCard.d.ts +3 -2
  120. package/build/src/components/OverLay/IdCard.d.ts.map +1 -1
  121. package/build/src/components/OverLay/IdCard.js +149 -141
  122. package/build/src/components/OverLay/IdCard.js.map +1 -1
  123. package/build/src/components/OverLay/SelfieOverlay.d.ts +2 -1
  124. package/build/src/components/OverLay/SelfieOverlay.d.ts.map +1 -1
  125. package/build/src/components/OverLay/SelfieOverlay.js +37 -95
  126. package/build/src/components/OverLay/SelfieOverlay.js.map +1 -1
  127. package/build/src/components/OverLay/type.d.ts +1 -0
  128. package/build/src/components/OverLay/type.d.ts.map +1 -1
  129. package/build/src/components/OverLay/type.js.map +1 -1
  130. package/build/src/components/Svgs/scanningLine.d.ts +2 -1
  131. package/build/src/components/Svgs/scanningLine.d.ts.map +1 -1
  132. package/build/src/components/Svgs/scanningLine.js +55 -51
  133. package/build/src/components/Svgs/scanningLine.js.map +1 -1
  134. package/build/src/config/KYCConfig.js +1 -1
  135. package/build/src/config/KYCConfig.js.map +1 -1
  136. package/build/src/config/allowedDomains.js +6 -6
  137. package/build/src/config/allowedDomains.js.map +1 -1
  138. package/build/src/hooks/useTemplateKYCFlow.d.ts.map +1 -1
  139. package/build/src/hooks/useTemplateKYCFlow.js +37 -38
  140. package/build/src/hooks/useTemplateKYCFlow.js.map +1 -1
  141. package/build/src/index.d.ts +3 -3
  142. package/build/src/index.d.ts.map +1 -1
  143. package/build/src/index.js +3 -3
  144. package/build/src/index.js.map +1 -1
  145. package/build/src/modules/api/CardAuthentification.d.ts +0 -5
  146. package/build/src/modules/api/CardAuthentification.d.ts.map +1 -1
  147. package/build/src/modules/api/CardAuthentification.js +114 -116
  148. package/build/src/modules/api/CardAuthentification.js.map +1 -1
  149. package/build/src/modules/api/KYCService.d.ts +12 -1
  150. package/build/src/modules/api/KYCService.d.ts.map +1 -1
  151. package/build/src/modules/api/KYCService.js +102 -38
  152. package/build/src/modules/api/KYCService.js.map +1 -1
  153. package/build/src/modules/camera/NativeCameraModule.js +17 -17
  154. package/build/src/modules/camera/NativeCameraModule.js.map +1 -1
  155. package/expo-module.config.json +2 -2
  156. package/ios/TransfergratisSdk.podspec +2 -2
  157. package/ios/TransfergratisSdkModule.swift +12 -12
  158. package/package.json +9 -7
  159. package/src/App.tsx +2 -2
  160. package/src/{TransfergratisSdk.types.ts → SanctumKeySdk.types.ts} +2 -2
  161. package/src/{TransfergratisSdkModule.ts → SanctumKeySdkModule.ts} +3 -3
  162. package/src/{TransfergratisSdkModule.web.ts → SanctumKeySdkModule.web.ts} +3 -3
  163. package/src/SanctumKeySdkView.tsx +11 -0
  164. package/src/{TransfergratisSdkView.web.tsx → SanctumKeySdkView.web.tsx} +2 -2
  165. package/src/api/axios.ts +2 -2
  166. package/src/components/EnhancedCameraView.tsx +131 -385
  167. package/src/components/KYCElements/EmailVerificationTemplate.tsx +141 -26
  168. package/src/components/KYCElements/IDCardCapture.tsx +228 -868
  169. package/src/components/KYCElements/PhoneVerificationTemplate.tsx +342 -60
  170. package/src/components/KYCElements/SelfieCapture.tsx +184 -213
  171. package/src/components/KYCElements/SelfieCaptureTemplate.tsx +330 -662
  172. package/src/components/NativeCameraView.tsx +1 -1
  173. package/src/components/OverLay/IdCard.tsx +218 -217
  174. package/src/components/OverLay/SelfieOverlay.tsx +56 -134
  175. package/src/components/OverLay/type.ts +1 -0
  176. package/src/components/Svgs/scanningLine.tsx +71 -72
  177. package/src/config/KYCConfig.ts +1 -1
  178. package/src/config/allowedDomains.ts +6 -6
  179. package/src/hooks/useTemplateKYCFlow.tsx +45 -39
  180. package/src/i18n/README.md +1 -1
  181. package/src/index.ts +3 -3
  182. package/src/modules/api/CardAuthentification.ts +202 -200
  183. package/src/modules/api/KYCService.ts +169 -53
  184. package/src/modules/camera/NativeCameraModule.ts +17 -17
  185. package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$1.class +0 -0
  186. package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$2.class +0 -0
  187. package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$View$1.class +0 -0
  188. package/build/src/TransfergratisSdk.types.d.ts.map +0 -1
  189. package/build/src/TransfergratisSdk.types.js +0 -2
  190. package/build/src/TransfergratisSdk.types.js.map +0 -1
  191. package/build/src/TransfergratisSdkModule.d.ts.map +0 -1
  192. package/build/src/TransfergratisSdkModule.js.map +0 -1
  193. package/build/src/TransfergratisSdkModule.web.d.ts.map +0 -1
  194. package/build/src/TransfergratisSdkModule.web.js.map +0 -1
  195. package/build/src/TransfergratisSdkView.d.ts +0 -4
  196. package/build/src/TransfergratisSdkView.d.ts.map +0 -1
  197. package/build/src/TransfergratisSdkView.js +0 -7
  198. package/build/src/TransfergratisSdkView.js.map +0 -1
  199. package/build/src/TransfergratisSdkView.web.d.ts +0 -4
  200. package/build/src/TransfergratisSdkView.web.d.ts.map +0 -1
  201. package/build/src/TransfergratisSdkView.web.js.map +0 -1
  202. package/src/TransfergratisSdkView.tsx +0 -11
  203. /package/android/build/.transforms/{532c0e65d82f446633d0a7dab2772198 → ab90740579f5bd05b27b4343ada2d1c9}/results.bin +0 -0
  204. /package/android/build/.transforms/{532c0e65d82f446633d0a7dab2772198 → ab90740579f5bd05b27b4343ada2d1c9}/transformed/classes/classes_dex/classes.dex +0 -0
  205. /package/android/build/.transforms/{f62cb96b2d1f78ca96ab35932dd530dc → c9d62bb333688ab562f51958998d5a48}/results.bin +0 -0
  206. /package/android/build/{intermediates/javac/debug/compileDebugJavaWithJavac/classes/kyc/transfergratis/com/BuildConfig.class → tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BuildConfig.class.uniqueId0} +0 -0
@@ -81,12 +81,12 @@ export class HttpClient {
81
81
  export default HttpClient;
82
82
  // ml service api
83
83
  export const mlService = new HttpClient({
84
- baseURL: 'https://api.ml.transfergratis.com',
84
+ baseURL: 'https://api.ml.SanctumKey.com',
85
85
  apiKey: 'your-api-key',
86
86
  });
87
87
  // backedn service api
88
88
  export const backendService = new HttpClient({
89
- baseURL: 'https://api.backend.transfergratis.com',
89
+ baseURL: 'https://api.backend.SanctumKey.com',
90
90
  apiKey: 'your-api-key',
91
91
  });
92
92
  //# sourceMappingURL=axios.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../src/api/axios.ts"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAef,MAAM,OAAO,UAAU;IACX,QAAQ,CAAgB;IACxB,MAAM,CAAU;IAChB,SAAS,CAAU;IAE3B,YAAY,aAA+B;QACvC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,aAAa,CAAC,OAAO;YAC9B,OAAO,EAAE,aAAa,CAAC,SAAS,IAAI,KAAK;YACzC,OAAO,E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AAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAI,GAAG,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QACnE,OAAO,GAAG,CAAC,IAAS,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,MAAM,CAAc,GAAW,EAAE,aAAkC;QACrE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAI,GAAG,EAAE,aAAa,CAAC,CAAC;QAC9D,OAAO,GAAG,CAAC,IAAS,CAAC;IACzB,CAAC;CACJ;AAED,eAAe,UAAU,CAAC;AAG1B,iBAAiB;AACjB,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC;IACpC,OAAO,EAAE,mCAAmC;IAC5C,MAAM,EAAE,cAAc;CACzB,CAAC,CAAC;AACH,sBAAsB;AACtB,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,UAAU,CAAC;IACzC,OAAO,EAAE,wCAAwC;IACjD,MAAM,EAAE,cAAc;CACzB,CAAC,CAAC","sourcesContent":["import axios, {\n AxiosInstance,\n AxiosRequestConfig,\n InternalAxiosRequestConfig,\n AxiosResponse,\n} from 'axios';\n\nexport type ApiConfiguration = {\n baseURL: string;\n apiKey?: string;\n authToken?: string;\n timeoutMs?: number;\n};\n\nexport type ApiErrorData = {\n message?: string;\n code?: string | number;\n details?: unknown;\n};\n\nexport class HttpClient {\n private instance: AxiosInstance;\n private apiKey?: string;\n private authToken?: string;\n\n constructor(configuration: ApiConfiguration) {\n this.apiKey = configuration.apiKey;\n this.authToken = configuration.authToken;\n this.instance = axios.create({\n baseURL: configuration.baseURL,\n timeout: configuration.timeoutMs ?? 15000,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n });\n\n this.instance.interceptors.request.use(\n (request: InternalAxiosRequestConfig) => {\n const headers = request.headers ?? {};\n if (this.apiKey && !headers['x-api-key']) {\n headers['x-api-key'] = this.apiKey;\n }\n if (this.authToken && !headers.Authorization) {\n headers.Authorization = `Bearer ${this.authToken}`;\n }\n request.headers = headers;\n return request;\n },\n (error) => Promise.reject(error)\n );\n\n this.instance.interceptors.response.use(\n (response: AxiosResponse) => response,\n (error) => {\n if (!error.response) {\n return Promise.reject({\n message: 'Network error. Please check your connection.',\n code: 'network_error',\n details: error?.message,\n } as ApiErrorData);\n }\n const { status, data } = error.response as AxiosResponse<ApiErrorData>;\n if (status === 401) {\n return Promise.reject({\n message: data?.message || 'Unauthorized',\n code: 401,\n details: data,\n } as ApiErrorData);\n }\n return Promise.reject({\n message: data?.message || 'Request failed',\n code: status,\n details: data,\n } as ApiErrorData);\n }\n );\n }\n\n setAuthToken(token?: string): void {\n this.authToken = token;\n }\n\n setApiKey(key?: string): void {\n this.apiKey = key;\n }\n\n setBaseURL(url: string): void {\n this.instance.defaults.baseURL = url;\n }\n\n async get<T = unknown>(url: string, requestConfig?: AxiosRequestConfig): Promise<T> {\n const res = await this.instance.get<T>(url, requestConfig);\n return res.data as T;\n }\n\n async post<T = unknown, B = unknown>(\n url: string,\n body?: B,\n requestConfig?: AxiosRequestConfig\n ): Promise<T> {\n const res = await this.instance.post<T>(url, body, requestConfig);\n return res.data as T;\n }\n\n async put<T = unknown, B = unknown>(\n url: string,\n body?: B,\n requestConfig?: AxiosRequestConfig\n ): Promise<T> {\n const res = await this.instance.put<T>(url, body, requestConfig);\n return res.data as T;\n }\n\n async patch<T = unknown, B = unknown>(\n url: string,\n body?: B,\n requestConfig?: AxiosRequestConfig\n ): Promise<T> {\n const res = await this.instance.patch<T>(url, body, requestConfig);\n return res.data as T;\n }\n\n async delete<T = unknown>(url: string, requestConfig?: AxiosRequestConfig): Promise<T> {\n const res = await this.instance.delete<T>(url, requestConfig);\n return res.data as T;\n }\n}\n\nexport default HttpClient;\n\n\n// ml service api\nexport const mlService = new HttpClient({\n baseURL: 'https://api.ml.transfergratis.com',\n apiKey: 'your-api-key',\n});\n// backedn service api\nexport const backendService = new HttpClient({\n baseURL: 'https://api.backend.transfergratis.com',\n apiKey: 'your-api-key',\n});\n\n\n"]}
1
+ {"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../src/api/axios.ts"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAef,MAAM,OAAO,UAAU;IACX,QAAQ,CAAgB;IACxB,MAAM,CAAU;IAChB,SAAS,CAAU;IAE3B,YAAY,aAA+B;QACvC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,aAAa,CAAC,OAAO;YAC9B,OAAO,EAAE,aAAa,CAAC,SAAS,IAAI,KAAK;YACzC,OAAO,EAAE;gBACL,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACrC;SACJ,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAClC,CAAC,OAAmC,EAAE,EAAE;YACpC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;YACtC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACvC,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;YACvC,CAAC;YACD,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC3C,OAAO,CAAC,aAAa,GAAG,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC;YACvD,CAAC;YACD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;YAC1B,OAAO,OAAO,CAAC;QACnB,CAAC,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CACnC,CAAC;QAEF,IAAI,CAAC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osResponse,\n} from 'axios';\n\nexport type ApiConfiguration = {\n baseURL: string;\n apiKey?: string;\n authToken?: string;\n timeoutMs?: number;\n};\n\nexport type ApiErrorData = {\n message?: string;\n code?: string | number;\n details?: unknown;\n};\n\nexport class HttpClient {\n private instance: AxiosInstance;\n private apiKey?: string;\n private authToken?: string;\n\n constructor(configuration: ApiConfiguration) {\n this.apiKey = configuration.apiKey;\n this.authToken = configuration.authToken;\n this.instance = axios.create({\n baseURL: configuration.baseURL,\n timeout: configuration.timeoutMs ?? 15000,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n });\n\n this.instance.interceptors.request.use(\n (request: InternalAxiosRequestConfig) => {\n const headers = request.headers ?? {};\n if (this.apiKey && !headers['x-api-key']) {\n headers['x-api-key'] = this.apiKey;\n }\n if (this.authToken && !headers.Authorization) {\n headers.Authorization = `Bearer ${this.authToken}`;\n }\n request.headers = headers;\n return request;\n },\n (error) => Promise.reject(error)\n );\n\n this.instance.interceptors.response.use(\n (response: AxiosResponse) => response,\n (error) => {\n if (!error.response) {\n return Promise.reject({\n message: 'Network error. Please check your connection.',\n code: 'network_error',\n details: error?.message,\n } as ApiErrorData);\n }\n const { status, data } = error.response as AxiosResponse<ApiErrorData>;\n if (status === 401) {\n return Promise.reject({\n message: data?.message || 'Unauthorized',\n code: 401,\n details: data,\n } as ApiErrorData);\n }\n return Promise.reject({\n message: data?.message || 'Request failed',\n code: status,\n details: data,\n } as ApiErrorData);\n }\n );\n }\n\n setAuthToken(token?: string): void {\n this.authToken = token;\n }\n\n setApiKey(key?: string): void {\n this.apiKey = key;\n }\n\n setBaseURL(url: string): void {\n this.instance.defaults.baseURL = url;\n }\n\n async get<T = unknown>(url: string, requestConfig?: AxiosRequestConfig): Promise<T> {\n const res = await this.instance.get<T>(url, requestConfig);\n return res.data as T;\n }\n\n async post<T = unknown, B = unknown>(\n url: string,\n body?: B,\n requestConfig?: AxiosRequestConfig\n ): Promise<T> {\n const res = await this.instance.post<T>(url, body, requestConfig);\n return res.data as T;\n }\n\n async put<T = unknown, B = unknown>(\n url: string,\n body?: B,\n requestConfig?: AxiosRequestConfig\n ): Promise<T> {\n const res = await this.instance.put<T>(url, body, requestConfig);\n return res.data as T;\n }\n\n async patch<T = unknown, B = unknown>(\n url: string,\n body?: B,\n requestConfig?: AxiosRequestConfig\n ): Promise<T> {\n const res = await this.instance.patch<T>(url, body, requestConfig);\n return res.data as T;\n }\n\n async delete<T = unknown>(url: string, requestConfig?: AxiosRequestConfig): Promise<T> {\n const res = await this.instance.delete<T>(url, requestConfig);\n return res.data as T;\n }\n}\n\nexport default HttpClient;\n\n\n// ml service api\nexport const mlService = new HttpClient({\n baseURL: 'https://api.ml.SanctumKey.com',\n apiKey: 'your-api-key',\n});\n// backedn service api\nexport const backendService = new HttpClient({\n baseURL: 'https://api.backend.SanctumKey.com',\n apiKey: 'your-api-key',\n});\n\n\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedCameraView.d.ts","sourceRoot":"","sources":["../../../src/components/EnhancedCameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAKjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAMzD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAqWhE,CAAC"}
1
+ {"version":3,"file":"EnhancedCameraView.d.ts","sourceRoot":"","sources":["../../../src/components/EnhancedCameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6MhE,CAAC"}
@@ -1,51 +1,31 @@
1
- import React, { useCallback, useEffect, useRef, useState, useMemo } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Text } from 'react-native';
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { View, StyleSheet, Text, AppState, ActivityIndicator } from 'react-native';
3
3
  import { Camera, useCameraDevice } from 'react-native-vision-camera';
4
4
  import VisionCameraModule from '../modules/camera/VisionCameraModule';
5
5
  import { useI18n } from '../hooks/useI18n';
6
6
  import { Button } from './ui/Button';
7
- export const EnhancedCameraView = ({ 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
+ export const EnhancedCameraView = ({ showCamera, cameraType: initialCameraType = 'front', style, onError, onSilentCapture, silentCaptureResult, isProcessing = false, overlayComponent, }) => {
8
8
  const { t } = useI18n();
9
9
  const camera = useRef(null);
10
- const [cameraType, setCameraType] = useState(initialCameraType);
11
- const [hasPermission, setHasPermission] = useState(false);
10
+ const isCapturingRef = useRef(false);
11
+ const isProcessingRef = useRef(isProcessing);
12
+ const [cameraType] = useState(initialCameraType);
13
+ const [hasPermission, setHasPermission] = useState(null);
12
14
  const [isInitialized, setIsInitialized] = useState(false);
13
- const [flash, setFlash] = useState('off');
14
15
  const [refreshCamera, setRefreshCamera] = useState(false);
16
+ // 🚨 ADDED: A timeout state to show a refresh button if the camera gets stuck booting
17
+ const [showInitTimeout, setShowInitTimeout] = useState(false);
15
18
  const device = useCameraDevice(cameraType);
16
- console.log({ setCameraType, setFlash });
17
- // Sélectionner le meilleur format disponible pour une qualité maximale
18
- // Prioriser les formats avec une bonne résolution vidéo (pour la prévisualisation) ET photo (pour la capture)
19
- const bestFormat = useMemo(() => {
20
- if (!device || !device.formats || device.formats.length === 0) {
21
- return undefined;
22
- }
23
- // Trier les formats en combinant la résolution vidéo (pour la prévisualisation) et photo (pour la capture)
24
- // On priorise les formats avec une bonne résolution vidéo car c'est ce qui est affiché en temps réel
25
- const sortedFormats = [...device.formats].sort((a, b) => {
26
- // Résolution vidéo (pour la prévisualisation live)
27
- const videoResolutionA = (a.videoWidth || 0) * (a.videoHeight || 0);
28
- const videoResolutionB = (b.videoWidth || 0) * (b.videoHeight || 0);
29
- // Résolution photo (pour la capture)
30
- const photoResolutionA = (a.photoWidth || 0) * (a.photoHeight || 0);
31
- const photoResolutionB = (b.photoWidth || 0) * (b.photoHeight || 0);
32
- // Prioriser d'abord la résolution vidéo (prévisualisation), puis la résolution photo
33
- if (videoResolutionB !== videoResolutionA) {
34
- return videoResolutionB - videoResolutionA;
35
- }
36
- return photoResolutionB - photoResolutionA;
37
- });
38
- return sortedFormats[0];
39
- }, [device]);
19
+ useEffect(() => {
20
+ isProcessingRef.current = isProcessing;
21
+ }, [isProcessing]);
40
22
  const checkPermissions = async () => {
41
23
  try {
42
24
  const hasAllPermissions = await VisionCameraModule.hasAllPermissions();
43
- console.log('hasAllPermissions', hasAllPermissions);
44
25
  if (!hasAllPermissions) {
45
26
  const granted = await VisionCameraModule.requestAllPermissions();
46
- console.log('granted', granted);
47
27
  if (!granted) {
48
- console.log('permissionRequired', t('camera.permissionRequired'));
28
+ setHasPermission(false);
49
29
  onError?.({ message: t('camera.permissionRequired') });
50
30
  return;
51
31
  }
@@ -53,341 +33,138 @@ export const EnhancedCameraView = ({ showCamera, cameraType: initialCameraType =
53
33
  setHasPermission(true);
54
34
  }
55
35
  catch (error) {
56
- console.error('Error checking permissions:', error);
36
+ setHasPermission(false);
57
37
  onError?.({ message: t('camera.errorOccurred') });
58
38
  }
59
39
  };
60
- // Check permissions on component mount
61
40
  useEffect(() => {
62
41
  if (showCamera) {
42
+ setIsInitialized(false); // Reset init state when checking permissions/refreshing
63
43
  checkPermissions();
64
44
  }
65
45
  }, [showCamera, refreshCamera]);
46
+ useEffect(() => {
47
+ const subscription = AppState.addEventListener('change', nextAppState => {
48
+ if (nextAppState === 'active' && showCamera && hasPermission === false) {
49
+ checkPermissions();
50
+ }
51
+ });
52
+ return () => subscription.remove();
53
+ }, [showCamera, hasPermission]);
54
+ useEffect(() => {
55
+ let timer;
56
+ if (hasPermission && device && showCamera && !isInitialized) {
57
+ timer = setTimeout(() => setShowInitTimeout(true), 3000);
58
+ }
59
+ else {
60
+ setShowInitTimeout(false);
61
+ }
62
+ return () => {
63
+ if (timer)
64
+ clearTimeout(timer);
65
+ };
66
+ }, [hasPermission, device, showCamera, isInitialized]);
66
67
  const onInitialized = useCallback(() => {
67
- console.log('Camera initialized!');
68
68
  setIsInitialized(true);
69
+ setShowInitTimeout(false);
69
70
  }, []);
70
71
  const onCameraError = useCallback((error) => {
71
- console.error('Camera error:', error);
72
72
  onError?.({ message: error.message || t('camera.errorOccurred') });
73
73
  }, [onError, t]);
74
74
  const captureSilentPhoto = useCallback(async () => {
75
- if (!camera.current || !isInitialized) {
76
- onError?.({ message: t('camera.notReady') });
75
+ if (!camera.current || !isInitialized || isProcessingRef.current || isCapturingRef.current)
77
76
  return;
78
- }
79
- console.log('silentCaptureResult', silentCaptureResult);
80
- if (silentCaptureResult?.isAnalyzing || silentCaptureResult?.success) {
77
+ if (silentCaptureResult?.isAnalyzing)
81
78
  return;
82
- }
83
79
  try {
80
+ isCapturingRef.current = true;
84
81
  const photo = await camera.current.takePhoto({
85
- enableShutterSound: true,
86
- flash: enableFlash ? flash : 'off',
82
+ enableShutterSound: false,
83
+ flash: 'off',
87
84
  });
88
85
  const result = await VisionCameraModule.processPhotoResult(photo);
89
- onSilentCapture?.(result);
90
- }
91
- catch (error) {
92
- }
93
- }, [isInitialized, onError, onSilentCapture, enableFlash, flash, silentCaptureResult]);
94
- // Automatically take a silent photo every 5 seconds when ready
95
- useEffect(() => {
96
- if (!showCamera || !isInitialized) {
97
- return;
98
- }
99
- const intervalId = setInterval(() => {
100
- captureSilentPhoto();
101
- }, 2500);
102
- return () => clearInterval(intervalId);
103
- }, [showCamera, isInitialized, captureSilentPhoto]);
104
- const capturePhoto = useCallback(async () => {
105
- try {
106
- if (!camera.current || !isInitialized) {
107
- onError?.({ message: t('camera.notReady') });
108
- return;
109
- }
110
- if (silentCaptureResult?.success) {
111
- onCapture?.({
112
- success: true,
113
- path: silentCaptureResult.path,
114
- });
115
- return;
116
- }
117
- const photo = await camera.current.takePhoto({
118
- enableShutterSound: true,
119
- flash: enableFlash ? flash : 'off',
86
+ onSilentCapture?.({
87
+ ...result,
88
+ path: result.path || photo.path,
120
89
  });
121
- const result = await VisionCameraModule.processPhotoResult(photo);
122
- onCapture?.(result);
123
90
  }
124
91
  catch (error) {
125
- console.error('Error taking photo:', error);
126
- onCapture?.({
127
- success: false,
128
- error: error instanceof Error ? error.message : t('camera.failedToCapture'),
129
- });
130
- }
131
- }, [isInitialized, quality, flash, enableFlash, onCapture, onError]);
132
- const startVideoRecording = useCallback(async () => {
133
- try {
134
- if (!camera.current || !isInitialized) {
135
- onError?.({ message: t('camera.notReady') });
136
- return;
137
- }
138
- await camera.current.startRecording({
139
- onRecordingFinished: (video) => {
140
- onVideoRecordingStop?.({
141
- success: true,
142
- path: video.path,
143
- });
144
- },
145
- onRecordingError: (error) => {
146
- console.error('Recording error:', error);
147
- onVideoRecordingStop?.({
148
- success: false,
149
- error: error.message || t('camera.failedToStartRecording'),
150
- });
151
- },
152
- });
153
- onVideoRecordingStart?.();
92
+ // Silent background fail
154
93
  }
155
- catch (error) {
156
- console.error('Error starting video recording:', error);
157
- onVideoRecordingStop?.({
158
- success: false,
159
- error: error instanceof Error ? error.message : t('camera.failedToStartRecording'),
160
- });
94
+ finally {
95
+ isCapturingRef.current = false;
161
96
  }
162
- }, [isInitialized, onVideoRecordingStart, onVideoRecordingStop, onError]);
163
- const stopVideoRecording = useCallback(async () => {
164
- try {
165
- if (!camera.current) {
166
- onError?.({ message: t('camera.notReady') });
97
+ }, [isInitialized, onSilentCapture, silentCaptureResult]);
98
+ useEffect(() => {
99
+ if (!showCamera || !isInitialized || isProcessing)
100
+ return;
101
+ let isActive = true;
102
+ let intervalId;
103
+ const warmupTimer = setTimeout(() => {
104
+ if (!isActive)
167
105
  return;
168
- }
169
- await camera.current.stopRecording();
170
- }
171
- catch (error) {
172
- console.error('Error stopping video recording:', error);
173
- onError?.({ message: t('camera.failedToStopRecording') });
174
- }
175
- }, [onError]);
176
- // const switchCamera = useCallback(() => {
177
- // setCameraType(current => current === 'front' ? 'back' : 'front');
178
- // }, []);
179
- // const toggleFlash = useCallback(() => {
180
- // setFlash(current => {
181
- // switch (current) {
182
- // case 'off': return 'on';
183
- // case 'on': return 'auto';
184
- // case 'auto': return 'off';
185
- // default: return 'off';
186
- // }
187
- // });
188
- // }, []);
189
- if (!hasPermission) {
190
- return (<View style={[styles.container, style]}>
191
- <Text style={styles.permissionMessage}>
192
- {t('camera.permissionRequired')}
193
- </Text>
194
- <Button title="Refresh Camera" onPress={() => setRefreshCamera(!refreshCamera)}/>
195
- </View>);
106
+ intervalId = setInterval(() => {
107
+ captureSilentPhoto();
108
+ }, 1500);
109
+ }, 1000);
110
+ return () => {
111
+ isActive = false;
112
+ clearTimeout(warmupTimer);
113
+ if (intervalId)
114
+ clearInterval(intervalId);
115
+ };
116
+ }, [showCamera, isInitialized, isProcessing, captureSilentPhoto]);
117
+ // --- RENDERERS ---
118
+ if (hasPermission === null) {
119
+ return <View style={[styles.container, style]}/>;
196
120
  }
197
- if (!device) {
198
- return (<View style={[styles.container, style]}>
199
- <Text style={styles.errorMessage}>
200
- {t('camera.deviceNotAvailable')}
201
- </Text>
121
+ if (hasPermission === false) {
122
+ return (<View style={[styles.container, style, styles.centerContent]}>
123
+ <Text style={styles.permissionMessage}>{t('camera.permissionRequired')}</Text>
124
+ <Button title="Refresh Camera" onPress={() => setRefreshCamera(prev => !prev)} variant="primary"/>
202
125
  </View>);
203
126
  }
204
- if (!showCamera) {
205
- return <View style={[styles.container, style]}/>;
127
+ // 🚨 FIX: Don't return an invisible blank screen if the device is loading!
128
+ // Give them a UI and a way out.
129
+ if (!device || !showCamera) {
130
+ return (<View style={[styles.container, style, styles.centerContent]}>
131
+ <ActivityIndicator size="large" color="#2DBD60" style={{ marginBottom: 16 }}/>
132
+ <Text style={styles.permissionMessage}>Loading Camera Hardware...</Text>
133
+ <Button title="Refresh" onPress={() => setRefreshCamera(prev => !prev)} variant="outline"/>
134
+ </View>);
206
135
  }
207
136
  return (<View style={[styles.container, style]}>
208
- <Camera ref={camera} style={StyleSheet.absoluteFill} device={device} isActive={showCamera} photo={true} video={enableVideo} audio={enableVideo} format={bestFormat} onInitialized={onInitialized} onError={onCameraError}/>
209
-
210
- {/* Instructions */}
211
- {/* {instructions && (
212
- <View style={styles.instructionsOverlay}>
213
- <Text style={styles.instructions}>{instructions}</Text>
214
- </View>
215
- )} */}
137
+ <Camera
138
+ // 🚨 FIX: This key forces the native component to completely remount
139
+ // when permissions are granted or when manually refreshed.
140
+ key={`cam-${hasPermission}-${refreshCamera ? '1' : '0'}`} ref={camera} style={StyleSheet.absoluteFill} device={device} isActive={showCamera && !isProcessing} photo={true} video={false} audio={false} onInitialized={onInitialized} onError={onCameraError}/>
141
+
142
+ {/* 🚨 FIX: Floating Refresh Button if the hardware freezes on a black screen */}
143
+ {!isInitialized && showInitTimeout && (<View style={styles.stuckOverlay}>
144
+ <ActivityIndicator size="large" color="#2DBD60" style={{ marginBottom: 16 }}/>
145
+ <Text style={{ color: 'white', marginBottom: 16, fontWeight: 'bold' }}>
146
+ Camera is taking a while to start...
147
+ </Text>
148
+ <Button title="Restart Camera" onPress={() => {
149
+ setIsInitialized(false);
150
+ setRefreshCamera(prev => !prev);
151
+ }} variant="primary"/>
152
+ </View>)}
216
153
 
217
- {/* Custom overlay component */}
218
154
  {overlayComponent}
219
-
220
- {/* Bounding box overlay */}
221
- {bbox && (<View style={styles.bboxOverlay}>
222
- <View style={[
223
- styles.bbox,
224
- {
225
- left: `${bbox.xMin}%`,
226
- top: `${bbox.yMin}%`,
227
- width: `${bbox.xMax - bbox.xMin}%`,
228
- height: `${bbox.yMax - bbox.yMin}%`,
229
- borderColor: bbox.borderColor || '#2DBD60',
230
- borderWidth: bbox.borderWidth || 3,
231
- borderRadius: bbox.cornerRadius || 8,
232
- }
233
- ]}/>
234
- </View>)}
235
-
236
-
237
- {/* Camera controls */}
238
- <View style={styles.controlsContainer}>
239
- {/* Flash button */}
240
- {/* {enableFlash && (
241
- <TouchableOpacity style={styles.controlButton} onPress={toggleFlash}>
242
- <Text style={styles.controlButtonText}>
243
- {flash === 'off' ? '⚡' : flash === 'on' ? '⚡️' : '✨'}
244
- </Text>
245
- </TouchableOpacity>
246
- )} */}
247
-
248
- {/* Capture button */}
249
- {showCaptureButton && !enableVideo && silentCaptureResult?.success && (<TouchableOpacity style={styles.captureButton} onPress={capturePhoto} disabled={!isInitialized}>
250
- <View style={[
251
- styles.captureButtonInner,
252
- !isInitialized && styles.captureButtonDisabled
253
- ]}/>
254
- </TouchableOpacity>)}
255
-
256
- {/* Video recording button */}
257
- {showCaptureButton && enableVideo && silentCaptureResult?.success && (<TouchableOpacity style={[
258
- styles.captureButton,
259
- isRecording && styles.recordingButton
260
- ]} onPress={isRecording ? stopVideoRecording : startVideoRecording} disabled={!isInitialized}>
261
- <View style={[
262
- styles.captureButtonInner,
263
- !isInitialized && styles.captureButtonDisabled,
264
- isRecording && styles.recordingButtonInner
265
- ]}/>
266
- </TouchableOpacity>)}
267
-
268
- {/* Switch camera button */}
269
- {/* {showSwitchCamera && canFlip && (
270
- <TouchableOpacity style={styles.controlButton} onPress={switchCamera}>
271
- <Text style={styles.controlButtonText}>🔄</Text>
272
- </TouchableOpacity>
273
- )} */}
274
-
275
- {silentCaptureResult?.isAnalyzing && (<View style={{ backgroundColor: 'rgba(0, 0, 0, 0.7)', padding: 10, borderRadius: 10 }}>
276
- <Text style={{ color: 'white', fontSize: 16, fontWeight: 'bold' }}>{t('camera.analyzing')}</Text>
277
- </View>)}
278
- </View>
279
155
  </View>);
280
156
  };
281
157
  const styles = StyleSheet.create({
282
- container: {
283
- flex: 1,
284
- backgroundColor: 'black',
285
- },
286
- instructionsOverlay: {
287
- position: 'absolute',
288
- top: 60,
289
- left: 20,
290
- right: 20,
291
- backgroundColor: 'rgba(0, 0, 0, 0.7)',
292
- padding: 15,
293
- // borderRadius: 10,
294
- zIndex: 1,
295
- },
296
- instructions: {
297
- color: 'white',
298
- fontSize: 16,
299
- textAlign: 'center',
300
- fontWeight: '500',
301
- },
302
- closeButton: {
303
- position: 'absolute',
304
- top: 50,
305
- right: 20,
306
- backgroundColor: 'rgba(0, 0, 0, 0.7)',
307
- width: 40,
308
- height: 40,
309
- borderRadius: 20,
310
- justifyContent: 'center',
311
- alignItems: 'center',
312
- zIndex: 2,
313
- },
314
- closeButtonText: {
315
- color: 'white',
316
- fontSize: 20,
317
- fontWeight: 'bold',
318
- },
319
- controlsContainer: {
320
- position: 'absolute',
321
- bottom: 40,
322
- left: 0,
323
- right: 0,
324
- flexDirection: 'row',
325
- justifyContent: 'space-around',
326
- alignItems: 'center',
327
- paddingHorizontal: 40,
328
- zIndex: 1,
329
- },
330
- controlButton: {
331
- backgroundColor: 'rgba(0, 0, 0, 0.7)',
332
- width: 50,
333
- height: 50,
334
- borderRadius: 25,
158
+ container: { flex: 1, backgroundColor: 'black' },
159
+ centerContent: { justifyContent: 'center', alignItems: 'center', padding: 20 },
160
+ permissionMessage: { color: 'white', textAlign: 'center', marginBottom: 20, fontSize: 16, fontWeight: '600' },
161
+ stuckOverlay: {
162
+ ...StyleSheet.absoluteFillObject,
335
163
  justifyContent: 'center',
336
164
  alignItems: 'center',
337
- },
338
- controlButtonText: {
339
- fontSize: 24,
340
- },
341
- captureButton: {
342
- backgroundColor: 'rgba(255, 255, 255, 0.3)',
343
- width: 80,
344
- height: 80,
345
- borderRadius: 40,
346
- justifyContent: 'center',
347
- alignItems: 'center',
348
- borderWidth: 3,
349
- borderColor: 'white',
350
- },
351
- captureButtonInner: {
352
- backgroundColor: 'white',
353
- width: 60,
354
- height: 60,
355
- borderRadius: 30,
356
- },
357
- captureButtonDisabled: {
358
- backgroundColor: 'rgba(255, 255, 255, 0.5)',
359
- },
360
- recordingButton: {
361
- backgroundColor: 'rgba(255, 59, 48, 0.3)',
362
- borderColor: '#FF3B30',
363
- },
364
- recordingButtonInner: {
365
- backgroundColor: '#FF3B30',
366
- },
367
- permissionMessage: {
368
- color: 'white',
369
- fontSize: 16,
370
- textAlign: 'center',
371
- margin: 20,
372
- },
373
- errorMessage: {
374
- color: 'red',
375
- fontSize: 16,
376
- textAlign: 'center',
377
- margin: 20,
378
- },
379
- bboxOverlay: {
380
- position: 'absolute',
381
- top: 0,
382
- left: 0,
383
- right: 0,
384
- bottom: 0,
385
- pointerEvents: 'none',
386
- },
387
- bbox: {
388
- position: 'absolute',
389
- borderStyle: 'solid',
390
- backgroundColor: 'transparent',
391
- },
165
+ backgroundColor: 'rgba(0,0,0,0.85)',
166
+ zIndex: 1000,
167
+ padding: 20
168
+ }
392
169
  });
393
170
  //# sourceMappingURL=EnhancedCameraView.js.map