@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,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HUMAN_BASIC_INFO step — natural-person identification data.
|
|
3
|
+
*
|
|
4
|
+
* - Form: first_name, last_name, identification_type (select from
|
|
5
|
+
* stepConfig.accepted_country_documents), identification_id.
|
|
6
|
+
* - Names are NFC-normalized (`normalizePersonNameSegment`) before submit.
|
|
7
|
+
* - On submit failure: surface a `<RetryDialog>` so the user can retry
|
|
8
|
+
* without losing their inputs.
|
|
9
|
+
*
|
|
10
|
+
* The orchestrator's view bridge (`StepUiHandle.setNode`) is how this module
|
|
11
|
+
* mounts its UI into `<VelionOnboardingScreen>`. Loading and retry overlays
|
|
12
|
+
* live alongside the form via the orchestrator's `setLoading` and the
|
|
13
|
+
* step-local retry dialog node.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
17
|
+
import { View } from 'react-native';
|
|
18
|
+
import {
|
|
19
|
+
SdkErrorCode,
|
|
20
|
+
type HumanBasicInfoPayload,
|
|
21
|
+
type HumanBasicInfoStepConfig,
|
|
22
|
+
type SdkError,
|
|
23
|
+
} from '../types';
|
|
24
|
+
import { Banner } from '../ui/primitives/Banner';
|
|
25
|
+
import { Button } from '../ui/primitives/Button';
|
|
26
|
+
import { Input } from '../ui/primitives/Input';
|
|
27
|
+
import { Select, type SelectOption } from '../ui/primitives/Select';
|
|
28
|
+
import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
|
|
29
|
+
import { RetryDialog } from '../ui/overlays/RetryDialog';
|
|
30
|
+
import { StepShell } from '../ui/StepShell';
|
|
31
|
+
import { StepIcon } from '../ui/icons/StepIcon';
|
|
32
|
+
import { useInlineValidation, required } from '../ui/forms';
|
|
33
|
+
import { getStrings, type StringsTable } from '../i18n';
|
|
34
|
+
import { resolveDocumentTypeOptions } from '../utils/documentTypeOptions';
|
|
35
|
+
import { resolveDocumentOptionsFromStepConfig } from '../utils/stepConfig';
|
|
36
|
+
import { normalizePersonNameSegment } from '../utils/personNameNormalize';
|
|
37
|
+
import type { ApiCaller } from '../transport/api';
|
|
38
|
+
import type { StepDeps, StepModule } from './types';
|
|
39
|
+
|
|
40
|
+
interface FormState {
|
|
41
|
+
first_name: string;
|
|
42
|
+
last_name: string;
|
|
43
|
+
identification_type: string;
|
|
44
|
+
identification_id: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class HumanBasicInfoStep implements StepModule {
|
|
48
|
+
private resolveStep!: () => void;
|
|
49
|
+
private rejectStep!: (err: SdkError) => void;
|
|
50
|
+
private destroyed = false;
|
|
51
|
+
|
|
52
|
+
constructor(private readonly deps: StepDeps) {}
|
|
53
|
+
|
|
54
|
+
run(): Promise<void> {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
this.resolveStep = resolve;
|
|
57
|
+
this.rejectStep = reject;
|
|
58
|
+
this.deps.ui.setNode(
|
|
59
|
+
<HumanBasicInfoView
|
|
60
|
+
api={this.deps.api}
|
|
61
|
+
sessionId={this.deps.sessionId}
|
|
62
|
+
locale={this.deps.locale}
|
|
63
|
+
stepConfig={this.deps.stepConfig as HumanBasicInfoStepConfig | undefined}
|
|
64
|
+
onComplete={() => {
|
|
65
|
+
if (this.destroyed) return;
|
|
66
|
+
this.deps.ui.setNode(null);
|
|
67
|
+
this.resolveStep();
|
|
68
|
+
}}
|
|
69
|
+
onCancel={(err) => {
|
|
70
|
+
if (this.destroyed) return;
|
|
71
|
+
this.deps.ui.setNode(null);
|
|
72
|
+
this.rejectStep(err);
|
|
73
|
+
}}
|
|
74
|
+
/>,
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
destroy(): void {
|
|
80
|
+
this.destroyed = true;
|
|
81
|
+
this.deps.ui.setNode(null);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface ViewProps {
|
|
86
|
+
api: ApiCaller;
|
|
87
|
+
sessionId: string;
|
|
88
|
+
locale: string;
|
|
89
|
+
stepConfig: HumanBasicInfoStepConfig | undefined;
|
|
90
|
+
onComplete: () => void;
|
|
91
|
+
onCancel: (err: SdkError) => void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function HumanBasicInfoView({
|
|
95
|
+
api,
|
|
96
|
+
sessionId,
|
|
97
|
+
locale,
|
|
98
|
+
stepConfig,
|
|
99
|
+
onComplete,
|
|
100
|
+
onCancel,
|
|
101
|
+
}: ViewProps) {
|
|
102
|
+
const t = getStrings(locale);
|
|
103
|
+
const documentOptions = useMemo<SelectOption[]>(() => {
|
|
104
|
+
const fromConfig = resolveDocumentOptionsFromStepConfig(stepConfig);
|
|
105
|
+
if (fromConfig && fromConfig.length > 0) return fromConfig;
|
|
106
|
+
return resolveDocumentTypeOptions(locale);
|
|
107
|
+
}, [stepConfig, locale]);
|
|
108
|
+
|
|
109
|
+
const [form, setForm] = useState<FormState>(() => ({
|
|
110
|
+
first_name: '',
|
|
111
|
+
last_name: '',
|
|
112
|
+
identification_type: documentOptions[0]?.value ?? '',
|
|
113
|
+
identification_id: '',
|
|
114
|
+
}));
|
|
115
|
+
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
116
|
+
const [submitting, setSubmitting] = useState(false);
|
|
117
|
+
const [retry, setRetry] = useState<{ message: string } | null>(null);
|
|
118
|
+
|
|
119
|
+
// Default the select to the first option once it becomes available, so the
|
|
120
|
+
// payload always has a non-empty `identification_type` even if the user
|
|
121
|
+
// submits without touching the dropdown.
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (!form.identification_type && documentOptions[0]) {
|
|
124
|
+
setForm((f) => ({ ...f, identification_type: documentOptions[0]!.value }));
|
|
125
|
+
}
|
|
126
|
+
}, [documentOptions, form.identification_type]);
|
|
127
|
+
|
|
128
|
+
const setField = useCallback(
|
|
129
|
+
<K extends keyof FormState>(key: K, value: FormState[K]) => {
|
|
130
|
+
setForm((f) => ({ ...f, [key]: value }));
|
|
131
|
+
},
|
|
132
|
+
[],
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const validation = useInlineValidation<keyof FormState>(
|
|
136
|
+
[
|
|
137
|
+
{ name: 'first_name', validate: required(t.human_basic_info.nameRequired) },
|
|
138
|
+
{ name: 'last_name', validate: required(t.human_basic_info.nameRequired) },
|
|
139
|
+
{ name: 'identification_type', validate: required(t.human_basic_info.idTypeRequired) },
|
|
140
|
+
{ name: 'identification_id', validate: required(t.human_basic_info.idNumberRequired) },
|
|
141
|
+
],
|
|
142
|
+
(name, value) => setField(name, value),
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const handleSubmit = useCallback(async () => {
|
|
146
|
+
setBannerError(null);
|
|
147
|
+
if (!validation.validateAll(form)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const first_name = normalizePersonNameSegment(form.first_name);
|
|
151
|
+
const last_name = normalizePersonNameSegment(form.last_name);
|
|
152
|
+
if (!first_name || !last_name) {
|
|
153
|
+
setBannerError(t.human_basic_info.nameRequired);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const payload: HumanBasicInfoPayload = {
|
|
158
|
+
first_name,
|
|
159
|
+
last_name,
|
|
160
|
+
identification_type: form.identification_type.trim(),
|
|
161
|
+
identification_id: form.identification_id.trim(),
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
setSubmitting(true);
|
|
165
|
+
try {
|
|
166
|
+
await api.post(`/sessions/${sessionId}/basic-info/human`, payload);
|
|
167
|
+
setSubmitting(false);
|
|
168
|
+
onComplete();
|
|
169
|
+
} catch (err) {
|
|
170
|
+
setSubmitting(false);
|
|
171
|
+
const sdkErr = toSdkError(err, t);
|
|
172
|
+
setBannerError(sdkErr.message);
|
|
173
|
+
setRetry({ message: sdkErr.message });
|
|
174
|
+
}
|
|
175
|
+
}, [api, form, onComplete, sessionId, t, validation]);
|
|
176
|
+
|
|
177
|
+
if (retry) {
|
|
178
|
+
return (
|
|
179
|
+
<RetryDialog
|
|
180
|
+
title={t.common.submissionTitle}
|
|
181
|
+
message={retry.message || t.common.submissionFallback}
|
|
182
|
+
retryLabel={t.common.retry}
|
|
183
|
+
cancelLabel={t.common.cancel}
|
|
184
|
+
onRetry={() => setRetry(null)}
|
|
185
|
+
onCancel={() => {
|
|
186
|
+
setRetry(null);
|
|
187
|
+
onCancel({
|
|
188
|
+
code: SdkErrorCode.API_ERROR,
|
|
189
|
+
message: retry.message,
|
|
190
|
+
});
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<View style={{ flex: 1 }}>
|
|
198
|
+
<StepShell
|
|
199
|
+
title={t.human_basic_info.title}
|
|
200
|
+
subtitle={t.human_basic_info.subtitle}
|
|
201
|
+
iconNode={<StepIcon name="badge" />}
|
|
202
|
+
>
|
|
203
|
+
<Input
|
|
204
|
+
label={t.human_basic_info.givenNames}
|
|
205
|
+
required
|
|
206
|
+
autoCapitalize="words"
|
|
207
|
+
autoComplete="name-given"
|
|
208
|
+
textContentType="givenName"
|
|
209
|
+
autoCorrect={false}
|
|
210
|
+
value={form.first_name}
|
|
211
|
+
{...validation.bind('first_name', form.first_name)}
|
|
212
|
+
/>
|
|
213
|
+
<Input
|
|
214
|
+
label={t.human_basic_info.familyNames}
|
|
215
|
+
required
|
|
216
|
+
autoCapitalize="words"
|
|
217
|
+
autoComplete="name-family"
|
|
218
|
+
textContentType="familyName"
|
|
219
|
+
autoCorrect={false}
|
|
220
|
+
value={form.last_name}
|
|
221
|
+
{...validation.bind('last_name', form.last_name)}
|
|
222
|
+
/>
|
|
223
|
+
<Select
|
|
224
|
+
label={t.human_basic_info.idType}
|
|
225
|
+
required
|
|
226
|
+
options={documentOptions}
|
|
227
|
+
value={form.identification_type || null}
|
|
228
|
+
onChange={(v) => {
|
|
229
|
+
setField('identification_type', v);
|
|
230
|
+
validation.setFieldError('identification_type', null);
|
|
231
|
+
}}
|
|
232
|
+
errorMessage={validation.errors.identification_type ?? null}
|
|
233
|
+
/>
|
|
234
|
+
<Input
|
|
235
|
+
label={t.human_basic_info.idNumber}
|
|
236
|
+
required
|
|
237
|
+
keyboardType="default"
|
|
238
|
+
autoCapitalize="characters"
|
|
239
|
+
autoCorrect={false}
|
|
240
|
+
value={form.identification_id}
|
|
241
|
+
{...validation.bind('identification_id', form.identification_id)}
|
|
242
|
+
/>
|
|
243
|
+
{bannerError ? <Banner message={bannerError} /> : null}
|
|
244
|
+
<Button
|
|
245
|
+
label={t.common.continue}
|
|
246
|
+
onPress={handleSubmit}
|
|
247
|
+
loading={submitting}
|
|
248
|
+
disabled={submitting}
|
|
249
|
+
/>
|
|
250
|
+
</StepShell>
|
|
251
|
+
{submitting ? <LoadingOverlay message={t.common.submitting} /> : null}
|
|
252
|
+
</View>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function toSdkError(err: unknown, t: StringsTable): SdkError {
|
|
257
|
+
if (
|
|
258
|
+
err != null &&
|
|
259
|
+
typeof err === 'object' &&
|
|
260
|
+
'code' in err &&
|
|
261
|
+
typeof (err as SdkError).code === 'string' &&
|
|
262
|
+
'message' in err &&
|
|
263
|
+
typeof (err as SdkError).message === 'string'
|
|
264
|
+
) {
|
|
265
|
+
return err as SdkError;
|
|
266
|
+
}
|
|
267
|
+
const message =
|
|
268
|
+
err instanceof Error ? err.message : t.common.submissionFallback;
|
|
269
|
+
return {
|
|
270
|
+
code: SdkErrorCode.API_ERROR,
|
|
271
|
+
message: message || t.common.submissionFallback,
|
|
272
|
+
cause: err,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HUMAN_EXTENDED_INFO — POST /sessions/:id/extended-info/human.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `HumanExtendedInfoModule.ts`. Each field's visibility and required
|
|
5
|
+
* state is read from `stepConfig.fields.<field>.{visible,required}`. Values
|
|
6
|
+
* default to `visible: true, required: true` when undefined (web parity).
|
|
7
|
+
*
|
|
8
|
+
* `gender` and `civil_status` options come from
|
|
9
|
+
* `stepConfig.fields.<field>.options` first, then `stepConfig.gender_options`
|
|
10
|
+
* / `civil_status_options` as a fallback. `birth_country` / `citizenship` /
|
|
11
|
+
* `residence_country` are 2-letter ISO codes resolved through `<CountrySelect>`.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
15
|
+
import { View } from 'react-native';
|
|
16
|
+
import {
|
|
17
|
+
SdkErrorCode,
|
|
18
|
+
type HumanExtendedInfoPayload,
|
|
19
|
+
type HumanExtendedInfoStepConfig,
|
|
20
|
+
type SdkError,
|
|
21
|
+
type StepFieldOption,
|
|
22
|
+
} from '../types';
|
|
23
|
+
import { Banner } from '../ui/primitives/Banner';
|
|
24
|
+
import { Button } from '../ui/primitives/Button';
|
|
25
|
+
import { Select, type SelectOption } from '../ui/primitives/Select';
|
|
26
|
+
import { DatePicker } from '../ui/primitives/DatePicker';
|
|
27
|
+
import { CountrySelect } from '../ui/primitives/CountrySelect';
|
|
28
|
+
import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
|
|
29
|
+
import { RetryDialog } from '../ui/overlays/RetryDialog';
|
|
30
|
+
import { StepShell } from '../ui/StepShell';
|
|
31
|
+
import { StepIcon } from '../ui/icons/StepIcon';
|
|
32
|
+
import { getStrings } from '../i18n';
|
|
33
|
+
import type { ApiCaller } from '../transport/api';
|
|
34
|
+
import type { StepDeps, StepModule } from './types';
|
|
35
|
+
import { toSubmissionError } from './_shared';
|
|
36
|
+
|
|
37
|
+
export class HumanExtendedInfoStep implements StepModule {
|
|
38
|
+
private resolveStep!: () => void;
|
|
39
|
+
private rejectStep!: (err: SdkError) => void;
|
|
40
|
+
private destroyed = false;
|
|
41
|
+
|
|
42
|
+
constructor(private readonly deps: StepDeps) {}
|
|
43
|
+
|
|
44
|
+
run(): Promise<void> {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
this.resolveStep = resolve;
|
|
47
|
+
this.rejectStep = reject;
|
|
48
|
+
this.deps.ui.setNode(
|
|
49
|
+
<HumanExtendedInfoView
|
|
50
|
+
api={this.deps.api}
|
|
51
|
+
sessionId={this.deps.sessionId}
|
|
52
|
+
locale={this.deps.locale}
|
|
53
|
+
stepConfig={
|
|
54
|
+
this.deps.stepConfig as HumanExtendedInfoStepConfig | undefined
|
|
55
|
+
}
|
|
56
|
+
onComplete={() => {
|
|
57
|
+
if (this.destroyed) return;
|
|
58
|
+
this.deps.ui.setNode(null);
|
|
59
|
+
this.resolveStep();
|
|
60
|
+
}}
|
|
61
|
+
onCancel={(err) => {
|
|
62
|
+
if (this.destroyed) return;
|
|
63
|
+
this.deps.ui.setNode(null);
|
|
64
|
+
this.rejectStep(err);
|
|
65
|
+
}}
|
|
66
|
+
/>,
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
destroy(): void {
|
|
72
|
+
this.destroyed = true;
|
|
73
|
+
this.deps.ui.setNode(null);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function resolveSelectOptions(
|
|
78
|
+
fromField: StepFieldOption[] | undefined,
|
|
79
|
+
fromTopLevel: StepFieldOption[] | undefined,
|
|
80
|
+
): SelectOption[] {
|
|
81
|
+
const raw = Array.isArray(fromField) && fromField.length > 0 ? fromField : fromTopLevel;
|
|
82
|
+
if (!Array.isArray(raw)) return [];
|
|
83
|
+
return raw
|
|
84
|
+
.map((opt) => {
|
|
85
|
+
const value = typeof opt?.id === 'string' ? opt.id.trim() : '';
|
|
86
|
+
if (!value) return null;
|
|
87
|
+
const display =
|
|
88
|
+
typeof opt.display_value === 'string' ? opt.display_value.trim() : '';
|
|
89
|
+
return { value, label: display || value };
|
|
90
|
+
})
|
|
91
|
+
.filter((opt): opt is SelectOption => opt !== null);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface FormState {
|
|
95
|
+
gender: string;
|
|
96
|
+
civil_status: string;
|
|
97
|
+
birth_date: string | null;
|
|
98
|
+
birth_country: string | null;
|
|
99
|
+
citizenship: string | null;
|
|
100
|
+
residence_country: string | null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface ViewProps {
|
|
104
|
+
api: ApiCaller;
|
|
105
|
+
sessionId: string;
|
|
106
|
+
locale: string;
|
|
107
|
+
stepConfig: HumanExtendedInfoStepConfig | undefined;
|
|
108
|
+
onComplete: () => void;
|
|
109
|
+
onCancel: (err: SdkError) => void;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function HumanExtendedInfoView({
|
|
113
|
+
api,
|
|
114
|
+
sessionId,
|
|
115
|
+
locale,
|
|
116
|
+
stepConfig,
|
|
117
|
+
onComplete,
|
|
118
|
+
onCancel,
|
|
119
|
+
}: ViewProps) {
|
|
120
|
+
const t = getStrings(locale);
|
|
121
|
+
const f = stepConfig?.fields;
|
|
122
|
+
const showGender = f?.gender?.visible !== false;
|
|
123
|
+
const reqGender = f?.gender?.required !== false;
|
|
124
|
+
const showCivil = f?.civil_status?.visible !== false;
|
|
125
|
+
const reqCivil = f?.civil_status?.required !== false;
|
|
126
|
+
const showBirthDate = f?.birth_date?.visible !== false;
|
|
127
|
+
const reqBirthDate = f?.birth_date?.required !== false;
|
|
128
|
+
const showBirthCountry = f?.birth_country?.visible !== false;
|
|
129
|
+
const reqBirthCountry = f?.birth_country?.required !== false;
|
|
130
|
+
const showCitizenship = f?.citizenship?.visible !== false;
|
|
131
|
+
const reqCitizenship = f?.citizenship?.required !== false;
|
|
132
|
+
const showResidence = f?.residence_country?.visible !== false;
|
|
133
|
+
const reqResidence = f?.residence_country?.required !== false;
|
|
134
|
+
|
|
135
|
+
const genderOptions = useMemo(
|
|
136
|
+
() => resolveSelectOptions(f?.gender?.options, stepConfig?.gender_options),
|
|
137
|
+
[f?.gender?.options, stepConfig?.gender_options],
|
|
138
|
+
);
|
|
139
|
+
const civilOptions = useMemo(
|
|
140
|
+
() =>
|
|
141
|
+
resolveSelectOptions(
|
|
142
|
+
f?.civil_status?.options,
|
|
143
|
+
stepConfig?.civil_status_options,
|
|
144
|
+
),
|
|
145
|
+
[f?.civil_status?.options, stepConfig?.civil_status_options],
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const [form, setForm] = useState<FormState>({
|
|
149
|
+
gender: '',
|
|
150
|
+
civil_status: '',
|
|
151
|
+
birth_date: null,
|
|
152
|
+
birth_country: null,
|
|
153
|
+
citizenship: null,
|
|
154
|
+
residence_country: null,
|
|
155
|
+
});
|
|
156
|
+
const [errors, setErrors] = useState<Partial<Record<keyof FormState, string>>>({});
|
|
157
|
+
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
158
|
+
const [submitting, setSubmitting] = useState(false);
|
|
159
|
+
const [retry, setRetry] = useState<{ message: string } | null>(null);
|
|
160
|
+
|
|
161
|
+
const updateField = useCallback(
|
|
162
|
+
<K extends keyof FormState>(key: K, value: FormState[K]) => {
|
|
163
|
+
setForm((prev) => ({ ...prev, [key]: value }));
|
|
164
|
+
setErrors((prev) => {
|
|
165
|
+
if (!(key in prev)) return prev;
|
|
166
|
+
const next = { ...prev };
|
|
167
|
+
delete next[key];
|
|
168
|
+
return next;
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
[],
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const validateAll = useCallback((): boolean => {
|
|
175
|
+
const next: Partial<Record<keyof FormState, string>> = {};
|
|
176
|
+
if (showGender && reqGender && !form.gender)
|
|
177
|
+
next.gender = t.human_extended_info.requiredGender;
|
|
178
|
+
if (showCivil && reqCivil && !form.civil_status)
|
|
179
|
+
next.civil_status = t.human_extended_info.requiredCivil;
|
|
180
|
+
if (showBirthDate && reqBirthDate && !form.birth_date)
|
|
181
|
+
next.birth_date = t.human_extended_info.requiredBirthDate;
|
|
182
|
+
if (showBirthCountry && reqBirthCountry && !form.birth_country)
|
|
183
|
+
next.birth_country = t.human_extended_info.requiredCountry;
|
|
184
|
+
if (showCitizenship && reqCitizenship && !form.citizenship)
|
|
185
|
+
next.citizenship = t.human_extended_info.requiredCountry;
|
|
186
|
+
if (showResidence && reqResidence && !form.residence_country)
|
|
187
|
+
next.residence_country = t.human_extended_info.requiredCountry;
|
|
188
|
+
setErrors(next);
|
|
189
|
+
return Object.keys(next).length === 0;
|
|
190
|
+
}, [
|
|
191
|
+
form,
|
|
192
|
+
reqBirthCountry,
|
|
193
|
+
reqBirthDate,
|
|
194
|
+
reqCitizenship,
|
|
195
|
+
reqCivil,
|
|
196
|
+
reqGender,
|
|
197
|
+
reqResidence,
|
|
198
|
+
showBirthCountry,
|
|
199
|
+
showBirthDate,
|
|
200
|
+
showCitizenship,
|
|
201
|
+
showCivil,
|
|
202
|
+
showGender,
|
|
203
|
+
showResidence,
|
|
204
|
+
t.human_extended_info.requiredBirthDate,
|
|
205
|
+
t.human_extended_info.requiredCivil,
|
|
206
|
+
t.human_extended_info.requiredCountry,
|
|
207
|
+
t.human_extended_info.requiredGender,
|
|
208
|
+
]);
|
|
209
|
+
|
|
210
|
+
const handleSubmit = useCallback(async () => {
|
|
211
|
+
setBannerError(null);
|
|
212
|
+
if (!validateAll()) return;
|
|
213
|
+
const payload: HumanExtendedInfoPayload = {
|
|
214
|
+
...(showGender && form.gender && { gender: form.gender }),
|
|
215
|
+
...(showCivil && form.civil_status && { civil_status: form.civil_status }),
|
|
216
|
+
...(showBirthDate && form.birth_date && { birth_date: form.birth_date }),
|
|
217
|
+
...(showBirthCountry && form.birth_country && {
|
|
218
|
+
birth_country: form.birth_country,
|
|
219
|
+
}),
|
|
220
|
+
...(showCitizenship && form.citizenship && { citizenship: form.citizenship }),
|
|
221
|
+
...(showResidence && form.residence_country && {
|
|
222
|
+
residence_country: form.residence_country,
|
|
223
|
+
}),
|
|
224
|
+
};
|
|
225
|
+
setSubmitting(true);
|
|
226
|
+
try {
|
|
227
|
+
await api.post(`/sessions/${sessionId}/extended-info/human`, payload);
|
|
228
|
+
setSubmitting(false);
|
|
229
|
+
onComplete();
|
|
230
|
+
} catch (err) {
|
|
231
|
+
setSubmitting(false);
|
|
232
|
+
const sdkErr = toSubmissionError(err, t);
|
|
233
|
+
setBannerError(sdkErr.message);
|
|
234
|
+
setRetry({ message: sdkErr.message });
|
|
235
|
+
}
|
|
236
|
+
}, [
|
|
237
|
+
api,
|
|
238
|
+
form,
|
|
239
|
+
onComplete,
|
|
240
|
+
sessionId,
|
|
241
|
+
showBirthCountry,
|
|
242
|
+
showBirthDate,
|
|
243
|
+
showCitizenship,
|
|
244
|
+
showCivil,
|
|
245
|
+
showGender,
|
|
246
|
+
showResidence,
|
|
247
|
+
t,
|
|
248
|
+
validateAll,
|
|
249
|
+
]);
|
|
250
|
+
|
|
251
|
+
if (retry) {
|
|
252
|
+
return (
|
|
253
|
+
<RetryDialog
|
|
254
|
+
title={t.common.submissionTitle}
|
|
255
|
+
message={retry.message || t.common.submissionFallback}
|
|
256
|
+
retryLabel={t.common.retry}
|
|
257
|
+
cancelLabel={t.common.cancel}
|
|
258
|
+
onRetry={() => setRetry(null)}
|
|
259
|
+
onCancel={() => {
|
|
260
|
+
setRetry(null);
|
|
261
|
+
onCancel({ code: SdkErrorCode.API_ERROR, message: retry.message });
|
|
262
|
+
}}
|
|
263
|
+
/>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return (
|
|
268
|
+
<View style={{ flex: 1 }}>
|
|
269
|
+
<StepShell
|
|
270
|
+
title={t.human_extended_info.title}
|
|
271
|
+
subtitle={t.human_extended_info.subtitle}
|
|
272
|
+
iconNode={<StepIcon name="person" />}
|
|
273
|
+
>
|
|
274
|
+
{showGender ? (
|
|
275
|
+
<Select
|
|
276
|
+
label={t.human_extended_info.gender}
|
|
277
|
+
required={reqGender}
|
|
278
|
+
options={genderOptions}
|
|
279
|
+
value={form.gender || null}
|
|
280
|
+
onChange={(v) => updateField('gender', v)}
|
|
281
|
+
errorMessage={errors.gender ?? null}
|
|
282
|
+
/>
|
|
283
|
+
) : null}
|
|
284
|
+
{showCivil ? (
|
|
285
|
+
<Select
|
|
286
|
+
label={t.human_extended_info.civilStatus}
|
|
287
|
+
required={reqCivil}
|
|
288
|
+
options={civilOptions}
|
|
289
|
+
value={form.civil_status || null}
|
|
290
|
+
onChange={(v) => updateField('civil_status', v)}
|
|
291
|
+
errorMessage={errors.civil_status ?? null}
|
|
292
|
+
/>
|
|
293
|
+
) : null}
|
|
294
|
+
{showBirthDate ? (
|
|
295
|
+
<DatePicker
|
|
296
|
+
label={t.human_extended_info.birthDate}
|
|
297
|
+
required={reqBirthDate}
|
|
298
|
+
value={form.birth_date}
|
|
299
|
+
onChange={(v) => updateField('birth_date', v)}
|
|
300
|
+
errorMessage={errors.birth_date ?? null}
|
|
301
|
+
monthLabels={t.months}
|
|
302
|
+
maxYear={new Date().getFullYear()}
|
|
303
|
+
minYear={1900}
|
|
304
|
+
/>
|
|
305
|
+
) : null}
|
|
306
|
+
{showBirthCountry ? (
|
|
307
|
+
<CountrySelect
|
|
308
|
+
label={t.human_extended_info.birthCountry}
|
|
309
|
+
required={reqBirthCountry}
|
|
310
|
+
value={form.birth_country}
|
|
311
|
+
onChange={(v) => updateField('birth_country', v)}
|
|
312
|
+
locale={locale}
|
|
313
|
+
placeholder={t.human_extended_info.countrySearch}
|
|
314
|
+
searchPlaceholder={t.human_extended_info.countrySearch}
|
|
315
|
+
errorMessage={errors.birth_country ?? null}
|
|
316
|
+
/>
|
|
317
|
+
) : null}
|
|
318
|
+
{showCitizenship ? (
|
|
319
|
+
<CountrySelect
|
|
320
|
+
label={t.human_extended_info.citizenship}
|
|
321
|
+
required={reqCitizenship}
|
|
322
|
+
value={form.citizenship}
|
|
323
|
+
onChange={(v) => updateField('citizenship', v)}
|
|
324
|
+
locale={locale}
|
|
325
|
+
placeholder={t.human_extended_info.countrySearch}
|
|
326
|
+
searchPlaceholder={t.human_extended_info.countrySearch}
|
|
327
|
+
errorMessage={errors.citizenship ?? null}
|
|
328
|
+
/>
|
|
329
|
+
) : null}
|
|
330
|
+
{showResidence ? (
|
|
331
|
+
<CountrySelect
|
|
332
|
+
label={t.human_extended_info.residenceCountry}
|
|
333
|
+
required={reqResidence}
|
|
334
|
+
value={form.residence_country}
|
|
335
|
+
onChange={(v) => updateField('residence_country', v)}
|
|
336
|
+
locale={locale}
|
|
337
|
+
placeholder={t.human_extended_info.countrySearch}
|
|
338
|
+
searchPlaceholder={t.human_extended_info.countrySearch}
|
|
339
|
+
errorMessage={errors.residence_country ?? null}
|
|
340
|
+
/>
|
|
341
|
+
) : null}
|
|
342
|
+
{bannerError ? <Banner message={bannerError} /> : null}
|
|
343
|
+
<Button
|
|
344
|
+
label={t.common.continue}
|
|
345
|
+
onPress={handleSubmit}
|
|
346
|
+
loading={submitting}
|
|
347
|
+
disabled={submitting}
|
|
348
|
+
/>
|
|
349
|
+
</StepShell>
|
|
350
|
+
{submitting ? <LoadingOverlay message={t.common.submitting} /> : null}
|
|
351
|
+
</View>
|
|
352
|
+
);
|
|
353
|
+
}
|