@redneckz/wildless-cms-uni-blocks 0.14.671 → 0.14.672

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 (83) hide show
  1. package/bundle/api/RetailAPI/getCardTypes.d.ts +8 -0
  2. package/bundle/api/RetailAPI/getPaymentSystems.d.ts +4 -0
  3. package/bundle/bundle.umd.js +40 -10
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/ui-kit/FormField/Fields/PaymentSystemField.d.ts +0 -2
  6. package/dist/api/RetailAPI/doRequest.js +1 -1
  7. package/dist/api/RetailAPI/doRequest.js.map +1 -1
  8. package/dist/api/RetailAPI/getCardTypes.d.ts +8 -0
  9. package/dist/api/RetailAPI/getCardTypes.js +13 -0
  10. package/dist/api/RetailAPI/getCardTypes.js.map +1 -0
  11. package/dist/api/RetailAPI/getPaymentSystems.d.ts +4 -0
  12. package/dist/api/RetailAPI/getPaymentSystems.js +15 -0
  13. package/dist/api/RetailAPI/getPaymentSystems.js.map +1 -0
  14. package/dist/components/CreditCardForm/formStateMap.js +1 -2
  15. package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  16. package/dist/ui-kit/FormField/Fields/CardCategoryField.js +11 -3
  17. package/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  18. package/dist/ui-kit/FormField/Fields/PaymentSystemField.d.ts +0 -2
  19. package/dist/ui-kit/FormField/Fields/PaymentSystemField.js +11 -6
  20. package/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  21. package/lib/api/RetailAPI/doRequest.js +1 -1
  22. package/lib/api/RetailAPI/doRequest.js.map +1 -1
  23. package/lib/api/RetailAPI/getCardTypes.d.ts +8 -0
  24. package/lib/api/RetailAPI/getCardTypes.js +10 -0
  25. package/lib/api/RetailAPI/getCardTypes.js.map +1 -0
  26. package/lib/api/RetailAPI/getPaymentSystems.d.ts +4 -0
  27. package/lib/api/RetailAPI/getPaymentSystems.js +12 -0
  28. package/lib/api/RetailAPI/getPaymentSystems.js.map +1 -0
  29. package/lib/components/CreditCardForm/formStateMap.js +1 -2
  30. package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  31. package/lib/ui-kit/FormField/Fields/CardCategoryField.js +11 -3
  32. package/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  33. package/lib/ui-kit/FormField/Fields/PaymentSystemField.d.ts +0 -2
  34. package/lib/ui-kit/FormField/Fields/PaymentSystemField.js +10 -5
  35. package/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  36. package/mobile/bundle/api/RetailAPI/getCardTypes.d.ts +8 -0
  37. package/mobile/bundle/api/RetailAPI/getPaymentSystems.d.ts +4 -0
  38. package/mobile/bundle/bundle.umd.js +40 -10
  39. package/mobile/bundle/bundle.umd.min.js +1 -1
  40. package/mobile/bundle/ui-kit/FormField/Fields/PaymentSystemField.d.ts +0 -2
  41. package/mobile/dist/api/RetailAPI/doRequest.js +1 -1
  42. package/mobile/dist/api/RetailAPI/doRequest.js.map +1 -1
  43. package/mobile/dist/api/RetailAPI/getCardTypes.d.ts +8 -0
  44. package/mobile/dist/api/RetailAPI/getCardTypes.js +13 -0
  45. package/mobile/dist/api/RetailAPI/getCardTypes.js.map +1 -0
  46. package/mobile/dist/api/RetailAPI/getPaymentSystems.d.ts +4 -0
  47. package/mobile/dist/api/RetailAPI/getPaymentSystems.js +15 -0
  48. package/mobile/dist/api/RetailAPI/getPaymentSystems.js.map +1 -0
  49. package/mobile/dist/components/CreditCardForm/formStateMap.js +1 -2
  50. package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  51. package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js +11 -3
  52. package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  53. package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.d.ts +0 -2
  54. package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js +11 -6
  55. package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  56. package/mobile/lib/api/RetailAPI/doRequest.js +1 -1
  57. package/mobile/lib/api/RetailAPI/doRequest.js.map +1 -1
  58. package/mobile/lib/api/RetailAPI/getCardTypes.d.ts +8 -0
  59. package/mobile/lib/api/RetailAPI/getCardTypes.js +10 -0
  60. package/mobile/lib/api/RetailAPI/getCardTypes.js.map +1 -0
  61. package/mobile/lib/api/RetailAPI/getPaymentSystems.d.ts +4 -0
  62. package/mobile/lib/api/RetailAPI/getPaymentSystems.js +12 -0
  63. package/mobile/lib/api/RetailAPI/getPaymentSystems.js.map +1 -0
  64. package/mobile/lib/components/CreditCardForm/formStateMap.js +1 -2
  65. package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  66. package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js +11 -3
  67. package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
  68. package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.d.ts +0 -2
  69. package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js +10 -5
  70. package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
  71. package/mobile/src/api/RetailAPI/doRequest.ts +1 -1
  72. package/mobile/src/api/RetailAPI/getCardTypes.ts +20 -0
  73. package/mobile/src/api/RetailAPI/getPaymentSystems.ts +21 -0
  74. package/mobile/src/components/CreditCardForm/formStateMap.tsx +1 -2
  75. package/mobile/src/ui-kit/FormField/Fields/CardCategoryField.tsx +12 -3
  76. package/mobile/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +12 -6
  77. package/package.json +1 -1
  78. package/src/api/RetailAPI/doRequest.ts +1 -1
  79. package/src/api/RetailAPI/getCardTypes.ts +20 -0
  80. package/src/api/RetailAPI/getPaymentSystems.ts +21 -0
  81. package/src/components/CreditCardForm/formStateMap.tsx +1 -2
  82. package/src/ui-kit/FormField/Fields/CardCategoryField.tsx +12 -3
  83. package/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +12 -6
