@sanctum-key/react-native-sdk 1.0.5 → 1.0.7

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 +4 -4
  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 +66 -338
  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 +93 -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 +167 -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 +269 -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 +11 -1
  150. package/build/src/modules/api/KYCService.d.ts.map +1 -1
  151. package/build/src/modules/api/KYCService.js +101 -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 +81 -400
  167. package/src/components/KYCElements/EmailVerificationTemplate.tsx +115 -26
  168. package/src/components/KYCElements/IDCardCapture.tsx +228 -868
  169. package/src/components/KYCElements/PhoneVerificationTemplate.tsx +328 -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 +168 -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
@@ -0,0 +1,11 @@
1
+ import { requireNativeView } from 'expo';
2
+ import * as React from 'react';
3
+
4
+ import { SanctumKeySdkViewProps } from './SanctumKeySdk.types';
5
+
6
+ const NativeView: React.ComponentType<SanctumKeySdkViewProps> =
7
+ requireNativeView('SanctumKeySdk');
8
+
9
+ export default function SanctumKeySdkView(props: SanctumKeySdkViewProps) {
10
+ return <NativeView {...props} />;
11
+ }
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { TransfergratisSdkViewProps } from './TransfergratisSdk.types';
3
+ import { SanctumKeySdkViewProps } from './SanctumKeySdk.types';
4
4
 
