@redneckz/wildless-cms-uni-blocks 0.14.1073 → 0.14.1074
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 +274 -407
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CashbackCalculator/CashbackCalculator.d.ts +2 -7
- package/bundle/components/CashbackCalculator/CashbackCalculatorContent.d.ts +25 -0
- package/bundle/components/CashbackCalculator/CashbackCalculatorResult.d.ts +1 -2
- package/bundle/components/CashbackCalculator/CashbackCategory.d.ts +2 -6
- package/bundle/components/CashbackCalculator/useCashbackCalculator.d.ts +2 -4
- package/bundle/components/GalleryLayout/utils.d.ts +0 -1
- package/bundle/ui-kit/RichText/RichTextProps.d.ts +0 -2
- package/dist/components/Blocks.js +2 -4
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/CashbackCalculator/CashbackCalculator.d.ts +2 -7
- package/dist/components/CashbackCalculator/CashbackCalculator.js +14 -25
- package/dist/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
- package/dist/components/CashbackCalculator/CashbackCalculatorContent.d.ts +25 -0
- package/dist/components/CashbackCalculator/CashbackCalculatorContent.js +1 -0
- package/dist/components/CashbackCalculator/CashbackCalculatorResult.d.ts +1 -2
- package/dist/components/CashbackCalculator/CashbackCalculatorResult.js +11 -9
- package/dist/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
- package/dist/components/CashbackCalculator/CashbackCategory.d.ts +2 -6
- package/dist/components/CashbackCalculator/CashbackCategory.js +54 -33
- package/dist/components/CashbackCalculator/CashbackCategory.js.map +1 -1
- package/dist/components/CashbackCalculator/useCashbackCalculator.d.ts +2 -4
- package/dist/components/CashbackCalculator/useCashbackCalculator.js +15 -17
- package/dist/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
- package/dist/components/GalleryLayout/utils.d.ts +0 -1
- package/dist/ui-kit/RichText/RichText.js +2 -2
- package/dist/ui-kit/RichText/RichText.js.map +1 -1
- package/dist/ui-kit/RichText/RichTextProps.d.ts +0 -2
- package/lib/common.css +1 -1
- package/lib/components/Blocks.js +2 -4
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/CashbackCalculator/CashbackCalculator.d.ts +2 -7
- package/lib/components/CashbackCalculator/CashbackCalculator.js +14 -25
- package/lib/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
- package/lib/components/CashbackCalculator/CashbackCalculatorContent.d.ts +25 -0
- package/lib/components/CashbackCalculator/CashbackCalculatorContent.js +1 -0
- package/lib/components/CashbackCalculator/CashbackCalculatorResult.d.ts +1 -2
- package/lib/components/CashbackCalculator/CashbackCalculatorResult.js +11 -9
- package/lib/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
- package/lib/components/CashbackCalculator/CashbackCategory.d.ts +2 -6
- package/lib/components/CashbackCalculator/CashbackCategory.js +54 -33
- package/lib/components/CashbackCalculator/CashbackCategory.js.map +1 -1
- package/lib/components/CashbackCalculator/useCashbackCalculator.d.ts +2 -4
- package/lib/components/CashbackCalculator/useCashbackCalculator.js +16 -18
- package/lib/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
- package/lib/components/GalleryLayout/utils.d.ts +0 -1
- package/lib/ui-kit/RichText/RichText.js +2 -2
- package/lib/ui-kit/RichText/RichText.js.map +1 -1
- package/lib/ui-kit/RichText/RichTextProps.d.ts +0 -2
- package/mobile/bundle/bundle.umd.js +67 -153
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CashbackCalculator/CashbackCalculator.d.ts +2 -7
- package/mobile/bundle/components/CashbackCalculator/CashbackCalculatorContent.d.ts +25 -0
- package/mobile/bundle/components/CashbackCalculator/CashbackCalculatorResult.d.ts +1 -2
- package/mobile/bundle/components/CashbackCalculator/CashbackCategory.d.ts +2 -6
- package/mobile/bundle/components/CashbackCalculator/useCashbackCalculator.d.ts +2 -4
- package/mobile/bundle/components/GalleryLayout/utils.d.ts +0 -1
- package/mobile/bundle/ui-kit/RichText/RichTextProps.d.ts +0 -2
- package/mobile/dist/components/CashbackCalculator/CashbackCalculator.d.ts +2 -7
- package/mobile/dist/components/CashbackCalculator/CashbackCalculator.js +14 -25
- package/mobile/dist/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorContent.d.ts +25 -0
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorContent.js +1 -0
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorResult.d.ts +1 -2
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorResult.js +11 -9
- package/mobile/dist/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
- package/mobile/dist/components/CashbackCalculator/CashbackCategory.d.ts +2 -6
- package/mobile/dist/components/CashbackCalculator/CashbackCategory.js +54 -33
- package/mobile/dist/components/CashbackCalculator/CashbackCategory.js.map +1 -1
- package/mobile/dist/components/CashbackCalculator/useCashbackCalculator.d.ts +2 -4
- package/mobile/dist/components/CashbackCalculator/useCashbackCalculator.js +15 -17
- package/mobile/dist/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
- package/mobile/dist/components/GalleryLayout/utils.d.ts +0 -1
- package/mobile/dist/ui-kit/RichText/RichText.js +2 -2
- package/mobile/dist/ui-kit/RichText/RichText.js.map +1 -1
- package/mobile/dist/ui-kit/RichText/RichTextProps.d.ts +0 -2
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/CashbackCalculator/CashbackCalculator.d.ts +2 -7
- package/mobile/lib/components/CashbackCalculator/CashbackCalculator.js +14 -25
- package/mobile/lib/components/CashbackCalculator/CashbackCalculator.js.map +1 -1
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorContent.d.ts +25 -0
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorContent.js +1 -0
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorResult.d.ts +1 -2
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorResult.js +11 -9
- package/mobile/lib/components/CashbackCalculator/CashbackCalculatorResult.js.map +1 -1
- package/mobile/lib/components/CashbackCalculator/CashbackCategory.d.ts +2 -6
- package/mobile/lib/components/CashbackCalculator/CashbackCategory.js +54 -33
- package/mobile/lib/components/CashbackCalculator/CashbackCategory.js.map +1 -1
- package/mobile/lib/components/CashbackCalculator/useCashbackCalculator.d.ts +2 -4
- package/mobile/lib/components/CashbackCalculator/useCashbackCalculator.js +16 -18
- package/mobile/lib/components/CashbackCalculator/useCashbackCalculator.js.map +1 -1
- package/mobile/lib/components/GalleryLayout/utils.d.ts +0 -1
- package/mobile/lib/ui-kit/RichText/RichText.js +2 -2
- package/mobile/lib/ui-kit/RichText/RichText.js.map +1 -1
- package/mobile/lib/ui-kit/RichText/RichTextProps.d.ts +0 -2
- package/mobile/src/components/CashbackCalculator/CashbackCalculator.example.json +1 -0
- package/mobile/src/components/CashbackCalculator/CashbackCalculator.tsx +69 -73
- package/mobile/src/components/{CashbackCalculatorLayout/CashbackCalculatorLayout.ui.json → CashbackCalculator/CashbackCalculator.ui.json} +0 -6
- package/mobile/src/components/CashbackCalculator/CashbackCalculatorContent.ts +28 -0
- package/mobile/src/components/CashbackCalculator/CashbackCalculatorResult.tsx +23 -23
- package/mobile/src/components/CashbackCalculator/CashbackCategory.tsx +71 -69
- package/mobile/src/components/CashbackCalculator/useCashbackCalculator.ts +17 -26
- package/mobile/src/ui-kit/RichText/RichText.tsx +1 -9
- package/mobile/src/ui-kit/RichText/RichTextProps.ts +0 -2
- package/package.json +2 -2
- package/src/components/Blocks.ts +2 -4
- package/src/components/CashbackCalculator/CashbackCalculator.example.json +1 -0
- package/src/components/CashbackCalculator/CashbackCalculator.tsx +69 -73
- package/src/components/{CashbackCalculatorLayout/CashbackCalculatorLayout.ui.json → CashbackCalculator/CashbackCalculator.ui.json} +0 -6
- package/src/components/CashbackCalculator/CashbackCalculatorContent.ts +28 -0
- package/src/components/CashbackCalculator/CashbackCalculatorResult.tsx +23 -23
- package/src/components/CashbackCalculator/CashbackCategory.tsx +71 -69
- package/src/components/CashbackCalculator/useCashbackCalculator.ts +17 -26
- package/src/ui-kit/RichText/RichText.tsx +1 -9
- package/src/ui-kit/RichText/RichTextProps.ts +0 -2
- package/bundle/components/CashbackCalculator/constants.d.ts +0 -16
- package/bundle/components/CashbackCalculator/getPercentCategories.d.ts +0 -1
- package/bundle/components/CashbackCalculator/renderButtons.d.ts +0 -9
- package/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +0 -6
- package/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +0 -38
- package/dist/components/CashbackCalculator/constants.d.ts +0 -16
- package/dist/components/CashbackCalculator/constants.js +0 -89
- package/dist/components/CashbackCalculator/constants.js.map +0 -1
- package/dist/components/CashbackCalculator/getPercentCategories.d.ts +0 -1
- package/dist/components/CashbackCalculator/getPercentCategories.js +0 -16
- package/dist/components/CashbackCalculator/getPercentCategories.js.map +0 -1
- package/dist/components/CashbackCalculator/renderButtons.d.ts +0 -9
- package/dist/components/CashbackCalculator/renderButtons.js +0 -10
- package/dist/components/CashbackCalculator/renderButtons.js.map +0 -1
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +0 -6
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +0 -56
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +0 -1
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +0 -38
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +0 -2
- package/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +0 -1
- package/lib/components/CashbackCalculator/constants.d.ts +0 -16
- package/lib/components/CashbackCalculator/constants.js +0 -87
- package/lib/components/CashbackCalculator/constants.js.map +0 -1
- package/lib/components/CashbackCalculator/getPercentCategories.d.ts +0 -1
- package/lib/components/CashbackCalculator/getPercentCategories.js +0 -13
- package/lib/components/CashbackCalculator/getPercentCategories.js.map +0 -1
- package/lib/components/CashbackCalculator/renderButtons.d.ts +0 -9
- package/lib/components/CashbackCalculator/renderButtons.js +0 -7
- package/lib/components/CashbackCalculator/renderButtons.js.map +0 -1
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +0 -6
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.fixture.d.ts +0 -5
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +0 -54
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +0 -1
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +0 -38
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +0 -2
- package/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +0 -1
- package/mobile/bundle/components/CashbackCalculator/constants.d.ts +0 -16
- package/mobile/bundle/components/CashbackCalculator/getPercentCategories.d.ts +0 -1
- package/mobile/bundle/components/CashbackCalculator/renderButtons.d.ts +0 -9
- package/mobile/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +0 -6
- package/mobile/bundle/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +0 -38
- package/mobile/dist/components/CashbackCalculator/constants.d.ts +0 -16
- package/mobile/dist/components/CashbackCalculator/constants.js +0 -89
- package/mobile/dist/components/CashbackCalculator/constants.js.map +0 -1
- package/mobile/dist/components/CashbackCalculator/getPercentCategories.d.ts +0 -1
- package/mobile/dist/components/CashbackCalculator/getPercentCategories.js +0 -16
- package/mobile/dist/components/CashbackCalculator/getPercentCategories.js.map +0 -1
- package/mobile/dist/components/CashbackCalculator/renderButtons.d.ts +0 -9
- package/mobile/dist/components/CashbackCalculator/renderButtons.js +0 -10
- package/mobile/dist/components/CashbackCalculator/renderButtons.js.map +0 -1
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +0 -6
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +0 -56
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +0 -1
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +0 -38
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +0 -2
- package/mobile/dist/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +0 -1
- package/mobile/lib/components/CashbackCalculator/constants.d.ts +0 -16
- package/mobile/lib/components/CashbackCalculator/constants.js +0 -87
- package/mobile/lib/components/CashbackCalculator/constants.js.map +0 -1
- package/mobile/lib/components/CashbackCalculator/getPercentCategories.d.ts +0 -1
- package/mobile/lib/components/CashbackCalculator/getPercentCategories.js +0 -13
- package/mobile/lib/components/CashbackCalculator/getPercentCategories.js.map +0 -1
- package/mobile/lib/components/CashbackCalculator/renderButtons.d.ts +0 -9
- package/mobile/lib/components/CashbackCalculator/renderButtons.js +0 -7
- package/mobile/lib/components/CashbackCalculator/renderButtons.js.map +0 -1
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.d.ts +0 -6
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js +0 -54
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayout.js.map +0 -1
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.d.ts +0 -38
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js +0 -2
- package/mobile/lib/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.js.map +0 -1
- package/mobile/src/components/CashbackCalculator/constants.ts +0 -97
- package/mobile/src/components/CashbackCalculator/getPercentCategories.ts +0 -24
- package/mobile/src/components/CashbackCalculator/renderButtons.tsx +0 -38
- package/mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.example.json +0 -47
- package/mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.tsx +0 -116
- package/mobile/src/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.ts +0 -49
- package/src/components/CashbackCalculator/constants.ts +0 -97
- package/src/components/CashbackCalculator/getPercentCategories.ts +0 -24
- package/src/components/CashbackCalculator/renderButtons.tsx +0 -38
- package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.example.json +0 -47
- package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.fixture.tsx +0 -61
- package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayout.tsx +0 -116
- package/src/components/CashbackCalculatorLayout/CashbackCalculatorLayoutContent.ts +0 -49
package/bundle/bundle.umd.js
CHANGED
|
@@ -823,11 +823,11 @@
|
|
|
823
823
|
? 'bg-secondary-light text-primary-main'
|
|
824
824
|
: 'bg-primary-main text-black group-data-secondary:bg-white/30 group-data-secondary:text-black'), children: jsx(Img, { className: "w-6 h-6", image: { ...icon, iconVersion: icon.iconVersion || benefitsVersion } }) })) : null;
|
|
825
825
|
|
|
826
|
-
const RichText = JSX(({ __html = '', richVersion = '', itemSize = 'list-m',
|
|
826
|
+
const RichText = JSX(({ __html = '', richVersion = '', itemSize = 'list-m', isDotted = true, children }) => {
|
|
827
827
|
const dotStyle = isDotted ? '' : 'without-dots';
|
|
828
828
|
return __html || children ? (
|
|
829
829
|
/* Attribute [data-component] need for correct render in wcms editor. Do not remove. */
|
|
830
|
-
jsx("div", { "data-component": "rich-text-container", children: jsx("div", { className: style(richVersion, itemSize, 'md-container group-data-secondary:text-white group-data-gray:text-secondary-text', dotStyle
|
|
830
|
+
jsx("div", { "data-component": "rich-text-container", children: jsx("div", { className: style(richVersion, itemSize, 'md-container group-data-secondary:text-white group-data-gray:text-secondary-text', dotStyle), dangerouslySetInnerHTML: __html ? { __html } : undefined, children: children }) })) : null;
|
|
831
831
|
});
|
|
832
832
|
|
|
833
833
|
const renderBenefitDescription = (description, i) => description ? (jsx(Paragraph, { font: "font-light", size: "text-m", color: "text-secondary-text group-data-secondary:text-white", children: description }, `description-${i}`)) : null;
|
|
@@ -6966,7 +6966,7 @@
|
|
|
6966
6966
|
'bg-white': 'text-primary-main',
|
|
6967
6967
|
transparent: 'text-white',
|
|
6968
6968
|
};
|
|
6969
|
-
const renderImage
|
|
6969
|
+
const renderImage = (bgColor, image, size) => {
|
|
6970
6970
|
const img = image?.src
|
|
6971
6971
|
? image
|
|
6972
6972
|
: {
|
|
@@ -6980,7 +6980,7 @@
|
|
|
6980
6980
|
'bg-white': 'text-primary-text',
|
|
6981
6981
|
transparent: 'text-white',
|
|
6982
6982
|
};
|
|
6983
|
-
const Logo = JSX(({ className, href = '/', logo, children, targetBlank, bgColor = 'bg-white', showTitle = true, data, size = ICON_SIZE, }) => (jsxs("a", { className: style('inline-flex items-center font-sans no-underline', className), href: logo?.href ?? href, target: targetBlank ? '_blank' : '_self', "aria-label": logo?.title ?? 'Россельхозбанк', ...getAspectsAttributes(data), children: [renderImage
|
|
6983
|
+
const Logo = JSX(({ className, href = '/', logo, children, targetBlank, bgColor = 'bg-white', showTitle = true, data, size = ICON_SIZE, }) => (jsxs("a", { className: style('inline-flex items-center font-sans no-underline', className), href: logo?.href ?? href, target: targetBlank ? '_blank' : '_self', "aria-label": logo?.title ?? 'Россельхозбанк', ...getAspectsAttributes(data), children: [renderImage(bgColor, logo?.image, size), showTitle
|
|
6984
6984
|
? children ?? (jsx("div", { className: "ml-s", children: jsx(Text, { font: "font-medium", color: TEXT_COLOR[bgColor], size: logoTitleSizeStyle, children: logo?.title ?? 'Россельхозбанк' }) }))
|
|
6985
6985
|
: null] })));
|
|
6986
6986
|
|
|
@@ -10260,30 +10260,27 @@
|
|
|
10260
10260
|
return (jsxs(BlockWrapper, { className: style('flex flex-col', className), defaultPadding: "p-2xl", ...rest, children: [jsx(Img, { className: "self-center", image: icon }), title ? (jsx(Heading, { className: style('pt-xs', align), headingType: "h5", title: title })) : null, button?.text ? jsx(LinkButton, { className: "w-full mt-m mb-lg", ...button }) : null, hiddenCells.length ? (jsxs(Foldable, { children: [jsxs("div", { children: [visibleCells, jsx(FoldableSection, { isUnfolded: isVisible, children: hiddenCells })] }), cardCells.length >= visibleCellsCount ? (jsx(DefaultFoldButton, { className: "mt-m", label: isVisible ? 'Скрыть' : 'Подробнее о тарифе', isUnfolded: isVisible, embedded: true, data: data, onClick: handleFold })) : null] })) : (jsx("div", { children: visibleCells }))] }));
|
|
10261
10261
|
});
|
|
10262
10262
|
|
|
10263
|
+
const MAX_MONTH_CASHBACK = 5000;
|
|
10264
|
+
const MAX_YEAR_CASHBACK = 60000;
|
|
10263
10265
|
const ResultText = JSX(({ text, value }) => (jsxs("div", { className: "space-y-xs w-full", children: [jsx(Text, { size: "text-m", color: "text-primary-text", font: "font-light", children: text }), jsx("div", { className: "w-full text-2xl bg-main-gray px-4 py-3 rounded-md", children: toLocalNumberFormat()(value) })] })));
|
|
10264
|
-
const CashbackCalculatorResult = JSX(({ cashbacks
|
|
10265
|
-
const {
|
|
10266
|
-
return (jsxs("div", { className: "w-full flex flex-col gap-lg", children: [jsx(Heading, { className: "text-left", headingType: "h5", as: "h2", title: "\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u0440\u0430\u0441\u0447\u0435\u0442\u0430" }), jsxs("div", { className: "flex flex-col @xs:flex-row gap-lg", children: [jsx(ResultText, { text: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0432 \u043C\u0435\u0441\u044F\u0446", value:
|
|
10266
|
+
const CashbackCalculatorResult = JSX(({ cashbacks }) => {
|
|
10267
|
+
const { mounth, year } = getResult(cashbacks);
|
|
10268
|
+
return (jsxs("div", { className: "w-full flex flex-col gap-lg", children: [jsx(Heading, { className: "text-left", headingType: "h5", as: "h2", title: "\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u0440\u0430\u0441\u0447\u0435\u0442\u0430" }), jsx(RichText, { __html: '\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438 \u043F\u043E\u043A\u0443\u043F\u043E\u043A \u0434\u043B\u044F \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0431\u0430\u043B\u043B\u043E\u0432 \u043F\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435.<br />\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435 \u043F\u043E \u0443\u0441\u043B\u043E\u0432\u0438\u044F\u043C \u0438 \u043D\u0430\u0447\u0438\u0441\u043B\u0435\u043D\u0438\u044F\u043C \u043C\u043E\u0436\u043D\u043E \u0443\u0437\u043D\u0430\u0442\u044C \u0432\u043E \u0432\u043A\u043B\u0430\u0434\u043A\u0435 <a href="#docs">\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B</a>' }), jsxs("div", { className: "flex flex-col @xs:flex-row gap-lg", children: [jsx(ResultText, { text: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0432 \u043C\u0435\u0441\u044F\u0446", value: mounth }), jsx(ResultText, { text: "\u0411\u0430\u043B\u043B\u043E\u0432 \u0432 \u0433\u043E\u0434", value: year })] })] }));
|
|
10267
10269
|
});
|
|
10268
|
-
const getResult = (cashbacks
|
|
10270
|
+
const getResult = (cashbacks) => {
|
|
10269
10271
|
return cashbacks.reduce((acc, val) => {
|
|
10270
|
-
const mounthSum = (
|
|
10272
|
+
const mounthSum = (Number(val.percent.key) / 100) * val.sum;
|
|
10271
10273
|
return {
|
|
10272
|
-
|
|
10273
|
-
year: Math.min(acc.year + mounthSum * 12,
|
|
10274
|
+
mounth: Math.min(acc.mounth + mounthSum, MAX_MONTH_CASHBACK),
|
|
10275
|
+
year: Math.min(acc.year + mounthSum * 12, MAX_YEAR_CASHBACK),
|
|
10274
10276
|
};
|
|
10275
10277
|
}, {
|
|
10276
|
-
|
|
10278
|
+
mounth: 0,
|
|
10277
10279
|
year: 0,
|
|
10278
10280
|
});
|
|
10279
10281
|
};
|
|
10280
|
-
const formatKey = (key) => Number(key.replace('-main', ''));
|
|
10281
10282
|
|
|
10282
|
-
const
|
|
10283
|
-
{
|
|
10284
|
-
text: 'Категория 1% «На всё»',
|
|
10285
|
-
key: '1-main',
|
|
10286
|
-
},
|
|
10283
|
+
const AllPercentCategories = [
|
|
10287
10284
|
{
|
|
10288
10285
|
text: 'Категория 1,5%',
|
|
10289
10286
|
key: '1.5',
|
|
@@ -10305,11 +10302,7 @@
|
|
|
10305
10302
|
key: '15',
|
|
10306
10303
|
},
|
|
10307
10304
|
];
|
|
10308
|
-
const
|
|
10309
|
-
{
|
|
10310
|
-
text: 'Категория 1,5% «На всё»',
|
|
10311
|
-
key: '1.5-main',
|
|
10312
|
-
},
|
|
10305
|
+
const PercentCategoriesWithoutIncreased = [
|
|
10313
10306
|
{
|
|
10314
10307
|
text: 'Категория 1,5%',
|
|
10315
10308
|
key: '1.5',
|
|
@@ -10318,128 +10311,58 @@
|
|
|
10318
10311
|
text: 'Категория 3%',
|
|
10319
10312
|
key: '3',
|
|
10320
10313
|
},
|
|
10321
|
-
{
|
|
10322
|
-
text: 'Категория 5%',
|
|
10323
|
-
key: '5',
|
|
10324
|
-
},
|
|
10325
|
-
{
|
|
10326
|
-
text: 'Категория 10%',
|
|
10327
|
-
key: '10',
|
|
10328
|
-
},
|
|
10329
|
-
{
|
|
10330
|
-
text: 'Категория 15%',
|
|
10331
|
-
key: '15',
|
|
10332
|
-
},
|
|
10333
|
-
];
|
|
10334
|
-
const MAIN_CASHBACK_KEY = {
|
|
10335
|
-
standard: '1-main',
|
|
10336
|
-
premium: '1.5-main',
|
|
10337
|
-
};
|
|
10338
|
-
const DEFAULT_STANDARD_CASHBACK = [
|
|
10339
|
-
{
|
|
10340
|
-
id: 0,
|
|
10341
|
-
percent: {
|
|
10342
|
-
text: 'Категория 1% «На всё»',
|
|
10343
|
-
key: '1-main',
|
|
10344
|
-
},
|
|
10345
|
-
sum: 5000,
|
|
10346
|
-
},
|
|
10347
|
-
];
|
|
10348
|
-
const DEFAULT_PREMIUM_CASHBACK = [
|
|
10349
|
-
{
|
|
10350
|
-
id: 0,
|
|
10351
|
-
percent: {
|
|
10352
|
-
text: 'Категория 1,5% «На всё»',
|
|
10353
|
-
key: '1.5-main',
|
|
10354
|
-
},
|
|
10355
|
-
sum: 5000,
|
|
10356
|
-
},
|
|
10357
10314
|
];
|
|
10358
|
-
|
|
10359
|
-
const MAX_CATEGORIES = {
|
|
10360
|
-
standard: 5,
|
|
10361
|
-
premium: 7,
|
|
10362
|
-
};
|
|
10363
|
-
const INFO_BLOCK_HTML = `<p>Полученные баллы можно конвертировать в рубли и компенсировать покупки у партнеров.</p>`;
|
|
10364
|
-
const MAX_MONTH_CASHBACK = {
|
|
10365
|
-
standard: 5000,
|
|
10366
|
-
premium: 15000,
|
|
10367
|
-
};
|
|
10368
|
-
|
|
10369
|
-
const getPercentCategories = (isMainCashbackAdded, calculatorType) => {
|
|
10370
|
-
const allPercentCategories = calculatorType === 'premium' ? ALL_PERCENT_PREMIUM_CATEGORIES : ALL_PERCENT_STANDARD_CATEGORIES;
|
|
10371
|
-
let updatedCategories = allPercentCategories;
|
|
10372
|
-
if (!isMainCashbackAdded) {
|
|
10373
|
-
return allPercentCategories;
|
|
10374
|
-
}
|
|
10375
|
-
if (isMainCashbackAdded) {
|
|
10376
|
-
updatedCategories = updatedCategories.filter((_) => _.key !== MAIN_CASHBACK_KEY[calculatorType]);
|
|
10377
|
-
}
|
|
10378
|
-
return updatedCategories;
|
|
10379
|
-
};
|
|
10380
|
-
|
|
10381
|
-
const defaultDeleteImage = {
|
|
10382
|
-
src: 'IconDelete.svg',
|
|
10383
|
-
format: 'webp',
|
|
10384
|
-
alt: 'Иконка кнопки удаления блока кэшбека',
|
|
10385
|
-
};
|
|
10386
|
-
const CashbackCategory = JSX(({ categories, cashback, maxInputRange, deleteImage = defaultDeleteImage, isMainCashbackAdded = false, calculatorType = 'standard', onDelete, onChange, isShowDisclaimer = false, onChangeCategory = noop, }) => {
|
|
10315
|
+
const CashbackCategory = JSX(({ categories, cashback, showIncreasedPercents, maxInputRange, deleteImage, onDelete, onChange, }) => {
|
|
10387
10316
|
const [currentCategory, setCurrentCategory] = useState(getRandomElement(categories));
|
|
10388
|
-
const isMainCashback = cashback.
|
|
10389
|
-
const onChangePercent =
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10317
|
+
const isMainCashback = cashback.id === 0;
|
|
10318
|
+
const onChangePercent = (value) => {
|
|
10319
|
+
onChange({
|
|
10320
|
+
...cashback,
|
|
10321
|
+
percent: value,
|
|
10322
|
+
});
|
|
10323
|
+
};
|
|
10324
|
+
const onChangeSum = (value) => {
|
|
10325
|
+
onChange({
|
|
10326
|
+
...cashback,
|
|
10327
|
+
sum: value,
|
|
10328
|
+
});
|
|
10394
10329
|
};
|
|
10395
|
-
return (jsxs("div", { className: "w-full space-y-m", children: [jsxs("div", { className: "space-y-xs", children: [jsx(
|
|
10330
|
+
return (jsxs("div", { className: "w-full space-y-m", children: [jsxs("div", { className: "space-y-xs", children: [jsx(Text, { size: "text-m", color: "text-primary-text", font: "font-light", children: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E" }), jsxs("div", { className: "flex gap-m", children: [jsx(Select, { className: "w-full", isManualInput: isMainCashback, placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E", options: getPercentCategories(isMainCashback, showIncreasedPercents), value: cashback.percent, onChange: onChangePercent }), !isMainCashback ? (jsx(Button, { version: "secondary", onClick: () => onDelete(cashback.id), shape: "round", className: "px-4 rounded-md", children: jsx(Img, { image: deleteImage }) })) : null] })] }), categories?.length && !isMainCashback ? (jsx(Select, { label: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u043F\u043E\u043A\u0443\u043F\u043E\u043A", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u043F\u043E\u043A\u0443\u043F\u043E\u043A", options: categories, value: currentCategory, onChange: setCurrentCategory })) : null, jsx(InputRange, { step: 500, title: "\u0421\u0443\u043C\u043C\u0430 \u043F\u043E\u043A\u0443\u043F\u043E\u043A \u0432 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438", min: 0, max: maxInputRange, value: cashback.sum, onChange: onChangeSum })] }));
|
|
10396
10331
|
});
|
|
10397
10332
|
const getRandomElement = (arr) => arr?.[new Date().getTime().toString().slice(-1)];
|
|
10398
|
-
const
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
[field]: value,
|
|
10402
|
-
});
|
|
10403
|
-
};
|
|
10404
|
-
const updateSelectedCategories = (prev, cashback, value) => {
|
|
10405
|
-
const newItem = { id: cashback.id, category: value };
|
|
10406
|
-
if (prev.length === 0) {
|
|
10407
|
-
return [newItem];
|
|
10333
|
+
const getPercentCategories = (isMainCashback, showIncreasedPercents) => {
|
|
10334
|
+
if (isMainCashback) {
|
|
10335
|
+
return [];
|
|
10408
10336
|
}
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
return
|
|
10337
|
+
else if (showIncreasedPercents) {
|
|
10338
|
+
return AllPercentCategories;
|
|
10339
|
+
}
|
|
10340
|
+
else {
|
|
10341
|
+
return PercentCategoriesWithoutIncreased;
|
|
10414
10342
|
}
|
|
10415
|
-
return [...prev, newItem];
|
|
10416
|
-
};
|
|
10417
|
-
|
|
10418
|
-
const renderButtons = ({ cashbacksLength, onAddNewCashback, onResetCashback, calculatorType = 'standard', maxCategories = MAX_CATEGORIES[calculatorType], }) => {
|
|
10419
|
-
return (jsxs("div", { className: "w-full flex flex-col gap-lg", children: [cashbacksLength < maxCategories ? (jsx(Button, { className: "self-start text-primary-main", embedded: true, version: "secondary", onClick: onAddNewCashback, children: cashbacksLength ? 'Добавить ещё категорию' : 'Добавить категорию' })) : null, cashbacksLength > 2 ? (jsx(Button, { className: "self-start", version: "secondary", onClick: onResetCashback, children: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438" })) : null] }));
|
|
10420
10343
|
};
|
|
10421
10344
|
|
|
10422
|
-
const
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10345
|
+
const DEFAULT_CASHBACK = [
|
|
10346
|
+
{
|
|
10347
|
+
id: 0,
|
|
10348
|
+
percent: {
|
|
10349
|
+
text: 'Категория 1% "На всё"',
|
|
10350
|
+
key: '1',
|
|
10351
|
+
},
|
|
10352
|
+
sum: 5000,
|
|
10353
|
+
},
|
|
10354
|
+
];
|
|
10355
|
+
const useCashbackCalculator = () => {
|
|
10427
10356
|
const { data } = useLeadFormData('CASHBACK_CATEGORY');
|
|
10428
|
-
const [cashbacks, setCashbacks] = useState(
|
|
10429
|
-
const [selectedCategories, setSelectedCategories] = useState([]);
|
|
10357
|
+
const [cashbacks, setCashbacks] = useState(DEFAULT_CASHBACK);
|
|
10430
10358
|
const categories = data?.map((_) => ({
|
|
10431
10359
|
key: _.key || '',
|
|
10432
10360
|
text: _.value,
|
|
10433
10361
|
})) || [];
|
|
10434
|
-
const filteredCategories = useMemo(() => {
|
|
10435
|
-
const categoriesToRemove = selectedCategories.map((obj) => obj.category);
|
|
10436
|
-
const keysToRemove = new Set(categoriesToRemove.map((item) => item.key));
|
|
10437
|
-
return categories.filter((item) => !keysToRemove.has(item.key));
|
|
10438
|
-
}, [selectedCategories, categories]);
|
|
10439
10362
|
const onAddNewCashback = () => setCashbacks((_) => [
|
|
10440
10363
|
..._,
|
|
10441
10364
|
{
|
|
10442
|
-
id: _
|
|
10365
|
+
id: _[_.length - 1].id + 1,
|
|
10443
10366
|
percent: {
|
|
10444
10367
|
text: 'Категория 1,5%',
|
|
10445
10368
|
key: '1.5',
|
|
@@ -10454,15 +10377,14 @@
|
|
|
10454
10377
|
return _;
|
|
10455
10378
|
}));
|
|
10456
10379
|
const onDeleteCashback = (id) => setCashbacks((prev) => prev.filter((_) => _.id !== id));
|
|
10457
|
-
const onResetCashback = () => setCashbacks(
|
|
10380
|
+
const onResetCashback = () => setCashbacks(DEFAULT_CASHBACK);
|
|
10458
10381
|
return {
|
|
10459
10382
|
cashbacks,
|
|
10460
|
-
categories
|
|
10383
|
+
categories,
|
|
10461
10384
|
onAddNewCashback,
|
|
10462
10385
|
onChangeCashback,
|
|
10463
10386
|
onDeleteCashback,
|
|
10464
10387
|
onResetCashback,
|
|
10465
|
-
onChangeCategory: setSelectedCategories,
|
|
10466
10388
|
};
|
|
10467
10389
|
};
|
|
10468
10390
|
|
|
@@ -10471,280 +10393,19 @@
|
|
|
10471
10393
|
text: 'Оформить карту',
|
|
10472
10394
|
target: '_self',
|
|
10473
10395
|
};
|
|
10474
|
-
const
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
const {
|
|
10479
|
-
const
|
|
10480
|
-
|
|
10481
|
-
setIsMainCashbackAdded(Boolean(cashbacks.find((item) => item.percent.key === MAIN_CASHBACK_KEY[calculatorType])));
|
|
10482
|
-
}, [cashbacks]);
|
|
10483
|
-
return (jsx(BlockWrapper, { className: style('flex flex-col justify-center items-center gap-lg', className), defaultPadding: style('p-0'), ...rest, children: jsxs("div", { className: "flex flex-row items-start gap-lg mt-5", children: [jsxs("div", { className: "w-full flex flex-col justify-center items-center gap-lg", children: [cashbacks.length
|
|
10484
|
-
? cashbacks.map((_, index) => (jsx(CashbackCategory, { categories: categories, cashback: _, maxInputRange: maxInputRange, deleteImage: deleteImage, onDelete: onDeleteCashback, onChange: onChangeCashback, isMainCashbackAdded: isMainCashbackAdded, calculatorType: calculatorType, isShowDisclaimer: index === 0, onChangeCategory: onChangeCategory }, String(_.id))))
|
|
10485
|
-
: renderNoCategoryText(), renderButtons({
|
|
10486
|
-
cashbacksLength: cashbacks.length,
|
|
10487
|
-
onAddNewCashback: onAddNewCashback,
|
|
10488
|
-
onResetCashback: onResetCashback,
|
|
10489
|
-
calculatorType: calculatorType,
|
|
10490
|
-
maxCategories,
|
|
10491
|
-
}), jsx(CashbackCalculatorResult, { cashbacks: cashbacks, maxMonthCashback: maxMonthCashback }), jsx(InfoCard, { __html: INFO_BLOCK_HTML, image: infoImage }), jsx(RichText, { __html: '* \u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435 \u043F\u043E \u0443\u0441\u043B\u043E\u0432\u0438\u044F\u043C \u0438 \u043D\u0430\u0447\u0438\u0441\u043B\u0435\u043D\u0438\u044F\u043C \u043C\u043E\u0436\u043D\u043E \u0443\u0437\u043D\u0430\u0442\u044C \u0432\u043E \u0432\u043A\u043B\u0430\u0434\u043A\u0435 <a href="#docs">\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B</a>' }), jsx(LinkButton, { className: "w-full @lg:w-auto self-start", href: button.href, text: button.text, target: button.target, version: "primary" })] }), renderImage(image)] }) }));
|
|
10492
|
-
});
|
|
10493
|
-
const renderNoCategoryText = () => (jsx(Text, { align: "text-left", className: "w-full", children: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u0430" }));
|
|
10494
|
-
const renderImage = (image = {}) => image?.src ? (jsx(Img, { image: image, className: "hidden w-full @xl:block", imageClassName: "justify-self-center" })) : null;
|
|
10495
|
-
|
|
10496
|
-
const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
|
|
10497
|
-
|
|
10498
|
-
const badgeBgStyleMap = {
|
|
10499
|
-
primary: 'bg-white/30',
|
|
10500
|
-
secondary: 'bg-main-divider',
|
|
10501
|
-
};
|
|
10502
|
-
const badgeTextColorStyleMap = {
|
|
10503
|
-
primary: { desktop: 'text-white', mobile: 'text-primary-text' },
|
|
10504
|
-
secondary: { desktop: 'text-secondary-text', mobile: 'text-secondary-text' },
|
|
10505
|
-
};
|
|
10506
|
-
const Badge = JSX(({ count, version = 'secondary' }) => {
|
|
10507
|
-
const isMobileMode = useMobileMode();
|
|
10508
|
-
const badgeBgStyle = isMobileMode ? 'bg-main-divider' : badgeBgStyleMap[version];
|
|
10509
|
-
const textStyle = badgeTextColorStyleMap[version][isMobileMode ? 'mobile' : 'desktop'];
|
|
10510
|
-
return (jsx("div", { className: style('w-6 h-6 rounded-full flex items-center justify-center', badgeBgStyle), role: "status", "aria-label": `Количество ${count} доступных программ и сервисов`, children: jsx(Text, { size: "text-xs", color: textStyle, children: count }) }));
|
|
10396
|
+
const INCREASED_PERCENTS = ['5', '10', '15'];
|
|
10397
|
+
const MAX_CATEGORIES = 5;
|
|
10398
|
+
const INFO_BLOCK_HTML = `<p>Полученные баллы можно конвертировать в рубли и компенсировать покупки у партнеров. Подробнее в <a href='#docs'>документах</a></p>`;
|
|
10399
|
+
const CashbackCalculator = JSX(({ maxInputRange = 300000, image, deleteImage, infoImage, className = '', button = defaultButton, ...rest }) => {
|
|
10400
|
+
const { cashbacks, categories, onAddNewCashback, onChangeCashback, onDeleteCashback, onResetCashback, } = useCashbackCalculator();
|
|
10401
|
+
const img = image?.src ? (jsx(Img, { image: image, className: "hidden w-full @xl:block", imageClassName: "justify-self-center" })) : null;
|
|
10402
|
+
return (jsxs(BlockWrapper, { className: style('flex flex-col justify-center items-center gap-lg', className), defaultPadding: style('p-6xl'), ...rest, children: [jsx(Headline, { title: "\u041A\u0430\u043B\u044C\u043A\u0443\u043B\u044F\u0442\u043E\u0440 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0431\u0430\u043B\u043B\u043E\u0432", description: "\u041C\u043E\u0436\u043D\u043E \u0432\u044B\u0431\u0440\u0430\u0442\u044C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435 5 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0439, \u043E\u0434\u043D\u0430 \u0438\u0437 \u043D\u0438\u0445 \u0438\u0437 \u043F\u043E\u0432\u044B\u0448\u0435\u043D\u043D\u043E\u0439 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438", headlineVersion: "XL", isEmbedded: true }), jsxs("div", { className: "flex flex-row items-start gap-lg", children: [jsxs("div", { className: "w-full flex flex-col justify-center items-center gap-lg", children: [cashbacks.map((_) => (jsx(CashbackCategory, { categories: categories, cashback: _, showIncreasedPercents: showIncreasedPercents(_, cashbacks), maxInputRange: maxInputRange, deleteImage: deleteImage, onDelete: onDeleteCashback, onChange: onChangeCashback }, String(_.id)))), renderButtons(cashbacks.length, onAddNewCashback, onResetCashback), jsx(CashbackCalculatorResult, { cashbacks: cashbacks }), jsx(InfoCard, { __html: INFO_BLOCK_HTML, image: infoImage }), jsx(LinkButton, { className: "w-full @lg:w-auto self-start", href: button.href, text: button.text, target: button.target, version: "primary" })] }), img] })] }));
|
|
10511
10403
|
});
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
btn: `w-96 ${isActive ? 'p-m border-none bg-primary-main text-white' : 'p-s ease-in duration-300 bg-white'}`,
|
|
10515
|
-
text: isActive ? 'mb-xs text-xl' : 'mb-2xs text-l text-primary-text',
|
|
10516
|
-
desc: `font-light ${isActive ? 'text-l text-white' : 'text-m text-secondary-text'}`,
|
|
10517
|
-
icon: isActive ? '' : 'text-primary-main',
|
|
10518
|
-
iconVersion: (isActive ? 'white' : 'normal'),
|
|
10519
|
-
oldText: 'text-m text-center',
|
|
10520
|
-
oldDesc: 'text-m-light',
|
|
10521
|
-
});
|
|
10522
|
-
const renderTabItemInner = ({ text, description, icon, isActive, type, }) => {
|
|
10523
|
-
const buttonClassNames = getButtonClassNames(isActive);
|
|
10524
|
-
return (jsxs("div", { className: style('cursor-pointer text-left border-b-0 flex gap-2xs'), "aria-label": text, "aria-labelledby": `${text}-label`, children: [icon ? (jsx(Img, { className: style('h-6 w-6 min-w-6 min-h-6', buttonClassNames.icon), image: {
|
|
10525
|
-
...icon,
|
|
10526
|
-
iconVersion: icon?.iconVersion ?? buttonClassNames.iconVersion,
|
|
10527
|
-
}, width: "24", height: "24", alt: text })) : null, jsxs("div", { className: "border-0", children: [jsx("div", { className: type === 'animated' ? buttonClassNames.text : buttonClassNames.oldText, children: text }), jsx("div", { className: type === 'animated' ? buttonClassNames.desc : buttonClassNames.oldDesc, children: description })] })] }));
|
|
10404
|
+
const renderButtons = (cashbacksLength, onAddNewCashback, onResetCashback) => {
|
|
10405
|
+
return (jsxs("div", { className: "w-full flex flex-col gap-lg", children: [cashbacksLength < MAX_CATEGORIES ? (jsx(Button, { className: "self-start text-primary-main", embedded: true, version: "secondary", onClick: onAddNewCashback, children: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0435\u0449\u0435" })) : null, cashbacksLength > 2 ? (jsx(Button, { className: "self-start", version: "secondary", onClick: onResetCashback, children: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438" })) : null] }));
|
|
10528
10406
|
};
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
default: 'px-xs',
|
|
10532
|
-
underlined: 'px-m',
|
|
10533
|
-
animated: 'px-m border border-gray cursor-pointer text-left border-b-0 mt-auto flex gap-2xs',
|
|
10534
|
-
};
|
|
10535
|
-
const tabTextStyle = 'text-secondary-text hover:text-primary-main';
|
|
10536
|
-
const activeTabTextStyleMap = {
|
|
10537
|
-
default: 'text-white',
|
|
10538
|
-
underlined: 'text-primary-main border-b-2',
|
|
10539
|
-
animated: 'text-white sm:text-white',
|
|
10540
|
-
};
|
|
10541
|
-
const tabBgStyleMap = {
|
|
10542
|
-
default: 'bg-white',
|
|
10543
|
-
underlined: 'bg-white',
|
|
10544
|
-
animated: 'p-1 ease-in duration-300 bg-white text-primary-text h-[70px] w-96',
|
|
10545
|
-
};
|
|
10546
|
-
const activeTabBgStyleMap = {
|
|
10547
|
-
default: 'bg-primary-main',
|
|
10548
|
-
underlined: 'bg-white',
|
|
10549
|
-
animated: 'p-2 border-none bg-primary-main text-white h-20 w-96',
|
|
10550
|
-
};
|
|
10551
|
-
const TabItemInner = JSX(({ tag = 'div', item = {}, isActive = false, type = 'default', onClick }) => {
|
|
10552
|
-
const Tag = tag;
|
|
10553
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10554
|
-
const { text, description, icon, count, tabName, ...link } = item;
|
|
10555
|
-
return (jsx(Tag, { className: style('h-12', 'block flex-1', 'cursor-pointer', 'rounded-none', tabPaddingStyleMap[type], isActive ? activeTabBgStyleMap[type] : tabBgStyleMap[type]), "aria-label": "\u0421\u043F\u0438\u0441\u043E\u043A \u0442\u0430\u0431\u043E\u0432", onClick: onClick, ...link, children: jsxs("div", { className: style('h-full', 'flex justify-center items-center', 'text-center whitespace-nowrap', isActive ? activeTabTextStyleMap[type] : tabTextStyle), role: "tab", "aria-label": `Таб ${text}`, children: [renderTabItemInner({
|
|
10556
|
-
text,
|
|
10557
|
-
description,
|
|
10558
|
-
icon,
|
|
10559
|
-
isActive,
|
|
10560
|
-
type,
|
|
10561
|
-
}), Number.isInteger(count) ? (jsx("div", { className: "ml-xs", role: "status", "aria-label": `Количество программ и сервисов ${count}`, children: jsx(Badge, { count: count, version: getVersion(isActive, type) }) })) : null] }) }));
|
|
10562
|
-
});
|
|
10563
|
-
|
|
10564
|
-
const TabItem = JSX((props) => props?.item?.href ? jsx(LinkTabItem, { ...props }) : jsx(ButtonTabItem, { ...props }));
|
|
10565
|
-
const LinkTabItem = JSX((props) => {
|
|
10566
|
-
const link = useLink();
|
|
10567
|
-
const handleClick = useCallback(() => {
|
|
10568
|
-
props.onClick && props.onClick(props.item || {});
|
|
10569
|
-
}, [props.onClick, props.item]);
|
|
10570
|
-
const { onClick, ...item } = link({ ...props.item, onClick: handleClick });
|
|
10571
|
-
return jsx(TabItemInner, { ...props, tag: "a", item: item, onClick: onClick });
|
|
10572
|
-
});
|
|
10573
|
-
// TODO: Update handlerDecorator (support buttons?)
|
|
10574
|
-
const ButtonTabItem = JSX(({ item = {}, onClick, ...rest }) => {
|
|
10575
|
-
const handleClick = useCallback((e) => {
|
|
10576
|
-
e.target.scrollIntoView({ block: 'nearest' });
|
|
10577
|
-
onClick?.(item);
|
|
10578
|
-
}, [onClick, item]);
|
|
10579
|
-
return jsx(TabItemInner, { item: item, onClick: handleClick, ...rest });
|
|
10580
|
-
});
|
|
10581
|
-
|
|
10582
|
-
const renderTab = (activeTab, onClick, type) => (tab, i) => (jsx(TabItem, { isActive: tab === activeTab, onClick: onClick, type: type, item: tab }, String(i)));
|
|
10583
|
-
|
|
10584
|
-
const scrollButtonStyle = 'hidden sm:flex absolute z-40';
|
|
10585
|
-
const scrollStyle = {
|
|
10586
|
-
default: {
|
|
10587
|
-
item: 'flex-1',
|
|
10588
|
-
gap: 0,
|
|
10589
|
-
buttonTop: 'top-0',
|
|
10590
|
-
},
|
|
10591
|
-
animated: {
|
|
10592
|
-
item: 'flex',
|
|
10593
|
-
gap: 8,
|
|
10594
|
-
buttonTop: 'top-5',
|
|
10595
|
-
},
|
|
10596
|
-
underlined: {
|
|
10597
|
-
item: '',
|
|
10598
|
-
gap: 0,
|
|
10599
|
-
buttonTop: 'top-0',
|
|
10600
|
-
},
|
|
10601
|
-
};
|
|
10602
|
-
const ScrollableTabsControl = JSX(({ className, items = [], activeItem, onChange, tabsType = 'default' }) => {
|
|
10603
|
-
const [containerRef, scroll] = useSwipeListScroll({
|
|
10604
|
-
itemCount: items?.length || 0,
|
|
10605
|
-
});
|
|
10606
|
-
useEffect(() => scrollToSelected(containerRef.current, items, activeItem), []);
|
|
10607
|
-
return (jsxs("div", { className: style('relative overflow-x-auto no-scrollbar', className), children: [jsx(SwipeListContainer, { containerRef: containerRef, snapAlign: "snap-start", onVisibleIndicesChange: scroll.handleVisibleIndicesChange, itemClassName: scrollStyle[tabsType].item, gap: scrollStyle[tabsType].gap, children: items.map(renderTab(activeItem, onChange, tabsType)) }), scroll.canScrollLeft ? (jsx(ArrowLeftButton, { wcmsIgnore: true, className: style('left-6', scrollButtonStyle, scrollStyle[tabsType].buttonTop), onClick: scroll.scrollLeft })) : null, scroll.canScrollRight ? (jsx(ArrowRightButton, { wcmsIgnore: true, className: style('right-6', scrollButtonStyle, scrollStyle[tabsType].buttonTop), onClick: scroll.scrollRight })) : null] }));
|
|
10608
|
-
});
|
|
10609
|
-
const scrollToSelected = (container, items, activeItem) => {
|
|
10610
|
-
const selectedIndex = items.findIndex((_) => _ === activeItem);
|
|
10611
|
-
if (container && selectedIndex > 0) {
|
|
10612
|
-
container.scrollTo({
|
|
10613
|
-
left: container?.children[selectedIndex]?.offsetLeft,
|
|
10614
|
-
behavior: 'smooth',
|
|
10615
|
-
});
|
|
10616
|
-
}
|
|
10617
|
-
};
|
|
10618
|
-
|
|
10619
|
-
const tabsStyle = {
|
|
10620
|
-
default: {
|
|
10621
|
-
wrapper: '',
|
|
10622
|
-
component: '',
|
|
10623
|
-
},
|
|
10624
|
-
animated: {
|
|
10625
|
-
wrapper: 'border-b-8 border-primary-main bg-white',
|
|
10626
|
-
component: 'm-auto',
|
|
10627
|
-
},
|
|
10628
|
-
underlined: {
|
|
10629
|
-
wrapper: 'flex',
|
|
10630
|
-
component: 'm-auto',
|
|
10631
|
-
},
|
|
10632
|
-
};
|
|
10633
|
-
const renderTabsLayout = ({ className = '', tabsType = 'animated', ...props }) => tabsType ? (jsx("div", { className: style(tabsStyle[tabsType].wrapper, className), children: jsx(ScrollableTabsControl, { className: tabsStyle[tabsType].component, tabsType: tabsType, ...props }) })) : null;
|
|
10634
|
-
|
|
10635
|
-
const STICKY_STYLE = 'sticky top-1 z-20';
|
|
10636
|
-
const TabsLayout = UniBlock(
|
|
10637
|
-
// eslint-disable-next-line max-lines-per-function
|
|
10638
|
-
({ className = '', tabs = [], block, tabsType, showCounter = false, isSticky = false, ...rest }) => {
|
|
10639
|
-
const id = getId(block || {});
|
|
10640
|
-
const router = useRouter();
|
|
10641
|
-
const isFrame = isIFrame();
|
|
10642
|
-
const isEveryLink = tabs.every((_) => _?.type === 'link');
|
|
10643
|
-
const query = new URLSearchParams(decodeURIComponent(globalThis?.location?.search || ''));
|
|
10644
|
-
const tabId = getTabId(id);
|
|
10645
|
-
const tabsCounted = showCounter
|
|
10646
|
-
? tabs.map((_) => ({
|
|
10647
|
-
..._,
|
|
10648
|
-
count: _?.type === 'group' ? block?.slots?.[_?.tabName ?? '']?.length ?? 0 : 0,
|
|
10649
|
-
}))
|
|
10650
|
-
: tabs;
|
|
10651
|
-
const defaultSelectedTabIndex = tabsCounted.findIndex((_) => Boolean(_?.selected));
|
|
10652
|
-
const defaultQueryTabIndex = tabsCounted.findIndex((_, i) => _.type === 'group' && (_?.tabName ?? String(i)) === tabId);
|
|
10653
|
-
const defaultTabIndex = tabId ? defaultQueryTabIndex : defaultSelectedTabIndex;
|
|
10654
|
-
const [activeTabIndex, setActiveTabIndex] = useState(getDefaultIndex(defaultTabIndex));
|
|
10655
|
-
const activeItem = tabsCounted[activeTabIndex];
|
|
10656
|
-
const slotName = getSlotName(tabsCounted[activeTabIndex], activeTabIndex);
|
|
10657
|
-
const updateUrlSearchTabParam = (_, i) => {
|
|
10658
|
-
if (_.text) {
|
|
10659
|
-
query.set(id, _?.tabName ?? String(i));
|
|
10660
|
-
}
|
|
10661
|
-
else {
|
|
10662
|
-
query.delete(id);
|
|
10663
|
-
}
|
|
10664
|
-
router.replace(`${router.pathname}?${query}`, { scroll: false });
|
|
10665
|
-
};
|
|
10666
|
-
const handleChange = useCallback((_) => {
|
|
10667
|
-
const index = tabsCounted.indexOf(_);
|
|
10668
|
-
const tab = tabsCounted[index];
|
|
10669
|
-
setActiveTabIndex(index);
|
|
10670
|
-
if (tab.type === 'group') {
|
|
10671
|
-
updateUrlSearchTabParam(_, index);
|
|
10672
|
-
}
|
|
10673
|
-
}, [tabsCounted]);
|
|
10674
|
-
return (jsxs(BlockWrapper, { className: style({ [STICKY_STYLE]: [isSticky, isEveryLink, !isFrame].every(Boolean) }, className), defaultPadding: "p-0", block: block, ...rest, children: [renderTabsLayout({
|
|
10675
|
-
className: style({
|
|
10676
|
-
'pb-1': [block?.slots, tabsType === 'default'].every(Boolean),
|
|
10677
|
-
[STICKY_STYLE]: [isSticky, !isEveryLink, !isFrame].every(Boolean),
|
|
10678
|
-
}),
|
|
10679
|
-
items: getItems(tabs, tabsCounted),
|
|
10680
|
-
activeItem,
|
|
10681
|
-
tabsType,
|
|
10682
|
-
onChange: handleChange,
|
|
10683
|
-
}), jsx("div", { className: "space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: Object.entries(block?.slots ?? {}).map(([key, value]) => renderBlocksList(value, {
|
|
10684
|
-
...rest?.options,
|
|
10685
|
-
slotName,
|
|
10686
|
-
parent: block,
|
|
10687
|
-
extraProps: { className: key === slotName ? '' : 'hidden' },
|
|
10688
|
-
})) })] }));
|
|
10689
|
-
}, {
|
|
10690
|
-
slots: ({ tabs }) => tabs?.map(getSlotName)?.filter(Boolean) || [],
|
|
10691
|
-
});
|
|
10692
|
-
const getDefaultIndex = (index) => (index && index !== -1 ? index : 0);
|
|
10693
|
-
const getId = ({ __id, anchor }) => anchor ?? __id ?? 'tabs';
|
|
10694
|
-
const getItems = (tabs, tabsCounted) => (tabsCounted?.length ? tabsCounted : tabs);
|
|
10695
|
-
const getSlotName = (tab, index) => tab?.type === 'group' ? tab?.tabName || `Слот №${index + 1}` : '';
|
|
10696
|
-
const getTabId = (id) => decodeURIComponent(globalThis?.location?.search
|
|
10697
|
-
.replace('?', '')
|
|
10698
|
-
.replace('+', ' ')
|
|
10699
|
-
.split('&')
|
|
10700
|
-
.find((_) => _.split('=').find((param) => param === id))
|
|
10701
|
-
?.split('=')?.[1] ?? '');
|
|
10702
|
-
|
|
10703
|
-
const CALCULATOR_TABS = [
|
|
10704
|
-
{
|
|
10705
|
-
type: 'group',
|
|
10706
|
-
description: 'с остатками на счетах до 2 999 999,99 руб*',
|
|
10707
|
-
text: 'Стандарт',
|
|
10708
|
-
tabName: 'standard',
|
|
10709
|
-
selected: true,
|
|
10710
|
-
},
|
|
10711
|
-
{
|
|
10712
|
-
type: 'group',
|
|
10713
|
-
description: 'с остатками на счетах от 3 000 000,00 руб*',
|
|
10714
|
-
text: 'Престиж',
|
|
10715
|
-
tabName: 'premium',
|
|
10716
|
-
selected: false,
|
|
10717
|
-
},
|
|
10718
|
-
];
|
|
10719
|
-
const defaultInfoImage = {
|
|
10720
|
-
src: 'IconExchange.svg',
|
|
10721
|
-
format: 'webp',
|
|
10722
|
-
alt: 'Иконка информационного блока',
|
|
10723
|
-
};
|
|
10724
|
-
const CashbackCalculatorLayout = JSX(({ premiumCalculatorParams = {}, standardCalculatorParams = {}, image, deleteImage, infoImage = defaultInfoImage, button, className = '', options, title, description, subtitle, ...rest }) => {
|
|
10725
|
-
const calculatorProps = {
|
|
10726
|
-
button,
|
|
10727
|
-
deleteImage,
|
|
10728
|
-
infoImage,
|
|
10729
|
-
image,
|
|
10730
|
-
};
|
|
10731
|
-
const CalculatorStandardBlock = createCalculatorBlock('standard', calculatorProps, standardCalculatorParams);
|
|
10732
|
-
const CalculatorPremiumBlock = createCalculatorBlock('premium', calculatorProps, premiumCalculatorParams);
|
|
10733
|
-
const slots = {
|
|
10734
|
-
standard: [CalculatorStandardBlock],
|
|
10735
|
-
premium: [CalculatorPremiumBlock],
|
|
10736
|
-
};
|
|
10737
|
-
return (jsxs(BlockWrapper, { className: style('flex flex-col justify-center items-center gap-lg', className), defaultPadding: style('p-6xl'), ...rest, children: [jsx(Headline, { title: title, headlineVersion: "XL", isEmbedded: true }), jsx(RichText, { __html: description, className: "text-center" }), jsx(Paragraph, { children: subtitle }), jsx("div", { className: "container grid grid-cols-12", children: jsx(TabsLayout, { className: "col-span-12", tabsType: "animated", tabs: CALCULATOR_TABS, block: { slots }, options: options }) })] }));
|
|
10738
|
-
});
|
|
10739
|
-
const createCalculatorBlock = (calculatorType, calculatorProps, calculatorParams) => ({
|
|
10740
|
-
type: 'CashbackCalculator',
|
|
10741
|
-
content: {
|
|
10742
|
-
calculatorType: calculatorType,
|
|
10743
|
-
...calculatorProps,
|
|
10744
|
-
...calculatorParams,
|
|
10745
|
-
},
|
|
10746
|
-
style: ['col-span-12'],
|
|
10747
|
-
});
|
|
10407
|
+
const showIncreasedPercents = (currentCashback, cashback) => INCREASED_PERCENTS.includes(currentCashback.percent.key) ||
|
|
10408
|
+
!cashback.some((_) => INCREASED_PERCENTS.includes(_.percent.key));
|
|
10748
10409
|
|
|
10749
10410
|
const ContactsBlock = JSX(({ className, contacts, info, version = 'secondary', ...rest }) => (jsxs(BlockWrapper, { className: style('flex', className), defaultPadding: "p-6xl", version: version, ...rest, children: [info?.length ? renderBlocks(info) : null, contacts?.length ? renderBlocks(contacts) : null] })));
|
|
10750
10411
|
const renderBlocks = (info) => (jsx("div", { className: "flex gap-5xl grow basis-0", children: info.map((column, i) => renderBlocksColumn({ column, i })) }));
|
|
@@ -14353,6 +14014,8 @@
|
|
|
14353
14014
|
return (jsx("div", { children: filters.length > 0 ? (jsxs("div", { className: "space-y-s", children: [jsx(Text, { children: text }), jsx("div", { className: COMMON_FILTERS_STYLES, children: filters })] })) : null }));
|
|
14354
14015
|
};
|
|
14355
14016
|
|
|
14017
|
+
const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
|
|
14018
|
+
|
|
14356
14019
|
const renderButtonsGroup = (data, activeButton, onButtonClick) => {
|
|
14357
14020
|
const allButtonVersion = getVersion(activeButton === 'all');
|
|
14358
14021
|
const businessButtonVersion = getVersion(activeButton === 'business');
|
|
@@ -14762,6 +14425,211 @@
|
|
|
14762
14425
|
|
|
14763
14426
|
const StickyBottomMenu = JSX(() => (jsx("div", { className: "hidden", role: "none" })));
|
|
14764
14427
|
|
|
14428
|
+
const badgeBgStyleMap = {
|
|
14429
|
+
primary: 'bg-white/30',
|
|
14430
|
+
secondary: 'bg-main-divider',
|
|
14431
|
+
};
|
|
14432
|
+
const badgeTextColorStyleMap = {
|
|
14433
|
+
primary: { desktop: 'text-white', mobile: 'text-primary-text' },
|
|
14434
|
+
secondary: { desktop: 'text-secondary-text', mobile: 'text-secondary-text' },
|
|
14435
|
+
};
|
|
14436
|
+
const Badge = JSX(({ count, version = 'secondary' }) => {
|
|
14437
|
+
const isMobileMode = useMobileMode();
|
|
14438
|
+
const badgeBgStyle = isMobileMode ? 'bg-main-divider' : badgeBgStyleMap[version];
|
|
14439
|
+
const textStyle = badgeTextColorStyleMap[version][isMobileMode ? 'mobile' : 'desktop'];
|
|
14440
|
+
return (jsx("div", { className: style('w-6 h-6 rounded-full flex items-center justify-center', badgeBgStyle), role: "status", "aria-label": `Количество ${count} доступных программ и сервисов`, children: jsx(Text, { size: "text-xs", color: textStyle, children: count }) }));
|
|
14441
|
+
});
|
|
14442
|
+
|
|
14443
|
+
const getButtonClassNames = (isActive) => ({
|
|
14444
|
+
btn: `w-96 ${isActive ? 'p-m border-none bg-primary-main text-white' : 'p-s ease-in duration-300 bg-white'}`,
|
|
14445
|
+
text: isActive ? 'mb-xs text-xl' : 'mb-2xs text-l text-primary-text',
|
|
14446
|
+
desc: `font-light ${isActive ? 'text-l text-white' : 'text-m text-secondary-text'}`,
|
|
14447
|
+
icon: isActive ? '' : 'text-primary-main',
|
|
14448
|
+
iconVersion: (isActive ? 'white' : 'normal'),
|
|
14449
|
+
oldText: 'text-m text-center',
|
|
14450
|
+
oldDesc: 'text-m-light',
|
|
14451
|
+
});
|
|
14452
|
+
const renderTabItemInner = ({ text, description, icon, isActive, type, }) => {
|
|
14453
|
+
const buttonClassNames = getButtonClassNames(isActive);
|
|
14454
|
+
return (jsxs("div", { className: style('cursor-pointer text-left border-b-0 flex gap-2xs'), "aria-label": text, "aria-labelledby": `${text}-label`, children: [icon ? (jsx(Img, { className: style('h-6 w-6 min-w-6 min-h-6', buttonClassNames.icon), image: {
|
|
14455
|
+
...icon,
|
|
14456
|
+
iconVersion: icon?.iconVersion ?? buttonClassNames.iconVersion,
|
|
14457
|
+
}, width: "24", height: "24", alt: text })) : null, jsxs("div", { className: "border-0", children: [jsx("div", { className: type === 'animated' ? buttonClassNames.text : buttonClassNames.oldText, children: text }), jsx("div", { className: type === 'animated' ? buttonClassNames.desc : buttonClassNames.oldDesc, children: description })] })] }));
|
|
14458
|
+
};
|
|
14459
|
+
|
|
14460
|
+
const tabPaddingStyleMap = {
|
|
14461
|
+
default: 'px-xs',
|
|
14462
|
+
underlined: 'px-m',
|
|
14463
|
+
animated: 'px-m border border-gray cursor-pointer text-left border-b-0 mt-auto flex gap-2xs',
|
|
14464
|
+
};
|
|
14465
|
+
const tabTextStyle = 'text-secondary-text hover:text-primary-main';
|
|
14466
|
+
const activeTabTextStyleMap = {
|
|
14467
|
+
default: 'text-white',
|
|
14468
|
+
underlined: 'text-primary-main border-b-2',
|
|
14469
|
+
animated: 'text-white sm:text-white',
|
|
14470
|
+
};
|
|
14471
|
+
const tabBgStyleMap = {
|
|
14472
|
+
default: 'bg-white',
|
|
14473
|
+
underlined: 'bg-white',
|
|
14474
|
+
animated: 'p-1 ease-in duration-300 bg-white text-primary-text h-[70px] w-96',
|
|
14475
|
+
};
|
|
14476
|
+
const activeTabBgStyleMap = {
|
|
14477
|
+
default: 'bg-primary-main',
|
|
14478
|
+
underlined: 'bg-white',
|
|
14479
|
+
animated: 'p-2 border-none bg-primary-main text-white h-20 w-96',
|
|
14480
|
+
};
|
|
14481
|
+
const TabItemInner = JSX(({ tag = 'div', item = {}, isActive = false, type = 'default', onClick }) => {
|
|
14482
|
+
const Tag = tag;
|
|
14483
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14484
|
+
const { text, description, icon, count, tabName, ...link } = item;
|
|
14485
|
+
return (jsx(Tag, { className: style('h-12', 'block flex-1', 'cursor-pointer', 'rounded-none', tabPaddingStyleMap[type], isActive ? activeTabBgStyleMap[type] : tabBgStyleMap[type]), "aria-label": "\u0421\u043F\u0438\u0441\u043E\u043A \u0442\u0430\u0431\u043E\u0432", onClick: onClick, ...link, children: jsxs("div", { className: style('h-full', 'flex justify-center items-center', 'text-center whitespace-nowrap', isActive ? activeTabTextStyleMap[type] : tabTextStyle), role: "tab", "aria-label": `Таб ${text}`, children: [renderTabItemInner({
|
|
14486
|
+
text,
|
|
14487
|
+
description,
|
|
14488
|
+
icon,
|
|
14489
|
+
isActive,
|
|
14490
|
+
type,
|
|
14491
|
+
}), Number.isInteger(count) ? (jsx("div", { className: "ml-xs", role: "status", "aria-label": `Количество программ и сервисов ${count}`, children: jsx(Badge, { count: count, version: getVersion(isActive, type) }) })) : null] }) }));
|
|
14492
|
+
});
|
|
14493
|
+
|
|
14494
|
+
const TabItem = JSX((props) => props?.item?.href ? jsx(LinkTabItem, { ...props }) : jsx(ButtonTabItem, { ...props }));
|
|
14495
|
+
const LinkTabItem = JSX((props) => {
|
|
14496
|
+
const link = useLink();
|
|
14497
|
+
const handleClick = useCallback(() => {
|
|
14498
|
+
props.onClick && props.onClick(props.item || {});
|
|
14499
|
+
}, [props.onClick, props.item]);
|
|
14500
|
+
const { onClick, ...item } = link({ ...props.item, onClick: handleClick });
|
|
14501
|
+
return jsx(TabItemInner, { ...props, tag: "a", item: item, onClick: onClick });
|
|
14502
|
+
});
|
|
14503
|
+
// TODO: Update handlerDecorator (support buttons?)
|
|
14504
|
+
const ButtonTabItem = JSX(({ item = {}, onClick, ...rest }) => {
|
|
14505
|
+
const handleClick = useCallback((e) => {
|
|
14506
|
+
e.target.scrollIntoView({ block: 'nearest' });
|
|
14507
|
+
onClick?.(item);
|
|
14508
|
+
}, [onClick, item]);
|
|
14509
|
+
return jsx(TabItemInner, { item: item, onClick: handleClick, ...rest });
|
|
14510
|
+
});
|
|
14511
|
+
|
|
14512
|
+
const renderTab = (activeTab, onClick, type) => (tab, i) => (jsx(TabItem, { isActive: tab === activeTab, onClick: onClick, type: type, item: tab }, String(i)));
|
|
14513
|
+
|
|
14514
|
+
const scrollButtonStyle = 'hidden sm:flex absolute z-40';
|
|
14515
|
+
const scrollStyle = {
|
|
14516
|
+
default: {
|
|
14517
|
+
item: 'flex-1',
|
|
14518
|
+
gap: 0,
|
|
14519
|
+
buttonTop: 'top-0',
|
|
14520
|
+
},
|
|
14521
|
+
animated: {
|
|
14522
|
+
item: 'flex',
|
|
14523
|
+
gap: 8,
|
|
14524
|
+
buttonTop: 'top-5',
|
|
14525
|
+
},
|
|
14526
|
+
underlined: {
|
|
14527
|
+
item: '',
|
|
14528
|
+
gap: 0,
|
|
14529
|
+
buttonTop: 'top-0',
|
|
14530
|
+
},
|
|
14531
|
+
};
|
|
14532
|
+
const ScrollableTabsControl = JSX(({ className, items = [], activeItem, onChange, tabsType = 'default' }) => {
|
|
14533
|
+
const [containerRef, scroll] = useSwipeListScroll({
|
|
14534
|
+
itemCount: items?.length || 0,
|
|
14535
|
+
});
|
|
14536
|
+
useEffect(() => scrollToSelected(containerRef.current, items, activeItem), []);
|
|
14537
|
+
return (jsxs("div", { className: style('relative overflow-x-auto no-scrollbar', className), children: [jsx(SwipeListContainer, { containerRef: containerRef, snapAlign: "snap-start", onVisibleIndicesChange: scroll.handleVisibleIndicesChange, itemClassName: scrollStyle[tabsType].item, gap: scrollStyle[tabsType].gap, children: items.map(renderTab(activeItem, onChange, tabsType)) }), scroll.canScrollLeft ? (jsx(ArrowLeftButton, { wcmsIgnore: true, className: style('left-6', scrollButtonStyle, scrollStyle[tabsType].buttonTop), onClick: scroll.scrollLeft })) : null, scroll.canScrollRight ? (jsx(ArrowRightButton, { wcmsIgnore: true, className: style('right-6', scrollButtonStyle, scrollStyle[tabsType].buttonTop), onClick: scroll.scrollRight })) : null] }));
|
|
14538
|
+
});
|
|
14539
|
+
const scrollToSelected = (container, items, activeItem) => {
|
|
14540
|
+
const selectedIndex = items.findIndex((_) => _ === activeItem);
|
|
14541
|
+
if (container && selectedIndex > 0) {
|
|
14542
|
+
container.scrollTo({
|
|
14543
|
+
left: container?.children[selectedIndex]?.offsetLeft,
|
|
14544
|
+
behavior: 'smooth',
|
|
14545
|
+
});
|
|
14546
|
+
}
|
|
14547
|
+
};
|
|
14548
|
+
|
|
14549
|
+
const tabsStyle = {
|
|
14550
|
+
default: {
|
|
14551
|
+
wrapper: '',
|
|
14552
|
+
component: '',
|
|
14553
|
+
},
|
|
14554
|
+
animated: {
|
|
14555
|
+
wrapper: 'border-b-8 border-primary-main bg-white',
|
|
14556
|
+
component: 'm-auto',
|
|
14557
|
+
},
|
|
14558
|
+
underlined: {
|
|
14559
|
+
wrapper: 'flex',
|
|
14560
|
+
component: 'm-auto',
|
|
14561
|
+
},
|
|
14562
|
+
};
|
|
14563
|
+
const renderTabsLayout = ({ className = '', tabsType = 'animated', ...props }) => tabsType ? (jsx("div", { className: style(tabsStyle[tabsType].wrapper, className), children: jsx(ScrollableTabsControl, { className: tabsStyle[tabsType].component, tabsType: tabsType, ...props }) })) : null;
|
|
14564
|
+
|
|
14565
|
+
const STICKY_STYLE = 'sticky top-1 z-20';
|
|
14566
|
+
const TabsLayout = UniBlock(
|
|
14567
|
+
// eslint-disable-next-line max-lines-per-function
|
|
14568
|
+
({ className = '', tabs = [], block, tabsType, showCounter = false, isSticky = false, ...rest }) => {
|
|
14569
|
+
const id = getId(block || {});
|
|
14570
|
+
const router = useRouter();
|
|
14571
|
+
const isFrame = isIFrame();
|
|
14572
|
+
const isEveryLink = tabs.every((_) => _?.type === 'link');
|
|
14573
|
+
const query = new URLSearchParams(decodeURIComponent(globalThis?.location?.search || ''));
|
|
14574
|
+
const tabId = getTabId(id);
|
|
14575
|
+
const tabsCounted = showCounter
|
|
14576
|
+
? tabs.map((_) => ({
|
|
14577
|
+
..._,
|
|
14578
|
+
count: _?.type === 'group' ? block?.slots?.[_?.tabName ?? '']?.length ?? 0 : 0,
|
|
14579
|
+
}))
|
|
14580
|
+
: tabs;
|
|
14581
|
+
const defaultSelectedTabIndex = tabsCounted.findIndex((_) => Boolean(_?.selected));
|
|
14582
|
+
const defaultQueryTabIndex = tabsCounted.findIndex((_, i) => _.type === 'group' && (_?.tabName ?? String(i)) === tabId);
|
|
14583
|
+
const defaultTabIndex = tabId ? defaultQueryTabIndex : defaultSelectedTabIndex;
|
|
14584
|
+
const [activeTabIndex, setActiveTabIndex] = useState(getDefaultIndex(defaultTabIndex));
|
|
14585
|
+
const activeItem = tabsCounted[activeTabIndex];
|
|
14586
|
+
const slotName = getSlotName(tabsCounted[activeTabIndex], activeTabIndex);
|
|
14587
|
+
const updateUrlSearchTabParam = (_, i) => {
|
|
14588
|
+
if (_.text) {
|
|
14589
|
+
query.set(id, _?.tabName ?? String(i));
|
|
14590
|
+
}
|
|
14591
|
+
else {
|
|
14592
|
+
query.delete(id);
|
|
14593
|
+
}
|
|
14594
|
+
router.replace(`${router.pathname}?${query}`, { scroll: false });
|
|
14595
|
+
};
|
|
14596
|
+
const handleChange = useCallback((_) => {
|
|
14597
|
+
const index = tabsCounted.indexOf(_);
|
|
14598
|
+
const tab = tabsCounted[index];
|
|
14599
|
+
setActiveTabIndex(index);
|
|
14600
|
+
if (tab.type === 'group') {
|
|
14601
|
+
updateUrlSearchTabParam(_, index);
|
|
14602
|
+
}
|
|
14603
|
+
}, [tabsCounted]);
|
|
14604
|
+
return (jsxs(BlockWrapper, { className: style({ [STICKY_STYLE]: [isSticky, isEveryLink, !isFrame].every(Boolean) }, className), defaultPadding: "p-0", block: block, ...rest, children: [renderTabsLayout({
|
|
14605
|
+
className: style({
|
|
14606
|
+
'pb-1': [block?.slots, tabsType === 'default'].every(Boolean),
|
|
14607
|
+
[STICKY_STYLE]: [isSticky, !isEveryLink, !isFrame].every(Boolean),
|
|
14608
|
+
}),
|
|
14609
|
+
items: getItems(tabs, tabsCounted),
|
|
14610
|
+
activeItem,
|
|
14611
|
+
tabsType,
|
|
14612
|
+
onChange: handleChange,
|
|
14613
|
+
}), jsx("div", { className: "space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: Object.entries(block?.slots ?? {}).map(([key, value]) => renderBlocksList(value, {
|
|
14614
|
+
...rest?.options,
|
|
14615
|
+
slotName,
|
|
14616
|
+
parent: block,
|
|
14617
|
+
extraProps: { className: key === slotName ? '' : 'hidden' },
|
|
14618
|
+
})) })] }));
|
|
14619
|
+
}, {
|
|
14620
|
+
slots: ({ tabs }) => tabs?.map(getSlotName)?.filter(Boolean) || [],
|
|
14621
|
+
});
|
|
14622
|
+
const getDefaultIndex = (index) => (index && index !== -1 ? index : 0);
|
|
14623
|
+
const getId = ({ __id, anchor }) => anchor ?? __id ?? 'tabs';
|
|
14624
|
+
const getItems = (tabs, tabsCounted) => (tabsCounted?.length ? tabsCounted : tabs);
|
|
14625
|
+
const getSlotName = (tab, index) => tab?.type === 'group' ? tab?.tabName || `Слот №${index + 1}` : '';
|
|
14626
|
+
const getTabId = (id) => decodeURIComponent(globalThis?.location?.search
|
|
14627
|
+
.replace('?', '')
|
|
14628
|
+
.replace('+', ' ')
|
|
14629
|
+
.split('&')
|
|
14630
|
+
.find((_) => _.split('=').find((param) => param === id))
|
|
14631
|
+
?.split('=')?.[1] ?? '');
|
|
14632
|
+
|
|
14765
14633
|
const FIRST_CELL_STYLES = 'w-80 flex-shrink-0 sticky left-0 bg-white';
|
|
14766
14634
|
const renderHeader = ({ title, icon }) => (jsxs("div", { className: style('flex gap-m items-center', FIRST_CELL_STYLES), role: "cell", children: [icon ? (jsx(Img, { className: "hidden lg:block max-w-6 shrink-0", image: icon, width: "24", height: "24" })) : null, title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null] }));
|
|
14767
14635
|
|
|
@@ -14882,21 +14750,20 @@
|
|
|
14882
14750
|
RollupItem,
|
|
14883
14751
|
StepsBlock,
|
|
14884
14752
|
StickyBottomMenu,
|
|
14885
|
-
TextBlock,
|
|
14886
14753
|
TabsLayout,
|
|
14887
14754
|
TariffsTable,
|
|
14755
|
+
TextBlock,
|
|
14888
14756
|
VerticalLayout,
|
|
14889
14757
|
Video,
|
|
14890
14758
|
ApplicationLeadForm,
|
|
14891
14759
|
CreditCardForm,
|
|
14892
14760
|
CreditForm,
|
|
14893
14761
|
DebitForm,
|
|
14762
|
+
CashbackCalculator,
|
|
14894
14763
|
CalculatorRko,
|
|
14895
14764
|
RkoTariffCardsTable,
|
|
14896
14765
|
RatesTable,
|
|
14897
14766
|
ReferalForm,
|
|
14898
|
-
CashbackCalculator,
|
|
14899
|
-
CashbackCalculatorLayout,
|
|
14900
14767
|
};
|
|
14901
14768
|
|
|
14902
14769
|
const applyAspects = (aspects) => (ev) => {
|
|
@@ -15041,7 +14908,7 @@
|
|
|
15041
14908
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
15042
14909
|
});
|
|
15043
14910
|
|
|
15044
|
-
const packageVersion = "0.14.
|
|
14911
|
+
const packageVersion = "0.14.1073";
|
|
15045
14912
|
|
|
15046
14913
|
exports.Blocks = Blocks;
|
|
15047
14914
|
exports.ContentPage = ContentPage;
|