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

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 (106) hide show
  1. package/README.md +4 -4
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/AndroidManifest.xml +1 -1
  4. package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkModule.kt +6 -6
  5. package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkView.kt +2 -2
  6. package/build/package.json +5 -5
  7. package/build/src/App.d.ts +2 -2
  8. package/build/src/App.d.ts.map +1 -1
  9. package/build/src/App.js +2 -2
  10. package/build/src/App.js.map +1 -1
  11. package/build/src/{SanctumKeySdk.types.d.ts → TransfergratisSdk.types.d.ts} +3 -3
  12. package/build/src/TransfergratisSdk.types.d.ts.map +1 -0
  13. package/build/src/TransfergratisSdk.types.js +2 -0
  14. package/build/src/TransfergratisSdk.types.js.map +1 -0
  15. package/build/src/{SanctumKeySdkModule.d.ts → TransfergratisSdkModule.d.ts} +4 -4
  16. package/build/src/TransfergratisSdkModule.d.ts.map +1 -0
  17. package/build/src/{SanctumKeySdkModule.js → TransfergratisSdkModule.js} +2 -2
  18. package/build/src/TransfergratisSdkModule.js.map +1 -0
  19. package/build/src/{SanctumKeySdkModule.web.d.ts → TransfergratisSdkModule.web.d.ts} +4 -4
  20. package/build/src/TransfergratisSdkModule.web.d.ts.map +1 -0
  21. package/build/src/{SanctumKeySdkModule.web.js → TransfergratisSdkModule.web.js} +3 -3
  22. package/build/src/TransfergratisSdkModule.web.js.map +1 -0
  23. package/build/src/TransfergratisSdkView.d.ts +4 -0
  24. package/build/src/TransfergratisSdkView.d.ts.map +1 -0
  25. package/build/src/TransfergratisSdkView.js +7 -0
  26. package/build/src/TransfergratisSdkView.js.map +1 -0
  27. package/build/src/TransfergratisSdkView.web.d.ts +4 -0
  28. package/build/src/TransfergratisSdkView.web.d.ts.map +1 -0
  29. package/build/src/{SanctumKeySdkView.web.js → TransfergratisSdkView.web.js} +2 -2
  30. package/build/src/TransfergratisSdkView.web.js.map +1 -0
  31. package/build/src/api/axios.js +2 -2
  32. package/build/src/api/axios.js.map +1 -1
  33. package/build/src/components/EnhancedCameraView.d.ts.map +1 -1
  34. package/build/src/components/EnhancedCameraView.js +12 -61
  35. package/build/src/components/EnhancedCameraView.js.map +1 -1
  36. package/build/src/components/KYCElements/CountrySelection.d.ts.map +1 -1
  37. package/build/src/components/KYCElements/CountrySelection.js +259 -63
  38. package/build/src/components/KYCElements/CountrySelection.js.map +1 -1
  39. package/build/src/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -1
  40. package/build/src/components/KYCElements/EmailVerificationTemplate.js +11 -32
  41. package/build/src/components/KYCElements/EmailVerificationTemplate.js.map +1 -1
  42. package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
  43. package/build/src/components/KYCElements/IDCardCapture.js +222 -68
  44. package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
  45. package/build/src/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -1
  46. package/build/src/components/KYCElements/PhoneVerificationTemplate.js +9 -11
  47. package/build/src/components/KYCElements/PhoneVerificationTemplate.js.map +1 -1
  48. package/build/src/components/NativeCameraView.js +1 -1
  49. package/build/src/components/NativeCameraView.js.map +1 -1
  50. package/build/src/config/KYCConfig.js +1 -1
  51. package/build/src/config/KYCConfig.js.map +1 -1
  52. package/build/src/config/allowedDomains.js +6 -6
  53. package/build/src/config/allowedDomains.js.map +1 -1
  54. package/build/src/config/region_mapping.json +727 -0
  55. package/build/src/index.d.ts +3 -3
  56. package/build/src/index.d.ts.map +1 -1
  57. package/build/src/index.js +3 -3
  58. package/build/src/index.js.map +1 -1
  59. package/build/src/modules/api/CardAuthentification.d.ts.map +1 -1
  60. package/build/src/modules/api/CardAuthentification.js +3 -7
  61. package/build/src/modules/api/CardAuthentification.js.map +1 -1
  62. package/build/src/modules/api/KYCService.d.ts +1 -2
  63. package/build/src/modules/api/KYCService.d.ts.map +1 -1
  64. package/build/src/modules/api/KYCService.js +103 -63
  65. package/build/src/modules/api/KYCService.js.map +1 -1
  66. package/build/src/modules/camera/NativeCameraModule.js +17 -17
  67. package/build/src/modules/camera/NativeCameraModule.js.map +1 -1
  68. package/expo-module.config.json +2 -2
  69. package/ios/TransfergratisSdk.podspec +2 -2
  70. package/ios/TransfergratisSdkModule.swift +12 -12
  71. package/package.json +5 -5
  72. package/src/App.tsx +2 -2
  73. package/src/{SanctumKeySdk.types.ts → TransfergratisSdk.types.ts} +2 -2
  74. package/src/{SanctumKeySdkModule.ts → TransfergratisSdkModule.ts} +3 -3
  75. package/src/{SanctumKeySdkModule.web.ts → TransfergratisSdkModule.web.ts} +3 -3
  76. package/src/TransfergratisSdkView.tsx +11 -0
  77. package/src/{SanctumKeySdkView.web.tsx → TransfergratisSdkView.web.tsx} +2 -2
  78. package/src/api/axios.ts +2 -2
  79. package/src/components/EnhancedCameraView.tsx +34 -99
  80. package/src/components/KYCElements/CountrySelection.tsx +300 -74
  81. package/src/components/KYCElements/EmailVerificationTemplate.tsx +10 -36
  82. package/src/components/KYCElements/IDCardCapture.tsx +310 -156
  83. package/src/components/KYCElements/PhoneVerificationTemplate.tsx +9 -11
  84. package/src/components/NativeCameraView.tsx +1 -1
  85. package/src/config/KYCConfig.ts +1 -1
  86. package/src/config/allowedDomains.ts +6 -6
  87. package/src/i18n/README.md +1 -1
  88. package/src/index.ts +3 -3
  89. package/src/modules/api/CardAuthentification.ts +5 -8
  90. package/src/modules/api/KYCService.ts +167 -116
  91. package/src/modules/camera/NativeCameraModule.ts +17 -17
  92. package/build/src/SanctumKeySdk.types.d.ts.map +0 -1
  93. package/build/src/SanctumKeySdk.types.js +0 -2
  94. package/build/src/SanctumKeySdk.types.js.map +0 -1
  95. package/build/src/SanctumKeySdkModule.d.ts.map +0 -1
  96. package/build/src/SanctumKeySdkModule.js.map +0 -1
  97. package/build/src/SanctumKeySdkModule.web.d.ts.map +0 -1
  98. package/build/src/SanctumKeySdkModule.web.js.map +0 -1
  99. package/build/src/SanctumKeySdkView.d.ts +0 -4
  100. package/build/src/SanctumKeySdkView.d.ts.map +0 -1
  101. package/build/src/SanctumKeySdkView.js +0 -7
  102. package/build/src/SanctumKeySdkView.js.map +0 -1
  103. package/build/src/SanctumKeySdkView.web.d.ts +0 -4
  104. package/build/src/SanctumKeySdkView.web.d.ts.map +0 -1
  105. package/build/src/SanctumKeySdkView.web.js.map +0 -1
  106. package/src/SanctumKeySdkView.tsx +0 -11
