@redneckz/wildless-cms-uni-blocks 0.14.723 → 0.14.725

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 (110) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +113 -130
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationLeadForm/LeadFormState.d.ts +0 -1
  5. package/bundle/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -0
  6. package/bundle/ui-kit/DraftDialog/utils.d.ts +1 -1
  7. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  8. package/bundle/ui-kit/FormField/validators.d.ts +2 -1
  9. package/dist/components/ApplicationForm/ApplicationForm.js +1 -3
  10. package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  11. package/dist/components/ApplicationLeadForm/LeadFormState.d.ts +0 -1
  12. package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -0
  13. package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js +5 -3
  14. package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  15. package/dist/ui-kit/DraftDialog/utils.d.ts +1 -1
  16. package/dist/ui-kit/DraftDialog/utils.js +2 -1
  17. package/dist/ui-kit/DraftDialog/utils.js.map +1 -1
  18. package/dist/ui-kit/FormField/Fields/RetirementIncomeField.js +1 -10
  19. package/dist/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
  20. package/dist/ui-kit/FormField/Fields/WagesField.js +1 -10
  21. package/dist/ui-kit/FormField/Fields/WagesField.js.map +1 -1
  22. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  23. package/dist/ui-kit/FormField/getObjectValidator.js +1 -1
  24. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  25. package/dist/ui-kit/FormField/validators.d.ts +2 -1
  26. package/dist/ui-kit/FormField/validators.js +5 -3
  27. package/dist/ui-kit/FormField/validators.js.map +1 -1
  28. package/lib/components/ApplicationForm/ApplicationForm.js +1 -3
  29. package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  30. package/lib/components/ApplicationLeadForm/LeadFormState.d.ts +0 -1
  31. package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -0
  32. package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js +3 -2
  33. package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  34. package/lib/ui-kit/DraftDialog/utils.d.ts +1 -1
  35. package/lib/ui-kit/DraftDialog/utils.js +2 -1
  36. package/lib/ui-kit/DraftDialog/utils.js.map +1 -1
  37. package/lib/ui-kit/FormField/Fields/RetirementIncomeField.js +1 -10
  38. package/lib/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
  39. package/lib/ui-kit/FormField/Fields/WagesField.js +1 -10
  40. package/lib/ui-kit/FormField/Fields/WagesField.js.map +1 -1
  41. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  42. package/lib/ui-kit/FormField/getObjectValidator.js +2 -2
  43. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  44. package/lib/ui-kit/FormField/validators.d.ts +2 -1
  45. package/lib/ui-kit/FormField/validators.js +3 -2
  46. package/lib/ui-kit/FormField/validators.js.map +1 -1
  47. package/mobile/bundle/bundle.umd.js +113 -130
  48. package/mobile/bundle/bundle.umd.min.js +1 -1
  49. package/mobile/bundle/components/ApplicationLeadForm/LeadFormState.d.ts +0 -1
  50. package/mobile/bundle/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -0
  51. package/mobile/bundle/ui-kit/DraftDialog/utils.d.ts +1 -1
  52. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  53. package/mobile/bundle/ui-kit/FormField/validators.d.ts +2 -1
  54. package/mobile/dist/components/ApplicationForm/ApplicationForm.js +1 -3
  55. package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  56. package/mobile/dist/components/ApplicationLeadForm/LeadFormState.d.ts +0 -1
  57. package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -0
  58. package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js +5 -3
  59. package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  60. package/mobile/dist/ui-kit/DraftDialog/utils.d.ts +1 -1
  61. package/mobile/dist/ui-kit/DraftDialog/utils.js +2 -1
  62. package/mobile/dist/ui-kit/DraftDialog/utils.js.map +1 -1
  63. package/mobile/dist/ui-kit/FormField/Fields/RetirementIncomeField.js +1 -10
  64. package/mobile/dist/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
  65. package/mobile/dist/ui-kit/FormField/Fields/WagesField.js +1 -10
  66. package/mobile/dist/ui-kit/FormField/Fields/WagesField.js.map +1 -1
  67. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  68. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -1
  69. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  70. package/mobile/dist/ui-kit/FormField/validators.d.ts +2 -1
  71. package/mobile/dist/ui-kit/FormField/validators.js +5 -3
  72. package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
  73. package/mobile/lib/components/ApplicationForm/ApplicationForm.js +1 -3
  74. package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  75. package/mobile/lib/components/ApplicationLeadForm/LeadFormState.d.ts +0 -1
  76. package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -0
  77. package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js +3 -2
  78. package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  79. package/mobile/lib/ui-kit/DraftDialog/utils.d.ts +1 -1
  80. package/mobile/lib/ui-kit/DraftDialog/utils.js +2 -1
  81. package/mobile/lib/ui-kit/DraftDialog/utils.js.map +1 -1
  82. package/mobile/lib/ui-kit/FormField/Fields/RetirementIncomeField.js +1 -10
  83. package/mobile/lib/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
  84. package/mobile/lib/ui-kit/FormField/Fields/WagesField.js +1 -10
  85. package/mobile/lib/ui-kit/FormField/Fields/WagesField.js.map +1 -1
  86. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  87. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +2 -2
  88. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  89. package/mobile/lib/ui-kit/FormField/validators.d.ts +2 -1
  90. package/mobile/lib/ui-kit/FormField/validators.js +3 -2
  91. package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
  92. package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +8 -10
  93. package/mobile/src/components/ApplicationLeadForm/LeadFormState.ts +0 -1
  94. package/mobile/src/services/retail/adaptors/getFamilyStatusAndIncomeData.ts +4 -2
  95. package/mobile/src/ui-kit/DraftDialog/utils.ts +2 -3
  96. package/mobile/src/ui-kit/FormField/Fields/RetirementIncomeField.tsx +9 -25
  97. package/mobile/src/ui-kit/FormField/Fields/WagesField.tsx +9 -25
  98. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +0 -1
  99. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +2 -1
  100. package/mobile/src/ui-kit/FormField/validators.ts +7 -3
  101. package/package.json +1 -1
  102. package/src/components/ApplicationForm/ApplicationForm.tsx +8 -10
  103. package/src/components/ApplicationLeadForm/LeadFormState.ts +0 -1
  104. package/src/services/retail/adaptors/getFamilyStatusAndIncomeData.ts +4 -2
  105. package/src/ui-kit/DraftDialog/utils.ts +2 -3
  106. package/src/ui-kit/FormField/Fields/RetirementIncomeField.tsx +9 -25
  107. package/src/ui-kit/FormField/Fields/WagesField.tsx +9 -25
  108. package/src/ui-kit/FormField/NameFieldDef.ts +0 -1
  109. package/src/ui-kit/FormField/getObjectValidator.tsx +2 -1
  110. package/src/ui-kit/FormField/validators.ts +7 -3
