@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,356 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CountrySelect — combobox-style picker for ISO 3166-1 alpha-2 codes.
|
|
3
|
+
*
|
|
4
|
+
* Renders a labelled trigger that opens a modal with a search field and a
|
|
5
|
+
* filtered FlatList. Used by every country-aware step (HUMAN_EXTENDED_INFO,
|
|
6
|
+
* LEGAL_EXTENDED_INFO, ADDRESS_INFO).
|
|
7
|
+
*
|
|
8
|
+
* Selection semantics:
|
|
9
|
+
* - The selected option is identified by its 2-letter code; the label shows
|
|
10
|
+
* the localized country name (resolved by `iso3166Countries`).
|
|
11
|
+
* - Search matches against name OR code, case-insensitive.
|
|
12
|
+
* - When `allowedCodes` is provided, the master list is pre-filtered.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
16
|
+
import {
|
|
17
|
+
FlatList,
|
|
18
|
+
Modal,
|
|
19
|
+
Pressable,
|
|
20
|
+
StyleSheet,
|
|
21
|
+
Text,
|
|
22
|
+
TextInput,
|
|
23
|
+
View,
|
|
24
|
+
type StyleProp,
|
|
25
|
+
type ViewStyle,
|
|
26
|
+
} from 'react-native';
|
|
27
|
+
import { useTheme, withAlpha } from '../theme';
|
|
28
|
+
import {
|
|
29
|
+
filterIso3166Countries,
|
|
30
|
+
listIso3166CountriesForUi,
|
|
31
|
+
type Iso3166CountryOption,
|
|
32
|
+
} from '../../utils/iso3166Countries';
|
|
33
|
+
|
|
34
|
+
export interface CountrySelectProps {
|
|
35
|
+
label?: string;
|
|
36
|
+
/** ISO alpha-2 code. */
|
|
37
|
+
value: string | null;
|
|
38
|
+
onChange: (code: string) => void;
|
|
39
|
+
locale?: string | undefined;
|
|
40
|
+
/** Optional ISO alpha-2 allowlist (e.g. from `AddressInfoStepConfig.country_allow`). */
|
|
41
|
+
allowedCodes?: ReadonlyArray<string> | undefined;
|
|
42
|
+
placeholder?: string | undefined;
|
|
43
|
+
searchPlaceholder?: string | undefined;
|
|
44
|
+
errorMessage?: string | null | undefined;
|
|
45
|
+
required?: boolean | undefined;
|
|
46
|
+
disabled?: boolean | undefined;
|
|
47
|
+
containerStyle?: StyleProp<ViewStyle> | undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function CountrySelect({
|
|
51
|
+
label,
|
|
52
|
+
value,
|
|
53
|
+
onChange,
|
|
54
|
+
locale = 'es',
|
|
55
|
+
allowedCodes,
|
|
56
|
+
placeholder,
|
|
57
|
+
searchPlaceholder,
|
|
58
|
+
errorMessage,
|
|
59
|
+
required,
|
|
60
|
+
disabled = false,
|
|
61
|
+
containerStyle,
|
|
62
|
+
}: CountrySelectProps) {
|
|
63
|
+
const theme = useTheme();
|
|
64
|
+
const [open, setOpen] = useState(false);
|
|
65
|
+
const [query, setQuery] = useState('');
|
|
66
|
+
|
|
67
|
+
const baseCountries = useMemo(() => {
|
|
68
|
+
const all = listIso3166CountriesForUi(locale);
|
|
69
|
+
if (!allowedCodes || allowedCodes.length === 0) return all;
|
|
70
|
+
const allow = new Set(allowedCodes.map((c) => c.toUpperCase()));
|
|
71
|
+
return all.filter((c) => allow.has(c.code));
|
|
72
|
+
}, [locale, allowedCodes]);
|
|
73
|
+
|
|
74
|
+
const visible = useMemo(
|
|
75
|
+
() => filterIso3166Countries(baseCountries, query),
|
|
76
|
+
[baseCountries, query],
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const selected = useMemo(
|
|
80
|
+
() => baseCountries.find((c) => c.code === value) ?? null,
|
|
81
|
+
[baseCountries, value],
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const hasError = Boolean(errorMessage && errorMessage.length > 0);
|
|
85
|
+
|
|
86
|
+
const close = useCallback(() => {
|
|
87
|
+
setOpen(false);
|
|
88
|
+
setQuery('');
|
|
89
|
+
}, []);
|
|
90
|
+
|
|
91
|
+
const select = useCallback(
|
|
92
|
+
(item: Iso3166CountryOption) => {
|
|
93
|
+
onChange(item.code);
|
|
94
|
+
close();
|
|
95
|
+
},
|
|
96
|
+
[close, onChange],
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<View style={[styles.wrap, containerStyle]}>
|
|
101
|
+
{label ? (
|
|
102
|
+
<Text style={[styles.label, { color: theme.textColor }]}>
|
|
103
|
+
{label}
|
|
104
|
+
{required ? (
|
|
105
|
+
<Text style={[styles.required, { color: theme.textSecondaryColor }]}>
|
|
106
|
+
{' '}*
|
|
107
|
+
</Text>
|
|
108
|
+
) : null}
|
|
109
|
+
</Text>
|
|
110
|
+
) : null}
|
|
111
|
+
<Pressable
|
|
112
|
+
accessibilityRole="combobox"
|
|
113
|
+
accessibilityState={{ disabled, expanded: open }}
|
|
114
|
+
accessibilityLabel={label}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
onPress={() => setOpen(true)}
|
|
117
|
+
style={[
|
|
118
|
+
styles.trigger,
|
|
119
|
+
{
|
|
120
|
+
backgroundColor: theme.backgroundColor,
|
|
121
|
+
borderColor: hasError ? theme.errorColor : theme.borderColor,
|
|
122
|
+
borderRadius: theme.borderRadiusPx,
|
|
123
|
+
},
|
|
124
|
+
disabled && styles.disabled,
|
|
125
|
+
]}
|
|
126
|
+
>
|
|
127
|
+
<Text
|
|
128
|
+
numberOfLines={1}
|
|
129
|
+
style={[
|
|
130
|
+
styles.triggerText,
|
|
131
|
+
{ color: selected ? theme.textColor : theme.textSecondaryColor },
|
|
132
|
+
]}
|
|
133
|
+
>
|
|
134
|
+
{selected ? selected.name : placeholder ?? ''}
|
|
135
|
+
</Text>
|
|
136
|
+
<Text style={[styles.chevron, { color: theme.textSecondaryColor }]}>
|
|
137
|
+
▾
|
|
138
|
+
</Text>
|
|
139
|
+
</Pressable>
|
|
140
|
+
{hasError ? (
|
|
141
|
+
<Text
|
|
142
|
+
accessibilityLiveRegion="polite"
|
|
143
|
+
style={[styles.error, { color: theme.errorColor }]}
|
|
144
|
+
>
|
|
145
|
+
{errorMessage}
|
|
146
|
+
</Text>
|
|
147
|
+
) : null}
|
|
148
|
+
|
|
149
|
+
<Modal
|
|
150
|
+
visible={open}
|
|
151
|
+
transparent
|
|
152
|
+
animationType="fade"
|
|
153
|
+
onRequestClose={close}
|
|
154
|
+
>
|
|
155
|
+
<Pressable style={styles.backdrop} onPress={close}>
|
|
156
|
+
<Pressable
|
|
157
|
+
style={[
|
|
158
|
+
styles.sheet,
|
|
159
|
+
{
|
|
160
|
+
backgroundColor: theme.backgroundColor,
|
|
161
|
+
borderColor: theme.borderColor,
|
|
162
|
+
borderRadius: theme.borderRadiusPx,
|
|
163
|
+
},
|
|
164
|
+
]}
|
|
165
|
+
onPress={() => undefined}
|
|
166
|
+
>
|
|
167
|
+
{label ? (
|
|
168
|
+
<Text style={[styles.sheetTitle, { color: theme.textColor }]}>
|
|
169
|
+
{label}
|
|
170
|
+
</Text>
|
|
171
|
+
) : null}
|
|
172
|
+
<TextInput
|
|
173
|
+
autoFocus
|
|
174
|
+
autoCapitalize="none"
|
|
175
|
+
autoCorrect={false}
|
|
176
|
+
placeholder={searchPlaceholder ?? placeholder ?? ''}
|
|
177
|
+
placeholderTextColor={theme.textSecondaryColor}
|
|
178
|
+
value={query}
|
|
179
|
+
onChangeText={setQuery}
|
|
180
|
+
style={[
|
|
181
|
+
styles.search,
|
|
182
|
+
{
|
|
183
|
+
color: theme.textColor,
|
|
184
|
+
backgroundColor: theme.backgroundColor,
|
|
185
|
+
borderColor: theme.borderColor,
|
|
186
|
+
borderRadius: theme.borderRadiusPx,
|
|
187
|
+
},
|
|
188
|
+
]}
|
|
189
|
+
/>
|
|
190
|
+
<FlatList
|
|
191
|
+
data={visible}
|
|
192
|
+
keyExtractor={(item) => item.code}
|
|
193
|
+
keyboardShouldPersistTaps="handled"
|
|
194
|
+
style={styles.list}
|
|
195
|
+
renderItem={({ item }) => {
|
|
196
|
+
const isSelected = item.code === value;
|
|
197
|
+
// Suppress the trailing code badge when the resolver
|
|
198
|
+
// already echoed the code as the name (Hermes fallback for
|
|
199
|
+
// countries outside the built-in map). Showing "AR AR"
|
|
200
|
+
// adds noise without information.
|
|
201
|
+
const showCodeBadge = item.name.toUpperCase() !== item.code;
|
|
202
|
+
return (
|
|
203
|
+
<Pressable
|
|
204
|
+
accessibilityRole="menuitem"
|
|
205
|
+
accessibilityState={{ selected: isSelected }}
|
|
206
|
+
onPress={() => select(item)}
|
|
207
|
+
style={({ pressed }) => [
|
|
208
|
+
styles.option,
|
|
209
|
+
isSelected && {
|
|
210
|
+
backgroundColor: withAlpha(theme.primaryColor, 0.12),
|
|
211
|
+
},
|
|
212
|
+
pressed && {
|
|
213
|
+
backgroundColor: withAlpha(theme.primaryColor, 0.18),
|
|
214
|
+
},
|
|
215
|
+
]}
|
|
216
|
+
>
|
|
217
|
+
<Text
|
|
218
|
+
numberOfLines={1}
|
|
219
|
+
style={[
|
|
220
|
+
styles.optionText,
|
|
221
|
+
{
|
|
222
|
+
color: isSelected ? theme.primaryColor : theme.textColor,
|
|
223
|
+
fontWeight: isSelected ? '600' : '400',
|
|
224
|
+
},
|
|
225
|
+
]}
|
|
226
|
+
>
|
|
227
|
+
{item.name}
|
|
228
|
+
</Text>
|
|
229
|
+
{showCodeBadge ? (
|
|
230
|
+
<View
|
|
231
|
+
style={[
|
|
232
|
+
styles.optionCodeBadge,
|
|
233
|
+
{
|
|
234
|
+
backgroundColor: withAlpha(theme.textColor, 0.06),
|
|
235
|
+
},
|
|
236
|
+
]}
|
|
237
|
+
>
|
|
238
|
+
<Text
|
|
239
|
+
style={[
|
|
240
|
+
styles.optionCode,
|
|
241
|
+
{ color: theme.textSecondaryColor },
|
|
242
|
+
]}
|
|
243
|
+
>
|
|
244
|
+
{item.code}
|
|
245
|
+
</Text>
|
|
246
|
+
</View>
|
|
247
|
+
) : null}
|
|
248
|
+
</Pressable>
|
|
249
|
+
);
|
|
250
|
+
}}
|
|
251
|
+
/>
|
|
252
|
+
</Pressable>
|
|
253
|
+
</Pressable>
|
|
254
|
+
</Modal>
|
|
255
|
+
</View>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const styles = StyleSheet.create({
|
|
260
|
+
wrap: {
|
|
261
|
+
width: '100%',
|
|
262
|
+
marginBottom: 4,
|
|
263
|
+
},
|
|
264
|
+
label: {
|
|
265
|
+
fontSize: 14,
|
|
266
|
+
fontWeight: '500',
|
|
267
|
+
marginBottom: 4,
|
|
268
|
+
},
|
|
269
|
+
required: {
|
|
270
|
+
fontWeight: '400',
|
|
271
|
+
},
|
|
272
|
+
trigger: {
|
|
273
|
+
minHeight: 44,
|
|
274
|
+
paddingHorizontal: 12,
|
|
275
|
+
paddingVertical: 10,
|
|
276
|
+
borderWidth: 1,
|
|
277
|
+
flexDirection: 'row',
|
|
278
|
+
alignItems: 'center',
|
|
279
|
+
justifyContent: 'space-between',
|
|
280
|
+
},
|
|
281
|
+
triggerText: {
|
|
282
|
+
fontSize: 15,
|
|
283
|
+
flex: 1,
|
|
284
|
+
},
|
|
285
|
+
chevron: {
|
|
286
|
+
fontSize: 14,
|
|
287
|
+
marginLeft: 8,
|
|
288
|
+
},
|
|
289
|
+
disabled: {
|
|
290
|
+
opacity: 0.5,
|
|
291
|
+
},
|
|
292
|
+
error: {
|
|
293
|
+
fontSize: 13,
|
|
294
|
+
marginTop: 4,
|
|
295
|
+
lineHeight: 18,
|
|
296
|
+
},
|
|
297
|
+
backdrop: {
|
|
298
|
+
flex: 1,
|
|
299
|
+
backgroundColor: 'rgba(0,0,0,0.4)',
|
|
300
|
+
justifyContent: 'center',
|
|
301
|
+
alignItems: 'center',
|
|
302
|
+
padding: 20,
|
|
303
|
+
},
|
|
304
|
+
sheet: {
|
|
305
|
+
width: '100%',
|
|
306
|
+
maxWidth: 420,
|
|
307
|
+
maxHeight: '80%',
|
|
308
|
+
borderWidth: 1,
|
|
309
|
+
paddingHorizontal: 12,
|
|
310
|
+
paddingTop: 12,
|
|
311
|
+
paddingBottom: 8,
|
|
312
|
+
},
|
|
313
|
+
sheetTitle: {
|
|
314
|
+
fontSize: 16,
|
|
315
|
+
fontWeight: '600',
|
|
316
|
+
marginBottom: 8,
|
|
317
|
+
},
|
|
318
|
+
search: {
|
|
319
|
+
minHeight: 44,
|
|
320
|
+
paddingHorizontal: 12,
|
|
321
|
+
paddingVertical: 10,
|
|
322
|
+
fontSize: 15,
|
|
323
|
+
borderWidth: 1,
|
|
324
|
+
marginBottom: 8,
|
|
325
|
+
},
|
|
326
|
+
list: {
|
|
327
|
+
flexShrink: 1,
|
|
328
|
+
},
|
|
329
|
+
option: {
|
|
330
|
+
flexDirection: 'row',
|
|
331
|
+
alignItems: 'center',
|
|
332
|
+
minHeight: 44,
|
|
333
|
+
paddingHorizontal: 12,
|
|
334
|
+
paddingVertical: 12,
|
|
335
|
+
justifyContent: 'space-between',
|
|
336
|
+
gap: 12,
|
|
337
|
+
borderRadius: 6,
|
|
338
|
+
},
|
|
339
|
+
optionCodeBadge: {
|
|
340
|
+
paddingHorizontal: 8,
|
|
341
|
+
paddingVertical: 2,
|
|
342
|
+
borderRadius: 4,
|
|
343
|
+
minWidth: 36,
|
|
344
|
+
alignItems: 'center',
|
|
345
|
+
},
|
|
346
|
+
optionText: {
|
|
347
|
+
fontSize: 15,
|
|
348
|
+
flex: 1,
|
|
349
|
+
},
|
|
350
|
+
optionCode: {
|
|
351
|
+
fontSize: 11,
|
|
352
|
+
fontWeight: '600',
|
|
353
|
+
letterSpacing: 0.5,
|
|
354
|
+
fontVariant: ['tabular-nums'],
|
|
355
|
+
},
|
|
356
|
+
});
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date input — three side-by-side `<Select>`s for day / month / year.
|
|
3
|
+
*
|
|
4
|
+
* Why three selects instead of `@react-native-community/datetimepicker`:
|
|
5
|
+
* - Zero additional native deps; the picker module needs Pods linking and
|
|
6
|
+
* extra Expo prebuild config. Adding it before we _need_ it (we don't yet
|
|
7
|
+
* for HUMAN_EXTENDED_INFO and LEGAL_EXTENDED_INFO) just bloats the bundle.
|
|
8
|
+
* - Three selects feel deliberate and avoid the platform-specific calendar
|
|
9
|
+
* inconsistency of the native pickers across iOS and Android.
|
|
10
|
+
*
|
|
11
|
+
* State model:
|
|
12
|
+
* The component keeps a private `draft` of the partial selection so an
|
|
13
|
+
* intermediate state like "day=15, month=, year=" stays visible while the
|
|
14
|
+
* user fills in the rest. The `value` prop only reflects the *complete*
|
|
15
|
+
* ISO string — when any of the three pieces is missing we surface `null`
|
|
16
|
+
* to the parent. An external `value` change (form reset, prefill, etc.)
|
|
17
|
+
* re-syncs the draft.
|
|
18
|
+
*
|
|
19
|
+
* Output: ISO 8601 date (`YYYY-MM-DD`) when all three parts are filled,
|
|
20
|
+
* otherwise `null`. The host form passes that value as the field's
|
|
21
|
+
* `birth_date` / `incorporation_date` payload.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
25
|
+
import { StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
26
|
+
import { useTheme } from '../theme';
|
|
27
|
+
import { Select, type SelectOption } from './Select';
|
|
28
|
+
|
|
29
|
+
export interface DatePickerProps {
|
|
30
|
+
label?: string;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
/** ISO 8601 date string (`YYYY-MM-DD`) or `null` when unset. */
|
|
33
|
+
value: string | null;
|
|
34
|
+
onChange: (next: string | null) => void;
|
|
35
|
+
errorMessage?: string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Earliest selectable year. Defaults to 1900 — wide enough for KYC birth
|
|
38
|
+
* dates while still bounded.
|
|
39
|
+
*/
|
|
40
|
+
minYear?: number;
|
|
41
|
+
/** Latest selectable year. Defaults to the current year. */
|
|
42
|
+
maxYear?: number;
|
|
43
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
44
|
+
monthLabels?: ReadonlyArray<string>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface ParsedDate {
|
|
48
|
+
year: string;
|
|
49
|
+
month: string;
|
|
50
|
+
day: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const EMPTY_DATE: ParsedDate = { year: '', month: '', day: '' };
|
|
54
|
+
|
|
55
|
+
const FALLBACK_MONTHS_ES: ReadonlyArray<string> = [
|
|
56
|
+
'Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic',
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
function parseISO(value: string | null): ParsedDate {
|
|
60
|
+
if (!value) return { ...EMPTY_DATE };
|
|
61
|
+
const m = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
62
|
+
if (!m) return { ...EMPTY_DATE };
|
|
63
|
+
return { year: m[1] ?? '', month: m[2] ?? '', day: m[3] ?? '' };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function buildIso(year: string, month: string, day: string): string | null {
|
|
67
|
+
if (!year || !month || !day) return null;
|
|
68
|
+
const y = Number(year);
|
|
69
|
+
const mo = Number(month);
|
|
70
|
+
const d = Number(day);
|
|
71
|
+
if (!Number.isFinite(y) || !Number.isFinite(mo) || !Number.isFinite(d)) return null;
|
|
72
|
+
// Validate the day fits the month (e.g. 31 of Feb → invalid → null).
|
|
73
|
+
const test = new Date(Date.UTC(y, mo - 1, d));
|
|
74
|
+
if (
|
|
75
|
+
test.getUTCFullYear() !== y ||
|
|
76
|
+
test.getUTCMonth() !== mo - 1 ||
|
|
77
|
+
test.getUTCDate() !== d
|
|
78
|
+
) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return `${year}-${month}-${day}`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function pad2(n: number): string {
|
|
85
|
+
return n < 10 ? `0${n}` : String(n);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function DatePicker({
|
|
89
|
+
label,
|
|
90
|
+
required,
|
|
91
|
+
value,
|
|
92
|
+
onChange,
|
|
93
|
+
errorMessage,
|
|
94
|
+
minYear = 1900,
|
|
95
|
+
maxYear = new Date().getFullYear(),
|
|
96
|
+
containerStyle,
|
|
97
|
+
monthLabels = FALLBACK_MONTHS_ES,
|
|
98
|
+
}: DatePickerProps) {
|
|
99
|
+
const theme = useTheme();
|
|
100
|
+
|
|
101
|
+
// Persistent draft of the user's partial selection. Survives the
|
|
102
|
+
// intermediate `onChange(null)` calls that happen until all three fields
|
|
103
|
+
// are filled.
|
|
104
|
+
const [draft, setDraft] = useState<ParsedDate>(() => parseISO(value));
|
|
105
|
+
|
|
106
|
+
// Re-sync the draft when the parent pushes a different `value` than the
|
|
107
|
+
// one our draft currently produces. Skips the resync if the external
|
|
108
|
+
// value matches what the draft would emit (the common case after every
|
|
109
|
+
// intermediate `onChange`), which prevents a feedback loop.
|
|
110
|
+
const lastEmittedRef = useRef<string | null>(buildIso(draft.year, draft.month, draft.day));
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (value === lastEmittedRef.current) return;
|
|
113
|
+
setDraft(parseISO(value));
|
|
114
|
+
lastEmittedRef.current = value;
|
|
115
|
+
}, [value]);
|
|
116
|
+
|
|
117
|
+
const yearOptions = useMemo<SelectOption[]>(() => {
|
|
118
|
+
const out: SelectOption[] = [];
|
|
119
|
+
for (let y = maxYear; y >= minYear; y -= 1) {
|
|
120
|
+
out.push({ value: String(y), label: String(y) });
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}, [maxYear, minYear]);
|
|
124
|
+
|
|
125
|
+
const monthOptions = useMemo<SelectOption[]>(() => {
|
|
126
|
+
return Array.from({ length: 12 }, (_, i) => ({
|
|
127
|
+
value: pad2(i + 1),
|
|
128
|
+
label: monthLabels[i] ?? pad2(i + 1),
|
|
129
|
+
}));
|
|
130
|
+
}, [monthLabels]);
|
|
131
|
+
|
|
132
|
+
const dayOptions = useMemo<SelectOption[]>(() => {
|
|
133
|
+
const max = daysInMonth(draft.year, draft.month);
|
|
134
|
+
return Array.from({ length: max }, (_, i) => ({
|
|
135
|
+
value: pad2(i + 1),
|
|
136
|
+
label: pad2(i + 1),
|
|
137
|
+
}));
|
|
138
|
+
}, [draft.month, draft.year]);
|
|
139
|
+
|
|
140
|
+
const update = useCallback(
|
|
141
|
+
(next: ParsedDate) => {
|
|
142
|
+
setDraft(next);
|
|
143
|
+
const iso = buildIso(next.year, next.month, next.day);
|
|
144
|
+
lastEmittedRef.current = iso;
|
|
145
|
+
onChange(iso);
|
|
146
|
+
},
|
|
147
|
+
[onChange],
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
const onDay = useCallback(
|
|
151
|
+
(day: string) => update({ ...draft, day }),
|
|
152
|
+
[draft, update],
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const onMonth = useCallback(
|
|
156
|
+
(month: string) => {
|
|
157
|
+
// If the chosen month is shorter than the current day, pull the day in.
|
|
158
|
+
update({ ...draft, month, day: clampDay(draft.day, month, draft.year) });
|
|
159
|
+
},
|
|
160
|
+
[draft, update],
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
const onYear = useCallback(
|
|
164
|
+
(year: string) => {
|
|
165
|
+
// Year change can also shorten the month (Feb 29 only on leap years).
|
|
166
|
+
update({ ...draft, year, day: clampDay(draft.day, draft.month, year) });
|
|
167
|
+
},
|
|
168
|
+
[draft, update],
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const hasError = Boolean(errorMessage && errorMessage.length > 0);
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<View style={[styles.wrap, containerStyle]}>
|
|
175
|
+
{label ? (
|
|
176
|
+
<Text style={[styles.label, { color: theme.textColor }]}>
|
|
177
|
+
{label}
|
|
178
|
+
{required ? (
|
|
179
|
+
<Text style={[styles.required, { color: theme.textSecondaryColor }]}>
|
|
180
|
+
{' '}*
|
|
181
|
+
</Text>
|
|
182
|
+
) : null}
|
|
183
|
+
</Text>
|
|
184
|
+
) : null}
|
|
185
|
+
<View style={styles.row}>
|
|
186
|
+
<View style={styles.cell}>
|
|
187
|
+
<Select
|
|
188
|
+
options={dayOptions}
|
|
189
|
+
value={draft.day || null}
|
|
190
|
+
onChange={onDay}
|
|
191
|
+
placeholder="DD"
|
|
192
|
+
errorMessage={hasError ? '' : null}
|
|
193
|
+
/>
|
|
194
|
+
</View>
|
|
195
|
+
<View style={styles.cell}>
|
|
196
|
+
<Select
|
|
197
|
+
options={monthOptions}
|
|
198
|
+
value={draft.month || null}
|
|
199
|
+
onChange={onMonth}
|
|
200
|
+
placeholder="MM"
|
|
201
|
+
errorMessage={hasError ? '' : null}
|
|
202
|
+
/>
|
|
203
|
+
</View>
|
|
204
|
+
<View style={styles.cellWide}>
|
|
205
|
+
<Select
|
|
206
|
+
options={yearOptions}
|
|
207
|
+
value={draft.year || null}
|
|
208
|
+
onChange={onYear}
|
|
209
|
+
placeholder="YYYY"
|
|
210
|
+
errorMessage={hasError ? '' : null}
|
|
211
|
+
/>
|
|
212
|
+
</View>
|
|
213
|
+
</View>
|
|
214
|
+
{hasError ? (
|
|
215
|
+
<Text style={[styles.error, { color: theme.errorColor }]}>
|
|
216
|
+
{errorMessage}
|
|
217
|
+
</Text>
|
|
218
|
+
) : null}
|
|
219
|
+
</View>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function clampDay(day: string, month: string, year: string): string {
|
|
224
|
+
if (!day) return day;
|
|
225
|
+
const max = daysInMonth(year, month);
|
|
226
|
+
const dn = Number(day);
|
|
227
|
+
if (!Number.isFinite(dn)) return '';
|
|
228
|
+
return dn > max ? pad2(max) : pad2(dn);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function daysInMonth(year: string, month: string): number {
|
|
232
|
+
const y = Number(year) || 2000;
|
|
233
|
+
const m = Number(month) || 1;
|
|
234
|
+
// 0-indexed month; passing day 0 of next month yields last day of m.
|
|
235
|
+
return new Date(y, m, 0).getDate() || 31;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const styles = StyleSheet.create({
|
|
239
|
+
wrap: {
|
|
240
|
+
width: '100%',
|
|
241
|
+
marginBottom: 4,
|
|
242
|
+
},
|
|
243
|
+
label: {
|
|
244
|
+
fontSize: 14,
|
|
245
|
+
fontWeight: '500',
|
|
246
|
+
marginBottom: 4,
|
|
247
|
+
},
|
|
248
|
+
required: {
|
|
249
|
+
fontWeight: '400',
|
|
250
|
+
},
|
|
251
|
+
row: {
|
|
252
|
+
flexDirection: 'row',
|
|
253
|
+
gap: 8,
|
|
254
|
+
},
|
|
255
|
+
cell: {
|
|
256
|
+
flex: 1,
|
|
257
|
+
},
|
|
258
|
+
cellWide: {
|
|
259
|
+
flex: 1.4,
|
|
260
|
+
},
|
|
261
|
+
error: {
|
|
262
|
+
fontSize: 13,
|
|
263
|
+
marginTop: 4,
|
|
264
|
+
lineHeight: 18,
|
|
265
|
+
},
|
|
266
|
+
});
|