@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.
- package/README.md +3 -3
- package/android/build/.transforms/{f62cb96b2d1f78ca96ab35932dd530dc → c9d62bb333688ab562f51958998d5a48}/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/kyc/{transfergratis → SanctumKey}/com/BuildConfig.java +2 -2
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +1 -1
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +1 -1
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +2 -2
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/kyc/SanctumKey/com/BuildConfig.class +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +1 -1
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +1 -1
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +1 -1
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/SanctumKey/com/SanctumKeySdkModule$definition$1$5$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/SanctumKey/com/SanctumKeySdkModule$definition$1$5$2.class +0 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/android/build/tmp/kotlin-classes/debug/kyc/SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$View$1.class +0 -0
- 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
- 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
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule.class → SanctumKey/com/SanctumKeySdkModule.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkView.class → SanctumKey/com/SanctumKeySdkView.class} +0 -0
- package/android/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkModule.kt +6 -6
- package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkView.kt +2 -2
- package/build/package.json +9 -7
- package/build/src/App.d.ts +2 -2
- package/build/src/App.d.ts.map +1 -1
- package/build/src/App.js +2 -2
- package/build/src/App.js.map +1 -1
- package/build/src/{TransfergratisSdk.types.d.ts → SanctumKeySdk.types.d.ts} +3 -3
- package/build/src/SanctumKeySdk.types.d.ts.map +1 -0
- package/build/src/SanctumKeySdk.types.js +2 -0
- package/build/src/SanctumKeySdk.types.js.map +1 -0
- package/build/src/{TransfergratisSdkModule.d.ts → SanctumKeySdkModule.d.ts} +4 -4
- package/build/src/SanctumKeySdkModule.d.ts.map +1 -0
- package/build/src/{TransfergratisSdkModule.js → SanctumKeySdkModule.js} +2 -2
- package/build/src/SanctumKeySdkModule.js.map +1 -0
- package/build/src/{TransfergratisSdkModule.web.d.ts → SanctumKeySdkModule.web.d.ts} +4 -4
- package/build/src/SanctumKeySdkModule.web.d.ts.map +1 -0
- package/build/src/{TransfergratisSdkModule.web.js → SanctumKeySdkModule.web.js} +3 -3
- package/build/src/SanctumKeySdkModule.web.js.map +1 -0
- package/build/src/SanctumKeySdkView.d.ts +4 -0
- package/build/src/SanctumKeySdkView.d.ts.map +1 -0
- package/build/src/SanctumKeySdkView.js +7 -0
- package/build/src/SanctumKeySdkView.js.map +1 -0
- package/build/src/SanctumKeySdkView.web.d.ts +4 -0
- package/build/src/SanctumKeySdkView.web.d.ts.map +1 -0
- package/build/src/{TransfergratisSdkView.web.js → SanctumKeySdkView.web.js} +2 -2
- package/build/src/SanctumKeySdkView.web.js.map +1 -0
- package/build/src/api/axios.js +2 -2
- package/build/src/api/axios.js.map +1 -1
- package/build/src/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/src/components/EnhancedCameraView.js +107 -330
- package/build/src/components/EnhancedCameraView.js.map +1 -1
- package/build/src/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/EmailVerificationTemplate.js +114 -15
- package/build/src/components/KYCElements/EmailVerificationTemplate.js.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.js +166 -695
- package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/src/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/PhoneVerificationTemplate.js +282 -40
- package/build/src/components/KYCElements/PhoneVerificationTemplate.js.map +1 -1
- package/build/src/components/KYCElements/SelfieCapture.d.ts +1 -1
- package/build/src/components/KYCElements/SelfieCapture.d.ts.map +1 -1
- package/build/src/components/KYCElements/SelfieCapture.js +130 -192
- package/build/src/components/KYCElements/SelfieCapture.js.map +1 -1
- package/build/src/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/SelfieCaptureTemplate.js +131 -433
- package/build/src/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/src/components/NativeCameraView.js +1 -1
- package/build/src/components/NativeCameraView.js.map +1 -1
- package/build/src/components/OverLay/IdCard.d.ts +3 -2
- package/build/src/components/OverLay/IdCard.d.ts.map +1 -1
- package/build/src/components/OverLay/IdCard.js +149 -141
- package/build/src/components/OverLay/IdCard.js.map +1 -1
- package/build/src/components/OverLay/SelfieOverlay.d.ts +2 -1
- package/build/src/components/OverLay/SelfieOverlay.d.ts.map +1 -1
- package/build/src/components/OverLay/SelfieOverlay.js +37 -95
- package/build/src/components/OverLay/SelfieOverlay.js.map +1 -1
- package/build/src/components/OverLay/type.d.ts +1 -0
- package/build/src/components/OverLay/type.d.ts.map +1 -1
- package/build/src/components/OverLay/type.js.map +1 -1
- package/build/src/components/Svgs/scanningLine.d.ts +2 -1
- package/build/src/components/Svgs/scanningLine.d.ts.map +1 -1
- package/build/src/components/Svgs/scanningLine.js +55 -51
- package/build/src/components/Svgs/scanningLine.js.map +1 -1
- package/build/src/config/KYCConfig.js +1 -1
- package/build/src/config/KYCConfig.js.map +1 -1
- package/build/src/config/allowedDomains.js +6 -6
- package/build/src/config/allowedDomains.js.map +1 -1
- package/build/src/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/src/hooks/useTemplateKYCFlow.js +37 -38
- package/build/src/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/src/index.d.ts +3 -3
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +3 -3
- package/build/src/index.js.map +1 -1
- package/build/src/modules/api/CardAuthentification.d.ts +0 -5
- package/build/src/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/src/modules/api/CardAuthentification.js +114 -116
- package/build/src/modules/api/CardAuthentification.js.map +1 -1
- package/build/src/modules/api/KYCService.d.ts +12 -1
- package/build/src/modules/api/KYCService.d.ts.map +1 -1
- package/build/src/modules/api/KYCService.js +102 -38
- package/build/src/modules/api/KYCService.js.map +1 -1
- package/build/src/modules/camera/NativeCameraModule.js +17 -17
- package/build/src/modules/camera/NativeCameraModule.js.map +1 -1
- package/expo-module.config.json +2 -2
- package/ios/TransfergratisSdk.podspec +2 -2
- package/ios/TransfergratisSdkModule.swift +12 -12
- package/package.json +9 -7
- package/src/App.tsx +2 -2
- package/src/{TransfergratisSdk.types.ts → SanctumKeySdk.types.ts} +2 -2
- package/src/{TransfergratisSdkModule.ts → SanctumKeySdkModule.ts} +3 -3
- package/src/{TransfergratisSdkModule.web.ts → SanctumKeySdkModule.web.ts} +3 -3
- package/src/SanctumKeySdkView.tsx +11 -0
- package/src/{TransfergratisSdkView.web.tsx → SanctumKeySdkView.web.tsx} +2 -2
- package/src/api/axios.ts +2 -2
- package/src/components/EnhancedCameraView.tsx +131 -385
- package/src/components/KYCElements/EmailVerificationTemplate.tsx +141 -26
- package/src/components/KYCElements/IDCardCapture.tsx +228 -868
- package/src/components/KYCElements/PhoneVerificationTemplate.tsx +342 -60
- package/src/components/KYCElements/SelfieCapture.tsx +184 -213
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +330 -662
- package/src/components/NativeCameraView.tsx +1 -1
- package/src/components/OverLay/IdCard.tsx +218 -217
- package/src/components/OverLay/SelfieOverlay.tsx +56 -134
- package/src/components/OverLay/type.ts +1 -0
- package/src/components/Svgs/scanningLine.tsx +71 -72
- package/src/config/KYCConfig.ts +1 -1
- package/src/config/allowedDomains.ts +6 -6
- package/src/hooks/useTemplateKYCFlow.tsx +45 -39
- package/src/i18n/README.md +1 -1
- package/src/index.ts +3 -3
- package/src/modules/api/CardAuthentification.ts +202 -200
- package/src/modules/api/KYCService.ts +169 -53
- package/src/modules/camera/NativeCameraModule.ts +17 -17
- package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$View$1.class +0 -0
- package/build/src/TransfergratisSdk.types.d.ts.map +0 -1
- package/build/src/TransfergratisSdk.types.js +0 -2
- package/build/src/TransfergratisSdk.types.js.map +0 -1
- package/build/src/TransfergratisSdkModule.d.ts.map +0 -1
- package/build/src/TransfergratisSdkModule.js.map +0 -1
- package/build/src/TransfergratisSdkModule.web.d.ts.map +0 -1
- package/build/src/TransfergratisSdkModule.web.js.map +0 -1
- package/build/src/TransfergratisSdkView.d.ts +0 -4
- package/build/src/TransfergratisSdkView.d.ts.map +0 -1
- package/build/src/TransfergratisSdkView.js +0 -7
- package/build/src/TransfergratisSdkView.js.map +0 -1
- package/build/src/TransfergratisSdkView.web.d.ts +0 -4
- package/build/src/TransfergratisSdkView.web.d.ts.map +0 -1
- package/build/src/TransfergratisSdkView.web.js.map +0 -1
- package/src/TransfergratisSdkView.tsx +0 -11
- /package/android/build/.transforms/{532c0e65d82f446633d0a7dab2772198 → ab90740579f5bd05b27b4343ada2d1c9}/results.bin +0 -0
- /package/android/build/.transforms/{532c0e65d82f446633d0a7dab2772198 → ab90740579f5bd05b27b4343ada2d1c9}/transformed/classes/classes_dex/classes.dex +0 -0
- /package/android/build/.transforms/{f62cb96b2d1f78ca96ab35932dd530dc → c9d62bb333688ab562f51958998d5a48}/results.bin +0 -0
- /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: '
|
|
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
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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.
|
|
113
|
+
<View style={styles.cameraContainerFullScreen}>
|
|
61
114
|
<EnhancedCameraView
|
|
62
|
-
instructions={cameraConfig.overlay?.guideText || 'Prenez un selfie clair'}
|
|
63
115
|
showCamera={true}
|
|
64
|
-
|
|
116
|
+
isProcessing={isBusy}
|
|
117
|
+
cameraType={cameraConfig.cameraType as 'front' | 'back'}
|
|
65
118
|
style={styles.camera}
|
|
66
|
-
onCapture={handleCapture}
|
|
67
119
|
onError={handleError}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
{
|
|
100
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
style={styles.
|
|
114
|
-
|
|
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
|
-
|
|
124
|
-
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
title: {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
+
});
|