@@ -0,0 +1,8 @@
1
+ export declare type CardTypeData = {
2
+ type: string;
3
+ key: string;
4
+ value: string;
5
+ displayOrder: number;
6
+ description: string;
7
+ };
8
+ export declare const getCardTypes: (paymentSystemType: string) => Promise<CardTypeData[]>;
@@ -0,0 +1,4 @@
1
+ export declare const getPaymentSystems: () => Promise<{
2
+ id: string;
3
+ text: string;
4
+ }[] | undefined>;
@@ -2027,7 +2027,7 @@
2027
2027
  }
2028
2028
  };
2029
2029
  async function doRequest(url, method, body) {
2030
- return await fetch(`${API_BASE_URI}${url}`, {
2030
+ return globalThis?.fetch?.(`${API_BASE_URI}${url}`, {
2031
2031
  method,
2032
2032
  headers: {
2033
2033
  'Content-Type': 'application/json',
@@ -2885,9 +2885,25 @@
2885
2885
  const FIELD_NAME$7 = 'birthPlace';
2886
2886
  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$7) })));
2887
2887
 
2888
+ const getCardTypes = async (paymentSystemType) => {
2889
+ const response = await doRequest('/dictionaryFiltered', 'POST', {
2890
+ type: 'CARD_TYPE',
2891
+ presets: { paymentSystemType, creditProgramId: 13 },
2892
+ });
2893
+ const data = await response?.json();
2894
+ return data;
2895
+ };
2896
+
2888
2897
  const CardCategoryField = JSX(({ field, input }) => {
2889
- const { data: cardCategory } = useLeadFormData('CARD_TYPE');
2890
- return (jsx(SelectField, { field: field, source: cardCategory, label: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043A\u0430\u0440\u0442\u044B", fieldName: "cardCategory", input: input }));
2898
+ const [cardTypes, setCardTypes] = useState([]);
2899
+ const selectedPaymentSystem = field('paymentSystem').value;
2900
+ useEffect(() => {
2901
+ (async () => {
2902
+ const fetchedCardTypes = await getCardTypes(selectedPaymentSystem);
2903
+ setCardTypes(fetchedCardTypes);
2904
+ })();
2905
+ }, [selectedPaymentSystem]);
2906
+ 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 }));
2891
2907
  });
2892
2908
 
2893
2909
  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", type: "number", ...getValidation(field('children'), validatorObj.children, input?.required), ...input })));
@@ -3188,13 +3204,27 @@
3188
3204
  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 }));
3189
3205
  });
3190
3206
 
3191
- const PAYMENT_SYSTEM_TYPES = [
3192
- { id: 'mir', text: 'Карта МИР' },
3193
- { id: 'union_pay', text: 'UnionPay' },
3194
- ];
3207
+ const getPaymentSystems = async () => {
3208
+ const response = await doRequest('/public-data/creditProgramConditions', 'POST', {
3209
+ creditProgramId: 13,
3210
+ });
3211
+ const data = await response?.json();
3212
+ return data?.paymentSystems?.map((paymentSystem) => ({
3213
+ id: paymentSystem.type,
3214
+ text: paymentSystem.name,
3215
+ }));
3216
+ };
3217
+
3195
3218
  const PaymentSystemField = JSX(({ field, input }) => {
3196
3219
  const { value, onChange } = field('paymentSystem');
3197
- return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: PAYMENT_SYSTEM_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('paymentSystem'), validatorObj.paymentSystem, input?.required) }));
3220
+ const [paymentSystemOptions, setPaymentSystemOptions] = useState([]);
3221
+ useEffect(() => {
3222
+ (async () => {
3223
+ const fetchedPaymentSystems = await getPaymentSystems();
3224
+ setPaymentSystemOptions(fetchedPaymentSystems || []);
3225
+ })();
3226
+ }, []);
3227
+ 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) }));
3198
3228
  });
3199
3229
 
3200
3230
  const isPlaceholder = (_) => _ === '_';
@@ -6176,7 +6206,7 @@
6176
6206
 
6177
6207
  const formStateMap$1 = [
6178
6208
  {
6179
- paymentSystem: PAYMENT_SYSTEM_TYPES[0].id,
6209
+ paymentSystem: '',
6180
6210
  currency: 'rub',
6181
6211
  codeWord: '',
6182
6212
  },
@@ -9982,7 +10012,7 @@
9982
10012
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
9983
10013
  });
9984
10014
 
9985
- const packageVersion = "0.14.670";
10015
+ const packageVersion = "0.14.671";
9986
10016
 
9987
10017
  exports.Blocks = Blocks;
9988
10018
  exports.ContentPage = ContentPage;