@redneckz/wildless-cms-uni-blocks 0.4.7 → 0.5.0
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 +14 -14
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/BaseTile/BaseTile.js +1 -1
- package/dist/components/BaseTile/BaseTile.js.map +1 -1
- package/dist/components/Calculator/Calculator.js +1 -1
- package/dist/components/Calculator/Calculator.js.map +1 -1
- package/dist/components/ContentPage/filterBlocks.d.ts +11 -0
- package/dist/components/ContentPage/filterBlocks.js +7 -0
- package/dist/components/ContentPage/filterBlocks.js.map +1 -0
- package/dist/components/ContentPage/filterBlocks.mobile.d.ts +11 -0
- package/dist/components/ContentPage/filterBlocks.mobile.js +10 -0
- package/dist/components/ContentPage/filterBlocks.mobile.js.map +1 -0
- package/dist/components/ContentPage/isBlockInRegistry.d.ts +2 -1
- package/dist/components/ContentPage/isBlockInRegistry.js.map +1 -1
- package/dist/components/ContentPage/normalizePage.d.ts +28 -1
- package/dist/components/ContentPage/normalizePage.js +6 -11
- package/dist/components/ContentPage/normalizePage.js.map +1 -1
- package/dist/components/ErrorBlock/ErrorBlockContent.d.ts +2 -2
- package/dist/components/Footer/HorizontalNavigation.js +1 -1
- package/dist/components/OfficeServicesBlock/OfficeServicesBlock.js +2 -2
- package/dist/components/OfficeServicesBlock/OfficeServicesBlock.js.map +1 -1
- package/dist/components/OfficeServicesBlock/OfficeServicesBlockContent.d.ts +2 -2
- package/dist/components/Recommendation/RecommendationCard.js +1 -1
- package/dist/components/Recommendation/RecommendationCard.js.map +1 -1
- package/dist/ui-kit/CurrencyInput/CurrencyInput.js +1 -1
- package/dist/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -1
- package/dist/ui-kit/Foldable/Foldable.js +2 -2
- package/dist/ui-kit/Foldable/Foldable.js.map +1 -1
- package/dist/ui-kit/Input/Input.js +1 -1
- package/dist/ui-kit/Input/Input.js.map +1 -1
- package/dist/ui-kit/Logo/Logo.js +2 -2
- package/dist/ui-kit/Logo/Logo.js.map +1 -1
- package/dist/ui-kit/SearchBar/SearchBarInner.js +1 -1
- package/dist/ui-kit/SearchBar/SearchBarInner.js.map +1 -1
- package/dist/ui-kit/Select/Select.js +1 -1
- package/dist/ui-kit/Select/Select.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/BaseTile/BaseTile.js +1 -1
- package/lib/components/BaseTile/BaseTile.js.map +1 -1
- package/lib/components/Calculator/Calculator.js +1 -1
- package/lib/components/Calculator/Calculator.js.map +1 -1
- package/lib/components/ContentPage/filterBlocks.d.ts +11 -0
- package/lib/components/ContentPage/filterBlocks.js +4 -0
- package/lib/components/ContentPage/filterBlocks.js.map +1 -0
- package/lib/components/ContentPage/filterBlocks.mobile.d.ts +11 -0
- package/lib/components/ContentPage/filterBlocks.mobile.js +7 -0
- package/lib/components/ContentPage/filterBlocks.mobile.js.map +1 -0
- package/lib/components/ContentPage/isBlockInRegistry.d.ts +2 -1
- package/lib/components/ContentPage/isBlockInRegistry.js.map +1 -1
- package/lib/components/ContentPage/normalizePage.d.ts +28 -1
- package/lib/components/ContentPage/normalizePage.js +6 -11
- package/lib/components/ContentPage/normalizePage.js.map +1 -1
- package/lib/components/ErrorBlock/ErrorBlockContent.d.ts +2 -2
- package/lib/components/Footer/HorizontalNavigation.js +1 -1
- package/lib/components/OfficeServicesBlock/OfficeServicesBlock.js +2 -2
- package/lib/components/OfficeServicesBlock/OfficeServicesBlock.js.map +1 -1
- package/lib/components/OfficeServicesBlock/OfficeServicesBlockContent.d.ts +2 -2
- package/lib/components/Recommendation/RecommendationCard.js +1 -1
- package/lib/components/Recommendation/RecommendationCard.js.map +1 -1
- package/lib/ui-kit/CurrencyInput/CurrencyInput.js +1 -1
- package/lib/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -1
- package/lib/ui-kit/Foldable/Foldable.js +2 -2
- package/lib/ui-kit/Foldable/Foldable.js.map +1 -1
- package/lib/ui-kit/Input/Input.js +1 -1
- package/lib/ui-kit/Input/Input.js.map +1 -1
- package/lib/ui-kit/Logo/Logo.js +2 -2
- package/lib/ui-kit/Logo/Logo.js.map +1 -1
- package/lib/ui-kit/SearchBar/SearchBarInner.js +1 -1
- package/lib/ui-kit/SearchBar/SearchBarInner.js.map +1 -1
- package/lib/ui-kit/Select/Select.js +1 -1
- package/lib/ui-kit/Select/Select.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +4 -4
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/BaseTile/BaseTile.js +1 -1
- package/mobile/dist/components/BaseTile/BaseTile.js.map +1 -1
- package/mobile/dist/components/Calculator/Calculator.js +1 -1
- package/mobile/dist/components/Calculator/Calculator.js.map +1 -1
- package/mobile/dist/components/ContentPage/filterBlocks.d.ts +3 -0
- package/mobile/dist/components/ContentPage/filterBlocks.js +10 -0
- package/mobile/dist/components/ContentPage/filterBlocks.js.map +1 -0
- package/mobile/dist/components/ContentPage/isBlockInRegistry.d.ts +2 -1
- package/mobile/dist/components/ContentPage/isBlockInRegistry.js.map +1 -1
- package/mobile/dist/components/ContentPage/normalizePage.d.ts +20 -1
- package/mobile/dist/components/ContentPage/normalizePage.js +6 -13
- package/mobile/dist/components/ContentPage/normalizePage.js.map +1 -1
- package/mobile/dist/components/ErrorBlock/ErrorBlockContent.d.ts +2 -2
- package/mobile/dist/components/OfficeServicesBlock/OfficeServicesBlock.js +2 -2
- package/mobile/dist/components/OfficeServicesBlock/OfficeServicesBlock.js.map +1 -1
- package/mobile/dist/components/OfficeServicesBlock/OfficeServicesBlockContent.d.ts +2 -2
- package/mobile/dist/components/Recommendation/RecommendationCard.js +1 -1
- package/mobile/dist/components/Recommendation/RecommendationCard.js.map +1 -1
- package/mobile/dist/ui-kit/CurrencyInput/CurrencyInput.js +1 -1
- package/mobile/dist/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -1
- package/mobile/dist/ui-kit/Foldable/Foldable.js +2 -2
- package/mobile/dist/ui-kit/Foldable/Foldable.js.map +1 -1
- package/mobile/dist/ui-kit/Input/Input.js +1 -1
- package/mobile/dist/ui-kit/Input/Input.js.map +1 -1
- package/mobile/dist/ui-kit/SearchBar/SearchBarInner.js +1 -1
- package/mobile/dist/ui-kit/SearchBar/SearchBarInner.js.map +1 -1
- package/mobile/dist/ui-kit/Select/Select.js +1 -1
- package/mobile/dist/ui-kit/Select/Select.js.map +1 -1
- package/mobile/lib/components/BaseTile/BaseTile.js +1 -1
- package/mobile/lib/components/BaseTile/BaseTile.js.map +1 -1
- package/mobile/lib/components/Calculator/Calculator.js +1 -1
- package/mobile/lib/components/Calculator/Calculator.js.map +1 -1
- package/mobile/lib/components/ContentPage/filterBlocks.d.ts +3 -0
- package/mobile/lib/components/ContentPage/filterBlocks.js +7 -0
- package/mobile/lib/components/ContentPage/filterBlocks.js.map +1 -0
- package/mobile/lib/components/ContentPage/isBlockInRegistry.d.ts +2 -1
- package/mobile/lib/components/ContentPage/isBlockInRegistry.js.map +1 -1
- package/mobile/lib/components/ContentPage/normalizePage.d.ts +20 -1
- package/mobile/lib/components/ContentPage/normalizePage.js +6 -13
- package/mobile/lib/components/ContentPage/normalizePage.js.map +1 -1
- package/mobile/lib/components/ErrorBlock/ErrorBlockContent.d.ts +2 -2
- package/mobile/lib/components/OfficeServicesBlock/OfficeServicesBlock.js +2 -2
- package/mobile/lib/components/OfficeServicesBlock/OfficeServicesBlock.js.map +1 -1
- package/mobile/lib/components/OfficeServicesBlock/OfficeServicesBlockContent.d.ts +2 -2
- package/mobile/lib/components/Recommendation/RecommendationCard.js +1 -1
- package/mobile/lib/components/Recommendation/RecommendationCard.js.map +1 -1
- package/mobile/lib/ui-kit/CurrencyInput/CurrencyInput.js +1 -1
- package/mobile/lib/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -1
- package/mobile/lib/ui-kit/Foldable/Foldable.js +2 -2
- package/mobile/lib/ui-kit/Foldable/Foldable.js.map +1 -1
- package/mobile/lib/ui-kit/Input/Input.js +1 -1
- package/mobile/lib/ui-kit/Input/Input.js.map +1 -1
- package/mobile/lib/ui-kit/SearchBar/SearchBarInner.js +1 -1
- package/mobile/lib/ui-kit/SearchBar/SearchBarInner.js.map +1 -1
- package/mobile/lib/ui-kit/Select/Select.js +1 -1
- package/mobile/lib/ui-kit/Select/Select.js.map +1 -1
- package/mobile/src/components/BaseTile/BaseTile.tsx +2 -2
- package/mobile/src/components/Calculator/Calculator.tsx +1 -1
- package/mobile/src/components/ContentPage/filterBlocks.ts +13 -0
- package/mobile/src/components/ContentPage/isBlockInRegistry.ts +3 -1
- package/mobile/src/components/ContentPage/normalizePage.ts +25 -36
- package/mobile/src/components/ErrorBlock/ErrorBlockContent.ts +2 -2
- package/mobile/src/components/OfficeServicesBlock/OfficeServicesBlock.tsx +2 -2
- package/mobile/src/components/OfficeServicesBlock/OfficeServicesBlockContent.ts +2 -2
- package/mobile/src/components/Recommendation/RecommendationCard.tsx +18 -16
- package/mobile/src/components/__snapshots__/Blocks.spec.tsx.snap +24 -14
- package/mobile/src/ui-kit/CurrencyInput/CurrencyInput.tsx +1 -1
- package/mobile/src/ui-kit/Foldable/Foldable.tsx +11 -2
- package/mobile/src/ui-kit/Input/Input.tsx +1 -1
- package/mobile/src/ui-kit/SearchBar/SearchBarInner.tsx +1 -1
- package/mobile/src/ui-kit/Select/Select.tsx +1 -1
- package/package.json +1 -1
- package/src/components/BaseTile/BaseTile.tsx +2 -2
- package/src/components/Calculator/Calculator.tsx +1 -1
- package/src/components/ContentPage/ContentPage.fixture.mobile.tsx +1 -1
- package/src/components/ContentPage/ContentPage.fixture.tsx +2 -2
- package/src/components/ContentPage/filterBlocks.mobile.ts +13 -0
- package/src/components/ContentPage/filterBlocks.ts +7 -0
- package/src/components/ContentPage/isBlockInRegistry.ts +3 -1
- package/src/components/ContentPage/normalizePage.ts +25 -31
- package/src/components/ErrorBlock/ErrorBlockContent.ts +2 -2
- package/src/components/Footer/HorizontalNavigation.tsx +1 -1
- package/src/components/OfficeServicesBlock/OfficeServicesBlock.fixture.tsx +1 -1
- package/src/components/OfficeServicesBlock/OfficeServicesBlock.tsx +2 -2
- package/src/components/OfficeServicesBlock/OfficeServicesBlockContent.ts +2 -2
- package/src/components/Recommendation/RecommendationCard.tsx +18 -16
- package/src/components/__snapshots__/Blocks.spec.tsx.snap +24 -14
- package/src/ui-kit/CurrencyInput/CurrencyInput.tsx +1 -1
- package/src/ui-kit/Foldable/Foldable.tsx +11 -2
- package/src/ui-kit/Input/Input.tsx +1 -1
- package/src/ui-kit/Logo/Logo.tsx +2 -2
- package/src/ui-kit/SearchBar/SearchBarInner.tsx +1 -1
- package/src/ui-kit/Select/Select.tsx +1 -1
- package/dist/components/ContentPage/normalizePage.mobile.d.ts +0 -2
- package/dist/components/ContentPage/normalizePage.mobile.js +0 -30
- package/dist/components/ContentPage/normalizePage.mobile.js.map +0 -1
- package/lib/components/ContentPage/normalizePage.mobile.d.ts +0 -2
- package/lib/components/ContentPage/normalizePage.mobile.js +0 -27
- package/lib/components/ContentPage/normalizePage.mobile.js.map +0 -1
- package/src/components/ContentPage/normalizePage.mobile.ts +0 -40
|
@@ -45,7 +45,7 @@ export const Foldable = JSX<FoldableProps>(
|
|
|
45
45
|
|
|
46
46
|
const buttonClassName =
|
|
47
47
|
foldButtonClasses ||
|
|
48
|
-
'border-none bg-primary-main hover:bg-primary-hover px-0 py-
|
|
48
|
+
'border-none bg-primary-main hover:bg-primary-hover px-0 py-5 mb-[1px] w-full font-sans text-white text-h4 flex justify-center cursor-pointer';
|
|
49
49
|
const getFoldButtonLabel = isActive ? 'Скрыть' : foldButtonLabel;
|
|
50
50
|
|
|
51
51
|
return blocks ? (
|
|
@@ -58,7 +58,16 @@ export const Foldable = JSX<FoldableProps>(
|
|
|
58
58
|
onClick={handleToggle}
|
|
59
59
|
>
|
|
60
60
|
<span className="pr-3">{getFoldButtonLabel}</span>
|
|
61
|
-
{icon ?
|
|
61
|
+
{icon ? (
|
|
62
|
+
<Icon
|
|
63
|
+
className="my-auto"
|
|
64
|
+
name={icon}
|
|
65
|
+
iconVersion="white"
|
|
66
|
+
width="20"
|
|
67
|
+
height="20"
|
|
68
|
+
asSVG
|
|
69
|
+
/>
|
|
70
|
+
) : null}
|
|
62
71
|
</button>
|
|
63
72
|
) : null}
|
|
64
73
|
</div>
|
|
@@ -10,7 +10,7 @@ export const Input = JSX<InputProps>(
|
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
12
|
<input
|
|
13
|
-
className={className}
|
|
13
|
+
className={`border-main-stroke hover:border-primary-hover active:border-primary-text focus:border-primary-text ${className}`}
|
|
14
14
|
id={id}
|
|
15
15
|
name={name || id}
|
|
16
16
|
type={type}
|
package/src/ui-kit/Logo/Logo.tsx
CHANGED
|
@@ -25,7 +25,7 @@ const SVG_COLOR: Record<BgColorVersion, string> = {
|
|
|
25
25
|
transparent: 'text-white',
|
|
26
26
|
};
|
|
27
27
|
const TEXT_COLOR: Record<BgColorVersion, string> = {
|
|
28
|
-
'bg-white': 'text-
|
|
28
|
+
'bg-white': 'text-primary-text',
|
|
29
29
|
transparent: 'text-white',
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -66,5 +66,5 @@ export const Logo = JSX<Partial<LogoProps>>(
|
|
|
66
66
|
const renderTitle = (children, bgColor, title) => {
|
|
67
67
|
const text = children || title || 'Россельхозбанк';
|
|
68
68
|
|
|
69
|
-
return <span className={`${TEXT_COLOR[bgColor]} font-
|
|
69
|
+
return <span className={`${TEXT_COLOR[bgColor]} font-medium ml-2.5`}>{text}</span>;
|
|
70
70
|
};
|
|
@@ -34,7 +34,7 @@ export const SearchBarInner = JSX<SearchBarInnerProps>(({ className, isMobile =
|
|
|
34
34
|
<input
|
|
35
35
|
id="search-bar-input"
|
|
36
36
|
className={`h-12 pl-12 w-full peer text-l text-black border border-solid rounded-md box-border
|
|
37
|
-
outline-none pr-[6%] border-main-
|
|
37
|
+
outline-none pr-[6%] border-main-stroke hover:border-primary-hover active:border-primary-text focus:border-primary-text ${SearchBarInputClassName}`}
|
|
38
38
|
value={term}
|
|
39
39
|
onChange={(e) => setTerm(e.target.value as string)}
|
|
40
40
|
type="text"
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.normalizePage = void 0;
|
|
3
|
-
const Blocks_1 = require("../Blocks");
|
|
4
|
-
const isBlockInRegistry_1 = require("./isBlockInRegistry");
|
|
5
|
-
const normalizeBlock_1 = require("./normalizeBlock");
|
|
6
|
-
function normalizePage(contentPage) {
|
|
7
|
-
if (!contentPage) {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
const { blocks, slots } = contentPage;
|
|
11
|
-
return {
|
|
12
|
-
...contentPage,
|
|
13
|
-
blocks: getMobileBlocks(blocks),
|
|
14
|
-
slots: slots &&
|
|
15
|
-
Object.keys(slots).reduce((res, key) => ({
|
|
16
|
-
...res,
|
|
17
|
-
[key]: {
|
|
18
|
-
...slots[key],
|
|
19
|
-
blocks: getMobileBlocks(slots[key].blocks),
|
|
20
|
-
},
|
|
21
|
-
}), {}),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
exports.normalizePage = normalizePage;
|
|
25
|
-
function getMobileBlocks(blocks) {
|
|
26
|
-
return blocks
|
|
27
|
-
?.filter((block) => (0, isBlockInRegistry_1.isBlockInRegistry)(block?.type || block?.mobile?.type, Blocks_1.Blocks) && !block.mobile?.hidden)
|
|
28
|
-
.map(normalizeBlock_1.normalizeBlock);
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=normalizePage.mobile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizePage.mobile.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.mobile.ts"],"names":[],"mappings":";;AACA,sCAAmC;AACnC,2DAAwD;AACxD,qDAAkD;AAElD,SAAgB,aAAa,CAC3B,WAA8C;IAE9C,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAEtC,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;QAC/B,KAAK,EACH,KAAK;YACL,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CACvB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;gBACb,GAAG,GAAG;gBACN,CAAC,GAAG,CAAC,EAAE;oBACL,GAAG,KAAK,CAAC,GAAG,CAAC;oBACb,MAAM,EAAE,eAAe,CAAE,KAAK,CAAC,GAAG,CAAU,CAAC,MAAM,CAAC;iBACrD;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC;AAzBD,sCAyBC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,OAAO,MAAM;QACX,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,IAAA,qCAAiB,EAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACzF;SACA,GAAG,CAAC,+BAAc,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Blocks } from '../Blocks.js';
|
|
2
|
-
import { isBlockInRegistry } from './isBlockInRegistry.js';
|
|
3
|
-
import { normalizeBlock } from './normalizeBlock.js';
|
|
4
|
-
export function normalizePage(contentPage) {
|
|
5
|
-
if (!contentPage) {
|
|
6
|
-
return undefined;
|
|
7
|
-
}
|
|
8
|
-
const { blocks, slots } = contentPage;
|
|
9
|
-
return {
|
|
10
|
-
...contentPage,
|
|
11
|
-
blocks: getMobileBlocks(blocks),
|
|
12
|
-
slots: slots &&
|
|
13
|
-
Object.keys(slots).reduce((res, key) => ({
|
|
14
|
-
...res,
|
|
15
|
-
[key]: {
|
|
16
|
-
...slots[key],
|
|
17
|
-
blocks: getMobileBlocks(slots[key].blocks),
|
|
18
|
-
},
|
|
19
|
-
}), {}),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function getMobileBlocks(blocks) {
|
|
23
|
-
return blocks
|
|
24
|
-
?.filter((block) => isBlockInRegistry(block?.type || block?.mobile?.type, Blocks) && !block.mobile?.hidden)
|
|
25
|
-
.map(normalizeBlock);
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=normalizePage.mobile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizePage.mobile.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.mobile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,UAAU,aAAa,CAC3B,WAA8C;IAE9C,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAEtC,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;QAC/B,KAAK,EACH,KAAK;YACL,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CACvB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;gBACb,GAAG,GAAG;gBACN,CAAC,GAAG,CAAC,EAAE;oBACL,GAAG,KAAK,CAAC,GAAG,CAAC;oBACb,MAAM,EAAE,eAAe,CAAE,KAAK,CAAC,GAAG,CAAU,CAAC,MAAM,CAAC;iBACrD;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,OAAO,MAAM;QACX,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,iBAAiB,CAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACzF;SACA,GAAG,CAAC,cAAc,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { BlockDef, ContentPageDef, Slot } from '../../types';
|
|
2
|
-
import { Blocks } from '../Blocks';
|
|
3
|
-
import { isBlockInRegistry } from './isBlockInRegistry';
|
|
4
|
-
import { normalizeBlock } from './normalizeBlock';
|
|
5
|
-
|
|
6
|
-
export function normalizePage(
|
|
7
|
-
contentPage: ContentPageDef | undefined | null,
|
|
8
|
-
): ContentPageDef | undefined {
|
|
9
|
-
if (!contentPage) {
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const { blocks, slots } = contentPage;
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
...contentPage,
|
|
17
|
-
blocks: getMobileBlocks(blocks),
|
|
18
|
-
slots:
|
|
19
|
-
slots &&
|
|
20
|
-
Object.keys(slots).reduce(
|
|
21
|
-
(res, key) => ({
|
|
22
|
-
...res,
|
|
23
|
-
[key]: {
|
|
24
|
-
...slots[key],
|
|
25
|
-
blocks: getMobileBlocks((slots[key] as Slot).blocks),
|
|
26
|
-
},
|
|
27
|
-
}),
|
|
28
|
-
{},
|
|
29
|
-
),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function getMobileBlocks(blocks?: BlockDef[]) {
|
|
34
|
-
return blocks
|
|
35
|
-
?.filter(
|
|
36
|
-
(block) =>
|
|
37
|
-
isBlockInRegistry(block?.type || block?.mobile?.type, Blocks) && !block.mobile?.hidden,
|
|
38
|
-
)
|
|
39
|
-
.map(normalizeBlock);
|
|
40
|
-
}
|