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

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 (103) hide show
  1. package/bundle/api/RetailAPI/getCardTypes.d.ts +1 -1
  2. package/bundle/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  3. package/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -2
  4. package/bundle/bundle.umd.js +51 -35
  5. package/bundle/bundle.umd.min.js +1 -1
  6. package/dist/api/RetailAPI/getCardTypes.d.ts +1 -1
  7. package/dist/api/RetailAPI/getCardTypes.js +3 -4
  8. package/dist/api/RetailAPI/getCardTypes.js.map +1 -1
  9. package/dist/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  10. package/dist/api/RetailAPI/getPaymentSystems.js +3 -4
  11. package/dist/api/RetailAPI/getPaymentSystems.js.map +1 -1
  12. package/dist/api/RetailAPI/updateUserProfile.d.ts +1 -2
  13. package/dist/api/RetailAPI/updateUserProfile.js +1 -1
  14. package/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
  15. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  16. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  17. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
  18. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  19. package/dist/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  20. package/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  21. package/dist/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  22. package/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  23. package/dist/ui-kit/FormField/getObjectValidator.js +2 -0
  24. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  25. package/lib/api/RetailAPI/getCardTypes.d.ts +1 -1
  26. package/lib/api/RetailAPI/getCardTypes.js +4 -5
  27. package/lib/api/RetailAPI/getCardTypes.js.map +1 -1
  28. package/lib/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  29. package/lib/api/RetailAPI/getPaymentSystems.js +4 -5
  30. package/lib/api/RetailAPI/getPaymentSystems.js.map +1 -1
  31. package/lib/api/RetailAPI/updateUserProfile.d.ts +1 -2
  32. package/lib/api/RetailAPI/updateUserProfile.js +2 -2
  33. package/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
  34. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  35. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  36. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
  37. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  38. package/lib/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  39. package/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  40. package/lib/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  41. package/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  42. package/lib/ui-kit/FormField/getObjectValidator.js +2 -0
  43. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  44. package/mobile/bundle/api/RetailAPI/getCardTypes.d.ts +1 -1
  45. package/mobile/bundle/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  46. package/mobile/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -2
  47. package/mobile/bundle/bundle.umd.js +51 -35
  48. package/mobile/bundle/bundle.umd.min.js +1 -1
  49. package/mobile/dist/api/RetailAPI/getCardTypes.d.ts +1 -1
  50. package/mobile/dist/api/RetailAPI/getCardTypes.js +3 -4
  51. package/mobile/dist/api/RetailAPI/getCardTypes.js.map +1 -1
  52. package/mobile/dist/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  53. package/mobile/dist/api/RetailAPI/getPaymentSystems.js +3 -4
  54. package/mobile/dist/api/RetailAPI/getPaymentSystems.js.map +1 -1
  55. package/mobile/dist/api/RetailAPI/updateUserProfile.d.ts +1 -2
  56. package/mobile/dist/api/RetailAPI/updateUserProfile.js +1 -1
  57. package/mobile/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
  58. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  59. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  60. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
  61. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  62. package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  63. package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  64. package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  65. package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  66. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +2 -0
  67. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  68. package/mobile/lib/api/RetailAPI/getCardTypes.d.ts +1 -1
  69. package/mobile/lib/api/RetailAPI/getCardTypes.js +4 -5
  70. package/mobile/lib/api/RetailAPI/getCardTypes.js.map +1 -1
  71. package/mobile/lib/api/RetailAPI/getPaymentSystems.d.ts +1 -1
  72. package/mobile/lib/api/RetailAPI/getPaymentSystems.js +4 -5
  73. package/mobile/lib/api/RetailAPI/getPaymentSystems.js.map +1 -1
  74. package/mobile/lib/api/RetailAPI/updateUserProfile.d.ts +1 -2
  75. package/mobile/lib/api/RetailAPI/updateUserProfile.js +2 -2
  76. package/mobile/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
  77. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  78. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  79. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
  80. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  81. package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
  82. package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  83. package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
  84. package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  85. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +2 -0
  86. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  87. package/mobile/src/api/RetailAPI/getCardTypes.ts +4 -6
  88. package/mobile/src/api/RetailAPI/getPaymentSystems.ts +9 -7
  89. package/mobile/src/api/RetailAPI/updateUserProfile.ts +2 -3
  90. package/mobile/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  91. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +12 -8
  92. package/mobile/src/ui-kit/FormField/Fields/CardCategoryField.tsx +17 -4
  93. package/mobile/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +8 -4
  94. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +2 -0
  95. package/package.json +1 -1
  96. package/src/api/RetailAPI/getCardTypes.ts +4 -6
  97. package/src/api/RetailAPI/getPaymentSystems.ts +9 -7
  98. package/src/api/RetailAPI/updateUserProfile.ts +2 -3
  99. package/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  100. package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +12 -8
  101. package/src/ui-kit/FormField/Fields/CardCategoryField.tsx +17 -4
  102. package/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +8 -4
  103. package/src/ui-kit/FormField/getObjectValidator.tsx +2 -0
