@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.
Files changed (148) hide show
  1. package/bundle/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +149 -49
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
  6. package/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  7. package/bundle/components/CreditForm/getInitialFormState.d.ts +1 -0
  8. package/bundle/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
  9. package/bundle/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
  10. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  11. package/dist/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  12. package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
  13. package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  14. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  15. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +52 -0
  16. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
  17. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
  18. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  19. package/dist/components/CreditForm/creditFormStepsData.js +16 -7
  20. package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  21. package/dist/components/CreditForm/getInitialFormState.d.ts +1 -0
  22. package/dist/components/CreditForm/getInitialFormState.js +1 -0
  23. package/dist/components/CreditForm/getInitialFormState.js.map +1 -1
  24. package/dist/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
  25. package/dist/ui-kit/FormField/Fields/AddressFactField.js +42 -0
  26. package/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
  27. package/dist/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
  28. package/dist/ui-kit/FormField/Fields/AddressMatchField.js +11 -0
  29. package/dist/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
  30. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  31. package/dist/ui-kit/FormField/getField.js +4 -1
  32. package/dist/ui-kit/FormField/getField.js.map +1 -1
  33. package/dist/ui-kit/FormField/getObjectValidator.js +1 -0
  34. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  35. package/dist/ui-kit/Input/InputControl.js +2 -2
  36. package/dist/ui-kit/Input/InputControl.js.map +1 -1
  37. package/lib/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  38. package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
  39. package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  40. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  41. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +49 -0
  42. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
  43. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
  44. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  45. package/lib/components/CreditForm/creditFormStepsData.js +16 -7
  46. package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  47. package/lib/components/CreditForm/getInitialFormState.d.ts +1 -0
  48. package/lib/components/CreditForm/getInitialFormState.js +1 -0
  49. package/lib/components/CreditForm/getInitialFormState.js.map +1 -1
  50. package/lib/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
  51. package/lib/ui-kit/FormField/Fields/AddressFactField.js +40 -0
  52. package/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
  53. package/lib/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
  54. package/lib/ui-kit/FormField/Fields/AddressMatchField.js +9 -0
  55. package/lib/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
  56. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  57. package/lib/ui-kit/FormField/getField.js +4 -1
  58. package/lib/ui-kit/FormField/getField.js.map +1 -1
  59. package/lib/ui-kit/FormField/getObjectValidator.js +1 -0
  60. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  61. package/lib/ui-kit/Input/InputControl.js +2 -2
  62. package/lib/ui-kit/Input/InputControl.js.map +1 -1
  63. package/mobile/bundle/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  64. package/mobile/bundle/bundle.umd.js +149 -49
  65. package/mobile/bundle/bundle.umd.min.js +1 -1
  66. package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
  67. package/mobile/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  68. package/mobile/bundle/components/CreditForm/getInitialFormState.d.ts +1 -0
  69. package/mobile/bundle/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
  70. package/mobile/bundle/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
  71. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  72. package/mobile/dist/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  73. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
  74. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  75. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  76. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +52 -0
  77. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
  78. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
  79. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  80. package/mobile/dist/components/CreditForm/creditFormStepsData.js +16 -7
  81. package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  82. package/mobile/dist/components/CreditForm/getInitialFormState.d.ts +1 -0
  83. package/mobile/dist/components/CreditForm/getInitialFormState.js +1 -0
  84. package/mobile/dist/components/CreditForm/getInitialFormState.js.map +1 -1
  85. package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
  86. package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js +42 -0
  87. package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
  88. package/mobile/dist/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
  89. package/mobile/dist/ui-kit/FormField/Fields/AddressMatchField.js +11 -0
  90. package/mobile/dist/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
  91. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  92. package/mobile/dist/ui-kit/FormField/getField.js +4 -1
  93. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  94. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -0
  95. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  96. package/mobile/dist/ui-kit/Input/InputControl.js +2 -2
  97. package/mobile/dist/ui-kit/Input/InputControl.js.map +1 -1
  98. package/mobile/lib/api/RetailAPI/updateProfileEsia.d.ts +7 -7
  99. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
  100. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  101. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +3 -0
  102. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +49 -0
  103. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -0
  104. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +6 -3
  105. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  106. package/mobile/lib/components/CreditForm/creditFormStepsData.js +16 -7
  107. package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  108. package/mobile/lib/components/CreditForm/getInitialFormState.d.ts +1 -0
  109. package/mobile/lib/components/CreditForm/getInitialFormState.js +1 -0
  110. package/mobile/lib/components/CreditForm/getInitialFormState.js.map +1 -1
  111. package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
  112. package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js +40 -0
  113. package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
  114. package/mobile/lib/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
  115. package/mobile/lib/ui-kit/FormField/Fields/AddressMatchField.js +9 -0
  116. package/mobile/lib/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
  117. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  118. package/mobile/lib/ui-kit/FormField/getField.js +4 -1
  119. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  120. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +1 -0
  121. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  122. package/mobile/lib/ui-kit/Input/InputControl.js +2 -2
  123. package/mobile/lib/ui-kit/Input/InputControl.js.map +1 -1
  124. package/mobile/src/api/RetailAPI/updateProfileEsia.ts +7 -7
  125. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -0
  126. package/mobile/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +69 -0
  127. package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -3
  128. package/mobile/src/components/CreditForm/creditFormStepsData.tsx +16 -7
  129. package/mobile/src/components/CreditForm/getInitialFormState.tsx +3 -0
  130. package/mobile/src/ui-kit/FormField/Fields/AddressFactField.tsx +55 -0
  131. package/mobile/src/ui-kit/FormField/Fields/AddressMatchField.tsx +14 -0
  132. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +2 -1
  133. package/mobile/src/ui-kit/FormField/getField.tsx +4 -1
  134. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
  135. package/mobile/src/ui-kit/Input/InputControl.tsx +2 -0
  136. package/package.json +1 -1
  137. package/src/api/RetailAPI/updateProfileEsia.ts +7 -7
  138. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -0
  139. package/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +69 -0
  140. package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +8 -3
  141. package/src/components/CreditForm/creditFormStepsData.tsx +16 -7
  142. package/src/components/CreditForm/getInitialFormState.tsx +3 -0
  143. package/src/ui-kit/FormField/Fields/AddressFactField.tsx +55 -0
  144. package/src/ui-kit/FormField/Fields/AddressMatchField.tsx +14 -0
  145. package/src/ui-kit/FormField/NameFieldDef.ts +2 -1
  146. package/src/ui-kit/FormField/getField.tsx +4 -1
  147. package/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
  148. 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: [{ fieldType: 'common', name: 'addressRegistration', required: true, dadata: true }],
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
- { fieldType: 'common', name: 'addressFact', required: true, dadata: true },
58
- { fieldType: 'common', name: 'housing' },
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: 1,
145
- inputs: [{ fieldType: 'common', name: 'familyMembers', required: true }],
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
+ });
@@ -86,4 +86,5 @@ export type NameFieldDef =
86
86
  | 'bankEmployeeCode'
