@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
@@ -1,14 +1,14 @@
1
1
  import React, { useState } from 'react';
2
- import { View, Text, TouchableOpacity, StyleSheet, Image } from 'react-native';
2
+ import { View, Text, TouchableOpacity, StyleSheet, Image, ActivityIndicator, Platform } from 'react-native';
3
3
  import { showAlert } from '../../utils/platformAlert';
4
4
  import { EnhancedCameraView } from '../EnhancedCameraView';
5
-
6
- import { KYCElement } from '../../types/KYC.types';
5
+ import SelfieOverlay from '../OverLay/SelfieOverlay';
6
+ import { KYCElement, ISilentCaptureResult } from '../../types/KYC.types';
7
7
 
8
8
  interface SelfieCaptureProps {
9
9
  element: KYCElement;
10
10
  value?: string;
11
- onValueChange: (value: string) => void;
11
+ onValueChange: (value: string) => void | Promise<void>;
12
12
  error?: string;
13
13
  }
14
14
 
@@ -20,6 +20,11 @@ export const SelfieCapture: React.FC<SelfieCaptureProps> = ({
20
20
  }) => {
21
21
  const [capturedImage, setCapturedImage] = useState<string | null>(value || null);
22
22
  const [showCamera, setShowCamera] = useState(false);
23
+
24
+ // 🚨 AUTO-CAPTURE STATES
25
+ const [isProcessingCapture, setIsProcessingCapture] = useState(false);
26
+ const [processingImagePath, setProcessingImagePath] = useState<string | null>(null);
27
+ const [silentCaptureResult, setSilentCaptureResult] = useState<ISilentCaptureResult>({ success: false, isAnalyzing: false });
23
28
 
24
29
  const cameraConfig = element.cameraConfig || {
25
30
  aspectRatio: 1,
@@ -30,255 +35,221 @@ export const SelfieCapture: React.FC<SelfieCaptureProps> = ({
30
35
  maxRetakes: 3,
31
36
  overlay: {
32
37
  showGuide: true,
33
- guideText: 'Prenez un selfie clair',
38
+ guideText: 'Placez votre visage dans l\'ovale',
39
+ }
40
+ };
41
+
42
+ // --- THE AUTO CAPTURE LOGIC ---
43
+ const autoCapture = async (capturePath: string) => {
44
+ if (isProcessingCapture) return;
45
+
46
+ // 1. Freeze UI and show the captured selfie
47
+ setIsProcessingCapture(true);
48
+ setProcessingImagePath(capturePath);
49
+
50
+ try {
51
+ setCapturedImage(capturePath);
52
+
53
+ // Save data to parent component
54
+ await onValueChange(capturePath);
55
+
56
+ // 2. Short delay for UX success feeling
57
+ setTimeout(() => {
58
+ setShowCamera(false);
59
+ setSilentCaptureResult({ success: false, isAnalyzing: false });
60
+ setIsProcessingCapture(false);
61
+ setProcessingImagePath(null);
62
+ }, 800);
63
+
64
+ } catch (e: any) {
65
+ showAlert('Erreur', e?.message || 'Impossible de sauvegarder le selfie');
66
+ setSilentCaptureResult({ success: false, isAnalyzing: false });
67
+ setIsProcessingCapture(false);
68
+ setProcessingImagePath(null);
34
69
  }
35
70
  };
36
71
 
37
- const handleCapture = (result: { success: boolean; path?: string; error?: string }) => {
72
+ // --- SILENT BACKGROUND SCANNER ---
73
+ const handleSilentCapture = async (result: { success: boolean; path?: string; error?: string }) => {
74
+ if (silentCaptureResult.isAnalyzing || isProcessingCapture) return;
75
+
38
76
  if (result.success && result.path) {
39
- setCapturedImage(result.path);
40
- onValueChange(result.path);
41
- setShowCamera(false);
42
- } else {
43
- showAlert('Erreur', result.error || 'Impossible de prendre le selfie');
77
+ setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: true, success: false, error: '' }));
78
+
79
+ try {
80
+ // Since camera returned success (clear frame), trigger auto-capture immediately
81
+ await autoCapture(result.path);
82
+ } catch (error: any) {
83
+ setSilentCaptureResult(prev => ({
84
+ ...prev,
85
+ isAnalyzing: false,
86
+ success: false,
87
+ error: error?.message || 'Visage non détecté'
88
+ }));
89
+ }
44
90
  }
45
91
  };
46
92
 
47
93
  const handleError = (event: { message: string }) => {
48
94
  showAlert('Erreur', event.message);
49
95
  setShowCamera(false);
96
+ setIsProcessingCapture(false);
50
97
  };
51
98
 
52
99
  const retakePicture = () => {
100
+ setIsProcessingCapture(false);
101
+ setProcessingImagePath(null);
102
+ setSilentCaptureResult({ success: false, isAnalyzing: false });
53
103
  setCapturedImage(null);
54
104
  onValueChange('');
55
105
  setShowCamera(true);
56
106
  };
57
107
 
108
+ // --- LIVE CAMERA RENDER ---
58
109
  if (showCamera) {
110
+ const isBusy = isProcessingCapture;
111
+
59
112
  return (
60
- <View style={styles.container}>
113
+ <View style={styles.cameraContainerFullScreen}>
61
114
  <EnhancedCameraView
62
- instructions={cameraConfig.overlay?.guideText || 'Prenez un selfie clair'}
63
115
  showCamera={true}
64
- cameraType="front"
116
+ isProcessing={isBusy}
117
+ cameraType={cameraConfig.cameraType as 'front' | 'back'}
65
118
  style={styles.camera}
66
- onCapture={handleCapture}
67
119
  onError={handleError}
68
- onClose={() => setShowCamera(false)}
69
- quality="high"
70
- showCaptureButton={true}
71
- showSwitchCamera={false}
72
- enableFlash={false}
73
- />
74
- </View>
75
- );
76
- }
120
+ onSilentCapture={handleSilentCapture}
121
+ silentCaptureResult={silentCaptureResult}
122
+ overlayComponent={
123
+ <>
124
+ {/* Subtle scanning indicator */}
125
+ {!isBusy && silentCaptureResult.isAnalyzing && (
126
+ <View style={styles.topAnalyzingPillContainer}>
127
+ <View style={styles.topAnalyzingPill}>
128
+ <ActivityIndicator size="small" color="white" />
129
+ <Text style={styles.analyzingPillText}>Analyse du visage...</Text>
130
+ </View>
131
+ </View>
132
+ )}
77
133
 
78
- if (capturedImage) {
79
- return (
80
- <View style={styles.container}>
81
- <Text style={styles.title}>{element.title}</Text>
82
- <Text style={styles.description}>{element.description}</Text>
83
-
84
- <View style={styles.imageContainer}>
85
- <Image source={{ uri: capturedImage }} style={styles.capturedImage} />
86
- </View>
134
+ {/* Success Overlay with Frozen Perfect Selfie */}
135
+ {isBusy && (
136
+ <View style={StyleSheet.absoluteFillObject}>
137
+ {processingImagePath && (
138
+ <Image
139
+ source={{ uri: processingImagePath.startsWith('file://') ? processingImagePath : `file://${processingImagePath}` }}
140
+ style={StyleSheet.absoluteFillObject}
141
+ resizeMode="cover"
142
+ />
143
+ )}
144
+ <View style={styles.processingOverlay}>
145
+ <ActivityIndicator size="large" color="#2DBD60" />
146
+ <Text style={styles.processingText}>
147
+ Parfait!{"\n"}Traitement du selfie...
148
+ </Text>
149
+ </View>
150
+ </View>
151
+ )}
87
152
 
88
- <View style={styles.buttonContainer}>
89
- {cameraConfig.allowRetake && (
90
- <TouchableOpacity style={styles.secondaryButton} onPress={retakePicture}>
91
- <Text style={styles.secondaryButtonText}>Reprendre</Text>
92
- </TouchableOpacity>
93
- )}
94
- <TouchableOpacity style={styles.primaryButton}>
95
- <Text style={styles.primaryButtonText}>Continuer</Text>
96
- </TouchableOpacity>
97
- </View>
153
+ {!isBusy && (
154
+ <SelfieOverlay
155
+ xMin={0} yMin={0} xMax={100} yMax={100}
156
+ orientation="center"
157
+ isSuccess={isBusy}
158
+ instructionsTile={element.title || "Selfie"}
159
+ instructionsSubtitle={cameraConfig.overlay?.guideText || "Placez votre visage dans l'ovale"}
160
+ cornerOpacity={1}
161
+ instructions=""
162
+ language="en"
163
+ />
164
+ )}
165
+ </>
166
+ }
167
+ />
98
168
 
99
- {error && (
100
- <Text style={styles.errorText}>{error}</Text>
101
- )}
169
+ {/* Floating Error Banner */}
170
+ {silentCaptureResult.error && !isBusy ? (
171
+ <View style={styles.floatingErrorBanner}>
172
+ <Text style={styles.floatingErrorText}>{silentCaptureResult.error}</Text>
173
+ </View>
174
+ ) : null}
102
175
  </View>
103
176
  );
104
177
  }
105
178
 
179
+ // --- PREVIEW RENDER ---
106
180
  return (
107
181
  <View style={styles.container}>
108
182
  <Text style={styles.title}>{element.title}</Text>
109
183
  <Text style={styles.description}>{element.description}</Text>
110
184
 
111
- <View style={styles.cameraContainer}>
112
- <TouchableOpacity
113
- style={styles.cameraPlaceholder}
114
- onPress={() => setShowCamera(true)}
115
- >
116
- <Text style={styles.cameraPlaceholderText}>📱</Text>
117
- <Text style={styles.cameraPlaceholderLabel}>
118
- {cameraConfig.overlay?.guideText || 'Appuyez pour prendre un selfie'}
119
- </Text>
120
- </TouchableOpacity>
121
- </View>
185
+ {capturedImage ? (
186
+ <>
187
+ <View style={styles.imageContainer}>
188
+ <Image source={{ uri: capturedImage }} style={styles.capturedImage} />
189
+ </View>
122
190
 
123
- {error && (
124
- <Text style={styles.errorText}>{error}</Text>
191
+ <View style={styles.buttonContainer}>
192
+ {cameraConfig.allowRetake && (
193
+ <TouchableOpacity style={styles.secondaryButton} onPress={retakePicture} disabled={isProcessingCapture}>
194
+ <Text style={styles.secondaryButtonText}>Reprendre</Text>
195
+ </TouchableOpacity>
196
+ )}
197
+ <TouchableOpacity style={styles.primaryButton} disabled={isProcessingCapture}>
198
+ <Text style={styles.primaryButtonText}>Continuer</Text>
199
+ </TouchableOpacity>
200
+ </View>
201
+ </>
202
+ ) : (
203
+ <View style={styles.cameraPlaceholderWrapper}>
204
+ <TouchableOpacity
205
+ style={styles.cameraPlaceholder}
206
+ onPress={() => setShowCamera(true)}
207
+ >
208
+ <Text style={styles.cameraPlaceholderText}>🤳</Text>
209
+ <Text style={styles.cameraPlaceholderLabel}>
210
+ {cameraConfig.overlay?.guideText || 'Appuyez pour prendre un selfie'}
211
+ </Text>
212
+ </TouchableOpacity>
213
+ </View>
125
214
  )}
215
+
216
+ {error && <Text style={styles.errorText}>{error}</Text>}
126
217
  </View>
127
218
  );
128
219
  };
129
220
 
130
221
  const styles = StyleSheet.create({
131
- container: {
132
- flex: 1,
133
- padding: 16,
134
- height: 500,
135
- },
136
- title: {
137
- fontSize: 24,
138
- fontWeight: 'bold',
139
- color: '#333',
140
- marginBottom: 8,
141
- textAlign: 'center',
142
- },
143
- description: {
144
- fontSize: 16,
145
- color: '#666',
146
- textAlign: 'center',
147
- marginBottom: 24,
148
- lineHeight: 22,
149
- },
150
- cameraContainer: {
151
- flex: 1,
152
- borderRadius: 12,
153
- overflow: 'hidden',
154
- marginBottom: 24,
155
- },
156
- camera: {
157
- flex: 1,
158
- },
159
- imageContainer: {
160
- flex: 1,
161
- borderRadius: 12,
162
- overflow: 'hidden',
163
- marginBottom: 24,
164
- },
165
- capturedImage: {
166
- width: '100%',
167
- height: '100%',
168
- resizeMode: 'contain',
169
- },
170
- buttonContainer: {
171
- flexDirection: 'row',
172
- justifyContent: 'space-around',
173
- alignItems: 'center',
174
- paddingHorizontal: 16,
175
- marginBottom: 24,
176
- },
177
- captureButton: {
178
- width: 80,
179
- height: 80,
180
- borderRadius: 40,
181
- backgroundColor: 'white',
182
- justifyContent: 'center',
183
- alignItems: 'center',
184
- shadowColor: '#000',
185
- shadowOffset: {
186
- width: 0,
187
- height: 4,
188
- },
189
- shadowOpacity: 0.3,
190
- shadowRadius: 4.65,
191
- elevation: 8,
192
- },
193
- captureButtonDisabled: {
194
- opacity: 0.6,
195
- },
196
- captureButtonInner: {
197
- width: 60,
198
- height: 60,
199
- borderRadius: 30,
200
- backgroundColor: '#4CAF50',
201
- justifyContent: 'center',
202
- alignItems: 'center',
203
- },
204
- captureButtonText: {
205
- fontSize: 24,
206
- color: 'white',
207
- },
208
- primaryButton: {
209
- backgroundColor: '#4CAF50',
210
- paddingHorizontal: 32,
211
- paddingVertical: 16,
212
- borderRadius: 8,
213
- },
214
- primaryButtonText: {
215
- color: 'white',
216
- fontWeight: '600',
217
- fontSize: 16,
218
- },
219
- secondaryButton: {
220
- backgroundColor: '#e5e5e5',
221
- paddingHorizontal: 32,
222
- paddingVertical: 16,
223
- borderRadius: 8,
224
- },
225
- secondaryButtonText: {
226
- color: '#333',
227
- fontWeight: '600',
228
- fontSize: 16,
229
- },
230
- permissionButton: {
231
- backgroundColor: '#4CAF50',
232
- paddingHorizontal: 32,
233
- paddingVertical: 16,
234
- borderRadius: 8,
235
- marginTop: 16,
236
- },
237
- permissionButtonText: {
238
- color: 'white',
239
- fontWeight: '600',
240
- fontSize: 16,
241
- textAlign: 'center',
242
- },
243
- tipsContainer: {
244
- backgroundColor: '#f8f9fa',
245
- padding: 16,
246
- borderRadius: 8,
247
- marginBottom: 16,
248
- },
249
- tipsTitle: {
250
- fontSize: 16,
251
- fontWeight: '600',
252
- color: '#333',
253
- marginBottom: 8,
254
- },
255
- tipText: {
256
- fontSize: 14,
257
- color: '#666',
258
- marginBottom: 4,
259
- },
260
- errorText: {
261
- color: '#dc2626',
262
- fontSize: 14,
263
- marginTop: 8,
264
- textAlign: 'center',
265
- },
266
- cameraPlaceholder: {
267
- flex: 1,
268
- justifyContent: 'center',
269
- alignItems: 'center',
270
- backgroundColor: '#e0e0e0',
271
- borderRadius: 12,
272
- borderWidth: 2,
273
- borderColor: '#ccc',
274
- },
275
- cameraPlaceholderText: {
276
- fontSize: 60,
277
- marginBottom: 10,
278
- },
279
- cameraPlaceholderLabel: {
280
- fontSize: 16,
281
- color: '#666',
282
- textAlign: 'center',
283
- },
284
- });
222
+ // 🚨 UI FIX: The camera MUST be full screen so your SelfieOverlay math matches the device screen
223
+ cameraContainerFullScreen: { ...StyleSheet.absoluteFillObject, backgroundColor: 'black', zIndex: 999 },
224
+ camera: { flex: 1 },
225
+
226
+ container: { flex: 1, padding: 16, height: 500 },
227
+ title: { fontSize: 24, fontWeight: 'bold', color: '#333', marginBottom: 8, textAlign: 'center' },
228
+ description: { fontSize: 16, color: '#666', textAlign: 'center', marginBottom: 24, lineHeight: 22 },
229
+
230
+ cameraPlaceholderWrapper: { flex: 1, borderRadius: 12, overflow: 'hidden', marginBottom: 24 },
231
+ imageContainer: { flex: 1, borderRadius: 12, overflow: 'hidden', marginBottom: 24, backgroundColor: '#000' },
232
+ capturedImage: { width: '100%', height: '100%', resizeMode: 'cover' },
233
+
234
+ buttonContainer: { flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center', paddingHorizontal: 16, marginBottom: 24 },
235
+ primaryButton: { backgroundColor: '#2DBD60', paddingHorizontal: 32, paddingVertical: 16, borderRadius: 12 },
236
+ primaryButtonText: { color: 'white', fontWeight: 'bold', fontSize: 16 },
237
+ secondaryButton: { backgroundColor: '#e5e5e5', paddingHorizontal: 32, paddingVertical: 16, borderRadius: 12 },
238
+ secondaryButtonText: { color: '#333', fontWeight: 'bold', fontSize: 16 },
239
+
240
+ errorText: { color: '#dc2626', fontSize: 14, marginTop: 8, textAlign: 'center' },
241
+
242
+ cameraPlaceholder: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f5f5f5', borderRadius: 12, borderWidth: 2, borderColor: '#e0e0e0', borderStyle: 'dashed' },
243
+ cameraPlaceholderText: { fontSize: 50, marginBottom: 12 },
244
+ cameraPlaceholderLabel: { fontSize: 16, color: '#666', textAlign: 'center', fontWeight: '500' },
245
+
246
+ topAnalyzingPillContainer: { position: 'absolute', top: Platform.OS === 'android' ? 60 : 50, left: 0, right: 0, alignItems: 'center', zIndex: 100 },
247
+ topAnalyzingPill: { flexDirection: 'row', alignItems: 'center', backgroundColor: 'rgba(0,0,0,0.6)', paddingVertical: 8, paddingHorizontal: 16, borderRadius: 20, gap: 8 },
248
+ analyzingPillText: { color: 'white', fontSize: 14, fontWeight: 'bold' },
249
+
250
+ processingOverlay: { flex: 1, backgroundColor: 'rgba(0, 0, 0, 0.7)', justifyContent: 'center', alignItems: 'center', zIndex: 9999 },
251
+ processingText: { color: '#FFF', fontSize: 20, fontWeight: 'bold', marginTop: 16, textAlign: 'center', lineHeight: 28 },
252
+
253
+ floatingErrorBanner: { position: 'absolute', top: 100, left: '10%', right: '10%', backgroundColor: 'rgba(220, 38, 38, 0.95)', paddingVertical: 12, paddingHorizontal: 16, borderRadius: 8, alignItems: 'center', justifyContent: 'center', shadowColor: '#000', shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.3, shadowRadius: 5, elevation: 8, zIndex: 100 },
254
+ floatingErrorText: { color: 'white', fontSize: 14, fontWeight: '700', textAlign: 'center' },
255
+ });