@velion-la/onboarding-sdk-react-native 1.4.0-beta.7 → 1.4.0-beta.9
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 +56 -0
- package/README.md +82 -1
- package/lib/commonjs/core/VelionOnboarding.js +156 -46
- package/lib/commonjs/core/VelionOnboarding.js.map +1 -1
- package/lib/commonjs/core/routingCommands.js +33 -0
- package/lib/commonjs/core/routingCommands.js.map +1 -1
- package/lib/commonjs/core/sessionStateMapper.js +48 -36
- package/lib/commonjs/core/sessionStateMapper.js.map +1 -1
- package/lib/commonjs/i18n/strings/en.js +27 -0
- package/lib/commonjs/i18n/strings/en.js.map +1 -1
- package/lib/commonjs/i18n/strings/es.js +27 -0
- package/lib/commonjs/i18n/strings/es.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/steps/CustomFormStep.js +348 -0
- package/lib/commonjs/steps/CustomFormStep.js.map +1 -0
- package/lib/commonjs/steps/EntityTypeSelectionStep.js +194 -0
- package/lib/commonjs/steps/EntityTypeSelectionStep.js.map +1 -0
- package/lib/commonjs/steps/customForm.js +251 -0
- package/lib/commonjs/steps/customForm.js.map +1 -0
- package/lib/commonjs/steps/entityType.js +30 -0
- package/lib/commonjs/steps/entityType.js.map +1 -0
- package/lib/commonjs/steps/submissionOutcome.js +101 -0
- package/lib/commonjs/steps/submissionOutcome.js.map +1 -0
- package/lib/commonjs/steps/unsupportedStep.js +33 -0
- package/lib/commonjs/steps/unsupportedStep.js.map +1 -0
- package/lib/commonjs/transport/api.js +9 -0
- package/lib/commonjs/transport/api.js.map +1 -1
- package/lib/commonjs/types/index.js +60 -4
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/ui/VelionOnboardingScreen.js +20 -3
- package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -1
- package/lib/commonjs/ui/primitives/RadioCard.js +120 -0
- package/lib/commonjs/ui/primitives/RadioCard.js.map +1 -0
- package/lib/commonjs/ui/primitives/Select.js +60 -7
- package/lib/commonjs/ui/primitives/Select.js.map +1 -1
- package/lib/commonjs/ui/primitives/index.js +7 -0
- package/lib/commonjs/ui/primitives/index.js.map +1 -1
- package/lib/commonjs/utils/sdkVersion.js +1 -1
- package/lib/module/core/VelionOnboarding.js +158 -48
- package/lib/module/core/VelionOnboarding.js.map +1 -1
- package/lib/module/core/routingCommands.js +33 -0
- package/lib/module/core/routingCommands.js.map +1 -1
- package/lib/module/core/sessionStateMapper.js +47 -36
- package/lib/module/core/sessionStateMapper.js.map +1 -1
- package/lib/module/i18n/strings/en.js +27 -0
- package/lib/module/i18n/strings/en.js.map +1 -1
- package/lib/module/i18n/strings/es.js +27 -0
- package/lib/module/i18n/strings/es.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/steps/CustomFormStep.js +345 -0
- package/lib/module/steps/CustomFormStep.js.map +1 -0
- package/lib/module/steps/EntityTypeSelectionStep.js +189 -0
- package/lib/module/steps/EntityTypeSelectionStep.js.map +1 -0
- package/lib/module/steps/customForm.js +237 -0
- package/lib/module/steps/customForm.js.map +1 -0
- package/lib/module/steps/entityType.js +24 -0
- package/lib/module/steps/entityType.js.map +1 -0
- package/lib/module/steps/submissionOutcome.js +94 -0
- package/lib/module/steps/submissionOutcome.js.map +1 -0
- package/lib/module/steps/unsupportedStep.js +30 -0
- package/lib/module/steps/unsupportedStep.js.map +1 -0
- package/lib/module/transport/api.js +9 -0
- package/lib/module/transport/api.js.map +1 -1
- package/lib/module/types/index.js +68 -3
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/ui/VelionOnboardingScreen.js +21 -4
- package/lib/module/ui/VelionOnboardingScreen.js.map +1 -1
- package/lib/module/ui/primitives/RadioCard.js +116 -0
- package/lib/module/ui/primitives/RadioCard.js.map +1 -0
- package/lib/module/ui/primitives/Select.js +62 -9
- package/lib/module/ui/primitives/Select.js.map +1 -1
- package/lib/module/ui/primitives/index.js +1 -0
- package/lib/module/ui/primitives/index.js.map +1 -1
- package/lib/module/utils/sdkVersion.js +1 -1
- package/lib/typescript/core/VelionOnboarding.d.ts +42 -5
- package/lib/typescript/core/VelionOnboarding.d.ts.map +1 -1
- package/lib/typescript/core/routingCommands.d.ts +23 -0
- package/lib/typescript/core/routingCommands.d.ts.map +1 -1
- package/lib/typescript/core/sessionStateMapper.d.ts +13 -5
- package/lib/typescript/core/sessionStateMapper.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/en.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/es.d.ts +27 -0
- package/lib/typescript/i18n/strings/es.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/steps/CustomFormStep.d.ts +28 -0
- package/lib/typescript/steps/CustomFormStep.d.ts.map +1 -0
- package/lib/typescript/steps/EntityTypeSelectionStep.d.ts +24 -0
- package/lib/typescript/steps/EntityTypeSelectionStep.d.ts.map +1 -0
- package/lib/typescript/steps/customForm.d.ts +99 -0
- package/lib/typescript/steps/customForm.d.ts.map +1 -0
- package/lib/typescript/steps/entityType.d.ts +15 -0
- package/lib/typescript/steps/entityType.d.ts.map +1 -0
- package/lib/typescript/steps/submissionOutcome.d.ts +43 -0
- package/lib/typescript/steps/submissionOutcome.d.ts.map +1 -0
- package/lib/typescript/steps/types.d.ts +5 -0
- package/lib/typescript/steps/types.d.ts.map +1 -1
- package/lib/typescript/steps/unsupportedStep.d.ts +15 -0
- package/lib/typescript/steps/unsupportedStep.d.ts.map +1 -0
- package/lib/typescript/transport/api.d.ts +1 -0
- package/lib/typescript/transport/api.d.ts.map +1 -1
- package/lib/typescript/types/index.d.ts +139 -14
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/ui/VelionOnboardingScreen.d.ts +21 -2
- package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -1
- package/lib/typescript/ui/primitives/RadioCard.d.ts +22 -0
- package/lib/typescript/ui/primitives/RadioCard.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/Select.d.ts +9 -3
- package/lib/typescript/ui/primitives/Select.d.ts.map +1 -1
- package/lib/typescript/ui/primitives/index.d.ts +1 -0
- package/lib/typescript/ui/primitives/index.d.ts.map +1 -1
- package/lib/typescript/utils/sdkVersion.d.ts +1 -1
- package/package.json +1 -1
- package/src/core/VelionOnboarding.ts +168 -55
- package/src/core/routingCommands.ts +42 -0
- package/src/core/sessionStateMapper.ts +63 -52
- package/src/i18n/strings/en.ts +28 -0
- package/src/i18n/strings/es.ts +28 -0
- package/src/index.ts +10 -0
- package/src/steps/CustomFormStep.tsx +400 -0
- package/src/steps/EntityTypeSelectionStep.tsx +207 -0
- package/src/steps/customForm.ts +302 -0
- package/src/steps/entityType.ts +25 -0
- package/src/steps/submissionOutcome.ts +93 -0
- package/src/steps/types.ts +5 -0
- package/src/steps/unsupportedStep.ts +32 -0
- package/src/transport/api.ts +16 -1
- package/src/types/index.ts +151 -17
- package/src/ui/VelionOnboardingScreen.tsx +38 -1
- package/src/ui/primitives/RadioCard.tsx +127 -0
- package/src/ui/primitives/Select.tsx +73 -7
- package/src/ui/primitives/index.ts +1 -0
- package/src/utils/sdkVersion.ts +1 -1
|
@@ -107,6 +107,33 @@ export declare const ES: {
|
|
|
107
107
|
empty: string;
|
|
108
108
|
required: string;
|
|
109
109
|
};
|
|
110
|
+
custom_form: {
|
|
111
|
+
defaultTitle: string;
|
|
112
|
+
selectPlaceholder: string;
|
|
113
|
+
searchPlaceholder: string;
|
|
114
|
+
empty: string;
|
|
115
|
+
yes: string;
|
|
116
|
+
no: string;
|
|
117
|
+
required: string;
|
|
118
|
+
textTooLong: string;
|
|
119
|
+
invalidNumber: string;
|
|
120
|
+
invalidBoolean: string;
|
|
121
|
+
invalidDate: string;
|
|
122
|
+
invalidOption: string;
|
|
123
|
+
};
|
|
124
|
+
entity_type: {
|
|
125
|
+
title: string;
|
|
126
|
+
subtitle: string;
|
|
127
|
+
human: string;
|
|
128
|
+
humanDescription: string;
|
|
129
|
+
legal: string;
|
|
130
|
+
legalDescription: string;
|
|
131
|
+
required: string;
|
|
132
|
+
};
|
|
133
|
+
unsupported_step: {
|
|
134
|
+
title: string;
|
|
135
|
+
message: string;
|
|
136
|
+
};
|
|
110
137
|
terms_and_conditions: {
|
|
111
138
|
title: string;
|
|
112
139
|
subtitle: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/es.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/es.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoXd,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC"}
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
export { VelionOnboarding } from './core/VelionOnboarding';
|
|
15
15
|
export type { VelionConfig, OrchestratorView, } from './core/VelionOnboarding';
|
|
16
16
|
export { VelionOnboardingScreen, } from './ui/VelionOnboardingScreen';
|
|
17
|
-
export type { VelionOnboardingScreenProps, } from './ui/VelionOnboardingScreen';
|
|
17
|
+
export type { VelionOnboardingScreenProps, VelionOnboardingScreenHandle, } from './ui/VelionOnboardingScreen';
|
|
18
18
|
export { ThemeProvider, useTheme, useReducedMotion, LIGHT_TOKENS, DARK_TOKENS, resolveTheme, mixHex, withAlpha, VELION_FONT_IDS, type ResolvedTheme, type ThemeTokenSet, type VelionFontId, } from './ui/theme';
|
|
19
19
|
export { Button, Input, Select, Card, Banner, Spinner, Checkbox, DatePicker, CountrySelect, SearchableSingleSelectList, filterSearchableOptions, type ButtonProps, type ButtonVariant, type InputProps, type SelectOption, type SelectProps, type CardProps, type BannerProps, type SpinnerProps, type CheckboxProps, type DatePickerProps, type CountrySelectProps, type SearchableSingleSelectListProps, type SearchableListOption, } from './ui/primitives';
|
|
20
20
|
export { LoadingOverlay, RetryDialog, ProgressBar, PROGRESS_BAR, } from './ui/overlays';
|
|
21
21
|
export { useInlineValidation, required, minLength, pattern, compose, type FieldRule, type InlineValidationHandle, type FieldValidator, } from './ui/forms';
|
|
22
22
|
export { getStrings, resolveLocale, type SupportedLocale } from './i18n';
|
|
23
|
-
export { SdkErrorCode, CameraErrorCode, } from './types';
|
|
24
|
-
export type { OnboardingStep, OnboardingStepStatus, OnboardingType, OnboardingResult, OnboardingExit, OnboardingSessionEvent, OnboardingDtoResponse, SessionState, SdkError, SdkStatus, VelionTheme, VelionFinalResultScreenTexts, VelionFinalResultStatusCopy, VelionSessionDeclinedReasonTexts, VelionSessionDeclinedReasonMessages, VelionRetryStepTexts, VelionCallbacks, HumanBasicInfoStepConfig, HumanExtendedInfoStepConfig, TaxInfoStepConfig, AddressInfoStepConfig, SwornDeclarationStepConfig, EconomicActivityStepConfig, EconomicActivityItem, DocumentsOcrStepConfig, TermsAndConditionsStepConfig, HumanBasicInfoPayload, LegalBasicInfoPayload, HumanExtendedInfoPayload, LegalExtendedInfoPayload, AddressInfoPayload, SwornDeclarationPayload, EconomicActivitySelectionPayload, EmailContactPayload, PhoneContactPayload, TaxInfoPayload, TaxInfoConfig, TaxInfoOption, TermsAndConditionsItem, TermsAndConditionsAcceptancePayload, TermsAndConditionsSubmitPayload, SessionCreationResponse, LivenessSessionResponse, } from './types';
|
|
23
|
+
export { SdkErrorCode, CameraErrorCode, CancelSessionErrorCode, } from './types';
|
|
24
|
+
export type { OnboardingStep, OnboardingStepStatus, OnboardingType, EntityType, OnboardingResult, OnboardingExit, OnboardingSessionEvent, OnboardingDtoResponse, SessionState, SdkError, CancelSessionError, SdkStatus, VelionTheme, VelionFinalResultScreenTexts, VelionFinalResultStatusCopy, VelionSessionDeclinedReasonTexts, VelionSessionDeclinedReasonMessages, VelionRetryStepTexts, VelionCallbacks, HumanBasicInfoStepConfig, HumanExtendedInfoStepConfig, TaxInfoStepConfig, AddressInfoStepConfig, SwornDeclarationStepConfig, EconomicActivityStepConfig, EconomicActivityItem, DocumentsOcrStepConfig, TermsAndConditionsStepConfig, CustomFormStepConfig, CustomFormField, CustomFormFieldType, HumanBasicInfoPayload, LegalBasicInfoPayload, HumanExtendedInfoPayload, LegalExtendedInfoPayload, AddressInfoPayload, SwornDeclarationPayload, EconomicActivitySelectionPayload, CustomFormSubmitPayload, CustomFormResponseValue, EntityTypeSelectionPayload, EmailContactPayload, PhoneContactPayload, TaxInfoPayload, TaxInfoConfig, TaxInfoOption, TermsAndConditionsItem, TermsAndConditionsAcceptancePayload, TermsAndConditionsSubmitPayload, SessionCreationResponse, LivenessSessionResponse, } from './types';
|
|
25
25
|
export { SDK_VERSION } from './utils/sdkVersion';
|
|
26
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EACV,YAAY,EACZ,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EACV,YAAY,EACZ,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,EACN,SAAS,EACT,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC;AAIpB,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,UAAU,EACV,aAAa,EACb,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,OAAO,EACP,OAAO,EACP,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC3B,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AAIzE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,sBAAsB,GACvB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,4BAA4B,EAC5B,2BAA2B,EAC3B,gCAAgC,EAChC,mCAAmC,EACnC,oBAAoB,EACpB,eAAe,EAEf,wBAAwB,EACxB,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EAEnB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,mCAAmC,EACnC,+BAA+B,EAE/B,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CUSTOM_FORM — POST /sessions/:id/custom-form/:stepKey { responses }.
|
|
3
|
+
*
|
|
4
|
+
* A form the workflow defines field by field (`config.form_fields`), with an
|
|
5
|
+
* optional `title` / `subtitle`. A workflow may hold several, so the step
|
|
6
|
+
* submits to its own `step_key`, never to the code. Field types and rules are
|
|
7
|
+
* in `customForm.ts` (spike VON-131 §3.2): TEXT → `Input`, NUMBER → decimal
|
|
8
|
+
* `Input`, BOOLEAN → Yes / No cards, DATE → `DatePicker`, LIST → `Select`
|
|
9
|
+
* (searchable above eight options).
|
|
10
|
+
*
|
|
11
|
+
* The POST answers 202 and the next step arrives over SSE. A 400 names the
|
|
12
|
+
* refused answers (`errors["responses.<field_key>"]`), shown next to each
|
|
13
|
+
* field and cleared when that field is edited; the other failures follow
|
|
14
|
+
* `submissionOutcome.ts`. A required field of
|
|
15
|
+
* a type this SDK does not know fails the step with `UNSUPPORTED_STEP` before
|
|
16
|
+
* anything renders. Prefill: `result.responses` (reverse navigation).
|
|
17
|
+
*/
|
|
18
|
+
import type { StepDeps, StepModule } from './types';
|
|
19
|
+
export declare class CustomFormStep implements StepModule {
|
|
20
|
+
private readonly deps;
|
|
21
|
+
private resolveStep;
|
|
22
|
+
private rejectStep;
|
|
23
|
+
private destroyed;
|
|
24
|
+
constructor(deps: StepDeps);
|
|
25
|
+
run(): Promise<void>;
|
|
26
|
+
destroy(): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=CustomFormStep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomFormStep.d.ts","sourceRoot":"","sources":["../../../src/steps/CustomFormStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAuBH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAmBpD,qBAAa,cAAe,YAAW,UAAU;IAKnC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAwCpB,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENTITY_TYPE_SELECTION — POST /sessions/:id/entity-type { selected_type }.
|
|
3
|
+
*
|
|
4
|
+
* The person chooses whether they complete the onboarding as a natural person
|
|
5
|
+
* (`HUMAN`) or on behalf of a legal entity (`LEGAL`); the backend routes to the
|
|
6
|
+
* matching branch of the workflow. The step has no UI config in v1: two fixed
|
|
7
|
+
* options with the SDK's own copy (`entity_type` in the strings table).
|
|
8
|
+
*
|
|
9
|
+
* The POST answers 202 and the first step of the chosen branch arrives over
|
|
10
|
+
* SSE. A 400 `errors.selected_type` is shown in the banner; the other failures
|
|
11
|
+
* follow `submissionOutcome.ts`. Prefill: `result.selected_type` (reverse
|
|
12
|
+
* navigation), so going back shows the previous choice selected.
|
|
13
|
+
*/
|
|
14
|
+
import type { StepDeps, StepModule } from './types';
|
|
15
|
+
export declare class EntityTypeSelectionStep implements StepModule {
|
|
16
|
+
private readonly deps;
|
|
17
|
+
private resolveStep;
|
|
18
|
+
private rejectStep;
|
|
19
|
+
private destroyed;
|
|
20
|
+
constructor(deps: StepDeps);
|
|
21
|
+
run(): Promise<void>;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=EntityTypeSelectionStep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityTypeSelectionStep.d.ts","sourceRoot":"","sources":["../../../src/steps/EntityTypeSelectionStep.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAoBH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKpD,qBAAa,uBAAwB,YAAW,UAAU;IAK5C,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,QAAQ;IAE3C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BpB,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Pure logic of the `CUSTOM_FORM` step: reading `form_fields`,
|
|
3
|
+
* the per-type validation and the `responses` payload (spike VON-131 §3.2).
|
|
4
|
+
*
|
|
5
|
+
* JSX-free so the rules run under Jest in the `node` environment. The server
|
|
6
|
+
* validates the same rules and is the authority; the SDK checks them only to
|
|
7
|
+
* answer before the round trip.
|
|
8
|
+
*
|
|
9
|
+
* | type | value sent | required means |
|
|
10
|
+
* |-----------|-----------------------------|---------------------------|
|
|
11
|
+
* | `TEXT` | string, trimmed, ≤ 255 | not empty after the trim |
|
|
12
|
+
* | `NUMBER` | JSON number (`,` or `.`) | present and finite |
|
|
13
|
+
* | `BOOLEAN` | `true` / `false` (Yes / No) | answered |
|
|
14
|
+
* | `DATE` | `"yyyy-MM-dd"`, a real date | a valid date |
|
|
15
|
+
* | `LIST` | one string of `options` | one of `options` |
|
|
16
|
+
*
|
|
17
|
+
* An optional field left unanswered is omitted from `responses`, never `null`.
|
|
18
|
+
*/
|
|
19
|
+
import type { CustomFormFieldType, CustomFormResponseValue } from '../types';
|
|
20
|
+
import type { StringsTable } from '../i18n';
|
|
21
|
+
/** Longest `TEXT` answer the backend accepts, after trimming. */
|
|
22
|
+
export declare const MAX_TEXT_LENGTH = 255;
|
|
23
|
+
/** `LIST` fields with more options than this render a searchable picker. */
|
|
24
|
+
export declare const SEARCHABLE_LIST_THRESHOLD = 8;
|
|
25
|
+
/** A `form_fields` entry, normalized. */
|
|
26
|
+
export interface CustomFormFieldDef {
|
|
27
|
+
fieldKey: string;
|
|
28
|
+
name: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Rendered type; an unknown optional type is already downgraded to `TEXT`. */
|
|
31
|
+
type: CustomFormFieldType;
|
|
32
|
+
required: boolean;
|
|
33
|
+
/** Choices of a `LIST` field; empty for the other types. */
|
|
34
|
+
options: string[];
|
|
35
|
+
}
|
|
36
|
+
/** The step config, normalized. */
|
|
37
|
+
export interface ParsedCustomForm {
|
|
38
|
+
title?: string;
|
|
39
|
+
subtitle?: string;
|
|
40
|
+
fields: CustomFormFieldDef[];
|
|
41
|
+
/** Required fields whose type this SDK does not know: the step cannot be answered. */
|
|
42
|
+
unsupportedFields: Array<{
|
|
43
|
+
fieldKey: string;
|
|
44
|
+
type: string;
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* What the form holds for one field while the person edits it: the text typed
|
|
49
|
+
* for `TEXT` / `NUMBER`, the choice for `BOOLEAN`, the ISO date for `DATE` and
|
|
50
|
+
* the option for `LIST` (`null` while unanswered).
|
|
51
|
+
*/
|
|
52
|
+
export type FieldDraft = string | boolean | null;
|
|
53
|
+
/** Validation copy, from `StringsTable.custom_form`. */
|
|
54
|
+
export type CustomFormMessages = Pick<StringsTable['custom_form'], 'required' | 'textTooLong' | 'invalidNumber' | 'invalidBoolean' | 'invalidDate' | 'invalidOption'>;
|
|
55
|
+
/**
|
|
56
|
+
* Reads `title`, `subtitle` and `form_fields` from the step config. Entries
|
|
57
|
+
* without a `field_key` are dropped. A field whose `type` is unknown is shown
|
|
58
|
+
* as `TEXT` when optional and reported in `unsupportedFields` when required.
|
|
59
|
+
*/
|
|
60
|
+
export declare function parseCustomFormConfig(config: Record<string, unknown> | undefined): ParsedCustomForm;
|
|
61
|
+
/** True for a `yyyy-MM-dd` string naming a real calendar date. */
|
|
62
|
+
export declare function isRealIsoDate(value: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Parses what the person typed in a `NUMBER` field. Either a comma or a dot is
|
|
65
|
+
* the decimal separator; thousands separators are not accepted. Returns `null`
|
|
66
|
+
* for blank or invalid text.
|
|
67
|
+
*/
|
|
68
|
+
export declare function parseNumberInput(text: string): number | null;
|
|
69
|
+
/** The empty draft of a field. */
|
|
70
|
+
export declare function emptyDraft(field: CustomFormFieldDef): FieldDraft;
|
|
71
|
+
/**
|
|
72
|
+
* Draft seeded from a previous answer (`result.responses` on reverse
|
|
73
|
+
* navigation). An answer that no longer fits the field is ignored.
|
|
74
|
+
*/
|
|
75
|
+
export declare function draftFromAnswer(field: CustomFormFieldDef, answer: unknown): FieldDraft;
|
|
76
|
+
/**
|
|
77
|
+
* Initial drafts of every field. `stepResult` is the step's previous `result`
|
|
78
|
+
* (`{ responses: { <field_key>: value } }`), present after reverse navigation.
|
|
79
|
+
*/
|
|
80
|
+
export declare function initialDrafts(fields: ReadonlyArray<CustomFormFieldDef>, stepResult: Record<string, unknown> | undefined): Record<string, FieldDraft>;
|
|
81
|
+
/** Validates one field. Returns the message to show, or `null` when valid. */
|
|
82
|
+
export declare function validateField(field: CustomFormFieldDef, draft: FieldDraft, messages: CustomFormMessages): string | null;
|
|
83
|
+
/** Validates every field; the result maps `field_key` to its message (empty when valid). */
|
|
84
|
+
export declare function validateForm(fields: ReadonlyArray<CustomFormFieldDef>, drafts: Readonly<Record<string, FieldDraft>>, messages: CustomFormMessages): Record<string, string>;
|
|
85
|
+
/**
|
|
86
|
+
* Builds the `responses` body from valid drafts: trimmed text, numbers as JSON
|
|
87
|
+
* numbers, and unanswered optional fields left out.
|
|
88
|
+
*/
|
|
89
|
+
export declare function buildResponses(fields: ReadonlyArray<CustomFormFieldDef>, drafts: Readonly<Record<string, FieldDraft>>): Record<string, CustomFormResponseValue>;
|
|
90
|
+
/**
|
|
91
|
+
* Splits the backend's per-field messages of a `CUSTOM_FORM` 400 into those of
|
|
92
|
+
* fields on screen (by `field_key`) and the rest (e.g. an unknown key), which
|
|
93
|
+
* the form shows in its banner.
|
|
94
|
+
*/
|
|
95
|
+
export declare function splitCustomFormErrors(fields: ReadonlyArray<CustomFormFieldDef>, errors: Readonly<Record<string, string>>): {
|
|
96
|
+
byField: Record<string, string>;
|
|
97
|
+
other: string[];
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=customForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customForm.d.ts","sourceRoot":"","sources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AAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACvC;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAYtD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Pure logic of the `ENTITY_TYPE_SELECTION` step. JSX-free so it
|
|
3
|
+
* runs under Jest in the `node` environment.
|
|
4
|
+
*/
|
|
5
|
+
import type { EntityType } from '../types';
|
|
6
|
+
/** The two choices, in the order the step shows them. */
|
|
7
|
+
export declare const ENTITY_TYPES: ReadonlyArray<EntityType>;
|
|
8
|
+
/** Narrows an unknown value to an {@link EntityType}. */
|
|
9
|
+
export declare function isEntityType(value: unknown): value is EntityType;
|
|
10
|
+
/**
|
|
11
|
+
* The previous choice from the step's `result` (`{ selected_type }`, present on
|
|
12
|
+
* reverse navigation), or `null` when there is none.
|
|
13
|
+
*/
|
|
14
|
+
export declare function prefillEntityType(stepResult: Record<string, unknown> | undefined): EntityType | null;
|
|
15
|
+
//# sourceMappingURL=entityType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entityType.d.ts","sourceRoot":"","sources":["../../../src/steps/entityType.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,yDAAyD;AACzD,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,UAAU,CAAsB,CAAC;AAE1E,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC9C,UAAU,GAAG,IAAI,CAGnB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview How a step reads a failed submit of `CUSTOM_FORM` or
|
|
3
|
+
* `ENTITY_TYPE_SELECTION` (VON-148 contract).
|
|
4
|
+
*
|
|
5
|
+
* | Response | Outcome | What the step does |
|
|
6
|
+
* |-----------------------------------------|------------|--------------------------------------------|
|
|
7
|
+
* | 400 `VAL-4000` with `errors` | `invalid` | shows each message next to its field |
|
|
8
|
+
* | 409 `VOB-40908` (not the current step) | `stale` | ends the step; the orchestrator re-routes |
|
|
9
|
+
* | request aborted by the flow | `aborted` | nothing: the flow already ended |
|
|
10
|
+
* | anything else | `failed` | banner + retry dialog, like the other steps|
|
|
11
|
+
*
|
|
12
|
+
* A `stale` submit cannot succeed by retrying: the session moved on (e.g. the
|
|
13
|
+
* same answer was already accepted). Ending the step hands control to the
|
|
14
|
+
* orchestrator's routing wait, whose fallback GET reads where the session
|
|
15
|
+
* really is, instead of a retry dialog that would loop on the same error. Same
|
|
16
|
+
* rule as the web SDK (OSDKW-41).
|
|
17
|
+
*
|
|
18
|
+
* JSX-free so it runs under Jest in the `node` environment.
|
|
19
|
+
*/
|
|
20
|
+
/** Backend code: the step submitted is not the session's current step (409). */
|
|
21
|
+
export declare const STEP_NOT_CURRENT_CODE = "VOB-40908";
|
|
22
|
+
export type SubmissionOutcome = {
|
|
23
|
+
kind: 'invalid';
|
|
24
|
+
errors: Record<string, string>;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'stale';
|
|
27
|
+
code: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'aborted';
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'failed';
|
|
32
|
+
};
|
|
33
|
+
/** The backend error code (`VAL-4000`, `VOB-40908`, …) of a failed request, when it sent one. */
|
|
34
|
+
export declare function backendErrorCode(err: unknown): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Per-field messages of a 400: the `errors` object of the problem body, keyed
|
|
37
|
+
* by request path (`responses.<field_key>`, `selected_type`). Also reads the
|
|
38
|
+
* list form `[{ field, message }]`. Empty when the error carries none.
|
|
39
|
+
*/
|
|
40
|
+
export declare function backendFieldErrors(err: unknown): Record<string, string>;
|
|
41
|
+
/** Classifies a failed submit; see the table at the top of the file. */
|
|
42
|
+
export declare function classifySubmissionError(err: unknown): SubmissionOutcome;
|
|
43
|
+
//# sourceMappingURL=submissionOutcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submissionOutcome.d.ts","sourceRoot":"","sources":["../../../src/steps/submissionOutcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAEjD,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAcvB,iGAAiG;AACjG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGjE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiBvE;AAUD,wEAAwE;AACxE,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,iBAAiB,CAYvE"}
|
|
@@ -37,6 +37,11 @@ export interface StepDeps {
|
|
|
37
37
|
colorMode: 'light' | 'dark';
|
|
38
38
|
ui: StepUiHandle;
|
|
39
39
|
step: OnboardingStep;
|
|
40
|
+
/**
|
|
41
|
+
* Instance key of the step (`step_key`, or the code when the backend sends
|
|
42
|
+
* none). `CUSTOM_FORM` submits to it; every other step can ignore it.
|
|
43
|
+
*/
|
|
44
|
+
stepKey: string;
|
|
40
45
|
stepConfig?: Record<string, unknown>;
|
|
41
46
|
/**
|
|
42
47
|
* Previously-captured data for this step, used as form prefill when the step
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/steps/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;CACvC;AAED,yDAAyD;AACzD,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,SAAS,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,EAAE,EAAE,YAAY,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,M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AAC,CAAC;IACrC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kFAAkF;IAClF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uFAAuF;IACvF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qFAAqF;IACrF,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC3D;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The `UNSUPPORTED_STEP` error, shared by the orchestrator (a
|
|
3
|
+
* step code this SDK does not know) and `CUSTOM_FORM` (a required field of a
|
|
4
|
+
* type it does not know).
|
|
5
|
+
*
|
|
6
|
+
* JSX-free so the orchestrator tests can import it in the `node` environment.
|
|
7
|
+
*/
|
|
8
|
+
import { type SdkError } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Builds the error that ends the flow on a step this SDK cannot render. The
|
|
11
|
+
* localized `declineTitle` / `declineMessage` feed the built-in error screen;
|
|
12
|
+
* `message` is the English text for the host's logs.
|
|
13
|
+
*/
|
|
14
|
+
export declare function unsupportedStepError(locale: string | undefined, stepCode: string, stepKey: string, message: string): SdkError;
|
|
15
|
+
//# sourceMappingURL=unsupportedStep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsupportedStep.d.ts","sourceRoot":"","sources":["../../../src/steps/unsupportedStep.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGvD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,QAAQ,CAUV"}
|
|
@@ -36,6 +36,7 @@ export interface ApiCallOptions {
|
|
|
36
36
|
export declare function createApiCaller(rawBaseUrl: string, sessionToken: string, expiresAt?: string, hooks?: ApiCallerHooks): {
|
|
37
37
|
readonly get: <TResponse>(endpoint: string, options?: ApiCallOptions) => Promise<TResponse>;
|
|
38
38
|
readonly post: <TResponse>(endpoint: string, body: unknown, options?: ApiCallOptions) => Promise<TResponse>;
|
|
39
|
+
readonly postEmpty: <TResponse>(endpoint: string, options?: ApiCallOptions) => Promise<TResponse>;
|
|
39
40
|
readonly postFormData: <TResponse>(endpoint: string, formData: FormData, options?: ApiCallOptions) => Promise<TResponse>;
|
|
40
41
|
readonly setSessionToken: (token: string, expiresAtIso?: string) => void;
|
|
41
42
|
readonly close: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/transport/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAgCH,mDAAmD;AACnD,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC3D;AA2BD,MAAM,WAAW,cAAc;IAC7B,mDAAmD;IACnD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC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"}
|
|
@@ -20,17 +20,27 @@
|
|
|
20
20
|
* - `ECONOMIC_ACTIVITY_DECLARATION`: pick exactly one economic activity from a searchable list.
|
|
21
21
|
* - `TERMS_AND_CONDITIONS`: accept configured T&C items.
|
|
22
22
|
* - `FACE_MATCH`: server-side face comparison after liveness (no user input; SDK waits).
|
|
23
|
+
* - `CUSTOM_FORM`: form built from the workflow's `form_fields`. A workflow may hold
|
|
24
|
+
* several, told apart by their `step_key`.
|
|
25
|
+
* - `ENTITY_TYPE_SELECTION`: the person picks HUMAN or LEGAL; the backend branches on it.
|
|
26
|
+
*
|
|
27
|
+
* A code outside this list fails the flow with {@link SdkErrorCode.UNSUPPORTED_STEP}.
|
|
23
28
|
*/
|
|
24
|
-
export type OnboardingStep = 'DEVICE_FINGERPRINT' | 'HUMAN_BASIC_INFO' | 'LEGAL_BASIC_INFO' | 'EMAIL_OTP' | 'EMAIL_CONTACT' | 'PHONE_OTP' | 'PHONE_CONTACT' | 'TAX_INFO' | 'HUMAN_EXTENDED_INFO' | 'LEGAL_EXTENDED_INFO' | 'ADDRESS_INFO' | 'SWORN_DECLARATION' | 'ECONOMIC_ACTIVITY_DECLARATION' | 'DOCUMENTS_OCR' | 'LIVENESS_MATCH' | 'FACE_MATCH' | 'TERMS_AND_CONDITIONS';
|
|
29
|
+
export type OnboardingStep = 'DEVICE_FINGERPRINT' | 'HUMAN_BASIC_INFO' | 'LEGAL_BASIC_INFO' | 'EMAIL_OTP' | 'EMAIL_CONTACT' | 'PHONE_OTP' | 'PHONE_CONTACT' | 'TAX_INFO' | 'HUMAN_EXTENDED_INFO' | 'LEGAL_EXTENDED_INFO' | 'ADDRESS_INFO' | 'SWORN_DECLARATION' | 'ECONOMIC_ACTIVITY_DECLARATION' | 'DOCUMENTS_OCR' | 'LIVENESS_MATCH' | 'FACE_MATCH' | 'TERMS_AND_CONDITIONS' | 'CUSTOM_FORM' | 'ENTITY_TYPE_SELECTION';
|
|
25
30
|
/**
|
|
26
31
|
* Status of an individual onboarding step (matches backend OnboardingStepStatus).
|
|
27
32
|
*/
|
|
28
33
|
export type OnboardingStepStatus = 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'SKIPPED' | 'FAILED';
|
|
29
34
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
35
|
+
* Choice of the `ENTITY_TYPE_SELECTION` step (`selected_type`): a natural
|
|
36
|
+
* person (`HUMAN`) or a legal entity (`LEGAL`).
|
|
37
|
+
*/
|
|
38
|
+
export type EntityType = 'HUMAN' | 'LEGAL';
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated The session DTO no longer carries an `onboarding_type`; the
|
|
41
|
+
* person picks it in `ENTITY_TYPE_SELECTION`. Use {@link EntityType}.
|
|
32
42
|
*/
|
|
33
|
-
export type OnboardingType =
|
|
43
|
+
export type OnboardingType = EntityType;
|
|
34
44
|
/** Which face of the ID document is being captured. */
|
|
35
45
|
export type DocumentSide = 'FRONT' | 'BACK';
|
|
36
46
|
/**
|
|
@@ -164,8 +174,53 @@ export interface TermsAndConditionsStepConfig {
|
|
|
164
174
|
url?: string;
|
|
165
175
|
}>;
|
|
166
176
|
}
|
|
167
|
-
/**
|
|
168
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Field types a `CUSTOM_FORM` can declare. The SDK renders a field whose type it
|
|
179
|
+
* does not know as `TEXT` when it is optional, and fails the step with
|
|
180
|
+
* `UNSUPPORTED_STEP` when it is required.
|
|
181
|
+
*/
|
|
182
|
+
export type CustomFormFieldType = 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'LIST';
|
|
183
|
+
/** One field of a `CUSTOM_FORM` (`config.form_fields[]`). */
|
|
184
|
+
export interface CustomFormField {
|
|
185
|
+
/** Key of the answer in `responses`. */
|
|
186
|
+
field_key: string;
|
|
187
|
+
/** Label shown to the person. */
|
|
188
|
+
name: string;
|
|
189
|
+
/** Optional help text under the label. */
|
|
190
|
+
description?: string | null;
|
|
191
|
+
/** Field type; a string the SDK does not know is handled as described in {@link CustomFormFieldType}. */
|
|
192
|
+
type: CustomFormFieldType | string;
|
|
193
|
+
required?: boolean;
|
|
194
|
+
/** Choices of a `LIST` field (single selection). */
|
|
195
|
+
options?: string[] | null;
|
|
196
|
+
}
|
|
197
|
+
/** STEP config for CUSTOM_FORM (`current_step.config`, SSE `step_config`). */
|
|
198
|
+
export interface CustomFormStepConfig {
|
|
199
|
+
/** Screen title; the SDK shows its own generic title when absent. */
|
|
200
|
+
title?: string | null;
|
|
201
|
+
/** Screen subtitle; omitted when absent. */
|
|
202
|
+
subtitle?: string | null;
|
|
203
|
+
form_fields?: CustomFormField[];
|
|
204
|
+
reversible?: boolean;
|
|
205
|
+
}
|
|
206
|
+
/** A `CUSTOM_FORM` answer, typed per {@link CustomFormFieldType}: DATE is `yyyy-MM-dd`, LIST one of `options`. */
|
|
207
|
+
export type CustomFormResponseValue = string | number | boolean;
|
|
208
|
+
/**
|
|
209
|
+
* POST /sessions/:id/custom-form/:stepKey. An optional field left unanswered is
|
|
210
|
+
* omitted, never sent as `null`.
|
|
211
|
+
*/
|
|
212
|
+
export interface CustomFormSubmitPayload {
|
|
213
|
+
responses: Record<string, CustomFormResponseValue>;
|
|
214
|
+
}
|
|
215
|
+
/** POST /sessions/:id/entity-type. */
|
|
216
|
+
export interface EntityTypeSelectionPayload {
|
|
217
|
+
selected_type: EntityType;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Per-step runtime config cache carried by session state and SSE, keyed by the
|
|
221
|
+
* step instance (`step_key`, or the step code when the backend sends no key).
|
|
222
|
+
*/
|
|
223
|
+
export type StepConfigMap = Record<string, Record<string, unknown>>;
|
|
169
224
|
/**
|
|
170
225
|
* Request body for POST /sessions/:sessionId/documents-init.
|
|
171
226
|
* Allowed values are defined by the backend; the SDK currently sends a fixed type until
|
|
@@ -295,6 +350,13 @@ export declare enum SdkErrorCode {
|
|
|
295
350
|
* mount the iframe to prevent execution of tampered/unsigned bundles.
|
|
296
351
|
*/
|
|
297
352
|
INTEGRITY_FAILED = "INTEGRITY_FAILED",
|
|
353
|
+
/**
|
|
354
|
+
* The backend routed the session to a step this SDK version cannot render: a
|
|
355
|
+
* step code it does not know, or a `CUSTOM_FORM` with a required field of an
|
|
356
|
+
* unknown type. `stepCode` and `stepKey` name the step. The step is not
|
|
357
|
+
* skipped (the session would be declined); update the SDK to continue.
|
|
358
|
+
*/
|
|
359
|
+
UNSUPPORTED_STEP = "UNSUPPORTED_STEP",
|
|
298
360
|
UNKNOWN = "UNKNOWN"
|
|
299
361
|
}
|
|
300
362
|
/**
|
|
@@ -325,13 +387,21 @@ export interface SdkError {
|
|
|
325
387
|
*/
|
|
326
388
|
readonly stepCode?: string;
|
|
327
389
|
/**
|
|
328
|
-
*
|
|
390
|
+
* Instance key of the step (`step_key`), present when it identifies the step
|
|
391
|
+
* better than `stepCode` alone — e.g. one of several `CUSTOM_FORM`s on
|
|
392
|
+
* `UNSUPPORTED_STEP`.
|
|
393
|
+
*/
|
|
394
|
+
readonly stepKey?: string;
|
|
395
|
+
/**
|
|
396
|
+
* Localized headline resolved by the SDK for SESSION_DECLINED, SESSION_CANCELLED
|
|
397
|
+
* and UNSUPPORTED_STEP.
|
|
329
398
|
* Useful when hosts hide the built-in final result screen but still want
|
|
330
399
|
* the same user-facing text in custom UI.
|
|
331
400
|
*/
|
|
332
401
|
readonly declineTitle?: string;
|
|
333
402
|
/**
|
|
334
|
-
* Localized body message resolved by the SDK for SESSION_DECLINED
|
|
403
|
+
* Localized body message resolved by the SDK for SESSION_DECLINED, SESSION_CANCELLED
|
|
404
|
+
* and UNSUPPORTED_STEP.
|
|
335
405
|
* Mirrors the text shown in the built-in final result screen.
|
|
336
406
|
*/
|
|
337
407
|
readonly declineMessage?: string;
|
|
@@ -347,6 +417,38 @@ export interface SdkError {
|
|
|
347
417
|
*/
|
|
348
418
|
readonly cause?: unknown;
|
|
349
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* Why `cancelSession()` rejected. The flow keeps running in every case: only a
|
|
422
|
+
* cancellation the backend confirmed ends it.
|
|
423
|
+
*/
|
|
424
|
+
export declare enum CancelSessionErrorCode {
|
|
425
|
+
/**
|
|
426
|
+
* The session is no longer open (409 `VOB-40913`): it already reached a
|
|
427
|
+
* verdict or was closed. Nothing to cancel.
|
|
428
|
+
*/
|
|
429
|
+
SESSION_NOT_OPEN = "SESSION_NOT_OPEN",
|
|
430
|
+
/**
|
|
431
|
+
* The session token was rejected (401/403) or has expired. Rotate it with
|
|
432
|
+
* `refreshSessionToken()` and call `cancelSession()` again.
|
|
433
|
+
*/
|
|
434
|
+
UNAUTHORIZED = "UNAUTHORIZED",
|
|
435
|
+
/**
|
|
436
|
+
* The request did not get through: no connectivity, or the backend answered
|
|
437
|
+
* with an unexpected status (`httpStatus` is set when it answered). Safe to
|
|
438
|
+
* retry.
|
|
439
|
+
*/
|
|
440
|
+
NETWORK = "NETWORK"
|
|
441
|
+
}
|
|
442
|
+
/** Rejection value of `cancelSession()`. */
|
|
443
|
+
export interface CancelSessionError {
|
|
444
|
+
readonly code: CancelSessionErrorCode;
|
|
445
|
+
/** Developer-facing description. Not intended for end users. */
|
|
446
|
+
readonly message: string;
|
|
447
|
+
/** HTTP status of the backend answer, when there was one. */
|
|
448
|
+
readonly httpStatus?: number;
|
|
449
|
+
/** The underlying error, for debugging. */
|
|
450
|
+
readonly cause?: unknown;
|
|
451
|
+
}
|
|
350
452
|
/**
|
|
351
453
|
* White-labeling theme configuration. Same keys as the web SDK's
|
|
352
454
|
* `VelionTheme`, so one workflow appearance renders alike on web and mobile.
|
|
@@ -773,6 +875,12 @@ export interface VelionConfig extends VelionCallbacks {
|
|
|
773
875
|
*/
|
|
774
876
|
export interface OnboardingStepDto {
|
|
775
877
|
code: string;
|
|
878
|
+
/**
|
|
879
|
+
* Instance key of the step within the workflow. Equals `code` except for
|
|
880
|
+
* `CUSTOM_FORM`, whose key is the form slug. Absent on older backends: the
|
|
881
|
+
* SDK then uses `code`.
|
|
882
|
+
*/
|
|
883
|
+
step_key?: string;
|
|
776
884
|
name?: string;
|
|
777
885
|
description?: string;
|
|
778
886
|
order?: number;
|
|
@@ -780,6 +888,8 @@ export interface OnboardingStepDto {
|
|
|
780
888
|
required?: boolean;
|
|
781
889
|
/** Step-specific payload (e.g. OCR fields, fingerprint, T&C items). */
|
|
782
890
|
result?: Record<string, unknown>;
|
|
891
|
+
/** Step configuration (e.g. `form_fields` of a CUSTOM_FORM). */
|
|
892
|
+
config?: Record<string, unknown>;
|
|
783
893
|
/**
|
|
784
894
|
* Whether the user may navigate back into this step after completing it.
|
|
785
895
|
* Resolved by the backend (step-type default merged with the workflow
|
|
@@ -796,10 +906,14 @@ export interface OnboardingStepDto {
|
|
|
796
906
|
export interface OnboardingDtoResponse {
|
|
797
907
|
id?: string;
|
|
798
908
|
related_id?: string;
|
|
799
|
-
onboarding_type?: string;
|
|
800
909
|
status?: string;
|
|
910
|
+
/** Step to run. May be omitted; the SDK then takes the first unfinished step of `steps`. */
|
|
801
911
|
current_step?: {
|
|
802
912
|
code?: string;
|
|
913
|
+
/** Instance key of the current step (see {@link OnboardingStepDto.step_key}). */
|
|
914
|
+
step_key?: string;
|
|
915
|
+
name?: string;
|
|
916
|
+
description?: string;
|
|
803
917
|
status?: string;
|
|
804
918
|
config?: Record<string, unknown>;
|
|
805
919
|
/** When `true`, the SDK renders the "back" control for this step. */
|
|
@@ -837,8 +951,13 @@ export interface OnboardingDtoResponse {
|
|
|
837
951
|
* (OnboardingDto): steps sorted by order → requiredSteps, first non-completed index → currentStepIndex.
|
|
838
952
|
*/
|
|
839
953
|
export interface SessionState {
|
|
840
|
-
/** Current runnable step reported by backend session state. */
|
|
954
|
+
/** Current runnable step reported by backend session state. Decides the screen. */
|
|
841
955
|
currentStep?: OnboardingStep;
|
|
956
|
+
/**
|
|
957
|
+
* Instance key of {@link currentStep} (`step_key`, or the code when the backend
|
|
958
|
+
* sends none). Decides which step instance the SDK answers to.
|
|
959
|
+
*/
|
|
960
|
+
currentStepKey?: string;
|
|
842
961
|
/** Step-specific config for `currentStep` from GET /sessions/:id `current_step.config`. */
|
|
843
962
|
currentStepConfig?: Record<string, unknown>;
|
|
844
963
|
/**
|
|
@@ -855,6 +974,7 @@ export interface SessionState {
|
|
|
855
974
|
*/
|
|
856
975
|
stepReversibility?: Array<{
|
|
857
976
|
code: OnboardingStep;
|
|
977
|
+
stepKey: string;
|
|
858
978
|
reversible: boolean;
|
|
859
979
|
}>;
|
|
860
980
|
/**
|
|
@@ -863,10 +983,8 @@ export interface SessionState {
|
|
|
863
983
|
* `current_step.result`.
|
|
864
984
|
*/
|
|
865
985
|
currentStepResult?: Record<string, unknown>;
|
|
866
|
-
/** Cached configs discovered from GET session and SSE `step_config
|
|
986
|
+
/** Cached configs discovered from GET session and SSE `step_config`, keyed by step key. */
|
|
867
987
|
stepConfigs?: StepConfigMap;
|
|
868
|
-
/** Session type (HUMAN or LEGAL). Constrains which steps are applicable. */
|
|
869
|
-
onboardingType?: OnboardingType;
|
|
870
988
|
/** Arbitrary session metadata the backend may attach. */
|
|
871
989
|
metadata?: Record<string, unknown>;
|
|
872
990
|
/**
|
|
@@ -1184,8 +1302,13 @@ export interface OnboardingSessionEvent {
|
|
|
1184
1302
|
session_id?: number;
|
|
1185
1303
|
/** Discriminator: STEP_UPDATED | ROUTING_COMMAND | SESSION_APPROVED | SESSION_MANUAL_REVIEW | SESSION_DECLINED | SESSION_CANCELLED */
|
|
1186
1304
|
event_type?: string;
|
|
1187
|
-
/** Present for STEP_UPDATED or ROUTING_COMMAND (next step code). */
|
|
1305
|
+
/** Present for STEP_UPDATED or ROUTING_COMMAND (next step code). Decides the screen. */
|
|
1188
1306
|
step_code?: string;
|
|
1307
|
+
/**
|
|
1308
|
+
* Instance key of `step_code` on STEP_UPDATED and ROUTING_COMMAND. Tells two
|
|
1309
|
+
* `CUSTOM_FORM`s apart. Absent on older backends: the SDK uses `step_code`.
|
|
1310
|
+
*/
|
|
1311
|
+
step_key?: string;
|
|
1189
1312
|
/** Present for STEP_UPDATED; e.g. COMPLETED. */
|
|
1190
1313
|
step_status?: string;
|
|
1191
1314
|
/** Present for terminal events; e.g. APPROVED | MANUAL_REVIEW | REJECTED | DECLINED | CANCELLED. */
|
|
@@ -1277,10 +1400,12 @@ export type SdkEventName = 'step:change' | 'step:complete' | 'session:loaded' |
|
|
|
1277
1400
|
export interface SdkEventMap extends Record<string, unknown> {
|
|
1278
1401
|
'step:change': {
|
|
1279
1402
|
step: OnboardingStep;
|
|
1403
|
+
stepKey: string;
|
|
1280
1404
|
index: number;
|
|
1281
1405
|
};
|
|
1282
1406
|
'step:complete': {
|
|
1283
1407
|
step: OnboardingStep;
|
|
1408
|
+
stepKey: string;
|
|
1284
1409
|
};
|
|
1285
1410
|
'session:loaded': SessionState;
|
|
1286
1411
|
'flow:complete': OnboardingResult;
|