@@ -1555,8 +1555,6 @@
1555
1555
  const isValidationSuccess = (info) => !info?.length;
1556
1556
  const validator = (predicate) => (message) => (_) => predicate(_) ? [] : [message];
1557
1557
 
1558
- const pattern = (regexp) => validator((_) => typeof _ === 'string' && regexp.test(_));
1559
-
1560
1558
  const required = validator((_) => _ !== null && _ !== undefined && _ !== '');
1561
1559
 
1562
1560
  const ERROR_MESSAGE = 'Некорректно заполненное поле';
@@ -1572,7 +1570,9 @@
1572
1570
  const serieValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 4)(errorMsg);
1573
1571
  const numberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 6)(errorMsg);
1574
1572
  const innValidator = (errorMsg) => validator((_) => typeof _ === 'string' && (_.length === 10 || _.length === 12))(errorMsg);
1575
- const phoneValidator = (errorMsg) => pattern(/^(\+7)?[\s-]?\(?[0-9]{3}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/)(errorMsg);
1573
+ const phoneValidate = (email) => /^(\+7)?[\s-]?\(?[0-9]{3}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/.test(email);
1574
+ const phoneValidator = (errorMsg) => validator(phoneValidate)(errorMsg);
1575
+ const phoneOptionalValidator = (errorMsg) => validator((_) => !_ || phoneValidate(_))(errorMsg);
1576
1576
  const agreementValidator = validator((_) => typeof _ === 'boolean' && _)('Согласие обязательно');
1577
1577
  const snilsValidate = (snils) => {
1578
1578
  const snl = String(snils).replace(/[^0-9]+/g, '');
@@ -1619,7 +1619,7 @@
1619
1619
  region: defaultSelectValidator(),
1620
1620
  addressBranch: defaultSelectValidator(),
1621
1621
  phone: phoneValidator('Укажите номер телефона'),
1622
- secondaryPhone: phoneValidator('Укажите номер телефона'),
1622
+ secondaryPhone: phoneOptionalValidator('Укажите номер телефона'),
1623
1623
  organizationPhone: phoneValidator('Укажите номер телефона'),
1624
1624
  birthday: defaultValidator('Укажите дату рождения'),
1625
1625
  limitedBirthday: limitedBirthdayValidator(),
@@ -4057,15 +4057,7 @@
4057
4057
  return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", isSearch: true, options: formatRegions, ...getValidation(field('regionRetail'), validatorObj.regionRetail, input?.required) }));
4058
4058
  });
4059
4059
 
4060
- const RetirementIncomeField = JSX(({ field, input }) => {
4061
- const currentWages = field('wages')?.value;
4062
- const onChange = useCallback((_) => {
4063
- const incomesSum = Number(_) + Number(currentWages || 0);
4064
- field('retirementIncome')?.onChange?.(_);
4065
- field('incomeAverage')?.onChange?.(String(incomesSum));
4066
- }, [currentWages]);
4067
- return (jsx(InputControl, { label: "\u041F\u0435\u043D\u0441\u0438\u043E\u043D\u043D\u044B\u0435 \u0434\u043E\u0445\u043E\u0434\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('retirementIncome'), validatorObj.retirementIncome, input?.required), ...input, onChange: onChange }));
4068
- });
4060
+ const RetirementIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041F\u0435\u043D\u0441\u0438\u043E\u043D\u043D\u044B\u0435 \u0434\u043E\u0445\u043E\u0434\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('retirementIncome'), validatorObj.retirementIncome, input?.required), ...input })));
4069
4061
 
