@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.
- package/bundle/api/RetailAPI/getCardTypes.d.ts +1 -1
- package/bundle/api/RetailAPI/getPaymentSystems.d.ts +1 -1
- package/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -2
- package/bundle/bundle.umd.js +51 -35
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/api/RetailAPI/getCardTypes.d.ts +1 -1
- package/dist/api/RetailAPI/getCardTypes.js +3 -4
- package/dist/api/RetailAPI/getCardTypes.js.map +1 -1
- package/dist/api/RetailAPI/getPaymentSystems.d.ts +1 -1
- package/dist/api/RetailAPI/getPaymentSystems.js +3 -4
- package/dist/api/RetailAPI/getPaymentSystems.js.map +1 -1
- package/dist/api/RetailAPI/updateUserProfile.d.ts +1 -2
- package/dist/api/RetailAPI/updateUserProfile.js +1 -1
- package/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
- package/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
- package/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
- package/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
- package/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +2 -0
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/api/RetailAPI/getCardTypes.d.ts +1 -1
- package/lib/api/RetailAPI/getCardTypes.js +4 -5
- package/lib/api/RetailAPI/getCardTypes.js.map +1 -1
- package/lib/api/RetailAPI/getPaymentSystems.d.ts +1 -1
- package/lib/api/RetailAPI/getPaymentSystems.js +4 -5
- package/lib/api/RetailAPI/getPaymentSystems.js.map +1 -1
- package/lib/api/RetailAPI/updateUserProfile.d.ts +1 -2
- package/lib/api/RetailAPI/updateUserProfile.js +2 -2
- package/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
- package/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
- package/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
- package/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
- package/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +2 -0
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/bundle/api/RetailAPI/getCardTypes.d.ts +1 -1
- package/mobile/bundle/api/RetailAPI/getPaymentSystems.d.ts +1 -1
- package/mobile/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -2
- package/mobile/bundle/bundle.umd.js +51 -35
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/api/RetailAPI/getCardTypes.d.ts +1 -1
- package/mobile/dist/api/RetailAPI/getCardTypes.js +3 -4
- package/mobile/dist/api/RetailAPI/getCardTypes.js.map +1 -1
- package/mobile/dist/api/RetailAPI/getPaymentSystems.d.ts +1 -1
- package/mobile/dist/api/RetailAPI/getPaymentSystems.js +3 -4
- package/mobile/dist/api/RetailAPI/getPaymentSystems.js.map +1 -1
- package/mobile/dist/api/RetailAPI/updateUserProfile.d.ts +1 -2
- package/mobile/dist/api/RetailAPI/updateUserProfile.js +1 -1
- package/mobile/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
- package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
- package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
- package/mobile/dist/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
- package/mobile/dist/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +2 -0
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/api/RetailAPI/getCardTypes.d.ts +1 -1
- package/mobile/lib/api/RetailAPI/getCardTypes.js +4 -5
- package/mobile/lib/api/RetailAPI/getCardTypes.js.map +1 -1
- package/mobile/lib/api/RetailAPI/getPaymentSystems.d.ts +1 -1
- package/mobile/lib/api/RetailAPI/getPaymentSystems.js +4 -5
- package/mobile/lib/api/RetailAPI/getPaymentSystems.js.map +1 -1
- package/mobile/lib/api/RetailAPI/updateUserProfile.d.ts +1 -2
- package/mobile/lib/api/RetailAPI/updateUserProfile.js +2 -2
- package/mobile/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
- package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
- package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +11 -6
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js +13 -4
- package/mobile/lib/ui-kit/FormField/Fields/CardCategoryField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js +8 -4
- package/mobile/lib/ui-kit/FormField/Fields/PaymentSystemField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +2 -0
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/src/api/RetailAPI/getCardTypes.ts +4 -6
- package/mobile/src/api/RetailAPI/getPaymentSystems.ts +9 -7
- package/mobile/src/api/RetailAPI/updateUserProfile.ts +2 -3
- package/mobile/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +12 -8
- package/mobile/src/ui-kit/FormField/Fields/CardCategoryField.tsx +17 -4
- package/mobile/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +8 -4
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +2 -0
- package/package.json +1 -1
- package/src/api/RetailAPI/getCardTypes.ts +4 -6
- package/src/api/RetailAPI/getPaymentSystems.ts +9 -7
- package/src/api/RetailAPI/updateUserProfile.ts +2 -3
- package/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +12 -8
- package/src/ui-kit/FormField/Fields/CardCategoryField.tsx +17 -4
- package/src/ui-kit/FormField/Fields/PaymentSystemField.tsx +8 -4
- package/src/ui-kit/FormField/getObjectValidator.tsx +2 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type CreateUserProfileResponse } from './updateUserTask';
|
|
1
|
+
import { doRequest } from './doRequest';
|
|
3
2
|
|
|
4
3
|
export type UpdateUserProfileBody = {
|
|
5
4
|
profile: {
|
|
@@ -23,4 +22,4 @@ export type UpdateUserProfileBody = {
|
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
export const updateUserProfile = (body: UpdateUserProfileBody) =>
|
|
26
|
-
|
|
25
|
+
doRequest('/user-data/updateUserProfile', 'PUT', body);
|
|
@@ -11,7 +11,7 @@ export const getUpdateUserProfileData = (
|
|
|
11
11
|
name = '',
|
|
12
12
|
surname = '',
|
|
13
13
|
middleName = '',
|
|
14
|
-
|
|
14
|
+
limitedBirthday = '',
|
|
15
15
|
phone = '',
|
|
16
16
|
email = '',
|
|
17
17
|
processPersonalDataFlg,
|
|
@@ -29,7 +29,7 @@ export const getUpdateUserProfileData = (
|
|
|
29
29
|
name,
|
|
30
30
|
surname,
|
|
31
31
|
midname: middleName,
|
|
32
|
-
birthDate:
|
|
32
|
+
birthDate: limitedBirthday && formatDate(limitedBirthday, true),
|
|
33
33
|
email,
|
|
34
34
|
phone: formatPhone(phone),
|
|
35
35
|
processPersonalDataFlg: Boolean(processPersonalDataFlg),
|
|
@@ -127,14 +127,18 @@ const updateUserData = async ({
|
|
|
127
127
|
programId,
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
try {
|
|
131
|
+
await updateUserTask(
|
|
132
|
+
getLeadFormTaskData({
|
|
133
|
+
participantId,
|
|
134
|
+
taskId,
|
|
135
|
+
profileId,
|
|
136
|
+
formData: transformedForm,
|
|
137
|
+
}),
|
|
138
|
+
);
|
|
139
|
+
} catch (ex) {
|
|
140
|
+
console.log(ex);
|
|
141
|
+
}
|
|
138
142
|
|
|
139
143
|
saveUserData({ participantId, taskId, profileId, programId });
|
|
140
144
|
saveForm(formData);
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { getCardTypes, type CardTypeData } from '../../../api/RetailAPI/getCardTypes';
|
|
4
|
+
import { useLocalStorage } from '../../../hooks/useLocalStorage';
|
|
5
|
+
import { type Option } from '../../Select/Option';
|
|
4
6
|
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
5
7
|
import { SelectField } from '../SelectField';
|
|
6
8
|
|
|
7
9
|
export const CardCategoryField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
8
10
|
const [cardTypes, setCardTypes] = useState<CardTypeData[]>([]);
|
|
11
|
+
const [programId] = useLocalStorage<string>('programId');
|
|
12
|
+
const { value: selectedCardCategory, onChange: cardCategoryChange } = field('cardCategory');
|
|
9
13
|
const selectedPaymentSystem = field('paymentSystem').value;
|
|
10
14
|
|
|
11
15
|
useEffect(() => {
|
|
12
|
-
(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
if (selectedPaymentSystem && programId) {
|
|
17
|
+
(async () => {
|
|
18
|
+
const fetchedCardTypes = await getCardTypes(selectedPaymentSystem as string, programId);
|
|
19
|
+
setCardTypes(fetchedCardTypes);
|
|
20
|
+
|
|
21
|
+
if (!isValidCardCategory(fetchedCardTypes, selectedCardCategory as Option)) {
|
|
22
|
+
cardCategoryChange && cardCategoryChange(null);
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
}
|
|
16
26
|
}, [selectedPaymentSystem]);
|
|
17
27
|
|
|
18
28
|
return (
|
|
@@ -25,3 +35,6 @@ export const CardCategoryField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
25
35
|
/>
|
|
26
36
|
);
|
|
27
37
|
});
|
|
38
|
+
|
|
39
|
+
const isValidCardCategory = (cardTypes: CardTypeData[], selectedCardCategory: Option | null) =>
|
|
40
|
+
cardTypes.some((cardType) => cardType.key === selectedCardCategory?.key);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { getPaymentSystems } from '../../../api/RetailAPI/getPaymentSystems';
|
|
4
|
+
import { useLocalStorage } from '../../../hooks/useLocalStorage';
|
|
4
5
|
import { type RadioButtonItem } from '../../RadioButtonGroup/RadioButtonGroup';
|
|
5
6
|
import { RadioButtonGroupControl } from '../../RadioButtonGroup/RadioButtonGroupControl';
|
|
6
7
|
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
@@ -9,14 +10,17 @@ import { getValidation } from '../getValidation';
|
|
|
9
10
|
|
|
10
11
|
export const PaymentSystemField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
11
12
|
const { value, onChange } = field('paymentSystem');
|
|
13
|
+
const [programId] = useLocalStorage<string>('programId');
|
|
12
14
|
|
|
13
15
|
const [paymentSystemOptions, setPaymentSystemOptions] = useState<RadioButtonItem[]>([]);
|
|
14
16
|
|
|
15
17
|
useEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
if (programId) {
|
|
19
|
+
(async () => {
|
|
20
|
+
const fetchedPaymentSystems = await getPaymentSystems(programId);
|
|
21
|
+
setPaymentSystemOptions(fetchedPaymentSystems || []);
|
|
22
|
+
})();
|
|
23
|
+
}
|
|
20
24
|
}, []);
|
|
21
25
|
|
|
22
26
|
return (
|
|
@@ -105,6 +105,8 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
105
105
|
confirmationIncome: defaultValidator(),
|
|
106
106
|
deliveryDate: defaultValidator('Укажите дату доставки'),
|
|
107
107
|
addressCourier: addressDaDataValidator(),
|
|
108
|
+
cardCategory: defaultValidator('Укажите категорию карты'),
|
|
109
|
+
paymentSystem: defaultValidator('Укажите тип платежной системы'),
|
|
108
110
|
};
|
|
109
111
|
|
|
110
112
|
export const getObjectValidator = (inputs: FieldDef[]): Record<string, Validator> => {
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fetchRetailJSON } from './doRequest';
|
|
2
2
|
|
|
3
3
|
export type CardTypeData = {
|
|
4
4
|
type: string;
|
|
@@ -8,13 +8,11 @@ export type CardTypeData = {
|
|
|
8
8
|
description: string;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export const getCardTypes = async (
|
|
12
|
-
const
|
|
11
|
+
export const getCardTypes = async (paymentSystemTypeCd: string, creditProgramId: string) => {
|
|
12
|
+
const data = await fetchRetailJSON<CardTypeData[]>('/dictionaryFiltered', 'POST', {
|
|
13
13
|
type: 'CARD_TYPE',
|
|
14
|
-
presets: {
|
|
14
|
+
presets: { paymentSystemTypeCd, creditProgramId },
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
const data: CardTypeData[] = await response?.json();
|
|
18
|
-
|
|
19
17
|
return Array.isArray(data) ? data : [];
|
|
20
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fetchRetailJSON } from './doRequest';
|
|
2
2
|
|
|
3
3
|
type PaymentSystemResponse = {
|
|
4
4
|
paymentSystems?: {
|
|
@@ -7,12 +7,14 @@ type PaymentSystemResponse = {
|
|
|
7
7
|
}[];
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export const getPaymentSystems = async () => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
export const getPaymentSystems = async (creditProgramId: string) => {
|
|
11
|
+
const data = await fetchRetailJSON<PaymentSystemResponse>(
|
|
12
|
+
'/public-data/creditProgramConditions',
|
|
13
|
+
'POST',
|
|
14
|
+
{
|
|
15
|
+
creditProgramId,
|
|
16
|
+
},
|
|
17
|
+
);
|
|
16
18
|
|
|
17
19
|
return (
|
|
18
20
|
data?.paymentSystems?.map((paymentSystem) => ({
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type CreateUserProfileResponse } from './updateUserTask';
|
|
1
|
+
import { doRequest } from './doRequest';
|
|
3
2
|
|
|
4
3
|
export type UpdateUserProfileBody = {
|
|
5
4
|
profile: {
|
|
@@ -23,4 +22,4 @@ export type UpdateUserProfileBody = {
|
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
export const updateUserProfile = (body: UpdateUserProfileBody) =>
|
|
26
|
-
|
|
25
|
+
doRequest('/user-data/updateUserProfile', 'PUT', body);
|
|
@@ -11,7 +11,7 @@ export const getUpdateUserProfileData = (
|
|
|
11
11
|
name = '',
|
|
12
12
|
surname = '',
|
|
13
13
|
middleName = '',
|
|
14
|
-
|
|
14
|
+
limitedBirthday = '',
|
|
15
15
|
phone = '',
|
|
16
16
|
email = '',
|
|
17
17
|
processPersonalDataFlg,
|
|
@@ -29,7 +29,7 @@ export const getUpdateUserProfileData = (
|
|
|
29
29
|
name,
|
|
30
30
|
surname,
|
|
31
31
|
midname: middleName,
|
|
32
|
-
birthDate:
|
|
32
|
+
birthDate: limitedBirthday && formatDate(limitedBirthday, true),
|
|
33
33
|
email,
|
|
34
34
|
phone: formatPhone(phone),
|
|
35
35
|
processPersonalDataFlg: Boolean(processPersonalDataFlg),
|
|
@@ -127,14 +127,18 @@ const updateUserData = async ({
|
|
|
127
127
|
programId,
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
try {
|
|
131
|
+
await updateUserTask(
|
|
132
|
+
getLeadFormTaskData({
|
|
133
|
+
participantId,
|
|
134
|
+
taskId,
|
|
135
|
+
profileId,
|
|
136
|
+
formData: transformedForm,
|
|
137
|
+
}),
|
|
138
|
+
);
|
|
139
|
+
} catch (ex) {
|
|
140
|
+
console.log(ex);
|
|
141
|
+
}
|
|
138
142
|
|
|
139
143
|
saveUserData({ participantId, taskId, profileId, programId });
|
|
140
144
|
saveForm(formData);
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { getCardTypes, type CardTypeData } from '../../../api/RetailAPI/getCardTypes';
|
|
4
|
+
import { useLocalStorage } from '../../../hooks/useLocalStorage';
|
|
5
|
+
import { type Option } from '../../Select/Option';
|
|
4
6
|
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
5
7
|
import { SelectField } from '../SelectField';
|
|
6
8
|
|
|
7
9
|
export const CardCategoryField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
8
10
|
const [cardTypes, setCardTypes] = useState<CardTypeData[]>([]);
|
|
11
|
+
const [programId] = useLocalStorage<string>('programId');
|
|
12
|
+
const { value: selectedCardCategory, onChange: cardCategoryChange } = field('cardCategory');
|
|
9
13
|
const selectedPaymentSystem = field('paymentSystem').value;
|
|
10
14
|
|
|
11
15
|
useEffect(() => {
|
|
12
|
-
(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
if (selectedPaymentSystem && programId) {
|
|
17
|
+
(async () => {
|
|
18
|
+
const fetchedCardTypes = await getCardTypes(selectedPaymentSystem as string, programId);
|
|
19
|
+
setCardTypes(fetchedCardTypes);
|
|
20
|
+
|
|
21
|
+
if (!isValidCardCategory(fetchedCardTypes, selectedCardCategory as Option)) {
|
|
22
|
+
cardCategoryChange && cardCategoryChange(null);
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
}
|
|
16
26
|
}, [selectedPaymentSystem]);
|
|
17
27
|
|
|
18
28
|
return (
|
|
@@ -25,3 +35,6 @@ export const CardCategoryField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
25
35
|
/>
|
|
26
36
|
);
|
|
27
37
|
});
|
|
38
|
+
|
|
39
|
+
const isValidCardCategory = (cardTypes: CardTypeData[], selectedCardCategory: Option | null) =>
|
|
40
|
+
cardTypes.some((cardType) => cardType.key === selectedCardCategory?.key);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { getPaymentSystems } from '../../../api/RetailAPI/getPaymentSystems';
|
|
4
|
+
import { useLocalStorage } from '../../../hooks/useLocalStorage';
|
|
4
5
|
import { type RadioButtonItem } from '../../RadioButtonGroup/RadioButtonGroup';
|
|
5
6
|
import { RadioButtonGroupControl } from '../../RadioButtonGroup/RadioButtonGroupControl';
|
|
6
7
|
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
@@ -9,14 +10,17 @@ import { getValidation } from '../getValidation';
|
|
|
9
10
|
|
|
10
11
|
export const PaymentSystemField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
11
12
|
const { value, onChange } = field('paymentSystem');
|
|
13
|
+
const [programId] = useLocalStorage<string>('programId');
|
|
12
14
|
|
|
13
15
|
const [paymentSystemOptions, setPaymentSystemOptions] = useState<RadioButtonItem[]>([]);
|
|
14
16
|
|
|
15
17
|
useEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
if (programId) {
|
|
19
|
+
(async () => {
|
|
20
|
+
const fetchedPaymentSystems = await getPaymentSystems(programId);
|
|
21
|
+
setPaymentSystemOptions(fetchedPaymentSystems || []);
|
|
22
|
+
})();
|
|
23
|
+
}
|
|
20
24
|
}, []);
|
|
21
25
|
|
|
22
26
|
return (
|
|
@@ -105,6 +105,8 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
105
105
|
confirmationIncome: defaultValidator(),
|
|
106
106
|
deliveryDate: defaultValidator('Укажите дату доставки'),
|
|
107
107
|
addressCourier: addressDaDataValidator(),
|
|
108
|
+
cardCategory: defaultValidator('Укажите категорию карты'),
|
|
109
|
+
paymentSystem: defaultValidator('Укажите тип платежной системы'),
|
|
108
110
|
};
|
|
109
111
|
|
|
110
112
|
export const getObjectValidator = (inputs: FieldDef[]): Record<string, Validator> => {
|