@redneckz/wildless-cms-uni-blocks 0.14.685 → 0.14.687

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 (88) hide show
  1. package/bundle/api/RetailAPI/getGenderFromName.d.ts +1 -0
  2. package/bundle/bundle.umd.js +57 -19
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  5. package/dist/api/RetailAPI/getGenderFromName.d.ts +1 -0
  6. package/dist/api/RetailAPI/getGenderFromName.js +15 -0
  7. package/dist/api/RetailAPI/getGenderFromName.js.map +1 -0
  8. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  9. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  10. package/dist/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  11. package/dist/components/ApplicationLeadForm/applicationFormData.js +25 -0
  12. package/dist/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  13. package/dist/components/CreditForm/calculateInputs.js +2 -1
  14. package/dist/components/CreditForm/calculateInputs.js.map +1 -1
  15. package/dist/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  16. package/dist/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  17. package/dist/ui-kit/FormField/Fields/SexField.js +17 -1
  18. package/dist/ui-kit/FormField/Fields/SexField.js.map +1 -1
  19. package/dist/ui-kit/FormField/Fields/SnilsField.js +1 -4
  20. package/dist/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
  21. package/lib/api/RetailAPI/getGenderFromName.d.ts +1 -0
  22. package/lib/api/RetailAPI/getGenderFromName.js +12 -0
  23. package/lib/api/RetailAPI/getGenderFromName.js.map +1 -0
  24. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  25. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  26. package/lib/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  27. package/lib/components/ApplicationLeadForm/applicationFormData.js +23 -0
  28. package/lib/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  29. package/lib/components/CreditForm/calculateInputs.js +2 -1
  30. package/lib/components/CreditForm/calculateInputs.js.map +1 -1
  31. package/lib/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  32. package/lib/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  33. package/lib/ui-kit/FormField/Fields/SexField.js +17 -1
  34. package/lib/ui-kit/FormField/Fields/SexField.js.map +1 -1
  35. package/lib/ui-kit/FormField/Fields/SnilsField.js +1 -4
  36. package/lib/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
  37. package/mobile/bundle/api/RetailAPI/getGenderFromName.d.ts +1 -0
  38. package/mobile/bundle/bundle.umd.js +57 -19
  39. package/mobile/bundle/bundle.umd.min.js +1 -1
  40. package/mobile/bundle/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  41. package/mobile/dist/api/RetailAPI/getGenderFromName.d.ts +1 -0
  42. package/mobile/dist/api/RetailAPI/getGenderFromName.js +15 -0
  43. package/mobile/dist/api/RetailAPI/getGenderFromName.js.map +1 -0
  44. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  45. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  46. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  47. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.js +25 -0
  48. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  49. package/mobile/dist/components/CreditForm/calculateInputs.js +2 -1
  50. package/mobile/dist/components/CreditForm/calculateInputs.js.map +1 -1
  51. package/mobile/dist/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  52. package/mobile/dist/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  53. package/mobile/dist/ui-kit/FormField/Fields/SexField.js +17 -1
  54. package/mobile/dist/ui-kit/FormField/Fields/SexField.js.map +1 -1
  55. package/mobile/dist/ui-kit/FormField/Fields/SnilsField.js +1 -4
  56. package/mobile/dist/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
  57. package/mobile/lib/api/RetailAPI/getGenderFromName.d.ts +1 -0
  58. package/mobile/lib/api/RetailAPI/getGenderFromName.js +12 -0
  59. package/mobile/lib/api/RetailAPI/getGenderFromName.js.map +1 -0
  60. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  61. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  62. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  63. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.js +23 -0
  64. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  65. package/mobile/lib/components/CreditForm/calculateInputs.js +2 -1
  66. package/mobile/lib/components/CreditForm/calculateInputs.js.map +1 -1
  67. package/mobile/lib/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  68. package/mobile/lib/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  69. package/mobile/lib/ui-kit/FormField/Fields/SexField.js +17 -1
  70. package/mobile/lib/ui-kit/FormField/Fields/SexField.js.map +1 -1
  71. package/mobile/lib/ui-kit/FormField/Fields/SnilsField.js +1 -4
  72. package/mobile/lib/ui-kit/FormField/Fields/SnilsField.js.map +1 -1
  73. package/mobile/src/api/RetailAPI/getGenderFromName.ts +20 -0
  74. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +4 -11
  75. package/mobile/src/components/ApplicationLeadForm/applicationFormData.tsx +24 -0
  76. package/mobile/src/components/CreditForm/calculateInputs.ts +4 -1
  77. package/mobile/src/ui-kit/FormField/Fields/MiddleNameField.tsx +9 -22
  78. package/mobile/src/ui-kit/FormField/Fields/SexField.tsx +26 -8
  79. package/mobile/src/ui-kit/FormField/Fields/SnilsField.tsx +7 -11
  80. package/package.json +1 -1
  81. package/src/api/RetailAPI/getGenderFromName.ts +20 -0
  82. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +1 -23
  83. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +4 -11
  84. package/src/components/ApplicationLeadForm/applicationFormData.tsx +24 -0
  85. package/src/components/CreditForm/calculateInputs.ts +4 -1
  86. package/src/ui-kit/FormField/Fields/MiddleNameField.tsx +9 -22
  87. package/src/ui-kit/FormField/Fields/SexField.tsx +26 -8
  88. package/src/ui-kit/FormField/Fields/SnilsField.tsx +7 -11
