@redneckz/wildless-cms-uni-blocks 0.14.793 → 0.14.795

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 (109) hide show
  1. package/bundle/bundle.umd.js +36 -6
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  4. package/bundle/retail/adaptors/utils.d.ts +1 -1
  5. package/bundle/retail/api/getOrganizationFromInn.d.ts +2 -0
  6. package/bundle/retail/api/updateProfileEsia.d.ts +11 -0
  7. package/bundle/retail/api/updateUserTask.d.ts +2 -2
  8. package/bundle/retail/components/DraftDialog/utils.d.ts +8 -8
  9. package/bundle/retail/model/LeadFormState.d.ts +9 -9
  10. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +11 -1
  11. package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
  12. package/dist/hooks/useAspects/aspects/getAspectsWithInclude.js +1 -3
  13. package/dist/hooks/useAspects/aspects/getAspectsWithInclude.js.map +1 -1
  14. package/dist/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  15. package/dist/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
  16. package/dist/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  17. package/dist/retail/adaptors/utils.d.ts +1 -1
  18. package/dist/retail/api/getOrganizationFromInn.d.ts +2 -0
  19. package/dist/retail/api/getOrganizationFromInn.js +12 -0
  20. package/dist/retail/api/getOrganizationFromInn.js.map +1 -0
  21. package/dist/retail/api/updateProfileEsia.d.ts +11 -0
  22. package/dist/retail/api/updateProfileEsia.js.map +1 -1
  23. package/dist/retail/api/updateUserTask.d.ts +2 -2
  24. package/dist/retail/components/DraftDialog/utils.d.ts +8 -8
  25. package/dist/retail/components/Fields/DaDataInnField.js +15 -0
  26. package/dist/retail/components/Fields/DaDataInnField.js.map +1 -1
  27. package/dist/retail/model/LeadFormState.d.ts +9 -9
  28. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +11 -1
  29. package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
  30. package/lib/hooks/useAspects/aspects/getAspectsWithInclude.js +1 -3
  31. package/lib/hooks/useAspects/aspects/getAspectsWithInclude.js.map +1 -1
  32. package/lib/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  33. package/lib/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
  34. package/lib/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  35. package/lib/retail/adaptors/utils.d.ts +1 -1
  36. package/lib/retail/api/getOrganizationFromInn.d.ts +2 -0
  37. package/lib/retail/api/getOrganizationFromInn.js +9 -0
  38. package/lib/retail/api/getOrganizationFromInn.js.map +1 -0
  39. package/lib/retail/api/updateProfileEsia.d.ts +11 -0
  40. package/lib/retail/api/updateProfileEsia.js.map +1 -1
  41. package/lib/retail/api/updateUserTask.d.ts +2 -2
  42. package/lib/retail/components/DraftDialog/utils.d.ts +8 -8
  43. package/lib/retail/components/Fields/DaDataInnField.js +16 -1
  44. package/lib/retail/components/Fields/DaDataInnField.js.map +1 -1
  45. package/lib/retail/model/LeadFormState.d.ts +9 -9
  46. package/mobile/bundle/bundle.umd.js +36 -6
  47. package/mobile/bundle/bundle.umd.min.js +1 -1
  48. package/mobile/bundle/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  49. package/mobile/bundle/retail/adaptors/utils.d.ts +1 -1
  50. package/mobile/bundle/retail/api/getOrganizationFromInn.d.ts +2 -0
  51. package/mobile/bundle/retail/api/updateProfileEsia.d.ts +11 -0
  52. package/mobile/bundle/retail/api/updateUserTask.d.ts +2 -2
  53. package/mobile/bundle/retail/components/DraftDialog/utils.d.ts +8 -8
  54. package/mobile/bundle/retail/model/LeadFormState.d.ts +9 -9
  55. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +11 -1
  56. package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
  57. package/mobile/dist/hooks/useAspects/aspects/getAspectsWithInclude.js +1 -3
  58. package/mobile/dist/hooks/useAspects/aspects/getAspectsWithInclude.js.map +1 -1
  59. package/mobile/dist/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  60. package/mobile/dist/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
  61. package/mobile/dist/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  62. package/mobile/dist/retail/adaptors/utils.d.ts +1 -1
  63. package/mobile/dist/retail/api/getOrganizationFromInn.d.ts +2 -0
  64. package/mobile/dist/retail/api/getOrganizationFromInn.js +12 -0
  65. package/mobile/dist/retail/api/getOrganizationFromInn.js.map +1 -0
  66. package/mobile/dist/retail/api/updateProfileEsia.d.ts +11 -0
  67. package/mobile/dist/retail/api/updateProfileEsia.js.map +1 -1
  68. package/mobile/dist/retail/api/updateUserTask.d.ts +2 -2
  69. package/mobile/dist/retail/components/DraftDialog/utils.d.ts +8 -8
  70. package/mobile/dist/retail/components/Fields/DaDataInnField.js +15 -0
  71. package/mobile/dist/retail/components/Fields/DaDataInnField.js.map +1 -1
  72. package/mobile/dist/retail/model/LeadFormState.d.ts +9 -9
  73. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +11 -1
  74. package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
  75. package/mobile/lib/hooks/useAspects/aspects/getAspectsWithInclude.js +1 -3
  76. package/mobile/lib/hooks/useAspects/aspects/getAspectsWithInclude.js.map +1 -1
  77. package/mobile/lib/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
  78. package/mobile/lib/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
  79. package/mobile/lib/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  80. package/mobile/lib/retail/adaptors/utils.d.ts +1 -1
  81. package/mobile/lib/retail/api/getOrganizationFromInn.d.ts +2 -0
  82. package/mobile/lib/retail/api/getOrganizationFromInn.js +9 -0
  83. package/mobile/lib/retail/api/getOrganizationFromInn.js.map +1 -0
  84. package/mobile/lib/retail/api/updateProfileEsia.d.ts +11 -0
  85. package/mobile/lib/retail/api/updateProfileEsia.js.map +1 -1
  86. package/mobile/lib/retail/api/updateUserTask.d.ts +2 -2
  87. package/mobile/lib/retail/components/DraftDialog/utils.d.ts +8 -8
  88. package/mobile/lib/retail/components/Fields/DaDataInnField.js +16 -1
  89. package/mobile/lib/retail/components/Fields/DaDataInnField.js.map +1 -1
  90. package/mobile/lib/retail/model/LeadFormState.d.ts +9 -9
  91. package/mobile/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +13 -1
  92. package/mobile/src/hooks/useAspects/aspects/getAspectsWithInclude.tsx +1 -4
  93. package/mobile/src/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
  94. package/mobile/src/retail/adaptors/utils.ts +1 -1
  95. package/mobile/src/retail/api/getOrganizationFromInn.ts +11 -0
  96. package/mobile/src/retail/api/updateProfileEsia.ts +11 -0
  97. package/mobile/src/retail/api/updateUserTask.ts +2 -2
  98. package/mobile/src/retail/components/Fields/DaDataInnField.tsx +17 -1
  99. package/mobile/src/retail/model/LeadFormState.ts +9 -9
  100. package/package.json +1 -1
  101. package/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +13 -1
  102. package/src/hooks/useAspects/aspects/getAspectsWithInclude.tsx +1 -4
  103. package/src/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
  104. package/src/retail/adaptors/utils.ts +1 -1
  105. package/src/retail/api/getOrganizationFromInn.ts +11 -0
  106. package/src/retail/api/updateProfileEsia.ts +11 -0
  107. package/src/retail/api/updateUserTask.ts +2 -2
  108. package/src/retail/components/Fields/DaDataInnField.tsx +17 -1
  109. package/src/retail/model/LeadFormState.ts +9 -9
