@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
@@ -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[]>;
@@ -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
 
@@ -3582,11 +3600,10 @@
3582
3600
  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
3601
  });
3584
3602
 
3585
- const getPaymentSystems = async () => {
3586
- const response = await doRequest('/public-data/creditProgramConditions', 'POST', {
3587
- creditProgramId: 13,
3603
+ const getPaymentSystems = async (creditProgramId) => {
3604
+ const data = await fetchRetailJSON('/public-data/creditProgramConditions', 'POST', {
3605
+ creditProgramId,
3588
3606
  });
3589
- const data = await response?.json();
3590
3607
  return (data?.paymentSystems?.map((paymentSystem) => ({
3591
3608
  id: paymentSystem.type,
3592
3609
  text: paymentSystem.name,
@@ -3595,12 +3612,15 @@
3595
3612
 
3596
3613
  const PaymentSystemField = JSX(({ field, input }) => {
3597
3614
  const { value, onChange } = field('paymentSystem');
3615
+ const [programId] = useLocalStorage('programId');
3598
3616
  const [paymentSystemOptions, setPaymentSystemOptions] = useState([]);
3599
3617
  useEffect(() => {
3600
- (async () => {
3601
- const fetchedPaymentSystems = await getPaymentSystems();
3602
- setPaymentSystemOptions(fetchedPaymentSystems || []);
3603
- })();
3618
+ if (programId) {
3619
+ (async () => {
3620
+ const fetchedPaymentSystems = await getPaymentSystems(programId);
3621
+ setPaymentSystemOptions(fetchedPaymentSystems || []);
3622
+ })();
3623
+ }
3604
3624
  }, []);
3605
3625
  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
3626
  });
@@ -4027,15 +4047,6 @@
4027
4047
  return _ === (dataValue?.key ?? dataValue);
4028
4048
  }));
4029
4049
 
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
4050
  const CONSENT_ALL_DOCS_TEXT = 'Согласие на все документы';
4040
4051
  const CONSENT_REQUIRED = 'Отметьте все обязательные соглашения';
4041
4052
  const GroupedConsents = JSX(({ inputs = [], typeForm = '', field, key }) => {
@@ -4123,19 +4134,19 @@
4123
4134
 
4124
4135
  const createUserProfile = (body) => fetchRetailJSON('/public-data/createUserProfile', 'POST', body).then((res) => res?.profile?.id || null);
4125
4136
 
4126
- const updateUserProfile = (body) => fetchRetailJSON('/user-data/updateUserProfile', 'PUT', body);
4137
+ const updateUserProfile = (body) => doRequest('/user-data/updateUserProfile', 'PUT', body);
4127
4138
 
4128
4139
  const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
4129
4140
 
4130
4141
  const getUpdateUserProfileData = (profileId, formData) => {
4131
- const { name = '', surname = '', middleName = '', birthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
4142
+ const { name = '', surname = '', middleName = '', limitedBirthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
4132
4143
  return {
4133
4144
  profile: {
4134
4145
  id: profileId,
4135
4146
  name,
4136
4147
  surname,
4137
4148
  midname: middleName,
4138
- birthDate: birthday && formatDate(birthday, true),
4149
+ birthDate: limitedBirthday && formatDate(limitedBirthday, true),
4139
4150
  email,
4140
4151
  phone: formatPhone(phone),
4141
4152
  processPersonalDataFlg: Boolean(processPersonalDataFlg),
@@ -4645,12 +4656,17 @@
4645
4656
  profileId,
4646
4657
  programId,
4647
4658
  });
4648
- await updateUserTask(getLeadFormTaskData({
4649
- participantId,
4650
- taskId,
4651
- profileId,
4652
- formData: transformedForm,
4653
- }));
4659
+ try {
4660
+ await updateUserTask(getLeadFormTaskData({
4661
+ participantId,
4662
+ taskId,
4663
+ profileId,
4664
+ formData: transformedForm,
4665
+ }));
4666
+ }
4667
+ catch (ex) {
4668
+ console.log(ex);
4669
+ }
4654
4670
  saveUserData({ participantId, taskId, profileId, programId });
4655
4671
  saveForm(formData);
4656
4672
  };
@@ -10369,7 +10385,7 @@
10369
10385
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
10370
10386
  });
10371
10387
 
10372
- const packageVersion = "0.14.683";
10388
+ const packageVersion = "0.14.684";
10373
10389
 
10374
10390
  exports.Blocks = Blocks;
10375
10391
  exports.ContentPage = ContentPage;