@redneckz/wildless-cms-uni-blocks 0.14.684 → 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 (166) hide show
  1. package/bundle/api/RetailAPI/getCardTypes.d.ts +1 -1
  2. package/bundle/api/RetailAPI/getGenderFromName.d.ts +1 -0
  3. package/bundle/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  4. package/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -2
  5. package/bundle/bundle.umd.js +104 -48
  6. package/bundle/bundle.umd.min.js +1 -1
  7. package/bundle/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  8. package/dist/api/RetailAPI/getCardTypes.d.ts +1 -1
  9. package/dist/api/RetailAPI/getCardTypes.js +3 -4
  10. package/dist/api/RetailAPI/getCardTypes.js.map +1 -1
  11. package/dist/api/RetailAPI/getGenderFromName.d.ts +1 -0
  12. package/dist/api/RetailAPI/getGenderFromName.js +15 -0
  13. package/dist/api/RetailAPI/getGenderFromName.js.map +1 -0
  14. package/dist/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  15. package/dist/api/RetailAPI/getPaymentSystems.js +3 -4
  16. package/dist/api/RetailAPI/getPaymentSystems.js.map +1 -1
  17. package/dist/api/RetailAPI/updateUserProfile.d.ts +1 -2
  18. package/dist/api/RetailAPI/updateUserProfile.js +1 -1
  19. package/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
  20. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  21. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  22. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  23. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  24. package/dist/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  25. package/dist/components/ApplicationLeadForm/applicationFormData.js +25 -0
  26. package/dist/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  27. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
  28. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  29. package/dist/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  30. package/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  31. package/dist/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  32. package/dist/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  33. package/dist/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  34. package/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  35. package/dist/ui-kit/FormField/Fields/SexField.js +17 -1
  36. package/dist/ui-kit/FormField/Fields/SexField.js.map +1 -1
  37. package/dist/ui-kit/FormField/getObjectValidator.js +2 -0
  38. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  39. package/lib/api/RetailAPI/getCardTypes.d.ts +1 -1
  40. package/lib/api/RetailAPI/getCardTypes.js +4 -5
  41. package/lib/api/RetailAPI/getCardTypes.js.map +1 -1
  42. package/lib/api/RetailAPI/getGenderFromName.d.ts +1 -0
  43. package/lib/api/RetailAPI/getGenderFromName.js +12 -0
  44. package/lib/api/RetailAPI/getGenderFromName.js.map +1 -0
  45. package/lib/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  46. package/lib/api/RetailAPI/getPaymentSystems.js +4 -5
  47. package/lib/api/RetailAPI/getPaymentSystems.js.map +1 -1
  48. package/lib/api/RetailAPI/updateUserProfile.d.ts +1 -2
  49. package/lib/api/RetailAPI/updateUserProfile.js +2 -2
  50. package/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
  51. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  52. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  53. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  54. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  55. package/lib/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  56. package/lib/components/ApplicationLeadForm/applicationFormData.js +23 -0
  57. package/lib/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  58. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
  59. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  60. package/lib/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  61. package/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  62. package/lib/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  63. package/lib/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  64. package/lib/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  65. package/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  66. package/lib/ui-kit/FormField/Fields/SexField.js +17 -1
  67. package/lib/ui-kit/FormField/Fields/SexField.js.map +1 -1
  68. package/lib/ui-kit/FormField/getObjectValidator.js +2 -0
  69. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  70. package/mobile/bundle/api/RetailAPI/getCardTypes.d.ts +1 -1
  71. package/mobile/bundle/api/RetailAPI/getGenderFromName.d.ts +1 -0
  72. package/mobile/bundle/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  73. package/mobile/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -2
  74. package/mobile/bundle/bundle.umd.js +104 -48
  75. package/mobile/bundle/bundle.umd.min.js +1 -1
  76. package/mobile/bundle/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  77. package/mobile/dist/api/RetailAPI/getCardTypes.d.ts +1 -1
  78. package/mobile/dist/api/RetailAPI/getCardTypes.js +3 -4
  79. package/mobile/dist/api/RetailAPI/getCardTypes.js.map +1 -1
  80. package/mobile/dist/api/RetailAPI/getGenderFromName.d.ts +1 -0
  81. package/mobile/dist/api/RetailAPI/getGenderFromName.js +15 -0
  82. package/mobile/dist/api/RetailAPI/getGenderFromName.js.map +1 -0
  83. package/mobile/dist/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  84. package/mobile/dist/api/RetailAPI/getPaymentSystems.js +3 -4
  85. package/mobile/dist/api/RetailAPI/getPaymentSystems.js.map +1 -1
  86. package/mobile/dist/api/RetailAPI/updateUserProfile.d.ts +1 -2
  87. package/mobile/dist/api/RetailAPI/updateUserProfile.js +1 -1
  88. package/mobile/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
  89. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  90. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  91. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  92. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  93. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  94. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.js +25 -0
  95. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  96. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
  97. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  98. package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  99. package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  100. package/mobile/dist/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  101. package/mobile/dist/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  102. package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  103. package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  104. package/mobile/dist/ui-kit/FormField/Fields/SexField.js +17 -1
  105. package/mobile/dist/ui-kit/FormField/Fields/SexField.js.map +1 -1
  106. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +2 -0
  107. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  108. package/mobile/lib/api/RetailAPI/getCardTypes.d.ts +1 -1
  109. package/mobile/lib/api/RetailAPI/getCardTypes.js +4 -5
  110. package/mobile/lib/api/RetailAPI/getCardTypes.js.map +1 -1
  111. package/mobile/lib/api/RetailAPI/getGenderFromName.d.ts +1 -0
  112. package/mobile/lib/api/RetailAPI/getGenderFromName.js +12 -0
  113. package/mobile/lib/api/RetailAPI/getGenderFromName.js.map +1 -0
  114. package/mobile/lib/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  115. package/mobile/lib/api/RetailAPI/getPaymentSystems.js +4 -5
  116. package/mobile/lib/api/RetailAPI/getPaymentSystems.js.map +1 -1
  117. package/mobile/lib/api/RetailAPI/updateUserProfile.d.ts +1 -2
  118. package/mobile/lib/api/RetailAPI/updateUserProfile.js +2 -2
  119. package/mobile/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
  120. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  121. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  122. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +4 -3
  123. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  124. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.d.ts +2 -0
  125. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.js +23 -0
  126. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.js.map +1 -0
  127. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
  128. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  129. package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  130. package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  131. package/mobile/lib/ui-kit/FormField/Fields/MiddleNameField.js +1 -10
  132. package/mobile/lib/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  133. package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  134. package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  135. package/mobile/lib/ui-kit/FormField/Fields/SexField.js +17 -1
  136. package/mobile/lib/ui-kit/FormField/Fields/SexField.js.map +1 -1
  137. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +2 -0
  138. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  139. package/mobile/src/api/RetailAPI/getCardTypes.ts +4 -6
  140. package/mobile/src/api/RetailAPI/getGenderFromName.ts +20 -0
  141. package/mobile/src/api/RetailAPI/getPaymentSystems.ts +9 -7
  142. package/mobile/src/api/RetailAPI/updateUserProfile.ts +2 -3
  143. package/mobile/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  144. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +4 -11
  145. package/mobile/src/components/ApplicationLeadForm/applicationFormData.tsx +24 -0
  146. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +12 -8
  147. package/mobile/src/ui-kit/FormField/Fields/CardCategoryField.tsx +17 -4
  148. package/mobile/src/ui-kit/FormField/Fields/MiddleNameField.tsx +9 -22
  149. package/mobile/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +8 -4
  150. package/mobile/src/ui-kit/FormField/Fields/SexField.tsx +26 -8
  151. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +2 -0
  152. package/package.json +1 -1
  153. package/src/api/RetailAPI/getCardTypes.ts +4 -6
  154. package/src/api/RetailAPI/getGenderFromName.ts +20 -0
  155. package/src/api/RetailAPI/getPaymentSystems.ts +9 -7
  156. package/src/api/RetailAPI/updateUserProfile.ts +2 -3
  157. package/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  158. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +1 -23
  159. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +4 -11
  160. package/src/components/ApplicationLeadForm/applicationFormData.tsx +24 -0
  161. package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +12 -8
  162. package/src/ui-kit/FormField/Fields/CardCategoryField.tsx +17 -4
  163. package/src/ui-kit/FormField/Fields/MiddleNameField.tsx +9 -22
  164. package/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +8 -4
  165. package/src/ui-kit/FormField/Fields/SexField.tsx +26 -8
  166. package/src/ui-kit/FormField/getObjectValidator.tsx +2 -0
