@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.
- package/bundle/bundle.umd.js +36 -6
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/bundle/retail/adaptors/utils.d.ts +1 -1
- package/bundle/retail/api/getOrganizationFromInn.d.ts +2 -0
- package/bundle/retail/api/updateProfileEsia.d.ts +11 -0
- package/bundle/retail/api/updateUserTask.d.ts +2 -2
- package/bundle/retail/components/DraftDialog/utils.d.ts +8 -8
- package/bundle/retail/model/LeadFormState.d.ts +9 -9
- package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +11 -1
- package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/dist/hooks/useAspects/aspects/getAspectsWithInclude.js +1 -3
- package/dist/hooks/useAspects/aspects/getAspectsWithInclude.js.map +1 -1
- package/dist/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/dist/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/dist/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/dist/retail/adaptors/utils.d.ts +1 -1
- package/dist/retail/api/getOrganizationFromInn.d.ts +2 -0
- package/dist/retail/api/getOrganizationFromInn.js +12 -0
- package/dist/retail/api/getOrganizationFromInn.js.map +1 -0
- package/dist/retail/api/updateProfileEsia.d.ts +11 -0
- package/dist/retail/api/updateProfileEsia.js.map +1 -1
- package/dist/retail/api/updateUserTask.d.ts +2 -2
- package/dist/retail/components/DraftDialog/utils.d.ts +8 -8
- package/dist/retail/components/Fields/DaDataInnField.js +15 -0
- package/dist/retail/components/Fields/DaDataInnField.js.map +1 -1
- package/dist/retail/model/LeadFormState.d.ts +9 -9
- package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +11 -1
- package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/lib/hooks/useAspects/aspects/getAspectsWithInclude.js +1 -3
- package/lib/hooks/useAspects/aspects/getAspectsWithInclude.js.map +1 -1
- package/lib/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/lib/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/lib/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/lib/retail/adaptors/utils.d.ts +1 -1
- package/lib/retail/api/getOrganizationFromInn.d.ts +2 -0
- package/lib/retail/api/getOrganizationFromInn.js +9 -0
- package/lib/retail/api/getOrganizationFromInn.js.map +1 -0
- package/lib/retail/api/updateProfileEsia.d.ts +11 -0
- package/lib/retail/api/updateProfileEsia.js.map +1 -1
- package/lib/retail/api/updateUserTask.d.ts +2 -2
- package/lib/retail/components/DraftDialog/utils.d.ts +8 -8
- package/lib/retail/components/Fields/DaDataInnField.js +16 -1
- package/lib/retail/components/Fields/DaDataInnField.js.map +1 -1
- package/lib/retail/model/LeadFormState.d.ts +9 -9
- package/mobile/bundle/bundle.umd.js +36 -6
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/mobile/bundle/retail/adaptors/utils.d.ts +1 -1
- package/mobile/bundle/retail/api/getOrganizationFromInn.d.ts +2 -0
- package/mobile/bundle/retail/api/updateProfileEsia.d.ts +11 -0
- package/mobile/bundle/retail/api/updateUserTask.d.ts +2 -2
- package/mobile/bundle/retail/components/DraftDialog/utils.d.ts +8 -8
- package/mobile/bundle/retail/model/LeadFormState.d.ts +9 -9
- package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js +11 -1
- package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/mobile/dist/hooks/useAspects/aspects/getAspectsWithInclude.js +1 -3
- package/mobile/dist/hooks/useAspects/aspects/getAspectsWithInclude.js.map +1 -1
- package/mobile/dist/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/mobile/dist/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/mobile/dist/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/mobile/dist/retail/adaptors/utils.d.ts +1 -1
- package/mobile/dist/retail/api/getOrganizationFromInn.d.ts +2 -0
- package/mobile/dist/retail/api/getOrganizationFromInn.js +12 -0
- package/mobile/dist/retail/api/getOrganizationFromInn.js.map +1 -0
- package/mobile/dist/retail/api/updateProfileEsia.d.ts +11 -0
- package/mobile/dist/retail/api/updateProfileEsia.js.map +1 -1
- package/mobile/dist/retail/api/updateUserTask.d.ts +2 -2
- package/mobile/dist/retail/components/DraftDialog/utils.d.ts +8 -8
- package/mobile/dist/retail/components/Fields/DaDataInnField.js +15 -0
- package/mobile/dist/retail/components/Fields/DaDataInnField.js.map +1 -1
- package/mobile/dist/retail/model/LeadFormState.d.ts +9 -9
- package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js +11 -1
- package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/mobile/lib/hooks/useAspects/aspects/getAspectsWithInclude.js +1 -3
- package/mobile/lib/hooks/useAspects/aspects/getAspectsWithInclude.js.map +1 -1
- package/mobile/lib/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/mobile/lib/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/mobile/lib/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/mobile/lib/retail/adaptors/utils.d.ts +1 -1
- package/mobile/lib/retail/api/getOrganizationFromInn.d.ts +2 -0
- package/mobile/lib/retail/api/getOrganizationFromInn.js +9 -0
- package/mobile/lib/retail/api/getOrganizationFromInn.js.map +1 -0
- package/mobile/lib/retail/api/updateProfileEsia.d.ts +11 -0
- package/mobile/lib/retail/api/updateProfileEsia.js.map +1 -1
- package/mobile/lib/retail/api/updateUserTask.d.ts +2 -2
- package/mobile/lib/retail/components/DraftDialog/utils.d.ts +8 -8
- package/mobile/lib/retail/components/Fields/DaDataInnField.js +16 -1
- package/mobile/lib/retail/components/Fields/DaDataInnField.js.map +1 -1
- package/mobile/lib/retail/model/LeadFormState.d.ts +9 -9
- package/mobile/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +13 -1
- package/mobile/src/hooks/useAspects/aspects/getAspectsWithInclude.tsx +1 -4
- package/mobile/src/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
- package/mobile/src/retail/adaptors/utils.ts +1 -1
- package/mobile/src/retail/api/getOrganizationFromInn.ts +11 -0
- package/mobile/src/retail/api/updateProfileEsia.ts +11 -0
- package/mobile/src/retail/api/updateUserTask.ts +2 -2
- package/mobile/src/retail/components/Fields/DaDataInnField.tsx +17 -1
- package/mobile/src/retail/model/LeadFormState.ts +9 -9
- package/package.json +1 -1
- package/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +13 -1
- package/src/hooks/useAspects/aspects/getAspectsWithInclude.tsx +1 -4
- package/src/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
- package/src/retail/adaptors/utils.ts +1 -1
- package/src/retail/api/getOrganizationFromInn.ts +11 -0
- package/src/retail/api/updateProfileEsia.ts +11 -0
- package/src/retail/api/updateUserTask.ts +2 -2
- package/src/retail/components/Fields/DaDataInnField.tsx +17 -1
- 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?:
|
|
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?:
|
|
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?:
|
|
137
|
-
otherIncome?:
|
|
138
|
-
mandatoryPayments?:
|
|
139
|
-
additionalIncome?:
|
|
140
|
-
otherPayments?:
|
|
141
|
-
rentalIncome?:
|
|
142
|
-
wages?:
|
|
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 } =
|
|
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?:
|
|
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,
|
|
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:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
149
|
-
otherIncome?:
|
|
150
|
-
mandatoryPayments?:
|
|
151
|
-
additionalIncome?:
|
|
152
|
-
otherPayments?:
|
|
153
|
-
rentalIncome?:
|
|
154
|
-
wages?:
|
|
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
|
@@ -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 } =
|
|
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?:
|
|
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,
|
|
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:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
149
|
-
otherIncome?:
|
|
150
|
-
mandatoryPayments?:
|
|
151
|
-
additionalIncome?:
|
|
152
|
-
otherPayments?:
|
|
153
|
-
rentalIncome?:
|
|
154
|
-
wages?:
|
|
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;
|