@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,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for reading a captured photo into JPEG bytes.
|
|
3
|
+
*
|
|
4
|
+
* Vision-Camera writes captures to a `file://` path; consumers convert that
|
|
5
|
+
* path into either base64 (for the Iris HMAC envelope) or raw bytes (for
|
|
6
|
+
* binary WebSocket frames + direct PUT to signed URLs).
|
|
7
|
+
*
|
|
8
|
+
* Why not `fetch(uri).then(r => r.blob()).then(b => b.arrayBuffer())`?
|
|
9
|
+
*
|
|
10
|
+
* React Native's Blob polyfill does NOT implement `Blob.arrayBuffer()`
|
|
11
|
+
* (it's web-only). Calling it crashes with
|
|
12
|
+
* `TypeError: blob.arrayBuffer is not a function`. The reliable path on
|
|
13
|
+
* iOS + Android is the native `File.arrayBuffer()` from
|
|
14
|
+
* `expo-file-system` v19+, which reads directly from disk into an
|
|
15
|
+
* ArrayBuffer without going through the JS Blob bridge.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { File } from 'expo-file-system';
|
|
19
|
+
import { bytesToBase64 } from './base64';
|
|
20
|
+
|
|
21
|
+
export interface JpegFromUri {
|
|
22
|
+
bytes: Uint8Array;
|
|
23
|
+
base64: string;
|
|
24
|
+
byteLength: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reads a `file://` URI into JPEG bytes + base64 representation.
|
|
29
|
+
*
|
|
30
|
+
* Accepts both forms vision-camera returns (`/var/mobile/...` without a
|
|
31
|
+
* scheme on iOS; `file:///data/...` on Android). Normalises to `file://`.
|
|
32
|
+
*/
|
|
33
|
+
export async function readJpegFromUri(uri: string): Promise<JpegFromUri> {
|
|
34
|
+
const normalised = uri.startsWith('file://') || uri.startsWith('http')
|
|
35
|
+
? uri
|
|
36
|
+
: `file://${uri}`;
|
|
37
|
+
const file = new File(normalised);
|
|
38
|
+
const buf = await file.arrayBuffer();
|
|
39
|
+
const bytes = new Uint8Array(buf);
|
|
40
|
+
const base64 = bytesToBase64(bytes);
|
|
41
|
+
return { bytes, base64, byteLength: bytes.byteLength };
|
|
42
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin wrapper around `expo-keep-awake` that prevents the device from
|
|
3
|
+
* locking the screen while the SDK is in the foreground. Without this,
|
|
4
|
+
* Android's screen-timeout policy kicks in during camera-heavy steps
|
|
5
|
+
* (LIVENESS_MATCH, DOCUMENTS_OCR) where the user is holding still and
|
|
6
|
+
* not interacting with the touchscreen — the screen dims, then locks,
|
|
7
|
+
* and the session is interrupted.
|
|
8
|
+
*
|
|
9
|
+
* Implementation is `require`-based so the SDK keeps working in bare
|
|
10
|
+
* React Native setups where `expo-keep-awake` may not be installed —
|
|
11
|
+
* in that case both calls degrade to no-ops and the host is expected to
|
|
12
|
+
* manage the wake lock itself.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { log } from './log';
|
|
16
|
+
|
|
17
|
+
const TAG = 'velion-onboarding-sdk';
|
|
18
|
+
|
|
19
|
+
let activated = false;
|
|
20
|
+
|
|
21
|
+
interface ExpoKeepAwakeModule {
|
|
22
|
+
activateKeepAwakeAsync?: (tag?: string) => Promise<void>;
|
|
23
|
+
deactivateKeepAwake?: (tag?: string) => Promise<void> | void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function loadModule(): ExpoKeepAwakeModule | null {
|
|
27
|
+
try {
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
|
29
|
+
const mod = require('expo-keep-awake');
|
|
30
|
+
return (mod?.default ?? mod) as ExpoKeepAwakeModule;
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function activateScreenKeepAwake(): void {
|
|
37
|
+
if (activated) return;
|
|
38
|
+
const mod = loadModule();
|
|
39
|
+
if (!mod?.activateKeepAwakeAsync) {
|
|
40
|
+
log.info(
|
|
41
|
+
'[keep-awake] expo-keep-awake unavailable; host should manage the wake lock if screen-lock is unwanted during the flow',
|
|
42
|
+
);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
activated = true;
|
|
46
|
+
void mod.activateKeepAwakeAsync(TAG).catch((err: unknown) => {
|
|
47
|
+
activated = false;
|
|
48
|
+
log.warn('[keep-awake] activate failed', err);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function deactivateScreenKeepAwake(): void {
|
|
53
|
+
if (!activated) return;
|
|
54
|
+
const mod = loadModule();
|
|
55
|
+
activated = false;
|
|
56
|
+
if (!mod?.deactivateKeepAwake) return;
|
|
57
|
+
try {
|
|
58
|
+
void mod.deactivateKeepAwake(TAG);
|
|
59
|
+
} catch (err) {
|
|
60
|
+
log.warn('[keep-awake] deactivate failed', err);
|
|
61
|
+
}
|
|
62
|
+
}
|
package/src/utils/log.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Lightweight log gate.
|
|
3
|
+
*
|
|
4
|
+
* `log.info()` is silent unless either:
|
|
5
|
+
* - `__DEV__` is true (Metro bundler injects this in development), or
|
|
6
|
+
* - the host explicitly opted in via `VelionConfig.debug = true`.
|
|
7
|
+
*
|
|
8
|
+
* `log.warn()` / `log.error()` always go through. They sit on top of `console.*`
|
|
9
|
+
* so the host's logging pipeline (Sentry, Datadog, …) keeps capturing them.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
declare const __DEV__: boolean | undefined;
|
|
13
|
+
|
|
14
|
+
let runtimeDebugEnabled = false;
|
|
15
|
+
|
|
16
|
+
/** Enables verbose logging at runtime. Called from VelionOnboarding when `config.debug === true`. */
|
|
17
|
+
export function setDebugEnabled(enabled: boolean): void {
|
|
18
|
+
runtimeDebugEnabled = enabled;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Internal — true when `log.info` should produce output. */
|
|
22
|
+
function infoEnabled(): boolean {
|
|
23
|
+
return (typeof __DEV__ !== 'undefined' && __DEV__ === true) || runtimeDebugEnabled;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const log = {
|
|
27
|
+
info(...args: unknown[]): void {
|
|
28
|
+
if (!infoEnabled()) return;
|
|
29
|
+
console.info('[VelionSDK]', ...args);
|
|
30
|
+
},
|
|
31
|
+
warn(...args: unknown[]): void {
|
|
32
|
+
console.warn('[VelionSDK]', ...args);
|
|
33
|
+
},
|
|
34
|
+
error(...args: unknown[]): void {
|
|
35
|
+
console.error('[VelionSDK]', ...args);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reverse geocoding via the OS-native geocoder, bypassing Google's REST API
|
|
3
|
+
* entirely.
|
|
4
|
+
*
|
|
5
|
+
* Why this exists:
|
|
6
|
+
* - The Google Geocoding Web Service is HTTP REST. It does not honour
|
|
7
|
+
* iOS/Android application restrictions on the API key, so a key tightly
|
|
8
|
+
* locked to a bundle ID still fails with REQUEST_DENIED when called from
|
|
9
|
+
* fetch().
|
|
10
|
+
* - The OS geocoder (CLGeocoder on iOS / android.location.Geocoder on
|
|
11
|
+
* Android) needs no Google key and respects the platform conventions
|
|
12
|
+
* users expect. Coverage in urban LATAM is excellent; rural coverage on
|
|
13
|
+
* iOS uses Apple Maps (lower than Google in remote zones) but the
|
|
14
|
+
* downstream OCR step normally recovers the printed address either way.
|
|
15
|
+
* - Keeps the SDK to one Google Maps key whose only purpose is rendering
|
|
16
|
+
* the map via the native Maps SDK — that one IS protected by the iOS /
|
|
17
|
+
* Android app restriction.
|
|
18
|
+
*
|
|
19
|
+
* Returns the same `ParsedAddressFields` shape that the previous Google
|
|
20
|
+
* Geocoding caller produced, so downstream code (`AddressDetailsForm`,
|
|
21
|
+
* payload assembly) doesn't change.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import * as Location from 'expo-location';
|
|
25
|
+
import {
|
|
26
|
+
type ParsedAddressFields,
|
|
27
|
+
} from './parseGoogleAddressComponents';
|
|
28
|
+
import { log } from './log';
|
|
29
|
+
|
|
30
|
+
export interface ReverseGeocodeArgs {
|
|
31
|
+
latitude: number;
|
|
32
|
+
longitude: number;
|
|
33
|
+
/** `'es'` or `'en'` — passed through to the OS where supported. */
|
|
34
|
+
locale?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns parsed structured address fields, or `null` when the OS geocoder
|
|
39
|
+
* has no match.
|
|
40
|
+
*/
|
|
41
|
+
export async function reverseGeocode(
|
|
42
|
+
args: ReverseGeocodeArgs,
|
|
43
|
+
): Promise<(ParsedAddressFields & { latitude: number; longitude: number }) | null> {
|
|
44
|
+
let results: Location.LocationGeocodedAddress[];
|
|
45
|
+
try {
|
|
46
|
+
results = await Location.reverseGeocodeAsync({
|
|
47
|
+
latitude: args.latitude,
|
|
48
|
+
longitude: args.longitude,
|
|
49
|
+
});
|
|
50
|
+
} catch (err) {
|
|
51
|
+
log.warn('[os-geocoder] reverse failed', err);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
if (!results || results.length === 0) {
|
|
55
|
+
log.info('[os-geocoder] no results');
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const top = results[0]!;
|
|
59
|
+
const isoCc = top.isoCountryCode ?? '';
|
|
60
|
+
return {
|
|
61
|
+
country: isoCc.toUpperCase(),
|
|
62
|
+
state: top.region ?? '',
|
|
63
|
+
city: top.city ?? '',
|
|
64
|
+
// OS reports neighborhoods inconsistently across platforms; map `district`
|
|
65
|
+
// (Apple) / `subregion` (Android fallback) to our `district` field and
|
|
66
|
+
// leave `neighborhood` empty so the user can fill it manually.
|
|
67
|
+
district: top.district ?? top.subregion ?? '',
|
|
68
|
+
neighborhood: '',
|
|
69
|
+
street: top.street ?? '',
|
|
70
|
+
number: top.streetNumber ?? '',
|
|
71
|
+
zip_code: top.postalCode ?? '',
|
|
72
|
+
latitude: args.latitude,
|
|
73
|
+
longitude: args.longitude,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps Google Geocoder / Places `address_components` into
|
|
3
|
+
* `AddressInfoPayload` fields.
|
|
4
|
+
*
|
|
5
|
+
* The wire shape used here is whatever the Google Geocoding REST API
|
|
6
|
+
* returns: `{ long_name, short_name, types: string[] }`.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface GoogleAddressComponent {
|
|
10
|
+
long_name: string;
|
|
11
|
+
short_name: string;
|
|
12
|
+
types: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ParsedAddressFields {
|
|
16
|
+
country: string;
|
|
17
|
+
state: string;
|
|
18
|
+
city: string;
|
|
19
|
+
district?: string;
|
|
20
|
+
neighborhood?: string;
|
|
21
|
+
street: string;
|
|
22
|
+
number: string;
|
|
23
|
+
zip_code: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function pick(
|
|
27
|
+
components: GoogleAddressComponent[],
|
|
28
|
+
type: string,
|
|
29
|
+
useShort: boolean,
|
|
30
|
+
): string {
|
|
31
|
+
const c = components.find((x) => x.types.includes(type));
|
|
32
|
+
if (!c) return '';
|
|
33
|
+
return useShort ? c.short_name : c.long_name;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Parses `address_components` from a Geocoder result or Place result.
|
|
38
|
+
* Applies fallbacks so required API fields are usually non-empty when Google
|
|
39
|
+
* returns a result.
|
|
40
|
+
*/
|
|
41
|
+
export function parseGoogleAddressComponents(
|
|
42
|
+
components: GoogleAddressComponent[] | null | undefined,
|
|
43
|
+
formattedAddress: string | undefined,
|
|
44
|
+
lat: number,
|
|
45
|
+
lng: number,
|
|
46
|
+
): ParsedAddressFields & { latitude: number; longitude: number } {
|
|
47
|
+
const list = components ?? [];
|
|
48
|
+
const firstLine = formattedAddress?.split(',')[0]?.trim() ?? '';
|
|
49
|
+
|
|
50
|
+
const country = pick(list, 'country', true).toUpperCase();
|
|
51
|
+
const state =
|
|
52
|
+
pick(list, 'administrative_area_level_1', false) ||
|
|
53
|
+
pick(list, 'administrative_area_level_2', false);
|
|
54
|
+
const city =
|
|
55
|
+
pick(list, 'locality', false) ||
|
|
56
|
+
pick(list, 'administrative_area_level_2', false) ||
|
|
57
|
+
pick(list, 'administrative_area_level_3', false) ||
|
|
58
|
+
pick(list, 'sublocality_level_1', false);
|
|
59
|
+
const district =
|
|
60
|
+
pick(list, 'sublocality_level_1', false) ||
|
|
61
|
+
pick(list, 'sublocality', false) ||
|
|
62
|
+
pick(list, 'administrative_area_level_3', false) ||
|
|
63
|
+
undefined;
|
|
64
|
+
const neighborhood = pick(list, 'neighborhood', false) || undefined;
|
|
65
|
+
const route = pick(list, 'route', false);
|
|
66
|
+
const streetNumber = pick(list, 'street_number', false);
|
|
67
|
+
const postal = pick(list, 'postal_code', false);
|
|
68
|
+
|
|
69
|
+
let street = route;
|
|
70
|
+
if (!street && firstLine) street = firstLine;
|
|
71
|
+
if (!street) street = '—';
|
|
72
|
+
|
|
73
|
+
const number = streetNumber || 'S/N';
|
|
74
|
+
const zip_code = postal || '0000';
|
|
75
|
+
|
|
76
|
+
let cityOut = city;
|
|
77
|
+
if (!cityOut) cityOut = state || '—';
|
|
78
|
+
let stateOut = state;
|
|
79
|
+
if (!stateOut) stateOut = cityOut;
|
|
80
|
+
|
|
81
|
+
const out: ParsedAddressFields & { latitude: number; longitude: number } = {
|
|
82
|
+
country: country || 'XX',
|
|
83
|
+
state: stateOut,
|
|
84
|
+
city: cityOut,
|
|
85
|
+
street,
|
|
86
|
+
number,
|
|
87
|
+
zip_code,
|
|
88
|
+
latitude: lat,
|
|
89
|
+
longitude: lng,
|
|
90
|
+
};
|
|
91
|
+
if (district) out.district = district;
|
|
92
|
+
if (neighborhood) out.neighborhood = neighborhood;
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* True when the parsed address has enough required fields to send to the
|
|
98
|
+
* backend.
|
|
99
|
+
*/
|
|
100
|
+
export function isAddressSelectionComplete(
|
|
101
|
+
parsed: ParsedAddressFields,
|
|
102
|
+
required: {
|
|
103
|
+
state?: boolean | undefined;
|
|
104
|
+
city?: boolean | undefined;
|
|
105
|
+
street?: boolean | undefined;
|
|
106
|
+
number?: boolean | undefined;
|
|
107
|
+
postal?: boolean | undefined;
|
|
108
|
+
} = {},
|
|
109
|
+
): boolean {
|
|
110
|
+
const reqState = required.state !== false;
|
|
111
|
+
const reqCity = required.city !== false;
|
|
112
|
+
const reqStreet = required.street !== false;
|
|
113
|
+
const reqNumber = required.number !== false;
|
|
114
|
+
const reqPostal = required.postal !== false;
|
|
115
|
+
return (
|
|
116
|
+
parsed.country.length === 2 &&
|
|
117
|
+
(!reqState || parsed.state.length > 0) &&
|
|
118
|
+
(!reqCity || parsed.city.length > 0) &&
|
|
119
|
+
(!reqStreet || parsed.street.length > 0) &&
|
|
120
|
+
(!reqNumber || parsed.number.length > 0) &&
|
|
121
|
+
(!reqPostal || parsed.zip_code.length > 0)
|
|
122
|
+
);
|
|
123
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a single name field (given names or surnames) for API submission.
|
|
3
|
+
*
|
|
4
|
+
* - Trims leading/trailing whitespace
|
|
5
|
+
* - Applies Unicode NFC (composed form) for consistent encoding
|
|
6
|
+
* - Splits on any run of whitespace and rejoins with a single ASCII space,
|
|
7
|
+
* so multiple internal spaces or line breaks become one separator between words
|
|
8
|
+
*/
|
|
9
|
+
export function normalizePersonNameSegment(raw: string): string {
|
|
10
|
+
const trimmed = raw.trim();
|
|
11
|
+
if (trimmed.length === 0) {
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
const nfc = trimmed.normalize('NFC');
|
|
15
|
+
const words = nfc.split(/\s+/).filter((w) => w.length > 0);
|
|
16
|
+
return words.join(' ');
|
|
17
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Helpers to normalize thrown values into SdkError for consistent onError delivery.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SdkErrorCode, type SdkError } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns true if the value looks like an SdkError (has code and message).
|
|
9
|
+
*/
|
|
10
|
+
export function isSdkError(value: unknown): value is SdkError {
|
|
11
|
+
return (
|
|
12
|
+
value != null &&
|
|
13
|
+
typeof value === 'object' &&
|
|
14
|
+
'code' in value &&
|
|
15
|
+
typeof (value as SdkError).code === 'string' &&
|
|
16
|
+
'message' in value &&
|
|
17
|
+
typeof (value as SdkError).message === 'string'
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes any thrown value to an SdkError so it can be passed to rejectStep/onError.
|
|
23
|
+
* Use when catching in a flow that must always end with an event to the implementer.
|
|
24
|
+
*/
|
|
25
|
+
export function toSdkError(
|
|
26
|
+
err: unknown,
|
|
27
|
+
defaultCode: SdkErrorCode,
|
|
28
|
+
defaultMessage: string,
|
|
29
|
+
): SdkError {
|
|
30
|
+
if (isSdkError(err)) {
|
|
31
|
+
return err;
|
|
32
|
+
}
|
|
33
|
+
const message =
|
|
34
|
+
err instanceof Error ? err.message : typeof err === 'string' ? err : defaultMessage;
|
|
35
|
+
return {
|
|
36
|
+
code: defaultCode,
|
|
37
|
+
message: message || defaultMessage,
|
|
38
|
+
cause: err,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DocumentCaptureMode,
|
|
3
|
+
DocumentsOcrStepConfig,
|
|
4
|
+
HumanBasicInfoStepConfig,
|
|
5
|
+
TermsAndConditionsItem,
|
|
6
|
+
TermsAndConditionsStepConfig,
|
|
7
|
+
} from '../types';
|
|
8
|
+
|
|
9
|
+
export function resolveDocumentOptionsFromStepConfig(
|
|
10
|
+
cfg: HumanBasicInfoStepConfig | undefined,
|
|
11
|
+
): Array<{ value: string; label: string }> | undefined {
|
|
12
|
+
const rows = cfg?.accepted_country_documents;
|
|
13
|
+
if (!Array.isArray(rows)) return undefined;
|
|
14
|
+
const out: Array<{ value: string; label: string }> = [];
|
|
15
|
+
for (const country of rows) {
|
|
16
|
+
const docs = country?.document_types;
|
|
17
|
+
if (!Array.isArray(docs)) continue;
|
|
18
|
+
for (const d of docs) {
|
|
19
|
+
const id = d?.id;
|
|
20
|
+
if (!id || typeof id !== 'string') continue;
|
|
21
|
+
out.push({
|
|
22
|
+
value: id,
|
|
23
|
+
label: typeof d.display_value === 'string' && d.display_value.trim().length > 0
|
|
24
|
+
? d.display_value
|
|
25
|
+
: id,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return out.length > 0 ? dedupeByValue(out) : undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function resolveCaptureModeFromStepConfig(
|
|
33
|
+
cfg: DocumentsOcrStepConfig | undefined,
|
|
34
|
+
): DocumentCaptureMode | undefined {
|
|
35
|
+
const methods = cfg?.capture_methods;
|
|
36
|
+
if (!methods) return undefined;
|
|
37
|
+
const camera = methods.camera_scan !== false;
|
|
38
|
+
const upload = methods.upload !== false;
|
|
39
|
+
if (camera && upload) return 'both';
|
|
40
|
+
if (camera) return 'camera';
|
|
41
|
+
if (upload) return 'file';
|
|
42
|
+
return 'both';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function resolveTermsFromStepConfig(
|
|
46
|
+
cfg: TermsAndConditionsStepConfig | undefined,
|
|
47
|
+
): TermsAndConditionsItem[] | undefined {
|
|
48
|
+
const terms = cfg?.terms;
|
|
49
|
+
if (!Array.isArray(terms)) return undefined;
|
|
50
|
+
const parsed: TermsAndConditionsItem[] = [];
|
|
51
|
+
for (const [index, term] of terms.entries()) {
|
|
52
|
+
const title = typeof term?.title === 'string' ? term.title.trim() : '';
|
|
53
|
+
const url = typeof term?.url === 'string' ? term.url.trim() : '';
|
|
54
|
+
if (!title && !url) continue;
|
|
55
|
+
parsed.push({
|
|
56
|
+
id: `term-${index + 1}`,
|
|
57
|
+
description: title || url,
|
|
58
|
+
...(url && { link: url }),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return parsed.length > 0 ? parsed : undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function dedupeByValue(
|
|
65
|
+
options: Array<{ value: string; label: string }>,
|
|
66
|
+
): Array<{ value: string; label: string }> {
|
|
67
|
+
const seen = new Set<string>();
|
|
68
|
+
const out: Array<{ value: string; label: string }> = [];
|
|
69
|
+
for (const opt of options) {
|
|
70
|
+
if (seen.has(opt.value)) continue;
|
|
71
|
+
seen.add(opt.value);
|
|
72
|
+
out.push(opt);
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TaxInfoConfig } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes selectable lists for TAX_INFO. Options come only from the backend
|
|
5
|
+
* `current_step.config.accepted_tax_information` (see TaxInfoModule); there are no SDK defaults.
|
|
6
|
+
*/
|
|
7
|
+
export function resolveTaxInfoConfig(config: Partial<TaxInfoConfig> | undefined): TaxInfoConfig {
|
|
8
|
+
const categories = config?.taxpayerCategories;
|
|
9
|
+
const fiscal = config?.fiscalIdentifierTypes;
|
|
10
|
+
return {
|
|
11
|
+
taxpayerCategories: Array.isArray(categories) ? categories : [],
|
|
12
|
+
fiscalIdentifierTypes: Array.isArray(fiscal) ? fiscal : [],
|
|
13
|
+
};
|
|
14
|
+
}
|