@redneckz/wildless-cms-uni-blocks 0.14.1027 → 0.14.1028
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 +158 -82
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/RatesTable/RatesTable.d.ts +6 -0
- package/bundle/components/RatesTable/RatesTableContent.d.ts +12 -0
- package/bundle/components/RatesTable/RatesTableItem.d.ts +9 -0
- package/bundle/components/RatesTable/renderDataPickForm.d.ts +1 -0
- package/bundle/components/RatesTable/renderDate.d.ts +6 -0
- package/bundle/components/RatesTable/renderLink.d.ts +1 -0
- package/bundle/hooks/useRates.d.ts +4 -0
- package/bundle/ui-kit/Rate/Rate.d.ts +12 -0
- package/dist/components/Blocks.js +2 -0
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/Blocks.mobile.js +2 -0
- package/dist/components/Blocks.mobile.js.map +1 -1
- package/dist/components/RatesTable/RatesTable.d.ts +6 -0
- package/dist/components/RatesTable/RatesTable.js +17 -0
- package/dist/components/RatesTable/RatesTable.js.map +1 -0
- package/dist/components/RatesTable/RatesTableContent.d.ts +12 -0
- package/dist/components/RatesTable/RatesTableContent.js +2 -0
- package/dist/components/RatesTable/RatesTableContent.js.map +1 -0
- package/dist/components/RatesTable/RatesTableItem.d.ts +9 -0
- package/dist/components/RatesTable/RatesTableItem.js +16 -0
- package/dist/components/RatesTable/RatesTableItem.js.map +1 -0
- package/dist/components/RatesTable/renderDataPickForm.d.ts +1 -0
- package/dist/components/RatesTable/renderDataPickForm.js +8 -0
- package/dist/components/RatesTable/renderDataPickForm.js.map +1 -0
- package/dist/components/RatesTable/renderDate.d.ts +6 -0
- package/dist/components/RatesTable/renderDate.js +24 -0
- package/dist/components/RatesTable/renderDate.js.map +1 -0
- package/dist/components/RatesTable/renderLink.d.ts +1 -0
- package/dist/components/RatesTable/renderLink.js +8 -0
- package/dist/components/RatesTable/renderLink.js.map +1 -0
- package/dist/hooks/useRates.d.ts +4 -0
- package/dist/hooks/useRates.js +42 -0
- package/dist/hooks/useRates.js.map +1 -0
- package/dist/ui-kit/Rate/Rate.d.ts +12 -0
- package/dist/ui-kit/Rate/Rate.js +11 -0
- package/dist/ui-kit/Rate/Rate.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/Blocks.js +2 -0
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/Blocks.mobile.js +2 -0
- package/lib/components/Blocks.mobile.js.map +1 -1
- package/lib/components/RatesTable/RatesTable.d.ts +6 -0
- package/lib/components/RatesTable/RatesTable.fixture.d.ts +6 -0
- package/lib/components/RatesTable/RatesTable.fixture.mobile.d.ts +6 -0
- package/lib/components/RatesTable/RatesTable.js +15 -0
- package/lib/components/RatesTable/RatesTable.js.map +1 -0
- package/lib/components/RatesTable/RatesTableContent.d.ts +12 -0
- package/lib/components/RatesTable/RatesTableContent.js +2 -0
- package/lib/components/RatesTable/RatesTableContent.js.map +1 -0
- package/lib/components/RatesTable/RatesTableItem.d.ts +9 -0
- package/lib/components/RatesTable/RatesTableItem.js +14 -0
- package/lib/components/RatesTable/RatesTableItem.js.map +1 -0
- package/lib/components/RatesTable/renderDataPickForm.d.ts +1 -0
- package/lib/components/RatesTable/renderDataPickForm.js +5 -0
- package/lib/components/RatesTable/renderDataPickForm.js.map +1 -0
- package/lib/components/RatesTable/renderDate.d.ts +6 -0
- package/lib/components/RatesTable/renderDate.js +21 -0
- package/lib/components/RatesTable/renderDate.js.map +1 -0
- package/lib/components/RatesTable/renderLink.d.ts +1 -0
- package/lib/components/RatesTable/renderLink.js +5 -0
- package/lib/components/RatesTable/renderLink.js.map +1 -0
- package/lib/hooks/useRates.d.ts +4 -0
- package/lib/hooks/useRates.js +39 -0
- package/lib/hooks/useRates.js.map +1 -0
- package/lib/ui-kit/Rate/Rate.d.ts +12 -0
- package/lib/ui-kit/Rate/Rate.js +9 -0
- package/lib/ui-kit/Rate/Rate.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +123 -47
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/RatesTable/RatesTable.d.ts +6 -0
- package/mobile/bundle/components/RatesTable/RatesTableContent.d.ts +12 -0
- package/mobile/bundle/components/RatesTable/RatesTableItem.d.ts +9 -0
- package/mobile/bundle/components/RatesTable/renderDataPickForm.d.ts +1 -0
- package/mobile/bundle/components/RatesTable/renderDate.d.ts +6 -0
- package/mobile/bundle/components/RatesTable/renderLink.d.ts +1 -0
- package/mobile/bundle/hooks/useRates.d.ts +4 -0
- package/mobile/bundle/ui-kit/Rate/Rate.d.ts +12 -0
- package/mobile/dist/components/Blocks.js +2 -0
- package/mobile/dist/components/Blocks.js.map +1 -1
- package/mobile/dist/components/RatesTable/RatesTable.d.ts +6 -0
- package/mobile/dist/components/RatesTable/RatesTable.js +17 -0
- package/mobile/dist/components/RatesTable/RatesTable.js.map +1 -0
- package/mobile/dist/components/RatesTable/RatesTableContent.d.ts +12 -0
- package/mobile/dist/components/RatesTable/RatesTableContent.js +2 -0
- package/mobile/dist/components/RatesTable/RatesTableContent.js.map +1 -0
- package/mobile/dist/components/RatesTable/RatesTableItem.d.ts +9 -0
- package/mobile/dist/components/RatesTable/RatesTableItem.js +16 -0
- package/mobile/dist/components/RatesTable/RatesTableItem.js.map +1 -0
- package/mobile/dist/components/RatesTable/renderDataPickForm.d.ts +1 -0
- package/mobile/dist/components/RatesTable/renderDataPickForm.js +8 -0
- package/mobile/dist/components/RatesTable/renderDataPickForm.js.map +1 -0
- package/mobile/dist/components/RatesTable/renderDate.d.ts +6 -0
- package/mobile/dist/components/RatesTable/renderDate.js +24 -0
- package/mobile/dist/components/RatesTable/renderDate.js.map +1 -0
- package/mobile/dist/components/RatesTable/renderLink.d.ts +1 -0
- package/mobile/dist/components/RatesTable/renderLink.js +8 -0
- package/mobile/dist/components/RatesTable/renderLink.js.map +1 -0
- package/mobile/dist/hooks/useRates.d.ts +4 -0
- package/mobile/dist/hooks/useRates.js +42 -0
- package/mobile/dist/hooks/useRates.js.map +1 -0
- package/mobile/dist/ui-kit/Rate/Rate.d.ts +12 -0
- package/mobile/dist/ui-kit/Rate/Rate.js +11 -0
- package/mobile/dist/ui-kit/Rate/Rate.js.map +1 -0
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/Blocks.js +2 -0
- package/mobile/lib/components/Blocks.js.map +1 -1
- package/mobile/lib/components/RatesTable/RatesTable.d.ts +6 -0
- package/mobile/lib/components/RatesTable/RatesTable.js +15 -0
- package/mobile/lib/components/RatesTable/RatesTable.js.map +1 -0
- package/mobile/lib/components/RatesTable/RatesTableContent.d.ts +12 -0
- package/mobile/lib/components/RatesTable/RatesTableContent.js +2 -0
- package/mobile/lib/components/RatesTable/RatesTableContent.js.map +1 -0
- package/mobile/lib/components/RatesTable/RatesTableItem.d.ts +9 -0
- package/mobile/lib/components/RatesTable/RatesTableItem.js +14 -0
- package/mobile/lib/components/RatesTable/RatesTableItem.js.map +1 -0
- package/mobile/lib/components/RatesTable/renderDataPickForm.d.ts +1 -0
- package/mobile/lib/components/RatesTable/renderDataPickForm.js +5 -0
- package/mobile/lib/components/RatesTable/renderDataPickForm.js.map +1 -0
- package/mobile/lib/components/RatesTable/renderDate.d.ts +6 -0
- package/mobile/lib/components/RatesTable/renderDate.js +21 -0
- package/mobile/lib/components/RatesTable/renderDate.js.map +1 -0
- package/mobile/lib/components/RatesTable/renderLink.d.ts +1 -0
- package/mobile/lib/components/RatesTable/renderLink.js +5 -0
- package/mobile/lib/components/RatesTable/renderLink.js.map +1 -0
- package/mobile/lib/hooks/useRates.d.ts +4 -0
- package/mobile/lib/hooks/useRates.js +39 -0
- package/mobile/lib/hooks/useRates.js.map +1 -0
- package/mobile/lib/ui-kit/Rate/Rate.d.ts +12 -0
- package/mobile/lib/ui-kit/Rate/Rate.js +9 -0
- package/mobile/lib/ui-kit/Rate/Rate.js.map +1 -0
- package/mobile/src/components/Blocks.ts +2 -0
- package/mobile/src/components/RatesTable/RatesTable.example.json +7 -0
- package/mobile/src/components/RatesTable/RatesTable.tsx +38 -0
- package/mobile/src/components/RatesTable/RatesTable.ui.json +7 -0
- package/mobile/src/components/RatesTable/RatesTableContent.ts +13 -0
- package/mobile/src/components/RatesTable/RatesTableItem.tsx +39 -0
- package/mobile/src/components/RatesTable/renderDataPickForm.tsx +9 -0
- package/mobile/src/components/RatesTable/renderDate.tsx +42 -0
- package/mobile/src/components/RatesTable/renderLink.tsx +8 -0
- package/mobile/src/hooks/useRates.ts +65 -0
- package/mobile/src/ui-kit/Rate/Rate.tsx +27 -0
- package/package.json +1 -1
- package/src/components/Blocks.mobile.ts +2 -0
- package/src/components/Blocks.ts +2 -0
- package/src/components/RatesTable/RatesTable.example.json +7 -0
- package/src/components/RatesTable/RatesTable.fixture.mobile.tsx +26 -0
- package/src/components/RatesTable/RatesTable.fixture.tsx +26 -0
- package/src/components/RatesTable/RatesTable.tsx +38 -0
- package/src/components/RatesTable/RatesTable.ui.json +7 -0
- package/src/components/RatesTable/RatesTableContent.ts +13 -0
- package/src/components/RatesTable/RatesTableItem.tsx +39 -0
- package/src/components/RatesTable/renderDataPickForm.tsx +9 -0
- package/src/components/RatesTable/renderDate.tsx +42 -0
- package/src/components/RatesTable/renderLink.tsx +8 -0
- package/src/hooks/useRates.ts +65 -0
- package/src/ui-kit/Rate/Rate.tsx +27 -0
|
@@ -8788,11 +8788,11 @@
|
|
|
8788
8788
|
return (jsx(BlockWrapper, { className: style('!bg-transparent', alignStyle, className), defaultPadding: "p-0", ...rest, children: renderButtonsSection(buttons) }));
|
|
8789
8789
|
});
|
|
8790
8790
|
|
|
8791
|
-
const Rate = JSX(({ rate = 0, title = 'Ставка', unit, fractionDigits = 2, depositeName, isShowDepositeName, color = 'text-secondary-text', }) => (jsxs("div", { children: [jsx(Text, { size: "text-l", font: "font-light", color: color, children: title }), jsxs("div", { className: "relative", children: [jsxs("div", { className: "flex @xl:justify-center gradient-color-text gap-xs", children: [jsx("span", { className: "font-mohave text-title-huge -mt-m tracking-[-15px]", children: toLocalNumberFormat(fractionDigits, { fixed: true })(rate) }), unit ? jsx("span", { className: "text-7xl mt-5", children: unit }) : null] }), depositeName && isShowDepositeName ? (jsx("div", { className: "absolute bottom-2 w-full text-left whitespace-nowrap", children: depositeName })) : null] })] })));
|
|
8791
|
+
const Rate$1 = JSX(({ rate = 0, title = 'Ставка', unit, fractionDigits = 2, depositeName, isShowDepositeName, color = 'text-secondary-text', }) => (jsxs("div", { children: [jsx(Text, { size: "text-l", font: "font-light", color: color, children: title }), jsxs("div", { className: "relative", children: [jsxs("div", { className: "flex @xl:justify-center gradient-color-text gap-xs", children: [jsx("span", { className: "font-mohave text-title-huge -mt-m tracking-[-15px]", children: toLocalNumberFormat(fractionDigits, { fixed: true })(rate) }), unit ? jsx("span", { className: "text-7xl mt-5", children: unit }) : null] }), depositeName && isShowDepositeName ? (jsx("div", { className: "absolute bottom-2 w-full text-left whitespace-nowrap", children: depositeName })) : null] })] })));
|
|
8792
8792
|
|
|
8793
8793
|
const UnknownRate = JSX(({ title = 'Ставка' }) => (jsxs("div", { className: "space-y-s lg:min-w-96", children: [jsx(Text, { size: "text-l", font: "font-light", color: "text-secondary-text", children: title }), jsx(Icon, { className: "w-10 h-auto lg:w-40", name: "PercentIcon" }), jsx("div", { className: "w-64", children: jsx(Paragraph, { size: "text-xl", font: "font-light", color: "text-primary-text", children: "\u041F\u0440\u043E\u0446\u0435\u043D\u0442\u043D\u0430\u044F \u0441\u0442\u0430\u0432\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430, \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B" }) })] })));
|
|
8794
8794
|
|
|
8795
|
-
const renderRate = ({ title = 'Ставка', rate = 0, unit = '%', fractionDigits = 2, color = 'text-secondary-text', children, ...rest }) => rate ? (jsxs("div", { className: "flex flex-col", children: [jsx("div", { className: "hidden lg:block min-w-96", children: jsx(Rate, { title: title, rate: rate, unit: unit, fractionDigits: fractionDigits, color: color, ...rest }) }), jsx(CalculatorValue, { className: "lg:hidden", title: title, value: rate, postfix: unit, fractionDigits: fractionDigits, fixed: true, color: color, ...rest }), children] })) : (jsx(UnknownRate, { title: title, ...rest }));
|
|
8795
|
+
const renderRate = ({ title = 'Ставка', rate = 0, unit = '%', fractionDigits = 2, color = 'text-secondary-text', children, ...rest }) => rate ? (jsxs("div", { className: "flex flex-col", children: [jsx("div", { className: "hidden lg:block min-w-96", children: jsx(Rate$1, { title: title, rate: rate, unit: unit, fractionDigits: fractionDigits, color: color, ...rest }) }), jsx(CalculatorValue, { className: "lg:hidden", title: title, value: rate, postfix: unit, fractionDigits: fractionDigits, fixed: true, color: color, ...rest }), children] })) : (jsx(UnknownRate, { title: title, ...rest }));
|
|
8796
8796
|
|
|
8797
8797
|
const DEFAULT_BONUS_CALCULATOR_PARAMS$1 = {
|
|
8798
8798
|
minSumTravel: 6000,
|
|
@@ -13373,6 +13373,125 @@
|
|
|
13373
13373
|
return (jsx(BlockWrapper, { version: "transparent", className: style(className), defaultPadding: "p-0", ...rest, children: dataType === 'offices' ? jsx(OfficesMap, {}) : jsx(AtmsMap, { descriptionData: data }) }));
|
|
13374
13374
|
});
|
|
13375
13375
|
|
|
13376
|
+
const RATES_URL = `${API_BASE_URI}/rates`;
|
|
13377
|
+
const ARCHIVE_RATES_URL = `${API_BASE_URI}/historyrates`;
|
|
13378
|
+
const EMPTY_RATES = [
|
|
13379
|
+
[
|
|
13380
|
+
{
|
|
13381
|
+
currencyPair: 'Валютная пара',
|
|
13382
|
+
buyRate: 0,
|
|
13383
|
+
sellRate: 0,
|
|
13384
|
+
},
|
|
13385
|
+
],
|
|
13386
|
+
];
|
|
13387
|
+
function useRates(isArchive) {
|
|
13388
|
+
const url = isArchive ? ARCHIVE_RATES_URL : RATES_URL;
|
|
13389
|
+
const rateKey = isArchive ? 'archiveRates' : 'rates';
|
|
13390
|
+
const ratesStore = useLocalStore();
|
|
13391
|
+
// проверяем, надо ли обновлять значения ставок
|
|
13392
|
+
const shouldUpdate = getShouldUpdate(isArchive, ratesStore);
|
|
13393
|
+
// костыль, не отправлять запрос на бэк, если уже был запрос менее 15 мин назад
|
|
13394
|
+
const { data } = useAsyncData(shouldUpdate ? url : '', fetchJSONUnsafe);
|
|
13395
|
+
// если есть data и значение надо обновить, то обновляем локалсторадж
|
|
13396
|
+
if (shouldUpdate && data) {
|
|
13397
|
+
const nextUpdate = getTimeAfter15Minutes();
|
|
13398
|
+
ratesStore[rateKey] = { rate: data, nextUpdate };
|
|
13399
|
+
}
|
|
13400
|
+
// берем данные из локалсторадж
|
|
13401
|
+
const rates = ratesStore[rateKey]?.rate;
|
|
13402
|
+
// возвращаем данные из локалсторадж или заглушку
|
|
13403
|
+
return Array.isArray(rates) ? rates : EMPTY_RATES;
|
|
13404
|
+
}
|
|
13405
|
+
// Отсчитываем 15 минут с текущего момента
|
|
13406
|
+
const getTimeAfter15Minutes = () => Date.now() + 15 * 60 * 1000;
|
|
13407
|
+
const getShouldUpdate = (isArchive, ratesStore) => isArchive
|
|
13408
|
+
? !ratesStore?.archiveRates || ratesStore?.archiveRates.nextUpdate <= Date.now()
|
|
13409
|
+
: !ratesStore?.rates || ratesStore?.rates.nextUpdate <= Date.now();
|
|
13410
|
+
|
|
13411
|
+
const sum = (list = []) => list.reduce((a, b) => a + b, 0);
|
|
13412
|
+
|
|
13413
|
+
const COLUMN_WIDTH = 140;
|
|
13414
|
+
const getHorizontalShift = (columns, activeColumnIndex) => sum(columns.slice(0, activeColumnIndex).map((_) => _?.cols?.length ?? 1)) * COLUMN_WIDTH;
|
|
13415
|
+
|
|
13416
|
+
const renderInnerTableRow = (activeColumnIndex) => (rowData, rowIdx) => {
|
|
13417
|
+
if (!rowData?.length) {
|
|
13418
|
+
return null;
|
|
13419
|
+
}
|
|
13420
|
+
const [headerColumn, ...columns] = rowData;
|
|
13421
|
+
const columnsStyle = style('flex duration-1000 text-center', rowIdx !== 0 ? 'font-normal' : 'font-light');
|
|
13422
|
+
return (jsxs("div", { className: "flex border-main-divider border-b border-solid h-full", children: [headerColumn?.data ? (jsx("div", { className: "whitespace-pre-wrap sm:whitespace-normal w-48 min-w-48 sm:w-56 sm:min-w-56 py-lg pr-lg sm:pr-0", children: jsx(Text, { size: "text-xl", font: "font-light", children: headerColumn.data }) })) : null, jsx("div", { className: "flex flex-grow overflow-hidden", children: jsx("div", { className: columnsStyle, style: {
|
|
13423
|
+
transform: `translateX(-${getHorizontalShift(columns, activeColumnIndex)}px)`,
|
|
13424
|
+
}, children: columns?.map((_, i) => (jsxs("div", { className: "flex flex-col flex-grow gap-s justify-center py-xl odd:bg-main-divider", children: [_?.data ? jsx(Text, { size: "text-xl", children: _.data }) : null, _?.cols ? renderCols(_.cols, activeColumnIndex) : null] }, `row${i}`))) }) })] }, String(rowIdx)));
|
|
13425
|
+
};
|
|
13426
|
+
const renderCols = (cols, rowIndex) => cols?.length > 0 ? (jsx("div", { className: style('flex', { 'text-secondary-text': rowIndex === 0 }), children: cols.map((data, i) => (jsx("div", { className: "w-20 mx-lg", children: jsx(Text, { size: "text-h6", font: "font-light", children: data }) }, String(i)))) })) : null;
|
|
13427
|
+
|
|
13428
|
+
const InnerTableBodyItem = JSX(({ rows }) => (jsx(SwipeListContainer, { visibleItemCount: 0, snapAlign: "snap-start", children: jsx("div", { children: rows?.map(renderInnerTableRow(0)) }) })));
|
|
13429
|
+
|
|
13430
|
+
const InnerTableBody = JSX(({ activeTabIndex, items }) => (jsx("div", { children: items.map((_, tableIdx) => {
|
|
13431
|
+
const key = `activeTabIdx:${activeTabIndex}-tableIdx:${tableIdx}`;
|
|
13432
|
+
return (jsxs("div", { className: "w-full @container", children: [jsx("div", { className: "flex py-m px-m bg-white @4xl:bg-gray relative", children: jsx(Text, { size: "text-xl", align: "text-left", children: _.title }) }), jsx("div", { className: "w-full sm:pl-xs overflow-hidden transition-height duration-500 ease-in-out", children: jsx("div", { className: "relative", children: jsx(InnerTableBodyItem, { rows: _.rowsData }) }) })] }, key));
|
|
13433
|
+
}) })));
|
|
13434
|
+
|
|
13435
|
+
const linkButtonVersion = 'link';
|
|
13436
|
+
|
|
13437
|
+
const TableColor = (isEqual = false) => `${isEqual ? 'text-white' : 'text-secondary-text'}`;
|
|
13438
|
+
const InnerTableHeader = JSX(({ currencies, linkToPDF, activeTabIndex, setActiveTabIndex }) => (jsxs("div", { className: "flex justify-between items-center w-full py-lg", children: [currencies && currencies.length > 1 ? (jsx("div", { className: "flex bg-secondary-light p-2xs rounded-md", children: currencies.map((currency, idx) => (jsx("div", { className: style('rounded-md px-4 py-3 cursor-pointer', {
|
|
13439
|
+
'bg-primary-main': idx === activeTabIndex,
|
|
13440
|
+
}), onClick: () => setActiveTabIndex(idx), children: jsx(Text, { size: "text-xl", font: "font-light", color: TableColor(idx === activeTabIndex), children: currency || idx + 1 }) }, currency))) })) : null, linkToPDF ? (jsx(LinkButton, { className: "text-primary-main", href: linkToPDF, version: linkButtonVersion, target: "_blank", appendLeft: jsx(Icon, { name: "DocDownloadIcon", iconVersion: "color", className: "mr-3xs", width: "20", height: "20" }), text: "\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0432 PDF" })) : null] })));
|
|
13441
|
+
|
|
13442
|
+
const EMPTY_DATA$1 = 'Данных нет';
|
|
13443
|
+
const InnerTable = UniBlock(({ tableSource }) => {
|
|
13444
|
+
const tableData = tableSource?.tableData;
|
|
13445
|
+
const [activeTabIndex, setActiveTabIndex] = useState(0);
|
|
13446
|
+
const handleActiveTabIndex = useCallback((_) => setActiveTabIndex(_), []);
|
|
13447
|
+
const items = tableData?.[activeTabIndex]?.items ?? [];
|
|
13448
|
+
const currencies = tableData?.map((item) => item.currency ?? '');
|
|
13449
|
+
return tableData ? (jsxs("div", { className: "bg-white z-10", children: [jsx(InnerTableHeader, { currencies: currencies, activeTabIndex: activeTabIndex, setActiveTabIndex: handleActiveTabIndex }), jsx(InnerTableBody, { activeTabIndex: activeTabIndex, items: items })] })) : (jsx("div", { className: "space-y-m text-center", children: jsx(Text, { size: "text-h6", children: EMPTY_DATA$1 }) }));
|
|
13450
|
+
});
|
|
13451
|
+
|
|
13452
|
+
const DIVIDER_STYLE = 'border-main-divider lg:border-b w-full py-s lg:py-xl';
|
|
13453
|
+
const TariffsTableRowContainer = JSX(({ children, tableInner, onClick }) => (jsxs("div", { className: style('self-start flex flex-col gap-xl', DIVIDER_STYLE), role: "row", children: [jsx("div", { className: style('flex flex-col lg:flex-row gap-x-5xl gap-y-xs'), children: children }), tableInner ? (jsx("div", { className: "origin-top animate-expansion", children: jsx(InnerTable, { ...tableInner, onClick: onClick }) })) : null] })));
|
|
13454
|
+
|
|
13455
|
+
const RATES_COLUMN_STYLE = `grid grid-cols-3 gap-s`;
|
|
13456
|
+
const Rate = UniBlock(({ currencyPair = '', buyRate = 0, sellRate = 0 }) => (jsxs("div", { className: style('mb-s', RATES_COLUMN_STYLE, DIVIDER_STYLE), children: [jsx("div", { children: formatCurrencyPair(currencyPair) }), jsx("div", { children: formatRate(buyRate) }), jsx("div", { children: formatRate(sellRate) })] })));
|
|
13457
|
+
const formatCurrencyPair = (currency) => currency.replace('_TOD', '');
|
|
13458
|
+
const formatRate = (rate) => rate.toFixed(4);
|
|
13459
|
+
|
|
13460
|
+
const TIMEZONE = 'МСК';
|
|
13461
|
+
const renderDate = ({ dateString, isArchive = false }) => {
|
|
13462
|
+
const date = new Date(String(dateString));
|
|
13463
|
+
const formatTime = date.toLocaleTimeString('ru-RU', {
|
|
13464
|
+
timeZone: 'Europe/Moscow',
|
|
13465
|
+
hour: '2-digit',
|
|
13466
|
+
minute: '2-digit',
|
|
13467
|
+
hour12: false,
|
|
13468
|
+
});
|
|
13469
|
+
const formatDate = date.toLocaleDateString('ru-RU', {
|
|
13470
|
+
timeZone: 'Europe/Moscow',
|
|
13471
|
+
day: 'numeric',
|
|
13472
|
+
month: 'long',
|
|
13473
|
+
year: 'numeric',
|
|
13474
|
+
});
|
|
13475
|
+
return isArchive ? (jsxs("div", { children: [jsx(Paragraph, { color: "text-secondary-text", font: "font-medium", children: formatDate }), jsxs(Paragraph, { color: "text-secondary-text", children: [formatTime, " (", TIMEZONE, ")"] })] })) : (jsxs(Text, { color: "text-secondary-text", children: ["\u041A\u0443\u0440\u0441\u044B \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u044B \u043D\u0430 ", formatTime, " (", TIMEZONE, "), ", formatDate] }));
|
|
13476
|
+
};
|
|
13477
|
+
|
|
13478
|
+
const RatesTableItem = JSX(({ isArchive = false, isRatesValid, list = [], infoMessage }) => {
|
|
13479
|
+
const maxDate = isRatesValid
|
|
13480
|
+
? list.map((item) => item.lastUpdatedAt).reduce((a, b) => (String(a) > String(b) ? a : b))
|
|
13481
|
+
: '';
|
|
13482
|
+
return (jsxs("div", { className: "space-y-xl mb-3xl", children: [maxDate && renderDate({ dateString: maxDate, isArchive }), jsxs("div", { className: style(RATES_COLUMN_STYLE), children: [jsx(Text, { font: "font-medium", children: "\u0412\u0430\u043B\u044E\u0442\u0430" }), jsx(Text, { font: "font-medium", children: "\u041F\u043E\u043A\u0443\u043F\u043A\u0430" }), jsx(Text, { font: "font-medium", children: "\u041F\u0440\u043E\u0434\u0430\u0436\u0430" })] }), list.length > 0 ? (list.map((rate, i) => jsx(Rate, { ...rate }, String(i)))) : (jsx(Paragraph, { children: "\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u0434\u0430\u043D\u043D\u044B\u0445" })), jsx(Paragraph, { color: "text-secondary-text", children: infoMessage })] }));
|
|
13483
|
+
});
|
|
13484
|
+
|
|
13485
|
+
const renderDataPickForm = () => (jsxs("div", { className: "flex justify-start items-end space-x-xl", children: [jsx(DatePicker, { label: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0435\u043D\u044C", maxDate: new Date() }), jsx(SubmitButton$1, { className: "h-fit", children: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C" })] }));
|
|
13486
|
+
|
|
13487
|
+
const renderLink = (href) => (jsxs(Paragraph, { children: ["\u041F\u043E\u043B\u043D\u044B\u0439 \u0430\u0440\u0445\u0438\u0432 \u0432\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C ", jsx(Link, { href: href, children: "\u0437\u0434\u0435\u0441\u044C" })] }));
|
|
13488
|
+
|
|
13489
|
+
const RatesTable = JSX(({ href, className = '', infoMessage, title, isArchive = false, ...rest }) => {
|
|
13490
|
+
const ratesList = useRates(isArchive);
|
|
13491
|
+
const isRatesValid = ratesList[0].length > 0;
|
|
13492
|
+
return (jsxs(BlockWrapper, { className: style('p-6xl space-y-xl', className), defaultPadding: "p-0", ...rest, children: [jsx(Heading, { className: "mb-xl", children: title }), isArchive ? renderDataPickForm() : null, ratesList.map((list, i) => (jsx(RatesTableItem, { list: list, isRatesValid: isRatesValid, isArchive: isArchive, infoMessage: infoMessage }, String(i)))), href ? renderLink(href) : null] }));
|
|
13493
|
+
});
|
|
13494
|
+
|
|
13376
13495
|
const RichTextBlock = UniBlock((props) => {
|
|
13377
13496
|
const { __html, dynamicQueryParamText = {}, dynamicTextSource, richVersion = '', ...rest } = props;
|
|
13378
13497
|
const formatText = getFormatDynamicText(dynamicQueryParamText, dynamicTextSource?.list, __html);
|
|
@@ -13943,50 +14062,6 @@
|
|
|
13943
14062
|
: null }));
|
|
13944
14063
|
});
|
|
13945
14064
|
|
|
13946
|
-
const sum = (list = []) => list.reduce((a, b) => a + b, 0);
|
|
13947
|
-
|
|
13948
|
-
const COLUMN_WIDTH = 140;
|
|
13949
|
-
const getHorizontalShift = (columns, activeColumnIndex) => sum(columns.slice(0, activeColumnIndex).map((_) => _?.cols?.length ?? 1)) * COLUMN_WIDTH;
|
|
13950
|
-
|
|
13951
|
-
const renderInnerTableRow = (activeColumnIndex) => (rowData, rowIdx) => {
|
|
13952
|
-
if (!rowData?.length) {
|
|
13953
|
-
return null;
|
|
13954
|
-
}
|
|
13955
|
-
const [headerColumn, ...columns] = rowData;
|
|
13956
|
-
const columnsStyle = style('flex duration-1000 text-center', rowIdx !== 0 ? 'font-normal' : 'font-light');
|
|
13957
|
-
return (jsxs("div", { className: "flex border-main-divider border-b border-solid h-full", children: [headerColumn?.data ? (jsx("div", { className: "whitespace-pre-wrap sm:whitespace-normal w-48 min-w-48 sm:w-56 sm:min-w-56 py-lg pr-lg sm:pr-0", children: jsx(Text, { size: "text-xl", font: "font-light", children: headerColumn.data }) })) : null, jsx("div", { className: "flex flex-grow overflow-hidden", children: jsx("div", { className: columnsStyle, style: {
|
|
13958
|
-
transform: `translateX(-${getHorizontalShift(columns, activeColumnIndex)}px)`,
|
|
13959
|
-
}, children: columns?.map((_, i) => (jsxs("div", { className: "flex flex-col flex-grow gap-s justify-center py-xl odd:bg-main-divider", children: [_?.data ? jsx(Text, { size: "text-xl", children: _.data }) : null, _?.cols ? renderCols(_.cols, activeColumnIndex) : null] }, `row${i}`))) }) })] }, String(rowIdx)));
|
|
13960
|
-
};
|
|
13961
|
-
const renderCols = (cols, rowIndex) => cols?.length > 0 ? (jsx("div", { className: style('flex', { 'text-secondary-text': rowIndex === 0 }), children: cols.map((data, i) => (jsx("div", { className: "w-20 mx-lg", children: jsx(Text, { size: "text-h6", font: "font-light", children: data }) }, String(i)))) })) : null;
|
|
13962
|
-
|
|
13963
|
-
const InnerTableBodyItem = JSX(({ rows }) => (jsx(SwipeListContainer, { visibleItemCount: 0, snapAlign: "snap-start", children: jsx("div", { children: rows?.map(renderInnerTableRow(0)) }) })));
|
|
13964
|
-
|
|
13965
|
-
const InnerTableBody = JSX(({ activeTabIndex, items }) => (jsx("div", { children: items.map((_, tableIdx) => {
|
|
13966
|
-
const key = `activeTabIdx:${activeTabIndex}-tableIdx:${tableIdx}`;
|
|
13967
|
-
return (jsxs("div", { className: "w-full @container", children: [jsx("div", { className: "flex py-m px-m bg-white @4xl:bg-gray relative", children: jsx(Text, { size: "text-xl", align: "text-left", children: _.title }) }), jsx("div", { className: "w-full sm:pl-xs overflow-hidden transition-height duration-500 ease-in-out", children: jsx("div", { className: "relative", children: jsx(InnerTableBodyItem, { rows: _.rowsData }) }) })] }, key));
|
|
13968
|
-
}) })));
|
|
13969
|
-
|
|
13970
|
-
const linkButtonVersion = 'link';
|
|
13971
|
-
|
|
13972
|
-
const TableColor = (isEqual = false) => `${isEqual ? 'text-white' : 'text-secondary-text'}`;
|
|
13973
|
-
const InnerTableHeader = JSX(({ currencies, linkToPDF, activeTabIndex, setActiveTabIndex }) => (jsxs("div", { className: "flex justify-between items-center w-full py-lg", children: [currencies && currencies.length > 1 ? (jsx("div", { className: "flex bg-secondary-light p-2xs rounded-md", children: currencies.map((currency, idx) => (jsx("div", { className: style('rounded-md px-4 py-3 cursor-pointer', {
|
|
13974
|
-
'bg-primary-main': idx === activeTabIndex,
|
|
13975
|
-
}), onClick: () => setActiveTabIndex(idx), children: jsx(Text, { size: "text-xl", font: "font-light", color: TableColor(idx === activeTabIndex), children: currency || idx + 1 }) }, currency))) })) : null, linkToPDF ? (jsx(LinkButton, { className: "text-primary-main", href: linkToPDF, version: linkButtonVersion, target: "_blank", appendLeft: jsx(Icon, { name: "DocDownloadIcon", iconVersion: "color", className: "mr-3xs", width: "20", height: "20" }), text: "\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0432 PDF" })) : null] })));
|
|
13976
|
-
|
|
13977
|
-
const EMPTY_DATA$1 = 'Данных нет';
|
|
13978
|
-
const InnerTable = UniBlock(({ tableSource }) => {
|
|
13979
|
-
const tableData = tableSource?.tableData;
|
|
13980
|
-
const [activeTabIndex, setActiveTabIndex] = useState(0);
|
|
13981
|
-
const handleActiveTabIndex = useCallback((_) => setActiveTabIndex(_), []);
|
|
13982
|
-
const items = tableData?.[activeTabIndex]?.items ?? [];
|
|
13983
|
-
const currencies = tableData?.map((item) => item.currency ?? '');
|
|
13984
|
-
return tableData ? (jsxs("div", { className: "bg-white z-10", children: [jsx(InnerTableHeader, { currencies: currencies, activeTabIndex: activeTabIndex, setActiveTabIndex: handleActiveTabIndex }), jsx(InnerTableBody, { activeTabIndex: activeTabIndex, items: items })] })) : (jsx("div", { className: "space-y-m text-center", children: jsx(Text, { size: "text-h6", children: EMPTY_DATA$1 }) }));
|
|
13985
|
-
});
|
|
13986
|
-
|
|
13987
|
-
const DIVIDER_STYLE = 'border-main-divider lg:border-b w-full py-s lg:py-xl';
|
|
13988
|
-
const TariffsTableRowContainer = JSX(({ children, tableInner, onClick }) => (jsxs("div", { className: style('self-start flex flex-col gap-xl', DIVIDER_STYLE), role: "row", children: [jsx("div", { className: style('flex flex-col lg:flex-row gap-x-5xl gap-y-xs'), children: children }), tableInner ? (jsx("div", { className: "origin-top animate-expansion", children: jsx(InnerTable, { ...tableInner, onClick: onClick }) })) : null] })));
|
|
13989
|
-
|
|
13990
14065
|
const TariffsTableRow = JSX(({ row: { header, data = [] }, ...rest }) => {
|
|
13991
14066
|
const [tableInner, setTableInner] = useState(undefined);
|
|
13992
14067
|
const handleSetTableInner = useCallback((_) => {
|
|
@@ -14059,6 +14134,7 @@
|
|
|
14059
14134
|
CashbackCalculator,
|
|
14060
14135
|
CalculatorRko,
|
|
14061
14136
|
RkoTariffCardsTable,
|
|
14137
|
+
RatesTable,
|
|
14062
14138
|
};
|
|
14063
14139
|
|
|
14064
14140
|
const applyAspects = (aspects) => (ev) => {
|
|
@@ -14183,7 +14259,7 @@
|
|
|
14183
14259
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
14184
14260
|
});
|
|
14185
14261
|
|
|
14186
|
-
const packageVersion = "0.14.
|
|
14262
|
+
const packageVersion = "0.14.1027";
|
|
14187
14263
|
|
|
14188
14264
|
exports.Blocks = Blocks;
|
|
14189
14265
|
exports.ContentPage = ContentPage;
|