@@ -0,0 +1 @@
1
+ export declare const getGenderFromName: (name: string) => Promise<string>;
@@ -3553,15 +3553,7 @@
3553
3553
  const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
3554
3554
 
3555
3555
  const FIELD_NAME$2 = 'middleName';
3556
- const MiddleNameField = JSX(({ field, input }) => {
3557
- const onDaDataChange = useCallback((item) => {
3558
- const dadataGender = item?.data?.gender;
3559
- if (dadataGender && dadataGender !== 'UNKNOWN') {
3560
- field('sex')?.onChange?.(dadataGender.toLowerCase());
3561
- }
3562
- }, []);
3563
- return (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$2), ...getValidation(field(FIELD_NAME$2), validatorObj.middleName, input?.required), ...input, onDaDataChange: onDaDataChange }));
3564
- });
3556
+ const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$2), ...getValidation(field(FIELD_NAME$2), validatorObj.middleName, input?.required), ...input })));
3565
3557
 
3566
3558
  const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
3567
3559
 
@@ -3717,11 +3709,36 @@
3717
3709
 
3718
3710
  const ServiceDirectionField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...getValidation(field('serviceDirection'), validatorObj.serviceDirection, input?.required) })));
3719
3711
 
3712
+ const GENDERS = ['male', 'female'];
3713
+ const getGenderFromName = async (name) => {
3714
+ const res = await fetchRetailJSON('/suggestions/suggest/fio', 'POST', {
3715
+ query: name,
3716
+ count: 1,
3717
+ parts: ['NAME'],
3718
+ });
3719
+ const gender = res?.suggestions[0]?.data?.gender?.toLowerCase() || '';
3720
+ return GENDERS.includes(gender) ? gender : '';
3721
+ };
3722
+
3720
3723
  const SEX_TYPES = [
3721
3724
  { id: 'male', text: 'Мужской' },
3722
3725
  { id: 'female', text: 'Женский' },
3723
3726
  ];
3724
- const SexField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { label: "\u041F\u043E\u043B", orientation: "horizontal", items: SEX_TYPES, ...getValidation(field('sex'), validatorObj.sex, input?.required) })));
3727
+ const SexField = JSX(({ field, input }) => {
3728
+ const name = field('name')?.value;
3729
+ const { value: selectedSex, onChange: changeSex } = field('sex');
3730
+ useEffect(() => {
3731
+ if (name && !selectedSex) {
3732
+ (async () => {
3733
+ const gender = await getGenderFromName(name);
3734
+ if (gender) {
3735
+ changeSex?.(gender);
3736
+ }
3737
+ })();
3738
+ }
3739
+ }, []);
3740
+ return (jsx(RadioButtonGroupControl, { label: "\u041F\u043E\u043B", orientation: "horizontal", items: SEX_TYPES, ...getValidation(field('sex'), validatorObj.sex, input?.required) }));
3741
+ });
3725
3742
 
3726
3743
  const ShareholderFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0430\u043A\u0446\u0438\u043E\u043D\u0435\u0440\u043E\u043C / \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u043C / \u0447\u043B\u0435\u043D\u043E\u043C / \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u043C / \u0432\u043A\u043B\u0430\u0434\u0447\u0438\u043A\u043E\u043C \u0441 \u0434\u043E\u043B\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0431\u043E\u043B\u0435\u0435 20% \u0443\u0441\u0442\u0430\u0432\u043D\u043E\u0433\u043E \u043A\u0430\u043F\u0438\u0442\u0430\u043B\u0430 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...getValidation(field('shareholderFlg'), validatorObj.shareholderFlg, input?.required) })));
3727
3744
 
@@ -3737,10 +3754,7 @@
3737
3754
 
3738
3755
  const InputSnilsControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(SnilsInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "___-___-___ __" }), renderErrorText(error)] })));
3739
3756
 
3740
- const SnilsField = JSX(({ field, input }) => {
3741
- const isPfrFlg = field('consentPfrFlg')?.value;
3742
- return (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", ...getValidation(field('snils'), validatorObj.snils, isPfrFlg ? input?.required : false), ...input }));
3743
- });
3757
+ const SnilsField = JSX(({ field, input }) => (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", ...getValidation(field('snils'), validatorObj.snils, input?.required), ...input })));
3744
3758
 
3745
3759
  const FIELD_NAME = 'surname';
3746
3760
  const SurnameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME), ...getValidation(field('surname'), validatorObj.surname, input?.required), ...input })));