@@ -1 +1 @@
1
- {"version":3,"file":"EmailVerificationTemplate.js","sourceRoot":"","sources":["../../../../src/components/KYCElements/EmailVerificationTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAErG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,UAAU,EAAE,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAWxE,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,mDAAmD;AACnD,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACjD,MAAM,YAAY,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,yBAAyB,GAA6C,CAAC,EAChF,SAAS,EACT,KAAK,EACL,aAAa,EACb,KAAK,EAAE,SAAS,GACnB,EAAE,EAAE;IACD,MAAM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QACrB,SAAS,EAAE,EAAE;KAChB;IACD,eAAe,EAAE;QACb,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACV,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,MAAM;KAChB;IACD,UAAU,EAAE;QACR,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,EAAE;QACZ,kBAAkB,EAAE,WAAW;KAClC;CACJ,CAAC,CAAC","sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\nimport { View, Text, StyleSheet, TextInput, TouchableOpacity, Alert, Pressable } from 'react-native';\nimport { TemplateComponent, LocalizedText } from '../../types/KYC.types';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport { Button } from '../ui/Button';\nimport kycService, { errorMessage } from '../../modules/api/KYCService';\n\ninterface EmailVerificationTemplateProps {\n component: TemplateComponent;\n value?: any;\n onValueChange: (data: any) => void;\n error?: string;\n language?: string;\n}\n\ntype VerificationStep = 'email' | 'otp';\nconst CODE_LENGTH = 6;\n\n/** RFC-style email validation: local@domain.tld */\nconst EMAIL_REGEX = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst isValidEmail = (value: string): boolean => EMAIL_REGEX.test((value || '').trim());\n\nexport const EmailVerificationTemplate: React.FC<EmailVerificationTemplateProps> = ({\n component,\n value,\n onValueChange,\n error: propError,\n}) => {\n const { actions, getLocalizedText, state, apiKey } = useTemplateKYCFlowContext();\n const { t } = useI18n();\n\n const auth = apiKey ? { apiKey } : (state.session.token ? { token: state.session.token } : undefined);\n\n // State\n const [step, setStep] = useState<VerificationStep>('email');\n const [email, setEmail] = useState('');\n const [otp, setOtp] = useState('');\n const [localError, setLocalError] = useState<string | null>(null);\n const [isSimulating, setIsSimulating] = useState(false);\n \n // 🚨 NEW: Track actual focus state for visual feedback\n const [isInputFocused, setIsInputFocused] = useState(false);\n\n const inputRef = useRef<TextInput>(null);\n\n const title = getLocalizedText(component.labels as LocalizedText);\n const instructions = getLocalizedText(component.instructions as LocalizedText);\n\n // Determine button text based on step\n const verifyButtonText = getLocalizedText((component.ui as any).buttonText) || t('common.verify') || 'Verify';\n const sendButtonText = t('common.sendCode') || 'Send Verification Code';\n const buttonText = step === 'email' ? sendButtonText : verifyButtonText;\n\n // --- AUTO SUBMIT LOGIC ---\n useEffect(() => {\n if (otp.length === CODE_LENGTH && step === 'otp' && !isSimulating) {\n handleVerifyCode();\n }\n }, [otp]);\n\n // --- AUTO FOCUS LOGIC ---\n useEffect(() => {\n let focusTimer: ReturnType<typeof setTimeout>;\n \n // Only attempt focus when we are on the OTP step AND the loading state is completely finished\n if (step === 'otp' && !isSimulating) {\n focusTimer = setTimeout(() => {\n inputRef.current?.focus();\n }, 100); \n }\n \n return () => {\n if (focusTimer) clearTimeout(focusTimer);\n };\n }, [step, isSimulating]);\n\n const handleSendCode = async () => {\n const trimmed = email.trim();\n if (!trimmed || !isValidEmail(trimmed)) {\n setLocalError(t('errors.invalidEmail') || 'Please enter a valid email address');\n return;\n }\n\n setLocalError(null);\n setIsSimulating(true);\n\n try {\n await kycService.sendEmailVerificationCode(trimmed, auth);\n setStep('otp');\n // Note: Removed the buggy setTimeout from here. The useEffect handles it now!\n } catch (err: any) {\n const msg = errorMessage(err) ?? err?.message ?? (t('errors.sendCodeFailed') || 'Failed to send verification code');\n setLocalError(typeof msg === 'string' ? msg : JSON.stringify(msg));\n } finally {\n setIsSimulating(false);\n }\n };\n\n const handleVerifyCode = async () => {\n if (!otp || otp.length < CODE_LENGTH) {\n setLocalError(t('errors.invalidCode') || 'Please enter the 6-digit code');\n return;\n }\n\n setLocalError(null);\n setIsSimulating(true);\n\n try {\n await kycService.verifyEmailCode(otp.trim(), auth);\n const data = { email, otp, verified: true };\n onValueChange(data);\n actions.nextComponent(data);\n } catch (err: any) {\n const msg = errorMessage(err) ?? err?.message ?? (t('errors.wrongCode') || 'Invalid verification code');\n setLocalError(typeof msg === 'string' ? msg : JSON.stringify(msg));\n setOtp(''); \n inputRef.current?.focus(); // Refocus on error\n } finally {\n setIsSimulating(false);\n }\n };\n\n const onChangeEmail = (text: string) => {\n setEmail(text);\n if (localError) setLocalError(null);\n };\n\n const onChangeOtp = (text: string) => {\n // Only allow numbers\n const cleaned = text.replace(/[^0-9]/g, '');\n setOtp(cleaned);\n if (localError) setLocalError(null);\n };\n\n const handleBackToEmail = () => {\n setStep('email');\n setOtp('');\n setLocalError(null);\n };\n\n const renderOtpBoxes = () => {\n const boxes = new Array(CODE_LENGTH).fill(0);\n return (\n <Pressable style={styles.otpBoxesContainer} onPress={() => inputRef.current?.focus()}>\n {boxes.map((_, index) => {\n const digit = otp[index] || '';\n const isFilled = index < otp.length;\n \n // 🚨 NEW: Only highlight if the input is ACTUALLY focused. \n const isActiveIndex = index === otp.length || (index === CODE_LENGTH - 1 && otp.length === CODE_LENGTH);\n const isCurrent = isInputFocused && isActiveIndex;\n\n return (\n <View \n key={index} \n style={[\n styles.otpBox, \n isFilled && styles.otpBoxFilled,\n isCurrent && styles.otpBoxActive // Active overrides filled\n ]}\n >\n <Text style={styles.otpBoxText}>{digit}</Text>\n </View>\n );\n })}\n </Pressable>\n );\n };\n\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{title}</Text>\n <Text style={styles.instructions}>\n {step === 'email' ? instructions : (t('kyc.enterCodeSent') || `Please enter the code sent to ${email}`)}\n </Text>\n\n <View style={styles.contentContainer}>\n {step === 'email' ? (\n <View style={styles.inputContainer}>\n <Text style={styles.label}>{t('common.email') || 'Email'}</Text>\n <TextInput\n style={styles.input}\n placeholder=\"name@example.com\"\n value={email}\n onChangeText={onChangeEmail}\n keyboardType=\"email-address\"\n autoCapitalize=\"none\"\n autoCorrect={false}\n editable={!isSimulating}\n />\n </View>\n ) : (\n <View style={styles.inputContainer}>\n <Text style={styles.label}>{t('common.verificationCode') || 'Verification Code'}</Text>\n \n <View style={styles.otpWrapper}>\n {renderOtpBoxes()}\n \n <TextInput\n ref={inputRef}\n style={styles.hiddenInput}\n value={otp}\n onChangeText={onChangeOtp}\n keyboardType=\"number-pad\"\n maxLength={CODE_LENGTH}\n editable={!isSimulating}\n textContentType=\"oneTimeCode\"\n caretHidden={true}\n // 🚨 NEW: Track focus state\n onFocus={() => setIsInputFocused(true)}\n onBlur={() => setIsInputFocused(false)}\n />\n </View>\n\n <TouchableOpacity onPress={handleBackToEmail} style={styles.changeEmailLink} disabled={isSimulating}>\n <Text style={styles.changeEmailText}>{t('common.changeEmail') || 'Change email'}</Text>\n </TouchableOpacity>\n </View>\n )}\n\n {(localError || propError) && (\n <Text style={styles.errorText}>{localError || propError}</Text>\n )}\n\n <Button\n title={isSimulating ? (t('common.processing') || 'Processing...') : buttonText}\n onPress={step === 'email' ? handleSendCode : handleVerifyCode}\n style={styles.button}\n disabled={\n isSimulating ||\n (step === 'email' ? !email : otp.length < CODE_LENGTH)\n }\n />\n\n {step === 'otp' && (\n <TouchableOpacity\n onPress={async () => {\n if (isSimulating) return;\n setLocalError(null);\n setIsSimulating(true);\n try {\n await kycService.sendEmailVerificationCode(email.trim(), auth);\n Alert.alert(\n t('common.codeResent') || 'Code Resent',\n t('common.codeResentMessage', { email }) || 'Code resent to ' + email\n );\n // Refocus after resending\n inputRef.current?.focus();\n } catch (err: any) {\n const msg = errorMessage(err) ?? err?.message ?? (t('errors.sendCodeFailed') || 'Failed to send code');\n setLocalError(typeof msg === 'string' ? msg : JSON.stringify(msg));\n } finally {\n setIsSimulating(false);\n }\n }}\n style={styles.resendButton}\n disabled={isSimulating}\n >\n <Text style={styles.resendText}>{t('common.resendCode') || 'Resend Code'}</Text>\n </TouchableOpacity>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n padding: 24,\n backgroundColor: 'white',\n borderRadius: 16,\n margin: 16,\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 4 },\n shadowOpacity: 0.1,\n shadowRadius: 12,\n elevation: 5,\n width: '95%',\n },\n title: {\n fontSize: 24,\n fontWeight: '700',\n marginBottom: 8,\n color: '#1a1a1a',\n textAlign: 'center',\n },\n instructions: {\n fontSize: 16,\n color: '#666',\n marginBottom: 32,\n lineHeight: 24,\n textAlign: 'center',\n },\n contentContainer: {},\n inputContainer: {\n marginBottom: 24,\n },\n label: {\n fontSize: 14,\n fontWeight: '600',\n color: '#333',\n marginBottom: 8,\n marginLeft: 4,\n },\n input: {\n borderWidth: 1,\n borderColor: '#e0e0e0',\n padding: 16,\n borderRadius: 12,\n fontSize: 16,\n backgroundColor: '#f8f9fa',\n color: '#333',\n },\n otpWrapper: {\n position: 'relative',\n width: '100%',\n height: 60,\n },\n otpBoxesContainer: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n width: '100%',\n height: '100%',\n },\n otpBox: {\n width: '14%',\n aspectRatio: 1, // keeps it perfectly square\n borderWidth: 1,\n borderColor: '#e0e0e0',\n borderRadius: 12,\n backgroundColor: '#f8f9fa',\n justifyContent: 'center',\n alignItems: 'center',\n },\n otpBoxFilled: {\n borderColor: '#9ca3af',\n backgroundColor: '#ffffff',\n },\n otpBoxActive: {\n borderColor: '#2DBD60',\n borderWidth: 2,\n backgroundColor: '#ffffff',\n },\n otpBoxText: {\n fontSize: 24,\n fontWeight: '700',\n color: '#1a1a1a',\n },\n hiddenInput: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n opacity: 0, // completely invisible but handles native keyboard interactions perfectly\n },\n errorText: {\n color: '#dc2626',\n marginBottom: 16,\n fontSize: 14,\n textAlign: 'center',\n backgroundColor: '#fee2e2',\n padding: 8,\n borderRadius: 8,\n overflow: 'hidden',\n },\n button: {\n height: 50,\n borderRadius: 12,\n width: \"100%\",\n },\n changeEmailLink: {\n alignSelf: 'flex-end',\n marginTop: 12,\n },\n changeEmailText: {\n color: '#2DBD60',\n fontSize: 14,\n fontWeight: '500',\n },\n resendButton: {\n marginTop: 16,\n alignItems: 'center',\n width: \"100%\",\n },\n resendText: {\n color: '#666',\n fontSize: 14,\n textDecorationLine: 'underline',\n },\n});"]}
1
+ {"version":3,"file":"EmailVerificationTemplate.js","sourceRoot":"","sources":["../../../../src/components/KYCElements/EmailVerificationTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAErG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,UAAU,EAAE,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAWxE,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,mDAAmD;AACnD,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACjD,MAAM,YAAY,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,yBAAyB,GAA6C,CAAC,EAChF,SAAS,EACT,KAAK,EACL,aAAa,EACb,KAAK,EAAE,SAAS,GACnB,EAAE,EAAE;IACD,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,yBAAyB,EAAE,CAAC;IACjF,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IAExB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,K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,EAAE,QAAQ;KACrB;IACD,MAAM,EAAE;QACJ,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,KAAK,EAAE,MAAM;KAChB;IACD,eAAe,EAAE;QACb,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,EAAE;KAChB;IACD,eAAe,EAAE;QACb,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACV,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,MAAM;KAChB;IACD,UAAU,EAAE;QACR,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,EAAE;QACZ,kBAAkB,EAAE,WAAW;KAClC;CACJ,CAAC,CAAC","sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\nimport { View, Text, StyleSheet, TextInput, TouchableOpacity, Alert, Pressable } from 'react-native';\nimport { TemplateComponent, LocalizedText } from '../../types/KYC.types';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport { Button } from '../ui/Button';\nimport kycService, { errorMessage } from '../../modules/api/KYCService';\n\ninterface EmailVerificationTemplateProps {\n component: TemplateComponent;\n value?: any;\n onValueChange: (data: any) => void;\n error?: string;\n language?: string;\n}\n\ntype VerificationStep = 'email' | 'otp';\nconst CODE_LENGTH = 6;\n\n/** RFC-style email validation: local@domain.tld */\nconst EMAIL_REGEX = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst isValidEmail = (value: string): boolean => EMAIL_REGEX.test((value || '').trim());\n\nexport const EmailVerificationTemplate: React.FC<EmailVerificationTemplateProps> = ({\n component,\n value,\n onValueChange,\n error: propError,\n}) => {\n const { actions, getLocalizedText, state, apiKey } = useTemplateKYCFlowContext();\n const { t } = useI18n();\n\n const auth = apiKey ? { apiKey } : (state.session.token ? { token: state.session.token } : undefined);\n\n // State\n const [step, setStep] = useState<VerificationStep>('email');\n const [email, setEmail] = useState('');\n const [otp, setOtp] = useState('');\n const [localError, setLocalError] = useState<string | null>(null);\n const [isSimulating, setIsSimulating] = useState(false);\n\n const inputRef = useRef<TextInput>(null);\n\n const title = getLocalizedText(component.labels as LocalizedText);\n const instructions = getLocalizedText(component.instructions as LocalizedText);\n\n // Determine button text based on step\n const verifyButtonText = getLocalizedText((component.ui as any).buttonText) || t('common.verify') || 'Verify';\n const sendButtonText = t('common.sendCode') || 'Send Verification Code';\n const buttonText = step === 'email' ? sendButtonText : verifyButtonText;\n\n // --- AUTO SUBMIT LOGIC ---\n useEffect(() => {\n if (otp.length === CODE_LENGTH && step === 'otp' && !isSimulating) {\n handleVerifyCode();\n }\n }, [otp]);\n\n const handleSendCode = async () => {\n const trimmed = email.trim();\n if (!trimmed || !isValidEmail(trimmed)) {\n setLocalError(t('errors.invalidEmail') || 'Please enter a valid email address');\n return;\n }\n\n setLocalError(null);\n setIsSimulating(true);\n\n try {\n await kycService.sendEmailVerificationCode(trimmed, auth);\n setStep('otp');\n // Auto-focus the OTP input shortly after switching steps\n setTimeout(() => inputRef.current?.focus(), 100);\n } catch (err: any) {\n const msg = errorMessage(err) ?? err?.message ?? (t('errors.sendCodeFailed') || 'Failed to send verification code');\n setLocalError(typeof msg === 'string' ? msg : JSON.stringify(msg));\n } finally {\n setIsSimulating(false);\n }\n };\n\n const handleVerifyCode = async () => {\n if (!otp || otp.length < CODE_LENGTH) {\n setLocalError(t('errors.invalidCode') || 'Please enter the 6-digit code');\n return;\n }\n\n setLocalError(null);\n setIsSimulating(true);\n\n try {\n await kycService.verifyEmailCode(otp.trim(), auth);\n const data = { email, otp, verified: true };\n onValueChange(data);\n actions.nextComponent(data);\n } catch (err: any) {\n const msg = errorMessage(err) ?? err?.message ?? (t('errors.wrongCode') || 'Invalid verification code');\n setLocalError(typeof msg === 'string' ? msg : JSON.stringify(msg));\n setOtp(''); // Clear the boxes on error so they can type again\n inputRef.current?.focus();\n } finally {\n setIsSimulating(false);\n }\n };\n\n const onChangeEmail = (text: string) => {\n setEmail(text);\n if (localError) setLocalError(null);\n };\n\n const onChangeOtp = (text: string) => {\n // Only allow numbers\n const cleaned = text.replace(/[^0-9]/g, '');\n setOtp(cleaned);\n if (localError) setLocalError(null);\n };\n\n const handleBackToEmail = () => {\n setStep('email');\n setOtp('');\n setLocalError(null);\n };\n\n const renderOtpBoxes = () => {\n const boxes = new Array(CODE_LENGTH).fill(0);\n return (\n <Pressable style={styles.otpBoxesContainer} onPress={() => inputRef.current?.focus()}>\n {boxes.map((_, index) => {\n const digit = otp[index] || '';\n const isCurrent = index === otp.length;\n const isFilled = index < otp.length;\n\n return (\n <View \n key={index} \n style={[\n styles.otpBox, \n isCurrent && styles.otpBoxActive,\n isFilled && styles.otpBoxFilled\n ]}\n >\n <Text style={styles.otpBoxText}>{digit}</Text>\n </View>\n );\n })}\n </Pressable>\n );\n };\n\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{title}</Text>\n <Text style={styles.instructions}>\n {step === 'email' ? instructions : (t('kyc.enterCodeSent') || `Please enter the code sent to ${email}`)}\n </Text>\n\n <View style={styles.contentContainer}>\n {step === 'email' ? (\n <View style={styles.inputContainer}>\n <Text style={styles.label}>{t('common.email') || 'Email'}</Text>\n <TextInput\n style={styles.input}\n placeholder=\"name@example.com\"\n value={email}\n onChangeText={onChangeEmail}\n keyboardType=\"email-address\"\n autoCapitalize=\"none\"\n autoCorrect={false}\n editable={!isSimulating}\n />\n </View>\n ) : (\n <View style={styles.inputContainer}>\n <Text style={styles.label}>{t('common.verificationCode') || 'Verification Code'}</Text>\n \n <View style={styles.otpWrapper}>\n {renderOtpBoxes()}\n {/* Hidden TextInput overlaid to handle native keyboard & pasting seamlessly */}\n <TextInput\n ref={inputRef}\n style={styles.hiddenInput}\n value={otp}\n onChangeText={onChangeOtp}\n keyboardType=\"number-pad\"\n maxLength={CODE_LENGTH}\n editable={!isSimulating}\n textContentType=\"oneTimeCode\"\n caretHidden={true}\n />\n </View>\n\n <TouchableOpacity onPress={handleBackToEmail} style={styles.changeEmailLink} disabled={isSimulating}>\n <Text style={styles.changeEmailText}>{t('common.changeEmail') || 'Change email'}</Text>\n </TouchableOpacity>\n </View>\n )}\n\n {(localError || propError) && (\n <Text style={styles.errorText}>{localError || propError}</Text>\n )}\n\n <Button\n title={isSimulating ? (t('common.processing') || 'Processing...') : buttonText}\n onPress={step === 'email' ? handleSendCode : handleVerifyCode}\n style={styles.button}\n disabled={\n isSimulating ||\n (step === 'email' ? !email : otp.length < CODE_LENGTH)\n }\n />\n\n {step === 'otp' && (\n <TouchableOpacity\n onPress={async () => {\n if (isSimulating) return;\n setLocalError(null);\n setIsSimulating(true);\n try {\n await kycService.sendEmailVerificationCode(email.trim(), auth);\n Alert.alert(\n t('common.codeResent') || 'Code Resent',\n t('common.codeResentMessage', { email }) || 'Code resent to ' + email\n );\n } catch (err: any) {\n const msg = errorMessage(err) ?? err?.message ?? (t('errors.sendCodeFailed') || 'Failed to send code');\n setLocalError(typeof msg === 'string' ? msg : JSON.stringify(msg));\n } finally {\n setIsSimulating(false);\n }\n }}\n style={styles.resendButton}\n disabled={isSimulating}\n >\n <Text style={styles.resendText}>{t('common.resendCode') || 'Resend Code'}</Text>\n </TouchableOpacity>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n padding: 24,\n backgroundColor: 'white',\n borderRadius: 16,\n margin: 16,\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 4 },\n shadowOpacity: 0.1,\n shadowRadius: 12,\n elevation: 5,\n width: '95%',\n },\n title: {\n fontSize: 24,\n fontWeight: '700',\n marginBottom: 8,\n color: '#1a1a1a',\n textAlign: 'center',\n },\n instructions: {\n fontSize: 16,\n color: '#666',\n marginBottom: 32,\n lineHeight: 24,\n textAlign: 'center',\n },\n contentContainer: {},\n inputContainer: {\n marginBottom: 24,\n },\n label: {\n fontSize: 14,\n fontWeight: '600',\n color: '#333',\n marginBottom: 8,\n marginLeft: 4,\n },\n input: {\n borderWidth: 1,\n borderColor: '#e0e0e0',\n padding: 16,\n borderRadius: 12,\n fontSize: 16,\n backgroundColor: '#f8f9fa',\n color: '#333',\n },\n otpWrapper: {\n position: 'relative',\n width: '100%',\n height: 60,\n },\n otpBoxesContainer: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n width: '100%',\n height: '100%',\n },\n otpBox: {\n width: '14%',\n aspectRatio: 1,\n borderWidth: 1,\n borderColor: '#e0e0e0',\n borderRadius: 12,\n backgroundColor: '#f8f9fa',\n justifyContent: 'center',\n alignItems: 'center',\n },\n otpBoxFilled: {\n borderColor: '#9ca3af',\n backgroundColor: '#ffffff',\n },\n otpBoxActive: {\n borderColor: '#2DBD60',\n borderWidth: 2,\n backgroundColor: '#ffffff',\n },\n otpBoxText: {\n fontSize: 24,\n fontWeight: '700',\n color: '#1a1a1a',\n },\n hiddenInput: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n opacity: 0,\n },\n errorText: {\n color: '#dc2626',\n marginBottom: 16,\n fontSize: 14,\n textAlign: 'center',\n backgroundColor: '#fee2e2',\n padding: 8,\n borderRadius: 8,\n overflow: 'hidden',\n },\n button: {\n height: 50,\n borderRadius: 12,\n width: \"100%\",\n },\n changeEmailLink: {\n alignSelf: 'flex-end',\n marginTop: 12,\n },\n changeEmailText: {\n color: '#2DBD60',\n fontSize: 14,\n fontWeight: '500',\n },\n resendButton: {\n marginTop: 16,\n alignItems: 'center',\n width: \"100%\",\n },\n resendText: {\n color: '#666',\n fontSize: 14,\n textDecorationLine: 'underline',\n },\n});"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IDCardCapture.d.ts","sourceRoot":"","sources":["../../../../src/components/KYCElements/IDCardCapture.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAI5D,OAAO,EAAE,iBAAiB,EAAoI,MAAM,uBAAuB,CAAC;AAW5L,UAAU,cAAc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ED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA8atD,CAAC"}
@@ -12,6 +12,13 @@ import { backVerification, checkTemplateType, frontVerification } from '../../mo
12
12
  import { getDocumentTypeInfo } from '../../utils/get-document-type-info';
13
13
  import pathToBase64 from '../../utils/pathToBase64';
14
14
  import { cropByObb, cropImageWithBBoxWithTolerance, getObbConfidence, OBB_CONFIDENCE_THRESHOLD } from '../../utils/cropByObb';
15
+ import REGION_MAPPING from '../../config/region_mapping.json';
16
+ // 🌍 Map ISO codes to exact JSON root keys to ensure perfect dictionary lookups
17
+ const ISO_TO_COUNTRY_NAME = {
18
+ 'KE': 'Kenya', 'CM': 'Cameroon', 'NG': 'Nigeria', 'CA': 'Canada',
19
+ 'FR': 'France', 'GH': 'Ghana', 'ZA': 'South Africa', 'GB': 'Britain',
20
+ 'CI': 'Ivory Coast', 'SN': 'Senegal', 'TG': 'Togo', 'ML': 'Mali'
21
+ };
15
22
  export const IDCardCapture = ({ component, value = {}, onValueChange, error, language = 'en' }) => {
16
23
  const { t, locale } = useI18n();
17
24
  const [showCamera, setShowCamera] = useState(false);
@@ -48,17 +55,20 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
48
55
  if (JSON.stringify(value) !== JSON.stringify(capturedImages)) {
49
56
  const updatedImages = value;
50
57
  setCapturedImages(updatedImages);
51
- Object.keys(updatedImages).forEach((side) => {
52
- const imageData = updatedImages[side];
53
- if (imageData?.dir) {
54
- setSilentCaptureResult(prev => ({
55
- ...prev, path: imageData.dir, success: true, isAnalyzing: false, mrz: imageData.mrz || '', templatePath: imageData.templatePath || '',
56
- }));
57
- }
58
- });
58
+ const currentImageData = updatedImages[currentSide];
59
+ if (currentImageData?.dir) {
60
+ setSilentCaptureResult(prev => ({
61
+ ...prev,
62
+ path: currentImageData.dir,
63
+ success: true,
64
+ isAnalyzing: false,
65
+ mrz: currentImageData.mrz || '',
66
+ templatePath: currentImageData.templatePath || '',
67
+ }));
68
+ }
59
69
  }
60
70
  }
61
- }, [value]);
71
+ }, [value, currentSide]);
62
72
  const cameraConfig = useMemo(() => {
63
73
  const instructions = selectedDocumentType
64
74
  ? (locale === 'en' ? getDocumentTypeInfo(selectedDocumentType.type).instructions.en : getDocumentTypeInfo(selectedDocumentType.type).instructions.fr)
@@ -69,7 +79,6 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
69
79
  };
70
80
  }, [selectedDocumentType, locale, component.instructions]);
