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

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 (68) hide show
  1. package/bundle/api/RetailAPI/getGenderFromName.d.ts +1 -0
  2. package/bundle/bundle.umd.js +54 -14
  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/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  14. package/dist/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  15. package/dist/ui-kit/FormField/Fields/SexField.js +17 -1
  16. package/dist/ui-kit/FormField/Fields/SexField.js.map +1 -1
  17. package/lib/api/RetailAPI/getGenderFromName.d.ts +1 -0
  18. package/lib/api/RetailAPI/getGenderFromName.js +12 -0
  19. package/lib/api/RetailAPI/getGenderFromName.js.map +1 -0
  20. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  21. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  22. package/lib/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  23. package/lib/components/ApplicationLeadForm/applicationFormData.js +23 -0
  24. package/lib/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  25. package/lib/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  26. package/lib/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  27. package/lib/ui-kit/FormField/Fields/SexField.js +17 -1
  28. package/lib/ui-kit/FormField/Fields/SexField.js.map +1 -1
  29. package/mobile/bundle/api/RetailAPI/getGenderFromName.d.ts +1 -0
  30. package/mobile/bundle/bundle.umd.js +54 -14
  31. package/mobile/bundle/bundle.umd.min.js +1 -1
  32. package/mobile/bundle/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  33. package/mobile/dist/api/RetailAPI/getGenderFromName.d.ts +1 -0
  34. package/mobile/dist/api/RetailAPI/getGenderFromName.js +15 -0
  35. package/mobile/dist/api/RetailAPI/getGenderFromName.js.map +1 -0
  36. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  37. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  38. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  39. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.js +25 -0
  40. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  41. package/mobile/dist/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  42. package/mobile/dist/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  43. package/mobile/dist/ui-kit/FormField/Fields/SexField.js +17 -1
  44. package/mobile/dist/ui-kit/FormField/Fields/SexField.js.map +1 -1
  45. package/mobile/lib/api/RetailAPI/getGenderFromName.d.ts +1 -0
  46. package/mobile/lib/api/RetailAPI/getGenderFromName.js +12 -0
  47. package/mobile/lib/api/RetailAPI/getGenderFromName.js.map +1 -0
  48. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  49. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  50. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  51. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.js +23 -0
  52. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  53. package/mobile/lib/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  54. package/mobile/lib/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  55. package/mobile/lib/ui-kit/FormField/Fields/SexField.js +17 -1
  56. package/mobile/lib/ui-kit/FormField/Fields/SexField.js.map +1 -1
  57. package/mobile/src/api/RetailAPI/getGenderFromName.ts +20 -0
  58. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +4 -11
  59. package/mobile/src/components/ApplicationLeadForm/applicationFormData.tsx +24 -0
  60. package/mobile/src/ui-kit/FormField/Fields/MiddleNameField.tsx +9 -22
  61. package/mobile/src/ui-kit/FormField/Fields/SexField.tsx +26 -8
  62. package/package.json +1 -1
  63. package/src/api/RetailAPI/getGenderFromName.ts +20 -0
  64. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +1 -23
  65. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +4 -11
  66. package/src/components/ApplicationLeadForm/applicationFormData.tsx +24 -0
  67. package/src/ui-kit/FormField/Fields/MiddleNameField.tsx +9 -22
  68. package/src/ui-kit/FormField/Fields/SexField.tsx +26 -8
@@ -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
 
@@ -4073,6 +4090,29 @@
4073
4090
  restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
4074
4091
  });
4075
4092
 
4093
+ const applicationFormData = [
4094
+ {
4095
+ columns: 2,
4096
+ inputs: [
4097
+ { fieldType: 'common', name: 'surname', required: true, dadata: true },
4098
+ { fieldType: 'common', name: 'name', required: true, dadata: true },
4099
+ { fieldType: 'common', name: 'middleName', dadata: true },
4100
+ { fieldType: 'common', name: 'limitedBirthday', required: true },
4101
+ { fieldType: 'common', name: 'phone', required: true },
4102
+ { fieldType: 'common', name: 'email', required: true, dadata: true },
4103
+ ],
4104
+ },
4105
+ {
4106
+ inputs: [
4107
+ { fieldType: 'common', name: 'processPersonalDataFlg', required: true },
4108
+ { fieldType: 'common', name: 'consentProviderFlg', required: true },
4109
+ { fieldType: 'common', name: 'consentOthersFlg', required: true },
4110
+ { fieldType: 'common', name: 'consentInformFlg' },
4111
+ { fieldType: 'common', name: 'consentPfrFlg' },
4112
+ ],
4113
+ },
4114
+ ];
4115
+
4076
4116
  const initialFormState = {
4077
4117
  typeForm: '',
4078
4118
  region: { key: '', text: '' },
@@ -4778,8 +4818,8 @@
4778
4818
  };
4779
4819
  };
4780
4820
 
4781
- const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', sections = [], button, ...rest }) => {
4782
- const inputs = (sections?.flatMap((_) => _?.inputs) || []);
4821
+ const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', button, ...rest }) => {
4822
+ const inputs = (applicationFormData?.flatMap((_) => _?.inputs) || []);
4783
4823
  const [responseType, setResponseType] = useState('');
4784
4824
  const { isLoading } = useInitApplicationLead(nextStepLink);
4785
4825
  const [leadForm, setLeadForm] = useLocalStorage('leadForm');
@@ -4801,7 +4841,7 @@
4801
4841
  reset();
4802
4842
  }
4803
4843
  }, [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)] }) }));
4844
+ 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
4845
  });
4806
4846
 
4807
4847
  const NotFound = JSX(({ title, description }) => {
@@ -10385,7 +10425,7 @@
10385
10425
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
10386
10426
  });
10387
10427
 
10388
- const packageVersion = "0.14.684";
10428
+ const packageVersion = "0.14.685";
10389
10429
 
10390
10430
  exports.Blocks = Blocks;
10391
10431
  exports.ContentPage = ContentPage;