@@ -4073,6 +4087,29 @@
4073
4087
  restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
4074
4088
  });
4075
4089
 
4090
+ const applicationFormData = [
4091
+ {
4092
+ columns: 2,
4093
+ inputs: [
4094
+ { fieldType: 'common', name: 'surname', required: true, dadata: true },
4095
+ { fieldType: 'common', name: 'name', required: true, dadata: true },
4096
+ { fieldType: 'common', name: 'middleName', dadata: true },
4097
+ { fieldType: 'common', name: 'limitedBirthday', required: true },
4098
+ { fieldType: 'common', name: 'phone', required: true },
4099
+ { fieldType: 'common', name: 'email', required: true, dadata: true },
4100
+ ],
4101
+ },
4102
+ {
4103
+ inputs: [
4104
+ { fieldType: 'common', name: 'processPersonalDataFlg', required: true },
4105
+ { fieldType: 'common', name: 'consentProviderFlg', required: true },
4106
+ { fieldType: 'common', name: 'consentOthersFlg', required: true },
4107
+ { fieldType: 'common', name: 'consentInformFlg' },
4108
+ { fieldType: 'common', name: 'consentPfrFlg' },
4109
+ ],
4110
+ },
4111
+ ];
4112
+
4076
4113
  const initialFormState = {
4077
4114
  typeForm: '',
4078
4115
  region: { key: '', text: '' },
@@ -4778,8 +4815,8 @@
4778
4815
  };
4779
4816
  };
4780
4817
 
4781
- const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', sections = [], button, ...rest }) => {
4782
- const inputs = (sections?.flatMap((_) => _?.inputs) || []);
4818
+ const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', button, ...rest }) => {
4819
+ const inputs = (applicationFormData?.flatMap((_) => _?.inputs) || []);
4783
4820
  const [responseType, setResponseType] = useState('');
4784
4821
  const { isLoading } = useInitApplicationLead(nextStepLink);
4785
4822
  const [leadForm, setLeadForm] = useLocalStorage('leadForm');
@@ -4801,7 +4838,7 @@
4801
4838
  reset();
4802
4839
  }
4803
4840
  }, [responseType]);
4804
- return (jsx(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: jsxs("form", { onSubmit: onSubmit, className: "space-y-m relative", children: [isLoading ? jsx(Loader, { blur: false }) : null, sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), renderInputs$2({ field, inputs: _?.inputs })] }, `section-${i}`))), renderSubmitButton(button)] }) }));
4841
+ return (jsx(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: jsxs("form", { onSubmit: onSubmit, className: "space-y-m relative", children: [isLoading ? jsx(Loader, { blur: false }) : null, applicationFormData.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), renderInputs$2({ field, inputs: _?.inputs })] }, `section-${i}`))), renderSubmitButton(button)] }) }));
4805
4842
  });
4806
4843
 
4807
4844
  const NotFound = JSX(({ title, description }) => {
@@ -7337,7 +7374,7 @@
7337
7374
  });
7338
7375
  const checkIsRetiree = (step, getValue) => step === 2 && getValue('employment')?.key === 'RETIREE';
7339
7376
  const checkBusinessOwner = ({ name }, getValue) => name === 'partInBusiness' && getValue('positionOrganization')?.key !== 'BUSINESS_OWNER';
7340
- const checkConsentPfrFlg = ({ name }, getValue) => name === 'snils' && !getValue('consentPfrFlg');
7377
+ const checkConsentPfrFlg = ({ name }, getValue) => name === 'snils' && isSnilsRequired(getValue);
7341
7378
  const checkAddressFillFromESIA = ({ name, filledByEsia }, getValue) => name?.startsWith('address') && getValue('esiaAccountTypeCd')?.key && filledByEsia;
7342
7379
  const checkAddressFact = ({ name }, getValue) => name === 'addressFact' && getValue('addressMatch');
7343
7380
  const checkCondition = ({ condition }, getValue) => condition?.name &&
@@ -7345,6 +7382,7 @@
7345
7382
  const dataValue = getValue(condition?.name);
7346
7383
  return _ !== (dataValue?.key ?? dataValue);
7347
7384
  });
7385
+ const isSnilsRequired = (getValue) => getValue('confirmationIncome')?.key !== 'PFR_CERTIFICATE';
7348
7386
 
7349
7387
  const renderInfo$1 = (inputs = []) => {
7350
7388
  const infoInputs = inputs.filter((_) => _.fieldType === 'info');
@@ -10385,7 +10423,7 @@
10385
10423
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
10386
10424
  });
10387
10425
 
10388
- const packageVersion = "0.14.684";
10426
+ const packageVersion = "0.14.686";
10389
10427
 
10390
10428
  exports.Blocks = Blocks;
10391
10429
  exports.ContentPage = ContentPage;