4070
4062
  const SecondaryPhoneField = JSX(({ field }) => {
4071
4063
  const fieldPhone = field('secondaryPhone');
@@ -4154,15 +4146,7 @@
4154
4146
  return (jsx("div", { className: "py-m gap-m grid @xl:flex @xl:items-center", children: jsx(RadioButtonGroup, { className: "whitespace-normal", orientation: "horizontal", items: VED_TYPES, value: value, onChange: (_) => onChange && onChange(_) }) }));
4155
4147
  });
4156
4148
 
4157
- const WagesField = JSX(({ field, input }) => {
4158
- const currentRetirementIncome = field('retirementIncome')?.value;
4159
- const onChange = useCallback((_) => {
4160
- const incomesSum = Number(_) + Number(currentRetirementIncome || 0);
4161
- field('wages')?.onChange?.(_);
4162
- field('incomeAverage')?.onChange?.(String(incomesSum));
4163
- }, [currentRetirementIncome]);
4164
- return (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('wages'), validatorObj.wages, input?.required), ...input, onChange: onChange }));
4165
- });
4149
+ const WagesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('wages'), validatorObj.wages, input?.required), ...input })));
4166
4150
 
4167
4151
  function isRenderField({ input, field, }) {
4168
4152
  const { condition } = input;
@@ -4415,9 +4399,7 @@
4415
4399
  }, [responseType]);
4416
4400
  return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, { typeForm }))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
4417
4401
  });
