@redneckz/wildless-cms-uni-blocks 0.14.972 → 0.14.974
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/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +157 -25
- 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/components/GalleryLayout/utils.d.ts +2 -2
- package/bundle/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/bundle/model/HeadlineType.d.ts +14 -1
- 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/components/GalleryLayout/utils.d.ts +2 -2
- package/dist/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/dist/components/ProductBlock/ProductBlock.js +16 -1
- package/dist/components/ProductBlock/ProductBlock.js.map +1 -1
- package/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/dist/model/HeadlineType.d.ts +14 -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/components/GalleryLayout/utils.d.ts +2 -2
- package/lib/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/lib/components/ProductBlock/ProductBlock.fixture.d.ts +1 -0
- package/lib/components/ProductBlock/ProductBlock.js +16 -1
- package/lib/components/ProductBlock/ProductBlock.js.map +1 -1
- package/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/lib/model/HeadlineType.d.ts +14 -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 +157 -25
- 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/components/GalleryLayout/utils.d.ts +2 -2
- package/mobile/bundle/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/mobile/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/mobile/bundle/model/HeadlineType.d.ts +14 -1
- 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/components/GalleryLayout/utils.d.ts +2 -2
- package/mobile/dist/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/mobile/dist/components/ProductBlock/ProductBlock.js +16 -1
- package/mobile/dist/components/ProductBlock/ProductBlock.js.map +1 -1
- package/mobile/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/mobile/dist/model/HeadlineType.d.ts +14 -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/components/GalleryLayout/utils.d.ts +2 -2
- package/mobile/lib/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/mobile/lib/components/ProductBlock/ProductBlock.js +16 -1
- package/mobile/lib/components/ProductBlock/ProductBlock.js.map +1 -1
- package/mobile/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/mobile/lib/model/HeadlineType.d.ts +14 -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/components/ProductBlock/ProductBlock.tsx +57 -14
- package/mobile/src/components/ProductBlock/ProductBlockContent.ts +6 -2
- package/mobile/src/model/HeadlineType.ts +20 -1
- 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/components/ProductBlock/ProductBlock.fixture.tsx +22 -0
- package/src/components/ProductBlock/ProductBlock.tsx +57 -14
- package/src/components/ProductBlock/ProductBlockContent.ts +6 -2
- package/src/model/HeadlineType.ts +20 -1
- 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
package/bundle/bundle.umd.js
CHANGED
|
@@ -977,7 +977,30 @@
|
|
|
977
977
|
return OutputComponent;
|
|
978
978
|
}
|
|
979
979
|
|
|
980
|
-
const
|
|
980
|
+
const QUERY_STORAGE_KEY = 'rshb-query-params';
|
|
981
|
+
function saveSessionQuery() {
|
|
982
|
+
const result = globalThis.location?.search || globalThis.sessionStorage?.getItem(QUERY_STORAGE_KEY) || '';
|
|
983
|
+
if (result) {
|
|
984
|
+
globalThis.sessionStorage?.setItem(QUERY_STORAGE_KEY, result);
|
|
985
|
+
}
|
|
986
|
+
return result;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
const ProductBlock = UniBlock(({ className, padding, defaultPadding, dynamicUtmDescription, dynamicDescriptionSource, description, ...rest }) => {
|
|
990
|
+
const formatDescription = getFormatDescription(dynamicUtmDescription, dynamicDescriptionSource?.list, description);
|
|
991
|
+
return (jsx(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', className), padding: "p-0", ...rest, children: jsx(BaseProductTile, { defaultPadding: defaultPadding || 'p-6xl', padding: padding, description: formatDescription, className: "grow h-full", ...rest }) }));
|
|
992
|
+
});
|
|
993
|
+
const getFormatDescription = (dynamicUtmDescription = {}, valuesList = [], description = '') => {
|
|
994
|
+
const { utm, value } = dynamicUtmDescription;
|
|
995
|
+
const sessionQuery = saveSessionQuery();
|
|
996
|
+
const utmValue = getUtmValue(utm ?? 'utm_source', sessionQuery);
|
|
997
|
+
const dynamicValue = valuesList.find((item) => item?.id === utmValue)?.value;
|
|
998
|
+
return dynamicValue ? description.replace(String(value), dynamicValue) : description;
|
|
999
|
+
};
|
|
1000
|
+
const getUtmValue = (utm, queryString) => {
|
|
1001
|
+
const params = new URLSearchParams(queryString);
|
|
1002
|
+
return params.get(utm);
|
|
1003
|
+
};
|
|
981
1004
|
|
|
982
1005
|
const AdTile = JSX((props) => {
|
|
983
1006
|
const { items } = (props.options?.page?.adSourceBook ?? {});
|
|
@@ -1005,15 +1028,6 @@
|
|
|
1005
1028
|
locationNavigator._impl = impl;
|
|
1006
1029
|
};
|
|
1007
1030
|
|
|
1008
|
-
const QUERY_STORAGE_KEY = 'rshb-query-params';
|
|
1009
|
-
function saveSessionQuery() {
|
|
1010
|
-
const result = globalThis.location?.search || globalThis.sessionStorage?.getItem(QUERY_STORAGE_KEY) || '';
|
|
1011
|
-
if (result) {
|
|
1012
|
-
globalThis.sessionStorage?.setItem(QUERY_STORAGE_KEY, result);
|
|
1013
|
-
}
|
|
1014
|
-
return result;
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
1031
|
const adjustSessionQuery = (href) => {
|
|
1018
1032
|
const sessionQuery = saveSessionQuery();
|
|
1019
1033
|
if (!isURL(href) || !sessionQuery) {
|
|
@@ -4542,6 +4556,15 @@
|
|
|
4542
4556
|
const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
|
|
4543
4557
|
const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
|
|
4544
4558
|
|
|
4559
|
+
function getCardSlugFromUrl(url) {
|
|
4560
|
+
const lastSegment = url.split('/').filter(Boolean).pop();
|
|
4561
|
+
if (!lastSegment) {
|
|
4562
|
+
return null;
|
|
4563
|
+
}
|
|
4564
|
+
const parts = lastSegment.split('-');
|
|
4565
|
+
return parts.length > 1 ? parts[parts.length - 1] : null;
|
|
4566
|
+
}
|
|
4567
|
+
|
|
4545
4568
|
const fetchRegionOffices = async (regionKey) => {
|
|
4546
4569
|
const response = await fetchRetailJSON('/public-data/regionOffices', 'POST', {
|
|
4547
4570
|
regionRfCd: {
|
|
@@ -4570,9 +4593,21 @@
|
|
|
4570
4593
|
return result || [];
|
|
4571
4594
|
};
|
|
4572
4595
|
|
|
4596
|
+
const BIBLIOGLOBUS_SLUG = 'biblioglobus';
|
|
4597
|
+
const UNIONPAY_TEXT = 'UnionPay';
|
|
4598
|
+
const filterPaymentSystems = (systems, slug) => {
|
|
4599
|
+
if (slug !== BIBLIOGLOBUS_SLUG) {
|
|
4600
|
+
return systems;
|
|
4601
|
+
}
|
|
4602
|
+
return systems.filter((system) => system.text === UNIONPAY_TEXT);
|
|
4603
|
+
};
|
|
4604
|
+
|
|
4605
|
+
const BIBLIOGLOBUS_OFFICE_ID = '714680716';
|
|
4573
4606
|
const AddressRetailField = JSX(({ field, input }) => {
|
|
4574
4607
|
const [offices, setOffices] = useState([]);
|
|
4575
4608
|
const { data } = useLeadFormData('REGION_RF');
|
|
4609
|
+
const sessionStore = useSessionStore();
|
|
4610
|
+
const referrerUrl = sessionStore.referrerUrl;
|
|
4576
4611
|
const regionValue = field('regionRetail')?.value || {};
|
|
4577
4612
|
const addressField = field(input?.name ?? '');
|
|
4578
4613
|
useEffect(() => {
|
|
@@ -4584,6 +4619,20 @@
|
|
|
4584
4619
|
addressField.onChange?.('');
|
|
4585
4620
|
}
|
|
4586
4621
|
}, [regionValue.key]);
|
|
4622
|
+
// Логика для biblioglobus - выбор отделения по умолчанию
|
|
4623
|
+
useEffect(() => {
|
|
4624
|
+
if (!referrerUrl || !offices.length) {
|
|
4625
|
+
return;
|
|
4626
|
+
}
|
|
4627
|
+
const slug = getCardSlugFromUrl(referrerUrl);
|
|
4628
|
+
if (slug === BIBLIOGLOBUS_SLUG) {
|
|
4629
|
+
const defaultOffice = offices.find((office) => office.id?.toString() === BIBLIOGLOBUS_OFFICE_ID);
|
|
4630
|
+
addressField.onChange?.({
|
|
4631
|
+
key: defaultOffice?.id?.toString() || '',
|
|
4632
|
+
text: defaultOffice?.address || '',
|
|
4633
|
+
});
|
|
4634
|
+
}
|
|
4635
|
+
}, [referrerUrl, offices]);
|
|
4587
4636
|
const { points } = useOfficesAtmsMapData({
|
|
4588
4637
|
data: offices,
|
|
4589
4638
|
filtrationState: {},
|
|
@@ -5692,12 +5741,21 @@
|
|
|
5692
5741
|
const PaymentSystemField = JSX(({ field, input }) => {
|
|
5693
5742
|
const [paymentSystemOptions, setPaymentSystemOptions] = useState([]);
|
|
5694
5743
|
const localStore = useLocalStore();
|
|
5744
|
+
const sessionStore = useSessionStore();
|
|
5695
5745
|
useAsyncEffect(async () => {
|
|
5696
5746
|
const { programId } = localStore;
|
|
5697
|
-
if (programId) {
|
|
5698
|
-
|
|
5747
|
+
if (!programId) {
|
|
5748
|
+
return;
|
|
5749
|
+
}
|
|
5750
|
+
const fetchedPaymentSystems = await getPaymentSystems(programId);
|
|
5751
|
+
const referrerUrl = sessionStore.referrerUrl;
|
|
5752
|
+
if (!referrerUrl) {
|
|
5699
5753
|
setPaymentSystemOptions(fetchedPaymentSystems ?? []);
|
|
5754
|
+
return;
|
|
5700
5755
|
}
|
|
5756
|
+
const slug = getCardSlugFromUrl(referrerUrl);
|
|
5757
|
+
const filteredSystems = filterPaymentSystems(fetchedPaymentSystems ?? [], slug);
|
|
5758
|
+
setPaymentSystemOptions(filteredSystems);
|
|
5701
5759
|
}, []);
|
|
5702
5760
|
const items = useMemo(() => paymentSystemOptions?.map((_) => ({ id: _.key, text: _.text })) ?? [], [paymentSystemOptions]);
|
|
5703
5761
|
return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: items, ...field(input?.name ?? '', {
|
|
@@ -5716,11 +5774,49 @@
|
|
|
5716
5774
|
return res || undefined;
|
|
5717
5775
|
};
|
|
5718
5776
|
|
|
5777
|
+
const useBiblioglobusDefaultRegion = (args) => {
|
|
5778
|
+
const { referrerUrl, regions, regionsDelivery, onRegionChange, onRegionHasDeliveryChange, onMethodObtainChange, } = args;
|
|
5779
|
+
const slug = referrerUrl ? getCardSlugFromUrl(referrerUrl) : '';
|
|
5780
|
+
const defaultRegion = regions?.find((region) => region.key === 'REGION_77');
|
|
5781
|
+
const regionHasDelivery = Boolean(regionsDelivery?.find((rd) => rd.regionCode === 'REGION_77')?.deliveryFlg);
|
|
5782
|
+
const isReady = Boolean(referrerUrl &&
|
|
5783
|
+
regions &&
|
|
5784
|
+
regionsDelivery &&
|
|
5785
|
+
slug === BIBLIOGLOBUS_SLUG &&
|
|
5786
|
+
defaultRegion?.key &&
|
|
5787
|
+
defaultRegion?.value);
|
|
5788
|
+
useEffect(() => {
|
|
5789
|
+
if (!isReady || !defaultRegion || !defaultRegion.key || !defaultRegion.value) {
|
|
5790
|
+
return;
|
|
5791
|
+
}
|
|
5792
|
+
onRegionChange?.({ key: defaultRegion.key, text: defaultRegion.value });
|
|
5793
|
+
onRegionHasDeliveryChange?.(regionHasDelivery);
|
|
5794
|
+
onMethodObtainChange?.(regionHasDelivery ? 'courier' : 'office');
|
|
5795
|
+
}, [
|
|
5796
|
+
isReady,
|
|
5797
|
+
defaultRegion,
|
|
5798
|
+
regionHasDelivery,
|
|
5799
|
+
onRegionChange,
|
|
5800
|
+
onRegionHasDeliveryChange,
|
|
5801
|
+
onMethodObtainChange,
|
|
5802
|
+
]);
|
|
5803
|
+
};
|
|
5804
|
+
|
|
5805
|
+
const getRegionDeliveryStatus = (regionsDelivery, value) => regionsDelivery?.find((_) => _.regionCode === String(value.key))?.deliveryFlg;
|
|
5806
|
+
const calculateRegionHasDelivery = (args) => {
|
|
5807
|
+
const { isDebit, isEsiaAuth, isSalaryCard, isDeliveryActive, regionDelivery } = args;
|
|
5808
|
+
if (isDebit) {
|
|
5809
|
+
return isEsiaAuth && !isSalaryCard && isDeliveryActive && regionDelivery;
|
|
5810
|
+
}
|
|
5811
|
+
return isDeliveryActive && regionDelivery;
|
|
5812
|
+
};
|
|
5813
|
+
|
|
5719
5814
|
const RegionRetailField = JSX(({ field, input }) => {
|
|
5720
5815
|
const { programId, productType } = useRetailFormStore();
|
|
5721
5816
|
const { data: regions } = useLeadFormData('REGION_RF');
|
|
5722
5817
|
const { data: regionsDelivery } = useAsyncData('regionsDelivery', getRegionsCardDelivery);
|
|
5723
5818
|
const { data: productSettings } = useLeadFormData(getCurrentProductSettings(productType));
|
|
5819
|
+
const sessionStore = useSessionStore();
|
|
5724
5820
|
const isDebit = productType === 'debitCard';
|
|
5725
5821
|
const isSalaryCard = programId === '38';
|
|
5726
5822
|
const isEsiaAuth = Boolean(field('esiaAccountTypeCd')?.value?.key);
|
|
@@ -5729,17 +5825,26 @@
|
|
|
5729
5825
|
const handleChangeRegion = field('regionRetail')?.onChange;
|
|
5730
5826
|
const handleChangeRegionHasDelivery = field('regionHasDelivery')?.onChange;
|
|
5731
5827
|
const handleChangeMethodObtain = field('methodObtain')?.onChange;
|
|
5828
|
+
useBiblioglobusDefaultRegion({
|
|
5829
|
+
referrerUrl: sessionStore.referrerUrl ?? undefined,
|
|
5830
|
+
regions,
|
|
5831
|
+
regionsDelivery,
|
|
5832
|
+
onRegionChange: handleChangeRegion,
|
|
5833
|
+
onRegionHasDeliveryChange: handleChangeRegionHasDelivery,
|
|
5834
|
+
onMethodObtainChange: handleChangeMethodObtain,
|
|
5835
|
+
});
|
|
5732
5836
|
const onChange = useCallback((value) => {
|
|
5733
|
-
const regionHasDelivery =
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
:
|
|
5837
|
+
const regionHasDelivery = calculateRegionHasDelivery({
|
|
5838
|
+
isDebit,
|
|
5839
|
+
isEsiaAuth,
|
|
5840
|
+
isSalaryCard,
|
|
5841
|
+
isDeliveryActive,
|
|
5842
|
+
regionDelivery: getRegionDeliveryStatus(regionsDelivery, value),
|
|
5843
|
+
});
|
|
5739
5844
|
handleChangeRegionHasDelivery?.(regionHasDelivery);
|
|
5740
5845
|
handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
|
|
5741
5846
|
handleChangeRegion?.(value);
|
|
5742
|
-
}, [
|
|
5847
|
+
}, [calculateRegionHasDelivery]);
|
|
5743
5848
|
useEffect(() => {
|
|
5744
5849
|
if (!isEsiaAuth && isDebit) {
|
|
5745
5850
|
handleChangeRegionHasDelivery?.(false);
|
|
@@ -5943,6 +6048,11 @@
|
|
|
5943
6048
|
return res || {};
|
|
5944
6049
|
};
|
|
5945
6050
|
|
|
6051
|
+
const getClaimChannel = async () => {
|
|
6052
|
+
const res = await fetchRetailJSON('light-api-cash/v1/claimChannel/', 'GET');
|
|
6053
|
+
return res || [];
|
|
6054
|
+
};
|
|
6055
|
+
|
|
5946
6056
|
const getLastTaskStatus = async (body) => {
|
|
5947
6057
|
const res = await fetchRetailJSON('/user-data/getLastStatus', 'POST', body);
|
|
5948
6058
|
return res?.statusCd === 'DRAFT' ? res?.taskId : null;
|
|
@@ -6630,7 +6740,7 @@
|
|
|
6630
6740
|
...consents,
|
|
6631
6741
|
};
|
|
6632
6742
|
};
|
|
6633
|
-
const getDebitLeadFormTaskData = (formData, programId, marketingInfo) => {
|
|
6743
|
+
const getDebitLeadFormTaskData = ({ formData, programId, marketingInfo, claimChannelCode, }) => {
|
|
6634
6744
|
const { name, surname, middleName, limitedBirthday, phone, email } = formData;
|
|
6635
6745
|
const taskSource = getTaskSource(marketingInfo?.utm_source);
|
|
6636
6746
|
return {
|
|
@@ -6653,6 +6763,7 @@
|
|
|
6653
6763
|
],
|
|
6654
6764
|
marketingInfo,
|
|
6655
6765
|
},
|
|
6766
|
+
...(claimChannelCode ? { claimChannelCode } : {}),
|
|
6656
6767
|
};
|
|
6657
6768
|
};
|
|
6658
6769
|
const getTaskSource = (source) => {
|
|
@@ -6728,6 +6839,7 @@
|
|
|
6728
6839
|
});
|
|
6729
6840
|
const referalData = leadFormStore.referalData;
|
|
6730
6841
|
const marketingInfo = sessionStore.marketingInfo;
|
|
6842
|
+
const referrerUrl = sessionStore.referrerUrl;
|
|
6731
6843
|
if (!profileId) {
|
|
6732
6844
|
throw new Error();
|
|
6733
6845
|
}
|
|
@@ -6741,6 +6853,7 @@
|
|
|
6741
6853
|
marketingInfo,
|
|
6742
6854
|
saveUserData,
|
|
6743
6855
|
sendAspects,
|
|
6856
|
+
referrerUrl,
|
|
6744
6857
|
});
|
|
6745
6858
|
verifyPhoneDialog.close();
|
|
6746
6859
|
if (productType === 'debitCard') {
|
|
@@ -6857,14 +6970,29 @@
|
|
|
6857
6970
|
.filter((_) => formData[_])
|
|
6858
6971
|
.map((_) => consents[_]?.text);
|
|
6859
6972
|
};
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6973
|
+
// Padding line to fix eslint padding-line-between-statements
|
|
6974
|
+
const computeClaimChannel = async (slug) => {
|
|
6975
|
+
if (slug !== BIBLIOGLOBUS_SLUG) {
|
|
6976
|
+
return undefined;
|
|
6977
|
+
}
|
|
6978
|
+
const claimData = await getClaimChannel();
|
|
6979
|
+
return claimData.find((item) => item.key === slug)?.code;
|
|
6980
|
+
};
|
|
6981
|
+
const updateUserData = async ({ programId, profileId, formData, productType, referalData, marketingInfo, saveUserData, sendAspects, referrerUrl, }) => {
|
|
6863
6982
|
const transformedConsents = transformConsentsFields(formData, productType);
|
|
6983
|
+
const slug = getCardSlugFromUrl(referrerUrl);
|
|
6864
6984
|
await updateUserProfile(getUpdateUserProfileData(profileId, formData, transformedConsents));
|
|
6865
6985
|
try {
|
|
6986
|
+
let taskId;
|
|
6987
|
+
let participantId;
|
|
6866
6988
|
if (productType === 'debitCard') {
|
|
6867
|
-
const
|
|
6989
|
+
const claimChannelCode = await computeClaimChannel(slug);
|
|
6990
|
+
const debitData = await createUserTaskDebit(getDebitLeadFormTaskData({
|
|
6991
|
+
formData,
|
|
6992
|
+
programId,
|
|
6993
|
+
marketingInfo,
|
|
6994
|
+
claimChannelCode,
|
|
6995
|
+
}));
|
|
6868
6996
|
taskId = debitData.taskId;
|
|
6869
6997
|
participantId = debitData.participantId;
|
|
6870
6998
|
}
|
|
@@ -7294,6 +7422,10 @@
|
|
|
7294
7422
|
leadFormStore.productType = productType;
|
|
7295
7423
|
sessionStore.marketingInfo = getMarketingInfo(queryFromStorage, sessionStore);
|
|
7296
7424
|
sessionStore.isNewMicroservice = isNewMicroservice || null;
|
|
7425
|
+
const referrer = globalThis.document.referrer;
|
|
7426
|
+
if (referrer) {
|
|
7427
|
+
sessionStore.referrerUrl = referrer;
|
|
7428
|
+
}
|
|
7297
7429
|
}, [queryFromStorage]);
|
|
7298
7430
|
useEffect(() => {
|
|
7299
7431
|
const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
|
|
@@ -13055,7 +13187,7 @@
|
|
|
13055
13187
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
13056
13188
|
});
|
|
13057
13189
|
|
|
13058
|
-
const packageVersion = "0.14.
|
|
13190
|
+
const packageVersion = "0.14.973";
|
|
13059
13191
|
|
|
13060
13192
|
exports.Blocks = Blocks;
|
|
13061
13193
|
exports.ContentPage = ContentPage;
|