@velion-la/onboarding-sdk-react-native 1.0.0-beta.2
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/CHANGELOG.md +66 -0
- package/LICENSE +12 -0
- package/README.md +803 -0
- package/lib/commonjs/camera/AddressSearchBar.js +304 -0
- package/lib/commonjs/camera/AddressSearchBar.js.map +1 -0
- package/lib/commonjs/camera/DocumentCapture.js +505 -0
- package/lib/commonjs/camera/DocumentCapture.js.map +1 -0
- package/lib/commonjs/camera/LivenessCamera.js +534 -0
- package/lib/commonjs/camera/LivenessCamera.js.map +1 -0
- package/lib/commonjs/camera/MapAddressPicker.js +341 -0
- package/lib/commonjs/camera/MapAddressPicker.js.map +1 -0
- package/lib/commonjs/core/VelionOnboarding.js +815 -0
- package/lib/commonjs/core/VelionOnboarding.js.map +1 -0
- package/lib/commonjs/core/sessionDeclinedCopy.js +56 -0
- package/lib/commonjs/core/sessionDeclinedCopy.js.map +1 -0
- package/lib/commonjs/core/sessionStateMapper.js +137 -0
- package/lib/commonjs/core/sessionStateMapper.js.map +1 -0
- package/lib/commonjs/core/sseReasonMessages.js +450 -0
- package/lib/commonjs/core/sseReasonMessages.js.map +1 -0
- package/lib/commonjs/data/iso3166Alpha2Codes.json +1 -0
- package/lib/commonjs/data/iso3166CountryNames.json +251 -0
- package/lib/commonjs/i18n/index.js +30 -0
- package/lib/commonjs/i18n/index.js.map +1 -0
- package/lib/commonjs/i18n/strings/en.js +261 -0
- package/lib/commonjs/i18n/strings/en.js.map +1 -0
- package/lib/commonjs/i18n/strings/es.js +266 -0
- package/lib/commonjs/i18n/strings/es.js.map +1 -0
- package/lib/commonjs/index.js +213 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/steps/AddressInfoStep.js +650 -0
- package/lib/commonjs/steps/AddressInfoStep.js.map +1 -0
- package/lib/commonjs/steps/DocumentsOcrStep.js +397 -0
- package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -0
- package/lib/commonjs/steps/EmailContactStep.js +145 -0
- package/lib/commonjs/steps/EmailContactStep.js.map +1 -0
- package/lib/commonjs/steps/EmailOtpStep.js +220 -0
- package/lib/commonjs/steps/EmailOtpStep.js.map +1 -0
- package/lib/commonjs/steps/FaceMatchStep.js +166 -0
- package/lib/commonjs/steps/FaceMatchStep.js.map +1 -0
- package/lib/commonjs/steps/FingerprintStep.js +92 -0
- package/lib/commonjs/steps/FingerprintStep.js.map +1 -0
- package/lib/commonjs/steps/HumanBasicInfoStep.js +243 -0
- package/lib/commonjs/steps/HumanBasicInfoStep.js.map +1 -0
- package/lib/commonjs/steps/HumanExtendedInfoStep.js +268 -0
- package/lib/commonjs/steps/HumanExtendedInfoStep.js.map +1 -0
- package/lib/commonjs/steps/LegalBasicInfoStep.js +188 -0
- package/lib/commonjs/steps/LegalBasicInfoStep.js.map +1 -0
- package/lib/commonjs/steps/LegalExtendedInfoStep.js +166 -0
- package/lib/commonjs/steps/LegalExtendedInfoStep.js.map +1 -0
- package/lib/commonjs/steps/LivenessMatchStep.js +707 -0
- package/lib/commonjs/steps/LivenessMatchStep.js.map +1 -0
- package/lib/commonjs/steps/PhoneContactStep.js +146 -0
- package/lib/commonjs/steps/PhoneContactStep.js.map +1 -0
- package/lib/commonjs/steps/PhoneOtpStep.js +219 -0
- package/lib/commonjs/steps/PhoneOtpStep.js.map +1 -0
- package/lib/commonjs/steps/SwornDeclarationStep.js +196 -0
- package/lib/commonjs/steps/SwornDeclarationStep.js.map +1 -0
- package/lib/commonjs/steps/TaxInfoStep.js +244 -0
- package/lib/commonjs/steps/TaxInfoStep.js.map +1 -0
- package/lib/commonjs/steps/TermsAndConditionsStep.js +238 -0
- package/lib/commonjs/steps/TermsAndConditionsStep.js.map +1 -0
- package/lib/commonjs/steps/_shared.js +40 -0
- package/lib/commonjs/steps/_shared.js.map +1 -0
- package/lib/commonjs/steps/types.js +6 -0
- package/lib/commonjs/steps/types.js.map +1 -0
- package/lib/commonjs/transport/api.js +176 -0
- package/lib/commonjs/transport/api.js.map +1 -0
- package/lib/commonjs/transport/irisWebSocket.js +121 -0
- package/lib/commonjs/transport/irisWebSocket.js.map +1 -0
- package/lib/commonjs/transport/secureUrl.js +50 -0
- package/lib/commonjs/transport/secureUrl.js.map +1 -0
- package/lib/commonjs/transport/sse.js +248 -0
- package/lib/commonjs/transport/sse.js.map +1 -0
- package/lib/commonjs/types/index.js +391 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/ui/MapFallbackBoundary.js +42 -0
- package/lib/commonjs/ui/MapFallbackBoundary.js.map +1 -0
- package/lib/commonjs/ui/StepShell.js +118 -0
- package/lib/commonjs/ui/StepShell.js.map +1 -0
- package/lib/commonjs/ui/VelionOnboardingScreen.js +217 -0
- package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -0
- package/lib/commonjs/ui/forms/index.js +38 -0
- package/lib/commonjs/ui/forms/index.js.map +1 -0
- package/lib/commonjs/ui/forms/useInlineValidation.js +88 -0
- package/lib/commonjs/ui/forms/useInlineValidation.js.map +1 -0
- package/lib/commonjs/ui/forms/validators.js +34 -0
- package/lib/commonjs/ui/forms/validators.js.map +1 -0
- package/lib/commonjs/ui/icons/HomeHeartIcon.js +38 -0
- package/lib/commonjs/ui/icons/HomeHeartIcon.js.map +1 -0
- package/lib/commonjs/ui/icons/StepIcon.js +59 -0
- package/lib/commonjs/ui/icons/StepIcon.js.map +1 -0
- package/lib/commonjs/ui/overlays/AnalyzingOverlay.js +284 -0
- package/lib/commonjs/ui/overlays/AnalyzingOverlay.js.map +1 -0
- package/lib/commonjs/ui/overlays/LoadingOverlay.js +108 -0
- package/lib/commonjs/ui/overlays/LoadingOverlay.js.map +1 -0
- package/lib/commonjs/ui/overlays/ProgressBar.js +95 -0
- package/lib/commonjs/ui/overlays/ProgressBar.js.map +1 -0
- package/lib/commonjs/ui/overlays/RetryDialog.js +125 -0
- package/lib/commonjs/ui/overlays/RetryDialog.js.map +1 -0
- package/lib/commonjs/ui/overlays/index.js +33 -0
- package/lib/commonjs/ui/overlays/index.js.map +1 -0
- package/lib/commonjs/ui/primitives/Banner.js +81 -0
- package/lib/commonjs/ui/primitives/Banner.js.map +1 -0
- package/lib/commonjs/ui/primitives/Button.js +142 -0
- package/lib/commonjs/ui/primitives/Button.js.map +1 -0
- package/lib/commonjs/ui/primitives/Card.js +50 -0
- package/lib/commonjs/ui/primitives/Card.js.map +1 -0
- package/lib/commonjs/ui/primitives/Checkbox.js +139 -0
- package/lib/commonjs/ui/primitives/Checkbox.js.map +1 -0
- package/lib/commonjs/ui/primitives/CountrySelect.js +288 -0
- package/lib/commonjs/ui/primitives/CountrySelect.js.map +1 -0
- package/lib/commonjs/ui/primitives/DatePicker.js +245 -0
- package/lib/commonjs/ui/primitives/DatePicker.js.map +1 -0
- package/lib/commonjs/ui/primitives/Input.js +101 -0
- package/lib/commonjs/ui/primitives/Input.js.map +1 -0
- package/lib/commonjs/ui/primitives/Select.js +209 -0
- package/lib/commonjs/ui/primitives/Select.js.map +1 -0
- package/lib/commonjs/ui/primitives/Spinner.js +25 -0
- package/lib/commonjs/ui/primitives/Spinner.js.map +1 -0
- package/lib/commonjs/ui/primitives/index.js +69 -0
- package/lib/commonjs/ui/primitives/index.js.map +1 -0
- package/lib/commonjs/ui/theme/ThemeProvider.js +74 -0
- package/lib/commonjs/ui/theme/ThemeProvider.js.map +1 -0
- package/lib/commonjs/ui/theme/index.js +68 -0
- package/lib/commonjs/ui/theme/index.js.map +1 -0
- package/lib/commonjs/ui/theme/tokens.js +154 -0
- package/lib/commonjs/ui/theme/tokens.js.map +1 -0
- package/lib/commonjs/utils/EventEmitter.js +144 -0
- package/lib/commonjs/utils/EventEmitter.js.map +1 -0
- package/lib/commonjs/utils/base64.js +53 -0
- package/lib/commonjs/utils/base64.js.map +1 -0
- package/lib/commonjs/utils/deviceFingerprint.js +132 -0
- package/lib/commonjs/utils/deviceFingerprint.js.map +1 -0
- package/lib/commonjs/utils/documentTypeOptions.js +35 -0
- package/lib/commonjs/utils/documentTypeOptions.js.map +1 -0
- package/lib/commonjs/utils/googleMapsPreflight.js +77 -0
- package/lib/commonjs/utils/googleMapsPreflight.js.map +1 -0
- package/lib/commonjs/utils/hmac.js +58 -0
- package/lib/commonjs/utils/hmac.js.map +1 -0
- package/lib/commonjs/utils/iso3166Countries.js +98 -0
- package/lib/commonjs/utils/iso3166Countries.js.map +1 -0
- package/lib/commonjs/utils/jpegFromUri.js +44 -0
- package/lib/commonjs/utils/jpegFromUri.js.map +1 -0
- package/lib/commonjs/utils/keepAwake.js +58 -0
- package/lib/commonjs/utils/keepAwake.js.map +1 -0
- package/lib/commonjs/utils/log.js +42 -0
- package/lib/commonjs/utils/log.js.map +1 -0
- package/lib/commonjs/utils/osGeocoder.js +70 -0
- package/lib/commonjs/utils/osGeocoder.js.map +1 -0
- package/lib/commonjs/utils/parseGoogleAddressComponents.js +74 -0
- package/lib/commonjs/utils/parseGoogleAddressComponents.js.map +1 -0
- package/lib/commonjs/utils/personNameNormalize.js +24 -0
- package/lib/commonjs/utils/personNameNormalize.js.map +1 -0
- package/lib/commonjs/utils/sdkError.js +34 -0
- package/lib/commonjs/utils/sdkError.js.map +1 -0
- package/lib/commonjs/utils/sdkVersion.js +13 -0
- package/lib/commonjs/utils/sdkVersion.js.map +1 -0
- package/lib/commonjs/utils/stepConfig.js +65 -0
- package/lib/commonjs/utils/stepConfig.js.map +1 -0
- package/lib/commonjs/utils/taxInfoConfig.js +19 -0
- package/lib/commonjs/utils/taxInfoConfig.js.map +1 -0
- package/lib/module/camera/AddressSearchBar.js +299 -0
- package/lib/module/camera/AddressSearchBar.js.map +1 -0
- package/lib/module/camera/DocumentCapture.js +500 -0
- package/lib/module/camera/DocumentCapture.js.map +1 -0
- package/lib/module/camera/LivenessCamera.js +529 -0
- package/lib/module/camera/LivenessCamera.js.map +1 -0
- package/lib/module/camera/MapAddressPicker.js +337 -0
- package/lib/module/camera/MapAddressPicker.js.map +1 -0
- package/lib/module/core/VelionOnboarding.js +811 -0
- package/lib/module/core/VelionOnboarding.js.map +1 -0
- package/lib/module/core/sessionDeclinedCopy.js +52 -0
- package/lib/module/core/sessionDeclinedCopy.js.map +1 -0
- package/lib/module/core/sessionStateMapper.js +128 -0
- package/lib/module/core/sessionStateMapper.js.map +1 -0
- package/lib/module/core/sseReasonMessages.js +446 -0
- package/lib/module/core/sseReasonMessages.js.map +1 -0
- package/lib/module/data/iso3166Alpha2Codes.json +1 -0
- package/lib/module/data/iso3166CountryNames.json +251 -0
- package/lib/module/i18n/index.js +25 -0
- package/lib/module/i18n/index.js.map +1 -0
- package/lib/module/i18n/strings/en.js +257 -0
- package/lib/module/i18n/strings/en.js.map +1 -0
- package/lib/module/i18n/strings/es.js +262 -0
- package/lib/module/i18n/strings/es.js.map +1 -0
- package/lib/module/index.js +36 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/steps/AddressInfoStep.js +646 -0
- package/lib/module/steps/AddressInfoStep.js.map +1 -0
- package/lib/module/steps/DocumentsOcrStep.js +391 -0
- package/lib/module/steps/DocumentsOcrStep.js.map +1 -0
- package/lib/module/steps/EmailContactStep.js +140 -0
- package/lib/module/steps/EmailContactStep.js.map +1 -0
- package/lib/module/steps/EmailOtpStep.js +215 -0
- package/lib/module/steps/EmailOtpStep.js.map +1 -0
- package/lib/module/steps/FaceMatchStep.js +161 -0
- package/lib/module/steps/FaceMatchStep.js.map +1 -0
- package/lib/module/steps/FingerprintStep.js +87 -0
- package/lib/module/steps/FingerprintStep.js.map +1 -0
- package/lib/module/steps/HumanBasicInfoStep.js +238 -0
- package/lib/module/steps/HumanBasicInfoStep.js.map +1 -0
- package/lib/module/steps/HumanExtendedInfoStep.js +263 -0
- package/lib/module/steps/HumanExtendedInfoStep.js.map +1 -0
- package/lib/module/steps/LegalBasicInfoStep.js +183 -0
- package/lib/module/steps/LegalBasicInfoStep.js.map +1 -0
- package/lib/module/steps/LegalExtendedInfoStep.js +161 -0
- package/lib/module/steps/LegalExtendedInfoStep.js.map +1 -0
- package/lib/module/steps/LivenessMatchStep.js +701 -0
- package/lib/module/steps/LivenessMatchStep.js.map +1 -0
- package/lib/module/steps/PhoneContactStep.js +141 -0
- package/lib/module/steps/PhoneContactStep.js.map +1 -0
- package/lib/module/steps/PhoneOtpStep.js +214 -0
- package/lib/module/steps/PhoneOtpStep.js.map +1 -0
- package/lib/module/steps/SwornDeclarationStep.js +191 -0
- package/lib/module/steps/SwornDeclarationStep.js.map +1 -0
- package/lib/module/steps/TaxInfoStep.js +239 -0
- package/lib/module/steps/TaxInfoStep.js.map +1 -0
- package/lib/module/steps/TermsAndConditionsStep.js +233 -0
- package/lib/module/steps/TermsAndConditionsStep.js.map +1 -0
- package/lib/module/steps/_shared.js +33 -0
- package/lib/module/steps/_shared.js.map +1 -0
- package/lib/module/steps/types.js +4 -0
- package/lib/module/steps/types.js.map +1 -0
- package/lib/module/transport/api.js +173 -0
- package/lib/module/transport/api.js.map +1 -0
- package/lib/module/transport/irisWebSocket.js +115 -0
- package/lib/module/transport/irisWebSocket.js.map +1 -0
- package/lib/module/transport/secureUrl.js +45 -0
- package/lib/module/transport/secureUrl.js.map +1 -0
- package/lib/module/transport/sse.js +242 -0
- package/lib/module/transport/sse.js.map +1 -0
- package/lib/module/types/index.js +457 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/ui/MapFallbackBoundary.js +37 -0
- package/lib/module/ui/MapFallbackBoundary.js.map +1 -0
- package/lib/module/ui/StepShell.js +114 -0
- package/lib/module/ui/StepShell.js.map +1 -0
- package/lib/module/ui/VelionOnboardingScreen.js +212 -0
- package/lib/module/ui/VelionOnboardingScreen.js.map +1 -0
- package/lib/module/ui/forms/index.js +5 -0
- package/lib/module/ui/forms/index.js.map +1 -0
- package/lib/module/ui/forms/useInlineValidation.js +84 -0
- package/lib/module/ui/forms/useInlineValidation.js.map +1 -0
- package/lib/module/ui/forms/validators.js +27 -0
- package/lib/module/ui/forms/validators.js.map +1 -0
- package/lib/module/ui/icons/HomeHeartIcon.js +33 -0
- package/lib/module/ui/icons/HomeHeartIcon.js.map +1 -0
- package/lib/module/ui/icons/StepIcon.js +55 -0
- package/lib/module/ui/icons/StepIcon.js.map +1 -0
- package/lib/module/ui/overlays/AnalyzingOverlay.js +279 -0
- package/lib/module/ui/overlays/AnalyzingOverlay.js.map +1 -0
- package/lib/module/ui/overlays/LoadingOverlay.js +104 -0
- package/lib/module/ui/overlays/LoadingOverlay.js.map +1 -0
- package/lib/module/ui/overlays/ProgressBar.js +90 -0
- package/lib/module/ui/overlays/ProgressBar.js.map +1 -0
- package/lib/module/ui/overlays/RetryDialog.js +121 -0
- package/lib/module/ui/overlays/RetryDialog.js.map +1 -0
- package/lib/module/ui/overlays/index.js +6 -0
- package/lib/module/ui/overlays/index.js.map +1 -0
- package/lib/module/ui/primitives/Banner.js +77 -0
- package/lib/module/ui/primitives/Banner.js.map +1 -0
- package/lib/module/ui/primitives/Button.js +138 -0
- package/lib/module/ui/primitives/Button.js.map +1 -0
- package/lib/module/ui/primitives/Card.js +46 -0
- package/lib/module/ui/primitives/Card.js.map +1 -0
- package/lib/module/ui/primitives/Checkbox.js +136 -0
- package/lib/module/ui/primitives/Checkbox.js.map +1 -0
- package/lib/module/ui/primitives/CountrySelect.js +284 -0
- package/lib/module/ui/primitives/CountrySelect.js.map +1 -0
- package/lib/module/ui/primitives/DatePicker.js +241 -0
- package/lib/module/ui/primitives/DatePicker.js.map +1 -0
- package/lib/module/ui/primitives/Input.js +97 -0
- package/lib/module/ui/primitives/Input.js.map +1 -0
- package/lib/module/ui/primitives/Select.js +205 -0
- package/lib/module/ui/primitives/Select.js.map +1 -0
- package/lib/module/ui/primitives/Spinner.js +21 -0
- package/lib/module/ui/primitives/Spinner.js.map +1 -0
- package/lib/module/ui/primitives/index.js +12 -0
- package/lib/module/ui/primitives/index.js.map +1 -0
- package/lib/module/ui/theme/ThemeProvider.js +67 -0
- package/lib/module/ui/theme/ThemeProvider.js.map +1 -0
- package/lib/module/ui/theme/index.js +5 -0
- package/lib/module/ui/theme/index.js.map +1 -0
- package/lib/module/ui/theme/tokens.js +145 -0
- package/lib/module/ui/theme/tokens.js.map +1 -0
- package/lib/module/utils/EventEmitter.js +139 -0
- package/lib/module/utils/EventEmitter.js.map +1 -0
- package/lib/module/utils/base64.js +47 -0
- package/lib/module/utils/base64.js.map +1 -0
- package/lib/module/utils/deviceFingerprint.js +129 -0
- package/lib/module/utils/deviceFingerprint.js.map +1 -0
- package/lib/module/utils/documentTypeOptions.js +31 -0
- package/lib/module/utils/documentTypeOptions.js.map +1 -0
- package/lib/module/utils/googleMapsPreflight.js +73 -0
- package/lib/module/utils/googleMapsPreflight.js.map +1 -0
- package/lib/module/utils/hmac.js +53 -0
- package/lib/module/utils/hmac.js.map +1 -0
- package/lib/module/utils/iso3166Countries.js +92 -0
- package/lib/module/utils/iso3166Countries.js.map +1 -0
- package/lib/module/utils/jpegFromUri.js +40 -0
- package/lib/module/utils/jpegFromUri.js.map +1 -0
- package/lib/module/utils/keepAwake.js +53 -0
- package/lib/module/utils/keepAwake.js.map +1 -0
- package/lib/module/utils/log.js +37 -0
- package/lib/module/utils/log.js.map +1 -0
- package/lib/module/utils/osGeocoder.js +65 -0
- package/lib/module/utils/osGeocoder.js.map +1 -0
- package/lib/module/utils/parseGoogleAddressComponents.js +69 -0
- package/lib/module/utils/parseGoogleAddressComponents.js.map +1 -0
- package/lib/module/utils/personNameNormalize.js +20 -0
- package/lib/module/utils/personNameNormalize.js.map +1 -0
- package/lib/module/utils/sdkError.js +29 -0
- package/lib/module/utils/sdkError.js.map +1 -0
- package/lib/module/utils/sdkVersion.js +9 -0
- package/lib/module/utils/sdkVersion.js.map +1 -0
- package/lib/module/utils/stepConfig.js +59 -0
- package/lib/module/utils/stepConfig.js.map +1 -0
- package/lib/module/utils/taxInfoConfig.js +15 -0
- package/lib/module/utils/taxInfoConfig.js.map +1 -0
- package/lib/typescript/camera/AddressSearchBar.d.ts +37 -0
- package/lib/typescript/camera/AddressSearchBar.d.ts.map +1 -0
- package/lib/typescript/camera/DocumentCapture.d.ts +34 -0
- package/lib/typescript/camera/DocumentCapture.d.ts.map +1 -0
- package/lib/typescript/camera/LivenessCamera.d.ts +50 -0
- package/lib/typescript/camera/LivenessCamera.d.ts.map +1 -0
- package/lib/typescript/camera/MapAddressPicker.d.ts +57 -0
- package/lib/typescript/camera/MapAddressPicker.d.ts.map +1 -0
- package/lib/typescript/core/VelionOnboarding.d.ts +115 -0
- package/lib/typescript/core/VelionOnboarding.d.ts.map +1 -0
- package/lib/typescript/core/sessionDeclinedCopy.d.ts +16 -0
- package/lib/typescript/core/sessionDeclinedCopy.d.ts.map +1 -0
- package/lib/typescript/core/sessionStateMapper.d.ts +33 -0
- package/lib/typescript/core/sessionStateMapper.d.ts.map +1 -0
- package/lib/typescript/core/sseReasonMessages.d.ts +20 -0
- package/lib/typescript/core/sseReasonMessages.d.ts.map +1 -0
- package/lib/typescript/i18n/index.d.ts +13 -0
- package/lib/typescript/i18n/index.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/en.d.ts +3 -0
- package/lib/typescript/i18n/strings/en.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/es.d.ts +260 -0
- package/lib/typescript/i18n/strings/es.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +26 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/steps/AddressInfoStep.d.ts +26 -0
- package/lib/typescript/steps/AddressInfoStep.d.ts.map +1 -0
- package/lib/typescript/steps/DocumentsOcrStep.d.ts +26 -0
- package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -0
- package/lib/typescript/steps/EmailContactStep.d.ts +15 -0
- package/lib/typescript/steps/EmailContactStep.d.ts.map +1 -0
- package/lib/typescript/steps/EmailOtpStep.d.ts +21 -0
- package/lib/typescript/steps/EmailOtpStep.d.ts.map +1 -0
- package/lib/typescript/steps/FaceMatchStep.d.ts +27 -0
- package/lib/typescript/steps/FaceMatchStep.d.ts.map +1 -0
- package/lib/typescript/steps/FingerprintStep.d.ts +25 -0
- package/lib/typescript/steps/FingerprintStep.d.ts.map +1 -0
- package/lib/typescript/steps/HumanBasicInfoStep.d.ts +25 -0
- package/lib/typescript/steps/HumanBasicInfoStep.d.ts.map +1 -0
- package/lib/typescript/steps/HumanExtendedInfoStep.d.ts +23 -0
- package/lib/typescript/steps/HumanExtendedInfoStep.d.ts.map +1 -0
- package/lib/typescript/steps/LegalBasicInfoStep.d.ts +17 -0
- package/lib/typescript/steps/LegalBasicInfoStep.d.ts.map +1 -0
- package/lib/typescript/steps/LegalExtendedInfoStep.d.ts +17 -0
- package/lib/typescript/steps/LegalExtendedInfoStep.d.ts.map +1 -0
- package/lib/typescript/steps/LivenessMatchStep.d.ts +26 -0
- package/lib/typescript/steps/LivenessMatchStep.d.ts.map +1 -0
- package/lib/typescript/steps/PhoneContactStep.d.ts +15 -0
- package/lib/typescript/steps/PhoneContactStep.d.ts.map +1 -0
- package/lib/typescript/steps/PhoneOtpStep.d.ts +19 -0
- package/lib/typescript/steps/PhoneOtpStep.d.ts.map +1 -0
- package/lib/typescript/steps/SwornDeclarationStep.d.ts +20 -0
- package/lib/typescript/steps/SwornDeclarationStep.d.ts.map +1 -0
- package/lib/typescript/steps/TaxInfoStep.d.ts +19 -0
- package/lib/typescript/steps/TaxInfoStep.d.ts.map +1 -0
- package/lib/typescript/steps/TermsAndConditionsStep.d.ts +21 -0
- package/lib/typescript/steps/TermsAndConditionsStep.d.ts.map +1 -0
- package/lib/typescript/steps/_shared.d.ts +11 -0
- package/lib/typescript/steps/_shared.d.ts.map +1 -0
- package/lib/typescript/steps/types.d.ts +68 -0
- package/lib/typescript/steps/types.d.ts.map +1 -0
- package/lib/typescript/transport/api.d.ts +35 -0
- package/lib/typescript/transport/api.d.ts.map +1 -0
- package/lib/typescript/transport/irisWebSocket.d.ts +72 -0
- package/lib/typescript/transport/irisWebSocket.d.ts.map +1 -0
- package/lib/typescript/transport/secureUrl.d.ts +14 -0
- package/lib/typescript/transport/secureUrl.d.ts.map +1 -0
- package/lib/typescript/transport/sse.d.ts +54 -0
- package/lib/typescript/transport/sse.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +1010 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/ui/MapFallbackBoundary.d.ts +28 -0
- package/lib/typescript/ui/MapFallbackBoundary.d.ts.map +1 -0
- package/lib/typescript/ui/StepShell.d.ts +19 -0
- package/lib/typescript/ui/StepShell.d.ts.map +1 -0
- package/lib/typescript/ui/VelionOnboardingScreen.d.ts +19 -0
- package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -0
- package/lib/typescript/ui/forms/index.d.ts +3 -0
- package/lib/typescript/ui/forms/index.d.ts.map +1 -0
- package/lib/typescript/ui/forms/useInlineValidation.d.ts +30 -0
- package/lib/typescript/ui/forms/useInlineValidation.d.ts.map +1 -0
- package/lib/typescript/ui/forms/validators.d.ts +11 -0
- package/lib/typescript/ui/forms/validators.d.ts.map +1 -0
- package/lib/typescript/ui/icons/HomeHeartIcon.d.ts +14 -0
- package/lib/typescript/ui/icons/HomeHeartIcon.d.ts.map +1 -0
- package/lib/typescript/ui/icons/StepIcon.d.ts +26 -0
- package/lib/typescript/ui/icons/StepIcon.d.ts.map +1 -0
- package/lib/typescript/ui/overlays/AnalyzingOverlay.d.ts +24 -0
- package/lib/typescript/ui/overlays/AnalyzingOverlay.d.ts.map +1 -0
- package/lib/typescript/ui/overlays/LoadingOverlay.d.ts +19 -0
- package/lib/typescript/ui/overlays/LoadingOverlay.d.ts.map +1 -0
- package/lib/typescript/ui/overlays/ProgressBar.d.ts +26 -0
- package/lib/typescript/ui/overlays/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/ui/overlays/RetryDialog.d.ts +17 -0
- package/lib/typescript/ui/overlays/RetryDialog.d.ts.map +1 -0
- package/lib/typescript/ui/overlays/index.d.ts +4 -0
- package/lib/typescript/ui/overlays/index.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/Banner.d.ts +11 -0
- package/lib/typescript/ui/primitives/Banner.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/Button.d.ts +27 -0
- package/lib/typescript/ui/primitives/Button.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/Card.d.ts +10 -0
- package/lib/typescript/ui/primitives/Card.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/Checkbox.d.ts +25 -0
- package/lib/typescript/ui/primitives/Checkbox.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/CountrySelect.d.ts +31 -0
- package/lib/typescript/ui/primitives/CountrySelect.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/DatePicker.d.ts +42 -0
- package/lib/typescript/ui/primitives/DatePicker.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/Input.d.ts +17 -0
- package/lib/typescript/ui/primitives/Input.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/Select.d.ts +26 -0
- package/lib/typescript/ui/primitives/Select.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/Spinner.d.ts +10 -0
- package/lib/typescript/ui/primitives/Spinner.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/index.d.ts +10 -0
- package/lib/typescript/ui/primitives/index.d.ts.map +1 -0
- package/lib/typescript/ui/theme/ThemeProvider.d.ts +23 -0
- package/lib/typescript/ui/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/ui/theme/index.d.ts +3 -0
- package/lib/typescript/ui/theme/index.d.ts.map +1 -0
- package/lib/typescript/ui/theme/tokens.d.ts +42 -0
- package/lib/typescript/ui/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/utils/EventEmitter.d.ts +98 -0
- package/lib/typescript/utils/EventEmitter.d.ts.map +1 -0
- package/lib/typescript/utils/base64.d.ts +19 -0
- package/lib/typescript/utils/base64.d.ts.map +1 -0
- package/lib/typescript/utils/deviceFingerprint.d.ts +42 -0
- package/lib/typescript/utils/deviceFingerprint.d.ts.map +1 -0
- package/lib/typescript/utils/documentTypeOptions.d.ts +13 -0
- package/lib/typescript/utils/documentTypeOptions.d.ts.map +1 -0
- package/lib/typescript/utils/googleMapsPreflight.d.ts +44 -0
- package/lib/typescript/utils/googleMapsPreflight.d.ts.map +1 -0
- package/lib/typescript/utils/hmac.d.ts +39 -0
- package/lib/typescript/utils/hmac.d.ts.map +1 -0
- package/lib/typescript/utils/iso3166Countries.d.ts +27 -0
- package/lib/typescript/utils/iso3166Countries.d.ts.map +1 -0
- package/lib/typescript/utils/jpegFromUri.d.ts +29 -0
- package/lib/typescript/utils/jpegFromUri.d.ts.map +1 -0
- package/lib/typescript/utils/keepAwake.d.ts +16 -0
- package/lib/typescript/utils/keepAwake.d.ts.map +1 -0
- package/lib/typescript/utils/log.d.ts +18 -0
- package/lib/typescript/utils/log.d.ts.map +1 -0
- package/lib/typescript/utils/osGeocoder.d.ts +38 -0
- package/lib/typescript/utils/osGeocoder.d.ts.map +1 -0
- package/lib/typescript/utils/parseGoogleAddressComponents.d.ts +43 -0
- package/lib/typescript/utils/parseGoogleAddressComponents.d.ts.map +1 -0
- package/lib/typescript/utils/personNameNormalize.d.ts +10 -0
- package/lib/typescript/utils/personNameNormalize.d.ts.map +1 -0
- package/lib/typescript/utils/sdkError.d.ts +14 -0
- package/lib/typescript/utils/sdkError.d.ts.map +1 -0
- package/lib/typescript/utils/sdkVersion.d.ts +7 -0
- package/lib/typescript/utils/sdkVersion.d.ts.map +1 -0
- package/lib/typescript/utils/stepConfig.d.ts +8 -0
- package/lib/typescript/utils/stepConfig.d.ts.map +1 -0
- package/lib/typescript/utils/taxInfoConfig.d.ts +7 -0
- package/lib/typescript/utils/taxInfoConfig.d.ts.map +1 -0
- package/package.json +99 -0
- package/src/camera/AddressSearchBar.tsx +363 -0
- package/src/camera/DocumentCapture.tsx +505 -0
- package/src/camera/LivenessCamera.tsx +602 -0
- package/src/camera/MapAddressPicker.tsx +397 -0
- package/src/core/VelionOnboarding.ts +974 -0
- package/src/core/sessionDeclinedCopy.ts +76 -0
- package/src/core/sessionStateMapper.ts +167 -0
- package/src/core/sseReasonMessages.ts +531 -0
- package/src/data/iso3166Alpha2Codes.json +1 -0
- package/src/data/iso3166CountryNames.json +251 -0
- package/src/i18n/index.ts +26 -0
- package/src/i18n/strings/en.ts +289 -0
- package/src/i18n/strings/es.ts +291 -0
- package/src/index.ts +137 -0
- package/src/steps/AddressInfoStep.tsx +726 -0
- package/src/steps/DocumentsOcrStep.tsx +472 -0
- package/src/steps/EmailContactStep.tsx +159 -0
- package/src/steps/EmailOtpStep.tsx +250 -0
- package/src/steps/FaceMatchStep.tsx +177 -0
- package/src/steps/FingerprintStep.tsx +99 -0
- package/src/steps/HumanBasicInfoStep.tsx +274 -0
- package/src/steps/HumanExtendedInfoStep.tsx +353 -0
- package/src/steps/LegalBasicInfoStep.tsx +205 -0
- package/src/steps/LegalExtendedInfoStep.tsx +171 -0
- package/src/steps/LivenessMatchStep.tsx +846 -0
- package/src/steps/PhoneContactStep.tsx +160 -0
- package/src/steps/PhoneOtpStep.tsx +249 -0
- package/src/steps/SwornDeclarationStep.tsx +220 -0
- package/src/steps/TaxInfoStep.tsx +277 -0
- package/src/steps/TermsAndConditionsStep.tsx +261 -0
- package/src/steps/_shared.ts +44 -0
- package/src/steps/types.ts +72 -0
- package/src/transport/api.ts +257 -0
- package/src/transport/irisWebSocket.ts +186 -0
- package/src/transport/secureUrl.ts +47 -0
- package/src/transport/sse.ts +310 -0
- package/src/types/index.ts +1198 -0
- package/src/ui/MapFallbackBoundary.tsx +46 -0
- package/src/ui/StepShell.tsx +137 -0
- package/src/ui/VelionOnboardingScreen.tsx +223 -0
- package/src/ui/forms/index.ts +12 -0
- package/src/ui/forms/useInlineValidation.ts +115 -0
- package/src/ui/forms/validators.ts +29 -0
- package/src/ui/icons/HomeHeartIcon.tsx +34 -0
- package/src/ui/icons/StepIcon.tsx +77 -0
- package/src/ui/overlays/AnalyzingOverlay.tsx +323 -0
- package/src/ui/overlays/LoadingOverlay.tsx +115 -0
- package/src/ui/overlays/ProgressBar.tsx +99 -0
- package/src/ui/overlays/RetryDialog.tsx +128 -0
- package/src/ui/overlays/index.ts +3 -0
- package/src/ui/primitives/Banner.tsx +81 -0
- package/src/ui/primitives/Button.tsx +164 -0
- package/src/ui/primitives/Card.tsx +55 -0
- package/src/ui/primitives/Checkbox.tsx +153 -0
- package/src/ui/primitives/CountrySelect.tsx +356 -0
- package/src/ui/primitives/DatePicker.tsx +266 -0
- package/src/ui/primitives/Input.tsx +110 -0
- package/src/ui/primitives/Select.tsx +259 -0
- package/src/ui/primitives/Spinner.tsx +17 -0
- package/src/ui/primitives/index.ts +9 -0
- package/src/ui/theme/ThemeProvider.tsx +102 -0
- package/src/ui/theme/index.ts +17 -0
- package/src/ui/theme/tokens.ts +159 -0
- package/src/utils/EventEmitter.ts +155 -0
- package/src/utils/base64.ts +44 -0
- package/src/utils/deviceFingerprint.ts +184 -0
- package/src/utils/documentTypeOptions.ts +31 -0
- package/src/utils/googleMapsPreflight.ts +72 -0
- package/src/utils/hmac.ts +61 -0
- package/src/utils/iso3166Countries.ts +111 -0
- package/src/utils/jpegFromUri.ts +42 -0
- package/src/utils/keepAwake.ts +62 -0
- package/src/utils/log.ts +37 -0
- package/src/utils/osGeocoder.ts +75 -0
- package/src/utils/parseGoogleAddressComponents.ts +123 -0
- package/src/utils/personNameNormalize.ts +17 -0
- package/src/utils/sdkError.ts +40 -0
- package/src/utils/sdkVersion.ts +6 -0
- package/src/utils/stepConfig.ts +75 -0
- package/src/utils/taxInfoConfig.ts +14 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Full-screen document camera with an ID-1 frame guide.
|
|
3
|
+
*
|
|
4
|
+
* Uses `react-native-vision-camera` v4 in `photo` mode. Tapping the shutter
|
|
5
|
+
* triggers `takePhoto()` with `qualityPrioritization: 'balanced'`; the file
|
|
6
|
+
* URI is returned to the caller via `onCaptured`.
|
|
7
|
+
*
|
|
8
|
+
* Visual: dark scrim with a transparent rectangular cutout (ID-1 16:10 ratio
|
|
9
|
+
* by default). The cutout is the visible-only guide — we do NOT crop the
|
|
10
|
+
* image client-side because the server's OCR pipeline rejects soft crops.
|
|
11
|
+
* The user is asked to fill the frame; the backend handles edge detection.
|
|
12
|
+
*
|
|
13
|
+
* No edge detection / OpenCV port (intentional MVP scope per the brief).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
17
|
+
import {
|
|
18
|
+
ActivityIndicator,
|
|
19
|
+
Pressable,
|
|
20
|
+
StyleSheet,
|
|
21
|
+
Text,
|
|
22
|
+
useWindowDimensions,
|
|
23
|
+
View,
|
|
24
|
+
} from 'react-native';
|
|
25
|
+
import Svg, { Defs, Mask, Rect } from 'react-native-svg';
|
|
26
|
+
import {
|
|
27
|
+
Camera,
|
|
28
|
+
useCameraDevice,
|
|
29
|
+
useCameraPermission,
|
|
30
|
+
type PhotoFile,
|
|
31
|
+
} from 'react-native-vision-camera';
|
|
32
|
+
import type { DocumentOrientation, DocumentSide } from '../types';
|
|
33
|
+
import { useTheme, withAlpha } from '../ui/theme';
|
|
34
|
+
import { Button } from '../ui/primitives/Button';
|
|
35
|
+
|
|
36
|
+
export interface DocumentCaptureProps {
|
|
37
|
+
side: DocumentSide;
|
|
38
|
+
orientation: DocumentOrientation;
|
|
39
|
+
/** Localized instruction shown above the cutout. */
|
|
40
|
+
instructions: string;
|
|
41
|
+
/** Localized "Take photo" label for the shutter button. */
|
|
42
|
+
captureLabel: string;
|
|
43
|
+
/** Localized error string when permission is denied. */
|
|
44
|
+
permissionDeniedLabel: string;
|
|
45
|
+
/** Localized "Try again" label. */
|
|
46
|
+
retryLabel: string;
|
|
47
|
+
/** Localized "Cancel" / back label. */
|
|
48
|
+
cancelLabel: string;
|
|
49
|
+
onCaptured: (photo: PhotoFile, side: DocumentSide) => void;
|
|
50
|
+
onCancel: () => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function DocumentCapture({
|
|
54
|
+
side,
|
|
55
|
+
orientation,
|
|
56
|
+
instructions,
|
|
57
|
+
captureLabel,
|
|
58
|
+
permissionDeniedLabel,
|
|
59
|
+
retryLabel,
|
|
60
|
+
cancelLabel,
|
|
61
|
+
onCaptured,
|
|
62
|
+
onCancel,
|
|
63
|
+
}: DocumentCaptureProps) {
|
|
64
|
+
const theme = useTheme();
|
|
65
|
+
const cameraRef = useRef<Camera>(null);
|
|
66
|
+
// Cross-platform back-camera selection.
|
|
67
|
+
//
|
|
68
|
+
// iOS (especially 15 Pro / Pro Max with multi-lens systems): asking for
|
|
69
|
+
// just 'back' returns the *wide-angle* device, whose ~20 cm minimum focus
|
|
70
|
+
// distance produces blurry frames when the user holds the ID closer.
|
|
71
|
+
// Passing the `physicalDevices` array makes vision-camera pick the
|
|
72
|
+
// *virtual multi-camera* device, which lets iOS auto-switch to the
|
|
73
|
+
// ultra-wide lens for macro / close-range subjects. Order = preference.
|
|
74
|
+
//
|
|
75
|
+
// Android: vision-camera's Android implementation ignores the
|
|
76
|
+
// `physicalDevices` filter (Android cameras are addressed by ID, not by
|
|
77
|
+
// physical-lens type) and returns the same default back camera it would
|
|
78
|
+
// return without the filter. So the filter is a no-op there but doesn't
|
|
79
|
+
// harm anything. Continuous AF is the default focus mode on both
|
|
80
|
+
// platforms, so cross-platform behaviour stays consistent.
|
|
81
|
+
const device = useCameraDevice('back', {
|
|
82
|
+
physicalDevices: [
|
|
83
|
+
'ultra-wide-angle-camera',
|
|
84
|
+
'wide-angle-camera',
|
|
85
|
+
'telephoto-camera',
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
const { hasPermission, requestPermission } = useCameraPermission();
|
|
89
|
+
const [requestedOnce, setRequestedOnce] = useState(false);
|
|
90
|
+
const [shooting, setShooting] = useState(false);
|
|
91
|
+
const [error, setError] = useState<string | null>(null);
|
|
92
|
+
// After ~4s without a device, surface a clear error instead of an
|
|
93
|
+
// infinite spinner. The most common cause is running the SDK in the
|
|
94
|
+
// iOS Simulator, which has no real camera.
|
|
95
|
+
const [deviceTimeout, setDeviceTimeout] = useState(false);
|
|
96
|
+
const [focusPoint, setFocusPoint] = useState<
|
|
97
|
+
{ x: number; y: number; key: number } | null
|
|
98
|
+
>(null);
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (!hasPermission && !requestedOnce) {
|
|
102
|
+
setRequestedOnce(true);
|
|
103
|
+
void requestPermission();
|
|
104
|
+
}
|
|
105
|
+
}, [hasPermission, requestedOnce, requestPermission]);
|
|
106
|
+
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (device || !hasPermission) {
|
|
109
|
+
setDeviceTimeout(false);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const t = setTimeout(() => setDeviceTimeout(true), 4000);
|
|
113
|
+
return () => clearTimeout(t);
|
|
114
|
+
}, [device, hasPermission]);
|
|
115
|
+
|
|
116
|
+
// NOTE: we intentionally do NOT call `cameraRef.current.focus()` on mount
|
|
117
|
+
// or before each shutter. iOS's continuous auto-focus runs by default and
|
|
118
|
+
// is what makes the native Camera app feel sharp at any distance. Calling
|
|
119
|
+
// `focus()` switches the device into single-shot/locked mode and DOES NOT
|
|
120
|
+
// restore continuous AF afterwards (vision-camera v4 has no "resume AF"
|
|
121
|
+
// API). The previous "autofocus on mount" + "autofocus before shutter"
|
|
122
|
+
// calls were the cause of blurry captures on iPhone 15 Pro Max: they
|
|
123
|
+
// pinned focus to the centre even after the user moved the phone, and
|
|
124
|
+
// never re-engaged continuous AF.
|
|
125
|
+
//
|
|
126
|
+
// Tap-to-focus is the one user-initiated override — when the user taps,
|
|
127
|
+
// they're explicitly asking us to lock focus on that point.
|
|
128
|
+
const supportsFocus = Boolean(device?.supportsFocus);
|
|
129
|
+
|
|
130
|
+
const handleTapToFocus = useCallback(
|
|
131
|
+
(event: { nativeEvent: { locationX: number; locationY: number } }) => {
|
|
132
|
+
if (!supportsFocus || !cameraRef.current) return;
|
|
133
|
+
const { locationX, locationY } = event.nativeEvent;
|
|
134
|
+
cameraRef.current.focus({ x: locationX, y: locationY }).catch(() => {
|
|
135
|
+
// Ignore — focus rejection is non-fatal.
|
|
136
|
+
});
|
|
137
|
+
setFocusPoint({ x: locationX, y: locationY, key: Date.now() });
|
|
138
|
+
},
|
|
139
|
+
[supportsFocus],
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// Auto-hide the focus indicator after a short period.
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (!focusPoint) return;
|
|
145
|
+
const t = setTimeout(() => setFocusPoint(null), 700);
|
|
146
|
+
return () => clearTimeout(t);
|
|
147
|
+
}, [focusPoint]);
|
|
148
|
+
|
|
149
|
+
const handleShutter = useCallback(async () => {
|
|
150
|
+
if (!cameraRef.current || shooting) return;
|
|
151
|
+
setShooting(true);
|
|
152
|
+
setError(null);
|
|
153
|
+
try {
|
|
154
|
+
const photo = await cameraRef.current.takePhoto({
|
|
155
|
+
flash: 'off',
|
|
156
|
+
enableShutterSound: false,
|
|
157
|
+
});
|
|
158
|
+
onCaptured(photo, side);
|
|
159
|
+
} catch (err) {
|
|
160
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
161
|
+
} finally {
|
|
162
|
+
setShooting(false);
|
|
163
|
+
}
|
|
164
|
+
}, [onCaptured, side, shooting]);
|
|
165
|
+
|
|
166
|
+
if (!hasPermission) {
|
|
167
|
+
return (
|
|
168
|
+
<View style={[styles.permission, { backgroundColor: theme.backgroundColor }]}>
|
|
169
|
+
<Text style={[styles.permissionText, { color: theme.textColor }]}>
|
|
170
|
+
{permissionDeniedLabel}
|
|
171
|
+
</Text>
|
|
172
|
+
<View style={styles.row}>
|
|
173
|
+
<Button
|
|
174
|
+
variant="ghost"
|
|
175
|
+
label={cancelLabel}
|
|
176
|
+
onPress={onCancel}
|
|
177
|
+
fullWidth={false}
|
|
178
|
+
style={styles.actionBtn}
|
|
179
|
+
/>
|
|
180
|
+
<Button
|
|
181
|
+
label={retryLabel}
|
|
182
|
+
onPress={() => {
|
|
183
|
+
void requestPermission();
|
|
184
|
+
}}
|
|
185
|
+
fullWidth={false}
|
|
186
|
+
style={styles.actionBtn}
|
|
187
|
+
/>
|
|
188
|
+
</View>
|
|
189
|
+
</View>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (!device) {
|
|
194
|
+
if (deviceTimeout) {
|
|
195
|
+
return (
|
|
196
|
+
<View style={[styles.permission, { backgroundColor: theme.backgroundColor }]}>
|
|
197
|
+
<Text style={[styles.permissionText, { color: theme.textColor }]}>
|
|
198
|
+
No camera detected. The iOS Simulator does not provide a real
|
|
199
|
+
camera — please run on a physical device to capture documents.
|
|
200
|
+
</Text>
|
|
201
|
+
<View style={styles.row}>
|
|
202
|
+
<Button
|
|
203
|
+
variant="ghost"
|
|
204
|
+
label={cancelLabel}
|
|
205
|
+
onPress={onCancel}
|
|
206
|
+
fullWidth={false}
|
|
207
|
+
style={styles.actionBtn}
|
|
208
|
+
/>
|
|
209
|
+
</View>
|
|
210
|
+
</View>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
return (
|
|
214
|
+
<View style={[styles.permission, { backgroundColor: theme.backgroundColor }]}>
|
|
215
|
+
<ActivityIndicator color={theme.primaryColor} />
|
|
216
|
+
</View>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return (
|
|
221
|
+
<View style={styles.root}>
|
|
222
|
+
<Camera
|
|
223
|
+
ref={cameraRef}
|
|
224
|
+
style={StyleSheet.absoluteFill}
|
|
225
|
+
device={device}
|
|
226
|
+
photo
|
|
227
|
+
photoQualityBalance="quality"
|
|
228
|
+
enableZoomGesture={false}
|
|
229
|
+
isActive
|
|
230
|
+
/>
|
|
231
|
+
{/* Invisible pressable layer over the camera preview for tap-to-focus.
|
|
232
|
+
Sits below the mask + chrome so the user can tap anywhere except
|
|
233
|
+
the bottom shutter / top close button. */}
|
|
234
|
+
<Pressable
|
|
235
|
+
style={StyleSheet.absoluteFill}
|
|
236
|
+
onPress={handleTapToFocus}
|
|
237
|
+
accessibilityLabel="Tap to focus"
|
|
238
|
+
/>
|
|
239
|
+
<DocumentMaskOverlay orientation={orientation} />
|
|
240
|
+
{focusPoint ? (
|
|
241
|
+
<View
|
|
242
|
+
pointerEvents="none"
|
|
243
|
+
style={[
|
|
244
|
+
styles.focusRing,
|
|
245
|
+
{
|
|
246
|
+
left: focusPoint.x - FOCUS_RING_SIZE / 2,
|
|
247
|
+
top: focusPoint.y - FOCUS_RING_SIZE / 2,
|
|
248
|
+
},
|
|
249
|
+
]}
|
|
250
|
+
/>
|
|
251
|
+
) : null}
|
|
252
|
+
<View style={styles.topBar}>
|
|
253
|
+
<Pressable onPress={onCancel} style={styles.iconBtn} accessibilityLabel={cancelLabel}>
|
|
254
|
+
<Text style={styles.iconBtnText}>✕</Text>
|
|
255
|
+
</Pressable>
|
|
256
|
+
</View>
|
|
257
|
+
<View style={styles.instructions} pointerEvents="none">
|
|
258
|
+
<Text style={styles.instructionsText}>{instructions}</Text>
|
|
259
|
+
</View>
|
|
260
|
+
<View style={styles.bottomBar}>
|
|
261
|
+
{error ? <Text style={styles.errorText}>{error}</Text> : null}
|
|
262
|
+
<Pressable
|
|
263
|
+
accessibilityRole="button"
|
|
264
|
+
accessibilityLabel={captureLabel}
|
|
265
|
+
accessibilityState={{ disabled: shooting }}
|
|
266
|
+
disabled={shooting}
|
|
267
|
+
onPress={handleShutter}
|
|
268
|
+
style={[
|
|
269
|
+
styles.shutter,
|
|
270
|
+
{ borderColor: '#FFFFFF', backgroundColor: withAlpha('#FFFFFF', 0.18) },
|
|
271
|
+
shooting && styles.shutterDisabled,
|
|
272
|
+
]}
|
|
273
|
+
>
|
|
274
|
+
<View
|
|
275
|
+
style={[styles.shutterCore, { backgroundColor: '#FFFFFF' }]}
|
|
276
|
+
/>
|
|
277
|
+
</Pressable>
|
|
278
|
+
</View>
|
|
279
|
+
</View>
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const FOCUS_RING_SIZE = 64;
|
|
284
|
+
|
|
285
|
+
interface MaskProps {
|
|
286
|
+
orientation: DocumentOrientation;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const CUTOUT_WIDTH_RATIO = 0.85; // 85% of screen width
|
|
290
|
+
const CUTOUT_MAX_HEIGHT_RATIO = 0.62; // never taller than 62% of screen height
|
|
291
|
+
const CORNER_LENGTH = 28;
|
|
292
|
+
const CORNER_THICKNESS = 3;
|
|
293
|
+
/**
|
|
294
|
+
* Radius of the rounded cutout AND of the corner brackets. The SVG mask uses
|
|
295
|
+
* it for the inner rounded rect; each bracket's outward corner radius is the
|
|
296
|
+
* same value so the brackets sit flush on the curve.
|
|
297
|
+
*/
|
|
298
|
+
const CUTOUT_RADIUS = 16;
|
|
299
|
+
const DIM_COLOR = 'rgba(0,0,0,0.55)';
|
|
300
|
+
|
|
301
|
+
function DocumentMaskOverlay({ orientation }: MaskProps) {
|
|
302
|
+
const { width: screenW, height: screenH } = useWindowDimensions();
|
|
303
|
+
const aspectRatio = orientation === 'portrait' ? 0.625 : 1.586;
|
|
304
|
+
|
|
305
|
+
// Compute the cutout proportionally. Width is the primary dimension; if
|
|
306
|
+
// the resulting height would overflow the screen budget (mostly portrait
|
|
307
|
+
// ID-1 = 0.625 aspect on tall phones), shrink it back to fit.
|
|
308
|
+
let cutoutW = screenW * CUTOUT_WIDTH_RATIO;
|
|
309
|
+
let cutoutH = cutoutW / aspectRatio;
|
|
310
|
+
const maxH = screenH * CUTOUT_MAX_HEIGHT_RATIO;
|
|
311
|
+
if (cutoutH > maxH) {
|
|
312
|
+
cutoutH = maxH;
|
|
313
|
+
cutoutW = cutoutH * aspectRatio;
|
|
314
|
+
}
|
|
315
|
+
const left = (screenW - cutoutW) / 2;
|
|
316
|
+
const top = (screenH - cutoutH) / 2;
|
|
317
|
+
const R = CUTOUT_RADIUS;
|
|
318
|
+
|
|
319
|
+
// SVG mask: opaque outer rect minus a rounded inner rect. The mask paints
|
|
320
|
+
// white where dim should render and black where the cutout is transparent;
|
|
321
|
+
// the rounded inner Rect (rx/ry = R) produces exact concave curves at each
|
|
322
|
+
// corner — no quarter-circle fillers, no curve inversion.
|
|
323
|
+
return (
|
|
324
|
+
<View pointerEvents="none" style={StyleSheet.absoluteFill}>
|
|
325
|
+
<Svg width={screenW} height={screenH} style={StyleSheet.absoluteFill}>
|
|
326
|
+
<Defs>
|
|
327
|
+
<Mask id="documentCutout">
|
|
328
|
+
<Rect x={0} y={0} width={screenW} height={screenH} fill="white" />
|
|
329
|
+
<Rect
|
|
330
|
+
x={left}
|
|
331
|
+
y={top}
|
|
332
|
+
width={cutoutW}
|
|
333
|
+
height={cutoutH}
|
|
334
|
+
rx={R}
|
|
335
|
+
ry={R}
|
|
336
|
+
fill="black"
|
|
337
|
+
/>
|
|
338
|
+
</Mask>
|
|
339
|
+
</Defs>
|
|
340
|
+
<Rect
|
|
341
|
+
x={0}
|
|
342
|
+
y={0}
|
|
343
|
+
width={screenW}
|
|
344
|
+
height={screenH}
|
|
345
|
+
fill={DIM_COLOR}
|
|
346
|
+
mask="url(#documentCutout)"
|
|
347
|
+
/>
|
|
348
|
+
</Svg>
|
|
349
|
+
|
|
350
|
+
{/* Corner brackets, anchored to the cutout bounding box. Each bracket's
|
|
351
|
+
outward corner uses the same radius as the cutout so it sits flush
|
|
352
|
+
on the curve. */}
|
|
353
|
+
<View
|
|
354
|
+
style={{
|
|
355
|
+
position: 'absolute',
|
|
356
|
+
left,
|
|
357
|
+
top,
|
|
358
|
+
width: cutoutW,
|
|
359
|
+
height: cutoutH,
|
|
360
|
+
}}
|
|
361
|
+
>
|
|
362
|
+
<View style={[styles.corner, styles.cornerTL, { borderTopLeftRadius: R }]} />
|
|
363
|
+
<View style={[styles.corner, styles.cornerTR, { borderTopRightRadius: R }]} />
|
|
364
|
+
<View style={[styles.corner, styles.cornerBL, { borderBottomLeftRadius: R }]} />
|
|
365
|
+
<View style={[styles.corner, styles.cornerBR, { borderBottomRightRadius: R }]} />
|
|
366
|
+
</View>
|
|
367
|
+
</View>
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const styles = StyleSheet.create({
|
|
372
|
+
root: {
|
|
373
|
+
flex: 1,
|
|
374
|
+
backgroundColor: '#000',
|
|
375
|
+
},
|
|
376
|
+
permission: {
|
|
377
|
+
flex: 1,
|
|
378
|
+
alignItems: 'center',
|
|
379
|
+
justifyContent: 'center',
|
|
380
|
+
padding: 32,
|
|
381
|
+
gap: 16,
|
|
382
|
+
},
|
|
383
|
+
permissionText: {
|
|
384
|
+
textAlign: 'center',
|
|
385
|
+
fontSize: 15,
|
|
386
|
+
lineHeight: 22,
|
|
387
|
+
},
|
|
388
|
+
row: {
|
|
389
|
+
flexDirection: 'row',
|
|
390
|
+
gap: 12,
|
|
391
|
+
width: '100%',
|
|
392
|
+
maxWidth: 380,
|
|
393
|
+
},
|
|
394
|
+
actionBtn: {
|
|
395
|
+
flex: 1,
|
|
396
|
+
},
|
|
397
|
+
topBar: {
|
|
398
|
+
position: 'absolute',
|
|
399
|
+
top: 12,
|
|
400
|
+
left: 12,
|
|
401
|
+
right: 12,
|
|
402
|
+
flexDirection: 'row',
|
|
403
|
+
alignItems: 'center',
|
|
404
|
+
justifyContent: 'flex-end',
|
|
405
|
+
},
|
|
406
|
+
iconBtn: {
|
|
407
|
+
width: 36,
|
|
408
|
+
height: 36,
|
|
409
|
+
borderRadius: 18,
|
|
410
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
411
|
+
alignItems: 'center',
|
|
412
|
+
justifyContent: 'center',
|
|
413
|
+
},
|
|
414
|
+
iconBtnText: {
|
|
415
|
+
color: '#FFFFFF',
|
|
416
|
+
fontSize: 16,
|
|
417
|
+
fontWeight: '700',
|
|
418
|
+
},
|
|
419
|
+
instructions: {
|
|
420
|
+
position: 'absolute',
|
|
421
|
+
top: 60,
|
|
422
|
+
left: 24,
|
|
423
|
+
right: 24,
|
|
424
|
+
alignItems: 'center',
|
|
425
|
+
},
|
|
426
|
+
instructionsText: {
|
|
427
|
+
color: '#FFFFFF',
|
|
428
|
+
fontSize: 14,
|
|
429
|
+
textAlign: 'center',
|
|
430
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
431
|
+
paddingHorizontal: 12,
|
|
432
|
+
paddingVertical: 6,
|
|
433
|
+
borderRadius: 16,
|
|
434
|
+
overflow: 'hidden',
|
|
435
|
+
},
|
|
436
|
+
bottomBar: {
|
|
437
|
+
position: 'absolute',
|
|
438
|
+
bottom: 32,
|
|
439
|
+
left: 0,
|
|
440
|
+
right: 0,
|
|
441
|
+
alignItems: 'center',
|
|
442
|
+
gap: 12,
|
|
443
|
+
},
|
|
444
|
+
errorText: {
|
|
445
|
+
color: '#FCA5A5',
|
|
446
|
+
fontSize: 13,
|
|
447
|
+
textAlign: 'center',
|
|
448
|
+
paddingHorizontal: 24,
|
|
449
|
+
},
|
|
450
|
+
shutter: {
|
|
451
|
+
width: 76,
|
|
452
|
+
height: 76,
|
|
453
|
+
borderRadius: 38,
|
|
454
|
+
borderWidth: 4,
|
|
455
|
+
alignItems: 'center',
|
|
456
|
+
justifyContent: 'center',
|
|
457
|
+
},
|
|
458
|
+
shutterDisabled: {
|
|
459
|
+
opacity: 0.5,
|
|
460
|
+
},
|
|
461
|
+
shutterCore: {
|
|
462
|
+
width: 56,
|
|
463
|
+
height: 56,
|
|
464
|
+
borderRadius: 28,
|
|
465
|
+
},
|
|
466
|
+
corner: {
|
|
467
|
+
position: 'absolute',
|
|
468
|
+
width: CORNER_LENGTH,
|
|
469
|
+
height: CORNER_LENGTH,
|
|
470
|
+
borderColor: '#FFFFFF',
|
|
471
|
+
},
|
|
472
|
+
cornerTL: {
|
|
473
|
+
top: 0,
|
|
474
|
+
left: 0,
|
|
475
|
+
borderTopWidth: CORNER_THICKNESS,
|
|
476
|
+
borderLeftWidth: CORNER_THICKNESS,
|
|
477
|
+
},
|
|
478
|
+
cornerTR: {
|
|
479
|
+
top: 0,
|
|
480
|
+
right: 0,
|
|
481
|
+
borderTopWidth: CORNER_THICKNESS,
|
|
482
|
+
borderRightWidth: CORNER_THICKNESS,
|
|
483
|
+
},
|
|
484
|
+
cornerBL: {
|
|
485
|
+
bottom: 0,
|
|
486
|
+
left: 0,
|
|
487
|
+
borderBottomWidth: CORNER_THICKNESS,
|
|
488
|
+
borderLeftWidth: CORNER_THICKNESS,
|
|
489
|
+
},
|
|
490
|
+
cornerBR: {
|
|
491
|
+
bottom: 0,
|
|
492
|
+
right: 0,
|
|
493
|
+
borderBottomWidth: CORNER_THICKNESS,
|
|
494
|
+
borderRightWidth: CORNER_THICKNESS,
|
|
495
|
+
},
|
|
496
|
+
focusRing: {
|
|
497
|
+
position: 'absolute',
|
|
498
|
+
width: FOCUS_RING_SIZE,
|
|
499
|
+
height: FOCUS_RING_SIZE,
|
|
500
|
+
borderRadius: FOCUS_RING_SIZE / 2,
|
|
501
|
+
borderWidth: 2,
|
|
502
|
+
borderColor: '#FFFFFF',
|
|
503
|
+
backgroundColor: 'transparent',
|
|
504
|
+
},
|
|
505
|
+
});
|