4418
- const getFilteredInputs = (inputs, data) => inputs
4419
- .filter((_) => (_?.name === 'secondaryPhone' ? Boolean(data.secondaryPhone) : _))
4420
- .filter((input) => !input?.condition ||
4402
+ const getFilteredInputs = (inputs, data) => inputs.filter((input) => !input?.condition ||
4421
4403
  input?.condition.values.find((_) => {
4422
4404
  const dataValue = data?.[input?.condition?.name ?? ''];
4423
4405
  return _ === (dataValue?.key ?? dataValue);
@@ -4792,6 +4774,98 @@
4792
4774
 
4793
4775
  const DraftActionButton = JSX(({ title, icon, description, onClick = noop }) => (jsxs("button", { className: "flex gap-lg items-center border border-gray rounded-md cursor-pointer p-4 hover:border-green", type: "button", onClick: onClick, children: [jsx(Img, { image: { icon: icon, iconVersion: 'black' }, width: "78", height: "78" }), jsxs("div", { className: "w-full md:w-auto", children: [jsx(Heading, { className: "text-center md:text-left", title: title, headingType: "h5" }), description ? (jsx(Paragraph, { color: "text-secondary-text", size: "text-m", children: description })) : null] })] })));
4794
4776
 
4777
+ const fieldsNamesToContactKeysMap = {
4778
+ email: 'EMAIL',
4779
+ phone: 'MAIN_PHONE',
4780
+ organizationPhone: 'ORGANIZATION_PHONE',
4781
+ };
4782
+ const fieldsNamesToAddressKeysMap = {
4783
+ addressRegistration: 'REGISTRATION',
4784
+ addressFact: 'RESIDENTAL',
4785
+ organizationAddress: 'WORK',
4786
+ addressCourier: 'DELIVERY',
4787
+ };
4788
+ const fieldsNamesToIncomeKeysMap = {
4789
+ incomeAverage: 'INCOME_AVERAGE',
4790
+ mandatoryPayments: 'MANDATORY_PAYMENTS',
4791
+ additionalIncome: 'ADDITIONAL_INCOME',
4792
+ otherIncome: 'OTHER_INCOME',
4793
+ otherPayments: 'OTHER_PAYMENTS',
4794
+ rentalIncome: 'RENTAL_INCOME',
4795
+ wages: 'WAGES',
4796
+ retirementIncome: 'RETIREMENT_INCOME',
4797
+ };
4798
+ const getParticipantContacts$1 = (fields) => Object.entries(fields).reduce((acc, [key, value]) => {
4799
+ if (key in fieldsNamesToContactKeysMap) {
4800
+ return [
4801
+ ...acc,
4802
+ {
4803
+ contactTypeCd: {
4804
+ key: fieldsNamesToContactKeysMap[key],
4805
+ },
4806
+ value,
4807
+ },
4808
+ ];
4809
+ }
4810
+ return acc;
4811
+ }, []);
4812
+ const getParticipantAddresses$1 = (fields) => Object.entries(fields).reduce((acc, [key, value]) => {
4813
+ if (key in fieldsNamesToAddressKeysMap) {
4814
+ const address = Object.fromEntries(Object.entries(value ?? {})
4815
+ .filter(([k]) => !k.startsWith('qc')) // exclude dadata fields
4816
+ .map(([k, v]) => [k, v ?? '']));
4817
+ return [
4818
+ ...acc,
4819
+ {
4820
+ addressType: {
4821
+ key: fieldsNamesToAddressKeysMap[key],
4822
+ },
4823
+ ...address,
4824
+ },
4825
+ ];
4826
+ }
4827
+ return acc;
4828
+ }, []);
4829
+ const getParticipantIncomes$1 = (fields) => Object.entries(fields).reduce((acc, [key, value]) => {
4830
+ if (key in fieldsNamesToIncomeKeysMap) {
4831
+ return [
4832
+ ...acc,
4833
+ {
4834
+ incomeTypeCd: {
4835
+ key: fieldsNamesToIncomeKeysMap[key],
4836
+ },
4837
+ value: Number(value || 0),
4838
+ },
4839
+ ];
4840
+ }
4841
+ return acc;
4842
+ }, []);
4843
+
4844
+ const getFamilyStatusAndIncomeData = (formData) => {
4845
+ const { familyStatus, dependents, familyMembers, children, confirmationIncome, wages, mandatoryPayments, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, conscription, } = formData;
4846
+ return {
4847
+ maritalStatusCd: familyStatus,
4848
+ totalDependents: familyMembers,
4849
+ incomeCertificateCd: confirmationIncome,
4850
+ otherDependents: dependents,
4851
+ childrenDependents: children,
4852
+ militaryStatusCd: conscription,
4853
+ participantIncomes: getParticipantIncomes$1({
4854
+ wages,
4855
+ mandatoryPayments,
4856
+ incomeAverage: countIncomeAverage(wages, retirementIncome),
4857
+ additionalIncome,
4858
+ otherIncome,
4859
+ otherPayments,
4860
+ rentalIncome,
4861
+ retirementIncome,
4862
+ }),
4863
+ snils: snils?.replaceAll(' ', '').replaceAll('-', ''),
4864
+ armyIdFlg,
4865
+ };
4866
+ };
4867
+ const countIncomeAverage = (wages, retirementIncome) => Number(wages) + Number(retirementIncome);
4868
+
4795
4869
  const creditCodesToProgrammIdMap = {
4796
4870
  credit_cash: '10',
4797
4871
  credit_cash_single_doc: '28',
@@ -4814,15 +4888,15 @@
4814
4888
  ...creditCodesToProgrammIdMap,
4815
4889
  ...cardCodesToProgrammIdMap,
4816
4890
  };
4817
- const getParticipantIncomes$1 = (participantIncomes) => {
4891
+ const getParticipantIncomes = (participantIncomes) => {
4818
4892
  const wages = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "WAGES" /* EIncomesType.WAGES */)?.value;
4819
4893
  const mandatoryPayments = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "MANDATORY_PAYMENTS" /* EIncomesType.MANDATORY_PAYMENTS */)?.value;
4820
- const incomeAverage = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "INCOME_AVERAGE" /* EIncomesType.INCOME_AVERAGE */)?.value;
4821
4894
  const additionalIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "ADDITIONAL_INCOME" /* EIncomesType.ADDITIONAL_INCOME */)?.value;
4822
4895
  const otherIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "OTHER_INCOME" /* EIncomesType.OTHER_INCOME */)?.value;
4823
4896
  const otherPayments = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "OTHER_PAYMENTS" /* EIncomesType.OTHER_PAYMENTS */)?.value;
