@velion-la/onboarding-sdk-react-native 1.4.0-beta.7 → 1.4.0-beta.8
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 +41 -0
- package/README.md +31 -1
- package/lib/commonjs/core/VelionOnboarding.js +52 -44
- 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.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/types/index.js +35 -3
- package/lib/commonjs/types/index.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 +53 -45
- 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.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/types/index.js +42 -3
- package/lib/module/types/index.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 +11 -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 +1 -1
- 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/types/index.d.ts +107 -14
- package/lib/typescript/types/index.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 +59 -53
- 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 +7 -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/types/index.ts +117 -17
- 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
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
* of `<Input>` (label, 44 px tap target, error styling) so step forms can mix
|
|
6
6
|
* the two primitives interchangeably.
|
|
7
7
|
*
|
|
8
|
-
* Intentionally simple: no
|
|
9
|
-
*
|
|
8
|
+
* Intentionally simple: no virtualisation. `searchable` adds a filter field on
|
|
9
|
+
* top of the option list for longer lists (e.g. a CUSTOM_FORM `LIST` with many
|
|
10
|
+
* options). For country pickers use `CountrySelect`.
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
|
-
import { useId, useMemo, useState } from 'react';
|
|
13
|
+
import { useCallback, useId, useMemo, useState } from 'react';
|
|
13
14
|
import { Modal, Pressable, ScrollView, StyleSheet, View } from 'react-native';
|
|
14
|
-
import { Text } from './Text';
|
|
15
|
+
import { Text, TextInput } from './Text';
|
|
15
16
|
import { useTheme, withAlpha } from '../theme';
|
|
17
|
+
import { filterSearchableOptions } from './searchableSingleSelectFilter';
|
|
16
18
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
export function Select({
|
|
18
20
|
label,
|
|
@@ -23,13 +25,29 @@ export function Select({
|
|
|
23
25
|
errorMessage,
|
|
24
26
|
required,
|
|
25
27
|
disabled = false,
|
|
26
|
-
containerStyle
|
|
28
|
+
containerStyle,
|
|
29
|
+
searchable = false,
|
|
30
|
+
searchPlaceholder,
|
|
31
|
+
emptyText
|
|
27
32
|
}) {
|
|
28
33
|
const theme = useTheme();
|
|
29
34
|
const errorId = useId();
|
|
30
|
-
const [open,
|
|
35
|
+
const [open, setOpenState] = useState(false);
|
|
36
|
+
const [query, setQuery] = useState('');
|
|
31
37
|
const hasError = Boolean(errorMessage && errorMessage.length > 0);
|
|
38
|
+
const setOpen = useCallback(next => {
|
|
39
|
+
setOpenState(next);
|
|
40
|
+
if (!next) setQuery('');
|
|
41
|
+
}, []);
|
|
32
42
|
const selected = useMemo(() => options.find(o => o.value === value) ?? null, [options, value]);
|
|
43
|
+
const visibleOptions = useMemo(() => {
|
|
44
|
+
if (!searchable) return options;
|
|
45
|
+
const matches = new Set(filterSearchableOptions(options.map(o => ({
|
|
46
|
+
id: o.value,
|
|
47
|
+
label: o.label
|
|
48
|
+
})), query).map(o => o.id));
|
|
49
|
+
return options.filter(o => matches.has(o.value));
|
|
50
|
+
}, [options, query, searchable]);
|
|
33
51
|
return /*#__PURE__*/_jsxs(View, {
|
|
34
52
|
style: [styles.wrap, containerStyle],
|
|
35
53
|
children: [label ? /*#__PURE__*/_jsxs(Text, {
|
|
@@ -98,9 +116,31 @@ export function Select({
|
|
|
98
116
|
color: theme.textColor
|
|
99
117
|
}],
|
|
100
118
|
children: label
|
|
101
|
-
}) : null, /*#__PURE__*/_jsx(
|
|
119
|
+
}) : null, searchable ? /*#__PURE__*/_jsx(TextInput, {
|
|
120
|
+
autoCapitalize: "none",
|
|
121
|
+
autoCorrect: false,
|
|
122
|
+
accessibilityLabel: searchPlaceholder ?? label,
|
|
123
|
+
placeholder: searchPlaceholder ?? '',
|
|
124
|
+
placeholderTextColor: theme.textSecondaryColor,
|
|
125
|
+
value: query,
|
|
126
|
+
onChangeText: setQuery,
|
|
127
|
+
style: [styles.search, {
|
|
128
|
+
minHeight: theme.inputHeightPx
|
|
129
|
+
}, {
|
|
130
|
+
color: theme.textColor,
|
|
131
|
+
backgroundColor: theme.backgroundColor,
|
|
132
|
+
borderColor: theme.borderColor,
|
|
133
|
+
borderRadius: theme.borderRadiusPx
|
|
134
|
+
}]
|
|
135
|
+
}) : null, /*#__PURE__*/_jsxs(ScrollView, {
|
|
102
136
|
style: styles.sheetList,
|
|
103
|
-
|
|
137
|
+
keyboardShouldPersistTaps: "handled",
|
|
138
|
+
children: [searchable && visibleOptions.length === 0 && emptyText ? /*#__PURE__*/_jsx(Text, {
|
|
139
|
+
style: [styles.empty, {
|
|
140
|
+
color: theme.textSecondaryColor
|
|
141
|
+
}],
|
|
142
|
+
children: emptyText
|
|
143
|
+
}) : null, visibleOptions.map(opt => {
|
|
104
144
|
const isSelected = opt.value === value;
|
|
105
145
|
return /*#__PURE__*/_jsx(Pressable, {
|
|
106
146
|
accessibilityRole: "menuitem",
|
|
@@ -126,7 +166,7 @@ export function Select({
|
|
|
126
166
|
children: opt.label
|
|
127
167
|
})
|
|
128
168
|
}, opt.value);
|
|
129
|
-
})
|
|
169
|
+
})]
|
|
130
170
|
})]
|
|
131
171
|
})
|
|
132
172
|
})
|
|
@@ -194,6 +234,19 @@ const styles = StyleSheet.create({
|
|
|
194
234
|
sheetList: {
|
|
195
235
|
flexShrink: 1
|
|
196
236
|
},
|
|
237
|
+
search: {
|
|
238
|
+
marginHorizontal: 16,
|
|
239
|
+
marginBottom: 8,
|
|
240
|
+
paddingHorizontal: 12,
|
|
241
|
+
paddingVertical: 8,
|
|
242
|
+
fontSize: 15,
|
|
243
|
+
borderWidth: 1
|
|
244
|
+
},
|
|
245
|
+
empty: {
|
|
246
|
+
paddingHorizontal: 16,
|
|
247
|
+
paddingVertical: 12,
|
|
248
|
+
fontSize: 14
|
|
249
|
+
},
|
|
197
250
|
option: {
|
|
198
251
|
minHeight: 44,
|
|
199
252
|
paddingHorizontal: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useId","useMemo","useState","Modal","Pressable","ScrollView","StyleSheet","View","Text","useTheme","withAlpha","jsxs","_jsxs","jsx","_jsx","Select","label","options","value","onChange","placeholder","errorMessage","required","disabled","containerStyle","theme","errorId","open","
|
|
1
|
+
{"version":3,"names":["useCallback","useId","useMemo","useState","Modal","Pressable","ScrollView","StyleSheet","View","Text","TextInput","useTheme","withAlpha","filterSearchableOptions","jsxs","_jsxs","jsx","_jsx","Select","label","options","value","onChange","placeholder","errorMessage","required","disabled","containerStyle","searchable","searchPlaceholder","emptyText","theme","errorId","open","setOpenState","query","setQuery","hasError","Boolean","length","setOpen","next","selected","find","o","visibleOptions","matches","Set","map","id","filter","has","style","styles","wrap","children","color","textColor","textSecondaryColor","accessibilityRole","accessibilityState","expanded","accessibilityLabel","onPress","trigger","minHeight","inputHeightPx","backgroundColor","borderColor","errorColor","borderRadius","borderRadiusPx","numberOfLines","triggerText","chevron","nativeID","accessibilityLiveRegion","error","visible","transparent","animationType","onRequestClose","backdrop","sheet","undefined","sheetTitle","autoCapitalize","autoCorrect","placeholderTextColor","onChangeText","search","sheetList","keyboardShouldPersistTaps","empty","opt","isSelected","pressed","option","primaryColor","optionText","fontWeight","create","width","marginBottom","fontSize","paddingHorizontal","paddingVertical","borderWidth","flexDirection","alignItems","justifyContent","flex","marginLeft","opacity","marginTop","lineHeight","padding","maxWidth","maxHeight","paddingTop","paddingBottom","flexShrink","marginHorizontal"],"sourceRoot":"../../../../src","sources":["ui/primitives/Select.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,EAAEC,KAAK,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC7D,SACEC,KAAK,EACLC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,IAAI,QAGC,cAAc;AACrB,SAASC,IAAI,EAAEC,SAAS,QAAQ,QAAQ;AACxC,SAASC,QAAQ,EAAEC,SAAS,QAAQ,UAAU;AAC9C,SAASC,uBAAuB,QAAQ,gCAAgC;AAAC,SAAAC,IAAA,IAAAC,KAAA,EAAAC,GAAA,IAAAC,IAAA;AAwBzE,OAAO,SAASC,MAAMA,CAAC;EACrBC,KAAK;EACLC,OAAO;EACPC,KAAK;EACLC,QAAQ;EACRC,WAAW;EACXC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BAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,CAAC;IAClBF,QAAQ,EAAE,EAAE;IACZG,WAAW,EAAE;EACf,CAAC;EACDd,KAAK,EAAE;IACLY,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBF,QAAQ,EAAE;EACZ,CAAC;EACDP,MAAM,EAAE;IACNhC,SAAS,EAAE,EAAE;IACbwC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBI,cAAc,EAAE;EAClB,CAAC;EACDX,UAAU,EAAE;IACVK,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -12,4 +12,5 @@ export { Checkbox } from './Checkbox';
|
|
|
12
12
|
export { DatePicker } from './DatePicker';
|
|
13
13
|
export { CountrySelect } from './CountrySelect';
|
|
14
14
|
export { SearchableSingleSelectList, filterSearchableOptions } from './SearchableSingleSelectList';
|
|
15
|
+
export { RadioCard } from './RadioCard';
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Text","TextInput","Button","BackButton","Input","Select","Card","Banner","Spinner","Checkbox","DatePicker","CountrySelect","SearchableSingleSelectList","filterSearchableOptions"],"sourceRoot":"../../../../src","sources":["ui/primitives/index.ts"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,SAAS,QAAQ,QAAQ;AACxC,SAASC,MAAM,QAA8C,UAAU;AACvE,SAASC,UAAU,QAA8B,cAAc;AAC/D,SAASC,KAAK,QAAyB,SAAS;AAChD,SAASC,MAAM,QAA6C,UAAU;AACtE,SAASC,IAAI,QAAwB,QAAQ;AAC7C,SAASC,MAAM,QAA0B,UAAU;AACnD,SAASC,OAAO,QAA2B,WAAW;AACtD,SAASC,QAAQ,QAA4B,YAAY;AACzD,SAASC,UAAU,QAA8B,cAAc;AAC/D,SAASC,aAAa,QAAiC,iBAAiB;AACxE,SACEC,0BAA0B,EAC1BC,uBAAuB,QAGlB,8BAA8B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Text","TextInput","Button","BackButton","Input","Select","Card","Banner","Spinner","Checkbox","DatePicker","CountrySelect","SearchableSingleSelectList","filterSearchableOptions","RadioCard"],"sourceRoot":"../../../../src","sources":["ui/primitives/index.ts"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,SAAS,QAAQ,QAAQ;AACxC,SAASC,MAAM,QAA8C,UAAU;AACvE,SAASC,UAAU,QAA8B,cAAc;AAC/D,SAASC,KAAK,QAAyB,SAAS;AAChD,SAASC,MAAM,QAA6C,UAAU;AACtE,SAASC,IAAI,QAAwB,QAAQ;AAC7C,SAASC,MAAM,QAA0B,UAAU;AACnD,SAASC,OAAO,QAA2B,WAAW;AACtD,SAASC,QAAQ,QAA4B,YAAY;AACzD,SAASC,UAAU,QAA8B,cAAc;AAC/D,SAASC,aAAa,QAAiC,iBAAiB;AACxE,SACEC,0BAA0B,EAC1BC,uBAAuB,QAGlB,8BAA8B;AACrC,SAASC,SAAS,QAA6B,aAAa","ignoreList":[]}
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
* GENERATED by `sdk/scripts/sync-sdk-version.js` from `sdk/package.json`:
|
|
8
8
|
* do not edit by hand. The build and the CI version bump regenerate it.
|
|
9
9
|
*/
|
|
10
|
-
export const SDK_VERSION = '1.4.0-beta.
|
|
10
|
+
export const SDK_VERSION = '1.4.0-beta.8';
|
|
11
11
|
//# sourceMappingURL=sdkVersion.js.map
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
* token with the cancellation, so the SDK closes SSE and stops calling out
|
|
20
20
|
* - A request rejected with the 401 `VOB-40103` (token revoked by that same
|
|
21
21
|
* cancellation, SSE event missed) ends the flow exactly like SESSION_CANCELLED
|
|
22
|
+
* - The step code picks the screen; the step key (`step_key`, else the code)
|
|
23
|
+
* picks the instance: dedupe, config cache, reversibility and back
|
|
24
|
+
* navigation all go by key, so two CUSTOM_FORMs in a row are two steps
|
|
25
|
+
* - A step this SDK cannot render ends the flow with UNSUPPORTED_STEP; it is
|
|
26
|
+
* never skipped
|
|
22
27
|
*/
|
|
23
28
|
import { type VelionConfig as WebVelionConfig, type SdkStatus, type SdkEventMap, type SdkError, type OnboardingResult, type OnboardingExit } from '../types';
|
|
24
29
|
import { type ReactNode } from 'react';
|
|
@@ -147,12 +152,13 @@ export declare class VelionOnboarding {
|
|
|
147
152
|
private stopTalkingToBackend;
|
|
148
153
|
private openSseStream;
|
|
149
154
|
private handleSseEvent;
|
|
150
|
-
private extractNextStepCommand;
|
|
151
155
|
/**
|
|
152
|
-
* Fire-and-forget reverse navigation. POSTs `/sessions/:id/back
|
|
153
|
-
* step
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
+
* Fire-and-forget reverse navigation. POSTs `/sessions/:id/back` with the
|
|
157
|
+
* step key as `from_step` (the backend accepts a key or a code; only the key
|
|
158
|
+
* tells two CUSTOM_FORMs apart); the actual step transition arrives via SSE
|
|
159
|
+
* (`PREVIOUS_STEP`). A `400` (session not IN_PROGRESS) or any other failure is
|
|
160
|
+
* swallowed — the user keeps editing the current step. De-duplicated so rapid
|
|
161
|
+
* taps don't stack requests.
|
|
156
162
|
*/
|
|
157
163
|
private requestBackNavigation;
|
|
158
164
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VelionOnboarding.d.ts","sourceRoot":"","sources":["../../../src/core/VelionOnboarding.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"VelionOnboarding.d.ts","sourceRoot":"","sources":["../../../src/core/VelionOnboarding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AA8CH,OAAO,EAEL,KAAK,YAAY,IAAI,eAAe,EACpC,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,QAAQ,EAEb,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAIpB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAiB,KAAK,SA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IACrE,OAAO,CAAC,oBAAoB;IAiB5B,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,cAAc;IAkHtB;;;;;;;OAOG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAWxB,iFAAiF;IACjF,OAAO,CAAC,gBAAgB;IAOxB;;;;;;;;;;;;;;;;OAgBG;YACW,qBAAqB;IAuEnC;;;;OAIG;YACW,8BAA8B;IA4B5C,kFAAkF;IAClF,OAAO,CAAC,sBAAsB;IAa9B,qEAAqE;IACrE,OAAO,CAAC,4BAA4B;IAMpC;;;OAGG;YACW,2BAA2B;YAuC3B,kCAAkC;IAKhD,OAAO,CAAC,uBAAuB;IAqB/B;;;;OAIG;YACW,2BAA2B;IAYzC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,kBAAkB;IAoC1B;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAkC9B,OAAO,CAAC,qBAAqB;IAgB7B,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,WAAW;CAGpB"}
|
|
@@ -6,12 +6,35 @@
|
|
|
6
6
|
* functions only translate a raw `OnboardingSessionEvent` into a typed command.
|
|
7
7
|
*/
|
|
8
8
|
import type { OnboardingSessionEvent, OnboardingStep } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Forward routing command (`ROUTING_COMMAND / NEXT_STEP` or `RETRY_STEP`). The
|
|
11
|
+
* code picks the screen; the key picks the step instance (two `CUSTOM_FORM`s
|
|
12
|
+
* share a code but not a key).
|
|
13
|
+
*/
|
|
14
|
+
export interface NextStepCommand {
|
|
15
|
+
step: OnboardingStep;
|
|
16
|
+
/** `step_key` of the event, or `step_code` when the backend sends no key. */
|
|
17
|
+
stepKey: string;
|
|
18
|
+
stepConfig?: Record<string, unknown>;
|
|
19
|
+
/** `NEXT_STEP` advances; `RETRY_STEP` re-presents the same step (via a retry dialog). */
|
|
20
|
+
action: 'NEXT_STEP' | 'RETRY_STEP';
|
|
21
|
+
/** Whether the target step can go back (when the backend sends it on the command). */
|
|
22
|
+
canGoBack?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parses a forward routing command from an SSE event. Returns `null` for any
|
|
26
|
+
* event that is not a `ROUTING_COMMAND` `NEXT_STEP` / `RETRY_STEP` with a
|
|
27
|
+
* `step_code`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseNextStepCommand(event: OnboardingSessionEvent): NextStepCommand | null;
|
|
9
30
|
/**
|
|
10
31
|
* Reverse-navigation command (`ROUTING_COMMAND / PREVIOUS_STEP`). Carries the
|
|
11
32
|
* re-opened step plus its config and the previously-captured data for prefill.
|
|
12
33
|
*/
|
|
13
34
|
export interface PreviousStepCommand {
|
|
14
35
|
step: OnboardingStep;
|
|
36
|
+
/** `step_key` of the event, or `step_code` when the backend sends no key. */
|
|
37
|
+
stepKey: string;
|
|
15
38
|
stepConfig?: Record<string, unknown>;
|
|
16
39
|
stepResult?: Record<string, unknown>;
|
|
17
40
|
/** Whether the re-opened step can itself go back further (when the backend sends it). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routingCommands.d.ts","sourceRoot":"","sources":["../../../src/core/routingCommands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"routingCommands.d.ts","sourceRoot":"","sources":["../../../src/core/routingCommands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGvE;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,yFAAyF;IACzF,MAAM,EAAE,WAAW,GAAG,YAAY,CAAC;IACnC,sFAAsF;IACtF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,sBAAsB,GAC5B,eAAe,GAAG,IAAI,CAaxB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,yFAAyF;IACzF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,sBAAsB,GAC5B,mBAAmB,GAAG,IAAI,CAY5B;AAED,kFAAkF;AAClF,MAAM,WAAW,eAAe;IAC9B,iFAAiF;IACjF,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,sBAAsB,GAC5B,eAAe,GAAG,IAAI,CAKxB"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Maps backend OnboardingDto (GET /sessions/:id) to SDK SessionState.
|
|
3
3
|
*/
|
|
4
|
-
import type { OnboardingDtoResponse, OnboardingResult,
|
|
4
|
+
import type { OnboardingDtoResponse, OnboardingResult, SessionState } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Instance key of a step: its `step_key`, or its code when the backend sends no
|
|
7
|
+
* key (older backends, and every step but `CUSTOM_FORM`, where both match).
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveStepKey(stepKey: string | undefined | null, code: string): string;
|
|
5
10
|
/**
|
|
6
11
|
* Maps the onboarding DTO returned by GET /sessions/:sessionId to the
|
|
7
12
|
* SessionState shape used by the step machine.
|
|
13
|
+
*
|
|
14
|
+
* The code of a step decides which screen renders; its `step_key` decides which
|
|
15
|
+
* instance the SDK answers to, so configs and reversibility are keyed by it.
|
|
8
16
|
*/
|
|
9
17
|
export declare function mapOnboardingDtoToSessionState(dto: OnboardingDtoResponse): SessionState;
|
|
10
18
|
/**
|
|
@@ -19,11 +27,11 @@ export declare function resolveReversibleFlag(explicit: boolean | undefined, con
|
|
|
19
27
|
* fallback when the backend doesn't send `can_go_back` explicitly — e.g. on a
|
|
20
28
|
* step reached via SSE). Matches the backend's barrier model: a step can go back
|
|
21
29
|
* when any earlier step is reversible (navigate to it) or the step itself is the
|
|
22
|
-
* first reversible step (back exits the flow).
|
|
23
|
-
* not in the cached order.
|
|
30
|
+
* first reversible step (back exits the flow). The step is looked up by its
|
|
31
|
+
* instance key. Returns `false` when the step is not in the cached order.
|
|
24
32
|
*/
|
|
25
|
-
export declare function deriveCanGoBack(
|
|
26
|
-
|
|
33
|
+
export declare function deriveCanGoBack(stepKey: string, order: ReadonlyArray<{
|
|
34
|
+
stepKey: string;
|
|
27
35
|
reversible: boolean;
|
|
28
36
|
}>): boolean;
|
|
29
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionStateMapper.d.ts","sourceRoot":"","sources":["../../../src/core/sessionStateMapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"sessionStateMapper.d.ts","sourceRoot":"","sources":["../../../src/core/sessionStateMapper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAGhB,YAAY,EAE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QAAQ,CAAC,EAC1C,cAAc,CAAC,EAAE,MAAM,GACtB,gBAAgB,CAElB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/strings/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,eAAO,MAAM,EAAE,EAAE,YAuXhB,CAAC"}
|
|
@@ -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"}
|
|
@@ -21,6 +21,6 @@ export { LoadingOverlay, RetryDialog, ProgressBar, PROGRESS_BAR, } from './ui/ov
|
|
|
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
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';
|
|
24
|
+
export type { OnboardingStep, OnboardingStepStatus, OnboardingType, EntityType, OnboardingResult, OnboardingExit, OnboardingSessionEvent, OnboardingDtoResponse, SessionState, SdkError, 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,gBA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gB,EAChB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,QAAQ,EACR,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,
|
|
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,GAC5B,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,C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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":["../../../src/steps/customForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,iEAAiE;AACjE,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAa3C,yCAAyC;AACzC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,mCAAmC;AACnC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,sFAAsF;IACtF,iBAAiB,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9D;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEjD,wDAAwD;AACxD,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,YA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kB,CAAC,EACzC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC3C,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAezC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,aAAa,CAAC,kBAAkB,CAAC,EACzC,MAAM,EAAE,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"}
|