@redneckz/wildless-cms-uni-blocks 0.14.972 → 0.14.973
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 +133 -15
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
- package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/bundle/retail/api/createUserTaskDebit.d.ts +1 -0
- package/bundle/retail/api/getClaimChannel.d.ts +8 -0
- package/bundle/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
- package/bundle/retail/utils/filterPaymentSystems.d.ts +4 -0
- package/bundle/retail/utils/hasDelivery.d.ts +10 -0
- package/bundle/utils/getSlugFromUrl.d.ts +1 -0
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +24 -4
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +4 -0
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.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 +9 -0
- package/dist/retail/api/getClaimChannel.js.map +1 -0
- package/dist/retail/components/Fields/AddressRetailField.js +20 -0
- package/dist/retail/components/Fields/AddressRetailField.js.map +1 -1
- package/dist/retail/components/Fields/PaymentSystemField.js +14 -2
- package/dist/retail/components/Fields/PaymentSystemField.js.map +1 -1
- package/dist/retail/components/Fields/RegionRetailField.js +20 -7
- package/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/dist/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
- package/dist/retail/hooks/useBiblioglobusDefaultRegion.js +34 -0
- package/dist/retail/hooks/useBiblioglobusDefaultRegion.js.map +1 -0
- package/dist/retail/utils/filterPaymentSystems.d.ts +4 -0
- package/dist/retail/utils/filterPaymentSystems.js +13 -0
- package/dist/retail/utils/filterPaymentSystems.js.map +1 -0
- package/dist/retail/utils/hasDelivery.d.ts +10 -0
- package/dist/retail/utils/hasDelivery.js +13 -0
- package/dist/retail/utils/hasDelivery.js.map +1 -0
- package/dist/utils/getSlugFromUrl.d.ts +1 -0
- package/dist/utils/getSlugFromUrl.js +12 -0
- package/dist/utils/getSlugFromUrl.js.map +1 -0
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +24 -4
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +4 -0
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.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 +6 -0
- package/lib/retail/api/getClaimChannel.js.map +1 -0
- package/lib/retail/components/Fields/AddressRetailField.js +20 -0
- package/lib/retail/components/Fields/AddressRetailField.js.map +1 -1
- package/lib/retail/components/Fields/PaymentSystemField.js +14 -2
- package/lib/retail/components/Fields/PaymentSystemField.js.map +1 -1
- package/lib/retail/components/Fields/RegionRetailField.js +20 -7
- package/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/lib/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
- package/lib/retail/hooks/useBiblioglobusDefaultRegion.js +31 -0
- package/lib/retail/hooks/useBiblioglobusDefaultRegion.js.map +1 -0
- package/lib/retail/utils/filterPaymentSystems.d.ts +4 -0
- package/lib/retail/utils/filterPaymentSystems.js +10 -0
- package/lib/retail/utils/filterPaymentSystems.js.map +1 -0
- package/lib/retail/utils/hasDelivery.d.ts +10 -0
- package/lib/retail/utils/hasDelivery.js +9 -0
- package/lib/retail/utils/hasDelivery.js.map +1 -0
- package/lib/utils/getSlugFromUrl.d.ts +1 -0
- package/lib/utils/getSlugFromUrl.js +9 -0
- package/lib/utils/getSlugFromUrl.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +133 -15
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
- package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/mobile/bundle/retail/api/createUserTaskDebit.d.ts +1 -0
- package/mobile/bundle/retail/api/getClaimChannel.d.ts +8 -0
- package/mobile/bundle/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
- package/mobile/bundle/retail/utils/filterPaymentSystems.d.ts +4 -0
- package/mobile/bundle/retail/utils/hasDelivery.d.ts +10 -0
- package/mobile/bundle/utils/getSlugFromUrl.d.ts +1 -0
- package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
- 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 +24 -4
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +4 -0
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.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 +9 -0
- package/mobile/dist/retail/api/getClaimChannel.js.map +1 -0
- package/mobile/dist/retail/components/Fields/AddressRetailField.js +20 -0
- package/mobile/dist/retail/components/Fields/AddressRetailField.js.map +1 -1
- package/mobile/dist/retail/components/Fields/PaymentSystemField.js +14 -2
- package/mobile/dist/retail/components/Fields/PaymentSystemField.js.map +1 -1
- package/mobile/dist/retail/components/Fields/RegionRetailField.js +20 -7
- package/mobile/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/mobile/dist/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
- package/mobile/dist/retail/hooks/useBiblioglobusDefaultRegion.js +34 -0
- package/mobile/dist/retail/hooks/useBiblioglobusDefaultRegion.js.map +1 -0
- package/mobile/dist/retail/utils/filterPaymentSystems.d.ts +4 -0
- package/mobile/dist/retail/utils/filterPaymentSystems.js +13 -0
- package/mobile/dist/retail/utils/filterPaymentSystems.js.map +1 -0
- package/mobile/dist/retail/utils/hasDelivery.d.ts +10 -0
- package/mobile/dist/retail/utils/hasDelivery.js +13 -0
- package/mobile/dist/retail/utils/hasDelivery.js.map +1 -0
- package/mobile/dist/utils/getSlugFromUrl.d.ts +1 -0
- package/mobile/dist/utils/getSlugFromUrl.js +12 -0
- package/mobile/dist/utils/getSlugFromUrl.js.map +1 -0
- package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
- 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 +24 -4
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +4 -0
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.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 +6 -0
- package/mobile/lib/retail/api/getClaimChannel.js.map +1 -0
- package/mobile/lib/retail/components/Fields/AddressRetailField.js +20 -0
- package/mobile/lib/retail/components/Fields/AddressRetailField.js.map +1 -1
- package/mobile/lib/retail/components/Fields/PaymentSystemField.js +14 -2
- package/mobile/lib/retail/components/Fields/PaymentSystemField.js.map +1 -1
- package/mobile/lib/retail/components/Fields/RegionRetailField.js +20 -7
- package/mobile/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/mobile/lib/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
- package/mobile/lib/retail/hooks/useBiblioglobusDefaultRegion.js +31 -0
- package/mobile/lib/retail/hooks/useBiblioglobusDefaultRegion.js.map +1 -0
- package/mobile/lib/retail/utils/filterPaymentSystems.d.ts +4 -0
- package/mobile/lib/retail/utils/filterPaymentSystems.js +10 -0
- package/mobile/lib/retail/utils/filterPaymentSystems.js.map +1 -0
- package/mobile/lib/retail/utils/hasDelivery.d.ts +10 -0
- package/mobile/lib/retail/utils/hasDelivery.js +9 -0
- package/mobile/lib/retail/utils/hasDelivery.js.map +1 -0
- package/mobile/lib/utils/getSlugFromUrl.d.ts +1 -0
- package/mobile/lib/utils/getSlugFromUrl.js +9 -0
- package/mobile/lib/utils/getSlugFromUrl.js.map +1 -0
- package/mobile/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +14 -5
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +32 -3
- package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +6 -0
- package/mobile/src/retail/api/createUserTaskDebit.ts +1 -0
- package/mobile/src/retail/api/getClaimChannel.ts +18 -0
- package/mobile/src/retail/components/Fields/AddressRetailField.tsx +26 -0
- package/mobile/src/retail/components/Fields/PaymentSystemField.tsx +21 -2
- package/mobile/src/retail/components/Fields/RegionRetailField.tsx +22 -7
- package/mobile/src/retail/hooks/useBiblioglobusDefaultRegion.ts +56 -0
- package/mobile/src/retail/utils/filterPaymentSystems.ts +14 -0
- package/mobile/src/retail/utils/hasDelivery.ts +22 -0
- package/mobile/src/utils/getSlugFromUrl.ts +10 -0
- package/package.json +2 -2
- package/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +14 -5
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +32 -3
- package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +6 -0
- package/src/icons/IconName.ts +4 -4
- package/src/retail/api/createUserTaskDebit.ts +1 -0
- package/src/retail/api/getClaimChannel.ts +18 -0
- package/src/retail/components/Fields/AddressRetailField.tsx +26 -0
- package/src/retail/components/Fields/PaymentSystemField.tsx +21 -2
- package/src/retail/components/Fields/RegionRetailField.tsx +22 -7
- package/src/retail/hooks/useBiblioglobusDefaultRegion.ts +56 -0
- package/src/retail/utils/filterPaymentSystems.ts +14 -0
- package/src/retail/utils/hasDelivery.ts +22 -0
- package/src/utils/getSlugFromUrl.ts +10 -0
|
@@ -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';
|
|
@@ -18,9 +19,11 @@ import { useDraftDialog } from '../../retail/components/DraftDialog/useDraftDial
|
|
|
18
19
|
import { VerifyPhoneDialog } from '../../retail/components/VerifyPhoneDialog/VerifyPhoneDialog';
|
|
19
20
|
import { type FormRetailConsents, type LeadFormState } from '../../retail/model/LeadFormState';
|
|
20
21
|
import { type ReferalData } from '../../retail/model/ReferalData';
|
|
22
|
+
import { BIBLIOGLOBUS_SLUG } from '../../retail/utils/filterPaymentSystems';
|
|
21
23
|
import { getUpdateUserProfileData } from '../../retail/utils/getUpdateUserProfile';
|
|
22
24
|
import { useDialog } from '../../ui-kit/DialogManager/useDialog';
|
|
23
25
|
import { formatPhone } from '../../utils/formatPhone';
|
|
26
|
+
import { getCardSlugFromUrl } from '../../utils/getSlugFromUrl';
|
|
24
27
|
import { type ProductType } from './ApplicationLeadFormContent';
|
|
25
28
|
import { productTypeToConsentsMap } from './consents';
|
|
26
29
|
import { getCreditLeadFormTaskData, getDebitLeadFormTaskData } from './getLeadFormTaskData';
|
|
@@ -76,6 +79,7 @@ export const useApplicationLeadApi = ({
|
|
|
76
79
|
|
|
77
80
|
const referalData = leadFormStore.referalData;
|
|
78
81
|
const marketingInfo = sessionStore.marketingInfo;
|
|
82
|
+
const referrerUrl = sessionStore.referrerUrl;
|
|
79
83
|
|
|
80
84
|
if (!profileId) {
|
|
81
85
|
throw new Error();
|
|
@@ -91,6 +95,7 @@ export const useApplicationLeadApi = ({
|
|
|
91
95
|
marketingInfo,
|
|
92
96
|
saveUserData,
|
|
93
97
|
sendAspects,
|
|
98
|
+
referrerUrl,
|
|
94
99
|
});
|
|
95
100
|
verifyPhoneDialog.close();
|
|
96
101
|
if (productType === 'debitCard') {
|
|
@@ -214,6 +219,18 @@ const getAcceptedConsents = (formData: LeadFormState, productType: ProductType):
|
|
|
214
219
|
.map((_) => consents[_]?.text);
|
|
215
220
|
};
|
|
216
221
|
|
|
222
|
+
// Padding line to fix eslint padding-line-between-statements
|
|
223
|
+
|
|
224
|
+
const computeClaimChannel = async (slug: string | null): Promise<string | undefined> => {
|
|
225
|
+
if (slug !== BIBLIOGLOBUS_SLUG) {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const claimData = await getClaimChannel();
|
|
230
|
+
|
|
231
|
+
return claimData.find((item) => item.key === slug)?.code;
|
|
232
|
+
};
|
|
233
|
+
|
|
217
234
|
const updateUserData = async ({
|
|
218
235
|
programId,
|
|
219
236
|
profileId,
|
|
@@ -223,6 +240,7 @@ const updateUserData = async ({
|
|
|
223
240
|
marketingInfo,
|
|
224
241
|
saveUserData,
|
|
225
242
|
sendAspects,
|
|
243
|
+
referrerUrl,
|
|
226
244
|
}: {
|
|
227
245
|
programId: string;
|
|
228
246
|
profileId: number;
|
|
@@ -232,17 +250,27 @@ const updateUserData = async ({
|
|
|
232
250
|
marketingInfo: MarketingInfo | null;
|
|
233
251
|
saveUserData: (userData: UserData) => void;
|
|
234
252
|
sendAspects: (profileId: number, taskId: number) => void;
|
|
253
|
+
referrerUrl: string | null;
|
|
235
254
|
}) => {
|
|
236
|
-
let taskId: number;
|
|
237
|
-
let participantId: number;
|
|
238
255
|
const transformedConsents = transformConsentsFields(formData, productType);
|
|
256
|
+
const slug = getCardSlugFromUrl(referrerUrl as string);
|
|
239
257
|
|
|
240
258
|
await updateUserProfile(getUpdateUserProfileData(profileId, formData, transformedConsents));
|
|
241
259
|
|
|
242
260
|
try {
|
|
261
|
+
let taskId: number;
|
|
262
|
+
let participantId: number;
|
|
263
|
+
|
|
243
264
|
if (productType === 'debitCard') {
|
|
265
|
+
const claimChannelCode = await computeClaimChannel(slug);
|
|
266
|
+
|
|
244
267
|
const debitData = await createUserTaskDebit(
|
|
245
|
-
getDebitLeadFormTaskData(
|
|
268
|
+
getDebitLeadFormTaskData({
|
|
269
|
+
formData,
|
|
270
|
+
programId,
|
|
271
|
+
marketingInfo,
|
|
272
|
+
claimChannelCode,
|
|
273
|
+
}),
|
|
246
274
|
);
|
|
247
275
|
|
|
248
276
|
taskId = debitData.taskId;
|
|
@@ -265,6 +293,7 @@ const updateUserData = async ({
|
|
|
265
293
|
}),
|
|
266
294
|
);
|
|
267
295
|
}
|
|
296
|
+
|
|
268
297
|
if (referalData?.referalCode) {
|
|
269
298
|
await saveReferalInfo({
|
|
270
299
|
taskId,
|
|
@@ -25,6 +25,7 @@ type InitApplicationLeadProps = {
|
|
|
25
25
|
export interface ApplicationLeadStore {
|
|
26
26
|
marketingInfo: MarketingInfo | null;
|
|
27
27
|
isNewMicroservice: boolean | null;
|
|
28
|
+
referrerUrl: string | null;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export const useInitApplicationLead = ({
|
|
@@ -78,6 +79,11 @@ export const useInitApplicationLead = ({
|
|
|
78
79
|
|
|
79
80
|
sessionStore.marketingInfo = getMarketingInfo(queryFromStorage, sessionStore);
|
|
80
81
|
sessionStore.isNewMicroservice = isNewMicroservice || null;
|
|
82
|
+
|
|
83
|
+
const referrer = globalThis.document.referrer;
|
|
84
|
+
if (referrer) {
|
|
85
|
+
sessionStore.referrerUrl = referrer as string;
|
|
86
|
+
}
|
|
81
87
|
}, [queryFromStorage]);
|
|
82
88
|
|
|
83
89
|
useEffect(() => {
|
|
@@ -0,0 +1,18 @@
|
|
|
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<GetClaimChannelResponse[]> => {
|
|
12
|
+
const res = await fetchRetailJSON<GetClaimChannelResponse[]>(
|
|
13
|
+
'light-api-cash/v1/claimChannel/',
|
|
14
|
+
'GET',
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return res || ([] as GetClaimChannelResponse[]);
|
|
18
|
+
};
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
3
4
|
import { getOfficePoint } from '../../../components/OfficesAtmsMap/renderOfficeCard';
|
|
4
5
|
import { useOfficesAtmsMapData } from '../../../components/OfficesAtmsMap/useOfficesAtmsMapData';
|
|
5
6
|
import { ClientOnly } from '../../../ui-kit/ClientOnly';
|
|
6
7
|
import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
|
|
7
8
|
import { SelectControl } from '../../../ui-kit/Select/SelectControl';
|
|
8
9
|
import { YandexMap } from '../../../ui-kit/YandexMap/YandexMap';
|
|
10
|
+
import { getCardSlugFromUrl } from '../../../utils/getSlugFromUrl';
|
|
9
11
|
import { fetchRegionOffices, type OfficeType } from '../../api/regionOffices';
|
|
10
12
|
import { useLeadFormData } from '../../hooks/useLeadFormData';
|
|
13
|
+
import { BIBLIOGLOBUS_SLUG } from '../../utils/filterPaymentSystems';
|
|
14
|
+
|
|
15
|
+
const BIBLIOGLOBUS_OFFICE_ID = '714680716';
|
|
11
16
|
|
|
12
17
|
export const AddressRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
13
18
|
const [offices, setOffices] = useState<OfficeType[]>([]);
|
|
14
19
|
const { data } = useLeadFormData('REGION_RF');
|
|
15
20
|
|
|
21
|
+
const sessionStore = useSessionStore<{ referrerUrl?: string }>();
|
|
22
|
+
const referrerUrl = sessionStore.referrerUrl;
|
|
23
|
+
|
|
16
24
|
const regionValue = field('regionRetail')?.value || {};
|
|
17
25
|
const addressField = field(input?.name ?? '');
|
|
18
26
|
|
|
@@ -27,6 +35,24 @@ export const AddressRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
27
35
|
}
|
|
28
36
|
}, [regionValue.key]);
|
|
29
37
|
|
|
38
|
+
// Логика для biblioglobus - выбор отделения по умолчанию
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!referrerUrl || !offices.length) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const slug = getCardSlugFromUrl(referrerUrl);
|
|
45
|
+
if (slug === BIBLIOGLOBUS_SLUG) {
|
|
46
|
+
const defaultOffice = offices.find(
|
|
47
|
+
(office) => office.id?.toString() === BIBLIOGLOBUS_OFFICE_ID,
|
|
48
|
+
);
|
|
49
|
+
addressField.onChange?.({
|
|
50
|
+
key: defaultOffice?.id?.toString() || '',
|
|
51
|
+
text: defaultOffice?.address || '',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, [referrerUrl, offices]);
|
|
55
|
+
|
|
30
56
|
const { points } = useOfficesAtmsMapData({
|
|
31
57
|
data: offices,
|
|
32
58
|
filtrationState: {},
|
|
@@ -1,11 +1,14 @@
|
|
|
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';
|
|
7
8
|
import { type Option } from '../../../ui-kit/Select/Option';
|
|
9
|
+
import { getCardSlugFromUrl } from '../../../utils/getSlugFromUrl';
|
|
8
10
|
import { getPaymentSystems } from '../../api/getPaymentSystems';
|
|
11
|
+
import { filterPaymentSystems } from '../../utils/filterPaymentSystems';
|
|
9
12
|
|
|
10
13
|
const optionKey = (option: { key?: string } | undefined) => option?.key;
|
|
11
14
|
|
|
@@ -13,12 +16,28 @@ export const PaymentSystemField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
13
16
|
const [paymentSystemOptions, setPaymentSystemOptions] = useState<Option[]>([]);
|
|
14
17
|
|
|
15
18
|
const localStore = useLocalStore<{ programId: string }>();
|
|
19
|
+
const sessionStore = useSessionStore<{ referrerUrl?: string }>();
|
|
20
|
+
|
|
16
21
|
useAsyncEffect(async () => {
|
|
17
22
|
const { programId } = localStore;
|
|
18
|
-
if (programId) {
|
|
19
|
-
|
|
23
|
+
if (!programId) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const fetchedPaymentSystems = await getPaymentSystems(programId);
|
|
28
|
+
|
|
29
|
+
const referrerUrl = sessionStore.referrerUrl;
|
|
30
|
+
|
|
31
|
+
if (!referrerUrl) {
|
|
20
32
|
setPaymentSystemOptions(fetchedPaymentSystems ?? []);
|
|
33
|
+
|
|
34
|
+
return;
|
|
21
35
|
}
|
|
36
|
+
|
|
37
|
+
const slug = getCardSlugFromUrl(referrerUrl);
|
|
38
|
+
const filteredSystems = filterPaymentSystems(fetchedPaymentSystems ?? [], slug);
|
|
39
|
+
|
|
40
|
+
setPaymentSystemOptions(filteredSystems);
|
|
22
41
|
}, []);
|
|
23
42
|
|
|
24
43
|
const items = useMemo(
|
|
@@ -1,19 +1,24 @@
|
|
|
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';
|
|
7
8
|
import { SelectControl } from '../../../ui-kit/Select/SelectControl';
|
|
8
9
|
import { getRegionsCardDelivery } from '../../api/getRegionsCardDelivery';
|
|
10
|
+
import { useBiblioglobusDefaultRegion } from '../../hooks/useBiblioglobusDefaultRegion';
|
|
9
11
|
import { useLeadFormData } from '../../hooks/useLeadFormData';
|
|
10
12
|
import { useRetailFormStore } from '../../hooks/useRetailFormStore';
|
|
13
|
+
import { calculateRegionHasDelivery, getRegionDeliveryStatus } from '../../utils/hasDelivery';
|
|
11
14
|
|
|
12
15
|
export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
13
16
|
const { programId, productType } = useRetailFormStore();
|
|
14
17
|
const { data: regions } = useLeadFormData('REGION_RF');
|
|
15
18
|
const { data: regionsDelivery } = useAsyncData('regionsDelivery', getRegionsCardDelivery);
|
|
16
19
|
const { data: productSettings } = useLeadFormData(getCurrentProductSettings(productType));
|
|
20
|
+
const sessionStore = useSessionStore<{ referrerUrl?: string }>();
|
|
21
|
+
|
|
17
22
|
const isDebit = productType === 'debitCard';
|
|
18
23
|
const isSalaryCard = programId === '38';
|
|
19
24
|
const isEsiaAuth = Boolean(field('esiaAccountTypeCd')?.value?.key);
|
|
@@ -24,20 +29,30 @@ export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
24
29
|
const handleChangeRegionHasDelivery = field('regionHasDelivery')?.onChange;
|
|
25
30
|
const handleChangeMethodObtain = field('methodObtain')?.onChange;
|
|
26
31
|
|
|
32
|
+
useBiblioglobusDefaultRegion({
|
|
33
|
+
referrerUrl: sessionStore.referrerUrl ?? undefined,
|
|
34
|
+
regions,
|
|
35
|
+
regionsDelivery,
|
|
36
|
+
onRegionChange: handleChangeRegion,
|
|
37
|
+
onRegionHasDeliveryChange: handleChangeRegionHasDelivery,
|
|
38
|
+
onMethodObtainChange: handleChangeMethodObtain,
|
|
39
|
+
});
|
|
40
|
+
|
|
27
41
|
const onChange = useCallback(
|
|
28
42
|
(value: Option) => {
|
|
29
|
-
const regionHasDelivery =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
:
|
|
43
|
+
const regionHasDelivery = calculateRegionHasDelivery({
|
|
44
|
+
isDebit,
|
|
45
|
+
isEsiaAuth,
|
|
46
|
+
isSalaryCard,
|
|
47
|
+
isDeliveryActive,
|
|
48
|
+
regionDelivery: getRegionDeliveryStatus(regionsDelivery, value),
|
|
49
|
+
});
|
|
35
50
|
|
|
36
51
|
handleChangeRegionHasDelivery?.(regionHasDelivery);
|
|
37
52
|
handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
|
|
38
53
|
handleChangeRegion?.(value);
|
|
39
54
|
},
|
|
40
|
-
[
|
|
55
|
+
[calculateRegionHasDelivery],
|
|
41
56
|
);
|
|
42
57
|
|
|
43
58
|
useEffect(() => {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { type Option } from '../../ui-kit/Select/Option';
|
|
3
|
+
import { getCardSlugFromUrl } from '../../utils/getSlugFromUrl';
|
|
4
|
+
import { type DictionaryItem } from '../model/LeadFormData';
|
|
5
|
+
import { BIBLIOGLOBUS_SLUG } from '../utils/filterPaymentSystems';
|
|
6
|
+
|
|
7
|
+
export type RegionDelivery = { regionCode: string; deliveryFlg: boolean };
|
|
8
|
+
|
|
9
|
+
export const useBiblioglobusDefaultRegion = (args: {
|
|
10
|
+
referrerUrl?: string;
|
|
11
|
+
regions?: DictionaryItem[];
|
|
12
|
+
regionsDelivery?: RegionDelivery[];
|
|
13
|
+
onRegionChange?: (option: Option) => void;
|
|
14
|
+
onRegionHasDeliveryChange?: (value: boolean) => void;
|
|
15
|
+
onMethodObtainChange?: (value: string) => void;
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
referrerUrl,
|
|
19
|
+
regions,
|
|
20
|
+
regionsDelivery,
|
|
21
|
+
onRegionChange,
|
|
22
|
+
onRegionHasDeliveryChange,
|
|
23
|
+
onMethodObtainChange,
|
|
24
|
+
} = args;
|
|
25
|
+
|
|
26
|
+
const slug = referrerUrl ? getCardSlugFromUrl(referrerUrl) : '';
|
|
27
|
+
const defaultRegion = regions?.find((region) => region.key === 'REGION_77');
|
|
28
|
+
const regionHasDelivery = Boolean(
|
|
29
|
+
regionsDelivery?.find((rd) => rd.regionCode === 'REGION_77')?.deliveryFlg,
|
|
30
|
+
);
|
|
31
|
+
const isReady = Boolean(
|
|
32
|
+
referrerUrl &&
|
|
33
|
+
regions &&
|
|
34
|
+
regionsDelivery &&
|
|
35
|
+
slug === BIBLIOGLOBUS_SLUG &&
|
|
36
|
+
defaultRegion?.key &&
|
|
37
|
+
defaultRegion?.value,
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!isReady || !defaultRegion || !defaultRegion.key || !defaultRegion.value) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
onRegionChange?.({ key: defaultRegion.key, text: defaultRegion.value });
|
|
46
|
+
onRegionHasDeliveryChange?.(regionHasDelivery);
|
|
47
|
+
onMethodObtainChange?.(regionHasDelivery ? 'courier' : 'office');
|
|
48
|
+
}, [
|
|
49
|
+
isReady,
|
|
50
|
+
defaultRegion,
|
|
51
|
+
regionHasDelivery,
|
|
52
|
+
onRegionChange,
|
|
53
|
+
onRegionHasDeliveryChange,
|
|
54
|
+
onMethodObtainChange,
|
|
55
|
+
]);
|
|
56
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Option } from '../../ui-kit/Select/Option';
|
|
2
|
+
|
|
3
|
+
const BIBLIOGLOBUS_SLUG = 'biblioglobus';
|
|
4
|
+
const UNIONPAY_TEXT = 'UnionPay';
|
|
5
|
+
|
|
6
|
+
export const filterPaymentSystems = (systems: Option[], slug: string | null): Option[] => {
|
|
7
|
+
if (slug !== BIBLIOGLOBUS_SLUG) {
|
|
8
|
+
return systems;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return systems.filter((system) => system.text === UNIONPAY_TEXT);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { BIBLIOGLOBUS_SLUG };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Option } from '../../ui-kit/Select/Option';
|
|
2
|
+
import { type RegionDelivery } from '../hooks/useBiblioglobusDefaultRegion';
|
|
3
|
+
|
|
4
|
+
export const getRegionDeliveryStatus = (
|
|
5
|
+
regionsDelivery: RegionDelivery[] | undefined,
|
|
6
|
+
value: Option,
|
|
7
|
+
) => regionsDelivery?.find((_) => _.regionCode === String(value.key))?.deliveryFlg;
|
|
8
|
+
|
|
9
|
+
export const calculateRegionHasDelivery = (args: {
|
|
10
|
+
isDebit: boolean;
|
|
11
|
+
isEsiaAuth: boolean;
|
|
12
|
+
isSalaryCard: boolean;
|
|
13
|
+
isDeliveryActive: boolean;
|
|
14
|
+
regionDelivery?: boolean;
|
|
15
|
+
}) => {
|
|
16
|
+
const { isDebit, isEsiaAuth, isSalaryCard, isDeliveryActive, regionDelivery } = args;
|
|
17
|
+
if (isDebit) {
|
|
18
|
+
return isEsiaAuth && !isSalaryCard && isDeliveryActive && regionDelivery;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return isDeliveryActive && regionDelivery;
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function getCardSlugFromUrl(url: string): string | null {
|
|
2
|
+
const lastSegment = url.split('/').filter(Boolean).pop();
|
|
3
|
+
if (!lastSegment) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const parts = lastSegment.split('-');
|
|
8
|
+
|
|
9
|
+
return parts.length > 1 ? parts[parts.length - 1] : null;
|
|
10
|
+
}
|
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.973",
|
|
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
|
],
|
|
@@ -83,11 +83,19 @@ export const getParticipant = ({
|
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
formData: LeadFormState
|
|
88
|
-
programId: string
|
|
89
|
-
marketingInfo: MarketingInfo | null
|
|
90
|
-
|
|
86
|
+
type GetDebitLeadFormTaskDataProps = {
|
|
87
|
+
formData: LeadFormState;
|
|
88
|
+
programId: string;
|
|
89
|
+
marketingInfo: MarketingInfo | null;
|
|
90
|
+
claimChannelCode?: string;
|
|
91
|
+
};
|
|
92
|
+
|
|
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
|
|
|
@@ -111,6 +119,7 @@ export const getDebitLeadFormTaskData = (
|
|
|
111
119
|
],
|
|
112
120
|
marketingInfo,
|
|
113
121
|
},
|
|
122
|
+
...(claimChannelCode ? { claimChannelCode } : {}),
|
|
114
123
|
};
|
|
115
124
|
};
|
|
116
125
|
|
|
@@ -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';
|
|
@@ -18,9 +19,11 @@ import { useDraftDialog } from '../../retail/components/DraftDialog/useDraftDial
|
|
|
18
19
|
import { VerifyPhoneDialog } from '../../retail/components/VerifyPhoneDialog/VerifyPhoneDialog';
|
|
19
20
|
import { type FormRetailConsents, type LeadFormState } from '../../retail/model/LeadFormState';
|
|
20
21
|
import { type ReferalData } from '../../retail/model/ReferalData';
|
|
22
|
+
import { BIBLIOGLOBUS_SLUG } from '../../retail/utils/filterPaymentSystems';
|
|
21
23
|
import { getUpdateUserProfileData } from '../../retail/utils/getUpdateUserProfile';
|
|
22
24
|
import { useDialog } from '../../ui-kit/DialogManager/useDialog';
|
|
23
25
|
import { formatPhone } from '../../utils/formatPhone';
|
|
26
|
+
import { getCardSlugFromUrl } from '../../utils/getSlugFromUrl';
|
|
24
27
|
import { type ProductType } from './ApplicationLeadFormContent';
|
|
25
28
|
import { productTypeToConsentsMap } from './consents';
|
|
26
29
|
import { getCreditLeadFormTaskData, getDebitLeadFormTaskData } from './getLeadFormTaskData';
|
|
@@ -76,6 +79,7 @@ export const useApplicationLeadApi = ({
|
|
|
76
79
|
|
|
77
80
|
const referalData = leadFormStore.referalData;
|
|
78
81
|
const marketingInfo = sessionStore.marketingInfo;
|
|
82
|
+
const referrerUrl = sessionStore.referrerUrl;
|
|
79
83
|
|
|
80
84
|
if (!profileId) {
|
|
81
85
|
throw new Error();
|
|
@@ -91,6 +95,7 @@ export const useApplicationLeadApi = ({
|
|
|
91
95
|
marketingInfo,
|
|
92
96
|
saveUserData,
|
|
93
97
|
sendAspects,
|
|
98
|
+
referrerUrl,
|
|
94
99
|
});
|
|
95
100
|
verifyPhoneDialog.close();
|
|
96
101
|
if (productType === 'debitCard') {
|
|
@@ -214,6 +219,18 @@ const getAcceptedConsents = (formData: LeadFormState, productType: ProductType):
|
|
|
214
219
|
.map((_) => consents[_]?.text);
|
|
215
220
|
};
|
|
216
221
|
|
|
222
|
+
// Padding line to fix eslint padding-line-between-statements
|
|
223
|
+
|
|
224
|
+
const computeClaimChannel = async (slug: string | null): Promise<string | undefined> => {
|
|
225
|
+
if (slug !== BIBLIOGLOBUS_SLUG) {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const claimData = await getClaimChannel();
|
|
230
|
+
|
|
231
|
+
return claimData.find((item) => item.key === slug)?.code;
|
|
232
|
+
};
|
|
233
|
+
|
|
217
234
|
const updateUserData = async ({
|
|
218
235
|
programId,
|
|
219
236
|
profileId,
|
|
@@ -223,6 +240,7 @@ const updateUserData = async ({
|
|
|
223
240
|
marketingInfo,
|
|
224
241
|
saveUserData,
|
|
225
242
|
sendAspects,
|
|
243
|
+
referrerUrl,
|
|
226
244
|
}: {
|
|
227
245
|
programId: string;
|
|
228
246
|
profileId: number;
|
|
@@ -232,17 +250,27 @@ const updateUserData = async ({
|
|
|
232
250
|
marketingInfo: MarketingInfo | null;
|
|
233
251
|
saveUserData: (userData: UserData) => void;
|
|
234
252
|
sendAspects: (profileId: number, taskId: number) => void;
|
|
253
|
+
referrerUrl: string | null;
|
|
235
254
|
}) => {
|
|
236
|
-
let taskId: number;
|
|
237
|
-
let participantId: number;
|
|
238
255
|
const transformedConsents = transformConsentsFields(formData, productType);
|
|
256
|
+
const slug = getCardSlugFromUrl(referrerUrl as string);
|
|
239
257
|
|
|
240
258
|
await updateUserProfile(getUpdateUserProfileData(profileId, formData, transformedConsents));
|
|
241
259
|
|
|
242
260
|
try {
|
|
261
|
+
let taskId: number;
|
|
262
|
+
let participantId: number;
|
|
263
|
+
|
|
243
264
|
if (productType === 'debitCard') {
|
|
265
|
+
const claimChannelCode = await computeClaimChannel(slug);
|
|
266
|
+
|
|
244
267
|
const debitData = await createUserTaskDebit(
|
|
245
|
-
getDebitLeadFormTaskData(
|
|
268
|
+
getDebitLeadFormTaskData({
|
|
269
|
+
formData,
|
|
270
|
+
programId,
|
|
271
|
+
marketingInfo,
|
|
272
|
+
claimChannelCode,
|
|
273
|
+
}),
|
|
246
274
|
);
|
|
247
275
|
|
|
248
276
|
taskId = debitData.taskId;
|
|
@@ -265,6 +293,7 @@ const updateUserData = async ({
|
|
|
265
293
|
}),
|
|
266
294
|
);
|
|
267
295
|
}
|
|
296
|
+
|
|
268
297
|
if (referalData?.referalCode) {
|
|
269
298
|
await saveReferalInfo({
|
|
270
299
|
taskId,
|
|
@@ -25,6 +25,7 @@ type InitApplicationLeadProps = {
|
|
|
25
25
|
export interface ApplicationLeadStore {
|
|
26
26
|
marketingInfo: MarketingInfo | null;
|
|
27
27
|
isNewMicroservice: boolean | null;
|
|
28
|
+
referrerUrl: string | null;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export const useInitApplicationLead = ({
|
|
@@ -78,6 +79,11 @@ export const useInitApplicationLead = ({
|
|
|
78
79
|
|
|
79
80
|
sessionStore.marketingInfo = getMarketingInfo(queryFromStorage, sessionStore);
|
|
80
81
|
sessionStore.isNewMicroservice = isNewMicroservice || null;
|
|
82
|
+
|
|
83
|
+
const referrer = globalThis.document.referrer;
|
|
84
|
+
if (referrer) {
|
|
85
|
+
sessionStore.referrerUrl = referrer as string;
|
|
86
|
+
}
|
|
81
87
|
}, [queryFromStorage]);
|
|
82
88
|
|
|
83
89
|
useEffect(() => {
|