@velion-la/onboarding-sdk-react-native 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/LICENSE +12 -0
- package/README.md +888 -0
- package/app.plugin.js +101 -0
- package/lib/commonjs/camera/AddressSearchBar.js +304 -0
- package/lib/commonjs/camera/AddressSearchBar.js.map +1 -0
- package/lib/commonjs/camera/DocumentCapture.js +513 -0
- package/lib/commonjs/camera/DocumentCapture.js.map +1 -0
- package/lib/commonjs/camera/LivenessCamera.js +628 -0
- package/lib/commonjs/camera/LivenessCamera.js.map +1 -0
- package/lib/commonjs/camera/MapAddressPicker.js +331 -0
- package/lib/commonjs/camera/MapAddressPicker.js.map +1 -0
- package/lib/commonjs/core/VelionOnboarding.js +1113 -0
- package/lib/commonjs/core/VelionOnboarding.js.map +1 -0
- package/lib/commonjs/core/retryStepCopy.js +43 -0
- package/lib/commonjs/core/retryStepCopy.js.map +1 -0
- package/lib/commonjs/core/routingCommands.js +62 -0
- package/lib/commonjs/core/routingCommands.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 +200 -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 +301 -0
- package/lib/commonjs/i18n/strings/en.js.map +1 -0
- package/lib/commonjs/i18n/strings/es.js +306 -0
- package/lib/commonjs/i18n/strings/es.js.map +1 -0
- package/lib/commonjs/index.js +225 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/steps/AddressInfoStep.js +662 -0
- package/lib/commonjs/steps/AddressInfoStep.js.map +1 -0
- package/lib/commonjs/steps/DocumentsOcrStep.js +405 -0
- package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -0
- package/lib/commonjs/steps/EconomicActivityStep.js +214 -0
- package/lib/commonjs/steps/EconomicActivityStep.js.map +1 -0
- package/lib/commonjs/steps/EmailContactStep.js +150 -0
- package/lib/commonjs/steps/EmailContactStep.js.map +1 -0
- package/lib/commonjs/steps/EmailOtpStep.js +225 -0
- package/lib/commonjs/steps/EmailOtpStep.js.map +1 -0
- package/lib/commonjs/steps/FaceMatchStep.js +169 -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 +251 -0
- package/lib/commonjs/steps/HumanBasicInfoStep.js.map +1 -0
- package/lib/commonjs/steps/HumanExtendedInfoStep.js +275 -0
- package/lib/commonjs/steps/HumanExtendedInfoStep.js.map +1 -0
- package/lib/commonjs/steps/LegalBasicInfoStep.js +195 -0
- package/lib/commonjs/steps/LegalBasicInfoStep.js.map +1 -0
- package/lib/commonjs/steps/LegalExtendedInfoStep.js +173 -0
- package/lib/commonjs/steps/LegalExtendedInfoStep.js.map +1 -0
- package/lib/commonjs/steps/LivenessMatchStep.js +1184 -0
- package/lib/commonjs/steps/LivenessMatchStep.js.map +1 -0
- package/lib/commonjs/steps/PhoneContactStep.js +151 -0
- package/lib/commonjs/steps/PhoneContactStep.js.map +1 -0
- package/lib/commonjs/steps/PhoneOtpStep.js +224 -0
- package/lib/commonjs/steps/PhoneOtpStep.js.map +1 -0
- package/lib/commonjs/steps/SwornDeclarationStep.js +206 -0
- package/lib/commonjs/steps/SwornDeclarationStep.js.map +1 -0
- package/lib/commonjs/steps/TaxInfoStep.js +251 -0
- package/lib/commonjs/steps/TaxInfoStep.js.map +1 -0
- package/lib/commonjs/steps/TermsAndConditionsStep.js +245 -0
- package/lib/commonjs/steps/TermsAndConditionsStep.js.map +1 -0
- package/lib/commonjs/steps/_shared.js +61 -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 +458 -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 +251 -0
- package/lib/commonjs/ui/StepShell.js.map +1 -0
- package/lib/commonjs/ui/VelionOnboardingScreen.js +276 -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 +101 -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/BackButton.js +75 -0
- package/lib/commonjs/ui/primitives/BackButton.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/SearchableSingleSelectList.js +162 -0
- package/lib/commonjs/ui/primitives/SearchableSingleSelectList.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 +89 -0
- package/lib/commonjs/ui/primitives/index.js.map +1 -0
- package/lib/commonjs/ui/primitives/searchableSingleSelectFilter.js +31 -0
- package/lib/commonjs/ui/primitives/searchableSingleSelectFilter.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 +88 -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/commonjs/utils/useSafeAreaInsets.js +41 -0
- package/lib/commonjs/utils/useSafeAreaInsets.js.map +1 -0
- package/lib/commonjs/utils/velionExtra.js +48 -0
- package/lib/commonjs/utils/velionExtra.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 +508 -0
- package/lib/module/camera/DocumentCapture.js.map +1 -0
- package/lib/module/camera/LivenessCamera.js +623 -0
- package/lib/module/camera/LivenessCamera.js.map +1 -0
- package/lib/module/camera/MapAddressPicker.js +326 -0
- package/lib/module/camera/MapAddressPicker.js.map +1 -0
- package/lib/module/core/VelionOnboarding.js +1109 -0
- package/lib/module/core/VelionOnboarding.js.map +1 -0
- package/lib/module/core/retryStepCopy.js +39 -0
- package/lib/module/core/retryStepCopy.js.map +1 -0
- package/lib/module/core/routingCommands.js +57 -0
- package/lib/module/core/routingCommands.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 +189 -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 +297 -0
- package/lib/module/i18n/strings/en.js.map +1 -0
- package/lib/module/i18n/strings/es.js +302 -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 +658 -0
- package/lib/module/steps/AddressInfoStep.js.map +1 -0
- package/lib/module/steps/DocumentsOcrStep.js +399 -0
- package/lib/module/steps/DocumentsOcrStep.js.map +1 -0
- package/lib/module/steps/EconomicActivityStep.js +209 -0
- package/lib/module/steps/EconomicActivityStep.js.map +1 -0
- package/lib/module/steps/EmailContactStep.js +145 -0
- package/lib/module/steps/EmailContactStep.js.map +1 -0
- package/lib/module/steps/EmailOtpStep.js +220 -0
- package/lib/module/steps/EmailOtpStep.js.map +1 -0
- package/lib/module/steps/FaceMatchStep.js +164 -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 +246 -0
- package/lib/module/steps/HumanBasicInfoStep.js.map +1 -0
- package/lib/module/steps/HumanExtendedInfoStep.js +270 -0
- package/lib/module/steps/HumanExtendedInfoStep.js.map +1 -0
- package/lib/module/steps/LegalBasicInfoStep.js +190 -0
- package/lib/module/steps/LegalBasicInfoStep.js.map +1 -0
- package/lib/module/steps/LegalExtendedInfoStep.js +168 -0
- package/lib/module/steps/LegalExtendedInfoStep.js.map +1 -0
- package/lib/module/steps/LivenessMatchStep.js +1177 -0
- package/lib/module/steps/LivenessMatchStep.js.map +1 -0
- package/lib/module/steps/PhoneContactStep.js +146 -0
- package/lib/module/steps/PhoneContactStep.js.map +1 -0
- package/lib/module/steps/PhoneOtpStep.js +219 -0
- package/lib/module/steps/PhoneOtpStep.js.map +1 -0
- package/lib/module/steps/SwornDeclarationStep.js +203 -0
- package/lib/module/steps/SwornDeclarationStep.js.map +1 -0
- package/lib/module/steps/TaxInfoStep.js +246 -0
- package/lib/module/steps/TaxInfoStep.js.map +1 -0
- package/lib/module/steps/TermsAndConditionsStep.js +240 -0
- package/lib/module/steps/TermsAndConditionsStep.js.map +1 -0
- package/lib/module/steps/_shared.js +52 -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 +532 -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 +246 -0
- package/lib/module/ui/StepShell.js.map +1 -0
- package/lib/module/ui/VelionOnboardingScreen.js +273 -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 +97 -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/BackButton.js +71 -0
- package/lib/module/ui/primitives/BackButton.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/SearchableSingleSelectList.js +153 -0
- package/lib/module/ui/primitives/SearchableSingleSelectList.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 +14 -0
- package/lib/module/ui/primitives/index.js.map +1 -0
- package/lib/module/ui/primitives/searchableSingleSelectFilter.js +27 -0
- package/lib/module/ui/primitives/searchableSingleSelectFilter.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 +84 -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/module/utils/useSafeAreaInsets.js +37 -0
- package/lib/module/utils/useSafeAreaInsets.js.map +1 -0
- package/lib/module/utils/velionExtra.js +44 -0
- package/lib/module/utils/velionExtra.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 +67 -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 +169 -0
- package/lib/typescript/core/VelionOnboarding.d.ts.map +1 -0
- package/lib/typescript/core/retryStepCopy.d.ts +27 -0
- package/lib/typescript/core/retryStepCopy.d.ts.map +1 -0
- package/lib/typescript/core/routingCommands.d.ts +39 -0
- package/lib/typescript/core/routingCommands.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 +52 -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 +297 -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/EconomicActivityStep.d.ts +29 -0
- package/lib/typescript/steps/EconomicActivityStep.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 +22 -0
- package/lib/typescript/steps/_shared.d.ts.map +1 -0
- package/lib/typescript/steps/types.d.ts +89 -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 +1219 -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 +29 -0
- package/lib/typescript/ui/StepShell.d.ts.map +1 -0
- package/lib/typescript/ui/VelionOnboardingScreen.d.ts +26 -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 +32 -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/BackButton.d.ts +20 -0
- package/lib/typescript/ui/primitives/BackButton.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/SearchableSingleSelectList.d.ts +33 -0
- package/lib/typescript/ui/primitives/SearchableSingleSelectList.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 +12 -0
- package/lib/typescript/ui/primitives/index.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/searchableSingleSelectFilter.d.ts +25 -0
- package/lib/typescript/ui/primitives/searchableSingleSelectFilter.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 +52 -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/lib/typescript/utils/useSafeAreaInsets.d.ts +26 -0
- package/lib/typescript/utils/useSafeAreaInsets.d.ts.map +1 -0
- package/lib/typescript/utils/velionExtra.d.ts +24 -0
- package/lib/typescript/utils/velionExtra.d.ts.map +1 -0
- package/package.json +107 -0
- package/src/camera/AddressSearchBar.tsx +363 -0
- package/src/camera/DocumentCapture.tsx +514 -0
- package/src/camera/LivenessCamera.tsx +706 -0
- package/src/camera/MapAddressPicker.tsx +391 -0
- package/src/core/VelionOnboarding.ts +1291 -0
- package/src/core/retryStepCopy.ts +54 -0
- package/src/core/routingCommands.ts +63 -0
- package/src/core/sessionDeclinedCopy.ts +76 -0
- package/src/core/sessionStateMapper.ts +232 -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 +335 -0
- package/src/i18n/strings/es.ts +337 -0
- package/src/index.ts +146 -0
- package/src/steps/AddressInfoStep.tsx +744 -0
- package/src/steps/DocumentsOcrStep.tsx +481 -0
- package/src/steps/EconomicActivityStep.tsx +230 -0
- package/src/steps/EmailContactStep.tsx +165 -0
- package/src/steps/EmailOtpStep.tsx +256 -0
- package/src/steps/FaceMatchStep.tsx +176 -0
- package/src/steps/FingerprintStep.tsx +99 -0
- package/src/steps/HumanBasicInfoStep.tsx +286 -0
- package/src/steps/HumanExtendedInfoStep.tsx +362 -0
- package/src/steps/LegalBasicInfoStep.tsx +214 -0
- package/src/steps/LegalExtendedInfoStep.tsx +184 -0
- package/src/steps/LivenessMatchStep.tsx +1351 -0
- package/src/steps/PhoneContactStep.tsx +166 -0
- package/src/steps/PhoneOtpStep.tsx +255 -0
- package/src/steps/SwornDeclarationStep.tsx +237 -0
- package/src/steps/TaxInfoStep.tsx +288 -0
- package/src/steps/TermsAndConditionsStep.tsx +269 -0
- package/src/steps/_shared.ts +69 -0
- package/src/steps/types.ts +93 -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 +1421 -0
- package/src/ui/MapFallbackBoundary.tsx +46 -0
- package/src/ui/StepShell.tsx +273 -0
- package/src/ui/VelionOnboardingScreen.tsx +297 -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 +78 -0
- package/src/ui/overlays/AnalyzingOverlay.tsx +323 -0
- package/src/ui/overlays/LoadingOverlay.tsx +115 -0
- package/src/ui/overlays/ProgressBar.tsx +106 -0
- package/src/ui/overlays/RetryDialog.tsx +128 -0
- package/src/ui/overlays/index.ts +3 -0
- package/src/ui/primitives/BackButton.tsx +65 -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/SearchableSingleSelectList.tsx +195 -0
- package/src/ui/primitives/Select.tsx +259 -0
- package/src/ui/primitives/Spinner.tsx +17 -0
- package/src/ui/primitives/index.ts +16 -0
- package/src/ui/primitives/searchableSingleSelectFilter.ts +38 -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 +89 -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
- package/src/utils/useSafeAreaInsets.ts +37 -0
- package/src/utils/velionExtra.ts +46 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Copy resolution for the retry dialog shown on
|
|
3
|
+
* `ROUTING_COMMAND / RETRY_STEP` (a step failed but the retry quota is not yet
|
|
4
|
+
* exhausted, so the backend asks the SDK to re-present it).
|
|
5
|
+
*
|
|
6
|
+
* The backend `reason` is intentionally NOT used here: it is a diagnostic string
|
|
7
|
+
* (e.g. `"STEP_FAILED_RETRY_ALLOWED (attempt 1/3)"`), not user-facing localized
|
|
8
|
+
* copy. The dialog title/message are derived from the step being retried, with a
|
|
9
|
+
* generic fallback, and can be overridden per-step by the host via
|
|
10
|
+
* `VelionConfig.retryStepTexts`.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { OnboardingStep, VelionRetryStepTexts } from '../types';
|
|
14
|
+
import { getStrings } from '../i18n';
|
|
15
|
+
|
|
16
|
+
export interface ResolvedRetryStepCopy {
|
|
17
|
+
title: string;
|
|
18
|
+
message: string;
|
|
19
|
+
retryLabel: string;
|
|
20
|
+
cancelLabel: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isEnglishLocale(locale: string | undefined): boolean {
|
|
24
|
+
return (locale ?? 'es').toLowerCase().startsWith('en');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Resolves the retry dialog copy for `step`. Precedence for title/message:
|
|
29
|
+
* 1. host override (`retryStepTexts[step][lang]`),
|
|
30
|
+
* 2. SDK per-step default (i18n `retryStep.steps[step]`),
|
|
31
|
+
* 3. generic SDK default (i18n `retryStep.default*`).
|
|
32
|
+
* The retry/cancel button labels always come from the i18n table.
|
|
33
|
+
*/
|
|
34
|
+
export function resolveRetryStepCopy(
|
|
35
|
+
locale: string | undefined,
|
|
36
|
+
texts: VelionRetryStepTexts | undefined,
|
|
37
|
+
step: OnboardingStep,
|
|
38
|
+
): ResolvedRetryStepCopy {
|
|
39
|
+
const t = getStrings(locale);
|
|
40
|
+
const lang = isEnglishLocale(locale) ? 'en' : 'es';
|
|
41
|
+
|
|
42
|
+
const perStepDefault = (
|
|
43
|
+
t.retryStep.steps as Record<string, { title: string; message: string }>
|
|
44
|
+
)[step];
|
|
45
|
+
const override = texts?.[step]?.[lang];
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
title: override?.title ?? perStepDefault?.title ?? t.retryStep.defaultTitle,
|
|
49
|
+
message:
|
|
50
|
+
override?.message ?? perStepDefault?.message ?? t.retryStep.defaultMessage,
|
|
51
|
+
retryLabel: t.retryStep.retry,
|
|
52
|
+
cancelLabel: t.retryStep.cancel,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Pure parsers for SSE `ROUTING_COMMAND` payloads.
|
|
3
|
+
*
|
|
4
|
+
* Kept free of React Native imports so they can be unit-tested in a plain node
|
|
5
|
+
* environment. The orchestrator owns the side effects (navigation, POSTs); these
|
|
6
|
+
* functions only translate a raw `OnboardingSessionEvent` into a typed command.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { OnboardingSessionEvent, OnboardingStep } from '../types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Reverse-navigation command (`ROUTING_COMMAND / PREVIOUS_STEP`). Carries the
|
|
13
|
+
* re-opened step plus its config and the previously-captured data for prefill.
|
|
14
|
+
*/
|
|
15
|
+
export interface PreviousStepCommand {
|
|
16
|
+
step: OnboardingStep;
|
|
17
|
+
stepConfig?: Record<string, unknown>;
|
|
18
|
+
stepResult?: Record<string, unknown>;
|
|
19
|
+
/** Whether the re-opened step can itself go back further (when the backend sends it). */
|
|
20
|
+
canGoBack?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Parses a reverse-navigation command from an SSE event. Returns `null` for any
|
|
25
|
+
* event that is not a `ROUTING_COMMAND` with `action === 'PREVIOUS_STEP'` and a
|
|
26
|
+
* `step_code`. `step_config` (config) and `step_result` (prefill) are forwarded
|
|
27
|
+
* when present.
|
|
28
|
+
*/
|
|
29
|
+
export function parsePreviousStepCommand(
|
|
30
|
+
event: OnboardingSessionEvent,
|
|
31
|
+
): PreviousStepCommand | null {
|
|
32
|
+
if (event.event_type !== 'ROUTING_COMMAND') return null;
|
|
33
|
+
if (event.action !== 'PREVIOUS_STEP') return null;
|
|
34
|
+
const step = event.step_code as OnboardingStep | undefined;
|
|
35
|
+
if (!step) return null;
|
|
36
|
+
return {
|
|
37
|
+
step,
|
|
38
|
+
...(event.step_config !== undefined && { stepConfig: event.step_config }),
|
|
39
|
+
...(event.step_result !== undefined && { stepResult: event.step_result }),
|
|
40
|
+
...(typeof event.can_go_back === 'boolean' && { canGoBack: event.can_go_back }),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Back-exit command (`ROUTING_COMMAND / BACK_EXIT`): leave the flow entirely. */
|
|
45
|
+
export interface BackExitCommand {
|
|
46
|
+
/** The step the user exited from (`step_code`), when the backend provides it. */
|
|
47
|
+
step?: OnboardingStep;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Parses a back-exit command from an SSE event. The backend emits this when the
|
|
52
|
+
* user taps "back" on the first reversible step (no earlier step to return to),
|
|
53
|
+
* signalling the SDK to leave the flow. Returns `null` for any other event.
|
|
54
|
+
* `step_code` is forwarded when present but is not required.
|
|
55
|
+
*/
|
|
56
|
+
export function parseBackExitCommand(
|
|
57
|
+
event: OnboardingSessionEvent,
|
|
58
|
+
): BackExitCommand | null {
|
|
59
|
+
if (event.event_type !== 'ROUTING_COMMAND') return null;
|
|
60
|
+
if (event.action !== 'BACK_EXIT') return null;
|
|
61
|
+
const step = event.step_code as OnboardingStep | undefined;
|
|
62
|
+
return step ? { step } : {};
|
|
63
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Default and merged copy for the SESSION_DECLINED SSE error screen.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { VelionSessionDeclinedReasonTexts } from '../types';
|
|
6
|
+
import { SESSION_DECLINED_REASON_MESSAGES } from './sseReasonMessages';
|
|
7
|
+
|
|
8
|
+
export interface ResolvedSessionDeclinedCopy {
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
dismissLabel: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function isEnglishLocale(locale: string | undefined): boolean {
|
|
15
|
+
return (locale ?? 'es').toLowerCase().startsWith('en');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function humanizeStepFailedCode(reasonKey: string): string {
|
|
19
|
+
return reasonKey.replace(/_FAILED$/iu, '').replace(/_/g, ' ').toLowerCase();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function stepFailedFallback(reasonKey: string, lang: 'en' | 'es'): { title: string; message: string } {
|
|
23
|
+
const stepLabel = humanizeStepFailedCode(reasonKey);
|
|
24
|
+
if (lang === 'en') {
|
|
25
|
+
return {
|
|
26
|
+
title: 'We could not complete this step',
|
|
27
|
+
message: `The verification step (${stepLabel}) did not complete successfully. Please try again or contact support.`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
title: 'No pudimos completar este paso',
|
|
32
|
+
message: `El paso de verificación (${stepLabel}) no se completó correctamente. Intentá de nuevo o contactá a soporte.`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function pickDeclineDefaults(
|
|
37
|
+
reasonKey: string,
|
|
38
|
+
lang: 'en' | 'es',
|
|
39
|
+
): { title: string; message: string } | undefined {
|
|
40
|
+
const fromMap = SESSION_DECLINED_REASON_MESSAGES[reasonKey]?.[lang];
|
|
41
|
+
if (fromMap) return fromMap;
|
|
42
|
+
if (/_FAILED$/iu.test(reasonKey)) {
|
|
43
|
+
return stepFailedFallback(reasonKey, lang);
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Resolves title, body, and dismiss label for a SESSION_DECLINED screen.
|
|
50
|
+
*/
|
|
51
|
+
export function resolveSessionDeclinedCopy(
|
|
52
|
+
locale: string | undefined,
|
|
53
|
+
texts: VelionSessionDeclinedReasonTexts | undefined,
|
|
54
|
+
reason: string | undefined,
|
|
55
|
+
/** Same dismiss as `VelionFinalResultScreenTexts.dismissLabel` when set. */
|
|
56
|
+
finalResultDismissLabel?: string,
|
|
57
|
+
): ResolvedSessionDeclinedCopy {
|
|
58
|
+
const lang = isEnglishLocale(locale) ? 'en' : 'es';
|
|
59
|
+
const reasonKey = reason ?? '';
|
|
60
|
+
const defaults = pickDeclineDefaults(reasonKey, lang);
|
|
61
|
+
const override = reason ? texts?.[reason]?.[lang] : undefined;
|
|
62
|
+
const dismissLabel =
|
|
63
|
+
finalResultDismissLabel ?? (isEnglishLocale(locale) ? 'Got it' : 'Entendido');
|
|
64
|
+
return {
|
|
65
|
+
title: override?.title ?? defaults?.title ?? (isEnglishLocale(locale)
|
|
66
|
+
? 'We could not continue'
|
|
67
|
+
: 'No pudimos continuar'),
|
|
68
|
+
message:
|
|
69
|
+
override?.message ??
|
|
70
|
+
defaults?.message ??
|
|
71
|
+
(isEnglishLocale(locale)
|
|
72
|
+
? 'This session could not be completed. Please try again or contact support.'
|
|
73
|
+
: 'No se pudo completar esta sesión. Intentá de nuevo o contactá a soporte.'),
|
|
74
|
+
dismissLabel,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Maps backend OnboardingDto (GET /sessions/:id) to SDK SessionState.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
OnboardingDtoResponse,
|
|
7
|
+
OnboardingResult,
|
|
8
|
+
OnboardingStep,
|
|
9
|
+
SessionState,
|
|
10
|
+
OnboardingType,
|
|
11
|
+
StepConfigMap,
|
|
12
|
+
} from '../types';
|
|
13
|
+
|
|
14
|
+
const TERMINAL_STEP_STATUSES = new Set(['COMPLETED', 'SKIPPED']);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Maps the onboarding DTO returned by GET /sessions/:sessionId to the
|
|
18
|
+
* SessionState shape used by the step machine.
|
|
19
|
+
*/
|
|
20
|
+
export function mapOnboardingDtoToSessionState(
|
|
21
|
+
dto: OnboardingDtoResponse,
|
|
22
|
+
): SessionState {
|
|
23
|
+
const steps = dto.steps ?? [];
|
|
24
|
+
const sorted = [...steps].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
25
|
+
|
|
26
|
+
const onboardingType = dto.onboarding_type as OnboardingType | undefined;
|
|
27
|
+
const validType: OnboardingType | undefined =
|
|
28
|
+
onboardingType === 'HUMAN' || onboardingType === 'LEGAL'
|
|
29
|
+
? onboardingType
|
|
30
|
+
: undefined;
|
|
31
|
+
|
|
32
|
+
const stepConfigs: StepConfigMap = {};
|
|
33
|
+
|
|
34
|
+
for (const s of sorted) {
|
|
35
|
+
const code = s.code as OnboardingStep | undefined;
|
|
36
|
+
if (!code || typeof code !== 'string') continue;
|
|
37
|
+
if (s.result && typeof s.result === 'object') {
|
|
38
|
+
stepConfigs[code] = s.result;
|
|
39
|
+
}
|
|
40
|
+
const maybeConfig = (s as unknown as { config?: Record<string, unknown> }).config;
|
|
41
|
+
if (maybeConfig && typeof maybeConfig === 'object') {
|
|
42
|
+
stepConfigs[code] = maybeConfig;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const currentStepCode = dto.current_step?.code;
|
|
47
|
+
const currentStep =
|
|
48
|
+
typeof currentStepCode === 'string'
|
|
49
|
+
? (currentStepCode as OnboardingStep)
|
|
50
|
+
: resolveCurrentStepFromLegacySteps(sorted);
|
|
51
|
+
const currentStepConfig =
|
|
52
|
+
dto.current_step?.config && typeof dto.current_step.config === 'object'
|
|
53
|
+
? dto.current_step.config
|
|
54
|
+
: currentStep
|
|
55
|
+
? stepConfigs[currentStep]
|
|
56
|
+
: undefined;
|
|
57
|
+
if (currentStep && currentStepConfig) {
|
|
58
|
+
stepConfigs[currentStep] = currentStepConfig;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Whether the SDK shows the "back" control on the current step. The backend
|
|
62
|
+
// computes this from the workflow graph and exposes it as `can_go_back` — the
|
|
63
|
+
// SDK obeys it instead of a step's intrinsic `reversible` flag.
|
|
64
|
+
const canGoBack =
|
|
65
|
+
typeof dto.can_go_back === 'boolean' ? dto.can_go_back : undefined;
|
|
66
|
+
|
|
67
|
+
// Per-step reversibility in workflow order, so the orchestrator can derive
|
|
68
|
+
// `can_go_back` for steps reached via SSE (which does not carry the flag).
|
|
69
|
+
const stepReversibility = sorted
|
|
70
|
+
.map((s) => {
|
|
71
|
+
const code = s.code as OnboardingStep | undefined;
|
|
72
|
+
if (!code || typeof code !== 'string') return null;
|
|
73
|
+
const maybeConfig = (s as unknown as { config?: Record<string, unknown> })
|
|
74
|
+
.config;
|
|
75
|
+
const reversible = resolveReversibleFlag(s.reversible, maybeConfig) === true;
|
|
76
|
+
return { code, reversible };
|
|
77
|
+
})
|
|
78
|
+
.filter((s): s is { code: OnboardingStep; reversible: boolean } => s !== null);
|
|
79
|
+
|
|
80
|
+
// Prefill: data previously captured for `currentStep`, present when a reverse
|
|
81
|
+
// navigation re-opened a completed step (GET reflects it on `current_step.result`).
|
|
82
|
+
const currentStepResult =
|
|
83
|
+
dto.current_step?.result && typeof dto.current_step.result === 'object'
|
|
84
|
+
? dto.current_step.result
|
|
85
|
+
: undefined;
|
|
86
|
+
|
|
87
|
+
const allowedParentOrigins = Array.isArray(dto.allowed_parent_origins)
|
|
88
|
+
? dto.allowed_parent_origins.filter(
|
|
89
|
+
(o): o is string => typeof o === 'string' && o.length > 0,
|
|
90
|
+
)
|
|
91
|
+
: undefined;
|
|
92
|
+
|
|
93
|
+
const state: SessionState = {
|
|
94
|
+
...(currentStep !== undefined && { currentStep }),
|
|
95
|
+
...(currentStepConfig !== undefined && { currentStepConfig }),
|
|
96
|
+
...(canGoBack !== undefined && { canGoBack }),
|
|
97
|
+
...(stepReversibility.length > 0 && { stepReversibility }),
|
|
98
|
+
...(currentStepResult !== undefined && { currentStepResult }),
|
|
99
|
+
...(Object.keys(stepConfigs).length > 0 && { stepConfigs }),
|
|
100
|
+
...(validType !== undefined && { onboardingType: validType }),
|
|
101
|
+
...(dto.metadata !== undefined && { metadata: dto.metadata }),
|
|
102
|
+
...(allowedParentOrigins !== undefined && { allowedParentOrigins }),
|
|
103
|
+
};
|
|
104
|
+
return state;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Resolves whether a step is reversible. Prefers an explicit boolean flag
|
|
109
|
+
* (e.g. `current_step.reversible`); otherwise reads the `reversible` key the
|
|
110
|
+
* backend stamps into the step config. Returns `undefined` when neither source
|
|
111
|
+
* carries the flag, so callers can distinguish "not reversible" from "unknown".
|
|
112
|
+
*/
|
|
113
|
+
export function resolveReversibleFlag(
|
|
114
|
+
explicit: boolean | undefined,
|
|
115
|
+
config: Record<string, unknown> | undefined,
|
|
116
|
+
): boolean | undefined {
|
|
117
|
+
if (typeof explicit === 'boolean') return explicit;
|
|
118
|
+
if (config && typeof config.reversible === 'boolean') {
|
|
119
|
+
return config.reversible;
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Derives `can_go_back` for a step from the workflow reversibility map (used as a
|
|
126
|
+
* fallback when the backend doesn't send `can_go_back` explicitly — e.g. on a
|
|
127
|
+
* step reached via SSE). Matches the backend's barrier model: a step can go back
|
|
128
|
+
* when any earlier step is reversible (navigate to it) or the step itself is the
|
|
129
|
+
* first reversible step (back exits the flow). Returns `false` when the step is
|
|
130
|
+
* not in the cached order.
|
|
131
|
+
*/
|
|
132
|
+
export function deriveCanGoBack(
|
|
133
|
+
step: OnboardingStep,
|
|
134
|
+
order: ReadonlyArray<{ code: OnboardingStep; reversible: boolean }>,
|
|
135
|
+
): boolean {
|
|
136
|
+
const index = order.findIndex((s) => s.code === step);
|
|
137
|
+
if (index < 0) return false;
|
|
138
|
+
const previousReversible = order.slice(0, index).some((s) => s.reversible);
|
|
139
|
+
const currentReversible = order[index]?.reversible === true;
|
|
140
|
+
return previousReversible || currentReversible;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function resolveCurrentStepFromLegacySteps(
|
|
144
|
+
sorted: Array<{ code: string; status?: string }>,
|
|
145
|
+
): OnboardingStep | undefined {
|
|
146
|
+
for (const s of sorted) {
|
|
147
|
+
const status = s.status;
|
|
148
|
+
if (!status || !TERMINAL_STEP_STATUSES.has(status)) {
|
|
149
|
+
return s.code as OnboardingStep;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const last = sorted.at(-1);
|
|
153
|
+
return last?.code as OnboardingStep | undefined;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Maps GET /sessions `status` to {@link OnboardingResult.status}.
|
|
158
|
+
* Unknown values fall back to `MANUAL_REVIEW`.
|
|
159
|
+
*/
|
|
160
|
+
export function mapSessionDtoStatusToResultStatus(
|
|
161
|
+
raw: string | undefined,
|
|
162
|
+
): OnboardingResult['status'] {
|
|
163
|
+
const s = typeof raw === 'string' ? raw.trim().toUpperCase() : '';
|
|
164
|
+
if (s === 'APPROVED') return 'APPROVED';
|
|
165
|
+
if (s === 'MANUAL_REVIEW' || s === 'IN_REVIEW') return 'MANUAL_REVIEW';
|
|
166
|
+
if (s === 'REJECTED') return 'REJECTED';
|
|
167
|
+
if (s === 'DECLINED') return 'DECLINED';
|
|
168
|
+
return 'MANUAL_REVIEW';
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* True when GET session has no runnable step but onboarding is already finished
|
|
173
|
+
* (no `current_step` expected).
|
|
174
|
+
*/
|
|
175
|
+
export function isTerminalSessionStatusFromDto(raw: string | undefined): boolean {
|
|
176
|
+
const s = typeof raw === 'string' ? raw.trim().toUpperCase() : '';
|
|
177
|
+
return (
|
|
178
|
+
s === 'APPROVED' ||
|
|
179
|
+
s === 'MANUAL_REVIEW' ||
|
|
180
|
+
s === 'REJECTED' ||
|
|
181
|
+
s === 'DECLINED' ||
|
|
182
|
+
s === 'IN_REVIEW'
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* True when the SDK must run workflow steps; backend should send `current_step`.
|
|
188
|
+
*/
|
|
189
|
+
export function requiresCurrentStepForSessionStatus(raw: string | undefined): boolean {
|
|
190
|
+
const s = typeof raw === 'string' ? raw.trim().toUpperCase() : '';
|
|
191
|
+
return s === 'INITIATED' || s === 'IN_PROGRESS';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Builds OnboardingResult from the same onboarding DTO when status is terminal.
|
|
196
|
+
*/
|
|
197
|
+
export function mapOnboardingDtoToResult(
|
|
198
|
+
dto: OnboardingDtoResponse,
|
|
199
|
+
sessionId: string,
|
|
200
|
+
): OnboardingResult {
|
|
201
|
+
const terminal = mapSessionDtoStatusToResultStatus(dto.status);
|
|
202
|
+
return buildResultFromDto(dto, sessionId, terminal);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Builds OnboardingResult using completed_at and referenceId from the DTO
|
|
207
|
+
* but with an explicit terminal status (e.g. from a terminal SSE event).
|
|
208
|
+
*/
|
|
209
|
+
export function mapOnboardingDtoToResultWithStatus(
|
|
210
|
+
dto: OnboardingDtoResponse,
|
|
211
|
+
sessionId: string,
|
|
212
|
+
terminalStatus: OnboardingResult['status'],
|
|
213
|
+
terminalReason?: string,
|
|
214
|
+
): OnboardingResult {
|
|
215
|
+
return buildResultFromDto(dto, sessionId, terminalStatus, terminalReason);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function buildResultFromDto(
|
|
219
|
+
dto: OnboardingDtoResponse,
|
|
220
|
+
sessionId: string,
|
|
221
|
+
terminal: OnboardingResult['status'],
|
|
222
|
+
terminalReason?: string,
|
|
223
|
+
): OnboardingResult {
|
|
224
|
+
return {
|
|
225
|
+
sessionId,
|
|
226
|
+
completedAt: dto.completed_at ?? new Date().toISOString(),
|
|
227
|
+
status: terminal,
|
|
228
|
+
...(dto.id !== undefined && dto.id !== '' && { referenceId: String(dto.id) }),
|
|
229
|
+
...(terminalReason !== undefined &&
|
|
230
|
+
terminalReason.trim() !== '' && { terminalReason: terminalReason.trim() }),
|
|
231
|
+
};
|
|
232
|
+
}
|