@redneckz/wildless-cms-uni-blocks 0.14.196 → 0.14.198
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/migration-scripts/0.14.189.js +22 -0
- package/bundle/bundle.umd.js +91 -93
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/hooks/useForm.d.ts +8 -7
- package/bundle/hooks/useJSONRef/resolveBlockProps.d.ts +1 -0
- package/bundle/ui-kit/BaseFiltration/filterBlocks.d.ts +1 -1
- package/bundle/ui-kit/BaseFiltration/useFiltrationForm.d.ts +10 -0
- package/dist/components/AdTile/AdTile.js +3 -1
- package/dist/components/AdTile/AdTile.js.map +1 -1
- package/dist/components/DepositFiltration/DepositFiltration.js +20 -11
- package/dist/components/DepositFiltration/DepositFiltration.js.map +1 -1
- package/dist/components/MortgageFiltration/MortgageFiltration.js +6 -7
- package/dist/components/MortgageFiltration/MortgageFiltration.js.map +1 -1
- package/dist/hooks/useForm.d.ts +8 -7
- package/dist/hooks/useForm.js.map +1 -1
- package/dist/hooks/useJSONRef/resolveBlockProps.d.ts +1 -0
- package/dist/hooks/useJSONRef/resolveBlockProps.js +6 -0
- package/dist/hooks/useJSONRef/resolveBlockProps.js.map +1 -0
- package/dist/hooks/useJSONRef/useJSONRef.js +2 -3
- package/dist/hooks/useJSONRef/useJSONRef.js.map +1 -1
- package/dist/ui-kit/BaseFiltration/filterBlocks.d.ts +1 -1
- package/dist/ui-kit/BaseFiltration/filterBlocks.js +3 -1
- package/dist/ui-kit/BaseFiltration/filterBlocks.js.map +1 -1
- package/dist/ui-kit/BaseFiltration/useFiltrationForm.d.ts +10 -0
- package/dist/ui-kit/BaseFiltration/useFiltrationForm.js +23 -0
- package/dist/ui-kit/BaseFiltration/useFiltrationForm.js.map +1 -0
- package/dist/ui-kit/Shimmer/Shimmer.js +1 -1
- package/dist/ui-kit/Shimmer/Shimmer.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/AdTile/AdTile.js +3 -1
- package/lib/components/AdTile/AdTile.js.map +1 -1
- package/lib/components/DepositFiltration/DepositFiltration.js +20 -11
- package/lib/components/DepositFiltration/DepositFiltration.js.map +1 -1
- package/lib/components/MortgageFiltration/MortgageFiltration.js +6 -7
- package/lib/components/MortgageFiltration/MortgageFiltration.js.map +1 -1
- package/lib/hooks/useForm.d.ts +8 -7
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useJSONRef/resolveBlockProps.d.ts +1 -0
- package/lib/hooks/useJSONRef/resolveBlockProps.js +3 -0
- package/lib/hooks/useJSONRef/resolveBlockProps.js.map +1 -0
- package/lib/hooks/useJSONRef/useJSONRef.js +3 -4
- package/lib/hooks/useJSONRef/useJSONRef.js.map +1 -1
- package/lib/ui-kit/BaseFiltration/filterBlocks.d.ts +1 -1
- package/lib/ui-kit/BaseFiltration/filterBlocks.js +3 -1
- package/lib/ui-kit/BaseFiltration/filterBlocks.js.map +1 -1
- package/lib/ui-kit/BaseFiltration/useFiltrationForm.d.ts +10 -0
- package/lib/ui-kit/BaseFiltration/useFiltrationForm.js +20 -0
- package/lib/ui-kit/BaseFiltration/useFiltrationForm.js.map +1 -0
- package/lib/ui-kit/Shimmer/Shimmer.js +1 -1
- package/lib/ui-kit/Shimmer/Shimmer.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +91 -93
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/hooks/useForm.d.ts +8 -7
- package/mobile/bundle/hooks/useJSONRef/resolveBlockProps.d.ts +1 -0
- package/mobile/bundle/ui-kit/BaseFiltration/filterBlocks.d.ts +1 -1
- package/mobile/bundle/ui-kit/BaseFiltration/useFiltrationForm.d.ts +10 -0
- package/mobile/dist/components/AdTile/AdTile.js +3 -1
- package/mobile/dist/components/AdTile/AdTile.js.map +1 -1
- package/mobile/dist/components/DepositFiltration/DepositFiltration.js +20 -11
- package/mobile/dist/components/DepositFiltration/DepositFiltration.js.map +1 -1
- package/mobile/dist/components/MortgageFiltration/MortgageFiltration.js +6 -7
- package/mobile/dist/components/MortgageFiltration/MortgageFiltration.js.map +1 -1
- package/mobile/dist/hooks/useForm.d.ts +8 -7
- package/mobile/dist/hooks/useForm.js.map +1 -1
- package/mobile/dist/hooks/useJSONRef/resolveBlockProps.d.ts +1 -0
- package/mobile/dist/hooks/useJSONRef/resolveBlockProps.js +6 -0
- package/mobile/dist/hooks/useJSONRef/resolveBlockProps.js.map +1 -0
- package/mobile/dist/hooks/useJSONRef/useJSONRef.js +2 -3
- package/mobile/dist/hooks/useJSONRef/useJSONRef.js.map +1 -1
- package/mobile/dist/ui-kit/BaseFiltration/filterBlocks.d.ts +1 -1
- package/mobile/dist/ui-kit/BaseFiltration/filterBlocks.js +3 -1
- package/mobile/dist/ui-kit/BaseFiltration/filterBlocks.js.map +1 -1
- package/mobile/dist/ui-kit/BaseFiltration/useFiltrationForm.d.ts +10 -0
- package/mobile/dist/ui-kit/BaseFiltration/useFiltrationForm.js +23 -0
- package/mobile/dist/ui-kit/BaseFiltration/useFiltrationForm.js.map +1 -0
- package/mobile/dist/ui-kit/Shimmer/Shimmer.js +1 -1
- package/mobile/dist/ui-kit/Shimmer/Shimmer.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/AdTile/AdTile.js +3 -1
- package/mobile/lib/components/AdTile/AdTile.js.map +1 -1
- package/mobile/lib/components/DepositFiltration/DepositFiltration.js +20 -11
- package/mobile/lib/components/DepositFiltration/DepositFiltration.js.map +1 -1
- package/mobile/lib/components/MortgageFiltration/MortgageFiltration.js +6 -7
- package/mobile/lib/components/MortgageFiltration/MortgageFiltration.js.map +1 -1
- package/mobile/lib/hooks/useForm.d.ts +8 -7
- package/mobile/lib/hooks/useForm.js.map +1 -1
- package/mobile/lib/hooks/useJSONRef/resolveBlockProps.d.ts +1 -0
- package/mobile/lib/hooks/useJSONRef/resolveBlockProps.js +3 -0
- package/mobile/lib/hooks/useJSONRef/resolveBlockProps.js.map +1 -0
- package/mobile/lib/hooks/useJSONRef/useJSONRef.js +3 -4
- package/mobile/lib/hooks/useJSONRef/useJSONRef.js.map +1 -1
- package/mobile/lib/ui-kit/BaseFiltration/filterBlocks.d.ts +1 -1
- package/mobile/lib/ui-kit/BaseFiltration/filterBlocks.js +3 -1
- package/mobile/lib/ui-kit/BaseFiltration/filterBlocks.js.map +1 -1
- package/mobile/lib/ui-kit/BaseFiltration/useFiltrationForm.d.ts +10 -0
- package/mobile/lib/ui-kit/BaseFiltration/useFiltrationForm.js +20 -0
- package/mobile/lib/ui-kit/BaseFiltration/useFiltrationForm.js.map +1 -0
- package/mobile/lib/ui-kit/Shimmer/Shimmer.js +1 -1
- package/mobile/lib/ui-kit/Shimmer/Shimmer.js.map +1 -1
- package/mobile/src/components/AdTile/AdTile.tsx +7 -1
- package/mobile/src/components/DepositFiltration/DepositFiltration.tsx +32 -16
- package/mobile/src/components/MortgageFiltration/MortgageFiltration.tsx +9 -13
- package/mobile/src/hooks/useForm.ts +9 -10
- package/mobile/src/hooks/useJSONRef/resolveBlockProps.ts +4 -0
- package/mobile/src/hooks/useJSONRef/useJSONRef.ts +3 -4
- package/mobile/src/ui-kit/BaseFiltration/filterBlocks.ts +8 -3
- package/mobile/src/ui-kit/BaseFiltration/useFiltrationForm.ts +52 -0
- package/mobile/src/ui-kit/Shimmer/Shimmer.tsx +1 -1
- package/package.json +1 -1
- package/src/components/AdTile/AdTile.tsx +7 -1
- package/src/components/DepositFiltration/DepositFiltration.fixture.mobile.tsx +3 -3
- package/src/components/DepositFiltration/DepositFiltration.fixture.tsx +10 -3
- package/src/components/DepositFiltration/DepositFiltration.tsx +32 -16
- package/src/components/MortgageFiltration/MortgageFiltration.tsx +9 -13
- package/src/hooks/useForm.ts +9 -10
- package/src/hooks/useJSONRef/resolveBlockProps.ts +4 -0
- package/src/hooks/useJSONRef/useJSONRef.ts +3 -4
- package/src/ui-kit/BaseFiltration/filterBlocks.ts +8 -3
- package/src/ui-kit/BaseFiltration/useFiltrationForm.ts +52 -0
- package/src/ui-kit/Shimmer/Shimmer.tsx +1 -1
- package/bundle/components/DepositFiltration/SourceItem.d.ts +0 -4
- package/bundle/components/DepositFiltration/getChildSourceBook.d.ts +0 -2
- package/bundle/components/DepositFiltration/getPeriod.d.ts +0 -4
- package/bundle/components/DepositFiltration/useDepositsPeriods.d.ts +0 -8
- package/dist/components/DepositFiltration/SourceItem.d.ts +0 -4
- package/dist/components/DepositFiltration/SourceItem.js +0 -2
- package/dist/components/DepositFiltration/SourceItem.js.map +0 -1
- package/dist/components/DepositFiltration/getChildSourceBook.d.ts +0 -2
- package/dist/components/DepositFiltration/getChildSourceBook.js +0 -6
- package/dist/components/DepositFiltration/getChildSourceBook.js.map +0 -1
- package/dist/components/DepositFiltration/getPeriod.d.ts +0 -4
- package/dist/components/DepositFiltration/getPeriod.js +0 -10
- package/dist/components/DepositFiltration/getPeriod.js.map +0 -1
- package/dist/components/DepositFiltration/useDepositsPeriods.d.ts +0 -8
- package/dist/components/DepositFiltration/useDepositsPeriods.js +0 -26
- package/dist/components/DepositFiltration/useDepositsPeriods.js.map +0 -1
- package/lib/components/DepositFiltration/SourceItem.d.ts +0 -4
- package/lib/components/DepositFiltration/SourceItem.js +0 -2
- package/lib/components/DepositFiltration/SourceItem.js.map +0 -1
- package/lib/components/DepositFiltration/getChildSourceBook.d.ts +0 -2
- package/lib/components/DepositFiltration/getChildSourceBook.js +0 -3
- package/lib/components/DepositFiltration/getChildSourceBook.js.map +0 -1
- package/lib/components/DepositFiltration/getPeriod.d.ts +0 -4
- package/lib/components/DepositFiltration/getPeriod.js +0 -7
- package/lib/components/DepositFiltration/getPeriod.js.map +0 -1
- package/lib/components/DepositFiltration/useDepositsPeriods.d.ts +0 -8
- package/lib/components/DepositFiltration/useDepositsPeriods.js +0 -23
- package/lib/components/DepositFiltration/useDepositsPeriods.js.map +0 -1
- package/mobile/bundle/components/DepositFiltration/SourceItem.d.ts +0 -4
- package/mobile/bundle/components/DepositFiltration/getChildSourceBook.d.ts +0 -2
- package/mobile/bundle/components/DepositFiltration/getPeriod.d.ts +0 -4
- package/mobile/bundle/components/DepositFiltration/useDepositsPeriods.d.ts +0 -8
- package/mobile/dist/components/DepositFiltration/SourceItem.d.ts +0 -4
- package/mobile/dist/components/DepositFiltration/SourceItem.js +0 -2
- package/mobile/dist/components/DepositFiltration/SourceItem.js.map +0 -1
- package/mobile/dist/components/DepositFiltration/getChildSourceBook.d.ts +0 -2
- package/mobile/dist/components/DepositFiltration/getChildSourceBook.js +0 -6
- package/mobile/dist/components/DepositFiltration/getChildSourceBook.js.map +0 -1
- package/mobile/dist/components/DepositFiltration/getPeriod.d.ts +0 -4
- package/mobile/dist/components/DepositFiltration/getPeriod.js +0 -10
- package/mobile/dist/components/DepositFiltration/getPeriod.js.map +0 -1
- package/mobile/dist/components/DepositFiltration/useDepositsPeriods.d.ts +0 -8
- package/mobile/dist/components/DepositFiltration/useDepositsPeriods.js +0 -26
- package/mobile/dist/components/DepositFiltration/useDepositsPeriods.js.map +0 -1
- package/mobile/lib/components/DepositFiltration/SourceItem.d.ts +0 -4
- package/mobile/lib/components/DepositFiltration/SourceItem.js +0 -2
- package/mobile/lib/components/DepositFiltration/SourceItem.js.map +0 -1
- package/mobile/lib/components/DepositFiltration/getChildSourceBook.d.ts +0 -2
- package/mobile/lib/components/DepositFiltration/getChildSourceBook.js +0 -3
- package/mobile/lib/components/DepositFiltration/getChildSourceBook.js.map +0 -1
- package/mobile/lib/components/DepositFiltration/getPeriod.d.ts +0 -4
- package/mobile/lib/components/DepositFiltration/getPeriod.js +0 -7
- package/mobile/lib/components/DepositFiltration/getPeriod.js.map +0 -1
- package/mobile/lib/components/DepositFiltration/useDepositsPeriods.d.ts +0 -8
- package/mobile/lib/components/DepositFiltration/useDepositsPeriods.js +0 -23
- package/mobile/lib/components/DepositFiltration/useDepositsPeriods.js.map +0 -1
- package/mobile/src/components/DepositFiltration/SourceItem.ts +0 -5
- package/mobile/src/components/DepositFiltration/getChildSourceBook.ts +0 -7
- package/mobile/src/components/DepositFiltration/getPeriod.ts +0 -13
- package/mobile/src/components/DepositFiltration/useDepositsPeriods.ts +0 -34
- package/src/components/DepositFiltration/SourceItem.ts +0 -5
- package/src/components/DepositFiltration/getChildSourceBook.ts +0 -7
- package/src/components/DepositFiltration/getPeriod.ts +0 -13
- package/src/components/DepositFiltration/useDepositsPeriods.ts +0 -34
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { deleteProp, traversePageBlocks } from '../utils.js';
|
|
2
|
+
|
|
3
|
+
export const description = 'v0.14.189';
|
|
4
|
+
|
|
5
|
+
export default traversePageBlocks(adjustFiltratitonBlock);
|
|
6
|
+
|
|
7
|
+
function adjustFiltratitonBlock(block) {
|
|
8
|
+
if (block?.type !== 'DepositFiltration' || !block?.blocks || block?.blocks?.length === 0) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
block?.blocks.map((_) => {
|
|
13
|
+
if (_?.content?.sourceBook) {
|
|
14
|
+
_.content.paramsSource = {
|
|
15
|
+
$ref: `/wcms-resources/${_?.content?.sourceBook}.json`,
|
|
16
|
+
};
|
|
17
|
+
deleteProp(_.content, 'sourceBook');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return _;
|
|
21
|
+
});
|
|
22
|
+
}
|
package/bundle/bundle.umd.js
CHANGED
|
@@ -74,11 +74,6 @@
|
|
|
74
74
|
return JSXTmpl;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
|
|
78
|
-
|
|
79
|
-
const isClient = !isSSR();
|
|
80
|
-
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
81
|
-
|
|
82
77
|
class EventBus {
|
|
83
78
|
subscribers = {};
|
|
84
79
|
subjectsStateMap = {};
|
|
@@ -156,6 +151,19 @@
|
|
|
156
151
|
return (jsx(Tag, { className: style('@container font-sans', isGroup ? 'group' : '', blockStyles[version], isHidden ? 'hidden' : '', padding || defaultPadding, className), ...(isGroup ? { 'data-ver': version } : {}), ...(block?.anchor ? { id: block.anchor } : {}), role: role, style: inlineStyles, children: children }));
|
|
157
152
|
});
|
|
158
153
|
|
|
154
|
+
const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
|
|
155
|
+
|
|
156
|
+
const isClient = !isSSR();
|
|
157
|
+
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
158
|
+
|
|
159
|
+
const GOLDEN_RATIO = 1.618;
|
|
160
|
+
const Shimmer = JSX(({ className, size }) => (jsx("figure", { className: style('m-0 mt-xl min-w-[80%]', className), children: renderShimmer(size) })));
|
|
161
|
+
const renderShimmer = (size = 3) => goldenSequence(100, size)
|
|
162
|
+
.map((_) => Math.floor(_))
|
|
163
|
+
.map(renderShimmerItem);
|
|
164
|
+
const renderShimmerItem = (width, index) => (jsx("div", { style: { width: `${width || 100}%` }, className: "h-4 mt-xs bg-secondary-dark relative overflow-hidden animate-pulse" }, String(index)));
|
|
165
|
+
const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
|
|
166
|
+
|
|
159
167
|
const headingTag = (tag) => tag;
|
|
160
168
|
|
|
161
169
|
const styles$2 = {
|
|
@@ -765,6 +773,8 @@
|
|
|
765
773
|
.filter((res) => res.status === 'fulfilled')
|
|
766
774
|
.map(({ value }) => value));
|
|
767
775
|
|
|
776
|
+
const resolveBlockProps = (content, fallback) => resolveRef(content, (_) => fallback?.[_]);
|
|
777
|
+
|
|
768
778
|
const useJSONRef = (content, fallback) => {
|
|
769
779
|
const refs = collectRef(content);
|
|
770
780
|
const [refsMap, setRefsMap] = useState({});
|
|
@@ -773,9 +783,7 @@
|
|
|
773
783
|
fetchRefs(refs).then(setRefsMap);
|
|
774
784
|
}
|
|
775
785
|
}, [refs.join()]);
|
|
776
|
-
return refs.length
|
|
777
|
-
? resolveRef(content, (_) => refsMap[_] || fallback?.[_])
|
|
778
|
-
: content;
|
|
786
|
+
return refs.length ? resolveBlockProps(content, { ...fallback, ...refsMap }) : content;
|
|
779
787
|
};
|
|
780
788
|
|
|
781
789
|
const extractContent = ({ block, options, className, defaultPadding, padding, isTheme, version, children, ...content }) => content;
|
|
@@ -795,7 +803,7 @@
|
|
|
795
803
|
const { items } = (props.options?.page?.adSourceBook ?? {});
|
|
796
804
|
const tileIndex = useMemo(() => randomNumber(0, items?.length), [items]);
|
|
797
805
|
const content = items?.[tileIndex];
|
|
798
|
-
return content ? (jsx(ClientOnly, { children: jsx(ProductBlock, { ...content, ...props }) })) :
|
|
806
|
+
return content ? (jsx(ClientOnly, { children: jsx(ProductBlock, { ...content, ...props }) })) : (jsx(BlockWrapper, { ...props, children: jsx(Shimmer, {}) }));
|
|
799
807
|
});
|
|
800
808
|
const randomNumber = (min = 0, max = 0) => Math.floor(Math.random() * (max - min) + min);
|
|
801
809
|
|
|
@@ -3433,6 +3441,42 @@
|
|
|
3433
3441
|
}, renderFoldButton: ({ isUnfolded, onToggle }) => (jsx(DefaultFoldButton, { className: style(topItemsCount < 1 ? 'hidden' : ''), disabled: !hiddenBlocks?.length, label: label, icon: ICONS$1[Number(isUnfolded)], dataTheme: rest.options?.page?.colorPalette, onClick: onToggle })) })] })] }));
|
|
3434
3442
|
});
|
|
3435
3443
|
|
|
3444
|
+
const SlideCheckboxGroup = JSX(({ value, onChange, items = [], multiple }) => {
|
|
3445
|
+
const handleChange = (newValue) => {
|
|
3446
|
+
if (!onChange) {
|
|
3447
|
+
return;
|
|
3448
|
+
}
|
|
3449
|
+
const hasAlready = value?.includes(newValue);
|
|
3450
|
+
if (multiple) {
|
|
3451
|
+
onChange(hasAlready ? (value || []).filter((v) => v !== newValue) : [...(value || []), newValue]);
|
|
3452
|
+
}
|
|
3453
|
+
else {
|
|
3454
|
+
onChange(hasAlready ? [] : [newValue]);
|
|
3455
|
+
}
|
|
3456
|
+
};
|
|
3457
|
+
return items.map((item) => (jsx(SlideCheckbox, { text: item?.title, value: [value].flatMap((_) => _).includes(item.value), onChange: () => handleChange(item.value), type: multiple ? 'checkbox' : 'radio' }, item.value)));
|
|
3458
|
+
});
|
|
3459
|
+
|
|
3460
|
+
const renderFiltrationForm$1 = ({ field, reset, filtrationSchema, resetButton, children, }) => (jsxs("form", { className: "flex flex-col @4xl:flex-row justify-between bg-white p-4xl gap-s @4xl:gap-0", children: [jsxs("div", { className: "flex flex-col @4xl:flex-row gap-5xl", children: [children, Object.entries(filtrationSchema).map(renderFormItem(field))] }), resetButton ? (jsx("div", { children: jsx(Button, { type: "reset", className: "w-full @4xl:w-72 @4xl:ml-s", onClick: reset, children: resetButton?.text }) })) : null] }));
|
|
3461
|
+
const renderFormItem = (field) => ([key, item]) => {
|
|
3462
|
+
const type = item?.type;
|
|
3463
|
+
switch (type) {
|
|
3464
|
+
case 'array':
|
|
3465
|
+
return renderCheckboxes(key, field)(item);
|
|
3466
|
+
default:
|
|
3467
|
+
return null;
|
|
3468
|
+
}
|
|
3469
|
+
};
|
|
3470
|
+
const renderCheckboxes = (key, field) => (item) => {
|
|
3471
|
+
const options = item?.items?.enum?.map((e, i) => ({ value: e, title: item?.items?.enumNames?.[i] || '' })) ||
|
|
3472
|
+
[];
|
|
3473
|
+
return (jsxs("div", { children: [item?.title ? (jsx("div", { className: "mb-m", children: jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: item.title }) })) : null, jsx(SlideCheckboxGroup, { items: options, multiple: !item?.single, ...field(key) })] }, key));
|
|
3474
|
+
};
|
|
3475
|
+
|
|
3476
|
+
function zip(firstCol, ...restCols) {
|
|
3477
|
+
return firstCol.map((firstEl, rowIndex) => [firstEl, ...restCols.map((col) => col[rowIndex])]);
|
|
3478
|
+
}
|
|
3479
|
+
|
|
3436
3480
|
const isEmpty = (v) => v === null ||
|
|
3437
3481
|
v === undefined ||
|
|
3438
3482
|
v === '' ||
|
|
@@ -3468,38 +3512,22 @@
|
|
|
3468
3512
|
.every((predicate) => predicate(target));
|
|
3469
3513
|
const naturalNumber = (n) => Number(n || 0);
|
|
3470
3514
|
|
|
3471
|
-
const filterBlocks = (
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
}
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
});
|
|
3488
|
-
|
|
3489
|
-
const renderFiltrationForm$1 = ({ field, reset, filtrationSchema, resetButton, children, }) => (jsxs("form", { className: "flex flex-col @4xl:flex-row justify-between bg-white p-4xl gap-s @4xl:gap-0", children: [jsxs("div", { className: "flex flex-col @4xl:flex-row gap-5xl", children: [children, Object.entries(filtrationSchema).map(renderFormItem(field))] }), resetButton ? (jsx("div", { children: jsx(Button, { type: "reset", className: "w-full @4xl:w-72 @4xl:ml-s", onClick: reset, children: resetButton?.text }) })) : null] }));
|
|
3490
|
-
const renderFormItem = (field) => ([key, item]) => {
|
|
3491
|
-
const type = item?.type;
|
|
3492
|
-
switch (type) {
|
|
3493
|
-
case 'array':
|
|
3494
|
-
return renderCheckboxes(key, field)(item);
|
|
3495
|
-
default:
|
|
3496
|
-
return null;
|
|
3497
|
-
}
|
|
3498
|
-
};
|
|
3499
|
-
const renderCheckboxes = (key, field) => (item) => {
|
|
3500
|
-
const options = item?.items?.enum?.map((e, i) => ({ value: e, title: item?.items?.enumNames?.[i] || '' })) ||
|
|
3501
|
-
[];
|
|
3502
|
-
return (jsxs("div", { children: [item?.title ? (jsx("div", { className: "mb-m", children: jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: item.title }) })) : null, jsx(SlideCheckboxGroup, { items: options, multiple: !item?.single, ...field(key) })] }, key));
|
|
3515
|
+
const filterBlocks = (blocksWithProps, filtrationState) => (normalize = identity) => blocksWithProps
|
|
3516
|
+
?.filter(([, content]) => targetMatchPattern(filtrationState, normalize(content) || {}))
|
|
3517
|
+
.map(([block]) => block);
|
|
3518
|
+
|
|
3519
|
+
const useFiltrationForm = (initialFormState, { block, page, normalize = identity, }) => {
|
|
3520
|
+
const blocks = block?.blocks || [];
|
|
3521
|
+
const [filtrationState, { field, reset, update: replaceFiltrationState }] = useForm(initialFormState);
|
|
3522
|
+
const blocksWithProps = useMemo(() => zip(blocks, blocks.map((b) => resolveBlockProps(b.content, page?.fallback))), [blocks, page?.fallback]);
|
|
3523
|
+
const blocksToRender = filtrationState === initialFormState
|
|
3524
|
+
? blocks
|
|
3525
|
+
: filterBlocks(blocksWithProps, filtrationState)(normalize);
|
|
3526
|
+
return [
|
|
3527
|
+
filtrationState,
|
|
3528
|
+
{ blocksToRender, blocksWithProps },
|
|
3529
|
+
{ field, reset, update: replaceFiltrationState },
|
|
3530
|
+
];
|
|
3503
3531
|
};
|
|
3504
3532
|
|
|
3505
3533
|
const isRateRow = (rateRow) => {
|
|
@@ -3508,37 +3536,6 @@
|
|
|
3508
3536
|
|
|
3509
3537
|
const numberRange = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
3510
3538
|
|
|
3511
|
-
const getPeriod = (source, content) => unique((source[content?.sourceBook]?.rateRows || [])
|
|
3512
|
-
.filter(isRateRow)
|
|
3513
|
-
.flatMap((_) => numberRange(_.minMonths, _.maxMonths)));
|
|
3514
|
-
|
|
3515
|
-
const fetchMultitudeJSON = (...urls) => {
|
|
3516
|
-
const fetchPromises = urls.map((url) => fetchJSON(url));
|
|
3517
|
-
return Promise.all(fetchPromises);
|
|
3518
|
-
};
|
|
3519
|
-
|
|
3520
|
-
function zip(firstCol, ...restCols) {
|
|
3521
|
-
return firstCol.map((firstEl, rowIndex) => [firstEl, ...restCols.map((col) => col[rowIndex])]);
|
|
3522
|
-
}
|
|
3523
|
-
|
|
3524
|
-
const getChildSourceBook = (blocks) => blocks?.filter(hasSourceBook).map(({ content: { sourceBook } }) => sourceBook);
|
|
3525
|
-
const hasSourceBook = (block) => Boolean(block && block.content && typeof block.content.sourceBook === 'string');
|
|
3526
|
-
|
|
3527
|
-
function useDepositsPeriods(blocks) {
|
|
3528
|
-
const { dirs = [], source = [] } = useMemo(() => {
|
|
3529
|
-
const sourceBooks = getChildSourceBook(blocks);
|
|
3530
|
-
return { dirs: sourceBooks?.map((url) => `/wcms-resources/${url}.json`), source: sourceBooks };
|
|
3531
|
-
}, [blocks]);
|
|
3532
|
-
const { data = [] } = useAsyncData(dirs, fetchMultitudeJSON);
|
|
3533
|
-
return {
|
|
3534
|
-
source: Object.fromEntries(zip(source, data).filter(([, sourceData]) => Boolean(sourceData))),
|
|
3535
|
-
months: unique(data
|
|
3536
|
-
.flatMap((item) => item?.rateRows || [])
|
|
3537
|
-
.filter(isRateRow)
|
|
3538
|
-
.flatMap((_) => numberRange(_.minMonths, _.maxMonths))).sort((a, b) => a - b) || [],
|
|
3539
|
-
};
|
|
3540
|
-
}
|
|
3541
|
-
|
|
3542
3539
|
const DEFAULT_MIN_SUM = 500;
|
|
3543
3540
|
const DEFAULT_MAX_SUM = 1000000000;
|
|
3544
3541
|
const initialFiltrationState$2 = {
|
|
@@ -3549,11 +3546,13 @@
|
|
|
3549
3546
|
period: 3,
|
|
3550
3547
|
};
|
|
3551
3548
|
const DepositFiltration = UniBlock(({ className, filtrationSchema = {}, resetButton, sumInput, periodInput, ...rest }) => {
|
|
3552
|
-
const {
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3549
|
+
const [, { blocksToRender, blocksWithProps }, { field, reset }] = useFiltrationForm(initialFiltrationState$2, {
|
|
3550
|
+
block: rest.block,
|
|
3551
|
+
page: rest.options?.page,
|
|
3552
|
+
normalize: (content) => ({ ...content, period: getPeriod(content) }),
|
|
3553
|
+
});
|
|
3554
|
+
const rateRows = blocksWithProps.map(([, _]) => _?.paramsSource?.rateRows);
|
|
3555
|
+
const months = getMonths(rateRows);
|
|
3557
3556
|
const Inputs = (jsxs("div", { children: [jsx(CurrencyInput, { label: sumInput?.title, min: DEFAULT_MIN_SUM, max: DEFAULT_MAX_SUM, ...field('sum', {
|
|
3558
3557
|
parse: (min) => ({ min: Number(min), max: DEFAULT_MAX_SUM }),
|
|
3559
3558
|
format: ({ min }) => String(min),
|
|
@@ -3563,12 +3562,19 @@
|
|
|
3563
3562
|
childrenTypes: ['ProductBlock'],
|
|
3564
3563
|
childSchema: (content) => ({
|
|
3565
3564
|
...(content?.filtrationSchema || {}),
|
|
3566
|
-
|
|
3567
|
-
type: '
|
|
3565
|
+
paramsSource: {
|
|
3566
|
+
type: 'object',
|
|
3568
3567
|
title: 'Адрес справочника',
|
|
3569
3568
|
},
|
|
3570
3569
|
}),
|
|
3571
3570
|
});
|
|
3571
|
+
const getPeriod = (content) => unique((content?.paramsSource?.rateRows || [])
|
|
3572
|
+
.filter(isRateRow)
|
|
3573
|
+
.flatMap((_) => numberRange(_.minMonths, _.maxMonths)));
|
|
3574
|
+
const getMonths = (rateRows) => unique(rateRows
|
|
3575
|
+
.flatMap((item) => item || [])
|
|
3576
|
+
.filter(isRateRow)
|
|
3577
|
+
.flatMap((_) => numberRange(_.minMonths, _.maxMonths))).sort((a, b) => a - b) || [];
|
|
3572
3578
|
|
|
3573
3579
|
const DEFAULT_OPTIONS = [{ key: '10' }, { key: '50' }, { key: '100' }];
|
|
3574
3580
|
const PageSizeSelector = ({ itemCount, onItemCountChange }) => {
|
|
@@ -4721,11 +4727,11 @@
|
|
|
4721
4727
|
stage: [],
|
|
4722
4728
|
};
|
|
4723
4729
|
const MortgageFiltration = UniBlock(({ className, hotFilters, filtrationSchema = {}, resetButton, ...rest }) => {
|
|
4724
|
-
const [filtrationState, { field, reset, update
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
const handleFiltrationStateChange = useCallback((_ = initialFiltrationState) =>
|
|
4730
|
+
const [filtrationState, { blocksToRender }, { field, reset, update }] = useFiltrationForm(initialFiltrationState, {
|
|
4731
|
+
block: rest.block,
|
|
4732
|
+
page: rest.options?.page,
|
|
4733
|
+
});
|
|
4734
|
+
const handleFiltrationStateChange = useCallback((_ = initialFiltrationState) => update(_), []);
|
|
4729
4735
|
const tabsControlProps = useHotFilters({
|
|
4730
4736
|
hotFilters,
|
|
4731
4737
|
filtrationState,
|
|
@@ -5210,14 +5216,6 @@
|
|
|
5210
5216
|
return (jsx(BlockWrapper, { version: "transparent", className: style(className), defaultPadding: "p-0", ...rest, children: dataType === 'offices' ? jsx(OfficesMap, {}) : jsx(AtmsMap, { data: data }) }));
|
|
5211
5217
|
});
|
|
5212
5218
|
|
|
5213
|
-
const GOLDEN_RATIO = 1.618;
|
|
5214
|
-
const Shimmer = JSX(({ className, size }) => (jsx("figure", { className: style('m-0 mt-xl min-w-[80%]', className), children: renderShimmer(size) })));
|
|
5215
|
-
const renderShimmer = (size = 3) => goldenSequence(100, size)
|
|
5216
|
-
.map((_) => Math.floor(_))
|
|
5217
|
-
.map(renderShimmerItem);
|
|
5218
|
-
const renderShimmerItem = (width, index) => (jsx("div", { style: { width: `${width || 100}%` }, className: "h-4 mt-xs bg-secondary-light" }, String(index)));
|
|
5219
|
-
const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
|
|
5220
|
-
|
|
5221
5219
|
const Placeholder = JSX(({ className, title, description = 'Блок в разработке...', ...rest }) => (jsxs(BlockWrapper, { className: style('box-border', className), ...rest, children: [jsx(Headline, { className: "max-w-[600px]", title: title, description: description, headlineVersion: "L", align: "text-left", isEmbedded: true }), jsx(Shimmer, {})] })));
|
|
5222
5220
|
|
|
5223
5221
|
const ProductGallery = JSX(({ className = '', padding, slides = [], ...rest }) => {
|
|
@@ -6074,7 +6072,7 @@
|
|
|
6074
6072
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
6075
6073
|
});
|
|
6076
6074
|
|
|
6077
|
-
const packageVersion = "0.14.
|
|
6075
|
+
const packageVersion = "0.14.197";
|
|
6078
6076
|
|
|
6079
6077
|
exports.Blocks = Blocks;
|
|
6080
6078
|
exports.ContentPage = ContentPage;
|