@redneckz/wildless-cms-uni-blocks 0.14.635 → 0.14.637
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/bundle/api/RetailAPI/updateProfileEsia.d.ts +7 -7
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +149 -49
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
- package/bundle/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/bundle/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/bundle/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/dist/api/RetailAPI/updateProfileEsia.d.ts +7 -7
- package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
- package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +52 -0
- package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/dist/components/CreditForm/creditFormStepsData.js +16 -7
- package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/dist/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/dist/components/CreditForm/getInitialFormState.js +1 -0
- package/dist/components/CreditForm/getInitialFormState.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/AddressFactField.js +42 -0
- package/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
- package/dist/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/AddressMatchField.js +11 -0
- package/dist/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
- package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/dist/ui-kit/FormField/getField.js +4 -1
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +1 -0
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/dist/ui-kit/Input/InputControl.js +2 -2
- package/dist/ui-kit/Input/InputControl.js.map +1 -1
- package/lib/api/RetailAPI/updateProfileEsia.d.ts +7 -7
- package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
- package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +49 -0
- package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/lib/components/CreditForm/creditFormStepsData.js +16 -7
- package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/lib/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/lib/components/CreditForm/getInitialFormState.js +1 -0
- package/lib/components/CreditForm/getInitialFormState.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/AddressFactField.js +40 -0
- package/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
- package/lib/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/AddressMatchField.js +9 -0
- package/lib/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
- package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/lib/ui-kit/FormField/getField.js +4 -1
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +1 -0
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/ui-kit/Input/InputControl.js +2 -2
- package/lib/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/bundle/api/RetailAPI/updateProfileEsia.d.ts +7 -7
- package/mobile/bundle/bundle.umd.js +149 -49
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/mobile/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
- package/mobile/bundle/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/mobile/bundle/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/dist/api/RetailAPI/updateProfileEsia.d.ts +7 -7
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
- package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +52 -0
- package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/dist/components/CreditForm/creditFormStepsData.js +16 -7
- package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/dist/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/mobile/dist/components/CreditForm/getInitialFormState.js +1 -0
- package/mobile/dist/components/CreditForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js +42 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressMatchField.js +11 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/getField.js +4 -1
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -0
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/dist/ui-kit/Input/InputControl.js +2 -2
- package/mobile/dist/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/lib/api/RetailAPI/updateProfileEsia.d.ts +7 -7
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
- package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +49 -0
- package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/lib/components/CreditForm/creditFormStepsData.js +16 -7
- package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/lib/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/mobile/lib/components/CreditForm/getInitialFormState.js +1 -0
- package/mobile/lib/components/CreditForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js +40 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressMatchField.js +9 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/getField.js +4 -1
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +1 -0
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/ui-kit/Input/InputControl.js +2 -2
- package/mobile/lib/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/src/api/RetailAPI/updateProfileEsia.ts +7 -7
- package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -0
- package/mobile/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +69 -0
- package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -3
- package/mobile/src/components/CreditForm/creditFormStepsData.tsx +16 -7
- package/mobile/src/components/CreditForm/getInitialFormState.tsx +3 -0
- package/mobile/src/ui-kit/FormField/Fields/AddressFactField.tsx +55 -0
- package/mobile/src/ui-kit/FormField/Fields/AddressMatchField.tsx +14 -0
- package/mobile/src/ui-kit/FormField/NameFieldDef.ts +2 -1
- package/mobile/src/ui-kit/FormField/getField.tsx +4 -1
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
- package/mobile/src/ui-kit/Input/InputControl.tsx +2 -0
- package/package.json +1 -1
- package/src/api/RetailAPI/updateProfileEsia.ts +7 -7
- package/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -0
- package/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +69 -0
- package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -3
- package/src/components/CreditForm/creditFormStepsData.tsx +16 -7
- package/src/components/CreditForm/getInitialFormState.tsx +3 -0
- package/src/ui-kit/FormField/Fields/AddressFactField.tsx +55 -0
- package/src/ui-kit/FormField/Fields/AddressMatchField.tsx +14 -0
- package/src/ui-kit/FormField/NameFieldDef.ts +2 -1
- package/src/ui-kit/FormField/getField.tsx +4 -1
- package/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
- package/src/ui-kit/Input/InputControl.tsx +2 -0
|
@@ -44,7 +44,10 @@ export const stepsSectionsMap: SectionsProps[][] = [
|
|
|
44
44
|
inputs: [],
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
inputs: [
|
|
47
|
+
inputs: [
|
|
48
|
+
{ fieldType: 'common', name: 'addressRegistration', required: true, dadata: true },
|
|
49
|
+
{ fieldType: 'common', name: 'addressMatch' },
|
|
50
|
+
],
|
|
48
51
|
},
|
|
49
52
|
{
|
|
50
53
|
columns: 2,
|
|
@@ -52,11 +55,14 @@ export const stepsSectionsMap: SectionsProps[][] = [
|
|
|
52
55
|
},
|
|
53
56
|
{
|
|
54
57
|
title: 'Адрес фактического проживания (место пребывания РФ)',
|
|
58
|
+
inputs: [],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
55
61
|
columns: 2,
|
|
56
|
-
inputs: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
],
|
|
62
|
+
inputs: [{ fieldType: 'common', name: 'housing' }],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
inputs: [{ fieldType: 'common', name: 'addressFact', required: true, dadata: true }],
|
|
60
66
|
},
|
|
61
67
|
],
|
|
62
68
|
[
|
|
@@ -141,8 +147,11 @@ export const stepsSectionsMap: SectionsProps[][] = [
|
|
|
141
147
|
inputs: [{ fieldType: 'common', name: 'dependents', required: true }],
|
|
142
148
|
},
|
|
143
149
|
{
|
|
144
|
-
columns:
|
|
145
|
-
inputs: [
|
|
150
|
+
columns: 2,
|
|
151
|
+
inputs: [
|
|
152
|
+
{ fieldType: 'common', name: 'familyMembers', required: true },
|
|
153
|
+
{ fieldType: 'common', name: 'children', required: true },
|
|
154
|
+
],
|
|
146
155
|
},
|
|
147
156
|
{
|
|
148
157
|
title: 'Совокупный доход',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len, max-lines */
|
|
1
2
|
import type { Option } from '../../ui-kit/Select/Option';
|
|
2
3
|
import { type Address } from '../ApplicationLeadForm/getInitialFormState';
|
|
3
4
|
|
|
@@ -17,6 +18,7 @@ export interface FormStateMap {
|
|
|
17
18
|
dulSubdivisionCode?: string;
|
|
18
19
|
dulIssuedBy?: string;
|
|
19
20
|
addressRegistration?: Address;
|
|
21
|
+
addressMatch?: boolean;
|
|
20
22
|
participantDateRegistration?: Date;
|
|
21
23
|
addressFact?: Address;
|
|
22
24
|
housing?: string;
|
|
@@ -81,6 +83,7 @@ const formStateMap: FormStateMap = {
|
|
|
81
83
|
fullAddress: '',
|
|
82
84
|
fiasCode: '',
|
|
83
85
|
},
|
|
86
|
+
addressMatch: false,
|
|
84
87
|
participantDateRegistration: undefined,
|
|
85
88
|
addressFact: {
|
|
86
89
|
fullAddress: '',
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { type DaDataSuggestion } from '../../../api/dadataHints/dadataHintsType';
|
|
4
|
+
import { InputControl } from '../../Input/InputControl';
|
|
5
|
+
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
6
|
+
import { validatorObj } from '../getObjectValidator';
|
|
7
|
+
import { getValidation } from '../getValidation';
|
|
8
|
+
|
|
9
|
+
export const AddressFactField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
10
|
+
const fieldName = 'addressFact';
|
|
11
|
+
const fieldValue = field(fieldName).value;
|
|
12
|
+
const { value } = field('addressMatch');
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (value) {
|
|
16
|
+
field('addressFact')?.onChange?.(field('addressRegistration').value);
|
|
17
|
+
}
|
|
18
|
+
}, [value]);
|
|
19
|
+
|
|
20
|
+
const onDaDataChange = useCallback((item: DaDataSuggestion) => {
|
|
21
|
+
field?.(fieldName)?.onChange?.({
|
|
22
|
+
apartment: item?.data?.flat,
|
|
23
|
+
city: item?.data?.city,
|
|
24
|
+
district: item?.data?.area_with_type,
|
|
25
|
+
fullAddress: item?.value,
|
|
26
|
+
fiasCode: item?.data?.fias_id,
|
|
27
|
+
house: item?.data?.house,
|
|
28
|
+
locality: item?.data?.settlement_with_type,
|
|
29
|
+
okatoRegionCode: item?.data?.okato,
|
|
30
|
+
postcode: item?.data?.postal_code,
|
|
31
|
+
region: item?.data?.region,
|
|
32
|
+
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
33
|
+
street: item?.data?.house,
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
const onChange = useCallback((val: string) => {
|
|
38
|
+
field?.(fieldName)?.onChange?.({
|
|
39
|
+
...field(fieldName).value,
|
|
40
|
+
fullAddress: val,
|
|
41
|
+
});
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<InputControl
|
|
46
|
+
label="Адрес"
|
|
47
|
+
disabled={value}
|
|
48
|
+
{...getValidation(field(fieldName), validatorObj[fieldName], input?.required)}
|
|
49
|
+
value={fieldValue.fullAddress}
|
|
50
|
+
onChange={onChange}
|
|
51
|
+
{...input}
|
|
52
|
+
onDaDataChange={onDaDataChange}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { CheckboxWithError } from '../../Checkbox/CheckboxWithError';
|
|
3
|
+
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
4
|
+
import { validatorObj } from '../getObjectValidator';
|
|
5
|
+
import { getValidation } from '../getValidation';
|
|
6
|
+
|
|
7
|
+
export const AddressMatchField = JSX<CustomFieldProps>(({ field }) => {
|
|
8
|
+
return (
|
|
9
|
+
<CheckboxWithError
|
|
10
|
+
text="Адрес фактического места жительства совпадает с адресом регистрации"
|
|
11
|
+
{...getValidation(field('addressMatch'), validatorObj.addressMatch)}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
});
|
|
@@ -5,7 +5,9 @@ import { type FormFieldRegisterer } from '../../hooks/useForm';
|
|
|
5
5
|
import { InputControl } from '../Input/InputControl';
|
|
6
6
|
import { AcquiringField } from './Fields/AcquiringField';
|
|
7
7
|
import { AddressBranchField } from './Fields/AddressBranchField';
|
|
8
|
+
import { AddressFactField } from './Fields/AddressFactField';
|
|
8
9
|
import { AddressField } from './Fields/AddressField';
|
|
10
|
+
import { AddressMatchField } from './Fields/AddressMatchField';
|
|
9
11
|
import { AmountField } from './Fields/AmountField';
|
|
10
12
|
import { AmountWorkersField } from './Fields/AmountWorkersField';
|
|
11
13
|
import { AnnualRevenueField } from './Fields/AnnualRevenueField';
|
|
@@ -107,7 +109,7 @@ export const getField =
|
|
|
107
109
|
experience5Years: <Experience5YearsField field={field} input={input} />,
|
|
108
110
|
jobsNumber: <JobsNumberField field={field} input={input} />,
|
|
109
111
|
beginDate: <BeginDateField field={field} input={input} />,
|
|
110
|
-
addressFact: <
|
|
112
|
+
addressFact: <AddressFactField field={field} input={input} />,
|
|
111
113
|
organizationAddress: <AddressField field={field} input={input} />,
|
|
112
114
|
comment: <CommentField field={field} input={input} />,
|
|
113
115
|
addressBranch: <AddressBranchField field={field} input={input} isPremium={isPremium} />,
|
|
@@ -184,6 +186,7 @@ export const getField =
|
|
|
184
186
|
partInBusiness: <PartInBusinessField field={field} input={input} />,
|
|
185
187
|
regionRetail: <RetailRegionField field={field} input={input} />,
|
|
186
188
|
addressRetail: <RetailAddressField field={field} input={input} />,
|
|
189
|
+
addressMatch: <AddressMatchField field={field} input={input} />,
|
|
187
190
|
};
|
|
188
191
|
|
|
189
192
|
return isRenderField({ input, field }) ? (
|
|
@@ -95,6 +95,7 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
95
95
|
partInBusiness: defaultValidator(),
|
|
96
96
|
regionRetail: defaultSelectValidator('Выберите филиал банка'),
|
|
97
97
|
addressRetail: defaultSelectValidator('Выберите адрес банка'),
|
|
98
|
+
addressMatch: defaultValidator(),
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
export const getObjectValidator = (inputs: FieldDef[]): Record<string, Validator> => {
|
|
@@ -27,6 +27,7 @@ export const InputControl = JSX<InputProps>(
|
|
|
27
27
|
daDataQueryPrefix,
|
|
28
28
|
inputLength,
|
|
29
29
|
dadata = false,
|
|
30
|
+
disabled = false,
|
|
30
31
|
}) => {
|
|
31
32
|
const [isOpen, { setFalse: close, setTrue: open }] = useBool();
|
|
32
33
|
const popupRef = useOutsideClick<HTMLDivElement>(close);
|
|
@@ -54,6 +55,7 @@ export const InputControl = JSX<InputProps>(
|
|
|
54
55
|
>
|
|
55
56
|
<div ref={inputRef}>
|
|
56
57
|
<Input
|
|
58
|
+
disabled={disabled}
|
|
57
59
|
type={type || 'text'}
|
|
58
60
|
aria-label={label}
|
|
59
61
|
label={getRequiredLabel({ label, errors })}
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ export type UpdateProfileEsiaResponse = {
|
|
|
14
14
|
surname: string;
|
|
15
15
|
name: string;
|
|
16
16
|
midname: string;
|
|
17
|
-
birthDate:
|
|
17
|
+
birthDate: Date;
|
|
18
18
|
phone: string;
|
|
19
19
|
email: string;
|
|
20
20
|
esiaAccountType: {
|
|
@@ -42,11 +42,11 @@ export type UpdateProfileEsiaResponse = {
|
|
|
42
42
|
value: string;
|
|
43
43
|
};
|
|
44
44
|
city: string;
|
|
45
|
-
locality:
|
|
45
|
+
locality: string;
|
|
46
46
|
street: string;
|
|
47
47
|
house: string;
|
|
48
|
-
building:
|
|
49
|
-
block:
|
|
48
|
+
building: string;
|
|
49
|
+
block: string;
|
|
50
50
|
apartment: string;
|
|
51
51
|
};
|
|
52
52
|
addressFact: {
|
|
@@ -58,11 +58,11 @@ export type UpdateProfileEsiaResponse = {
|
|
|
58
58
|
value: string;
|
|
59
59
|
};
|
|
60
60
|
city: string;
|
|
61
|
-
locality:
|
|
61
|
+
locality: string;
|
|
62
62
|
street: string;
|
|
63
63
|
house: string;
|
|
64
|
-
building:
|
|
65
|
-
block:
|
|
64
|
+
building: string;
|
|
65
|
+
block: string;
|
|
66
66
|
apartment: string;
|
|
67
67
|
};
|
|
68
68
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type UpdateProfileEsiaResponse } from '../../api/RetailAPI/updateProfileEsia';
|
|
2
|
+
import { normalizePhone } from '../../ui-kit/PhoneInput/normalizePhone';
|
|
3
|
+
import { type Address, type FormState } from './getInitialFormState';
|
|
4
|
+
|
|
5
|
+
export const parseEsiaProfile = (esiaProfile: UpdateProfileEsiaResponse): FormState => {
|
|
6
|
+
const { profile, addInfo, document, addressRegistration, addressFact } = esiaProfile;
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
name: profile?.name,
|
|
10
|
+
surname: profile?.surname,
|
|
11
|
+
middleName: profile?.midname,
|
|
12
|
+
birthday: profile?.birthDate,
|
|
13
|
+
phone: normalizePhone(profile?.phone),
|
|
14
|
+
email: profile?.email,
|
|
15
|
+
dulIssueDateField: document?.dulIssueDate,
|
|
16
|
+
dulIssuedBy: document?.dulIssuedBy,
|
|
17
|
+
dulNumber: document?.dulNumber,
|
|
18
|
+
dulSerie: document?.dulSerie,
|
|
19
|
+
dulSubdivisionCode: document?.dulSubdivisionCode,
|
|
20
|
+
snils: addInfo?.snils,
|
|
21
|
+
birthPlace: addInfo?.birthPlace,
|
|
22
|
+
addressRegistration: buildAddress(addressRegistration),
|
|
23
|
+
addressFact: buildAddress(addressFact),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const concatFullAddress = (address: Array<string | undefined>): string => {
|
|
28
|
+
return address.reduce((acc: string, value) => {
|
|
29
|
+
if (value) {
|
|
30
|
+
return acc ? `${acc}, ${value}` : value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return acc;
|
|
34
|
+
}, '');
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const buildAddress = (fields: UpdateProfileEsiaResponse['addressRegistration']): Address => {
|
|
38
|
+
const {
|
|
39
|
+
postcode,
|
|
40
|
+
region,
|
|
41
|
+
regionCode,
|
|
42
|
+
locality,
|
|
43
|
+
city,
|
|
44
|
+
street,
|
|
45
|
+
house,
|
|
46
|
+
building,
|
|
47
|
+
block,
|
|
48
|
+
apartment,
|
|
49
|
+
} = fields;
|
|
50
|
+
|
|
51
|
+
const place = locality || city;
|
|
52
|
+
|
|
53
|
+
const fullAddress = concatFullAddress([
|
|
54
|
+
postcode,
|
|
55
|
+
region,
|
|
56
|
+
place,
|
|
57
|
+
street ? `ул ${street}` : undefined,
|
|
58
|
+
house ? `д ${house}` : undefined,
|
|
59
|
+
block ? `к ${block}` : undefined,
|
|
60
|
+
building ? `стр ${building}` : undefined,
|
|
61
|
+
apartment ? `кв ${apartment}` : undefined,
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
...fields,
|
|
66
|
+
regionCode: regionCode?.key,
|
|
67
|
+
fullAddress,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
@@ -2,11 +2,13 @@ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
|
2
2
|
|
|
3
3
|
import { updateProfileEsia } from '../../api/RetailAPI/updateProfileEsia';
|
|
4
4
|
import { useLocalStorage } from '../../hooks/useLocalStorage';
|
|
5
|
+
import { type FormState } from './getInitialFormState';
|
|
6
|
+
import { parseEsiaProfile } from './pasreEsiaProfile';
|
|
5
7
|
|
|
6
8
|
export const useInitApplicationLead = (nextStepLink: string) => {
|
|
7
9
|
const [isLoading, setIsLoading] = useState(false);
|
|
8
10
|
const [profileId] = useLocalStorage<string>('profileId');
|
|
9
|
-
const [,
|
|
11
|
+
const [leadForm, setLeadForm] = useLocalStorage<FormState>('leadForm');
|
|
10
12
|
const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
|
|
11
13
|
const code = params.get('code');
|
|
12
14
|
const state = params.get('state');
|
|
@@ -20,7 +22,11 @@ export const useInitApplicationLead = (nextStepLink: string) => {
|
|
|
20
22
|
redirectUri: globalThis.location?.href,
|
|
21
23
|
});
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
setLeadForm({
|
|
26
|
+
...leadForm,
|
|
27
|
+
...parseEsiaProfile(data),
|
|
28
|
+
});
|
|
29
|
+
|
|
24
30
|
globalThis.location.href = nextStepLink;
|
|
25
31
|
}
|
|
26
32
|
}, []);
|
|
@@ -30,7 +36,6 @@ export const useInitApplicationLead = (nextStepLink: string) => {
|
|
|
30
36
|
setIsLoading(true);
|
|
31
37
|
updateEsiaProfile();
|
|
32
38
|
} else {
|
|
33
|
-
setEsiaData('');
|
|
34
39
|
sessionStorage.removeItem('accessToken');
|
|
35
40
|
sessionStorage.removeItem('refreshToken');
|
|
36
41
|
}
|
|
@@ -44,7 +44,10 @@ export const stepsSectionsMap: SectionsProps[][] = [
|
|
|
44
44
|
inputs: [],
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
inputs: [
|
|
47
|
+
inputs: [
|
|
48
|
+
{ fieldType: 'common', name: 'addressRegistration', required: true, dadata: true },
|
|
49
|
+
{ fieldType: 'common', name: 'addressMatch' },
|
|
50
|
+
],
|
|
48
51
|
},
|
|
49
52
|
{
|
|
50
53
|
columns: 2,
|
|
@@ -52,11 +55,14 @@ export const stepsSectionsMap: SectionsProps[][] = [
|
|
|
52
55
|
},
|
|
53
56
|
{
|
|
54
57
|
title: 'Адрес фактического проживания (место пребывания РФ)',
|
|
58
|
+
inputs: [],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
55
61
|
columns: 2,
|
|
56
|
-
inputs: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
],
|
|
62
|
+
inputs: [{ fieldType: 'common', name: 'housing' }],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
inputs: [{ fieldType: 'common', name: 'addressFact', required: true, dadata: true }],
|
|
60
66
|
},
|
|
61
67
|
],
|
|
62
68
|
[
|
|
@@ -141,8 +147,11 @@ export const stepsSectionsMap: SectionsProps[][] = [
|
|
|
141
147
|
inputs: [{ fieldType: 'common', name: 'dependents', required: true }],
|
|
142
148
|
},
|
|
143
149
|
{
|
|
144
|
-
columns:
|
|
145
|
-
inputs: [
|
|
150
|
+
columns: 2,
|
|
151
|
+
inputs: [
|
|
152
|
+
{ fieldType: 'common', name: 'familyMembers', required: true },
|
|
153
|
+
{ fieldType: 'common', name: 'children', required: true },
|
|
154
|
+
],
|
|
146
155
|
},
|
|
147
156
|
{
|
|
148
157
|
title: 'Совокупный доход',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len, max-lines */
|
|
1
2
|
import type { Option } from '../../ui-kit/Select/Option';
|
|
2
3
|
import { type Address } from '../ApplicationLeadForm/getInitialFormState';
|
|
3
4
|
|
|
@@ -17,6 +18,7 @@ export interface FormStateMap {
|
|
|
17
18
|
dulSubdivisionCode?: string;
|
|
18
19
|
dulIssuedBy?: string;
|
|
19
20
|
addressRegistration?: Address;
|
|
21
|
+
addressMatch?: boolean;
|
|
20
22
|
participantDateRegistration?: Date;
|
|
21
23
|
addressFact?: Address;
|
|
22
24
|
housing?: string;
|
|
@@ -81,6 +83,7 @@ const formStateMap: FormStateMap = {
|
|
|
81
83
|
fullAddress: '',
|
|
82
84
|
fiasCode: '',
|
|
83
85
|
},
|
|
86
|
+
addressMatch: false,
|
|
84
87
|
participantDateRegistration: undefined,
|
|
85
88
|
addressFact: {
|
|
86
89
|
fullAddress: '',
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { type DaDataSuggestion } from '../../../api/dadataHints/dadataHintsType';
|
|
4
|
+
import { InputControl } from '../../Input/InputControl';
|
|
5
|
+
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
6
|
+
import { validatorObj } from '../getObjectValidator';
|
|
7
|
+
import { getValidation } from '../getValidation';
|
|
8
|
+
|
|
9
|
+
export const AddressFactField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
10
|
+
const fieldName = 'addressFact';
|
|
11
|
+
const fieldValue = field(fieldName).value;
|
|
12
|
+
const { value } = field('addressMatch');
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (value) {
|
|
16
|
+
field('addressFact')?.onChange?.(field('addressRegistration').value);
|
|
17
|
+
}
|
|
18
|
+
}, [value]);
|
|
19
|
+
|
|
20
|
+
const onDaDataChange = useCallback((item: DaDataSuggestion) => {
|
|
21
|
+
field?.(fieldName)?.onChange?.({
|
|
22
|
+
apartment: item?.data?.flat,
|
|
23
|
+
city: item?.data?.city,
|
|
24
|
+
district: item?.data?.area_with_type,
|
|
25
|
+
fullAddress: item?.value,
|
|
26
|
+
fiasCode: item?.data?.fias_id,
|
|
27
|
+
house: item?.data?.house,
|
|
28
|
+
locality: item?.data?.settlement_with_type,
|
|
29
|
+
okatoRegionCode: item?.data?.okato,
|
|
30
|
+
postcode: item?.data?.postal_code,
|
|
31
|
+
region: item?.data?.region,
|
|
32
|
+
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
33
|
+
street: item?.data?.house,
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
const onChange = useCallback((val: string) => {
|
|
38
|
+
field?.(fieldName)?.onChange?.({
|
|
39
|
+
...field(fieldName).value,
|
|
40
|
+
fullAddress: val,
|
|
41
|
+
});
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<InputControl
|
|
46
|
+
label="Адрес"
|
|
47
|
+
disabled={value}
|
|
48
|
+
{...getValidation(field(fieldName), validatorObj[fieldName], input?.required)}
|
|
49
|
+
value={fieldValue.fullAddress}
|
|
50
|
+
onChange={onChange}
|
|
51
|
+
{...input}
|
|
52
|
+
onDaDataChange={onDaDataChange}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { CheckboxWithError } from '../../Checkbox/CheckboxWithError';
|
|
3
|
+
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
4
|
+
import { validatorObj } from '../getObjectValidator';
|
|
5
|
+
import { getValidation } from '../getValidation';
|
|
6
|
+
|
|
7
|
+
export const AddressMatchField = JSX<CustomFieldProps>(({ field }) => {
|
|
8
|
+
return (
|
|
9
|
+
<CheckboxWithError
|
|
10
|
+
text="Адрес фактического места жительства совпадает с адресом регистрации"
|
|
11
|
+
{...getValidation(field('addressMatch'), validatorObj.addressMatch)}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
});
|
|
@@ -5,7 +5,9 @@ import { type FormFieldRegisterer } from '../../hooks/useForm';
|
|
|
5
5
|
import { InputControl } from '../Input/InputControl';
|
|
6
6
|
import { AcquiringField } from './Fields/AcquiringField';
|
|
7
7
|
import { AddressBranchField } from './Fields/AddressBranchField';
|
|
8
|
+
import { AddressFactField } from './Fields/AddressFactField';
|
|
8
9
|
import { AddressField } from './Fields/AddressField';
|
|
10
|
+
import { AddressMatchField } from './Fields/AddressMatchField';
|
|
9
11
|
import { AmountField } from './Fields/AmountField';
|
|
10
12
|
import { AmountWorkersField } from './Fields/AmountWorkersField';
|
|
11
13
|
import { AnnualRevenueField } from './Fields/AnnualRevenueField';
|
|
@@ -107,7 +109,7 @@ export const getField =
|
|
|
107
109
|
experience5Years: <Experience5YearsField field={field} input={input} />,
|
|
108
110
|
jobsNumber: <JobsNumberField field={field} input={input} />,
|
|
109
111
|
beginDate: <BeginDateField field={field} input={input} />,
|
|
110
|
-
addressFact: <
|
|
112
|
+
addressFact: <AddressFactField field={field} input={input} />,
|
|
111
113
|
organizationAddress: <AddressField field={field} input={input} />,
|
|
112
114
|
comment: <CommentField field={field} input={input} />,
|
|
113
115
|
addressBranch: <AddressBranchField field={field} input={input} isPremium={isPremium} />,
|
|
@@ -184,6 +186,7 @@ export const getField =
|
|
|
184
186
|
partInBusiness: <PartInBusinessField field={field} input={input} />,
|
|
185
187
|
regionRetail: <RetailRegionField field={field} input={input} />,
|
|
186
188
|
addressRetail: <RetailAddressField field={field} input={input} />,
|
|
189
|
+
addressMatch: <AddressMatchField field={field} input={input} />,
|
|
187
190
|
};
|
|
188
191
|
|
|
189
192
|
return isRenderField({ input, field }) ? (
|
|
@@ -95,6 +95,7 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
95
95
|
partInBusiness: defaultValidator(),
|
|
96
96
|
regionRetail: defaultSelectValidator('Выберите филиал банка'),
|
|
97
97
|
addressRetail: defaultSelectValidator('Выберите адрес банка'),
|
|
98
|
+
addressMatch: defaultValidator(),
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
export const getObjectValidator = (inputs: FieldDef[]): Record<string, Validator> => {
|
|
@@ -27,6 +27,7 @@ export const InputControl = JSX<InputProps>(
|
|
|
27
27
|
daDataQueryPrefix,
|
|
28
28
|
inputLength,
|
|
29
29
|
dadata = false,
|
|
30
|
+
disabled = false,
|
|
30
31
|
}) => {
|
|
31
32
|
const [isOpen, { setFalse: close, setTrue: open }] = useBool();
|
|
32
33
|
const popupRef = useOutsideClick<HTMLDivElement>(close);
|
|
@@ -54,6 +55,7 @@ export const InputControl = JSX<InputProps>(
|
|
|
54
55
|
>
|
|
55
56
|
<div ref={inputRef}>
|
|
56
57
|
<Input
|
|
58
|
+
disabled={disabled}
|
|
57
59
|
type={type || 'text'}
|
|
58
60
|
aria-label={label}
|
|
59
61
|
label={getRequiredLabel({ label, errors })}
|