@@ -98,7 +98,7 @@ export interface LeadFormState extends FormRetailConsents, FormStateDeliveryType
98
98
  annualRevenue?: string;
99
99
  serviceDirection?: string;
100
100
  desiredMeetingDate?: string;
101
- inn?: number;
101
+ inn?: string;
102
102
  legalForm?: string;
103
103
  organizationName?: string;
104
104
  generalSeniority?: string;
@@ -126,20 +126,20 @@ export interface LeadFormState extends FormRetailConsents, FormStateDeliveryType
126
126
  familyMembers?: string;
127
127
  children?: string;
128
128
  dependents?: string;
129
- totalIncome?: number;
129
+ totalIncome?: string;
130
130
  expenses?: number;
131
131
  snils?: string;
132
132
  conscription?: Option;
133
133
  armyIdFlg?: boolean;
134
134
  addressRegistration?: Address;
135
135
  participantDateRegistration?: Date | string;
136
- retirementIncome?: number;
137
- otherIncome?: number;
138
- mandatoryPayments?: number;
139
- additionalIncome?: number;
140
- otherPayments?: number;
141
- rentalIncome?: number;
142
- wages?: number;
136
+ retirementIncome?: string;
137
+ otherIncome?: string;
138
+ mandatoryPayments?: string;
139
+ additionalIncome?: string;
140
+ otherPayments?: string;
141
+ rentalIncome?: string;
142
+ wages?: string;
143
143
  creditInRshbCd?: Option;
