@velion-la/onboarding-sdk-react-native 1.0.0-beta.5 → 1.0.0-beta.6
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/README.md +85 -0
- package/lib/commonjs/core/VelionOnboarding.js +233 -15
- package/lib/commonjs/core/VelionOnboarding.js.map +1 -1
- package/lib/commonjs/core/routingCommands.js +62 -0
- package/lib/commonjs/core/routingCommands.js.map +1 -0
- package/lib/commonjs/core/sessionStateMapper.js +63 -0
- package/lib/commonjs/core/sessionStateMapper.js.map +1 -1
- package/lib/commonjs/i18n/strings/en.js +1 -0
- package/lib/commonjs/i18n/strings/en.js.map +1 -1
- package/lib/commonjs/i18n/strings/es.js +1 -0
- package/lib/commonjs/i18n/strings/es.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/steps/AddressInfoStep.js +30 -18
- package/lib/commonjs/steps/AddressInfoStep.js.map +1 -1
- package/lib/commonjs/steps/DocumentsOcrStep.js +4 -0
- package/lib/commonjs/steps/DocumentsOcrStep.js.map +1 -1
- package/lib/commonjs/steps/EmailContactStep.js +5 -0
- package/lib/commonjs/steps/EmailContactStep.js.map +1 -1
- package/lib/commonjs/steps/EmailOtpStep.js +5 -0
- package/lib/commonjs/steps/EmailOtpStep.js.map +1 -1
- package/lib/commonjs/steps/HumanBasicInfoStep.js +12 -4
- package/lib/commonjs/steps/HumanBasicInfoStep.js.map +1 -1
- package/lib/commonjs/steps/HumanExtendedInfoStep.js +15 -8
- package/lib/commonjs/steps/HumanExtendedInfoStep.js.map +1 -1
- package/lib/commonjs/steps/LegalBasicInfoStep.js +13 -6
- package/lib/commonjs/steps/LegalBasicInfoStep.js.map +1 -1
- package/lib/commonjs/steps/LegalExtendedInfoStep.js +9 -2
- package/lib/commonjs/steps/LegalExtendedInfoStep.js.map +1 -1
- package/lib/commonjs/steps/PhoneContactStep.js +5 -0
- package/lib/commonjs/steps/PhoneContactStep.js.map +1 -1
- package/lib/commonjs/steps/PhoneOtpStep.js +5 -0
- package/lib/commonjs/steps/PhoneOtpStep.js.map +1 -1
- package/lib/commonjs/steps/SwornDeclarationStep.js +16 -6
- package/lib/commonjs/steps/SwornDeclarationStep.js.map +1 -1
- package/lib/commonjs/steps/TaxInfoStep.js +10 -3
- package/lib/commonjs/steps/TaxInfoStep.js.map +1 -1
- package/lib/commonjs/steps/TermsAndConditionsStep.js +7 -0
- package/lib/commonjs/steps/TermsAndConditionsStep.js.map +1 -1
- package/lib/commonjs/steps/_shared.js +21 -0
- package/lib/commonjs/steps/_shared.js.map +1 -1
- package/lib/commonjs/types/index.js +20 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/ui/StepShell.js +10 -2
- package/lib/commonjs/ui/StepShell.js.map +1 -1
- package/lib/commonjs/ui/VelionOnboardingScreen.js +25 -5
- package/lib/commonjs/ui/VelionOnboardingScreen.js.map +1 -1
- package/lib/commonjs/ui/icons/StepIcon.js.map +1 -1
- package/lib/commonjs/ui/primitives/BackButton.js +75 -0
- package/lib/commonjs/ui/primitives/BackButton.js.map +1 -0
- package/lib/commonjs/ui/primitives/index.js +7 -0
- package/lib/commonjs/ui/primitives/index.js.map +1 -1
- package/lib/module/core/VelionOnboarding.js +234 -16
- package/lib/module/core/VelionOnboarding.js.map +1 -1
- package/lib/module/core/routingCommands.js +57 -0
- package/lib/module/core/routingCommands.js.map +1 -0
- package/lib/module/core/sessionStateMapper.js +61 -0
- package/lib/module/core/sessionStateMapper.js.map +1 -1
- package/lib/module/i18n/strings/en.js +1 -0
- package/lib/module/i18n/strings/en.js.map +1 -1
- package/lib/module/i18n/strings/es.js +1 -0
- package/lib/module/i18n/strings/es.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/steps/AddressInfoStep.js +31 -19
- package/lib/module/steps/AddressInfoStep.js.map +1 -1
- package/lib/module/steps/DocumentsOcrStep.js +4 -0
- package/lib/module/steps/DocumentsOcrStep.js.map +1 -1
- package/lib/module/steps/EmailContactStep.js +5 -0
- package/lib/module/steps/EmailContactStep.js.map +1 -1
- package/lib/module/steps/EmailOtpStep.js +5 -0
- package/lib/module/steps/EmailOtpStep.js.map +1 -1
- package/lib/module/steps/HumanBasicInfoStep.js +12 -4
- package/lib/module/steps/HumanBasicInfoStep.js.map +1 -1
- package/lib/module/steps/HumanExtendedInfoStep.js +16 -9
- package/lib/module/steps/HumanExtendedInfoStep.js.map +1 -1
- package/lib/module/steps/LegalBasicInfoStep.js +14 -7
- package/lib/module/steps/LegalBasicInfoStep.js.map +1 -1
- package/lib/module/steps/LegalExtendedInfoStep.js +10 -3
- package/lib/module/steps/LegalExtendedInfoStep.js.map +1 -1
- package/lib/module/steps/PhoneContactStep.js +5 -0
- package/lib/module/steps/PhoneContactStep.js.map +1 -1
- package/lib/module/steps/PhoneOtpStep.js +5 -0
- package/lib/module/steps/PhoneOtpStep.js.map +1 -1
- package/lib/module/steps/SwornDeclarationStep.js +18 -6
- package/lib/module/steps/SwornDeclarationStep.js.map +1 -1
- package/lib/module/steps/TaxInfoStep.js +11 -4
- package/lib/module/steps/TaxInfoStep.js.map +1 -1
- package/lib/module/steps/TermsAndConditionsStep.js +7 -0
- package/lib/module/steps/TermsAndConditionsStep.js.map +1 -1
- package/lib/module/steps/_shared.js +19 -0
- package/lib/module/steps/_shared.js.map +1 -1
- package/lib/module/types/index.js +21 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/ui/StepShell.js +10 -2
- package/lib/module/ui/StepShell.js.map +1 -1
- package/lib/module/ui/VelionOnboardingScreen.js +25 -5
- package/lib/module/ui/VelionOnboardingScreen.js.map +1 -1
- package/lib/module/ui/icons/StepIcon.js.map +1 -1
- package/lib/module/ui/primitives/BackButton.js +71 -0
- package/lib/module/ui/primitives/BackButton.js.map +1 -0
- package/lib/module/ui/primitives/index.js +1 -0
- package/lib/module/ui/primitives/index.js.map +1 -1
- package/lib/typescript/core/VelionOnboarding.d.ts +44 -1
- package/lib/typescript/core/VelionOnboarding.d.ts.map +1 -1
- package/lib/typescript/core/routingCommands.d.ts +39 -0
- package/lib/typescript/core/routingCommands.d.ts.map +1 -0
- package/lib/typescript/core/sessionStateMapper.d.ts +20 -1
- 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 +1 -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/AddressInfoStep.d.ts.map +1 -1
- package/lib/typescript/steps/DocumentsOcrStep.d.ts.map +1 -1
- package/lib/typescript/steps/EmailContactStep.d.ts.map +1 -1
- package/lib/typescript/steps/EmailOtpStep.d.ts.map +1 -1
- package/lib/typescript/steps/HumanBasicInfoStep.d.ts.map +1 -1
- package/lib/typescript/steps/HumanExtendedInfoStep.d.ts.map +1 -1
- package/lib/typescript/steps/LegalBasicInfoStep.d.ts.map +1 -1
- package/lib/typescript/steps/LegalExtendedInfoStep.d.ts.map +1 -1
- package/lib/typescript/steps/PhoneContactStep.d.ts.map +1 -1
- package/lib/typescript/steps/PhoneOtpStep.d.ts.map +1 -1
- package/lib/typescript/steps/SwornDeclarationStep.d.ts.map +1 -1
- package/lib/typescript/steps/TaxInfoStep.d.ts.map +1 -1
- package/lib/typescript/steps/TermsAndConditionsStep.d.ts.map +1 -1
- package/lib/typescript/steps/_shared.d.ts +11 -0
- package/lib/typescript/steps/_shared.d.ts.map +1 -1
- package/lib/typescript/steps/types.d.ts +15 -0
- package/lib/typescript/steps/types.d.ts.map +1 -1
- package/lib/typescript/types/index.d.ts +104 -5
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/ui/StepShell.d.ts +11 -1
- package/lib/typescript/ui/StepShell.d.ts.map +1 -1
- package/lib/typescript/ui/VelionOnboardingScreen.d.ts +9 -2
- package/lib/typescript/ui/VelionOnboardingScreen.d.ts.map +1 -1
- package/lib/typescript/ui/icons/StepIcon.d.ts +1 -1
- package/lib/typescript/ui/icons/StepIcon.d.ts.map +1 -1
- package/lib/typescript/ui/primitives/BackButton.d.ts +20 -0
- package/lib/typescript/ui/primitives/BackButton.d.ts.map +1 -0
- package/lib/typescript/ui/primitives/index.d.ts +1 -0
- package/lib/typescript/ui/primitives/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/VelionOnboarding.ts +241 -14
- package/src/core/routingCommands.ts +63 -0
- package/src/core/sessionStateMapper.ts +65 -0
- package/src/i18n/strings/en.ts +1 -0
- package/src/i18n/strings/es.ts +1 -0
- package/src/index.ts +1 -0
- package/src/steps/AddressInfoStep.tsx +38 -20
- package/src/steps/DocumentsOcrStep.tsx +5 -0
- package/src/steps/EmailContactStep.tsx +6 -0
- package/src/steps/EmailOtpStep.tsx +6 -0
- package/src/steps/HumanBasicInfoStep.tsx +16 -4
- package/src/steps/HumanExtendedInfoStep.tsx +18 -9
- package/src/steps/LegalBasicInfoStep.tsx +16 -7
- package/src/steps/LegalExtendedInfoStep.tsx +16 -3
- package/src/steps/PhoneContactStep.tsx +6 -0
- package/src/steps/PhoneOtpStep.tsx +6 -0
- package/src/steps/SwornDeclarationStep.tsx +23 -6
- package/src/steps/TaxInfoStep.tsx +15 -4
- package/src/steps/TermsAndConditionsStep.tsx +8 -0
- package/src/steps/_shared.ts +25 -0
- package/src/steps/types.ts +15 -0
- package/src/types/index.ts +103 -3
- package/src/ui/StepShell.tsx +17 -0
- package/src/ui/VelionOnboardingScreen.tsx +36 -2
- package/src/ui/icons/StepIcon.tsx +2 -1
- package/src/ui/primitives/BackButton.tsx +65 -0
- package/src/ui/primitives/index.ts +1 -0
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
} from '../utils/googleMapsPreflight';
|
|
43
43
|
import { log } from '../utils/log';
|
|
44
44
|
import type { StepDeps, StepModule } from './types';
|
|
45
|
-
import { toSubmissionError } from './_shared';
|
|
45
|
+
import { prefillString, toSubmissionError } from './_shared';
|
|
46
46
|
|
|
47
47
|
const ADDRESS_TYPE_HOME = 'HOME';
|
|
48
48
|
|
|
@@ -64,6 +64,8 @@ export class AddressInfoStep implements StepModule {
|
|
|
64
64
|
locale={this.deps.locale}
|
|
65
65
|
stepConfig={this.deps.stepConfig as AddressInfoStepConfig | undefined}
|
|
66
66
|
googleMapsApiKey={this.deps.googleMapsApiKey}
|
|
67
|
+
prefill={this.deps.stepResult}
|
|
68
|
+
onBack={this.deps.onBack}
|
|
67
69
|
onComplete={() => {
|
|
68
70
|
if (this.destroyed) return;
|
|
69
71
|
this.deps.ui.setNode(null);
|
|
@@ -91,6 +93,8 @@ interface ViewProps {
|
|
|
91
93
|
locale: string;
|
|
92
94
|
stepConfig: AddressInfoStepConfig | undefined;
|
|
93
95
|
googleMapsApiKey: string | undefined;
|
|
96
|
+
prefill?: Record<string, unknown> | undefined;
|
|
97
|
+
onBack?: (() => void) | undefined;
|
|
94
98
|
onComplete: () => void;
|
|
95
99
|
onCancel: (err: SdkError) => void;
|
|
96
100
|
}
|
|
@@ -183,6 +187,8 @@ function AssistedAddressFlow({
|
|
|
183
187
|
sessionId,
|
|
184
188
|
locale,
|
|
185
189
|
stepConfig,
|
|
190
|
+
prefill,
|
|
191
|
+
onBack,
|
|
186
192
|
onComplete,
|
|
187
193
|
onCancel,
|
|
188
194
|
onMapRenderFailure,
|
|
@@ -212,6 +218,8 @@ function AssistedAddressFlow({
|
|
|
212
218
|
title={t.address_info.introTitle}
|
|
213
219
|
subtitle={t.address_info.introLine1}
|
|
214
220
|
iconNode={<HomeHeartIcon />}
|
|
221
|
+
onBack={onBack}
|
|
222
|
+
backLabel={t.common.back}
|
|
215
223
|
>
|
|
216
224
|
<Text style={[styles.introBody, { color: theme.textSecondaryColor }]}>
|
|
217
225
|
{t.address_info.introLine2}
|
|
@@ -260,6 +268,7 @@ function AssistedAddressFlow({
|
|
|
260
268
|
locale={locale}
|
|
261
269
|
parsed={parsed}
|
|
262
270
|
addressType={stepConfig?.address_type?.id ?? ADDRESS_TYPE_HOME}
|
|
271
|
+
prefill={prefill}
|
|
263
272
|
onComplete={onComplete}
|
|
264
273
|
onCancel={onCancel}
|
|
265
274
|
onBack={() => setPhase('map')}
|
|
@@ -273,6 +282,7 @@ interface DetailsFormProps {
|
|
|
273
282
|
locale: string;
|
|
274
283
|
parsed: ParsedAddressFields & { latitude: number; longitude: number };
|
|
275
284
|
addressType: string;
|
|
285
|
+
prefill?: Record<string, unknown> | undefined;
|
|
276
286
|
onComplete: () => void;
|
|
277
287
|
onCancel: (err: SdkError) => void;
|
|
278
288
|
onBack: () => void;
|
|
@@ -284,15 +294,18 @@ function AddressDetailsForm({
|
|
|
284
294
|
locale,
|
|
285
295
|
parsed,
|
|
286
296
|
addressType,
|
|
297
|
+
prefill,
|
|
287
298
|
onComplete,
|
|
288
299
|
onCancel,
|
|
289
300
|
onBack,
|
|
290
301
|
}: DetailsFormProps) {
|
|
291
302
|
const t = getStrings(locale);
|
|
292
303
|
const theme = useTheme();
|
|
293
|
-
const [floor, setFloor] = useState('');
|
|
294
|
-
const [apartment, setApartment] = useState(
|
|
295
|
-
|
|
304
|
+
const [floor, setFloor] = useState(() => prefillString(prefill, 'floor'));
|
|
305
|
+
const [apartment, setApartment] = useState(() =>
|
|
306
|
+
prefillString(prefill, 'apartment'),
|
|
307
|
+
);
|
|
308
|
+
const [details, setDetails] = useState(() => prefillString(prefill, 'details'));
|
|
296
309
|
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
297
310
|
const [submitting, setSubmitting] = useState(false);
|
|
298
311
|
const [retry, setRetry] = useState<{ message: string } | null>(null);
|
|
@@ -435,25 +448,13 @@ type FieldKey =
|
|
|
435
448
|
|
|
436
449
|
type ManualForm = Record<FieldKey, string>;
|
|
437
450
|
|
|
438
|
-
const INITIAL_MANUAL: ManualForm = {
|
|
439
|
-
country: '',
|
|
440
|
-
state: '',
|
|
441
|
-
city: '',
|
|
442
|
-
district: '',
|
|
443
|
-
neighborhood: '',
|
|
444
|
-
street: '',
|
|
445
|
-
number: '',
|
|
446
|
-
zip_code: '',
|
|
447
|
-
floor: '',
|
|
448
|
-
apartment: '',
|
|
449
|
-
details: '',
|
|
450
|
-
};
|
|
451
|
-
|
|
452
451
|
function ManualAddressForm({
|
|
453
452
|
api,
|
|
454
453
|
sessionId,
|
|
455
454
|
locale,
|
|
456
455
|
stepConfig,
|
|
456
|
+
prefill,
|
|
457
|
+
onBack,
|
|
457
458
|
onComplete,
|
|
458
459
|
onCancel,
|
|
459
460
|
}: ViewProps) {
|
|
@@ -480,8 +481,22 @@ function ManualAddressForm({
|
|
|
480
481
|
);
|
|
481
482
|
|
|
482
483
|
const [form, setForm] = useState<ManualForm>(() => {
|
|
483
|
-
|
|
484
|
-
|
|
484
|
+
// Seed from prefill first (reverse navigation re-opened this step), then
|
|
485
|
+
// fall back to a single allowed country. Prefill takes precedence.
|
|
486
|
+
const base: ManualForm = {
|
|
487
|
+
country: prefillString(prefill, 'country'),
|
|
488
|
+
state: prefillString(prefill, 'state'),
|
|
489
|
+
city: prefillString(prefill, 'city'),
|
|
490
|
+
district: prefillString(prefill, 'district'),
|
|
491
|
+
neighborhood: prefillString(prefill, 'neighborhood'),
|
|
492
|
+
street: prefillString(prefill, 'street'),
|
|
493
|
+
number: prefillString(prefill, 'number'),
|
|
494
|
+
zip_code: prefillString(prefill, 'zip_code'),
|
|
495
|
+
floor: prefillString(prefill, 'floor'),
|
|
496
|
+
apartment: prefillString(prefill, 'apartment'),
|
|
497
|
+
details: prefillString(prefill, 'details'),
|
|
498
|
+
};
|
|
499
|
+
if (!base.country && allowedCodes && allowedCodes.length === 1) {
|
|
485
500
|
base.country = allowedCodes[0] ?? '';
|
|
486
501
|
}
|
|
487
502
|
return base;
|
|
@@ -584,6 +599,9 @@ function ManualAddressForm({
|
|
|
584
599
|
title={t.address_info.title}
|
|
585
600
|
subtitle={t.address_info.subtitle}
|
|
586
601
|
iconNode={<HomeHeartIcon />}
|
|
602
|
+
onBack={onBack}
|
|
603
|
+
backLabel={t.common.back}
|
|
604
|
+
backDisabled={submitting}
|
|
587
605
|
>
|
|
588
606
|
<CountrySelect
|
|
589
607
|
label={t.address_info.country}
|
|
@@ -84,6 +84,7 @@ export class DocumentsOcrStep implements StepModule {
|
|
|
84
84
|
sessionId={this.deps.sessionId}
|
|
85
85
|
locale={this.deps.locale}
|
|
86
86
|
stepConfig={this.deps.stepConfig as DocumentsOcrStepConfig | undefined}
|
|
87
|
+
onBack={this.deps.onBack}
|
|
87
88
|
onComplete={() => {
|
|
88
89
|
if (this.destroyed) return;
|
|
89
90
|
this.deps.ui.setNode(null);
|
|
@@ -110,6 +111,7 @@ interface ViewProps {
|
|
|
110
111
|
sessionId: string;
|
|
111
112
|
locale: string;
|
|
112
113
|
stepConfig: DocumentsOcrStepConfig | undefined;
|
|
114
|
+
onBack?: (() => void) | undefined;
|
|
113
115
|
onComplete: () => void;
|
|
114
116
|
onCancel: (err: SdkError) => void;
|
|
115
117
|
}
|
|
@@ -119,6 +121,7 @@ function DocumentsOcrView({
|
|
|
119
121
|
sessionId,
|
|
120
122
|
locale,
|
|
121
123
|
stepConfig,
|
|
124
|
+
onBack,
|
|
122
125
|
onComplete,
|
|
123
126
|
onCancel,
|
|
124
127
|
}: ViewProps) {
|
|
@@ -315,6 +318,8 @@ function DocumentsOcrView({
|
|
|
315
318
|
title={t.documents_ocr.introTitle}
|
|
316
319
|
subtitle={t.documents_ocr.introSubtitle}
|
|
317
320
|
iconNode={<StepIcon name="badge" />}
|
|
321
|
+
onBack={onBack}
|
|
322
|
+
backLabel={t.common.back}
|
|
318
323
|
>
|
|
319
324
|
<ScrollView style={styles.tipsScroll} contentContainerStyle={styles.tipsList}>
|
|
320
325
|
{t.documents_ocr.introTips.map((tip, idx) => (
|
|
@@ -39,6 +39,7 @@ export class EmailContactStep implements StepModule {
|
|
|
39
39
|
api={this.deps.api}
|
|
40
40
|
sessionId={this.deps.sessionId}
|
|
41
41
|
locale={this.deps.locale}
|
|
42
|
+
onBack={this.deps.onBack}
|
|
42
43
|
onComplete={() => {
|
|
43
44
|
if (this.destroyed) return;
|
|
44
45
|
this.deps.ui.setNode(null);
|
|
@@ -64,6 +65,7 @@ interface ViewProps {
|
|
|
64
65
|
api: ApiCaller;
|
|
65
66
|
sessionId: string;
|
|
66
67
|
locale: string;
|
|
68
|
+
onBack?: (() => void) | undefined;
|
|
67
69
|
onComplete: () => void;
|
|
68
70
|
onCancel: (err: SdkError) => void;
|
|
69
71
|
}
|
|
@@ -72,6 +74,7 @@ function EmailContactView({
|
|
|
72
74
|
api,
|
|
73
75
|
sessionId,
|
|
74
76
|
locale,
|
|
77
|
+
onBack,
|
|
75
78
|
onComplete,
|
|
76
79
|
onCancel,
|
|
77
80
|
}: ViewProps) {
|
|
@@ -133,6 +136,9 @@ function EmailContactView({
|
|
|
133
136
|
title={t.email_contact.title}
|
|
134
137
|
subtitle={t.email_contact.hint}
|
|
135
138
|
iconNode={<StepIcon name="mail-outline" />}
|
|
139
|
+
onBack={onBack}
|
|
140
|
+
backLabel={t.common.back}
|
|
141
|
+
backDisabled={submitting}
|
|
136
142
|
>
|
|
137
143
|
<Input
|
|
138
144
|
label={t.email_contact.label}
|
|
@@ -42,6 +42,7 @@ export class EmailOtpStep implements StepModule {
|
|
|
42
42
|
api={this.deps.api}
|
|
43
43
|
sessionId={this.deps.sessionId}
|
|
44
44
|
locale={this.deps.locale}
|
|
45
|
+
onBack={this.deps.onBack}
|
|
45
46
|
onComplete={() => {
|
|
46
47
|
if (this.destroyed) return;
|
|
47
48
|
this.deps.ui.setNode(null);
|
|
@@ -67,6 +68,7 @@ interface ViewProps {
|
|
|
67
68
|
api: ApiCaller;
|
|
68
69
|
sessionId: string;
|
|
69
70
|
locale: string;
|
|
71
|
+
onBack?: (() => void) | undefined;
|
|
70
72
|
onComplete: () => void;
|
|
71
73
|
onCancel: (err: SdkError) => void;
|
|
72
74
|
}
|
|
@@ -75,6 +77,7 @@ function EmailOtpView({
|
|
|
75
77
|
api,
|
|
76
78
|
sessionId,
|
|
77
79
|
locale,
|
|
80
|
+
onBack,
|
|
78
81
|
onComplete,
|
|
79
82
|
onCancel,
|
|
80
83
|
}: ViewProps) {
|
|
@@ -170,6 +173,9 @@ function EmailOtpView({
|
|
|
170
173
|
title={t.email_otp.title}
|
|
171
174
|
subtitle={t.email_otp.emailHint}
|
|
172
175
|
iconNode={<StepIcon name="mail-outline" />}
|
|
176
|
+
onBack={stage === 'request' ? onBack : undefined}
|
|
177
|
+
backLabel={t.common.back}
|
|
178
|
+
backDisabled={busy !== null}
|
|
173
179
|
>
|
|
174
180
|
<Input
|
|
175
181
|
label={t.email_otp.emailLabel}
|
|
@@ -36,6 +36,7 @@ import { resolveDocumentOptionsFromStepConfig } from '../utils/stepConfig';
|
|
|
36
36
|
import { normalizePersonNameSegment } from '../utils/personNameNormalize';
|
|
37
37
|
import type { ApiCaller } from '../transport/api';
|
|
38
38
|
import type { StepDeps, StepModule } from './types';
|
|
39
|
+
import { prefillString } from './_shared';
|
|
39
40
|
|
|
40
41
|
interface FormState {
|
|
41
42
|
first_name: string;
|
|
@@ -61,6 +62,8 @@ export class HumanBasicInfoStep implements StepModule {
|
|
|
61
62
|
sessionId={this.deps.sessionId}
|
|
62
63
|
locale={this.deps.locale}
|
|
63
64
|
stepConfig={this.deps.stepConfig as HumanBasicInfoStepConfig | undefined}
|
|
65
|
+
prefill={this.deps.stepResult}
|
|
66
|
+
onBack={this.deps.onBack}
|
|
64
67
|
onComplete={() => {
|
|
65
68
|
if (this.destroyed) return;
|
|
66
69
|
this.deps.ui.setNode(null);
|
|
@@ -87,6 +90,8 @@ interface ViewProps {
|
|
|
87
90
|
sessionId: string;
|
|
88
91
|
locale: string;
|
|
89
92
|
stepConfig: HumanBasicInfoStepConfig | undefined;
|
|
93
|
+
prefill?: Record<string, unknown> | undefined;
|
|
94
|
+
onBack?: (() => void) | undefined;
|
|
90
95
|
onComplete: () => void;
|
|
91
96
|
onCancel: (err: SdkError) => void;
|
|
92
97
|
}
|
|
@@ -96,6 +101,8 @@ function HumanBasicInfoView({
|
|
|
96
101
|
sessionId,
|
|
97
102
|
locale,
|
|
98
103
|
stepConfig,
|
|
104
|
+
prefill,
|
|
105
|
+
onBack,
|
|
99
106
|
onComplete,
|
|
100
107
|
onCancel,
|
|
101
108
|
}: ViewProps) {
|
|
@@ -107,10 +114,12 @@ function HumanBasicInfoView({
|
|
|
107
114
|
}, [stepConfig, locale]);
|
|
108
115
|
|
|
109
116
|
const [form, setForm] = useState<FormState>(() => ({
|
|
110
|
-
first_name: '',
|
|
111
|
-
last_name: '',
|
|
112
|
-
identification_type:
|
|
113
|
-
|
|
117
|
+
first_name: prefillString(prefill, 'first_name'),
|
|
118
|
+
last_name: prefillString(prefill, 'last_name'),
|
|
119
|
+
identification_type:
|
|
120
|
+
prefillString(prefill, 'identification_type') ||
|
|
121
|
+
(documentOptions[0]?.value ?? ''),
|
|
122
|
+
identification_id: prefillString(prefill, 'identification_id'),
|
|
114
123
|
}));
|
|
115
124
|
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
116
125
|
const [submitting, setSubmitting] = useState(false);
|
|
@@ -199,6 +208,9 @@ function HumanBasicInfoView({
|
|
|
199
208
|
title={t.human_basic_info.title}
|
|
200
209
|
subtitle={t.human_basic_info.subtitle}
|
|
201
210
|
iconNode={<StepIcon name="badge" />}
|
|
211
|
+
onBack={onBack}
|
|
212
|
+
backLabel={t.common.back}
|
|
213
|
+
backDisabled={submitting}
|
|
202
214
|
>
|
|
203
215
|
<Input
|
|
204
216
|
label={t.human_basic_info.givenNames}
|
|
@@ -32,7 +32,7 @@ import { StepIcon } from '../ui/icons/StepIcon';
|
|
|
32
32
|
import { getStrings } from '../i18n';
|
|
33
33
|
import type { ApiCaller } from '../transport/api';
|
|
34
34
|
import type { StepDeps, StepModule } from './types';
|
|
35
|
-
import { toSubmissionError } from './_shared';
|
|
35
|
+
import { prefillString, prefillStringOrNull, toSubmissionError } from './_shared';
|
|
36
36
|
|
|
37
37
|
export class HumanExtendedInfoStep implements StepModule {
|
|
38
38
|
private resolveStep!: () => void;
|
|
@@ -53,6 +53,8 @@ export class HumanExtendedInfoStep implements StepModule {
|
|
|
53
53
|
stepConfig={
|
|
54
54
|
this.deps.stepConfig as HumanExtendedInfoStepConfig | undefined
|
|
55
55
|
}
|
|
56
|
+
prefill={this.deps.stepResult}
|
|
57
|
+
onBack={this.deps.onBack}
|
|
56
58
|
onComplete={() => {
|
|
57
59
|
if (this.destroyed) return;
|
|
58
60
|
this.deps.ui.setNode(null);
|
|
@@ -105,6 +107,8 @@ interface ViewProps {
|
|
|
105
107
|
sessionId: string;
|
|
106
108
|
locale: string;
|
|
107
109
|
stepConfig: HumanExtendedInfoStepConfig | undefined;
|
|
110
|
+
prefill?: Record<string, unknown> | undefined;
|
|
111
|
+
onBack?: (() => void) | undefined;
|
|
108
112
|
onComplete: () => void;
|
|
109
113
|
onCancel: (err: SdkError) => void;
|
|
110
114
|
}
|
|
@@ -114,6 +118,8 @@ function HumanExtendedInfoView({
|
|
|
114
118
|
sessionId,
|
|
115
119
|
locale,
|
|
116
120
|
stepConfig,
|
|
121
|
+
prefill,
|
|
122
|
+
onBack,
|
|
117
123
|
onComplete,
|
|
118
124
|
onCancel,
|
|
119
125
|
}: ViewProps) {
|
|
@@ -145,14 +151,14 @@ function HumanExtendedInfoView({
|
|
|
145
151
|
[f?.civil_status?.options, stepConfig?.civil_status_options],
|
|
146
152
|
);
|
|
147
153
|
|
|
148
|
-
const [form, setForm] = useState<FormState>({
|
|
149
|
-
gender: '',
|
|
150
|
-
civil_status: '',
|
|
151
|
-
birth_date:
|
|
152
|
-
birth_country:
|
|
153
|
-
citizenship:
|
|
154
|
-
residence_country:
|
|
155
|
-
});
|
|
154
|
+
const [form, setForm] = useState<FormState>(() => ({
|
|
155
|
+
gender: prefillString(prefill, 'gender'),
|
|
156
|
+
civil_status: prefillString(prefill, 'civil_status'),
|
|
157
|
+
birth_date: prefillStringOrNull(prefill, 'birth_date'),
|
|
158
|
+
birth_country: prefillStringOrNull(prefill, 'birth_country'),
|
|
159
|
+
citizenship: prefillStringOrNull(prefill, 'citizenship'),
|
|
160
|
+
residence_country: prefillStringOrNull(prefill, 'residence_country'),
|
|
161
|
+
}));
|
|
156
162
|
const [errors, setErrors] = useState<Partial<Record<keyof FormState, string>>>({});
|
|
157
163
|
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
158
164
|
const [submitting, setSubmitting] = useState(false);
|
|
@@ -270,6 +276,9 @@ function HumanExtendedInfoView({
|
|
|
270
276
|
title={t.human_extended_info.title}
|
|
271
277
|
subtitle={t.human_extended_info.subtitle}
|
|
272
278
|
iconNode={<StepIcon name="person" />}
|
|
279
|
+
onBack={onBack}
|
|
280
|
+
backLabel={t.common.back}
|
|
281
|
+
backDisabled={submitting}
|
|
273
282
|
>
|
|
274
283
|
{showGender ? (
|
|
275
284
|
<Select
|
|
@@ -23,7 +23,7 @@ import { required, useInlineValidation } from '../ui/forms';
|
|
|
23
23
|
import { getStrings } from '../i18n';
|
|
24
24
|
import type { ApiCaller } from '../transport/api';
|
|
25
25
|
import type { StepDeps, StepModule } from './types';
|
|
26
|
-
import { toSubmissionError } from './_shared';
|
|
26
|
+
import { prefillString, toSubmissionError } from './_shared';
|
|
27
27
|
|
|
28
28
|
export class LegalBasicInfoStep implements StepModule {
|
|
29
29
|
private resolveStep!: () => void;
|
|
@@ -41,6 +41,8 @@ export class LegalBasicInfoStep implements StepModule {
|
|
|
41
41
|
api={this.deps.api}
|
|
42
42
|
sessionId={this.deps.sessionId}
|
|
43
43
|
locale={this.deps.locale}
|
|
44
|
+
prefill={this.deps.stepResult}
|
|
45
|
+
onBack={this.deps.onBack}
|
|
44
46
|
onComplete={() => {
|
|
45
47
|
if (this.destroyed) return;
|
|
46
48
|
this.deps.ui.setNode(null);
|
|
@@ -73,6 +75,8 @@ interface ViewProps {
|
|
|
73
75
|
api: ApiCaller;
|
|
74
76
|
sessionId: string;
|
|
75
77
|
locale: string;
|
|
78
|
+
prefill?: Record<string, unknown> | undefined;
|
|
79
|
+
onBack?: (() => void) | undefined;
|
|
76
80
|
onComplete: () => void;
|
|
77
81
|
onCancel: (err: SdkError) => void;
|
|
78
82
|
}
|
|
@@ -81,16 +85,18 @@ function LegalBasicInfoView({
|
|
|
81
85
|
api,
|
|
82
86
|
sessionId,
|
|
83
87
|
locale,
|
|
88
|
+
prefill,
|
|
89
|
+
onBack,
|
|
84
90
|
onComplete,
|
|
85
91
|
onCancel,
|
|
86
92
|
}: ViewProps) {
|
|
87
93
|
const t = getStrings(locale);
|
|
88
|
-
const [form, setForm] = useState<FormState>({
|
|
89
|
-
legal_name: '',
|
|
90
|
-
legal_form: '',
|
|
91
|
-
identification_type: '',
|
|
92
|
-
identification_id: '',
|
|
93
|
-
});
|
|
94
|
+
const [form, setForm] = useState<FormState>(() => ({
|
|
95
|
+
legal_name: prefillString(prefill, 'legal_name'),
|
|
96
|
+
legal_form: prefillString(prefill, 'legal_form'),
|
|
97
|
+
identification_type: prefillString(prefill, 'identification_type'),
|
|
98
|
+
identification_id: prefillString(prefill, 'identification_id'),
|
|
99
|
+
}));
|
|
94
100
|
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
95
101
|
const [submitting, setSubmitting] = useState(false);
|
|
96
102
|
const [retry, setRetry] = useState<{ message: string } | null>(null);
|
|
@@ -156,6 +162,9 @@ function LegalBasicInfoView({
|
|
|
156
162
|
title={t.legal_basic_info.title}
|
|
157
163
|
subtitle={t.legal_basic_info.subtitle}
|
|
158
164
|
iconNode={<StepIcon name="business" />}
|
|
165
|
+
onBack={onBack}
|
|
166
|
+
backLabel={t.common.back}
|
|
167
|
+
backDisabled={submitting}
|
|
159
168
|
>
|
|
160
169
|
<Input
|
|
161
170
|
label={t.legal_basic_info.legalName}
|
|
@@ -23,7 +23,7 @@ import { StepIcon } from '../ui/icons/StepIcon';
|
|
|
23
23
|
import { getStrings } from '../i18n';
|
|
24
24
|
import type { ApiCaller } from '../transport/api';
|
|
25
25
|
import type { StepDeps, StepModule } from './types';
|
|
26
|
-
import { toSubmissionError } from './_shared';
|
|
26
|
+
import { prefillStringOrNull, toSubmissionError } from './_shared';
|
|
27
27
|
|
|
28
28
|
export class LegalExtendedInfoStep implements StepModule {
|
|
29
29
|
private resolveStep!: () => void;
|
|
@@ -41,6 +41,8 @@ export class LegalExtendedInfoStep implements StepModule {
|
|
|
41
41
|
api={this.deps.api}
|
|
42
42
|
sessionId={this.deps.sessionId}
|
|
43
43
|
locale={this.deps.locale}
|
|
44
|
+
prefill={this.deps.stepResult}
|
|
45
|
+
onBack={this.deps.onBack}
|
|
44
46
|
onComplete={() => {
|
|
45
47
|
if (this.destroyed) return;
|
|
46
48
|
this.deps.ui.setNode(null);
|
|
@@ -66,6 +68,8 @@ interface ViewProps {
|
|
|
66
68
|
api: ApiCaller;
|
|
67
69
|
sessionId: string;
|
|
68
70
|
locale: string;
|
|
71
|
+
prefill?: Record<string, unknown> | undefined;
|
|
72
|
+
onBack?: (() => void) | undefined;
|
|
69
73
|
onComplete: () => void;
|
|
70
74
|
onCancel: (err: SdkError) => void;
|
|
71
75
|
}
|
|
@@ -74,12 +78,18 @@ function LegalExtendedInfoView({
|
|
|
74
78
|
api,
|
|
75
79
|
sessionId,
|
|
76
80
|
locale,
|
|
81
|
+
prefill,
|
|
82
|
+
onBack,
|
|
77
83
|
onComplete,
|
|
78
84
|
onCancel,
|
|
79
85
|
}: ViewProps) {
|
|
80
86
|
const t = getStrings(locale);
|
|
81
|
-
const [date, setDate] = useState<string | null>(
|
|
82
|
-
|
|
87
|
+
const [date, setDate] = useState<string | null>(() =>
|
|
88
|
+
prefillStringOrNull(prefill, 'incorporation_date'),
|
|
89
|
+
);
|
|
90
|
+
const [country, setCountry] = useState<string | null>(() =>
|
|
91
|
+
prefillStringOrNull(prefill, 'incorporation_country'),
|
|
92
|
+
);
|
|
83
93
|
const [errors, setErrors] = useState<{ date?: string | undefined; country?: string | undefined }>({});
|
|
84
94
|
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
85
95
|
const [submitting, setSubmitting] = useState(false);
|
|
@@ -132,6 +142,9 @@ function LegalExtendedInfoView({
|
|
|
132
142
|
title={t.legal_extended_info.title}
|
|
133
143
|
subtitle={t.legal_extended_info.subtitle}
|
|
134
144
|
iconNode={<StepIcon name="business-center" />}
|
|
145
|
+
onBack={onBack}
|
|
146
|
+
backLabel={t.common.back}
|
|
147
|
+
backDisabled={submitting}
|
|
135
148
|
>
|
|
136
149
|
<DatePicker
|
|
137
150
|
label={t.legal_extended_info.incorporationDate}
|
|
@@ -39,6 +39,7 @@ export class PhoneContactStep implements StepModule {
|
|
|
39
39
|
api={this.deps.api}
|
|
40
40
|
sessionId={this.deps.sessionId}
|
|
41
41
|
locale={this.deps.locale}
|
|
42
|
+
onBack={this.deps.onBack}
|
|
42
43
|
onComplete={() => {
|
|
43
44
|
if (this.destroyed) return;
|
|
44
45
|
this.deps.ui.setNode(null);
|
|
@@ -64,6 +65,7 @@ interface ViewProps {
|
|
|
64
65
|
api: ApiCaller;
|
|
65
66
|
sessionId: string;
|
|
66
67
|
locale: string;
|
|
68
|
+
onBack?: (() => void) | undefined;
|
|
67
69
|
onComplete: () => void;
|
|
68
70
|
onCancel: (err: SdkError) => void;
|
|
69
71
|
}
|
|
@@ -72,6 +74,7 @@ function PhoneContactView({
|
|
|
72
74
|
api,
|
|
73
75
|
sessionId,
|
|
74
76
|
locale,
|
|
77
|
+
onBack,
|
|
75
78
|
onComplete,
|
|
76
79
|
onCancel,
|
|
77
80
|
}: ViewProps) {
|
|
@@ -133,6 +136,9 @@ function PhoneContactView({
|
|
|
133
136
|
title={t.phone_contact.title}
|
|
134
137
|
subtitle={t.phone_contact.hint}
|
|
135
138
|
iconNode={<StepIcon name="phone-iphone" />}
|
|
139
|
+
onBack={onBack}
|
|
140
|
+
backLabel={t.common.back}
|
|
141
|
+
backDisabled={submitting}
|
|
136
142
|
>
|
|
137
143
|
<Input
|
|
138
144
|
label={t.phone_contact.label}
|
|
@@ -40,6 +40,7 @@ export class PhoneOtpStep implements StepModule {
|
|
|
40
40
|
api={this.deps.api}
|
|
41
41
|
sessionId={this.deps.sessionId}
|
|
42
42
|
locale={this.deps.locale}
|
|
43
|
+
onBack={this.deps.onBack}
|
|
43
44
|
onComplete={() => {
|
|
44
45
|
if (this.destroyed) return;
|
|
45
46
|
this.deps.ui.setNode(null);
|
|
@@ -65,6 +66,7 @@ interface ViewProps {
|
|
|
65
66
|
api: ApiCaller;
|
|
66
67
|
sessionId: string;
|
|
67
68
|
locale: string;
|
|
69
|
+
onBack?: (() => void) | undefined;
|
|
68
70
|
onComplete: () => void;
|
|
69
71
|
onCancel: (err: SdkError) => void;
|
|
70
72
|
}
|
|
@@ -73,6 +75,7 @@ function PhoneOtpView({
|
|
|
73
75
|
api,
|
|
74
76
|
sessionId,
|
|
75
77
|
locale,
|
|
78
|
+
onBack,
|
|
76
79
|
onComplete,
|
|
77
80
|
onCancel,
|
|
78
81
|
}: ViewProps) {
|
|
@@ -168,6 +171,9 @@ function PhoneOtpView({
|
|
|
168
171
|
title={t.phone_otp.title}
|
|
169
172
|
subtitle={t.phone_otp.phoneHint}
|
|
170
173
|
iconNode={<StepIcon name="phone-iphone" />}
|
|
174
|
+
onBack={stage === 'request' ? onBack : undefined}
|
|
175
|
+
backLabel={t.common.back}
|
|
176
|
+
backDisabled={busy !== null}
|
|
171
177
|
>
|
|
172
178
|
<Input
|
|
173
179
|
label={t.phone_otp.phoneLabel}
|
|
@@ -27,6 +27,14 @@ import type { ApiCaller } from '../transport/api';
|
|
|
27
27
|
import type { StepDeps, StepModule } from './types';
|
|
28
28
|
import { toSubmissionError } from './_shared';
|
|
29
29
|
|
|
30
|
+
/** Reads a boolean field from a step's prefill `result` map (reverse navigation). */
|
|
31
|
+
function prefillBool(
|
|
32
|
+
result: Record<string, unknown> | undefined,
|
|
33
|
+
key: string,
|
|
34
|
+
): boolean {
|
|
35
|
+
return result?.[key] === true;
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
export class SwornDeclarationStep implements StepModule {
|
|
31
39
|
private resolveStep!: () => void;
|
|
32
40
|
private rejectStep!: (err: SdkError) => void;
|
|
@@ -44,6 +52,8 @@ export class SwornDeclarationStep implements StepModule {
|
|
|
44
52
|
sessionId={this.deps.sessionId}
|
|
45
53
|
locale={this.deps.locale}
|
|
46
54
|
stepConfig={this.deps.stepConfig as SwornDeclarationStepConfig | undefined}
|
|
55
|
+
prefill={this.deps.stepResult}
|
|
56
|
+
onBack={this.deps.onBack}
|
|
47
57
|
onComplete={() => {
|
|
48
58
|
if (this.destroyed) return;
|
|
49
59
|
this.deps.ui.setNode(null);
|
|
@@ -72,6 +82,8 @@ interface ViewProps {
|
|
|
72
82
|
sessionId: string;
|
|
73
83
|
locale: string;
|
|
74
84
|
stepConfig: SwornDeclarationStepConfig | undefined;
|
|
85
|
+
prefill?: Record<string, unknown> | undefined;
|
|
86
|
+
onBack?: (() => void) | undefined;
|
|
75
87
|
onComplete: () => void;
|
|
76
88
|
onCancel: (err: SdkError) => void;
|
|
77
89
|
}
|
|
@@ -81,6 +93,8 @@ function SwornDeclarationView({
|
|
|
81
93
|
sessionId,
|
|
82
94
|
locale,
|
|
83
95
|
stepConfig,
|
|
96
|
+
prefill,
|
|
97
|
+
onBack,
|
|
84
98
|
onComplete,
|
|
85
99
|
onCancel,
|
|
86
100
|
}: ViewProps) {
|
|
@@ -95,12 +109,12 @@ function SwornDeclarationView({
|
|
|
95
109
|
return out;
|
|
96
110
|
}, [stepConfig]);
|
|
97
111
|
|
|
98
|
-
const [values, setValues] = useState<Record<DeclarationKey, boolean>>({
|
|
99
|
-
is_pep:
|
|
100
|
-
is_ssoo:
|
|
101
|
-
is_fatca:
|
|
102
|
-
is_ocde:
|
|
103
|
-
});
|
|
112
|
+
const [values, setValues] = useState<Record<DeclarationKey, boolean>>(() => ({
|
|
113
|
+
is_pep: prefillBool(prefill, 'is_pep'),
|
|
114
|
+
is_ssoo: prefillBool(prefill, 'is_ssoo'),
|
|
115
|
+
is_fatca: prefillBool(prefill, 'is_fatca'),
|
|
116
|
+
is_ocde: prefillBool(prefill, 'is_ocde'),
|
|
117
|
+
}));
|
|
104
118
|
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
105
119
|
const [submitting, setSubmitting] = useState(false);
|
|
106
120
|
const [retry, setRetry] = useState<{ message: string } | null>(null);
|
|
@@ -162,6 +176,9 @@ function SwornDeclarationView({
|
|
|
162
176
|
<StepShell
|
|
163
177
|
title={t.sworn_declaration.title}
|
|
164
178
|
subtitle={t.sworn_declaration.subtitle}
|
|
179
|
+
onBack={onBack}
|
|
180
|
+
backLabel={t.common.back}
|
|
181
|
+
backDisabled={submitting}
|
|
165
182
|
>
|
|
166
183
|
{visibleKeys.includes('is_pep') ? (
|
|
167
184
|
<Checkbox
|
|
@@ -30,7 +30,7 @@ import { getStrings } from '../i18n';
|
|
|
30
30
|
import { resolveTaxInfoConfig } from '../utils/taxInfoConfig';
|
|
31
31
|
import type { ApiCaller } from '../transport/api';
|
|
32
32
|
import type { StepDeps, StepModule } from './types';
|
|
33
|
-
import { toSubmissionError } from './_shared';
|
|
33
|
+
import { prefillString, toSubmissionError } from './_shared';
|
|
34
34
|
|
|
35
35
|
export class TaxInfoStep implements StepModule {
|
|
36
36
|
private resolveStep!: () => void;
|
|
@@ -49,6 +49,8 @@ export class TaxInfoStep implements StepModule {
|
|
|
49
49
|
sessionId={this.deps.sessionId}
|
|
50
50
|
locale={this.deps.locale}
|
|
51
51
|
stepConfig={this.deps.stepConfig as TaxInfoStepConfig | undefined}
|
|
52
|
+
prefill={this.deps.stepResult}
|
|
53
|
+
onBack={this.deps.onBack}
|
|
52
54
|
onComplete={() => {
|
|
53
55
|
if (this.destroyed) return;
|
|
54
56
|
this.deps.ui.setNode(null);
|
|
@@ -108,6 +110,8 @@ interface ViewProps {
|
|
|
108
110
|
sessionId: string;
|
|
109
111
|
locale: string;
|
|
110
112
|
stepConfig: TaxInfoStepConfig | undefined;
|
|
113
|
+
prefill?: Record<string, unknown> | undefined;
|
|
114
|
+
onBack?: (() => void) | undefined;
|
|
111
115
|
onComplete: () => void;
|
|
112
116
|
onCancel: (err: SdkError) => void;
|
|
113
117
|
}
|
|
@@ -117,6 +121,8 @@ function TaxInfoView({
|
|
|
117
121
|
sessionId,
|
|
118
122
|
locale,
|
|
119
123
|
stepConfig,
|
|
124
|
+
prefill,
|
|
125
|
+
onBack,
|
|
120
126
|
onComplete,
|
|
121
127
|
onCancel,
|
|
122
128
|
}: ViewProps) {
|
|
@@ -159,9 +165,11 @@ function TaxInfoView({
|
|
|
159
165
|
}, [stepConfig]);
|
|
160
166
|
|
|
161
167
|
const [form, setForm] = useState<FormState>(() => ({
|
|
162
|
-
taxpayer_type:
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
taxpayer_type:
|
|
169
|
+
prefillString(prefill, 'taxpayer_type') || (categoryOptions[0]?.value ?? ''),
|
|
170
|
+
taxpayer_id_type:
|
|
171
|
+
prefillString(prefill, 'taxpayer_id_type') || (idTypeOptions[0]?.value ?? ''),
|
|
172
|
+
taxpayer_id: prefillString(prefill, 'taxpayer_id'),
|
|
165
173
|
}));
|
|
166
174
|
const [bannerError, setBannerError] = useState<string | null>(null);
|
|
167
175
|
const [submitting, setSubmitting] = useState(false);
|
|
@@ -232,6 +240,9 @@ function TaxInfoView({
|
|
|
232
240
|
title={t.tax_info.title}
|
|
233
241
|
subtitle={t.tax_info.subtitle}
|
|
234
242
|
iconNode={<StepIcon name="receipt-long" />}
|
|
243
|
+
onBack={onBack}
|
|
244
|
+
backLabel={t.common.back}
|
|
245
|
+
backDisabled={submitting}
|
|
235
246
|
>
|
|
236
247
|
<Select
|
|
237
248
|
label={t.tax_info.taxpayerType}
|