4824
4897
  const rentalIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "RENTAL_INCOME" /* EIncomesType.RENTAL_INCOME */)?.value;
4825
4898
  const retirementIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "RETIREMENT_INCOME" /* EIncomesType.RETIREMENT_INCOME */)?.value;
4899
+ const incomeAverage = countIncomeAverage(wages, retirementIncome);
4826
4900
  return {
4827
4901
  wages,
4828
4902
  mandatoryPayments,
@@ -4834,7 +4908,7 @@
4834
4908
  retirementIncome,
4835
4909
  };
4836
4910
  };
4837
- const getParticipantAddresses$1 = (participantAddresses) => {
4911
+ const getParticipantAddresses = (participantAddresses) => {
4838
4912
  const addressRegistration = participantAddresses?.find((address) => address.addressType.key === "REGISTRATION" /* EAddressType.REGISTRATION */);
4839
4913
  const addressFact = participantAddresses?.find((address) => address.addressType.key === "RESIDENTAL" /* EAddressType.RESIDENTAL */);
4840
4914
  const organizationAddress = participantAddresses?.find((address) => address.addressType.key === "WORK" /* EAddressType.WORK */);
@@ -4844,7 +4918,7 @@
4844
4918
  organizationAddress,
4845
4919
  };
4846
4920
  };
