@redneckz/wildless-cms-uni-blocks 0.8.23 → 0.8.24
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/bin/migration-scripts/0.8.17.js +27 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +59 -28
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +6 -2
- package/bundle/components/Tabs/LinkTab.d.ts +1 -0
- package/bundle/hooks/useBranches.d.ts +20 -0
- package/bundle/ui-kit/TopItem/TopItem.d.ts +2 -1
- package/dist/components/ApplicationForm/ApplicationFormAcquiring.js +1 -1
- package/dist/components/ApplicationForm/ApplicationFormAcquiring.js.map +1 -1
- package/dist/components/ApplicationForm/ApplicationFormBusinessCard.js +2 -2
- package/dist/components/ApplicationForm/ApplicationFormBusinessCard.js.map +1 -1
- package/dist/components/ApplicationForm/ApplicationFormCredit.js +5 -5
- package/dist/components/ApplicationForm/ApplicationFormCredit.js.map +1 -1
- package/dist/components/ApplicationForm/renderBankOffices.js.map +1 -1
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js +2 -2
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -1
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +6 -2
- package/dist/components/Calculator/getMonthlyPayment.js +4 -1
- package/dist/components/Calculator/getMonthlyPayment.js.map +1 -1
- package/dist/components/Header/HeaderSecondaryMenu.js +7 -2
- package/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/dist/components/Tabs/LinkTab.d.ts +1 -0
- package/dist/components/Tabs/LinkTab.js +6 -2
- package/dist/components/Tabs/LinkTab.js.map +1 -1
- package/dist/components/Tabs/Tabs.js +15 -3
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/renderTab.js +1 -1
- package/dist/components/Tabs/renderTab.js.map +1 -1
- package/dist/hooks/useBranches.d.ts +20 -0
- package/dist/hooks/useBranches.js +16 -0
- package/dist/hooks/useBranches.js.map +1 -0
- package/dist/ui-kit/BlockWrapper.js +1 -4
- package/dist/ui-kit/BlockWrapper.js.map +1 -1
- package/dist/ui-kit/TopItem/TopItem.d.ts +2 -1
- package/dist/ui-kit/TopItem/TopItem.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationFormAcquiring.js +1 -1
- package/lib/components/ApplicationForm/ApplicationFormAcquiring.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationFormBusinessCard.js +2 -2
- package/lib/components/ApplicationForm/ApplicationFormBusinessCard.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationFormCredit.js +5 -5
- package/lib/components/ApplicationForm/ApplicationFormCredit.js.map +1 -1
- package/lib/components/ApplicationForm/renderBankOffices.js.map +1 -1
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js +2 -2
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -1
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +6 -2
- package/lib/components/Calculator/getMonthlyPayment.js +4 -1
- package/lib/components/Calculator/getMonthlyPayment.js.map +1 -1
- package/lib/components/Header/HeaderSecondaryMenu.js +7 -2
- package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/lib/components/Tabs/LinkTab.d.ts +1 -0
- package/lib/components/Tabs/LinkTab.js +6 -2
- package/lib/components/Tabs/LinkTab.js.map +1 -1
- package/lib/components/Tabs/Tabs.js +15 -3
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Tabs/renderTab.js +1 -1
- package/lib/components/Tabs/renderTab.js.map +1 -1
- package/lib/hooks/useBranches.d.ts +20 -0
- package/lib/hooks/useBranches.js +13 -0
- package/lib/hooks/useBranches.js.map +1 -0
- package/lib/ui-kit/BlockWrapper.js +1 -4
- package/lib/ui-kit/BlockWrapper.js.map +1 -1
- package/lib/ui-kit/TopItem/TopItem.d.ts +2 -1
- package/lib/ui-kit/TopItem/TopItem.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +2 -5
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +6 -2
- package/mobile/bundle/components/Tabs/LinkTab.d.ts +1 -0
- package/mobile/bundle/hooks/useBranches.d.ts +20 -0
- package/mobile/bundle/ui-kit/TopItem/TopItem.d.ts +2 -1
- package/mobile/dist/components/ApplicationForm/ApplicationFormAcquiring.js +1 -1
- package/mobile/dist/components/ApplicationForm/ApplicationFormAcquiring.js.map +1 -1
- package/mobile/dist/components/ApplicationForm/ApplicationFormBusinessCard.js +2 -2
- package/mobile/dist/components/ApplicationForm/ApplicationFormBusinessCard.js.map +1 -1
- package/mobile/dist/components/ApplicationForm/ApplicationFormCredit.js +5 -5
- package/mobile/dist/components/ApplicationForm/ApplicationFormCredit.js.map +1 -1
- package/mobile/dist/components/ApplicationForm/renderBankOffices.js.map +1 -1
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js +2 -2
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -1
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +6 -2
- package/mobile/dist/components/Calculator/getMonthlyPayment.js +4 -1
- package/mobile/dist/components/Calculator/getMonthlyPayment.js.map +1 -1
- package/mobile/dist/components/Header/HeaderSecondaryMenu.js +7 -2
- package/mobile/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/mobile/dist/components/Tabs/LinkTab.d.ts +1 -0
- package/mobile/dist/components/Tabs/LinkTab.js +6 -2
- package/mobile/dist/components/Tabs/LinkTab.js.map +1 -1
- package/mobile/dist/components/Tabs/Tabs.js +15 -3
- package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
- package/mobile/dist/components/Tabs/renderTab.js +1 -1
- package/mobile/dist/components/Tabs/renderTab.js.map +1 -1
- package/mobile/dist/hooks/useBranches.d.ts +20 -0
- package/mobile/dist/hooks/useBranches.js +16 -0
- package/mobile/dist/hooks/useBranches.js.map +1 -0
- package/mobile/dist/ui-kit/BlockWrapper.js +1 -4
- package/mobile/dist/ui-kit/BlockWrapper.js.map +1 -1
- package/mobile/dist/ui-kit/TopItem/TopItem.d.ts +2 -1
- package/mobile/dist/ui-kit/TopItem/TopItem.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationFormAcquiring.js +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationFormAcquiring.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationFormBusinessCard.js +2 -2
- package/mobile/lib/components/ApplicationForm/ApplicationFormBusinessCard.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationFormCredit.js +5 -5
- package/mobile/lib/components/ApplicationForm/ApplicationFormCredit.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/renderBankOffices.js.map +1 -1
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js +2 -2
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -1
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +6 -2
- package/mobile/lib/components/Calculator/getMonthlyPayment.js +4 -1
- package/mobile/lib/components/Calculator/getMonthlyPayment.js.map +1 -1
- package/mobile/lib/components/Header/HeaderSecondaryMenu.js +7 -2
- package/mobile/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/mobile/lib/components/Tabs/LinkTab.d.ts +1 -0
- package/mobile/lib/components/Tabs/LinkTab.js +6 -2
- package/mobile/lib/components/Tabs/LinkTab.js.map +1 -1
- package/mobile/lib/components/Tabs/Tabs.js +15 -3
- package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
- package/mobile/lib/components/Tabs/renderTab.js +1 -1
- package/mobile/lib/components/Tabs/renderTab.js.map +1 -1
- package/mobile/lib/hooks/useBranches.d.ts +20 -0
- package/mobile/lib/hooks/useBranches.js +13 -0
- package/mobile/lib/hooks/useBranches.js.map +1 -0
- package/mobile/lib/ui-kit/BlockWrapper.js +1 -4
- package/mobile/lib/ui-kit/BlockWrapper.js.map +1 -1
- package/mobile/lib/ui-kit/TopItem/TopItem.d.ts +2 -1
- package/mobile/lib/ui-kit/TopItem/TopItem.js.map +1 -1
- package/mobile/src/components/ApplicationForm/ApplicationFormAcquiring.tsx +1 -1
- package/mobile/src/components/ApplicationForm/ApplicationFormBusinessCard.tsx +2 -2
- package/mobile/src/components/ApplicationForm/ApplicationFormCredit.tsx +5 -5
- package/mobile/src/components/ApplicationForm/renderBankOffices.tsx +1 -1
- package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlock.example.json +16 -8
- package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlock.tsx +3 -3
- package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlockContent.ts +6 -2
- package/mobile/src/components/Calculator/getMonthlyPayment.ts +3 -1
- package/mobile/src/components/Header/HeaderSecondaryMenu.tsx +9 -2
- package/mobile/src/components/Tabs/LinkTab.tsx +8 -2
- package/mobile/src/components/Tabs/Tabs.tsx +18 -3
- package/mobile/src/components/Tabs/renderTab.tsx +7 -1
- package/mobile/src/hooks/useBranches.ts +43 -0
- package/mobile/src/ui-kit/BlockWrapper.tsx +1 -6
- package/mobile/src/ui-kit/TopItem/TopItem.tsx +2 -1
- package/package.json +1 -1
- package/src/components/ApplicationForm/ApplicationFormAcquiring.tsx +1 -1
- package/src/components/ApplicationForm/ApplicationFormBusinessCard.tsx +2 -2
- package/src/components/ApplicationForm/ApplicationFormCredit.tsx +5 -5
- package/src/components/ApplicationForm/renderBankOffices.tsx +1 -1
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.example.json +16 -8
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.fixture.tsx +8 -8
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.tsx +3 -3
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlockContent.ts +6 -2
- package/src/components/Calculator/getMonthlyPayment.ts +3 -1
- package/src/components/Header/HeaderSecondaryMenu.tsx +9 -2
- package/src/components/Tabs/LinkTab.tsx +8 -2
- package/src/components/Tabs/Tabs.tsx +18 -3
- package/src/components/Tabs/renderTab.tsx +7 -1
- package/src/hooks/useBranches.ts +43 -0
- package/src/ui-kit/BlockWrapper.tsx +1 -6
- package/src/ui-kit/TopItem/TopItem.tsx +2 -1
package/bundle/bundle.umd.js
CHANGED
|
@@ -370,10 +370,7 @@
|
|
|
370
370
|
const ref = useBlockIntersectionObserver(block);
|
|
371
371
|
const [isHidden, setHidden] = useState(false);
|
|
372
372
|
useEffect(() => defaultEventBus.subscribe('tab', (event) => {
|
|
373
|
-
setHidden(Boolean(event.
|
|
374
|
-
event.label &&
|
|
375
|
-
block?.labels?.length &&
|
|
376
|
-
!block.labels.includes(event.label)));
|
|
373
|
+
setHidden(Boolean(event.label && block?.labels?.length && !block.labels.includes(event.label)));
|
|
377
374
|
}), [block]);
|
|
378
375
|
return (jsx(Tag, { className: style(isTheme ? 'group' : '', blockStyles[version], isHidden ? 'hidden' : '', className), ...(version && isTheme ? { 'data-ver': version } : {}), ...(block?.anchor ? { id: block.anchor, ref } : {}), role: role, children: children }));
|
|
379
376
|
});
|
|
@@ -873,7 +870,7 @@
|
|
|
873
870
|
handleSubmit &&
|
|
874
871
|
(await handleSubmit({
|
|
875
872
|
typeForm: 'acqr',
|
|
876
|
-
region,
|
|
873
|
+
region: regions.find((_) => _.code === selectedRegion)?.name || '',
|
|
877
874
|
PartnerComments,
|
|
878
875
|
fullName,
|
|
879
876
|
inn,
|
|
@@ -914,7 +911,7 @@
|
|
|
914
911
|
handleSubmit &&
|
|
915
912
|
(await handleSubmit({
|
|
916
913
|
typeForm: 'bcrd',
|
|
917
|
-
region,
|
|
914
|
+
region: regions.find((_) => _.code === selectedRegion)?.name || '',
|
|
918
915
|
name,
|
|
919
916
|
phone,
|
|
920
917
|
inn,
|
|
@@ -930,15 +927,15 @@
|
|
|
930
927
|
const renderDataOrganization$3 = ({ name, phone, mail, inn, handleChange, }) => (jsxs("div", { className: "flex justify-between gap-5", children: [jsxs("div", { className: "w-1/2", children: [jsx(Input, { className: "shrink-0 text-l w-full mb-5", type: "text", "aria-label": "\u041A\u043E\u043D\u0442\u0430\u043A\u0442\u043D\u043E\u0435 \u043B\u0438\u0446\u043E", label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442\u043D\u043E\u0435 \u043B\u0438\u0446\u043E", value: name, onChange: (value) => handleChange({ name: value }) }), jsx(Input, { className: "shrink-0 text-l w-full mb-5", type: "text", "aria-label": "\u0418\u041D\u041D", label: "\u0418\u041D\u041D", value: inn, onChange: (value) => handleChange({ inn: value }) })] }), jsxs("div", { className: "w-1/2", children: [jsx(Input, { className: "shrink-0 text-l w-full mb-5", type: "text", "aria-label": "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", value: phone, onChange: (value) => handleChange({ phone: value }) }), jsx(Input, { className: "shrink-0 text-l w-full ", type: "text", "aria-label": "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", value: mail, onChange: (value) => handleChange({ mail: value }) })] })] }));
|
|
931
928
|
const renderRegion$1 = ({ regions, region, handleChange }) => (jsx("div", { className: "flex justify-between gap-5 mb-5", children: jsx("div", { className: "w-full", children: jsx(WrapperSelect$1, { data: regions, fieldValue: "code", fieldLabel: "name", selected: region, setSelected: (value) => handleChange({ region: value }), label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D" }) }) }));
|
|
932
929
|
|
|
933
|
-
const
|
|
934
|
-
const EMPTY_VALUE = [];
|
|
935
|
-
function
|
|
936
|
-
const { data } = useAsyncData(regionCode ? `${
|
|
937
|
-
return data || EMPTY_VALUE;
|
|
930
|
+
const BRANCHES_URL = '/api/v1/branches';
|
|
931
|
+
const EMPTY_VALUE$1 = [];
|
|
932
|
+
function useBranches(regionCode) {
|
|
933
|
+
const { data } = useAsyncData(regionCode ? `${BRANCHES_URL}?regionCode=${regionCode}` : null, fetchSafeBoxes$1);
|
|
934
|
+
return data || EMPTY_VALUE$1;
|
|
938
935
|
}
|
|
939
|
-
const fetchSafeBoxes = async (url) => {
|
|
936
|
+
const fetchSafeBoxes$1 = async (url) => {
|
|
940
937
|
const result = await fetchJSON(url, { method: 'GET' });
|
|
941
|
-
return result || EMPTY_VALUE;
|
|
938
|
+
return result || EMPTY_VALUE$1;
|
|
942
939
|
};
|
|
943
940
|
|
|
944
941
|
const MIN_CREDIT_AMOUNT = 50000;
|
|
@@ -1013,8 +1010,8 @@
|
|
|
1013
1010
|
const { handleChange } = useFormHandlers({
|
|
1014
1011
|
setFormState,
|
|
1015
1012
|
});
|
|
1016
|
-
const selectedRegion = normalizeSelectedRegion$1(
|
|
1017
|
-
const branches =
|
|
1013
|
+
const selectedRegion = normalizeSelectedRegion$1(region, regions);
|
|
1014
|
+
const branches = useBranches(selectedRegion).filter((branch) => branch.address);
|
|
1018
1015
|
useEffect(() => {
|
|
1019
1016
|
handleChange({
|
|
1020
1017
|
department: '',
|
|
@@ -1031,8 +1028,8 @@
|
|
|
1031
1028
|
name,
|
|
1032
1029
|
phone,
|
|
1033
1030
|
mail,
|
|
1034
|
-
region,
|
|
1035
|
-
department,
|
|
1031
|
+
region: regions.find((_) => _.code === selectedRegion)?.name || '',
|
|
1032
|
+
department: branches.find((_) => _.branchCode === department)?.address || '',
|
|
1036
1033
|
PartnerComments,
|
|
1037
1034
|
}));
|
|
1038
1035
|
};
|
|
@@ -1244,8 +1241,8 @@
|
|
|
1244
1241
|
const renderBonusImage = (_) => _.image ? jsx(ImgInner, { className: `w-12 h-12 min-w-12 p-3 rounded-full`, image: _.image }) : null;
|
|
1245
1242
|
|
|
1246
1243
|
const BonusBenefitsBlock = JSX(({ bonusBenefits, cardTextAlign = 'center', className = '', columnsCount = '4', subtitle, title, ...rest }) => (jsxs(BlockWrapper, { className: `font-sans text-primary-text bg-white p-12 flex flex-col text-center ${className}`, ...rest, children: [jsx(Headline, { className: "!p-0 mb-8", title: title, description: subtitle, headlineVersion: "M" }), bonusBenefits?.length ? (jsx("div", { className: `grid gap-1 ${AlignText[cardTextAlign]} ${getElementsColsValue(columnsCount)}`, children: bonusBenefits.map(renderBonusBenefit) })) : null] })));
|
|
1247
|
-
const renderBonusBenefit = ({ icon,
|
|
1248
|
-
return (jsxs("div", { className: "flex flex-col items-center text-h6", children: [
|
|
1244
|
+
const renderBonusBenefit = ({ icon, title, description }, i) => {
|
|
1245
|
+
return (jsxs("div", { className: "flex flex-col items-center text-h6", children: [title ? jsx("span", { children: title }) : null, icon ? jsx(ImgInner, { image: icon, height: "180", width: "auto", className: "h-[180px] w-auto" }) : null, jsx("div", { children: description ? jsx("span", { children: description }) : null })] }, String(i)));
|
|
1249
1246
|
};
|
|
1250
1247
|
const getElementsColsValue = (colValue) => {
|
|
1251
1248
|
switch (colValue) {
|
|
@@ -1616,7 +1613,10 @@
|
|
|
1616
1613
|
*/
|
|
1617
1614
|
const getMonthlyPayment = (rate, params) => {
|
|
1618
1615
|
const { isAnnuity, moneyValue, monthsValue } = params;
|
|
1619
|
-
if (
|
|
1616
|
+
if (rate === 0) {
|
|
1617
|
+
return 0;
|
|
1618
|
+
}
|
|
1619
|
+
else if (isAnnuity) {
|
|
1620
1620
|
const i = rate / MONTHLY_INTEREST_RATE; // Используется значение ставки в процентах
|
|
1621
1621
|
return moneyValue * (i + i / (Math.pow(1 + i, monthsValue) - 1));
|
|
1622
1622
|
}
|
|
@@ -2842,7 +2842,11 @@
|
|
|
2842
2842
|
const [isShowLocationModal, { setTrue: showLocationModal, setFalse: hideLocationModal }] = useBool();
|
|
2843
2843
|
const [location, onChangeLocation] = useLocation(defaultLocation);
|
|
2844
2844
|
const iconVersion = version === 'transparent' ? 'white' : 'black';
|
|
2845
|
-
|
|
2845
|
+
const handleShowLocationModal = useCallback((ev) => {
|
|
2846
|
+
ev?.preventDefault();
|
|
2847
|
+
showLocationModal();
|
|
2848
|
+
}, []);
|
|
2849
|
+
return (jsxs("div", { className: style('flex items-center', className), children: [jsx(TopItem, { className: "mr-5", flat: true, href: "#", text: location.name, onClick: handleShowLocationModal }), officesLink ? (jsx(TopItem, { className: "mr-7", flat: true, href: officesLink, text: "\u041E\u0444\u0438\u0441\u044B \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B" })) : null, projectSettings.CHAT_BOT ? (jsx(HeaderChatBotButton, { className: "mr-5", iconVersion: iconVersion, chat: projectSettings.CHAT_BOT })) : null, isShowLocationModal ? (jsx(Location, { currentLocation: location, foreignOffices: foreignOffices, onChangeLocation: onChangeLocation, close: hideLocationModal })) : null] }));
|
|
2846
2850
|
});
|
|
2847
2851
|
|
|
2848
2852
|
const findActiveSubItem = (router) => (items = []) => {
|
|
@@ -3775,6 +3779,17 @@
|
|
|
3775
3779
|
};
|
|
3776
3780
|
const renderPrimaryFoldButton = ({ label, icon, onToggle }) => (jsxs("button", { className: "border-none bg-transparent px-9 pt-5 pb-3.5 flex justify-between text-left w-full font-sans text-h6 cursor-pointer", onClick: onToggle, children: [jsx("span", { className: "text-xl font-medium pr-2.5", children: label }), icon ? jsx(ImgInner, { image: getIconWithVersion({ icon }), width: "24", height: "24", asSVG: true }) : null] }));
|
|
3777
3781
|
|
|
3782
|
+
const SAFEBOXES_URL = '/api/v1/safeboxes';
|
|
3783
|
+
const EMPTY_VALUE = [];
|
|
3784
|
+
function useSafeBoxes(regionCode) {
|
|
3785
|
+
const { data } = useAsyncData(regionCode ? `${SAFEBOXES_URL}?regionCode=${regionCode}` : null, fetchSafeBoxes);
|
|
3786
|
+
return data || EMPTY_VALUE;
|
|
3787
|
+
}
|
|
3788
|
+
const fetchSafeBoxes = async (url) => {
|
|
3789
|
+
const result = await fetchJSON(url, { method: 'GET' });
|
|
3790
|
+
return result || EMPTY_VALUE;
|
|
3791
|
+
};
|
|
3792
|
+
|
|
3778
3793
|
const WrapperSelect = JSX(({ data, fieldLabel, fieldValue, selected, placeholder = '', setSelected, label }) => {
|
|
3779
3794
|
const dataFormat = data
|
|
3780
3795
|
.filter(Boolean)
|
|
@@ -4048,11 +4063,15 @@
|
|
|
4048
4063
|
};
|
|
4049
4064
|
|
|
4050
4065
|
const LinkTab = JSX((props) => {
|
|
4051
|
-
const { tab, currentTab, isScrollable = false } = props;
|
|
4066
|
+
const { tab, currentTab, onClick, isScrollable = false } = props;
|
|
4052
4067
|
const active = currentTab?.type === 'link' && currentTab.href === tab.href;
|
|
4053
4068
|
const link = useLink();
|
|
4054
4069
|
const adjustedProps = link(tab);
|
|
4055
|
-
|
|
4070
|
+
const handleClick = (ev) => {
|
|
4071
|
+
adjustedProps.onClick(ev);
|
|
4072
|
+
onClick(tab);
|
|
4073
|
+
};
|
|
4074
|
+
return (jsx("a", { role: "tab", className: getLinkTabClassName('link', active, isScrollable), target: tab.target, href: adjustedProps.href, onClick: handleClick, children: jsx("span", { className: getLinkTabClassName('text', active, isScrollable), children: tab.text }) }));
|
|
4056
4075
|
});
|
|
4057
4076
|
|
|
4058
4077
|
const BADGE_CLASSES = 'min-w-[22px] h-[22px] rounded-full text-xs ml-2 flex justify-center items-center';
|
|
@@ -4085,7 +4104,7 @@
|
|
|
4085
4104
|
case 'group':
|
|
4086
4105
|
return renderGroupTab({ page, currentTab, showCounter, onClick, isScrollable })(tab, i);
|
|
4087
4106
|
case 'link': {
|
|
4088
|
-
return (jsx(LinkTab, { tab: tab, currentTab: currentTab, isScrollable: isScrollable }, String(i)));
|
|
4107
|
+
return (jsx(LinkTab, { tab: tab, currentTab: currentTab, isScrollable: isScrollable, onClick: onClick }, String(i)));
|
|
4089
4108
|
}
|
|
4090
4109
|
default:
|
|
4091
4110
|
assertUnreachable(type);
|
|
@@ -4112,15 +4131,19 @@
|
|
|
4112
4131
|
const Tabs = JSX((props) => {
|
|
4113
4132
|
const { className = '', tabs, showCounter, isSticky, tabsMode, ...rest } = props;
|
|
4114
4133
|
const [currentTab, setCurrentTab] = useState(tabs ? tabs[0] : undefined);
|
|
4134
|
+
useEffect(() => {
|
|
4135
|
+
if (!tabs || !tabs[0]) {
|
|
4136
|
+
return;
|
|
4137
|
+
}
|
|
4138
|
+
fireTabEvent(tabs[0]);
|
|
4139
|
+
}, []);
|
|
4115
4140
|
useEffect(() => {
|
|
4116
4141
|
if (currentTab?.type === 'group') {
|
|
4117
4142
|
defaultEventBus.subject('tab', { type: currentTab.type, label: currentTab.ref });
|
|
4118
4143
|
}
|
|
4119
4144
|
}, [currentTab]);
|
|
4120
4145
|
const handleClick = useCallback((selectedTab) => {
|
|
4121
|
-
|
|
4122
|
-
defaultEventBus.fire('tab', { type: selectedTab.type, label: selectedTab.ref });
|
|
4123
|
-
}
|
|
4146
|
+
fireTabEvent(selectedTab);
|
|
4124
4147
|
setCurrentTab(selectedTab);
|
|
4125
4148
|
}, []);
|
|
4126
4149
|
return (jsx(BlockWrapper, { className: `relative box-border flex gap-x-1 w-full ${isSticky ? 'sticky top-1 z-20' : ''} ${className}`, role: "tablist", ...rest, children: tabsMode === 'scrollable' ? (jsx(ScrollableTabs, { tabs: tabs, onClick: handleClick, currentTab: currentTab, showCounter: showCounter, ...rest })) : (tabs?.map(renderTab({
|
|
@@ -4130,6 +4153,14 @@
|
|
|
4130
4153
|
...rest,
|
|
4131
4154
|
}))) }));
|
|
4132
4155
|
});
|
|
4156
|
+
const fireTabEvent = (tab) => {
|
|
4157
|
+
if (tab.type === 'group') {
|
|
4158
|
+
defaultEventBus.fire('tab', { type: tab.type, label: tab.ref });
|
|
4159
|
+
}
|
|
4160
|
+
if (tab.type === 'link') {
|
|
4161
|
+
defaultEventBus.fire('tab', { type: tab.type, label: tab.href });
|
|
4162
|
+
}
|
|
4163
|
+
};
|
|
4133
4164
|
|
|
4134
4165
|
const DIVIDER_CLASSES = 'border-main-divider border border-t-0 border-x-0';
|
|
4135
4166
|
const FIRST_CELL_CLASSES = 'w-[354px] flex-shrink-0';
|
|
@@ -4535,7 +4566,7 @@
|
|
|
4535
4566
|
return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto" }) }));
|
|
4536
4567
|
}
|
|
4537
4568
|
|
|
4538
|
-
const packageVersion = "0.8.
|
|
4569
|
+
const packageVersion = "0.8.24";
|
|
4539
4570
|
|
|
4540
4571
|
exports.Blocks = Blocks;
|
|
4541
4572
|
exports.ContentPage = ContentPage;
|