144
144
  bankruptcyFlg?: boolean;
145
145
  shareholderFlg?: boolean;
@@ -3,7 +3,8 @@ import { type Address, type LeadFormState } from '../../retail/model/LeadFormSta
3
3
  import { normalizePhone } from '../../ui-kit/PhoneInput/normalizePhone';
4
4
 
5
5
  export const parseEsiaProfile = (esiaProfile: UpdateProfileEsiaResponse): LeadFormState => {
6
- const { profile, addInfo, document, addressRegistration, addressFact } = esiaProfile;
6
+ const { profile, addInfo, document, addressRegistration, addressFact, esiaAdditionalDocument } =
7
+ esiaProfile;
7
8
 
8
9
  return {
9
10
  name: profile?.name,
@@ -22,6 +23,15 @@ export const parseEsiaProfile = (esiaProfile: UpdateProfileEsiaResponse): LeadFo
22
23
  addressRegistration: buildAddress(addressRegistration),
23
24
  addressFact: buildAddress(addressFact),
24
25
  esiaAccountTypeCd: profile?.esiaAccountType,
26
+ inn: esiaAdditionalDocument?.inn,
27
+ wages: esiaAdditionalDocument?.averageMonthlyIncome
28
+ ? Math.floor(esiaAdditionalDocument.averageMonthlyIncome)?.toString()
29
+ : undefined,
30
+ beginDate: esiaAdditionalDocument?.startWorkDate,
31
+ experience5Years: getYearFromMonth(esiaAdditionalDocument?.workLengthInFiveYears)?.toString(),
32
+ generalSeniority: getYearFromMonth(esiaAdditionalDocument?.workLength)?.toString(),
33
+ lastJobExperience: getYearFromMonth(esiaAdditionalDocument?.workLengthLastJob)?.toString(),
34
+ jobsNumber: esiaAdditionalDocument?.jobsNumberInFiveYears?.toString(),
25
35
  };
26
36
  };
27
37
 
@@ -68,3 +78,5 @@ const buildAddress = (fields: UpdateProfileEsiaResponse['addressRegistration']):
68
78
  fullAddress,
69
79
  };
70
80
  };
81
+
82
+ const getYearFromMonth = (month?: number) => (month ? Math.floor(month / 12) : null);
@@ -4,8 +4,5 @@ import { type AspectsAttribute } from '../useAspects';
4
4
  export const getAspectsWithInclude = (data?: AspectsDef[], include?: string): AspectsDef[] =>
5
5
  data?.map(({ aspectName, params }: AspectsAttribute) => ({
6
6
  aspectName,
7
- params:
8
- aspectName === 'mindboxEvent' || aspectName === 'snowplowEvent'
9
- ? { ...params, eventJson: include }
10
- : params,
7
+ params: aspectName === 'snowplowEvent' ? { ...params, eventJSON: include } : params,
11
8
  })) as AspectsDef[];
@@ -43,5 +43,5 @@ export const getFamilyStatusAndIncomeData = (formData: LeadFormState): Partial<P
43
43
  };
44
44
  };
45
45
 
46
- export const countIncomeAverage = (wages?: number, retirementIncome?: number) =>
47
- Number(wages ?? 0) + Number(retirementIncome ?? 0);
46
+ export const countIncomeAverage = (wages?: string, retirementIncome?: string) =>
47
+ (Number(wages ?? 0) + Number(retirementIncome ?? 0)).toString();
@@ -64,7 +64,7 @@ export const getParticipantAddresses = (fields: Record<string, Address | undefin
64
64
  return acc;
65
65
  }, []);
66
66
 