@@ -1683,6 +1683,8 @@
1683
1683
  confirmationIncome: defaultValidator(),
1684
1684
  deliveryDate: defaultValidator('Укажите дату доставки'),
1685
1685
  addressCourier: addressDaDataValidator(),
1686
+ cardCategory: defaultValidator('Укажите категорию карты'),
1687
+ paymentSystem: defaultValidator('Укажите тип платежной системы'),
1686
1688
  };
1687
1689
  const getObjectValidator = (inputs) => {
1688
1690
  const requiredInputs = getNamesFromInput(inputs.filter((_) => Boolean(_?.required)));
@@ -2924,26 +2926,42 @@
2924
2926
  const FIELD_NAME$a = 'birthPlace';
2925
2927
  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) })));
2926
2928
 
2927
- const getCardTypes = async (paymentSystemType) => {
2928
- const response = await doRequest('/dictionaryFiltered', 'POST', {
2929
+ const getCardTypes = async (paymentSystemTypeCd, creditProgramId) => {
2930
+ const data = await fetchRetailJSON('/dictionaryFiltered', 'POST', {
2929
2931
  type: 'CARD_TYPE',
2930
- presets: { paymentSystemType, creditProgramId: 13 },
2932
+ presets: { paymentSystemTypeCd, creditProgramId },
2931
2933
  });
2932
- const data = await response?.json();
2933
2934
  return Array.isArray(data) ? data : [];
2934
2935
  };
2935
2936
 
2937
+ function useLocalStorage(key) {
2938
+ const [storedValue, setStoredValue] = useState(JSON.parse(globalThis.localStorage?.getItem(key) || 'null'));
2939
+ const setValue = useCallback((value) => {
2940
+ globalThis.localStorage?.setItem(key, JSON.stringify(value));
2941
+ setStoredValue(value);
2942
+ }, [key, globalThis.localStorage]);
2943
+ return [storedValue, setValue];
2944
+ }
2945
+
2936
2946
  const CardCategoryField = JSX(({ field, input }) => {
2937
2947
  const [cardTypes, setCardTypes] = useState([]);
2948
+ const [programId] = useLocalStorage('programId');
2949
+ const { value: selectedCardCategory, onChange: cardCategoryChange } = field('cardCategory');
2938
2950
  const selectedPaymentSystem = field('paymentSystem').value;
2939
2951
  useEffect(() => {
2940
- (async () => {
2941
- const fetchedCardTypes = await getCardTypes(selectedPaymentSystem);
2942
- setCardTypes(fetchedCardTypes);
2943
- })();
2952
+ if (selectedPaymentSystem && programId) {
2953
+ (async () => {
2954
+ const fetchedCardTypes = await getCardTypes(selectedPaymentSystem, programId);
2955
+ setCardTypes(fetchedCardTypes);
2956
+ if (!isValidCardCategory(fetchedCardTypes, selectedCardCategory)) {
2957
+ cardCategoryChange && cardCategoryChange(null);
2958
+ }
2959
+ })();
2960
+ }
2944
2961
  }, [selectedPaymentSystem]);
2945
2962
  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 }));
2946
2963
  });
2964
+ const isValidCardCategory = (cardTypes, selectedCardCategory) => cardTypes.some((cardType) => cardType.key === selectedCardCategory?.key);
2947
2965
 
2948
2966
  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 })));
2949
2967
 
@@ -3590,11 +3608,10 @@
3590
3608
  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 }));
3591
3609
  });
3592
3610
 
