@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,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TAX_INFO — POST /sessions/:id/tax-info { taxpayer_type, taxpayer_id_type, taxpayer_id }.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `TaxInfoModule.ts`:
|
|
5
|
+
* - Resolves selectable lists from `stepConfig.accepted_tax_information`
|
|
6
|
+
* (only — no SDK-side defaults), preferring `code` → `id` for the option
|
|
7
|
+
* value sent in the payload.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
11
|
+
import { View } from 'react-native';
|
|
12
|
+
import {
|
|
13
|
+
SdkErrorCode,
|
|
14
|
+
type SdkError,
|
|
15
|
+
type TaxInfoAcceptedCountryRow,
|
|
16
|
+
type TaxInfoConfigOptionRow,
|
|
17
|
+
type TaxInfoPayload,
|
|
18
|
+
type TaxInfoStepConfig,
|
|
19
|
+
} from '../types';
|
|
20
|
+
import { Banner } from '../ui/primitives/Banner';
|
|
21
|
+
import { Button } from '../ui/primitives/Button';
|
|
22
|
+
import { Input } from '../ui/primitives/Input';
|
|
23
|
+
import { Select, type SelectOption } from '../ui/primitives/Select';
|
|
24
|
+
import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
|
|
25
|
+
import { RetryDialog } from '../ui/overlays/RetryDialog';
|
|
26
|
+
import { StepShell } from '../ui/StepShell';
|
|
27
|
+
import { StepIcon } from '../ui/icons/StepIcon';
|
|
28
|
+
import { required, useInlineValidation } from '../ui/forms';
|
|
29
|
+
import { getStrings } from '../i18n';
|
|
30
|
+
import { resolveTaxInfoConfig } from '../utils/taxInfoConfig';
|
|
31
|
+
import type { ApiCaller } from '../transport/api';
|
|
32
|
+
import type { StepDeps, StepModule } from './types';
|
|
33
|
+
import { toSubmissionError } from './_shared';
|
|
34
|
+
|
|
35
|
+
export class TaxInfoStep implements StepModule {
|
|
36
|
+
private resolveStep!: () => void;
|
|
37
|
+
private rejectStep!: (err: SdkError) => void;
|
|
38
|
+
private destroyed = false;
|
|
39
|
+
|
|
40
|
+
constructor(private readonly deps: StepDeps) {}
|
|
41
|
+
|
|
42
|
+
run(): Promise<void> {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
this.resolveStep = resolve;
|
|
45
|
+
this.rejectStep = reject;
|
|
46
|
+
this.deps.ui.setNode(
|
|
47
|
+
<TaxInfoView
|
|
48
|
+
api={this.deps.api}
|
|
49
|
+
sessionId={this.deps.sessionId}
|
|
50
|
+
locale={this.deps.locale}
|
|
51
|
+
stepConfig={this.deps.stepConfig as TaxInfoStepConfig | undefined}
|
|
52
|
+
onComplete={() => {
|
|
53
|
+
if (this.destroyed) return;
|
|
54
|
+
this.deps.ui.setNode(null);
|
|
55
|
+
this.resolveStep();
|
|
56
|
+
}}
|
|
57
|
+
onCancel={(err) => {
|
|
58
|
+
if (this.destroyed) return;
|
|
59
|
+
this.deps.ui.setNode(null);
|
|
60
|
+
this.rejectStep(err);
|
|
61
|
+
}}
|
|
62
|
+
/>,
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
destroy(): void {
|
|
68
|
+
this.destroyed = true;
|
|
69
|
+
this.deps.ui.setNode(null);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function taxInfoOptionValue(row: TaxInfoConfigOptionRow): string | undefined {
|
|
74
|
+
const c = typeof row.code === 'string' ? row.code.trim() : '';
|
|
75
|
+
if (c) return c;
|
|
76
|
+
const i = typeof row.id === 'string' ? row.id.trim() : '';
|
|
77
|
+
if (i) return i;
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function rowsToOptions(
|
|
82
|
+
rows: TaxInfoConfigOptionRow[] | undefined,
|
|
83
|
+
): SelectOption[] {
|
|
84
|
+
if (!Array.isArray(rows)) return [];
|
|
85
|
+
const out: SelectOption[] = [];
|
|
86
|
+
for (const row of rows) {
|
|
87
|
+
const value = taxInfoOptionValue(row);
|
|
88
|
+
if (!value) continue;
|
|
89
|
+
out.push({
|
|
90
|
+
value,
|
|
91
|
+
label:
|
|
92
|
+
typeof row.display_value === 'string' && row.display_value.trim().length > 0
|
|
93
|
+
? row.display_value
|
|
94
|
+
: value,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
interface FormState {
|
|
101
|
+
taxpayer_type: string;
|
|
102
|
+
taxpayer_id_type: string;
|
|
103
|
+
taxpayer_id: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface ViewProps {
|
|
107
|
+
api: ApiCaller;
|
|
108
|
+
sessionId: string;
|
|
109
|
+
locale: string;
|
|
110
|
+
stepConfig: TaxInfoStepConfig | undefined;
|
|
111
|
+
onComplete: () => void;
|
|
112
|
+
onCancel: (err: SdkError) => void;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function TaxInfoView({
|
|
116
|
+
api,
|
|
117
|
+
sessionId,
|
|
118
|
+
locale,
|
|
119
|
+
stepConfig,
|
|
120
|
+
onComplete,
|
|
121
|
+
onCancel,
|
|
122
|
+
}: ViewProps) {
|
|
123
|
+
const t = getStrings(locale);
|
|
124
|
+
|
|
125
|
+
const { categoryOptions, idTypeOptions } = useMemo(() => {
|
|
126
|
+
const acceptedRows = stepConfig?.accepted_tax_information;
|
|
127
|
+
const rows: TaxInfoAcceptedCountryRow[] = Array.isArray(acceptedRows)
|
|
128
|
+
? acceptedRows
|
|
129
|
+
: [];
|
|
130
|
+
let categoryOptions: SelectOption[] = [];
|
|
131
|
+
let idTypeOptions: SelectOption[] = [];
|
|
132
|
+
for (const row of rows) {
|
|
133
|
+
if (categoryOptions.length === 0) {
|
|
134
|
+
categoryOptions = rowsToOptions(row?.taxpayer_categories);
|
|
135
|
+
}
|
|
136
|
+
if (idTypeOptions.length === 0) {
|
|
137
|
+
idTypeOptions = rowsToOptions(row?.identification_types);
|
|
138
|
+
}
|
|
139
|
+
if (categoryOptions.length > 0 && idTypeOptions.length > 0) break;
|
|
140
|
+
}
|
|
141
|
+
const resolved = resolveTaxInfoConfig({
|
|
142
|
+
taxpayerCategories: categoryOptions.map((o) => ({
|
|
143
|
+
id: o.value,
|
|
144
|
+
description: o.label,
|
|
145
|
+
})),
|
|
146
|
+
fiscalIdentifierTypes: idTypeOptions.map((o) => ({
|
|
147
|
+
id: o.value,
|
|
148
|
+
description: o.label,
|
|
149
|
+
})),
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
categoryOptions: resolved.taxpayerCategories.map(
|
|
153
|
+
(o): SelectOption => ({ value: o.id, label: o.description }),
|
|
154
|
+
),
|
|
155
|
+
idTypeOptions: resolved.fiscalIdentifierTypes.map(
|
|
156
|
+
(o): SelectOption => ({ value: o.id, label: o.description }),
|
|
157
|
+
),
|
|
158
|
+
};
|
|
159
|
+
}, [stepConfig]);
|
|
160
|
+
|
|
161
|
+
const [form, setForm] = useState<FormState>(() => ({
|
|
162
|
+
taxpayer_type: categoryOptions[0]?.value ?? '',
|
|
163
|
+
taxpayer_id_type: idTypeOptions[0]?.value ?? '',
|
|
164
|
+
taxpayer_id: '',
|
|
165
|
+
}));
|
|
166
|
+
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
167
|
+
const [submitting, setSubmitting] = useState(false);
|
|
168
|
+
const [retry, setRetry] = useState<{ message: string } | null>(null);
|
|
169
|
+
|
|
170
|
+
const setField = useCallback(
|
|
171
|
+
<K extends keyof FormState>(name: K, value: FormState[K]) => {
|
|
172
|
+
setForm((f) => ({ ...f, [name]: value }));
|
|
173
|
+
},
|
|
174
|
+
[],
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const validation = useInlineValidation<keyof FormState>(
|
|
178
|
+
[
|
|
179
|
+
{
|
|
180
|
+
name: 'taxpayer_type',
|
|
181
|
+
validate: required(t.tax_info.requiredCategory),
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'taxpayer_id_type',
|
|
185
|
+
validate: required(t.tax_info.requiredIdType),
|
|
186
|
+
},
|
|
187
|
+
{ name: 'taxpayer_id', validate: required(t.tax_info.requiredId) },
|
|
188
|
+
],
|
|
189
|
+
(name, value) => setField(name, value),
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
const handleSubmit = useCallback(async () => {
|
|
193
|
+
setBannerError(null);
|
|
194
|
+
if (!validation.validateAll(form)) return;
|
|
195
|
+
const payload: TaxInfoPayload = {
|
|
196
|
+
taxpayer_type: form.taxpayer_type.trim(),
|
|
197
|
+
taxpayer_id_type: form.taxpayer_id_type.trim(),
|
|
198
|
+
taxpayer_id: form.taxpayer_id.trim(),
|
|
199
|
+
};
|
|
200
|
+
setSubmitting(true);
|
|
201
|
+
try {
|
|
202
|
+
await api.post(`/sessions/${sessionId}/tax-info`, payload);
|
|
203
|
+
setSubmitting(false);
|
|
204
|
+
onComplete();
|
|
205
|
+
} catch (err) {
|
|
206
|
+
setSubmitting(false);
|
|
207
|
+
const sdkErr = toSubmissionError(err, t);
|
|
208
|
+
setBannerError(sdkErr.message);
|
|
209
|
+
setRetry({ message: sdkErr.message });
|
|
210
|
+
}
|
|
211
|
+
}, [api, form, onComplete, sessionId, t, validation]);
|
|
212
|
+
|
|
213
|
+
if (retry) {
|
|
214
|
+
return (
|
|
215
|
+
<RetryDialog
|
|
216
|
+
title={t.common.submissionTitle}
|
|
217
|
+
message={retry.message || t.common.submissionFallback}
|
|
218
|
+
retryLabel={t.common.retry}
|
|
219
|
+
cancelLabel={t.common.cancel}
|
|
220
|
+
onRetry={() => setRetry(null)}
|
|
221
|
+
onCancel={() => {
|
|
222
|
+
setRetry(null);
|
|
223
|
+
onCancel({ code: SdkErrorCode.API_ERROR, message: retry.message });
|
|
224
|
+
}}
|
|
225
|
+
/>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<View style={{ flex: 1 }}>
|
|
231
|
+
<StepShell
|
|
232
|
+
title={t.tax_info.title}
|
|
233
|
+
subtitle={t.tax_info.subtitle}
|
|
234
|
+
iconNode={<StepIcon name="receipt-long" />}
|
|
235
|
+
>
|
|
236
|
+
<Select
|
|
237
|
+
label={t.tax_info.taxpayerType}
|
|
238
|
+
required
|
|
239
|
+
options={categoryOptions}
|
|
240
|
+
value={form.taxpayer_type || null}
|
|
241
|
+
onChange={(v) => {
|
|
242
|
+
setField('taxpayer_type', v);
|
|
243
|
+
validation.setFieldError('taxpayer_type', null);
|
|
244
|
+
}}
|
|
245
|
+
errorMessage={validation.errors.taxpayer_type ?? null}
|
|
246
|
+
/>
|
|
247
|
+
<Select
|
|
248
|
+
label={t.tax_info.taxpayerIdType}
|
|
249
|
+
required
|
|
250
|
+
options={idTypeOptions}
|
|
251
|
+
value={form.taxpayer_id_type || null}
|
|
252
|
+
onChange={(v) => {
|
|
253
|
+
setField('taxpayer_id_type', v);
|
|
254
|
+
validation.setFieldError('taxpayer_id_type', null);
|
|
255
|
+
}}
|
|
256
|
+
errorMessage={validation.errors.taxpayer_id_type ?? null}
|
|
257
|
+
/>
|
|
258
|
+
<Input
|
|
259
|
+
label={t.tax_info.taxpayerId}
|
|
260
|
+
required
|
|
261
|
+
autoCapitalize="characters"
|
|
262
|
+
autoCorrect={false}
|
|
263
|
+
value={form.taxpayer_id}
|
|
264
|
+
{...validation.bind('taxpayer_id', form.taxpayer_id)}
|
|
265
|
+
/>
|
|
266
|
+
{bannerError ? <Banner message={bannerError} /> : null}
|
|
267
|
+
<Button
|
|
268
|
+
label={t.common.continue}
|
|
269
|
+
onPress={handleSubmit}
|
|
270
|
+
loading={submitting}
|
|
271
|
+
disabled={submitting}
|
|
272
|
+
/>
|
|
273
|
+
</StepShell>
|
|
274
|
+
{submitting ? <LoadingOverlay message={t.common.submitting} /> : null}
|
|
275
|
+
</View>
|
|
276
|
+
);
|
|
277
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TERMS_AND_CONDITIONS — POST /sessions/:id/terms-and-conditions { acceptances }.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `TermsAndConditionsModule.ts`:
|
|
5
|
+
* - Items resolved from `stepConfig.terms`. If empty, the step rejects with
|
|
6
|
+
* `SdkErrorCode.UNKNOWN` (same as web — orchestrator can surface support copy).
|
|
7
|
+
* - Each item has an optional `link` opened via React Native's `Linking`
|
|
8
|
+
* (no extra dependency, OS picks the right handler — WebView, Safari, …).
|
|
9
|
+
* - Submit gate: every item must be accepted.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import { Linking, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
14
|
+
import {
|
|
15
|
+
SdkErrorCode,
|
|
16
|
+
type SdkError,
|
|
17
|
+
type TermsAndConditionsItem,
|
|
18
|
+
type TermsAndConditionsStepConfig,
|
|
19
|
+
type TermsAndConditionsSubmitPayload,
|
|
20
|
+
} from '../types';
|
|
21
|
+
import { Banner } from '../ui/primitives/Banner';
|
|
22
|
+
import { Button } from '../ui/primitives/Button';
|
|
23
|
+
import { Checkbox } from '../ui/primitives/Checkbox';
|
|
24
|
+
import { LoadingOverlay } from '../ui/overlays/LoadingOverlay';
|
|
25
|
+
import { RetryDialog } from '../ui/overlays/RetryDialog';
|
|
26
|
+
import { StepShell } from '../ui/StepShell';
|
|
27
|
+
import { StepIcon } from '../ui/icons/StepIcon';
|
|
28
|
+
import { getStrings } from '../i18n';
|
|
29
|
+
import { useTheme } from '../ui/theme';
|
|
30
|
+
import { resolveTermsFromStepConfig } from '../utils/stepConfig';
|
|
31
|
+
import { log } from '../utils/log';
|
|
32
|
+
import type { ApiCaller } from '../transport/api';
|
|
33
|
+
import type { StepDeps, StepModule } from './types';
|
|
34
|
+
import { toSubmissionError } from './_shared';
|
|
35
|
+
|
|
36
|
+
export class TermsAndConditionsStep implements StepModule {
|
|
37
|
+
private resolveStep!: () => void;
|
|
38
|
+
private rejectStep!: (err: SdkError) => void;
|
|
39
|
+
private destroyed = false;
|
|
40
|
+
|
|
41
|
+
constructor(private readonly deps: StepDeps) {}
|
|
42
|
+
|
|
43
|
+
run(): Promise<void> {
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
this.resolveStep = resolve;
|
|
46
|
+
this.rejectStep = reject;
|
|
47
|
+
this.deps.ui.setNode(
|
|
48
|
+
<TermsAndConditionsView
|
|
49
|
+
api={this.deps.api}
|
|
50
|
+
sessionId={this.deps.sessionId}
|
|
51
|
+
locale={this.deps.locale}
|
|
52
|
+
stepConfig={this.deps.stepConfig as TermsAndConditionsStepConfig | undefined}
|
|
53
|
+
onComplete={() => {
|
|
54
|
+
if (this.destroyed) return;
|
|
55
|
+
this.deps.ui.setNode(null);
|
|
56
|
+
this.resolveStep();
|
|
57
|
+
}}
|
|
58
|
+
onCancel={(err) => {
|
|
59
|
+
if (this.destroyed) return;
|
|
60
|
+
this.deps.ui.setNode(null);
|
|
61
|
+
this.rejectStep(err);
|
|
62
|
+
}}
|
|
63
|
+
onNoItems={(err) => {
|
|
64
|
+
if (this.destroyed) return;
|
|
65
|
+
// Match the web: don't unmount the empty-state banner — the
|
|
66
|
+
// orchestrator surfaces the error and the user backs out.
|
|
67
|
+
this.rejectStep(err);
|
|
68
|
+
}}
|
|
69
|
+
/>,
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
destroy(): void {
|
|
75
|
+
this.destroyed = true;
|
|
76
|
+
this.deps.ui.setNode(null);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface ViewProps {
|
|
81
|
+
api: ApiCaller;
|
|
82
|
+
sessionId: string;
|
|
83
|
+
locale: string;
|
|
84
|
+
stepConfig: TermsAndConditionsStepConfig | undefined;
|
|
85
|
+
onComplete: () => void;
|
|
86
|
+
onCancel: (err: SdkError) => void;
|
|
87
|
+
onNoItems: (err: SdkError) => void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function TermsAndConditionsView({
|
|
91
|
+
api,
|
|
92
|
+
sessionId,
|
|
93
|
+
locale,
|
|
94
|
+
stepConfig,
|
|
95
|
+
onComplete,
|
|
96
|
+
onCancel,
|
|
97
|
+
onNoItems,
|
|
98
|
+
}: ViewProps) {
|
|
99
|
+
const t = getStrings(locale);
|
|
100
|
+
const theme = useTheme();
|
|
101
|
+
const items: TermsAndConditionsItem[] = useMemo(
|
|
102
|
+
() => resolveTermsFromStepConfig(stepConfig) ?? [],
|
|
103
|
+
[stepConfig],
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const [accepted, setAccepted] = useState<Record<string, boolean>>({});
|
|
107
|
+
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
108
|
+
const [submitting, setSubmitting] = useState(false);
|
|
109
|
+
const [retry, setRetry] = useState<{ message: string } | null>(null);
|
|
110
|
+
|
|
111
|
+
// No items → surface the error. Don't navigate away from the screen so the
|
|
112
|
+
// user has context (matching the web flow).
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (items.length === 0) {
|
|
115
|
+
onNoItems({
|
|
116
|
+
code: SdkErrorCode.UNKNOWN,
|
|
117
|
+
message: t.terms_and_conditions.noItems,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}, [items.length, onNoItems, t]);
|
|
121
|
+
|
|
122
|
+
const handleOpenLink = useCallback(async (url: string) => {
|
|
123
|
+
try {
|
|
124
|
+
const supported = await Linking.canOpenURL(url);
|
|
125
|
+
if (supported) {
|
|
126
|
+
await Linking.openURL(url);
|
|
127
|
+
} else {
|
|
128
|
+
log.warn('[T&C] Cannot open link', { url });
|
|
129
|
+
}
|
|
130
|
+
} catch (err) {
|
|
131
|
+
log.warn('[T&C] Failed to open link', err);
|
|
132
|
+
}
|
|
133
|
+
}, []);
|
|
134
|
+
|
|
135
|
+
const handleSubmit = useCallback(async () => {
|
|
136
|
+
setBannerError(null);
|
|
137
|
+
const payload: TermsAndConditionsSubmitPayload = {
|
|
138
|
+
acceptances: items.map((item) => ({
|
|
139
|
+
item_id: item.id,
|
|
140
|
+
accepted: accepted[item.id] === true,
|
|
141
|
+
})),
|
|
142
|
+
};
|
|
143
|
+
if (!payload.acceptances.every((a) => a.accepted)) {
|
|
144
|
+
setBannerError(t.terms_and_conditions.needAll);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
setSubmitting(true);
|
|
148
|
+
try {
|
|
149
|
+
await api.post(
|
|
150
|
+
`/sessions/${sessionId}/terms-and-conditions`,
|
|
151
|
+
payload,
|
|
152
|
+
);
|
|
153
|
+
setSubmitting(false);
|
|
154
|
+
onComplete();
|
|
155
|
+
} catch (err) {
|
|
156
|
+
setSubmitting(false);
|
|
157
|
+
const sdkErr = toSubmissionError(err, t);
|
|
158
|
+
setBannerError(sdkErr.message);
|
|
159
|
+
setRetry({ message: sdkErr.message });
|
|
160
|
+
}
|
|
161
|
+
}, [accepted, api, items, onComplete, sessionId, t]);
|
|
162
|
+
|
|
163
|
+
if (retry) {
|
|
164
|
+
return (
|
|
165
|
+
<RetryDialog
|
|
166
|
+
title={t.common.submissionTitle}
|
|
167
|
+
message={retry.message || t.common.submissionFallback}
|
|
168
|
+
retryLabel={t.common.retry}
|
|
169
|
+
cancelLabel={t.common.cancel}
|
|
170
|
+
onRetry={() => setRetry(null)}
|
|
171
|
+
onCancel={() => {
|
|
172
|
+
setRetry(null);
|
|
173
|
+
onCancel({ code: SdkErrorCode.API_ERROR, message: retry.message });
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (items.length === 0) {
|
|
180
|
+
return (
|
|
181
|
+
<StepShell
|
|
182
|
+
title={t.terms_and_conditions.title}
|
|
183
|
+
subtitle={t.terms_and_conditions.subtitle}
|
|
184
|
+
iconNode={<StepIcon name="description" />}
|
|
185
|
+
>
|
|
186
|
+
<Banner message={t.terms_and_conditions.noItems} />
|
|
187
|
+
</StepShell>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<View style={{ flex: 1 }}>
|
|
193
|
+
<StepShell
|
|
194
|
+
title={t.terms_and_conditions.title}
|
|
195
|
+
subtitle={t.terms_and_conditions.subtitle}
|
|
196
|
+
iconNode={<StepIcon name="description" />}
|
|
197
|
+
>
|
|
198
|
+
{items.map((item) => (
|
|
199
|
+
<View
|
|
200
|
+
key={item.id}
|
|
201
|
+
style={[
|
|
202
|
+
styles.itemBlock,
|
|
203
|
+
{ borderTopColor: theme.borderColor },
|
|
204
|
+
]}
|
|
205
|
+
>
|
|
206
|
+
<Text style={[styles.description, { color: theme.textColor }]}>
|
|
207
|
+
{item.description}
|
|
208
|
+
</Text>
|
|
209
|
+
{item.link ? (
|
|
210
|
+
<Pressable
|
|
211
|
+
accessibilityRole="link"
|
|
212
|
+
onPress={() => handleOpenLink(item.link as string)}
|
|
213
|
+
style={styles.linkRow}
|
|
214
|
+
>
|
|
215
|
+
<Text style={[styles.link, { color: theme.primaryColor }]}>
|
|
216
|
+
{t.terms_and_conditions.openLink}
|
|
217
|
+
</Text>
|
|
218
|
+
</Pressable>
|
|
219
|
+
) : null}
|
|
220
|
+
<Checkbox
|
|
221
|
+
variant="inline"
|
|
222
|
+
checked={accepted[item.id] === true}
|
|
223
|
+
onChange={(next) =>
|
|
224
|
+
setAccepted((prev) => ({ ...prev, [item.id]: next }))
|
|
225
|
+
}
|
|
226
|
+
label={t.terms_and_conditions.accept}
|
|
227
|
+
/>
|
|
228
|
+
</View>
|
|
229
|
+
))}
|
|
230
|
+
{bannerError ? <Banner message={bannerError} /> : null}
|
|
231
|
+
<Button
|
|
232
|
+
label={t.common.confirm}
|
|
233
|
+
onPress={handleSubmit}
|
|
234
|
+
loading={submitting}
|
|
235
|
+
disabled={submitting}
|
|
236
|
+
/>
|
|
237
|
+
</StepShell>
|
|
238
|
+
{submitting ? <LoadingOverlay message={t.common.submitting} /> : null}
|
|
239
|
+
</View>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const styles = StyleSheet.create({
|
|
244
|
+
itemBlock: {
|
|
245
|
+
paddingVertical: 12,
|
|
246
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
247
|
+
gap: 6,
|
|
248
|
+
},
|
|
249
|
+
description: {
|
|
250
|
+
fontSize: 14,
|
|
251
|
+
lineHeight: 20,
|
|
252
|
+
},
|
|
253
|
+
linkRow: {
|
|
254
|
+
paddingVertical: 4,
|
|
255
|
+
},
|
|
256
|
+
link: {
|
|
257
|
+
fontSize: 14,
|
|
258
|
+
fontWeight: '500',
|
|
259
|
+
textDecorationLine: 'underline',
|
|
260
|
+
},
|
|
261
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers shared by every step module — kept in a single place so the per-step
|
|
3
|
+
* files stay focused on their specific UI + payload.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { SdkErrorCode, type SdkError } from '../types';
|
|
7
|
+
import type { StringsTable } from '../i18n';
|
|
8
|
+
|
|
9
|
+
export function toSubmissionError(err: unknown, t: StringsTable): SdkError {
|
|
10
|
+
if (
|
|
11
|
+
err != null &&
|
|
12
|
+
typeof err === 'object' &&
|
|
13
|
+
'code' in err &&
|
|
14
|
+
typeof (err as SdkError).code === 'string' &&
|
|
15
|
+
'message' in err &&
|
|
16
|
+
typeof (err as SdkError).message === 'string'
|
|
17
|
+
) {
|
|
18
|
+
return err as SdkError;
|
|
19
|
+
}
|
|
20
|
+
const message =
|
|
21
|
+
err instanceof Error ? err.message : t.common.submissionFallback;
|
|
22
|
+
return {
|
|
23
|
+
code: SdkErrorCode.API_ERROR,
|
|
24
|
+
message: message || t.common.submissionFallback,
|
|
25
|
+
cause: err,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
30
|
+
/** Backend accepts any reasonably-shaped E.164 — keep this check loose. */
|
|
31
|
+
const E164_REGEX = /^\+[1-9]\d{6,14}$/;
|
|
32
|
+
const OTP_REGEX = /^\d{6}$/;
|
|
33
|
+
|
|
34
|
+
export function isEmail(value: string): boolean {
|
|
35
|
+
return EMAIL_REGEX.test(value.trim());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function isE164Phone(value: string): boolean {
|
|
39
|
+
return E164_REGEX.test(value.trim());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function isOtpCode(value: string): boolean {
|
|
43
|
+
return OTP_REGEX.test(value.trim());
|
|
44
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Internal contracts shared by all step modules.
|
|
3
|
+
*
|
|
4
|
+
* Step modules own their network lifecycle and (when applicable) drive the UI
|
|
5
|
+
* via a `StepUiHandle` provided by the orchestrator. Modules that don't need
|
|
6
|
+
* a screen (e.g. DEVICE_FINGERPRINT, FACE_MATCH) ignore the UI handle entirely.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ReactNode } from 'react';
|
|
10
|
+
import type { ApiCaller } from '../transport/api';
|
|
11
|
+
import type { OnboardingStep, SdkError } from '../types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal contract every step module must implement. The orchestrator awaits
|
|
15
|
+
* `run()` and calls `destroy()` exactly once when the step is leaving the flow.
|
|
16
|
+
*/
|
|
17
|
+
export interface StepModule {
|
|
18
|
+
run(): Promise<void>;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Bridge a step module uses to render its UI inside `VelionOnboardingScreen`.
|
|
24
|
+
*
|
|
25
|
+
* - `setNode(node)` mounts a React subtree as the active step view.
|
|
26
|
+
* - `setNode(null)` (or omitting all calls) leaves whatever the orchestrator
|
|
27
|
+
* considers the default chrome — typically a loading overlay.
|
|
28
|
+
*
|
|
29
|
+
* The orchestrator clears the slot automatically between steps, so modules
|
|
30
|
+
* don't need to call `setNode(null)` on `destroy()` for cleanup purposes.
|
|
31
|
+
*/
|
|
32
|
+
export interface StepUiHandle {
|
|
33
|
+
setNode(node: ReactNode | null): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Constructor arguments shared by every step module. */
|
|
37
|
+
export interface StepDeps {
|
|
38
|
+
api: ApiCaller;
|
|
39
|
+
sessionId: string;
|
|
40
|
+
locale: string;
|
|
41
|
+
colorMode: 'light' | 'dark';
|
|
42
|
+
ui: StepUiHandle;
|
|
43
|
+
step: OnboardingStep;
|
|
44
|
+
stepConfig?: Record<string, unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Google Maps Platform API key (Maps + Places). Forwarded to the assisted
|
|
47
|
+
* `ADDRESS_INFO` flow when the consumer passes it via `VelionConfig`. Steps
|
|
48
|
+
* that don't use it can ignore the field.
|
|
49
|
+
*/
|
|
50
|
+
googleMapsApiKey?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Fingerprint Pro endpoint URL (custom subdomain). Defaults to
|
|
53
|
+
* `https://fp.velion.la`. Only read by `FingerprintStep`.
|
|
54
|
+
*/
|
|
55
|
+
fingerprintEndpoint?: string;
|
|
56
|
+
/** Override of the public Fingerprint Pro key. Only read by `FingerprintStep`. */
|
|
57
|
+
fingerprintApiKey?: string;
|
|
58
|
+
/** Per-call timeout for Fingerprint identification. Only read by `FingerprintStep`. */
|
|
59
|
+
fingerprintTimeoutMs?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Optional Iris calibration tag for LIVENESS_MATCH. See
|
|
62
|
+
* `VelionConfig.livenessCalibrationLabel` for details. Only read by
|
|
63
|
+
* `LivenessMatchStep`.
|
|
64
|
+
*/
|
|
65
|
+
livenessCalibrationLabel?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Convenience type used by step modules that propagate failures to the
|
|
70
|
+
* orchestrator. The orchestrator translates these into `onError` calls.
|
|
71
|
+
*/
|
|
72
|
+
export type StepFailure = SdkError;
|