@redneckz/wildless-cms-uni-blocks 0.14.977 → 0.14.979
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/bundle.umd.js +56 -13
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +10 -4
- package/bundle/retail/api/createUserTaskDebit.d.ts +1 -0
- package/bundle/retail/api/getClaimChannel.d.ts +8 -0
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +10 -4
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/retail/api/createUserTaskDebit.d.ts +1 -0
- package/dist/retail/api/createUserTaskDebit.js.map +1 -1
- package/dist/retail/api/getClaimChannel.d.ts +8 -0
- package/dist/retail/api/getClaimChannel.js +14 -0
- package/dist/retail/api/getClaimChannel.js.map +1 -0
- package/dist/retail/components/Fields/AddressRetailField.js +0 -3
- package/dist/retail/components/Fields/AddressRetailField.js.map +1 -1
- package/dist/retail/components/Fields/PaymentSystemField.js +9 -1
- package/dist/retail/components/Fields/PaymentSystemField.js.map +1 -1
- package/dist/retail/components/Fields/RegionRetailField.js +29 -6
- package/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +10 -4
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/retail/api/createUserTaskDebit.d.ts +1 -0
- package/lib/retail/api/createUserTaskDebit.js.map +1 -1
- package/lib/retail/api/getClaimChannel.d.ts +8 -0
- package/lib/retail/api/getClaimChannel.js +11 -0
- package/lib/retail/api/getClaimChannel.js.map +1 -0
- package/lib/retail/components/Fields/AddressRetailField.js +0 -3
- package/lib/retail/components/Fields/AddressRetailField.js.map +1 -1
- package/lib/retail/components/Fields/PaymentSystemField.js +9 -1
- package/lib/retail/components/Fields/PaymentSystemField.js.map +1 -1
- package/lib/retail/components/Fields/RegionRetailField.js +29 -6
- package/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +56 -13
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +10 -4
- package/mobile/bundle/retail/api/createUserTaskDebit.d.ts +1 -0
- package/mobile/bundle/retail/api/getClaimChannel.d.ts +8 -0
- package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +10 -4
- package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
- package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/retail/api/createUserTaskDebit.d.ts +1 -0
- package/mobile/dist/retail/api/createUserTaskDebit.js.map +1 -1
- package/mobile/dist/retail/api/getClaimChannel.d.ts +8 -0
- package/mobile/dist/retail/api/getClaimChannel.js +14 -0
- package/mobile/dist/retail/api/getClaimChannel.js.map +1 -0
- package/mobile/dist/retail/components/Fields/AddressRetailField.js +0 -3
- package/mobile/dist/retail/components/Fields/AddressRetailField.js.map +1 -1
- package/mobile/dist/retail/components/Fields/PaymentSystemField.js +9 -1
- package/mobile/dist/retail/components/Fields/PaymentSystemField.js.map +1 -1
- package/mobile/dist/retail/components/Fields/RegionRetailField.js +29 -6
- package/mobile/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +10 -4
- package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
- package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/retail/api/createUserTaskDebit.d.ts +1 -0
- package/mobile/lib/retail/api/createUserTaskDebit.js.map +1 -1
- package/mobile/lib/retail/api/getClaimChannel.d.ts +8 -0
- package/mobile/lib/retail/api/getClaimChannel.js +11 -0
- package/mobile/lib/retail/api/getClaimChannel.js.map +1 -0
- package/mobile/lib/retail/components/Fields/AddressRetailField.js +0 -3
- package/mobile/lib/retail/components/Fields/AddressRetailField.js.map +1 -1
- package/mobile/lib/retail/components/Fields/PaymentSystemField.js +9 -1
- package/mobile/lib/retail/components/Fields/PaymentSystemField.js.map +1 -1
- package/mobile/lib/retail/components/Fields/RegionRetailField.js +29 -6
- package/mobile/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/mobile/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +17 -8
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +8 -1
- package/mobile/src/retail/api/createUserTaskDebit.ts +1 -0
- package/mobile/src/retail/api/getClaimChannel.ts +24 -0
- package/mobile/src/retail/components/Fields/AddressRetailField.tsx +0 -4
- package/mobile/src/retail/components/Fields/PaymentSystemField.tsx +10 -1
- package/mobile/src/retail/components/Fields/RegionRetailField.tsx +38 -6
- package/package.json +2 -2
- package/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +17 -8
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +8 -1
- package/src/retail/api/createUserTaskDebit.ts +1 -0
- package/src/retail/api/getClaimChannel.ts +24 -0
- package/src/retail/components/Fields/AddressRetailField.tsx +0 -4
- package/src/retail/components/Fields/PaymentSystemField.tsx +10 -1
- package/src/retail/components/Fields/RegionRetailField.tsx +38 -6
|
@@ -2,34 +2,57 @@ import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
|
2
2
|
import { JSX } from '@redneckz/uni-jsx';
|
|
3
3
|
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
4
4
|
import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
|
|
5
|
+
import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
5
6
|
import { SelectControl } from '../../../ui-kit/Select/SelectControl.js';
|
|
6
7
|
import { getRegionsCardDelivery } from '../../api/getRegionsCardDelivery.js';
|
|
7
8
|
import { useLeadFormData } from '../../hooks/useLeadFormData.js';
|
|
8
9
|
import { useRetailFormStore } from '../../hooks/useRetailFormStore.js';
|
|
10
|
+
const DEFAULT_BIBLIOLOBUS_VALUES = {
|
|
11
|
+
region: {
|
|
12
|
+
key: 'REGION_77',
|
|
13
|
+
text: 'Москва и Московская область',
|
|
14
|
+
},
|
|
15
|
+
office: {
|
|
16
|
+
key: '3041100',
|
|
17
|
+
text: 'Аэропорт Шереметьево, МО, г.Химки, Шереметьевское шоссе, вл39с1',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
9
20
|
export const RegionRetailField = JSX(({ field, input }) => {
|
|
10
21
|
const { programId, productType } = useRetailFormStore();
|
|
11
22
|
const { data: regions } = useLeadFormData('REGION_RF');
|
|
12
23
|
const { data: regionsDelivery } = useAsyncData('regionsDelivery', getRegionsCardDelivery);
|
|
13
24
|
const { data: productSettings } = useLeadFormData(getCurrentProductSettings(productType));
|
|
25
|
+
const sessionStore = useSessionStore();
|
|
14
26
|
const isDebit = productType === 'debitCard';
|
|
15
27
|
const isSalaryCard = programId === '38';
|
|
16
28
|
const isEsiaAuth = Boolean(field('esiaAccountTypeCd')?.value?.key);
|
|
17
29
|
const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
|
|
18
30
|
const isDeliveryActive = productSettings?.find((_) => _?.key === 'DELIVERY_ACTIVE')?.value === 'true';
|
|
19
31
|
const handleChangeRegion = field('regionRetail')?.onChange;
|
|
32
|
+
const handleChangeOffice = field('addressRetail')?.onChange;
|
|
20
33
|
const handleChangeRegionHasDelivery = field('regionHasDelivery')?.onChange;
|
|
21
34
|
const handleChangeMethodObtain = field('methodObtain')?.onChange;
|
|
35
|
+
const checkRegionDeliveryStatus = useCallback((value) => {
|
|
36
|
+
const isDebitDeliveryActive = isDebit ? isEsiaAuth && !isSalaryCard : true;
|
|
37
|
+
return (isDebitDeliveryActive &&
|
|
38
|
+
isDeliveryActive &&
|
|
39
|
+
regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg);
|
|
40
|
+
}, [isDeliveryActive, regionsDelivery]);
|
|
22
41
|
const onChange = useCallback((value) => {
|
|
23
|
-
const regionHasDelivery =
|
|
24
|
-
? isEsiaAuth &&
|
|
25
|
-
!isSalaryCard &&
|
|
26
|
-
isDeliveryActive &&
|
|
27
|
-
regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg
|
|
28
|
-
: isDeliveryActive && regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg;
|
|
42
|
+
const regionHasDelivery = checkRegionDeliveryStatus(value);
|
|
29
43
|
handleChangeRegionHasDelivery?.(regionHasDelivery);
|
|
30
44
|
handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
|
|
31
45
|
handleChangeRegion?.(value);
|
|
46
|
+
handleChangeOffice?.('');
|
|
32
47
|
}, [regionsDelivery, isDeliveryActive, isEsiaAuth]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (sessionStore.claimChannelCode) {
|
|
50
|
+
handleChangeRegion?.(DEFAULT_BIBLIOLOBUS_VALUES.region);
|
|
51
|
+
handleChangeOffice?.(DEFAULT_BIBLIOLOBUS_VALUES.office);
|
|
52
|
+
handleChangeRegionHasDelivery?.(checkRegionDeliveryStatus(DEFAULT_BIBLIOLOBUS_VALUES.region));
|
|
53
|
+
handleChangeMethodObtain?.('office');
|
|
54
|
+
}
|
|
55
|
+
}, [checkRegionDeliveryStatus]);
|
|
33
56
|
useEffect(() => {
|
|
34
57
|
if (!isEsiaAuth && isDebit) {
|
|
35
58
|
handleChangeRegionHasDelivery?.(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegionRetailField.js","sourceRoot":"","sources":["../../../../src/retail/components/Fields/RegionRetailField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"RegionRetailField.js","sourceRoot":"","sources":["../../../../src/retail/components/Fields/RegionRetailField.tsx"],"names":[],"mappings":"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"}
|
|
@@ -11,7 +11,7 @@ import { formatPhone } from '../../utils/formatPhone';
|
|
|
11
11
|
import { type Nullable } from '../../utils/Nullable';
|
|
12
12
|
import { debitProgrammIdToCardCodesMap } from '../DebitForm/utils';
|
|
13
13
|
|
|
14
|
-
type
|
|
14
|
+
type getCreditLeadFormTaskDataProps = {
|
|
15
15
|
participantId: number;
|
|
16
16
|
taskId: number;
|
|
17
17
|
profileId?: number;
|
|
@@ -20,6 +20,13 @@ type getLeadFormTaskDataProps = {
|
|
|
20
20
|
consents?: FormRetailConsents;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
type getDebitLeadFormTaskDataProps = {
|
|
24
|
+
formData: LeadFormState;
|
|
25
|
+
programId: string;
|
|
26
|
+
marketingInfo: MarketingInfo | null;
|
|
27
|
+
claimChannelCode?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
23
30
|
export const getCreditLeadFormTaskData = ({
|
|
24
31
|
participantId,
|
|
25
32
|
taskId,
|
|
@@ -27,7 +34,7 @@ export const getCreditLeadFormTaskData = ({
|
|
|
27
34
|
formData,
|
|
28
35
|
marketingInfo,
|
|
29
36
|
consents,
|
|
30
|
-
}:
|
|
37
|
+
}: getCreditLeadFormTaskDataProps): UpdateUserTaskBody => {
|
|
31
38
|
const taskSource = getTaskSource(marketingInfo?.utm_source);
|
|
32
39
|
const participantInfo = getParticipant({ participantId, profileId, formData, consents });
|
|
33
40
|
|
|
@@ -55,7 +62,7 @@ export const getParticipant = ({
|
|
|
55
62
|
formData,
|
|
56
63
|
consents,
|
|
57
64
|
}: Pick<
|
|
58
|
-
|
|
65
|
+
getCreditLeadFormTaskDataProps,
|
|
59
66
|
'profileId' | 'participantId' | 'formData' | 'consents'
|
|
60
67
|
>): Participant => {
|
|
61
68
|
const { name, surname, middleName, limitedBirthday, phone, email } = formData;
|
|
@@ -83,11 +90,12 @@ export const getParticipant = ({
|
|
|
83
90
|
};
|
|
84
91
|
};
|
|
85
92
|
|
|
86
|
-
export const getDebitLeadFormTaskData = (
|
|
87
|
-
formData
|
|
88
|
-
programId
|
|
89
|
-
marketingInfo
|
|
90
|
-
|
|
93
|
+
export const getDebitLeadFormTaskData = ({
|
|
94
|
+
formData,
|
|
95
|
+
programId,
|
|
96
|
+
marketingInfo,
|
|
97
|
+
claimChannelCode,
|
|
98
|
+
}: getDebitLeadFormTaskDataProps): CreateUserTaskDebitBody => {
|
|
91
99
|
const { name, surname, middleName, limitedBirthday, phone, email } = formData;
|
|
92
100
|
const taskSource = getTaskSource(marketingInfo?.utm_source);
|
|
93
101
|
|
|
@@ -110,6 +118,7 @@ export const getDebitLeadFormTaskData = (
|
|
|
110
118
|
},
|
|
111
119
|
],
|
|
112
120
|
marketingInfo,
|
|
121
|
+
claimChannelCode,
|
|
113
122
|
},
|
|
114
123
|
};
|
|
115
124
|
};
|
|
@@ -8,6 +8,7 @@ import { createDraftTask } from '../../retail/api/createDraftTask';
|
|
|
8
8
|
import { createParticipant } from '../../retail/api/createParticipant';
|
|
9
9
|
import { createUserProfile } from '../../retail/api/createUserProfile';
|
|
10
10
|
import { createUserTaskDebit } from '../../retail/api/createUserTaskDebit';
|
|
11
|
+
import { getClaimChannel } from '../../retail/api/getClaimChannel';
|
|
11
12
|
import { getLastTaskStatus } from '../../retail/api/getLastTaskStatus';
|
|
12
13
|
import { getTaskById } from '../../retail/api/getTaskById';
|
|
13
14
|
import { saveReferalInfo } from '../../retail/api/saveReferalInfo';
|
|
@@ -241,8 +242,14 @@ const updateUserData = async ({
|
|
|
241
242
|
|
|
242
243
|
try {
|
|
243
244
|
if (productType === 'debitCard') {
|
|
245
|
+
const claimChannelCode = await getClaimChannel();
|
|
244
246
|
const debitData = await createUserTaskDebit(
|
|
245
|
-
getDebitLeadFormTaskData(
|
|
247
|
+
getDebitLeadFormTaskData({
|
|
248
|
+
formData,
|
|
249
|
+
programId,
|
|
250
|
+
marketingInfo,
|
|
251
|
+
claimChannelCode,
|
|
252
|
+
}),
|
|
246
253
|
);
|
|
247
254
|
|
|
248
255
|
taskId = debitData.taskId;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fetchRetailJSON } from './doRequest';
|
|
2
|
+
|
|
3
|
+
export type GetClaimChannelResponse = {
|
|
4
|
+
code: string;
|
|
5
|
+
deliveryEmail: string;
|
|
6
|
+
description: string;
|
|
7
|
+
id: number;
|
|
8
|
+
key: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const getClaimChannel = async (): Promise<string | undefined> => {
|
|
12
|
+
const claimChannelCode = await fetchRetailJSON<GetClaimChannelResponse[]>(
|
|
13
|
+
'/claim-channel/',
|
|
14
|
+
'GET',
|
|
15
|
+
).then((res) => {
|
|
16
|
+
const url = globalThis.location.href;
|
|
17
|
+
const code = res?.find((_) => _ && url.includes(_.key))?.code;
|
|
18
|
+
globalThis.sessionStorage.setItem('claimChannelCode', code ?? '');
|
|
19
|
+
|
|
20
|
+
return code;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return claimChannelCode;
|
|
24
|
+
};
|
|
@@ -21,10 +21,6 @@ export const AddressRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
21
21
|
const officesList = await fetchRegionOffices((regionValue?.key as string) ?? '');
|
|
22
22
|
setOffices(officesList);
|
|
23
23
|
})();
|
|
24
|
-
|
|
25
|
-
if (regionValue?.key) {
|
|
26
|
-
addressField.onChange?.('');
|
|
27
|
-
}
|
|
28
24
|
}, [regionValue.key]);
|
|
29
25
|
|
|
30
26
|
const { points } = useOfficesAtmsMapData({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useLocalStore } from '@redneckz/uni-jsx/lib/Store/useLocalStore';
|
|
4
|
+
import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
4
5
|
import { useAsyncEffect } from '../../../hooks/useAsyncEffect';
|
|
5
6
|
import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
|
|
6
7
|
import { RadioButtonGroupControl } from '../../../ui-kit/RadioButtonGroup/RadioButtonGroupControl';
|
|
@@ -9,14 +10,22 @@ import { getPaymentSystems } from '../../api/getPaymentSystems';
|
|
|
9
10
|
|
|
10
11
|
const optionKey = (option: { key?: string } | undefined) => option?.key;
|
|
11
12
|
|
|
13
|
+
const DEFAULT_BIBLIOLOBUS_PAYMENT_SYSTEMS: Option[] = [
|
|
14
|
+
{ key: 'PAYMENT_SYSTEM_TYPE_3', text: 'UnionPay' },
|
|
15
|
+
];
|
|
16
|
+
|
|
12
17
|
export const PaymentSystemField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
13
18
|
const [paymentSystemOptions, setPaymentSystemOptions] = useState<Option[]>([]);
|
|
14
19
|
|
|
15
20
|
const localStore = useLocalStore<{ programId: string }>();
|
|
21
|
+
const sessionStore = useSessionStore<{ claimChannelCode?: string }>();
|
|
16
22
|
useAsyncEffect(async () => {
|
|
17
23
|
const { programId } = localStore;
|
|
24
|
+
const { claimChannelCode } = sessionStore;
|
|
18
25
|
if (programId) {
|
|
19
|
-
const fetchedPaymentSystems =
|
|
26
|
+
const fetchedPaymentSystems = claimChannelCode
|
|
27
|
+
? DEFAULT_BIBLIOLOBUS_PAYMENT_SYSTEMS
|
|
28
|
+
: await getPaymentSystems(programId);
|
|
20
29
|
setPaymentSystemOptions(fetchedPaymentSystems ?? []);
|
|
21
30
|
}
|
|
22
31
|
}, []);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
|
|
4
|
+
import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
4
5
|
import { type ProductType } from '../../../components/ApplicationLeadForm/ApplicationLeadFormContent';
|
|
5
6
|
import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
|
|
6
7
|
import { type Option } from '../../../ui-kit/Select/Option';
|
|
@@ -9,11 +10,23 @@ import { getRegionsCardDelivery } from '../../api/getRegionsCardDelivery';
|
|
|
9
10
|
import { useLeadFormData } from '../../hooks/useLeadFormData';
|
|
10
11
|
import { useRetailFormStore } from '../../hooks/useRetailFormStore';
|
|
11
12
|
|
|
13
|
+
const DEFAULT_BIBLIOLOBUS_VALUES = {
|
|
14
|
+
region: {
|
|
15
|
+
key: 'REGION_77',
|
|
16
|
+
text: 'Москва и Московская область',
|
|
17
|
+
},
|
|
18
|
+
office: {
|
|
19
|
+
key: '3041100',
|
|
20
|
+
text: 'Аэропорт Шереметьево, МО, г.Химки, Шереметьевское шоссе, вл39с1',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
12
24
|
export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
13
25
|
const { programId, productType } = useRetailFormStore();
|
|
14
26
|
const { data: regions } = useLeadFormData('REGION_RF');
|
|
15
27
|
const { data: regionsDelivery } = useAsyncData('regionsDelivery', getRegionsCardDelivery);
|
|
16
28
|
const { data: productSettings } = useLeadFormData(getCurrentProductSettings(productType));
|
|
29
|
+
const sessionStore = useSessionStore<{ claimChannelCode?: string }>();
|
|
17
30
|
const isDebit = productType === 'debitCard';
|
|
18
31
|
const isSalaryCard = programId === '38';
|
|
19
32
|
const isEsiaAuth = Boolean(field('esiaAccountTypeCd')?.value?.key);
|
|
@@ -21,25 +34,44 @@ export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
21
34
|
const isDeliveryActive =
|
|
22
35
|
productSettings?.find((_) => _?.key === 'DELIVERY_ACTIVE')?.value === 'true';
|
|
23
36
|
const handleChangeRegion = field('regionRetail')?.onChange;
|
|
37
|
+
const handleChangeOffice = field('addressRetail')?.onChange;
|
|
24
38
|
const handleChangeRegionHasDelivery = field('regionHasDelivery')?.onChange;
|
|
25
39
|
const handleChangeMethodObtain = field('methodObtain')?.onChange;
|
|
26
40
|
|
|
41
|
+
const checkRegionDeliveryStatus = useCallback(
|
|
42
|
+
(value: Option) => {
|
|
43
|
+
const isDebitDeliveryActive = isDebit ? isEsiaAuth && !isSalaryCard : true;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
isDebitDeliveryActive &&
|
|
47
|
+
isDeliveryActive &&
|
|
48
|
+
regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
[isDeliveryActive, regionsDelivery],
|
|
52
|
+
);
|
|
53
|
+
|
|
27
54
|
const onChange = useCallback(
|
|
28
55
|
(value: Option) => {
|
|
29
|
-
const regionHasDelivery =
|
|
30
|
-
? isEsiaAuth &&
|
|
31
|
-
!isSalaryCard &&
|
|
32
|
-
isDeliveryActive &&
|
|
33
|
-
regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg
|
|
34
|
-
: isDeliveryActive && regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg;
|
|
56
|
+
const regionHasDelivery = checkRegionDeliveryStatus(value);
|
|
35
57
|
|
|
36
58
|
handleChangeRegionHasDelivery?.(regionHasDelivery);
|
|
37
59
|
handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
|
|
38
60
|
handleChangeRegion?.(value);
|
|
61
|
+
handleChangeOffice?.('');
|
|
39
62
|
},
|
|
40
63
|
[regionsDelivery, isDeliveryActive, isEsiaAuth],
|
|
41
64
|
);
|
|
42
65
|
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (sessionStore.claimChannelCode) {
|
|
68
|
+
handleChangeRegion?.(DEFAULT_BIBLIOLOBUS_VALUES.region);
|
|
69
|
+
handleChangeOffice?.(DEFAULT_BIBLIOLOBUS_VALUES.office);
|
|
70
|
+
handleChangeRegionHasDelivery?.(checkRegionDeliveryStatus(DEFAULT_BIBLIOLOBUS_VALUES.region));
|
|
71
|
+
handleChangeMethodObtain?.('office');
|
|
72
|
+
}
|
|
73
|
+
}, [checkRegionDeliveryStatus]);
|
|
74
|
+
|
|
43
75
|
useEffect(() => {
|
|
44
76
|
if (!isEsiaAuth && isDebit) {
|
|
45
77
|
handleChangeRegionHasDelivery?.(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redneckz/wildless-cms-uni-blocks",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.979",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ЦК",
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"path": "lib/common.css"
|
|
206
206
|
},
|
|
207
207
|
{
|
|
208
|
-
"limit": "
|
|
208
|
+
"limit": "106 kB",
|
|
209
209
|
"path": "bundle/bundle.umd.min.js"
|
|
210
210
|
}
|
|
211
211
|
],
|
|
@@ -11,7 +11,7 @@ import { formatPhone } from '../../utils/formatPhone';
|
|
|
11
11
|
import { type Nullable } from '../../utils/Nullable';
|
|
12
12
|
import { debitProgrammIdToCardCodesMap } from '../DebitForm/utils';
|
|
13
13
|
|
|
14
|
-
type
|
|
14
|
+
type getCreditLeadFormTaskDataProps = {
|
|
15
15
|
participantId: number;
|
|
16
16
|
taskId: number;
|
|
17
17
|
profileId?: number;
|
|
@@ -20,6 +20,13 @@ type getLeadFormTaskDataProps = {
|
|
|
20
20
|
consents?: FormRetailConsents;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
type getDebitLeadFormTaskDataProps = {
|
|
24
|
+
formData: LeadFormState;
|
|
25
|
+
programId: string;
|
|
26
|
+
marketingInfo: MarketingInfo | null;
|
|
27
|
+
claimChannelCode?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
23
30
|
export const getCreditLeadFormTaskData = ({
|
|
24
31
|
participantId,
|
|
25
32
|
taskId,
|
|
@@ -27,7 +34,7 @@ export const getCreditLeadFormTaskData = ({
|
|
|
27
34
|
formData,
|
|
28
35
|
marketingInfo,
|
|
29
36
|
consents,
|
|
30
|
-
}:
|
|
37
|
+
}: getCreditLeadFormTaskDataProps): UpdateUserTaskBody => {
|
|
31
38
|
const taskSource = getTaskSource(marketingInfo?.utm_source);
|
|
32
39
|
const participantInfo = getParticipant({ participantId, profileId, formData, consents });
|
|
33
40
|
|
|
@@ -55,7 +62,7 @@ export const getParticipant = ({
|
|
|
55
62
|
formData,
|
|
56
63
|
consents,
|
|
57
64
|
}: Pick<
|
|
58
|
-
|
|
65
|
+
getCreditLeadFormTaskDataProps,
|
|
59
66
|
'profileId' | 'participantId' | 'formData' | 'consents'
|
|
60
67
|
>): Participant => {
|
|
61
68
|
const { name, surname, middleName, limitedBirthday, phone, email } = formData;
|
|
@@ -83,11 +90,12 @@ export const getParticipant = ({
|
|
|
83
90
|
};
|
|
84
91
|
};
|
|
85
92
|
|
|
86
|
-
export const getDebitLeadFormTaskData = (
|
|
87
|
-
formData
|
|
88
|
-
programId
|
|
89
|
-
marketingInfo
|
|
90
|
-
|
|
93
|
+
export const getDebitLeadFormTaskData = ({
|
|
94
|
+
formData,
|
|
95
|
+
programId,
|
|
96
|
+
marketingInfo,
|
|
97
|
+
claimChannelCode,
|
|
98
|
+
}: getDebitLeadFormTaskDataProps): CreateUserTaskDebitBody => {
|
|
91
99
|
const { name, surname, middleName, limitedBirthday, phone, email } = formData;
|
|
92
100
|
const taskSource = getTaskSource(marketingInfo?.utm_source);
|
|
93
101
|
|
|
@@ -110,6 +118,7 @@ export const getDebitLeadFormTaskData = (
|
|
|
110
118
|
},
|
|
111
119
|
],
|
|
112
120
|
marketingInfo,
|
|
121
|
+
claimChannelCode,
|
|
113
122
|
},
|
|
114
123
|
};
|
|
115
124
|
};
|
|
@@ -8,6 +8,7 @@ import { createDraftTask } from '../../retail/api/createDraftTask';
|
|
|
8
8
|
import { createParticipant } from '../../retail/api/createParticipant';
|
|
9
9
|
import { createUserProfile } from '../../retail/api/createUserProfile';
|
|
10
10
|
import { createUserTaskDebit } from '../../retail/api/createUserTaskDebit';
|
|
11
|
+
import { getClaimChannel } from '../../retail/api/getClaimChannel';
|
|
11
12
|
import { getLastTaskStatus } from '../../retail/api/getLastTaskStatus';
|
|
12
13
|
import { getTaskById } from '../../retail/api/getTaskById';
|
|
13
14
|
import { saveReferalInfo } from '../../retail/api/saveReferalInfo';
|
|
@@ -241,8 +242,14 @@ const updateUserData = async ({
|
|
|
241
242
|
|
|
242
243
|
try {
|
|
243
244
|
if (productType === 'debitCard') {
|
|
245
|
+
const claimChannelCode = await getClaimChannel();
|
|
244
246
|
const debitData = await createUserTaskDebit(
|
|
245
|
-
getDebitLeadFormTaskData(
|
|
247
|
+
getDebitLeadFormTaskData({
|
|
248
|
+
formData,
|
|
249
|
+
programId,
|
|
250
|
+
marketingInfo,
|
|
251
|
+
claimChannelCode,
|
|
252
|
+
}),
|
|
246
253
|
);
|
|
247
254
|
|
|
248
255
|
taskId = debitData.taskId;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fetchRetailJSON } from './doRequest';
|
|
2
|
+
|
|
3
|
+
export type GetClaimChannelResponse = {
|
|
4
|
+
code: string;
|
|
5
|
+
deliveryEmail: string;
|
|
6
|
+
description: string;
|
|
7
|
+
id: number;
|
|
8
|
+
key: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const getClaimChannel = async (): Promise<string | undefined> => {
|
|
12
|
+
const claimChannelCode = await fetchRetailJSON<GetClaimChannelResponse[]>(
|
|
13
|
+
'/claim-channel/',
|
|
14
|
+
'GET',
|
|
15
|
+
).then((res) => {
|
|
16
|
+
const url = globalThis.location.href;
|
|
17
|
+
const code = res?.find((_) => _ && url.includes(_.key))?.code;
|
|
18
|
+
globalThis.sessionStorage.setItem('claimChannelCode', code ?? '');
|
|
19
|
+
|
|
20
|
+
return code;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return claimChannelCode;
|
|
24
|
+
};
|
|
@@ -21,10 +21,6 @@ export const AddressRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
21
21
|
const officesList = await fetchRegionOffices((regionValue?.key as string) ?? '');
|
|
22
22
|
setOffices(officesList);
|
|
23
23
|
})();
|
|
24
|
-
|
|
25
|
-
if (regionValue?.key) {
|
|
26
|
-
addressField.onChange?.('');
|
|
27
|
-
}
|
|
28
24
|
}, [regionValue.key]);
|
|
29
25
|
|
|
30
26
|
const { points } = useOfficesAtmsMapData({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useLocalStore } from '@redneckz/uni-jsx/lib/Store/useLocalStore';
|
|
4
|
+
import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
4
5
|
import { useAsyncEffect } from '../../../hooks/useAsyncEffect';
|
|
5
6
|
import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
|
|
6
7
|
import { RadioButtonGroupControl } from '../../../ui-kit/RadioButtonGroup/RadioButtonGroupControl';
|
|
@@ -9,14 +10,22 @@ import { getPaymentSystems } from '../../api/getPaymentSystems';
|
|
|
9
10
|
|
|
10
11
|
const optionKey = (option: { key?: string } | undefined) => option?.key;
|
|
11
12
|
|
|
13
|
+
const DEFAULT_BIBLIOLOBUS_PAYMENT_SYSTEMS: Option[] = [
|
|
14
|
+
{ key: 'PAYMENT_SYSTEM_TYPE_3', text: 'UnionPay' },
|
|
15
|
+
];
|
|
16
|
+
|
|
12
17
|
export const PaymentSystemField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
13
18
|
const [paymentSystemOptions, setPaymentSystemOptions] = useState<Option[]>([]);
|
|
14
19
|
|
|
15
20
|
const localStore = useLocalStore<{ programId: string }>();
|
|
21
|
+
const sessionStore = useSessionStore<{ claimChannelCode?: string }>();
|
|
16
22
|
useAsyncEffect(async () => {
|
|
17
23
|
const { programId } = localStore;
|
|
24
|
+
const { claimChannelCode } = sessionStore;
|
|
18
25
|
if (programId) {
|
|
19
|
-
const fetchedPaymentSystems =
|
|
26
|
+
const fetchedPaymentSystems = claimChannelCode
|
|
27
|
+
? DEFAULT_BIBLIOLOBUS_PAYMENT_SYSTEMS
|
|
28
|
+
: await getPaymentSystems(programId);
|
|
20
29
|
setPaymentSystemOptions(fetchedPaymentSystems ?? []);
|
|
21
30
|
}
|
|
22
31
|
}, []);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
|
|
4
|
+
import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
4
5
|
import { type ProductType } from '../../../components/ApplicationLeadForm/ApplicationLeadFormContent';
|
|
5
6
|
import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
|
|
6
7
|
import { type Option } from '../../../ui-kit/Select/Option';
|
|
@@ -9,11 +10,23 @@ import { getRegionsCardDelivery } from '../../api/getRegionsCardDelivery';
|
|
|
9
10
|
import { useLeadFormData } from '../../hooks/useLeadFormData';
|
|
10
11
|
import { useRetailFormStore } from '../../hooks/useRetailFormStore';
|
|
11
12
|
|
|
13
|
+
const DEFAULT_BIBLIOLOBUS_VALUES = {
|
|
14
|
+
region: {
|
|
15
|
+
key: 'REGION_77',
|
|
16
|
+
text: 'Москва и Московская область',
|
|
17
|
+
},
|
|
18
|
+
office: {
|
|
19
|
+
key: '3041100',
|
|
20
|
+
text: 'Аэропорт Шереметьево, МО, г.Химки, Шереметьевское шоссе, вл39с1',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
12
24
|
export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
13
25
|
const { programId, productType } = useRetailFormStore();
|
|
14
26
|
const { data: regions } = useLeadFormData('REGION_RF');
|
|
15
27
|
const { data: regionsDelivery } = useAsyncData('regionsDelivery', getRegionsCardDelivery);
|
|
16
28
|
const { data: productSettings } = useLeadFormData(getCurrentProductSettings(productType));
|
|
29
|
+
const sessionStore = useSessionStore<{ claimChannelCode?: string }>();
|
|
17
30
|
const isDebit = productType === 'debitCard';
|
|
18
31
|
const isSalaryCard = programId === '38';
|
|
19
32
|
const isEsiaAuth = Boolean(field('esiaAccountTypeCd')?.value?.key);
|
|
@@ -21,25 +34,44 @@ export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
21
34
|
const isDeliveryActive =
|
|
22
35
|
productSettings?.find((_) => _?.key === 'DELIVERY_ACTIVE')?.value === 'true';
|
|
23
36
|
const handleChangeRegion = field('regionRetail')?.onChange;
|
|
37
|
+
const handleChangeOffice = field('addressRetail')?.onChange;
|
|
24
38
|
const handleChangeRegionHasDelivery = field('regionHasDelivery')?.onChange;
|
|
25
39
|
const handleChangeMethodObtain = field('methodObtain')?.onChange;
|
|
26
40
|
|
|
41
|
+
const checkRegionDeliveryStatus = useCallback(
|
|
42
|
+
(value: Option) => {
|
|
43
|
+
const isDebitDeliveryActive = isDebit ? isEsiaAuth && !isSalaryCard : true;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
isDebitDeliveryActive &&
|
|
47
|
+
isDeliveryActive &&
|
|
48
|
+
regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
[isDeliveryActive, regionsDelivery],
|
|
52
|
+
);
|
|
53
|
+
|
|
27
54
|
const onChange = useCallback(
|
|
28
55
|
(value: Option) => {
|
|
29
|
-
const regionHasDelivery =
|
|
30
|
-
? isEsiaAuth &&
|
|
31
|
-
!isSalaryCard &&
|
|
32
|
-
isDeliveryActive &&
|
|
33
|
-
regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg
|
|
34
|
-
: isDeliveryActive && regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg;
|
|
56
|
+
const regionHasDelivery = checkRegionDeliveryStatus(value);
|
|
35
57
|
|
|
36
58
|
handleChangeRegionHasDelivery?.(regionHasDelivery);
|
|
37
59
|
handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
|
|
38
60
|
handleChangeRegion?.(value);
|
|
61
|
+
handleChangeOffice?.('');
|
|
39
62
|
},
|
|
40
63
|
[regionsDelivery, isDeliveryActive, isEsiaAuth],
|
|
41
64
|
);
|
|
42
65
|
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (sessionStore.claimChannelCode) {
|
|
68
|
+
handleChangeRegion?.(DEFAULT_BIBLIOLOBUS_VALUES.region);
|
|
69
|
+
handleChangeOffice?.(DEFAULT_BIBLIOLOBUS_VALUES.office);
|
|
70
|
+
handleChangeRegionHasDelivery?.(checkRegionDeliveryStatus(DEFAULT_BIBLIOLOBUS_VALUES.region));
|
|
71
|
+
handleChangeMethodObtain?.('office');
|
|
72
|
+
}
|
|
73
|
+
}, [checkRegionDeliveryStatus]);
|
|
74
|
+
|
|
43
75
|
useEffect(() => {
|
|
44
76
|
if (!isEsiaAuth && isDebit) {
|
|
45
77
|
handleChangeRegionHasDelivery?.(false);
|