5
- export default function TransfergratisSdkView(props: TransfergratisSdkViewProps) {
5
+ export default function SanctumKeySdkView(props: SanctumKeySdkViewProps) {
6
6
  return (
7
7
  <div>
8
8
  {/* <iframe
package/src/api/axios.ts CHANGED
@@ -132,12 +132,12 @@ export default HttpClient;
132
132
 
133
133
  // ml service api
134
134
  export const mlService = new HttpClient({
135
- baseURL: 'https://api.ml.transfergratis.com',
135
+ baseURL: 'https://api.ml.SanctumKey.com',
136
136
  apiKey: 'your-api-key',
137
137
  });
138
138
  // backedn service api
139
139
  export const backendService = new HttpClient({
140
- baseURL: 'https://api.backend.transfergratis.com',
140
+ baseURL: 'https://api.backend.SanctumKey.com',
141
141
  apiKey: 'your-api-key',
142
142
  });
143
143
 
@@ -1,266 +1,143 @@
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 } 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 { EnhancedCameraViewProps } from './OverLay/type';
7
7
  import { Button } from './ui/Button';
8
8
 
9
-
10
-
11
-
12
9
  export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
13
10
  showCamera,
14
11
  cameraType: initialCameraType = 'front',
15
12
  style,
16
- onCapture,
17
13
  onError,
18
- onClose,
19
- enableFlash = false,
20
- enableHdr = false,
21
- quality = 'high',
22
- showCaptureButton = true,
23
- showSwitchCamera = true,
24
- overlayComponent,
25
- bbox,
26
- canFlip = true,
27
- enableVideo = false,
28
- isRecording = false,
29
- onVideoRecordingStart,
30
- onVideoRecordingStop,
31
- videoDuration = 10,
32
- onSilentCapture,
14
+ onSilentCapture,
33
15
  silentCaptureResult,
16
+ isProcessing = false,
17
+ overlayComponent,
34
18
  }) => {
35
19
  const { t } = useI18n();
36
20
  const camera = useRef<Camera>(null);
37
- const [cameraType, setCameraType] = useState<'front' | 'back'>(initialCameraType);
38
- const [hasPermission, setHasPermission] = useState(false);
21
+
22
+ const isCapturingRef = useRef(false);
23
+ const isProcessingRef = useRef(isProcessing);
24
+
25
+ const [cameraType] = useState<'front' | 'back'>(initialCameraType);
26
+
27
+ // 🚨 BUG FIX: Initialize to null to prevent the "Flicker" on retake
28
+ const [hasPermission, setHasPermission] = useState<boolean | null>(null);
39
29
  const [isInitialized, setIsInitialized] = useState(false);
40
- const [flash, setFlash] = useState<'off' | 'on' | 'auto'>('off');
41
30
  const [refreshCamera, setRefreshCamera] = useState(false);
42
31
 
43
32
  const device = useCameraDevice(cameraType);
44
- console.log({ setCameraType, setFlash });
45
33
 
46
- // Sélectionner le meilleur format disponible pour une qualité maximale
47
- // Prioriser les formats avec une bonne résolution vidéo (pour la prévisualisation) ET photo (pour la capture)
48
- const bestFormat = useMemo(() => {
49
- if (!device || !device.formats || device.formats.length === 0) {
50
- return undefined;
51
- }
52
-
53
- // Trier les formats en combinant la résolution vidéo (pour la prévisualisation) et photo (pour la capture)
54
- // On priorise les formats avec une bonne résolution vidéo car c'est ce qui est affiché en temps réel
55
- const sortedFormats = [...device.formats].sort((a, b) => {
56
- // Résolution vidéo (pour la prévisualisation live)
57
- const videoResolutionA = (a.videoWidth || 0) * (a.videoHeight || 0);
58
- const videoResolutionB = (b.videoWidth || 0) * (b.videoHeight || 0);
59
-
60
- // Résolution photo (pour la capture)
61
- const photoResolutionA = (a.photoWidth || 0) * (a.photoHeight || 0);
62
- const photoResolutionB = (b.photoWidth || 0) * (b.photoHeight || 0);
63
-
64
- // Prioriser d'abord la résolution vidéo (prévisualisation), puis la résolution photo
65
- if (videoResolutionB !== videoResolutionA) {
66
- return videoResolutionB - videoResolutionA;
67
- }
68
- return photoResolutionB - photoResolutionA;
69
- });
70
-
71
- return sortedFormats[0];
72
- }, [device]);
34
+ useEffect(() => {
35
+ isProcessingRef.current = isProcessing;
36
+ }, [isProcessing]);
73
37
 
74
38
  const checkPermissions = async () => {
75
39
  try {
76
40
  const hasAllPermissions = await VisionCameraModule.hasAllPermissions();
77
- console.log('hasAllPermissions', hasAllPermissions);
78
41
  if (!hasAllPermissions) {
79
42
  const granted = await VisionCameraModule.requestAllPermissions();
80
- console.log('granted', granted);
81
43
  if (!granted) {
82
- console.log('permissionRequired', t('camera.permissionRequired'));
44
+ setHasPermission(false);
83
45
  onError?.({ message: t('camera.permissionRequired') });
84
46
  return;
85
47
  }
86
48
  }
87
49
  setHasPermission(true);
88
50
  } catch (error) {
89
- console.error('Error checking permissions:', error);
51
+ setHasPermission(false);
90
52
  onError?.({ message: t('camera.errorOccurred') });
91
53
  }
92
54
  };
93
55
 
94
- // Check permissions on component mount
95
56
  useEffect(() => {
96
- if (showCamera) {
97
- checkPermissions();
98
- }
57
+ if (showCamera) checkPermissions();
99
58
  }, [showCamera, refreshCamera]);
100
59
 
60
+ useEffect(() => {
61
+ const subscription = AppState.addEventListener('change', nextAppState => {
62
+ if (nextAppState === 'active' && showCamera && hasPermission === false) {
63
+ checkPermissions();
64
+ }
65
+ });
66
+ return () => subscription.remove();
67
+ }, [showCamera, hasPermission]);
101
68
 
102
-
103
- const onInitialized = useCallback(() => {
104
- console.log('Camera initialized!');
105
- setIsInitialized(true);
106
- }, []);
107
-
69
+ const onInitialized = useCallback(() => setIsInitialized(true), []);
108
70
  const onCameraError = useCallback((error: any) => {
109
- console.error('Camera error:', error);
110
71
  onError?.({ message: error.message || t('camera.errorOccurred') });
111
72
  }, [onError, t]);
112
73
 
113
74
  const captureSilentPhoto = useCallback(async () => {
114
- if (!camera.current || !isInitialized) {
115
- onError?.({ message: t('camera.notReady') });
116
- return;
117
- }
118
- console.log('silentCaptureResult', silentCaptureResult);
119
- if (silentCaptureResult?.isAnalyzing || silentCaptureResult?.success) {
120
- return;
121
- }
122
- try {
123
- const photo = await camera.current.takePhoto({
124
- enableShutterSound: true,
125
- flash: enableFlash ? flash : 'off',
126
- });
127
-
128
- const result = await VisionCameraModule.processPhotoResult(photo);
129
- onSilentCapture?.(result);
130
- } catch (error) {
131
-
132
- }
133
- }, [isInitialized, onError, onSilentCapture, enableFlash, flash, silentCaptureResult]);
134
-
135
- // Automatically take a silent photo every 5 seconds when ready
136
- useEffect(() => {
137
- if (!showCamera || !isInitialized) {
138
- return;
139
- }
140
-
141
- const intervalId = setInterval(() => {
142
- captureSilentPhoto();
143
- }, 2500);
75
+ if (!camera.current || !isInitialized || isProcessingRef.current || isCapturingRef.current) return;
76
+ if (silentCaptureResult?.isAnalyzing) return;
144
77
 
145
- return () => clearInterval(intervalId);
146
- }, [showCamera, isInitialized, captureSilentPhoto]);
147
-
148
- const capturePhoto = useCallback(async () => {
149
78
  try {
150
- if (!camera.current || !isInitialized) {
151
- onError?.({ message: t('camera.notReady') });
152
- return;
153
- }
154
- if (silentCaptureResult?.success) {
155
- onCapture?.({
156
- success: true,
157
- path: silentCaptureResult.path,
158
- });
159
- return;
160
- }
161
-
79
+ isCapturingRef.current = true;
162
80
  const photo = await camera.current.takePhoto({
163
- enableShutterSound: true,
164
- flash: enableFlash ? flash : 'off',
81
+ enableShutterSound: false,
82
+ flash: 'off',
165
83
  });
166
84
 
167
85
  const result = await VisionCameraModule.processPhotoResult(photo);
168
- onCapture?.(result);
169
- } catch (error) {
170
- console.error('Error taking photo:', error);
171
- onCapture?.({
172
- success: false,
173
- error: error instanceof Error ? error.message : t('camera.failedToCapture'),
174
- });
175
- }
176
- }, [isInitialized, quality, flash, enableFlash, onCapture, onError]);
177
-
178
- const startVideoRecording = useCallback(async () => {
179
- try {
180
- if (!camera.current || !isInitialized) {
181
- onError?.({ message: t('camera.notReady') });
182
- return;
183
- }
184
-
185
- await camera.current.startRecording({
186
- onRecordingFinished: (video: any) => {
187
- onVideoRecordingStop?.({
188
- success: true,
189
- path: video.path,
190
- });
191
- },
192
- onRecordingError: (error: any) => {
193
- console.error('Recording error:', error);
194
- onVideoRecordingStop?.({
195
- success: false,
196
- error: error.message || t('camera.failedToStartRecording'),
197
- });
198
- },
199
- });
200
-
201
- onVideoRecordingStart?.();
202
- } catch (error) {
203
- console.error('Error starting video recording:', error);
204
- onVideoRecordingStop?.({
205
- success: false,
206
- error: error instanceof Error ? error.message : t('camera.failedToStartRecording'),
86
+
87
+ onSilentCapture?.({
88
+ ...result,
89
+ path: result.path || photo.path,
207
90
  });
208
- }
209
- }, [isInitialized, onVideoRecordingStart, onVideoRecordingStop, onError]);
210
91
 
211
- const stopVideoRecording = useCallback(async () => {
212
- try {
213
- if (!camera.current) {
214
- onError?.({ message: t('camera.notReady') });
215
- return;
216
- }
217
-
218
- await camera.current.stopRecording();
219
92
  } catch (error) {
220
- console.error('Error stopping video recording:', error);
221
- onError?.({ message: t('camera.failedToStopRecording') });
93
+ // Silent background fail
94
+ } finally {
95
+ isCapturingRef.current = false;
222
96
  }
223
- }, [onError]);
224
-
225
- // const switchCamera = useCallback(() => {
226
- // setCameraType(current => current === 'front' ? 'back' : 'front');
227
- // }, []);
97
+ }, [isInitialized, onSilentCapture, silentCaptureResult]);
228
98
 
229
- // const toggleFlash = useCallback(() => {
230
- // setFlash(current => {
231
- // switch (current) {
232
- // case 'off': return 'on';
233
- // case 'on': return 'auto';
234
- // case 'auto': return 'off';
235
- // default: return 'off';
236
- // }
237
- // });
238
- // }, []);
239
-
240
- if (!hasPermission) {
241
- return (
242
- <View style={[styles.container, style]}>
243
- <Text style={styles.permissionMessage}>
244
- {t('camera.permissionRequired')}
245
- </Text>
246
- <Button title="Refresh Camera" onPress={() => setRefreshCamera(!refreshCamera)} />
247
- </View>
248
- );
99
+ // 🚨 BUG FIX: The Warm-up Timer (Fixes Blurry Images)
100
+ useEffect(() => {
101
+ if (!showCamera || !isInitialized || isProcessing) return;
102
+
103
+ let isActive = true;
104
+ let intervalId: ReturnType<typeof setInterval>;
105
+
106
+ const warmupTimer = setTimeout(() => {
107
+ if (!isActive) return;
108
+ intervalId = setInterval(() => {
109
+ captureSilentPhoto();
110
+ }, 1500); // 1.5s gives the hardware more time to stabilize between shots
111
+ }, 1000);
112
+
113
+ return () => {
114
+ isActive = false;
115
+ clearTimeout(warmupTimer);
116
+ if (intervalId) clearInterval(intervalId);
117
+ };
118
+ }, [showCamera, isInitialized, isProcessing, captureSilentPhoto]);
119
+
120
+ // --- RENDERERS ---
121
+
122
+ // 🚨 BUG FIX: Show nothing while checking permissions (Stops flicker)
123
+ if (hasPermission === null) {
124
+ return <View style={[styles.container, style]} />;
249
125
  }
250
126
 
251
- if (!device) {
127
+ if (hasPermission === false) {
252
128
  return (
253
- <View style={[styles.container, style]}>
254
- <Text style={styles.errorMessage}>
255
- {t('camera.deviceNotAvailable')}
256
- </Text>
129
+ <View style={[styles.container, style, { justifyContent: 'center', alignItems: 'center' }]}>
130
+ <Text style={styles.permissionMessage}>{t('camera.permissionRequired')}</Text>
131
+ <Button
132
+ title="Refresh Camera"
133
+ onPress={() => setRefreshCamera(prev => !prev)}
134
+ variant="primary"
135
+ />
257
136
  </View>
258
137
  );
259
138
  }
260
139
 
261
- if (!showCamera) {
262
- return <View style={[styles.container, style]} />;
263
- }
140
+ if (!device || !showCamera) return <View style={[styles.container, style]} />;
264
141
 
265
142
  return (
266
143
  <View style={[styles.container, style]}>
@@ -268,215 +145,19 @@ export const EnhancedCameraView: React.FC<EnhancedCameraViewProps> = ({
268
145
  ref={camera}
269
146
  style={StyleSheet.absoluteFill}
270
147
  device={device}
271
- isActive={showCamera}
148
+ isActive={showCamera && !isProcessing}
272
149
  photo={true}
273
- video={enableVideo}
274
- audio={enableVideo}
275
- format={bestFormat}
150
+ video={false}
151
+ audio={false}
276
152
  onInitialized={onInitialized}
277
153
  onError={onCameraError}
278
154
  />
279
-
280
- {/* Instructions */}
281
- {/* {instructions && (
282
- <View style={styles.instructionsOverlay}>
283
- <Text style={styles.instructions}>{instructions}</Text>
284
- </View>
285
- )} */}
286
-
287
- {/* Custom overlay component */}
288
155
  {overlayComponent}
289
-
290
- {/* Bounding box overlay */}
291
- {bbox && (
292
- <View style={styles.bboxOverlay}>
293
- <View
294
- style={[
295
- styles.bbox,
296
- {
297
- left: `${bbox.xMin}%`,
298
- top: `${bbox.yMin}%`,
299
- width: `${bbox.xMax - bbox.xMin}%`,
300
- height: `${bbox.yMax - bbox.yMin}%`,
301
- borderColor: bbox.borderColor || '#2DBD60',
302
- borderWidth: bbox.borderWidth || 3,
303
- borderRadius: bbox.cornerRadius || 8,
304
- }
305
- ]}
306
- />
307
- </View>
308
- )}
309
-
310
-
311
- {/* Camera controls */}
312
- <View style={styles.controlsContainer}>
313
- {/* Flash button */}
314
- {/* {enableFlash && (
315
- <TouchableOpacity style={styles.controlButton} onPress={toggleFlash}>
316
- <Text style={styles.controlButtonText}>
317
- {flash === 'off' ? '⚡' : flash === 'on' ? '⚡️' : '✨'}
318
- </Text>
319
- </TouchableOpacity>
320
- )} */}
321
-
322
- {/* Capture button */}
323
- {showCaptureButton && !enableVideo && silentCaptureResult?.success && (
324
- <TouchableOpacity
325
- style={styles.captureButton}
326
- onPress={capturePhoto}
327
- disabled={!isInitialized}
328
- >
329
- <View style={[
330
- styles.captureButtonInner,
331
- !isInitialized && styles.captureButtonDisabled
332
- ]} />
333
- </TouchableOpacity>
334
- )}
335
-
336
- {/* Video recording button */}
337
- {showCaptureButton && enableVideo && silentCaptureResult?.success && (
338
- <TouchableOpacity
339
- style={[
340
- styles.captureButton,
341
- isRecording && styles.recordingButton
342
- ]}
343
- onPress={isRecording ? stopVideoRecording : startVideoRecording}
344
- disabled={!isInitialized}
345
- >
346
- <View style={[
347
- styles.captureButtonInner,
348
- !isInitialized && styles.captureButtonDisabled,
349
- isRecording && styles.recordingButtonInner
350
- ]} />
351
- </TouchableOpacity>
352
- )}
353
-
354
- {/* Switch camera button */}
355
- {/* {showSwitchCamera && canFlip && (
356
- <TouchableOpacity style={styles.controlButton} onPress={switchCamera}>
357
- <Text style={styles.controlButtonText}>🔄</Text>
358
- </TouchableOpacity>
359
- )} */}
360
-
361
- {silentCaptureResult?.isAnalyzing && (
362
- <View style={{ backgroundColor: 'rgba(0, 0, 0, 0.7)', padding: 10, borderRadius: 10 }}>
363
- <Text style={{ color: 'white', fontSize: 16, fontWeight: 'bold' }}>{t('camera.analyzing')}</Text>
364
- </View>
365
- )}
366
- </View>
367
156
  </View>
368
157
  );
369
158
  };
370
159
 
371
160
  const styles = StyleSheet.create({
372
- container: {
373
- flex: 1,
374
- backgroundColor: 'black',
375
- },
376
- instructionsOverlay: {
377
- position: 'absolute',
378
- top: 60,
379
- left: 20,
380
- right: 20,
381
- backgroundColor: 'rgba(0, 0, 0, 0.7)',
382
- padding: 15,
383
- // borderRadius: 10,
384
- zIndex: 1,
385
- },
386
- instructions: {
387
- color: 'white',
388
- fontSize: 16,
389
- textAlign: 'center',
390
- fontWeight: '500',
391
- },
392
- closeButton: {
393
- position: 'absolute',
394
- top: 50,
395
- right: 20,
396
- backgroundColor: 'rgba(0, 0, 0, 0.7)',
397
- width: 40,
398
- height: 40,
399
- borderRadius: 20,
400
- justifyContent: 'center',
401
- alignItems: 'center',
402
- zIndex: 2,
403
- },
404
- closeButtonText: {
405
- color: 'white',
406
- fontSize: 20,
407
- fontWeight: 'bold',
408
- },
409
- controlsContainer: {
410
- position: 'absolute',
411
- bottom: 40,
412
- left: 0,
413
- right: 0,
414
- flexDirection: 'row',
415
- justifyContent: 'space-around',
416
- alignItems: 'center',
417
- paddingHorizontal: 40,
418
- zIndex: 1,
419
- },
420
- controlButton: {
421
- backgroundColor: 'rgba(0, 0, 0, 0.7)',
422
- width: 50,
423
- height: 50,
424
- borderRadius: 25,
425
- justifyContent: 'center',
426
- alignItems: 'center',
427
- },
428
- controlButtonText: {
429
- fontSize: 24,
430
- },
431
- captureButton: {
432
- backgroundColor: 'rgba(255, 255, 255, 0.3)',
433
- width: 80,
434
- height: 80,
435
- borderRadius: 40,
436
- justifyContent: 'center',
437
- alignItems: 'center',
438
- borderWidth: 3,
439
- borderColor: 'white',
440
- },
441
- captureButtonInner: {
442
- backgroundColor: 'white',
443
- width: 60,
444
- height: 60,
445
- borderRadius: 30,
446
- },
447
- captureButtonDisabled: {
448
- backgroundColor: 'rgba(255, 255, 255, 0.5)',
449
- },
450
- recordingButton: {
451
- backgroundColor: 'rgba(255, 59, 48, 0.3)',
452
- borderColor: '#FF3B30',
453
- },
454
- recordingButtonInner: {
455
- backgroundColor: '#FF3B30',
456
- },
457
- permissionMessage: {
458
- color: 'white',
459
- fontSize: 16,
460
- textAlign: 'center',
461
- margin: 20,
462
- },
463
- errorMessage: {
464
- color: 'red',
465
- fontSize: 16,
466
- textAlign: 'center',
467
- margin: 20,
468
- },
469
- bboxOverlay: {
470
- position: 'absolute',
471
- top: 0,
472
- left: 0,
473
- right: 0,
474
- bottom: 0,
475
- pointerEvents: 'none',
476
- },
477
- bbox: {
478
- position: 'absolute',
479
- borderStyle: 'solid',
480
- backgroundColor: 'transparent',
481
- },
161
+ container: { flex: 1, backgroundColor: 'black' },
162
+ permissionMessage: { color: 'white', textAlign: 'center', margin: 20, fontSize: 16 },
482
163
  });