3593
- const getPaymentSystems = async () => {
3594
- const response = await doRequest('/public-data/creditProgramConditions', 'POST', {
3595
- creditProgramId: 13,
3611
+ const getPaymentSystems = async (creditProgramId) => {
3612
+ const data = await fetchRetailJSON('/public-data/creditProgramConditions', 'POST', {
3613
+ creditProgramId,
3596
3614
  });
3597
- const data = await response?.json();
3598
3615
  return (data?.paymentSystems?.map((paymentSystem) => ({
3599
3616
  id: paymentSystem.type,
3600
3617
  text: paymentSystem.name,
@@ -3603,12 +3620,15 @@
3603
3620
 
3604
3621
  const PaymentSystemField = JSX(({ field, input }) => {
3605
3622
  const { value, onChange } = field('paymentSystem');
3623
+ const [programId] = useLocalStorage('programId');
3606
3624
  const [paymentSystemOptions, setPaymentSystemOptions] = useState([]);
3607
3625
  useEffect(() => {
3608
- (async () => {
3609
- const fetchedPaymentSystems = await getPaymentSystems();
3610
- setPaymentSystemOptions(fetchedPaymentSystems || []);
3611
- })();
3626
+ if (programId) {
3627
+ (async () => {
3628
+ const fetchedPaymentSystems = await getPaymentSystems(programId);
3629
+ setPaymentSystemOptions(fetchedPaymentSystems || []);
3630
+ })();
3631
+ }
3612
3632
  }, []);
3613
3633
  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) }));
3614
3634
  });
@@ -4035,15 +4055,6 @@
4035
4055
  return _ === (dataValue?.key ?? dataValue);
4036
4056
  }));
4037
4057
 
4038
- function useLocalStorage(key) {
4039
- const [storedValue, setStoredValue] = useState(JSON.parse(globalThis.localStorage?.getItem(key) || 'null'));
4040
- const setValue = useCallback((value) => {
4041
- globalThis.localStorage?.setItem(key, JSON.stringify(value));
4042
- setStoredValue(value);
4043
- }, [key, globalThis.localStorage]);
4044
- return [storedValue, setValue];
4045
- }
4046
-
4047
4058
  const CONSENT_ALL_DOCS_TEXT = 'Согласие на все документы';
4048
4059
  const CONSENT_REQUIRED = 'Отметьте все обязательные соглашения';
4049
4060
  const GroupedConsents = JSX(({ inputs = [], typeForm = '', field, key }) => {
@@ -4131,19 +4142,19 @@
4131
4142
 
4132
4143
  const createUserProfile = (body) => fetchRetailJSON('/public-data/createUserProfile', 'POST', body).then((res) => res?.profile?.id || null);
4133
4144
 
4134
- const updateUserProfile = (body) => fetchRetailJSON('/user-data/updateUserProfile', 'PUT', body);
4145
+ const updateUserProfile = (body) => doRequest('/user-data/updateUserProfile', 'PUT', body);
4135
4146
 
4136
4147
  const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
4137
4148
 
4138
4149
  const getUpdateUserProfileData = (profileId, formData) => {
4139
- const { name = '', surname = '', middleName = '', birthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
4150
+ const { name = '', surname = '', middleName = '', limitedBirthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
4140
4151
  return {
4141
4152
  profile: {
4142
4153
  id: profileId,
4143
4154
  name,
4144
4155
  surname,
4145
4156
  midname: middleName,
4146
- birthDate: birthday && formatDate(birthday, true),
4157
+ birthDate: limitedBirthday && formatDate(limitedBirthday, true),
4147
4158
  email,
4148
4159
  phone: formatPhone(phone),
4149
4160
  processPersonalDataFlg: Boolean(processPersonalDataFlg),
@@ -4653,12 +4664,17 @@
4653
4664
  profileId,
4654
4665
  programId,
4655
4666
  });
4656
- await updateUserTask(getLeadFormTaskData({
4657
- participantId,
4658
- taskId,
4659
- profileId,
4660
- formData: transformedForm,
4661
- }));
4667
+ try {
4668
+ await updateUserTask(getLeadFormTaskData({
4669
+ participantId,
4670
+ taskId,
4671
+ profileId,
4672
+ formData: transformedForm,
4673
+ }));
4674
+ }
4675
+ catch (ex) {
4676
+ console.log(ex);
4677
+ }
4662
4678
  saveUserData({ participantId, taskId, profileId, programId });
4663
4679
  saveForm(formData);
4664
4680
  };
@@ -9996,7 +10012,7 @@
9996
10012
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
9997
10013
  });
9998
10014
 
9999
- const packageVersion = "0.14.683";
10015
+ const packageVersion = "0.14.684";
10000
10016
 
10001
10017
  exports.Blocks = Blocks;
10002
10018
  exports.ContentPage = ContentPage;