67
- export const getParticipantIncomes = (fields: Record<string, number | undefined>): any[] =>
67
+ export const getParticipantIncomes = (fields: Record<string, string | undefined>): any[] =>
68
68
  Object.entries(fields).reduce((acc: any[], [key, value]) => {
69
69
  if (key in fieldsNamesToIncomeKeysMap) {
70
70
  return [
@@ -0,0 +1,11 @@
1
+ import { getDaDataHints } from './dadataHints/dadataHints';
2
+ import { type DaDataSuggestion } from './dadataHints/dadataHintsType';
3
+
4
+ export const getOrganizationFromInn = async (inn: string): Promise<DaDataSuggestion> => {
5
+ const res = await getDaDataHints({
6
+ url: 'suggest/party',
7
+ query: inn,
8
+ });
9
+
10
+ return res?.[0];
11
+ };
@@ -65,6 +65,17 @@ export type UpdateProfileEsiaResponse = {
65
65
  block: string;
66
66
  apartment: string;
67
67
  };
68
+ esiaAdditionalDocument: {
69
+ averageMonthlyIncome: number;
70
+ inn: string;
71
+ jobsNumberInFiveYears: string;
72
+ startWorkDate: string;
73
+ workLength: number;
74
+ workLengthInFiveYears: number;
75
+ workLengthLastJob: number;
76
+ pdfFileWorkbook: string;
77
+ pdfFilePayout: string;
78
+ };
68
79
  };
69
80
 
70
81
  export const updateProfileEsia = (body: UpdateProfileEsiaBody) =>
@@ -34,7 +34,7 @@ type ParticipantIncome = {
34
34
  | 'WAGES'
35
35
  | 'RETIREMENT_INCOME';
36
36
  };
37
- value: number;
37
+ value: string;
38
38
  };
39
39
 
40
40
  export type PaymentType = {
@@ -74,7 +74,7 @@ export type Participant = {
74
74
  maritalStatusCd?: Option;
75
75
  militaryStatusCd?: Option;
76
76
  organizationActivityTypeCd?: Option;
77
- organizationInn?: number;
77
+ organizationInn?: string;
78
78
  organizationKindCd?: Option;
79
79
  organizationName?: string;
80
80
  organizationTypeCd?: Option;
@@ -1,19 +1,35 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
4
4
  import { type DaDataSuggestion } from '../../api/dadataHints/dadataHintsType';
5
+ import { getOrganizationFromInn } from '../../api/getOrganizationFromInn';
5
6
  import { useRetailFormStore } from '../../hooks/useRetailFormStore';
6
7
  import { updateOrganizationFields } from '../../utils/updateOrganizationFields';
7
8
  import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
8
9
 
9
10
  export const DaDataInnField = JSX<CustomFieldProps>(({ field, input }) => {
10
11
  const store = useRetailFormStore();
12
+ const esiaAccountTypeCd = field?.('esiaAccountTypeCd')?.value;
13
+ const inn = field?.('inn')?.value;
11
14
 
12
15
  const onDaDataChange = useCallback((item: DaDataSuggestion) => {
13
16
  field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
14
17
  updateOrganizationFields(store, field, item);
15
18
  }, []);
16
19
 
20
+ useEffect(() => {
21
+ if (!esiaAccountTypeCd || !inn) {
22
+ return;
23
+ }
24
+ (async () => {
25
+ const organization = await getOrganizationFromInn(inn as string);
26
+ if (organization) {
27
+ field?.('organizationName')?.onChange?.(organization.data?.name?.short_with_opf);
28
+ updateOrganizationFields(store, field, organization);
29
+ }
30
+ })();
31
+ }, []);
32
+
17
33
  return (
18
34
  <DaDataInputControl
19
35
  label="ИНН"
@@ -110,7 +110,7 @@ export interface LeadFormState extends FormRetailConsents, FormStateDeliveryType
110
110
  annualRevenue?: string;
111
111
  serviceDirection?: string;
112
112
  desiredMeetingDate?: string;
113
- inn?: number;
113
+ inn?: string;
114
114
  legalForm?: string;
115
115
  organizationName?: string;
116
116
  generalSeniority?: string;
@@ -138,20 +138,20 @@ export interface LeadFormState extends FormRetailConsents, FormStateDeliveryType
138
138
  familyMembers?: string;
139
139
  children?: string;
140
140
  dependents?: string;
141
- totalIncome?: number;
141
+ totalIncome?: string;
142
142
  expenses?: number;
143
143
  snils?: string;
144
144
  conscription?: Option;
145
145
  armyIdFlg?: boolean;
146
146
  addressRegistration?: Address;
147
147
  participantDateRegistration?: Date | string;
148
- retirementIncome?: number;
149
- otherIncome?: number;
150
- mandatoryPayments?: number;
151
- additionalIncome?: number;
152
- otherPayments?: number;
153
- rentalIncome?: number;
154
- wages?: number;
148
+ retirementIncome?: string;
149
+ otherIncome?: string;
150
+ mandatoryPayments?: string;
151
+ additionalIncome?: string;
152
+ otherPayments?: string;
153
+ rentalIncome?: string;
154
+ wages?: string;
155
155
  creditInRshbCd?: Option;
156
156
  bankruptcyFlg?: boolean;
157
157
  shareholderFlg?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.793",
3
+ "version": "0.14.795",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -3,7 +3,8 @@ import { type Address, type LeadFormState } from '../../retail/model/LeadFormSta
3
3
  import { normalizePhone } from '../../ui-kit/PhoneInput/normalizePhone';
4
4
 
5
5
  export const parseEsiaProfile = (esiaProfile: UpdateProfileEsiaResponse): LeadFormState => {
6
- const { profile, addInfo, document, addressRegistration, addressFact } = esiaProfile;
6
+ const { profile, addInfo, document, addressRegistration, addressFact, esiaAdditionalDocument } =
7
+ esiaProfile;
7
8
 
8
9
  return {
9
10
  name: profile?.name,
@@ -22,6 +23,15 @@ export const parseEsiaProfile = (esiaProfile: UpdateProfileEsiaResponse): LeadFo
22
23
  addressRegistration: buildAddress(addressRegistration),
23
24
  addressFact: buildAddress(addressFact),
24
25
  esiaAccountTypeCd: profile?.esiaAccountType,
26
+ inn: esiaAdditionalDocument?.inn,
27
+ wages: esiaAdditionalDocument?.averageMonthlyIncome
28
+ ? Math.floor(esiaAdditionalDocument.averageMonthlyIncome)?.toString()
29
+ : undefined,
30
+ beginDate: esiaAdditionalDocument?.startWorkDate,
31
+ experience5Years: getYearFromMonth(esiaAdditionalDocument?.workLengthInFiveYears)?.toString(),
32
+ generalSeniority: getYearFromMonth(esiaAdditionalDocument?.workLength)?.toString(),
33
+ lastJobExperience: getYearFromMonth(esiaAdditionalDocument?.workLengthLastJob)?.toString(),
34
+ jobsNumber: esiaAdditionalDocument?.jobsNumberInFiveYears?.toString(),
25
35
  };
26
36
  };
27
37
 
@@ -68,3 +78,5 @@ const buildAddress = (fields: UpdateProfileEsiaResponse['addressRegistration']):
68
78
  fullAddress,
69
79
  };
70
80
  };
81
+
82
+ const getYearFromMonth = (month?: number) => (month ? Math.floor(month / 12) : null);
@@ -4,8 +4,5 @@ import { type AspectsAttribute } from '../useAspects';
4
4
  export const getAspectsWithInclude = (data?: AspectsDef[], include?: string): AspectsDef[] =>
5
5
  data?.map(({ aspectName, params }: AspectsAttribute) => ({
6
6
  aspectName,
7
- params:
8
- aspectName === 'mindboxEvent' || aspectName === 'snowplowEvent'
9
- ? { ...params, eventJson: include }
10
- : params,
7
+ params: aspectName === 'snowplowEvent' ? { ...params, eventJSON: include } : params,
11
8
  })) as AspectsDef[];
@@ -43,5 +43,5 @@ export const getFamilyStatusAndIncomeData = (formData: LeadFormState): Partial<P
43
43
  };
44
44
  };
45
45
 
46
- export const countIncomeAverage = (wages?: number, retirementIncome?: number) =>
47
- Number(wages ?? 0) + Number(retirementIncome ?? 0);
46
+ export const countIncomeAverage = (wages?: string, retirementIncome?: string) =>
47
+ (Number(wages ?? 0) + Number(retirementIncome ?? 0)).toString();
@@ -64,7 +64,7 @@ export const getParticipantAddresses = (fields: Record<string, Address | undefin
64
64
  return acc;
65
65
  }, []);
66
66
 
67
- export const getParticipantIncomes = (fields: Record<string, number | undefined>): any[] =>
67
+ export const getParticipantIncomes = (fields: Record<string, string | undefined>): any[] =>
68
68
  Object.entries(fields).reduce((acc: any[], [key, value]) => {
69
69
  if (key in fieldsNamesToIncomeKeysMap) {
70
70
  return [
@@ -0,0 +1,11 @@
1
+ import { getDaDataHints } from './dadataHints/dadataHints';
2
+ import { type DaDataSuggestion } from './dadataHints/dadataHintsType';
3
+
4
+ export const getOrganizationFromInn = async (inn: string): Promise<DaDataSuggestion> => {
5
+ const res = await getDaDataHints({
6
+ url: 'suggest/party',
7
+ query: inn,
8
+ });
9
+
10
+ return res?.[0];
11
+ };
@@ -65,6 +65,17 @@ export type UpdateProfileEsiaResponse = {
65
65
  block: string;
66
66
  apartment: string;
67
67
  };
68
+ esiaAdditionalDocument: {
69
+ averageMonthlyIncome: number;
70
+ inn: string;
71
+ jobsNumberInFiveYears: string;
72
+ startWorkDate: string;
73
+ workLength: number;
74
+ workLengthInFiveYears: number;
75
+ workLengthLastJob: number;
76
+ pdfFileWorkbook: string;
77
+ pdfFilePayout: string;
78
+ };
68
79
  };
69
80
 
70
81
  export const updateProfileEsia = (body: UpdateProfileEsiaBody) =>
@@ -34,7 +34,7 @@ type ParticipantIncome = {
34
34
  | 'WAGES'
35
35
  | 'RETIREMENT_INCOME';
36
36
  };
37
- value: number;
37
+ value: string;
38
38
  };
39
39
 
40
40
  export type PaymentType = {
@@ -74,7 +74,7 @@ export type Participant = {
74
74
  maritalStatusCd?: Option;
75
75
  militaryStatusCd?: Option;
76
76
  organizationActivityTypeCd?: Option;
77
- organizationInn?: number;
77
+ organizationInn?: string;
78
78
  organizationKindCd?: Option;
79
79
  organizationName?: string;
80
80
  organizationTypeCd?: Option;
@@ -1,19 +1,35 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
4
4
  import { type DaDataSuggestion } from '../../api/dadataHints/dadataHintsType';
5
+ import { getOrganizationFromInn } from '../../api/getOrganizationFromInn';
5
6
  import { useRetailFormStore } from '../../hooks/useRetailFormStore';
6
7
  import { updateOrganizationFields } from '../../utils/updateOrganizationFields';
7
8
  import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
8
9
 
9
10
  export const DaDataInnField = JSX<CustomFieldProps>(({ field, input }) => {
10
11
  const store = useRetailFormStore();
12
+ const esiaAccountTypeCd = field?.('esiaAccountTypeCd')?.value;
13
+ const inn = field?.('inn')?.value;
11
14
 
12
15
  const onDaDataChange = useCallback((item: DaDataSuggestion) => {
13
16
  field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
14
17
  updateOrganizationFields(store, field, item);
15
18
  }, []);
16
19
 
20
+ useEffect(() => {
21
+ if (!esiaAccountTypeCd || !inn) {
22
+ return;
23
+ }
24
+ (async () => {
25
+ const organization = await getOrganizationFromInn(inn as string);
26
+ if (organization) {
27
+ field?.('organizationName')?.onChange?.(organization.data?.name?.short_with_opf);
28
+ updateOrganizationFields(store, field, organization);
29
+ }
30
+ })();
31
+ }, []);
32
+
17
33
  return (
18
34
  <DaDataInputControl
19
35
  label="ИНН"
@@ -110,7 +110,7 @@ export interface LeadFormState extends FormRetailConsents, FormStateDeliveryType
110
110
  annualRevenue?: string;
111
111
  serviceDirection?: string;
112
112
  desiredMeetingDate?: string;
113
- inn?: number;
113
+ inn?: string;
114
114
  legalForm?: string;
115
115
  organizationName?: string;
116
116
  generalSeniority?: string;
@@ -138,20 +138,20 @@ export interface LeadFormState extends FormRetailConsents, FormStateDeliveryType
138
138
  familyMembers?: string;
139
139
  children?: string;
140
140
  dependents?: string;
141
- totalIncome?: number;
141
+ totalIncome?: string;
142
142
  expenses?: number;
143
143
  snils?: string;
144
144
  conscription?: Option;
145
145
  armyIdFlg?: boolean;
146
146
  addressRegistration?: Address;
147
147
  participantDateRegistration?: Date | string;
148
- retirementIncome?: number;
149
- otherIncome?: number;
150
- mandatoryPayments?: number;
151
- additionalIncome?: number;
152
- otherPayments?: number;
153
- rentalIncome?: number;
154
- wages?: number;
148
+ retirementIncome?: string;
149
+ otherIncome?: string;
150
+ mandatoryPayments?: string;
151
+ additionalIncome?: string;
152
+ otherPayments?: string;
153
+ rentalIncome?: string;
154
+ wages?: string;
155
155
  creditInRshbCd?: Option;
156
156
  bankruptcyFlg?: boolean;
157
157
  shareholderFlg?: boolean;