4847
- const getParticipantContacts$1 = (participantContacts) => {
4921
+ const getParticipantContacts = (participantContacts) => {
4848
4922
  const email = participantContacts?.find((contact) => contact.contactTypeCd.key === "EMAIL" /* EContactType.EMail */)?.value;
4849
4923
  const phone = participantContacts?.find((contact) => contact.contactTypeCd.key === "MAIN_PHONE" /* EContactType.MainPhone */)?.value;
4850
4924
  const organizationPhone = participantContacts?.find((contact) => contact.contactTypeCd.key === "ORGANIZATION_PHONE" /* EContactType.OrganizationPhone */)?.value;
@@ -4926,9 +5000,9 @@
4926
5000
  monthsValue,
4927
5001
  isAnnuity: paymentTypeCd?.key === 'ANNUITY',
4928
5002
  },
4929
- ...getParticipantIncomes$1(participantIncomes),
4930
- ...getParticipantAddresses$1(participantAddresses),
4931
- ...getParticipantContacts$1(participantContacts),
5003
+ ...getParticipantIncomes(participantIncomes),
5004
+ ...getParticipantAddresses(participantAddresses),
5005
+ ...getParticipantContacts(participantContacts),
4932
5006
  ...getParticipantGender(genderCd),
4933
5007
  };
4934
5008
  };
@@ -5013,73 +5087,6 @@
5013
5087
  }, [open, nextStepLink]);
5014
5088
  };
5015
5089
 