@@ -5,4 +5,4 @@ export declare type CardTypeData = {
5
5
  displayOrder: number;
6
6
  description: string;
7
7
  };
8
- export declare const getCardTypes: (paymentSystemType: string) => Promise<CardTypeData[]>;
8
+ export declare const getCardTypes: (paymentSystemTypeCd: string, creditProgramId: string) => Promise<CardTypeData[]>;
@@ -0,0 +1 @@
1
+ export declare const getGenderFromName: (name: string) => Promise<string>;
@@ -1,4 +1,4 @@
1
- export declare const getPaymentSystems: () => Promise<{
1
+ export declare const getPaymentSystems: (creditProgramId: string) => Promise<{
2
2
  id: string;
3
3
  text: string;
4
4
  }[]>;
@@ -1,4 +1,3 @@
1
- import { type CreateUserProfileResponse } from './updateUserTask';
2
1
  export declare type UpdateUserProfileBody = {
3
2
  profile: {
4
3
  id: number;
@@ -19,4 +18,4 @@ export declare type UpdateUserProfileBody = {
19
18
  smsConsentBki?: string;
20
19
  };
21
20
  };
22
- export declare const updateUserProfile: (body: UpdateUserProfileBody) => Promise<CreateUserProfileResponse | null>;
21
+ export declare const updateUserProfile: (body: UpdateUserProfileBody) => Promise<Response>;
@@ -1675,6 +1675,8 @@
1675
1675
  confirmationIncome: defaultValidator(),
1676
1676
  deliveryDate: defaultValidator('Укажите дату доставки'),
1677
1677
  addressCourier: addressDaDataValidator(),
1678
+ cardCategory: defaultValidator('Укажите категорию карты'),
1679
+ paymentSystem: defaultValidator('Укажите тип платежной системы'),
1678
1680
  };
1679
1681
  const getObjectValidator = (inputs) => {
1680
1682
  const requiredInputs = getNamesFromInput(inputs.filter((_) => Boolean(_?.required)));
@@ -2916,26 +2918,42 @@
2916
2918
  const FIELD_NAME$a = 'birthPlace';
2917
2919
  const BirthPlaceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthPlace'), validatorObj.birthPlace, input?.required), ...input, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$a) })));
2918
2920
 
2919
- const getCardTypes = async (paymentSystemType) => {
2920
- const response = await doRequest('/dictionaryFiltered', 'POST', {
2921
+ const getCardTypes = async (paymentSystemTypeCd, creditProgramId) => {
2922
+ const data = await fetchRetailJSON('/dictionaryFiltered', 'POST', {
2921
2923
  type: 'CARD_TYPE',
2922
- presets: { paymentSystemType, creditProgramId: 13 },
2924
+ presets: { paymentSystemTypeCd, creditProgramId },
2923
2925
  });
2924
- const data = await response?.json();
2925
2926
  return Array.isArray(data) ? data : [];
2926
2927
  };
2927
2928
 
2929
+ function useLocalStorage(key) {
2930
+ const [storedValue, setStoredValue] = useState(JSON.parse(globalThis.localStorage?.getItem(key) || 'null'));
2931
+ const setValue = useCallback((value) => {
2932
+ globalThis.localStorage?.setItem(key, JSON.stringify(value));
2933
+ setStoredValue(value);
2934
+ }, [key, globalThis.localStorage]);
2935
+ return [storedValue, setValue];
2936
+ }
2937
+
2928
2938
  const CardCategoryField = JSX(({ field, input }) => {
2929
2939
  const [cardTypes, setCardTypes] = useState([]);
2940
+ const [programId] = useLocalStorage('programId');
2941
+ const { value: selectedCardCategory, onChange: cardCategoryChange } = field('cardCategory');
2930
2942
  const selectedPaymentSystem = field('paymentSystem').value;
2931
2943
  useEffect(() => {
2932
- (async () => {
2933
- const fetchedCardTypes = await getCardTypes(selectedPaymentSystem);
2934
- setCardTypes(fetchedCardTypes);
2935
- })();
2944
+ if (selectedPaymentSystem && programId) {
2945
+ (async () => {
2946
+ const fetchedCardTypes = await getCardTypes(selectedPaymentSystem, programId);
2947
+ setCardTypes(fetchedCardTypes);
2948
+ if (!isValidCardCategory(fetchedCardTypes, selectedCardCategory)) {
2949
+ cardCategoryChange && cardCategoryChange(null);
2950
+ }
2951
+ })();
2952
+ }
2936
2953
  }, [selectedPaymentSystem]);
2937
2954
  return (jsx(SelectField, { field: field, source: cardTypes, label: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043A\u0430\u0440\u0442\u044B", fieldName: "cardCategory", input: input }));
2938
2955
  });
2956
+ const isValidCardCategory = (cardTypes, selectedCardCategory) => cardTypes.some((cardType) => cardType.key === selectedCardCategory?.key);
2939
2957
 
2940
2958
  const ChildrenField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('children'), validatorObj.children, input?.required), ...input })));
2941
2959
 
@@ -3535,15 +3553,7 @@
3535
3553
  const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
3536
3554
 
3537
3555
  const FIELD_NAME$2 = 'middleName';
3538
- const MiddleNameField = JSX(({ field, input }) => {
3539
- const onDaDataChange = useCallback((item) => {
3540
- const dadataGender = item?.data?.gender;
3541
- if (dadataGender && dadataGender !== 'UNKNOWN') {
3542
- field('sex')?.onChange?.(dadataGender.toLowerCase());
3543
- }
3544
- }, []);
3545
- 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 }));
3546
- });
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 })));
3547
3557
 