87
87
  | 'partInBusiness'
88
88
  | 'regionRetail'
89
- | 'addressRetail';
89
+ | 'addressRetail'
90
+ | 'addressMatch';
@@ -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: <AddressField field={field} input={input} />,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.635",
3
+ "version": "0.14.637",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -14,7 +14,7 @@ export type UpdateProfileEsiaResponse = {
14
14
  surname: string;
15
15
  name: string;
16
16
  midname: string;
17
- birthDate: string;
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: null;
45
+ locality: string;
46
46
  street: string;
47
47
  house: string;
48
- building: null;
49
- block: null;
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: null;
61
+ locality: string;
62
62
  street: string;
63
63
  house: string;
64
- building: null;
65
- block: null;
64
+ building: string;
65
+ block: string;
66
66
  apartment: string;
67
67
  };
68
68
  };
@@ -120,6 +120,7 @@ export interface FormState extends FormConsents {
120
120
  legalEntityName?: string;
121
121
  bankEmployeeCode?: number;
122
122
  partInBusiness?: number;
123
+ addressMatch?: boolean;
123
124
  }
124
125
 
125
126
  const initialFormState = {
@@ -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 [, setEsiaData] = useLocalStorage('esiaData');
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
- setEsiaData(JSON.stringify(data));
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: [{ fieldType: 'common', name: 'addressRegistration', required: true, dadata: true }],
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
- { fieldType: 'common', name: 'addressFact', required: true, dadata: true },
58
- { fieldType: 'common', name: 'housing' },
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: 1,
145
- inputs: [{ fieldType: 'common', name: 'familyMembers', required: true }],
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
+ });
@@ -86,4 +86,5 @@ export type NameFieldDef =
86
86
  | 'bankEmployeeCode'
87
87
  | 'partInBusiness'
88
88
  | 'regionRetail'
89
- | 'addressRetail';
89
+ | 'addressRetail'
90
+ | 'addressMatch';
@@ -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: <AddressField field={field} input={input} />,
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 })}