5016
- const fieldsNamesToContactKeysMap = {
5017
- email: 'EMAIL',
5018
- phone: 'MAIN_PHONE',
5019
- organizationPhone: 'ORGANIZATION_PHONE',
5020
- };
5021
- const fieldsNamesToAddressKeysMap = {
5022
- addressRegistration: 'REGISTRATION',
5023
- addressFact: 'RESIDENTAL',
5024
- organizationAddress: 'WORK',
5025
- addressCourier: 'DELIVERY',
5026
- };
5027
- const fieldsNamesToIncomeKeysMap = {
5028
- incomeAverage: 'INCOME_AVERAGE',
5029
- mandatoryPayments: 'MANDATORY_PAYMENTS',
5030
- additionalIncome: 'ADDITIONAL_INCOME',
5031
- otherIncome: 'OTHER_INCOME',
5032
- otherPayments: 'OTHER_PAYMENTS',
5033
- rentalIncome: 'RENTAL_INCOME',
5034
- wages: 'WAGES',
5035
- retirementIncome: 'RETIREMENT_INCOME',
5036
- };
5037
- const getParticipantContacts = (fields) => Object.entries(fields).reduce((acc, [key, value]) => {
5038
- if (key in fieldsNamesToContactKeysMap) {
5039
- return [
5040
- ...acc,
5041
- {
5042
- contactTypeCd: {
5043
- key: fieldsNamesToContactKeysMap[key],
5044
- },
5045
- value,
5046
- },
5047
- ];
5048
- }
5049
- return acc;
5050
- }, []);
5051
- const getParticipantAddresses = (fields) => Object.entries(fields).reduce((acc, [key, value]) => {
5052
- if (key in fieldsNamesToAddressKeysMap) {
5053
- const address = Object.fromEntries(Object.entries(value ?? {})
5054
- .filter(([k]) => !k.startsWith('qc')) // exclude dadata fields
5055
- .map(([k, v]) => [k, v ?? '']));
5056
- return [
5057
- ...acc,
5058
- {
5059
- addressType: {
5060
- key: fieldsNamesToAddressKeysMap[key],
5061
- },
5062
- ...address,
5063
- },
5064
- ];
5065
- }
5066
- return acc;
5067
- }, []);
5068
- const getParticipantIncomes = (fields) => Object.entries(fields).reduce((acc, [key, value]) => {
5069
- if (key in fieldsNamesToIncomeKeysMap) {
5070
- return [
5071
- ...acc,
5072
- {
5073
- incomeTypeCd: {
5074
- key: fieldsNamesToIncomeKeysMap[key],
5075
- },
5076
- value: Number(value || 0),
5077
- },
5078
- ];
5079
- }
5080
- return acc;
5081
- }, []);
5082
-
5083
5090
  const getLeadFormTaskData = ({ participantId, taskId, profileId, formData, }) => {
5084
5091
  const { name, surname, middleName, limitedBirthday, phone, email } = formData;
5085
5092
  const navigator = locationNavigator();
@@ -5099,7 +5106,7 @@
5099
5106
  profile: {
5100
5107
  id: profileId,
5101
5108
  },
5102
- participantContacts: getParticipantContacts({
5109
+ participantContacts: getParticipantContacts$1({
5103
5110
  phone: phone && formatPhone(phone),
5104
5111
  email,
5105
5112
  }),
@@ -7041,38 +7048,14 @@
7041
7048
  jobsNumber,
7042
7049
  lastWorkDuration: lastJobExperience,
7043
7050
  positionCd: positionOrganization,
7044
- participantContacts: getParticipantContacts({
7051
+ participantContacts: getParticipantContacts$1({
7045
7052
  organizationPhone: organizationPhone && formatPhone(organizationPhone),
7046
7053
  }),
7047
- participantAddresses: getParticipantAddresses({ organizationAddress }),
7054
+ participantAddresses: getParticipantAddresses$1({ organizationAddress }),
7048
7055
  ownershipShare: positionOrganization?.key === 'BUSINESS_OWNER' ? partInBusiness : '',
7049
7056
  };
7050
7057
  };
7051
7058
 
7052
- const getFamilyStatusAndIncomeData = (formData) => {
7053
- const { familyStatus, dependents, familyMembers, children, confirmationIncome, wages, mandatoryPayments, incomeAverage, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, conscription, } = formData;
7054
- return {
7055
- maritalStatusCd: familyStatus,
7056
- totalDependents: familyMembers,
7057
- incomeCertificateCd: confirmationIncome,
7058
- otherDependents: dependents,
7059
- childrenDependents: children,
7060
- militaryStatusCd: conscription,
7061
- participantIncomes: getParticipantIncomes({
7062
- wages,
7063
- mandatoryPayments,
7064
- incomeAverage,
7065
- additionalIncome,
7066
- otherIncome,
7067
- otherPayments,
7068
- rentalIncome,
7069
- retirementIncome,
7070
- }),
7071
- snils: snils?.replaceAll(' ', '').replaceAll('-', ''),
7072
- armyIdFlg,
7073
- };
7074
- };
7075
-
7076
7059
  const getPersonalInfoData = (formData) => {
7077
7060
  const { name, surname, middleName, limitedBirthday = '', phone = '', email, sex, birthPlace, dulIssueDateField = '', dulIssuedBy, dulNumber, dulSerie, dulSubdivisionCode, education, participantDateRegistration = '', housing, addressRegistration, addressFact, } = formData;
7078
7061
  return {
@@ -7089,11 +7072,11 @@
7089
7072
  educationLevelCd: education,
7090
7073
  registrationDate: formatDate(participantDateRegistration, true),
7091
7074
  houseTypeCd: housing,
7092
- participantContacts: getParticipantContacts({
7075
+ participantContacts: getParticipantContacts$1({
7093
7076
  phone: formatPhone(phone),
7094
7077
  email,
7095
7078
  }),
7096
- participantAddresses: getParticipantAddresses({ addressRegistration, addressFact }),
7079
+ participantAddresses: getParticipantAddresses$1({ addressRegistration, addressFact }),
7097
7080
  genderCd: sex
7098
7081
  ? {
7099
7082
  key: sex === 'male' ? 'MAN' : 'WOMAN',
@@ -7134,7 +7117,7 @@
7134
7117
  const isCourierDelivery = methodObtain === 'courier';
7135
7118
  return isCourierDelivery
7136
7119
  ? {
7137
- participantAddresses: getParticipantAddresses({ addressCourier }),
7120
+ participantAddresses: getParticipantAddresses$1({ addressCourier }),
7138
7121
  }
7139
7122
  : {};
7140
7123
  };
@@ -10510,7 +10493,7 @@
10510
10493
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
10511
10494
  });
10512
10495
 
10513
- const packageVersion = "0.14.722";
10496
+ const packageVersion = "0.14.724";
10514
10497
 
10515
10498
  exports.Blocks = Blocks;
10516
10499
  exports.ContentPage = ContentPage;