3548
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 })));
3549
3559
 
@@ -3582,11 +3592,10 @@
3582
3592
  return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
3583
3593
  });
3584
3594
 
3585
- const getPaymentSystems = async () => {
3586
- const response = await doRequest('/public-data/creditProgramConditions', 'POST', {
3587
- creditProgramId: 13,
3595
+ const getPaymentSystems = async (creditProgramId) => {
3596
+ const data = await fetchRetailJSON('/public-data/creditProgramConditions', 'POST', {
3597
+ creditProgramId,
3588
3598
  });
3589
- const data = await response?.json();
3590
3599
  return (data?.paymentSystems?.map((paymentSystem) => ({
3591
3600
  id: paymentSystem.type,
3592
3601
  text: paymentSystem.name,
@@ -3595,12 +3604,15 @@
3595
3604
 
3596
3605
  const PaymentSystemField = JSX(({ field, input }) => {
3597
3606
  const { value, onChange } = field('paymentSystem');
3607
+ const [programId] = useLocalStorage('programId');
3598
3608
  const [paymentSystemOptions, setPaymentSystemOptions] = useState([]);
3599
3609
  useEffect(() => {
3600
- (async () => {
3601
- const fetchedPaymentSystems = await getPaymentSystems();
3602
- setPaymentSystemOptions(fetchedPaymentSystems || []);
3603
- })();
3610
+ if (programId) {
3611
+ (async () => {
3612
+ const fetchedPaymentSystems = await getPaymentSystems(programId);
3613
+ setPaymentSystemOptions(fetchedPaymentSystems || []);
3614
+ })();
3615
+ }
3604
3616
  }, []);
3605
3617
  return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: paymentSystemOptions, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('paymentSystem'), validatorObj.paymentSystem, input?.required) }));
3606
3618
  });
@@ -3697,11 +3709,36 @@
3697
3709
 
3698
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) })));
3699
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
+
3700
3723
  const SEX_TYPES = [
3701
3724
  { id: 'male', text: 'Мужской' },
3702
3725
  { id: 'female', text: 'Женский' },
3703
3726
  ];