71
81
  const retakePicture = (sideToRetake) => {
72
- // Completely wipe all processing states to prevent leakage
73
82
  setIsProcessingCapture(false);
74
83
  setProcessingImagePath(null);
75
84
  setSilentCaptureResult({ path: '', success: false, isAnalyzing: false, error: '', templatePath: '', mrz: '', bbox: undefined });
@@ -82,13 +91,30 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
82
91
  onValueChange(newValue);
83
92
  }
84
93
  };
85
- const getCurrentSideVerification = (currentSide) => {
86
- if (!selectedDocumentType || !countryData?.regionMapping)
94
+ const getCurrentSideVerification = (currentSide, countryKey) => {
95
+ const rawDocType = countrySelectionData?.documentType;
96
+ if (!rawDocType || !countryKey) {
87
97
  return { authMethod: [], mrzTypes: [], regionMapping: null, key: 'root' };
88
- const regionMapping = countryData.regionMapping[selectedDocumentType.type];
98
+ }
99
+ const rawCountryName = ISO_TO_COUNTRY_NAME[countryData?.code || ''] || countryData?.code || countryKey;
100
+ const baseMapping = REGION_MAPPING.regionMapping || REGION_MAPPING;
101
+ let countryMapping = baseMapping[rawCountryName];
102
+ // Fallback search in case of case mismatches
103
+ if (!countryMapping) {
104
+ const foundKey = Object.keys(baseMapping).find(k => k.toLowerCase() === rawCountryName.toLowerCase() || k.toLowerCase() === countryKey.toLowerCase());
105
+ if (foundKey)
106
+ countryMapping = baseMapping[foundKey];
107
+ }
108
+ if (!countryMapping) {
109
+ return { authMethod: [], mrzTypes: [], regionMapping: null, key: 'root' };
110
+ }
111
+ const regionMapping = countryMapping[rawDocType];
112
+ if (!regionMapping) {
113
+ return { authMethod: [], mrzTypes: [], regionMapping: null, key: 'root' };
114
+ }
89
115
  const authMethod = [];
90
116
  const mrzTypes = [];
91
- const key = selectedDocumentType.region?.trim()?.length > 0 ? selectedDocumentType.region.trim() : 'root';
117
+ const key = countrySelectionData.region?.trim()?.length > 0 ? countrySelectionData.region.trim() : 'root';
92
118
  if (regionMapping?.[key] && Array.isArray(regionMapping[key])) {
93
119
  regionMapping[key].forEach((item) => {
94
120
  if (item[currentSide]) {
@@ -168,16 +194,16 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
168
194
  return;
169
195
  if (result.success && result.path) {
170
196
  setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: true, success: false, error: '' }));
171
- let templatePath = silentCaptureResult.templatePath || '';
197
+ // 🚨 Force a template fetch if we haven't successfully saved the current side yet
198
+ let templatePath = capturedImages[currentSide]?.templatePath || '';
172
199
  let templateBbox;
173
200
  let templateResponse;
174
201
  if (!selectedDocumentType) {
175
202
  setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: 'Document type not selected' }));
176
203
  return;
177
204
  }
178
- const regionMappings = getCurrentSideVerification(currentSide);
179
205
  try {
180
- if (templatePath.length === 0) {
206
+ if (!templatePath) {
181
207
  const templateType = await checkTemplateType({ path: result.path || '', docType: selectedDocumentType?.type, docRegion: countryData?.code || "", postfix: currentSide }, env);
182
208
  templateResponse = templateType;
183
209
  if (templateType.template_path)
@@ -195,16 +221,33 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
195
221
  catch { }
196
222
  }
197
223
  }
224
+ const extractedCountryKey = templatePath ? templatePath.split('/')[0] : (ISO_TO_COUNTRY_NAME[countryData?.code || ''] || 'root');
225
+ const regionMappings = getCurrentSideVerification(currentSide, extractedCountryKey);
198
226
  let verificationRes;
199
227
  if (currentSide === 'front') {
200
228
  const matchedAuthMethod = getCorrespondingAuthMethod(templatePath, regionMappings.regionMapping, regionMappings.key || '', 'front');
201
- const mrzType = getCorrespondingMrzType(templatePath, regionMappings.regionMapping, regionMappings.key || '') || '';
229
+ const mrzType = getCorrespondingMrzType(templatePath, regionMappings.regionMapping, regionMappings.key || '') || 'TD1';
202
230
  verificationRes = await frontVerification({ path: result.path, regionMapping: { authMethod: matchedAuthMethod ? [matchedAuthMethod] : regionMappings.authMethod, mrzTypes: regionMappings.mrzTypes }, selectedDocumentType: GovernmentDocumentTypeShorted[selectedDocumentType?.type] || '', code: countryData?.code || '', currentSide, templatePath, mrzType }, env);
203
231
  }
204
232
  else {
205
- const matchedBackAuthMethod = getCorrespondingAuthMethod(templatePath, regionMappings.regionMapping, regionMappings.key || '', 'back');
206
- const backMrzType = getCorrespondingMrzType(templatePath, regionMappings.regionMapping, regionMappings.key || '') || '';
207
- verificationRes = await backVerification({ path: result.path, regionMapping: { authMethod: matchedBackAuthMethod ? [matchedBackAuthMethod] : regionMappings.authMethod, mrzTypes: regionMappings.mrzTypes }, selectedDocumentType: GovernmentDocumentTypeShorted[selectedDocumentType.type] || '', code: countryData?.code || '', currentSide, templatePath, mrzType: backMrzType, templateResponse }, env);
233
+ let matchedBackAuthMethod = getCorrespondingAuthMethod(templatePath, regionMappings.regionMapping, regionMappings.key || '', 'back');
234
+ if (!matchedBackAuthMethod && currentSide === 'back') {
235
+ matchedBackAuthMethod = 'MRZ';
236
+ }
237
+ const backMrzType = getCorrespondingMrzType(templatePath, regionMappings.regionMapping, regionMappings.key || '') || 'TD1';
238
+ verificationRes = await backVerification({
239
+ path: result.path,
240
+ regionMapping: {
241
+ authMethod: matchedBackAuthMethod ? [matchedBackAuthMethod] : regionMappings.authMethod,
242
+ mrzTypes: regionMappings.mrzTypes
243
+ },
244
+ selectedDocumentType: GovernmentDocumentTypeShorted[selectedDocumentType.type] || '',
245
+ code: countryData?.code || '',
246
+ currentSide,
247
+ templatePath,
248
+ mrzType: backMrzType,
249
+ templateResponse
250
+ }, env);
208
251
  }
209
252
  const bbox = verificationRes?.bbox || templateBbox;
210
253
  const mrz = verificationRes?.mrz ? JSON.stringify(verificationRes.mrz) : "";
@@ -229,7 +272,7 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
229
272
  useEffect(() => { actions.showCustomStepper(!showCamera); }, [showCamera]);
230
273
  if (!countrySelectionData || !selectedDocumentType) {
231
274
  return (<View style={styles.root}>
232
- <View style={styles.container}>
275
+ <View style={styles.previewContainer}>
233
276
  <Text style={styles.title}>{getLocalizedText(component.labels)}</Text>
234
277
  <Text style={styles.description}>
235
278
  {state.currentLanguage === "en" ? "Please complete the country and document selection first." : "Veuillez d'abord compléter la sélection du pays et du document."}
@@ -240,33 +283,45 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
240
283
  // --- CAMERA RENDER ---
241
284
  if (showCamera) {
242
285
  const isBusy = isProcessingCapture;
243
- return (<View style={styles.cameraContainer}>
244
- <EnhancedCameraView key={currentSide} showCamera={true} isProcessing={isBusy} cameraType={cameraConfig.cameraType} style={styles.camera} onError={handleError} onSilentCapture={handleSilentCapture} silentCaptureResult={silentCaptureResult} overlayComponent={<>
245
- {!isBusy && silentCaptureResult.isAnalyzing && (<View style={styles.topAnalyzingPillContainer}>
246
- <View style={styles.topAnalyzingPill}>
247
- <ActivityIndicator size="small" color="white"/>
248
- <Text style={styles.analyzingPillText}>
249
- {state.currentLanguage === 'en' ? 'Scanning...' : 'Analyse...'}
250
- </Text>
251
- </View>
252
- </View>)}
253
-
254
- {isBusy && (<View style={StyleSheet.absoluteFillObject}>
255
- {processingImagePath && (<Image source={{ uri: processingImagePath.startsWith('file://') ? processingImagePath : `file://${processingImagePath}` }} style={StyleSheet.absoluteFillObject} resizeMode="cover"/>)}
256
- <View style={styles.processingOverlay}>
257
- <ActivityIndicator size="large" color="#2DBD60"/>
258
- <Text style={styles.processingText}>
259
- {state.currentLanguage === 'en' ? 'Perfect!\nProcessing Document...' : 'Parfait!\nTraitement du document...'}
260
- </Text>
261
- </View>
262
- </View>)}
286
+ return (<View style={styles.root}>
287
+ <View style={styles.cameraWrapper}>
288
+
289
+ {/* Web/Desktop Clean Header */}
290
+ <View style={styles.headerContainer}>
291
+ <Text style={styles.headerTitle}>
292
+ {selectedDocumentType ? (locale === 'en' ? getDocumentTypeInfo(selectedDocumentType.type).name.en : getDocumentTypeInfo(selectedDocumentType.type).name.fr) : ''}
293
+ </Text>
294
+ <View style={styles.stepBadge}>
295
+ <Text style={styles.stepText}>
296
+ {t('kyc.idCardCapture.captureTitle', { side: currentSide === 'front' ? locale === 'en' ? 'Front' : 'Recto' : locale === 'en' ? 'Back' : 'Verso' })}
297
+ </Text>
298
+ </View>
299
+ </View>
263
300
 
264
- <IdCardOverlay xMin={cameraConfig.overlay.bbox.xMin} yMin={cameraConfig.overlay.bbox.yMin} xMax={cameraConfig.overlay.bbox.xMax} yMax={cameraConfig.overlay.bbox.yMax} instructions={cameraConfig.overlay.guideText} cornerOpacity={cameraConfig.overlay.bbox.cornerRadius || 0} isSuccess={silentCaptureResult.success} language={state.currentLanguage} stepperProps={{
301
+ <View style={styles.cameraFeedContainer}>
302
+ <EnhancedCameraView key={currentSide} showCamera={true} isProcessing={isBusy} cameraType={cameraConfig.cameraType} style={styles.camera} onError={handleError} onSilentCapture={handleSilentCapture} silentCaptureResult={silentCaptureResult} overlayComponent={<>
303
+ {!isBusy && silentCaptureResult.isAnalyzing && (<View style={styles.topAnalyzingPillContainer}>
304
+ <View style={styles.topAnalyzingPill}>
305
+ <ActivityIndicator size="small" color="white"/>
306
+ <Text style={styles.analyzingPillText}>
307
+ {state.currentLanguage === 'en' ? 'Scanning...' : 'Analyse...'}
308
+ </Text>
309
+ </View>
310
+ </View>)}
311
+ {isBusy && (<View style={StyleSheet.absoluteFillObject}>
312
+ {processingImagePath && (<Image source={{ uri: processingImagePath.startsWith('file://') ? processingImagePath : `file://${processingImagePath}` }} style={StyleSheet.absoluteFillObject} resizeMode="cover"/>)}
313
+ <View style={styles.processingOverlay}>
314
+ <ActivityIndicator size="large" color="#2DBD60"/>
315
+ <Text style={styles.processingText}>
316
+ {state.currentLanguage === 'en' ? 'Perfect!\nProcessing Document...' : 'Parfait!\nTraitement du document...'}
317
+ </Text>
318
+ </View>
319
+ </View>)}
320
+ <IdCardOverlay xMin={cameraConfig.overlay.bbox.xMin} yMin={cameraConfig.overlay.bbox.yMin} xMax={cameraConfig.overlay.bbox.xMax} yMax={cameraConfig.overlay.bbox.yMax} instructions={cameraConfig.overlay.guideText} cornerOpacity={cameraConfig.overlay.bbox.cornerRadius || 0} isSuccess={silentCaptureResult.success} language={state.currentLanguage} stepperProps={{
265
321
  back: () => {
266
322
  if (currentSide === 'back') {
267
323
  setCurrentSide('front');
268
324
  setShowCamera(false);
269
- // 🚨 Clean up any residual state when going backwards
270
325
  setIsProcessingCapture(false);
271
326
  setProcessingImagePath(null);
272
327
  if (capturedImages['front']?.dir) {
@@ -284,11 +339,13 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
284
339
  selectedDocumentType: selectedDocumentType ? (locale === 'en' ? getDocumentTypeInfo(selectedDocumentType.type).name.en : getDocumentTypeInfo(selectedDocumentType.type).name.fr) : '',
285
340
  step: state.currentComponentIndex + 1, totalSteps: state.template.components.length, side: currentSide,
286
341
  }}/>
287
- </>}/>
288
-
289
- {silentCaptureResult.error && !isBusy ? (<View style={styles.floatingErrorBanner}>
290
- <Text style={styles.floatingErrorText}>{silentCaptureResult.error}</Text>
291
- </View>) : null}
342
+ </>}/>
343
+ {/* Elegant Floating Error Banner below the cutout */}
344
+ {silentCaptureResult.error && !isBusy ? (<View style={styles.floatingErrorBanner}>
345
+ <Text style={styles.floatingErrorText}>⚠️ {silentCaptureResult.error}</Text>
346
+ </View>) : null}
347
+ </View>
348
+ </View>
292
349
  </View>);
293
350
  }
294
351
  return (<View style={styles.root}>
@@ -302,19 +359,15 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
302
359
  {getLocalizedText(component.instructions)}
303
360
  </Text>
304
361
  <View style={{ alignItems: 'center', justifyContent: 'center', flexDirection: "column", gap: 16 }}>
305
-
306
362
  {silentCaptureResult?.error === 'TOO_FAR_AWAY' && (<View style={styles.warningBanner}>
307
363
  <Text style={styles.warningText}>
308
364
  {state.currentLanguage === "en" ? "Move the document closer to the camera and place it on a flat surface." : "Veuillez rapprocher le document de la caméra et le poser à plat."}
309
365
  </Text>
310
366
  </View>)}
311
-
312
367
  <View style={styles.imagePreviewWrapper}>
313
368
  {capturedImages[currentSide]?.dir ? (<Image source={{ uri: capturedImages[currentSide].dir }} style={styles.previewImage}/>) : silentCaptureResult.path ? (<Image source={{ uri: silentCaptureResult.path }} style={styles.previewImage}/>) : null}
314
369
  </View>
315
-
316
370
  {!capturedImages[currentSide]?.dir && (<Button title={state.currentLanguage === "en" ? "Start Scanning" : "Commencer la numérisation"} onPress={() => { setShowCamera(true); actions.showCustomStepper(false); }} variant="primary" size="large" fullWidth/>)}
317
-
318
371
  {capturedImages[currentSide]?.dir && (<>
319
372
  <Button title={t('kyc.idCardCapture.retakeButton')} onPress={() => retakePicture(currentSide)} variant="outline" size="medium" fullWidth/>
320
373
  <Button title={t('common.next')} onPress={() => {
@@ -322,14 +375,13 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
322
375
  showAlert('Error', 'Document type not selected');
323
376
  return;
324
377
  }
325
- // 🚨 BUG FIX: Clear all state before moving forward
326
378
  if (currentSide === 'back' || selectedDocumentType.type === 'passport') {
327
379
  actions.nextComponent();
328
380
  }
329
381
  else {
330
382
  setShowCamera(true);
331
383
  setCurrentSide('back');
332
- setSilentCaptureResult({ success: false, isAnalyzing: false, path: '', error: '' });
384
+ setSilentCaptureResult({ success: false, isAnalyzing: false, path: '', error: '', templatePath: undefined });
333
385
  setIsProcessingCapture(false);
334
386
  setProcessingImagePath(null);
335
387
  }
@@ -342,19 +394,124 @@ export const IDCardCapture = ({ component, value = {}, onValueChange, error, lan
342
394
  </View>);
343
395
  };
344
396
  const styles = StyleSheet.create({
345
- root: { flex: 1, maxWidth: 760, width: '100%' },
346
- container: { backgroundColor: 'white', margin: 10, borderRadius: 10, paddingVertical: 16, paddingHorizontal: 16, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.35, shadowRadius: 4.84, elevation: 10 },
347
- cameraContainer: { flex: 1, width: '100%', height: '100%' },
348
- previewContainer: { width: '95%', backgroundColor: 'white', margin: 10, borderRadius: 10, paddingVertical: 16, paddingHorizontal: 16 },
349
- previewItemContainer: {},
397
+ root: {
398
+ flex: 1,
399
+ width: '100%',
400
+ backgroundColor: 'transparent',
401
+ alignSelf: 'center',
402
+ ...(Platform.OS === 'web'
403
+ ? {
404
+ minHeight: '85vh',
405
+ justifyContent: 'center',
406
+ alignItems: 'center',
407
+ // Note: backdropFilter is valid in React Native Web but TS might complain, cast safely
408
+ backdropFilter: 'blur(8px)'
409
+ }
410
+ : {})
411
+ },
412
+ cameraWrapper: {
413
+ width: '100%',
414
+ backgroundColor: '#FFFFFF',
415
+ overflow: 'hidden',
416
+ ...(Platform.OS === 'web'
417
+ ? {
418
+ maxWidth: 500,
419
+ height: 700,
420
+ maxHeight: '90vh', // TypeScript will now ignore this thanks to the cast below
421
+ borderRadius: 24,
422
+ shadowColor: '#000',
423
+ shadowOffset: { width: 0, height: 20 },
424
+ shadowOpacity: 0.25,
425
+ shadowRadius: 35,
426
+ elevation: 24,
427
+ } // 🚨 CAST TO ANY
428
+ : {
429
+ flex: 1,
430
+ })
431
+ },
432
+ headerContainer: {
433
+ flexDirection: 'row',
434
+ alignItems: 'center',
435
+ justifyContent: 'space-between',
436
+ paddingHorizontal: 24,
437
+ paddingVertical: 18,
438
+ backgroundColor: '#FFFFFF',
439
+ borderBottomWidth: 1,
440
+ borderBottomColor: '#F1F5F9',
441
+ zIndex: 10,
442
+ // Mobile hidden, Web visible to replace floating text
443
+ ...(Platform.OS !== 'web' ? { display: 'none' } : {})
444
+ },
445
+ headerTitle: {
446
+ fontSize: 18,
447
+ fontWeight: '700',
448
+ color: '#0F172A',
449
+ },
450
+ stepBadge: {
451
+ backgroundColor: '#F1F5F9',
452
+ paddingHorizontal: 12,
453
+ paddingVertical: 6,
454
+ borderRadius: 20,
455
+ },
456
+ stepText: {
457
+ fontSize: 13,
458
+ fontWeight: '600',
459
+ color: '#64748B',
460
+ },
461
+ cameraFeedContainer: {
462
+ flex: 1,
463
+ position: 'relative',
464
+ backgroundColor: '#000',
465
+ },
466
+ camera: {
467
+ flex: 1,
468
+ },
469
+ previewContainer: {
470
+ width: '100%',
471
+ backgroundColor: 'white',
472
+ borderRadius: 12,
473
+ paddingVertical: 24,
474
+ paddingHorizontal: 20,
475
+ shadowColor: '#000',
476
+ shadowOffset: { width: 0, height: 4 },
477
+ shadowOpacity: 0.1,
478
+ shadowRadius: 12,
479
+ elevation: 8,
480
+ ...(Platform.OS === 'web' ? { alignSelf: 'center', maxWidth: 600 } : { margin: 10, width: '95%' })
481
+ },
482
+ previewItemContainer: {
483
+ flexGrow: 1,
484
+ },
350
485
  title: { fontSize: 24, fontWeight: 'bold', color: '#333', marginBottom: 8, textAlign: 'center' },
351
486
  description: { fontSize: 16, color: '#666', textAlign: 'center', marginBottom: 24, lineHeight: 22 },
352
487
  sideContainer: { marginBottom: 24 },
353
488
  sideTitle: { fontSize: 25, fontWeight: 'bold', color: '#000', marginBottom: 12, textAlign: 'center' },
354
- imagePreviewWrapper: { width: '100%', height: 200, borderRadius: 12, padding: 1, overflow: 'hidden', shadowColor: '#000', shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.18, shadowRadius: 8, elevation: 8, backgroundColor: '#000' },
355
- previewImage: { width: '100%', height: '100%', borderRadius: 12, resizeMode: 'contain' },
356
- floatingErrorBanner: { position: 'absolute', top: 60, 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 },
357
- floatingErrorText: { color: 'white', fontSize: 14, fontWeight: '700', textAlign: 'center' },
489
+ imagePreviewWrapper: {
490
+ width: '100%', height: 220, borderRadius: 12, padding: 1, overflow: 'hidden',
491
+ shadowColor: '#000', shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.18, shadowRadius: 8, elevation: 8, backgroundColor: '#f0f0f0'
492
+ },
493
+ previewImage: { width: '100%', height: '100%', borderRadius: 12, resizeMode: 'cover' },
494
+ floatingErrorBanner: {
495
+ position: 'absolute',
496
+ bottom: 30, // Pushed to the bottom for professional feel
497
+ left: 24,
498
+ right: 24,
499
+ backgroundColor: '#FEF2F2',
500
+ borderWidth: 1,
501
+ borderColor: '#FCA5A5',
502
+ paddingVertical: 12,
503
+ paddingHorizontal: 16,
504
+ borderRadius: 12,
505
+ alignItems: 'center',
506
+ justifyContent: 'center',
507
+ shadowColor: '#DC2626',
508
+ shadowOffset: { width: 0, height: 4 },
509
+ shadowOpacity: 0.1,
510
+ shadowRadius: 8,
511
+ elevation: 8,
512
+ zIndex: 100
513
+ },
514
+ floatingErrorText: { color: '#991B1B', fontSize: 14, fontWeight: '700', textAlign: 'center' },
358
515
  processingOverlay: { flex: 1, backgroundColor: 'rgba(0, 0, 0, 0.6)', justifyContent: 'center', alignItems: 'center', zIndex: 9999 },
359
516
  processingText: { color: '#FFF', fontSize: 18, fontWeight: 'bold', marginTop: 16, textAlign: 'center' },
360
517
  warningBanner: { backgroundColor: '#FF9500', padding: 12, borderRadius: 8, width: '100%', shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.2, shadowRadius: 4, elevation: 4 },
@@ -362,9 +519,6 @@ const styles = StyleSheet.create({
362
519
  errorText: { color: '#dc2626', fontSize: 14, marginTop: 8, textAlign: 'center' },
363
520
  topAnalyzingPillContainer: { position: 'absolute', top: Platform.OS === 'android' ? 60 : 50, left: 0, right: 0, alignItems: 'center', zIndex: 100 },
364
521
  topAnalyzingPill: { flexDirection: 'row', alignItems: 'center', backgroundColor: 'rgba(0,0,0,0.6)', paddingVertical: 8, paddingHorizontal: 16, borderRadius: 20, gap: 8 },
365
- analyzingPillText: { color: 'white', fontSize: 14, fontWeight: 'bold' },
366
- camera: {
367
- flex: 1,
368
- },
522
+ analyzingPillText: { color: 'white', fontSize: 14, fontWeight: 'bold' }
369
523
  });
370
524
  //# sourceMappingURL=IDCardCapture.js.map