3704
- 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
+ });
3705
3742
 
3706
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) })));
3707
3744
 
@@ -4027,15 +4064,6 @@
4027
4064
  return _ === (dataValue?.key ?? dataValue);
4028
4065
  }));
4029
4066
 
4030
- function useLocalStorage(key) {
4031
- const [storedValue, setStoredValue] = useState(JSON.parse(globalThis.localStorage?.getItem(key) || 'null'));
4032
- const setValue = useCallback((value) => {
4033
- globalThis.localStorage?.setItem(key, JSON.stringify(value));
4034
- setStoredValue(value);
4035
- }, [key, globalThis.localStorage]);
4036
- return [storedValue, setValue];
4037
- }
4038
-
4039
4067
  const CONSENT_ALL_DOCS_TEXT = 'Согласие на все документы';
4040
4068
  const CONSENT_REQUIRED = 'Отметьте все обязательные соглашения';
4041
4069
  const GroupedConsents = JSX(({ inputs = [], typeForm = '', field, key }) => {
@@ -4062,6 +4090,29 @@
4062
4090
  restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
4063
4091
  });
4064
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
+
4065
4116
  const initialFormState = {
4066
4117
  typeForm: '',
4067
4118
  region: { key: '', text: '' },
@@ -4123,19 +4174,19 @@
4123
4174
 
4124
4175
  const createUserProfile = (body) => fetchRetailJSON('/public-data/createUserProfile', 'POST', body).then((res) => res?.profile?.id || null);
4125
4176
 
4126
- const updateUserProfile = (body) => fetchRetailJSON('/user-data/updateUserProfile', 'PUT', body);
4177
+ const updateUserProfile = (body) => doRequest('/user-data/updateUserProfile', 'PUT', body);
4127
4178
 
4128
4179
  const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
4129
4180
 
4130
4181
  const getUpdateUserProfileData = (profileId, formData) => {
4131
- const { name = '', surname = '', middleName = '', birthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
4182
+ const { name = '', surname = '', middleName = '', limitedBirthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
4132
4183
  return {
4133
4184
  profile: {
4134
4185
  id: profileId,
4135
4186
  name,
4136
4187
  surname,
4137
4188
  midname: middleName,
4138
- birthDate: birthday && formatDate(birthday, true),
4189
+ birthDate: limitedBirthday && formatDate(limitedBirthday, true),
4139
4190
  email,
4140
4191
  phone: formatPhone(phone),
4141
4192
  processPersonalDataFlg: Boolean(processPersonalDataFlg),
@@ -4645,12 +4696,17 @@
4645
4696
  profileId,
4646
4697
  programId,
4647
4698
  });
4648
- await updateUserTask(getLeadFormTaskData({
4649
- participantId,
4650
- taskId,
4651
- profileId,
4652
- formData: transformedForm,
4653
- }));
4699
+ try {
4700
+ await updateUserTask(getLeadFormTaskData({
4701
+ participantId,
4702
+ taskId,
4703
+ profileId,
4704
+ formData: transformedForm,
4705
+ }));
4706
+ }
4707
+ catch (ex) {
4708
+ console.log(ex);
4709
+ }
4654
4710
  saveUserData({ participantId, taskId, profileId, programId });
4655
4711
  saveForm(formData);
4656
4712
  };
@@ -4762,8 +4818,8 @@
4762
4818
  };
4763
4819
  };
4764
4820
 
4765
- const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', sections = [], button, ...rest }) => {
4766
- const inputs = (sections?.flatMap((_) => _?.inputs) || []);
4821
+ const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', button, ...rest }) => {
4822
+ const inputs = (applicationFormData?.flatMap((_) => _?.inputs) || []);
4767
4823
  const [responseType, setResponseType] = useState('');
4768
4824
  const { isLoading } = useInitApplicationLead(nextStepLink);
4769
4825
  const [leadForm, setLeadForm] = useLocalStorage('leadForm');
@@ -4785,7 +4841,7 @@
4785
4841
  reset();
4786
4842
  }
4787
4843
  }, [responseType]);
4788
- 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)] }) }));
4789
4845
  });
4790
4846
 
4791
4847
  const NotFound = JSX(({ title, description }) => {
@@ -10369,7 +10425,7 @@
10369
10425
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
10370
10426
  });
10371
10427
 
10372
- const packageVersion = "0.14.683";
10428
+ const packageVersion = "0.14.685";
10373
10429
 
10374
10430
  exports.Blocks = Blocks;
10375
10431
  exports.ContentPage = ContentPage;