@redneckz/wildless-cms-uni-blocks 0.4.8 → 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/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/normalizePage.d.ts +27 -1
- package/dist/components/ContentPage/normalizePage.js +5 -11
- package/dist/components/ContentPage/normalizePage.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/normalizePage.d.ts +27 -1
- package/lib/components/ContentPage/normalizePage.js +5 -11
- package/lib/components/ContentPage/normalizePage.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/normalizePage.d.ts +19 -1
- package/mobile/dist/components/ContentPage/normalizePage.js +5 -12
- package/mobile/dist/components/ContentPage/normalizePage.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/normalizePage.d.ts +19 -1
- package/mobile/lib/components/ContentPage/normalizePage.js +5 -12
- package/mobile/lib/components/ContentPage/normalizePage.js.map +1 -1
- package/mobile/src/components/ContentPage/filterBlocks.ts +13 -0
- package/mobile/src/components/ContentPage/normalizePage.ts +24 -37
- package/package.json +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/normalizePage.ts +24 -33
- package/dist/components/ContentPage/normalizePage.mobile.d.ts +0 -3
- 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 -3
- 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 -42
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockDef } from '../../types';
|
|
2
|
+
import { BlocksRegistry } from './ContentPage';
|
|
3
|
+
export declare const filterBlocks: (blocks: BlockDef[], blocksRegistry: BlocksRegistry) => {
|
|
4
|
+
type?: string | undefined;
|
|
5
|
+
style?: string[] | undefined;
|
|
6
|
+
content?: import("../BlockContent").BlockContent | undefined;
|
|
7
|
+
version?: import("../../model/BlockVersion").BlockVersion | undefined;
|
|
8
|
+
hidden?: boolean | undefined;
|
|
9
|
+
anchor?: string | undefined;
|
|
10
|
+
labels?: string[] | undefined;
|
|
11
|
+
}[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.filterBlocks = void 0;
|
|
3
|
+
const isBlockInRegistry_1 = require("./isBlockInRegistry");
|
|
4
|
+
const normalizeBlock_1 = require("./normalizeBlock");
|
|
5
|
+
const filterBlocks = (blocks, blocksRegistry) => blocks?.filter((block) => (0, isBlockInRegistry_1.isBlockInRegistry)(block?.type, blocksRegistry)).map(normalizeBlock_1.normalizeBlock);
|
|
6
|
+
exports.filterBlocks = filterBlocks;
|
|
7
|
+
//# sourceMappingURL=filterBlocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterBlocks.js","sourceRoot":"","sources":["../../../src/components/ContentPage/filterBlocks.ts"],"names":[],"mappings":";;AAEA,2DAAwD;AACxD,qDAAkD;AAE3C,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAE,cAA8B,EAAE,EAAE,CACjF,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,qCAAiB,EAAC,KAAK,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,+BAAc,CAAC,CAAC;AADnF,QAAA,YAAY,gBACuE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockDef } from '../../types';
|
|
2
|
+
import { BlocksRegistry } from './ContentPage';
|
|
3
|
+
export declare const filterBlocks: (blocks: BlockDef[], blocksRegistry: BlocksRegistry) => {
|
|
4
|
+
type?: string | undefined;
|
|
5
|
+
style?: string[] | undefined;
|
|
6
|
+
content?: import("../BlockContent").BlockContent | undefined;
|
|
7
|
+
version?: import("../../model/BlockVersion").BlockVersion | undefined;
|
|
8
|
+
hidden?: boolean | undefined;
|
|
9
|
+
anchor?: string | undefined;
|
|
10
|
+
labels?: string[] | undefined;
|
|
11
|
+
}[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.filterBlocks = void 0;
|
|
3
|
+
const isBlockInRegistry_1 = require("./isBlockInRegistry");
|
|
4
|
+
const normalizeBlock_1 = require("./normalizeBlock");
|
|
5
|
+
const filterBlocks = (blocks, blocksRegistry) => blocks
|
|
6
|
+
?.filter((block) => (0, isBlockInRegistry_1.isBlockInRegistry)(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
7
|
+
!block.mobile?.hidden)
|
|
8
|
+
.map(normalizeBlock_1.normalizeBlock);
|
|
9
|
+
exports.filterBlocks = filterBlocks;
|
|
10
|
+
//# sourceMappingURL=filterBlocks.mobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterBlocks.mobile.js","sourceRoot":"","sources":["../../../src/components/ContentPage/filterBlocks.mobile.ts"],"names":[],"mappings":";;AAEA,2DAAwD;AACxD,qDAAkD;AAE3C,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAE,cAA8B,EAAE,EAAE,CACjF,MAAM;IACJ,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,IAAA,qCAAiB,EAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC;IACrE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACxB;KACA,GAAG,CAAC,+BAAc,CAAC,CAAC;AAPZ,QAAA,YAAY,gBAOA"}
|
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
import type { ContentPageDef } from '../../types';
|
|
2
2
|
import { BlocksRegistry } from './ContentPage';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const normalizePage: (blocksRegistry: BlocksRegistry) => (contentPage: ContentPageDef | undefined | null) => {
|
|
4
|
+
blocks: {
|
|
5
|
+
type?: string | undefined;
|
|
6
|
+
style?: string[] | undefined;
|
|
7
|
+
content?: import("../BlockContent").BlockContent | undefined;
|
|
8
|
+
version?: import("../../model/BlockVersion").BlockVersion | undefined;
|
|
9
|
+
hidden?: boolean | undefined;
|
|
10
|
+
anchor?: string | undefined;
|
|
11
|
+
labels?: string[] | undefined;
|
|
12
|
+
}[];
|
|
13
|
+
slots: {} | undefined;
|
|
14
|
+
_customPageType?: string | undefined;
|
|
15
|
+
style?: string[] | undefined;
|
|
16
|
+
likeControl?: boolean | undefined;
|
|
17
|
+
colorPalette?: import("../../types").ColorPalette | undefined;
|
|
18
|
+
title?: string | undefined;
|
|
19
|
+
slug?: string | undefined;
|
|
20
|
+
main?: {
|
|
21
|
+
description?: string | undefined;
|
|
22
|
+
keywords?: string[] | undefined;
|
|
23
|
+
canonical?: string | undefined;
|
|
24
|
+
robots?: string[] | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
og?: Record<string, string> | undefined;
|
|
27
|
+
twitter?: Record<string, string> | undefined;
|
|
28
|
+
jsonLd?: string | undefined;
|
|
29
|
+
} | undefined;
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.normalizePage = void 0;
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
function normalizePage(contentPage, blocksRegistry) {
|
|
3
|
+
const filterBlocks_1 = require("./filterBlocks");
|
|
4
|
+
const normalizePage = (blocksRegistry) => (contentPage) => {
|
|
6
5
|
if (!contentPage) {
|
|
7
6
|
return undefined;
|
|
8
7
|
}
|
|
9
8
|
const { blocks = [], slots } = contentPage;
|
|
10
9
|
return {
|
|
11
10
|
...contentPage,
|
|
12
|
-
blocks:
|
|
11
|
+
blocks: (0, filterBlocks_1.filterBlocks)(blocks, blocksRegistry),
|
|
13
12
|
slots: slots &&
|
|
14
13
|
Object.keys(slots).reduce((res, key) => ({
|
|
15
14
|
...res,
|
|
16
15
|
[key]: {
|
|
17
16
|
...slots[key],
|
|
18
|
-
blocks:
|
|
17
|
+
blocks: (0, filterBlocks_1.filterBlocks)(slots[key].blocks || [], blocksRegistry),
|
|
19
18
|
},
|
|
20
19
|
}), {}),
|
|
21
20
|
};
|
|
22
|
-
}
|
|
21
|
+
};
|
|
23
22
|
exports.normalizePage = normalizePage;
|
|
24
|
-
function getDesktopBlocks(blocks, blocksRegistry) {
|
|
25
|
-
return blocks
|
|
26
|
-
?.filter((block) => (0, isBlockInRegistry_1.isBlockInRegistry)(block?.type, blocksRegistry))
|
|
27
|
-
.map(normalizeBlock_1.normalizeBlock);
|
|
28
|
-
}
|
|
29
23
|
//# sourceMappingURL=normalizePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizePage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"normalizePage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.ts"],"names":[],"mappings":";;AAEA,iDAA8C;AAEvC,MAAM,aAAa,GACxB,CAAC,cAA8B,EAAE,EAAE,CAAC,CAAC,WAA8C,EAAE,EAAE;IACrF,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,IAAA,2BAAY,EAAC,MAAM,EAAE,cAAc,CAAC;QAC5C,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,IAAA,2BAAY,EAAE,KAAK,CAAC,GAAG,CAAU,CAAC,MAAM,IAAI,EAAE,EAAE,cAAc,CAAC;iBACxE;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC,CAAC;AAxBS,QAAA,aAAa,iBAwBtB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockDef } from '../../types';
|
|
2
|
+
import { BlocksRegistry } from './ContentPage';
|
|
3
|
+
export declare const filterBlocks: (blocks: BlockDef[], blocksRegistry: BlocksRegistry) => {
|
|
4
|
+
type?: string | undefined;
|
|
5
|
+
style?: string[] | undefined;
|
|
6
|
+
content?: import("../BlockContent").BlockContent | undefined;
|
|
7
|
+
version?: import("../../model/BlockVersion").BlockVersion | undefined;
|
|
8
|
+
hidden?: boolean | undefined;
|
|
9
|
+
anchor?: string | undefined;
|
|
10
|
+
labels?: string[] | undefined;
|
|
11
|
+
}[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { isBlockInRegistry } from './isBlockInRegistry.js';
|
|
2
|
+
import { normalizeBlock } from './normalizeBlock.js';
|
|
3
|
+
export const filterBlocks = (blocks, blocksRegistry) => blocks?.filter((block) => isBlockInRegistry(block?.type, blocksRegistry)).map(normalizeBlock);
|
|
4
|
+
//# sourceMappingURL=filterBlocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterBlocks.js","sourceRoot":"","sources":["../../../src/components/ContentPage/filterBlocks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAE,cAA8B,EAAE,EAAE,CACjF,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockDef } from '../../types';
|
|
2
|
+
import { BlocksRegistry } from './ContentPage';
|
|
3
|
+
export declare const filterBlocks: (blocks: BlockDef[], blocksRegistry: BlocksRegistry) => {
|
|
4
|
+
type?: string | undefined;
|
|
5
|
+
style?: string[] | undefined;
|
|
6
|
+
content?: import("../BlockContent").BlockContent | undefined;
|
|
7
|
+
version?: import("../../model/BlockVersion").BlockVersion | undefined;
|
|
8
|
+
hidden?: boolean | undefined;
|
|
9
|
+
anchor?: string | undefined;
|
|
10
|
+
labels?: string[] | undefined;
|
|
11
|
+
}[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isBlockInRegistry } from './isBlockInRegistry.js';
|
|
2
|
+
import { normalizeBlock } from './normalizeBlock.js';
|
|
3
|
+
export const filterBlocks = (blocks, blocksRegistry) => blocks
|
|
4
|
+
?.filter((block) => isBlockInRegistry(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
5
|
+
!block.mobile?.hidden)
|
|
6
|
+
.map(normalizeBlock);
|
|
7
|
+
//# sourceMappingURL=filterBlocks.mobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterBlocks.mobile.js","sourceRoot":"","sources":["../../../src/components/ContentPage/filterBlocks.mobile.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAE,cAA8B,EAAE,EAAE,CACjF,MAAM;IACJ,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,iBAAiB,CAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC;IACrE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACxB;KACA,GAAG,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
import type { ContentPageDef } from '../../types';
|
|
2
2
|
import { BlocksRegistry } from './ContentPage';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const normalizePage: (blocksRegistry: BlocksRegistry) => (contentPage: ContentPageDef | undefined | null) => {
|
|
4
|
+
blocks: {
|
|
5
|
+
type?: string | undefined;
|
|
6
|
+
style?: string[] | undefined;
|
|
7
|
+
content?: import("../BlockContent").BlockContent | undefined;
|
|
8
|
+
version?: import("../../model/BlockVersion").BlockVersion | undefined;
|
|
9
|
+
hidden?: boolean | undefined;
|
|
10
|
+
anchor?: string | undefined;
|
|
11
|
+
labels?: string[] | undefined;
|
|
12
|
+
}[];
|
|
13
|
+
slots: {} | undefined;
|
|
14
|
+
_customPageType?: string | undefined;
|
|
15
|
+
style?: string[] | undefined;
|
|
16
|
+
likeControl?: boolean | undefined;
|
|
17
|
+
colorPalette?: import("../../types").ColorPalette | undefined;
|
|
18
|
+
title?: string | undefined;
|
|
19
|
+
slug?: string | undefined;
|
|
20
|
+
main?: {
|
|
21
|
+
description?: string | undefined;
|
|
22
|
+
keywords?: string[] | undefined;
|
|
23
|
+
canonical?: string | undefined;
|
|
24
|
+
robots?: string[] | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
og?: Record<string, string> | undefined;
|
|
27
|
+
twitter?: Record<string, string> | undefined;
|
|
28
|
+
jsonLd?: string | undefined;
|
|
29
|
+
} | undefined;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export function normalizePage(contentPage, blocksRegistry) {
|
|
1
|
+
import { filterBlocks } from './filterBlocks.js';
|
|
2
|
+
export const normalizePage = (blocksRegistry) => (contentPage) => {
|
|
4
3
|
if (!contentPage) {
|
|
5
4
|
return undefined;
|
|
6
5
|
}
|
|
7
6
|
const { blocks = [], slots } = contentPage;
|
|
8
7
|
return {
|
|
9
8
|
...contentPage,
|
|
10
|
-
blocks:
|
|
9
|
+
blocks: filterBlocks(blocks, blocksRegistry),
|
|
11
10
|
slots: slots &&
|
|
12
11
|
Object.keys(slots).reduce((res, key) => ({
|
|
13
12
|
...res,
|
|
14
13
|
[key]: {
|
|
15
14
|
...slots[key],
|
|
16
|
-
blocks:
|
|
15
|
+
blocks: filterBlocks(slots[key].blocks || [], blocksRegistry),
|
|
17
16
|
},
|
|
18
17
|
}), {}),
|
|
19
18
|
};
|
|
20
|
-
}
|
|
21
|
-
function getDesktopBlocks(blocks, blocksRegistry) {
|
|
22
|
-
return blocks
|
|
23
|
-
?.filter((block) => isBlockInRegistry(block?.type, blocksRegistry))
|
|
24
|
-
.map(normalizeBlock);
|
|
25
|
-
}
|
|
19
|
+
};
|
|
26
20
|
//# sourceMappingURL=normalizePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizePage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"normalizePage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GACxB,CAAC,cAA8B,EAAE,EAAE,CAAC,CAAC,WAA8C,EAAE,EAAE;IACrF,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC;QAC5C,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,YAAY,CAAE,KAAK,CAAC,GAAG,CAAU,CAAC,MAAM,IAAI,EAAE,EAAE,cAAc,CAAC;iBACxE;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.filterBlocks = void 0;
|
|
3
|
+
const isBlockInRegistry_1 = require("./isBlockInRegistry");
|
|
4
|
+
const normalizeBlock_1 = require("./normalizeBlock");
|
|
5
|
+
const filterBlocks = (blocks, blocksRegistry) => blocks
|
|
6
|
+
?.filter((block) => (0, isBlockInRegistry_1.isBlockInRegistry)(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
7
|
+
!block.mobile?.hidden)
|
|
8
|
+
.map(normalizeBlock_1.normalizeBlock);
|
|
9
|
+
exports.filterBlocks = filterBlocks;
|
|
10
|
+
//# sourceMappingURL=filterBlocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterBlocks.js","sourceRoot":"","sources":["../../../src/components/ContentPage/filterBlocks.ts"],"names":[],"mappings":";;AAEA,2DAAwD;AACxD,qDAAkD;AAE3C,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAE,cAA8B,EAAE,EAAE,CACjF,MAAM;IACJ,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,IAAA,qCAAiB,EAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC;IACrE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACxB;KACA,GAAG,CAAC,+BAAc,CAAC,CAAC;AAPZ,QAAA,YAAY,gBAOA"}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
import type { ContentPageDef } from '../../types';
|
|
2
2
|
import { BlocksRegistry } from './ContentPage';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const normalizePage: (blocksRegistry: BlocksRegistry) => (contentPage: ContentPageDef | undefined | null) => {
|
|
4
|
+
blocks: import("../../types").BlockDef[];
|
|
5
|
+
slots: {} | undefined;
|
|
6
|
+
_customPageType?: string | undefined;
|
|
7
|
+
style?: string[] | undefined;
|
|
8
|
+
likeControl?: boolean | undefined;
|
|
9
|
+
colorPalette?: import("../../types").ColorPalette | undefined;
|
|
10
|
+
title?: string | undefined;
|
|
11
|
+
slug?: string | undefined;
|
|
12
|
+
main?: {
|
|
13
|
+
description?: string | undefined;
|
|
14
|
+
keywords?: string[] | undefined;
|
|
15
|
+
canonical?: string | undefined;
|
|
16
|
+
robots?: string[] | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
og?: Record<string, string> | undefined;
|
|
19
|
+
twitter?: Record<string, string> | undefined;
|
|
20
|
+
jsonLd?: string | undefined;
|
|
21
|
+
} | undefined;
|
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.normalizePage = void 0;
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
function normalizePage(contentPage, blocksRegistry) {
|
|
3
|
+
const filterBlocks_1 = require("./filterBlocks");
|
|
4
|
+
const normalizePage = (blocksRegistry) => (contentPage) => {
|
|
6
5
|
if (!contentPage) {
|
|
7
6
|
return undefined;
|
|
8
7
|
}
|
|
9
8
|
const { blocks = [], slots } = contentPage;
|
|
10
9
|
return {
|
|
11
10
|
...contentPage,
|
|
12
|
-
blocks:
|
|
11
|
+
blocks: (0, filterBlocks_1.filterBlocks)(blocks, blocksRegistry),
|
|
13
12
|
slots: slots &&
|
|
14
13
|
Object.keys(slots).reduce((res, key) => ({
|
|
15
14
|
...res,
|
|
16
15
|
[key]: {
|
|
17
16
|
...slots[key],
|
|
18
|
-
blocks:
|
|
17
|
+
blocks: (0, filterBlocks_1.filterBlocks)(slots[key].blocks || [], blocksRegistry),
|
|
19
18
|
},
|
|
20
19
|
}), {}),
|
|
21
20
|
};
|
|
22
|
-
}
|
|
21
|
+
};
|
|
23
22
|
exports.normalizePage = normalizePage;
|
|
24
|
-
function getMobileBlocks(blocks, blocksRegistry) {
|
|
25
|
-
return blocks
|
|
26
|
-
?.filter((block) => (0, isBlockInRegistry_1.isBlockInRegistry)(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
27
|
-
!block.mobile?.hidden)
|
|
28
|
-
.map(normalizeBlock_1.normalizeBlock);
|
|
29
|
-
}
|
|
30
23
|
//# sourceMappingURL=normalizePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizePage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"normalizePage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.ts"],"names":[],"mappings":";;AAEA,iDAA8C;AAEvC,MAAM,aAAa,GACxB,CAAC,cAA8B,EAAE,EAAE,CAAC,CAAC,WAA8C,EAAE,EAAE;IACrF,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,IAAA,2BAAY,EAAC,MAAM,EAAE,cAAc,CAAC;QAC5C,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,IAAA,2BAAY,EAAE,KAAK,CAAC,GAAG,CAAU,CAAC,MAAM,IAAI,EAAE,EAAE,cAAc,CAAC;iBACxE;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC,CAAC;AAxBS,QAAA,aAAa,iBAwBtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isBlockInRegistry } from './isBlockInRegistry.js';
|
|
2
|
+
import { normalizeBlock } from './normalizeBlock.js';
|
|
3
|
+
export const filterBlocks = (blocks, blocksRegistry) => blocks
|
|
4
|
+
?.filter((block) => isBlockInRegistry(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
5
|
+
!block.mobile?.hidden)
|
|
6
|
+
.map(normalizeBlock);
|
|
7
|
+
//# sourceMappingURL=filterBlocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterBlocks.js","sourceRoot":"","sources":["../../../src/components/ContentPage/filterBlocks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAkB,EAAE,cAA8B,EAAE,EAAE,CACjF,MAAM;IACJ,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,iBAAiB,CAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC;IACrE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACxB;KACA,GAAG,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
import type { ContentPageDef } from '../../types';
|
|
2
2
|
import { BlocksRegistry } from './ContentPage';
|
|
3
|
-
export declare
|
|
3
|
+
export declare const normalizePage: (blocksRegistry: BlocksRegistry) => (contentPage: ContentPageDef | undefined | null) => {
|
|
4
|
+
blocks: import("../../types").BlockDef[];
|
|
5
|
+
slots: {} | undefined;
|
|
6
|
+
_customPageType?: string | undefined;
|
|
7
|
+
style?: string[] | undefined;
|
|
8
|
+
likeControl?: boolean | undefined;
|
|
9
|
+
colorPalette?: import("../../types").ColorPalette | undefined;
|
|
10
|
+
title?: string | undefined;
|
|
11
|
+
slug?: string | undefined;
|
|
12
|
+
main?: {
|
|
13
|
+
description?: string | undefined;
|
|
14
|
+
keywords?: string[] | undefined;
|
|
15
|
+
canonical?: string | undefined;
|
|
16
|
+
robots?: string[] | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
og?: Record<string, string> | undefined;
|
|
19
|
+
twitter?: Record<string, string> | undefined;
|
|
20
|
+
jsonLd?: string | undefined;
|
|
21
|
+
} | undefined;
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export function normalizePage(contentPage, blocksRegistry) {
|
|
1
|
+
import { filterBlocks } from './filterBlocks.js';
|
|
2
|
+
export const normalizePage = (blocksRegistry) => (contentPage) => {
|
|
4
3
|
if (!contentPage) {
|
|
5
4
|
return undefined;
|
|
6
5
|
}
|
|
7
6
|
const { blocks = [], slots } = contentPage;
|
|
8
7
|
return {
|
|
9
8
|
...contentPage,
|
|
10
|
-
blocks:
|
|
9
|
+
blocks: filterBlocks(blocks, blocksRegistry),
|
|
11
10
|
slots: slots &&
|
|
12
11
|
Object.keys(slots).reduce((res, key) => ({
|
|
13
12
|
...res,
|
|
14
13
|
[key]: {
|
|
15
14
|
...slots[key],
|
|
16
|
-
blocks:
|
|
15
|
+
blocks: filterBlocks(slots[key].blocks || [], blocksRegistry),
|
|
17
16
|
},
|
|
18
17
|
}), {}),
|
|
19
18
|
};
|
|
20
|
-
}
|
|
21
|
-
function getMobileBlocks(blocks, blocksRegistry) {
|
|
22
|
-
return blocks
|
|
23
|
-
?.filter((block) => isBlockInRegistry(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
24
|
-
!block.mobile?.hidden)
|
|
25
|
-
.map(normalizeBlock);
|
|
26
|
-
}
|
|
19
|
+
};
|
|
27
20
|
//# sourceMappingURL=normalizePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizePage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"normalizePage.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GACxB,CAAC,cAA8B,EAAE,EAAE,CAAC,CAAC,WAA8C,EAAE,EAAE;IACrF,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC;QAC5C,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,YAAY,CAAE,KAAK,CAAC,GAAG,CAAU,CAAC,MAAM,IAAI,EAAE,EAAE,cAAc,CAAC;iBACxE;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BlockDef } from '../../types';
|
|
2
|
+
import { BlocksRegistry } from './ContentPage';
|
|
3
|
+
import { isBlockInRegistry } from './isBlockInRegistry';
|
|
4
|
+
import { normalizeBlock } from './normalizeBlock';
|
|
5
|
+
|
|
6
|
+
export const filterBlocks = (blocks: BlockDef[], blocksRegistry: BlocksRegistry) =>
|
|
7
|
+
blocks
|
|
8
|
+
?.filter(
|
|
9
|
+
(block) =>
|
|
10
|
+
isBlockInRegistry(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
11
|
+
!block.mobile?.hidden,
|
|
12
|
+
)
|
|
13
|
+
.map(normalizeBlock);
|
|
@@ -1,42 +1,29 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContentPageDef, Slot } from '../../types';
|
|
2
2
|
import { BlocksRegistry } from './ContentPage';
|
|
3
|
-
import {
|
|
4
|
-
import { normalizeBlock } from './normalizeBlock';
|
|
3
|
+
import { filterBlocks } from './filterBlocks';
|
|
5
4
|
|
|
6
|
-
export
|
|
7
|
-
contentPage: ContentPageDef | undefined | null
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
5
|
+
export const normalizePage =
|
|
6
|
+
(blocksRegistry: BlocksRegistry) => (contentPage: ContentPageDef | undefined | null) => {
|
|
7
|
+
if (!contentPage) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
const { blocks = [], slots } = contentPage;
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
return {
|
|
14
|
+
...contentPage,
|
|
15
|
+
blocks: filterBlocks(blocks, blocksRegistry),
|
|
16
|
+
slots:
|
|
17
|
+
slots &&
|
|
18
|
+
Object.keys(slots).reduce(
|
|
19
|
+
(res, key) => ({
|
|
20
|
+
...res,
|
|
21
|
+
[key]: {
|
|
22
|
+
...slots[key],
|
|
23
|
+
blocks: filterBlocks((slots[key] as Slot).blocks || [], blocksRegistry),
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
{},
|
|
27
|
+
),
|
|
28
|
+
};
|
|
31
29
|
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getMobileBlocks(blocks: BlockDef[], blocksRegistry: BlocksRegistry) {
|
|
35
|
-
return blocks
|
|
36
|
-
?.filter(
|
|
37
|
-
(block) =>
|
|
38
|
-
isBlockInRegistry(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
39
|
-
!block.mobile?.hidden,
|
|
40
|
-
)
|
|
41
|
-
.map(normalizeBlock);
|
|
42
|
-
}
|
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
className="bg-main"
|
|
33
33
|
context={context}
|
|
34
34
|
blocksRegistry={Blocks}
|
|
35
|
-
data={normalizePage(data as ContentPageDef
|
|
35
|
+
data={normalizePage(Blocks)(data as ContentPageDef)}
|
|
36
36
|
/>
|
|
37
37
|
),
|
|
38
38
|
editor: (
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
className="bg-transparent"
|
|
42
42
|
context={context}
|
|
43
43
|
blocksRegistry={Blocks}
|
|
44
|
-
data={normalizePage(data as ContentPageDef
|
|
44
|
+
data={normalizePage(Blocks)(data as ContentPageDef)}
|
|
45
45
|
blockDecorator={blockDecorator}
|
|
46
46
|
/>
|
|
47
47
|
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BlockDef } from '../../types';
|
|
2
|
+
import { BlocksRegistry } from './ContentPage';
|
|
3
|
+
import { isBlockInRegistry } from './isBlockInRegistry';
|
|
4
|
+
import { normalizeBlock } from './normalizeBlock';
|
|
5
|
+
|
|
6
|
+
export const filterBlocks = (blocks: BlockDef[], blocksRegistry: BlocksRegistry) =>
|
|
7
|
+
blocks
|
|
8
|
+
?.filter(
|
|
9
|
+
(block) =>
|
|
10
|
+
isBlockInRegistry(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
11
|
+
!block.mobile?.hidden,
|
|
12
|
+
)
|
|
13
|
+
.map(normalizeBlock);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BlockDef } from '../../types';
|
|
2
|
+
import { BlocksRegistry } from './ContentPage';
|
|
3
|
+
import { isBlockInRegistry } from './isBlockInRegistry';
|
|
4
|
+
import { normalizeBlock } from './normalizeBlock';
|
|
5
|
+
|
|
6
|
+
export const filterBlocks = (blocks: BlockDef[], blocksRegistry: BlocksRegistry) =>
|
|
7
|
+
blocks?.filter((block) => isBlockInRegistry(block?.type, blocksRegistry)).map(normalizeBlock);
|
|
@@ -1,38 +1,29 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContentPageDef, Slot } from '../../types';
|
|
2
2
|
import { BlocksRegistry } from './ContentPage';
|
|
3
|
-
import {
|
|
4
|
-
import { normalizeBlock } from './normalizeBlock';
|
|
3
|
+
import { filterBlocks } from './filterBlocks';
|
|
5
4
|
|
|
6
|
-
export
|
|
7
|
-
contentPage:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
5
|
+
export const normalizePage =
|
|
6
|
+
(blocksRegistry: BlocksRegistry) => (contentPage: ContentPageDef | undefined | null) => {
|
|
7
|
+
if (!contentPage) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
const { blocks = [], slots } = contentPage;
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
return {
|
|
14
|
+
...contentPage,
|
|
15
|
+
blocks: filterBlocks(blocks, blocksRegistry),
|
|
16
|
+
slots:
|
|
17
|
+
slots &&
|
|
18
|
+
Object.keys(slots).reduce(
|
|
19
|
+
(res, key) => ({
|
|
20
|
+
...res,
|
|
21
|
+
[key]: {
|
|
22
|
+
...slots[key],
|
|
23
|
+
blocks: filterBlocks((slots[key] as Slot).blocks || [], blocksRegistry),
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
{},
|
|
27
|
+
),
|
|
28
|
+
};
|
|
31
29
|
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getDesktopBlocks(blocks: BlockDef[], blocksRegistry: BlocksRegistry) {
|
|
35
|
-
return blocks
|
|
36
|
-
?.filter((block) => isBlockInRegistry(block?.type, blocksRegistry))
|
|
37
|
-
.map(normalizeBlock);
|
|
38
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.normalizePage = void 0;
|
|
3
|
-
const isBlockInRegistry_1 = require("./isBlockInRegistry");
|
|
4
|
-
const normalizeBlock_1 = require("./normalizeBlock");
|
|
5
|
-
function normalizePage(contentPage, blocksRegistry) {
|
|
6
|
-
if (!contentPage) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
const { blocks = [], slots } = contentPage;
|
|
10
|
-
return {
|
|
11
|
-
...contentPage,
|
|
12
|
-
blocks: getMobileBlocks(blocks, blocksRegistry),
|
|
13
|
-
slots: slots &&
|
|
14
|
-
Object.keys(slots).reduce((res, key) => ({
|
|
15
|
-
...res,
|
|
16
|
-
[key]: {
|
|
17
|
-
...slots[key],
|
|
18
|
-
blocks: getMobileBlocks(slots[key].blocks || [], blocksRegistry),
|
|
19
|
-
},
|
|
20
|
-
}), {}),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
exports.normalizePage = normalizePage;
|
|
24
|
-
function getMobileBlocks(blocks, blocksRegistry) {
|
|
25
|
-
return blocks
|
|
26
|
-
?.filter((block) => (0, isBlockInRegistry_1.isBlockInRegistry)(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
27
|
-
!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":";;AAEA,2DAAwD;AACxD,qDAAkD;AAElD,SAAgB,aAAa,CAC3B,WAA8C,EAC9C,cAA8B;IAE9B,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,eAAe,CAAC,MAAM,EAAE,cAAc,CAAC;QAC/C,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,IAAI,EAAE,EAAE,cAAc,CAAC;iBAC3E;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC;AA1BD,sCA0BC;AAED,SAAS,eAAe,CAAC,MAAkB,EAAE,cAA8B;IACzE,OAAO,MAAM;QACX,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,IAAA,qCAAiB,EAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC;QACrE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACxB;SACA,GAAG,CAAC,+BAAc,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { isBlockInRegistry } from './isBlockInRegistry.js';
|
|
2
|
-
import { normalizeBlock } from './normalizeBlock.js';
|
|
3
|
-
export function normalizePage(contentPage, blocksRegistry) {
|
|
4
|
-
if (!contentPage) {
|
|
5
|
-
return undefined;
|
|
6
|
-
}
|
|
7
|
-
const { blocks = [], slots } = contentPage;
|
|
8
|
-
return {
|
|
9
|
-
...contentPage,
|
|
10
|
-
blocks: getMobileBlocks(blocks, blocksRegistry),
|
|
11
|
-
slots: slots &&
|
|
12
|
-
Object.keys(slots).reduce((res, key) => ({
|
|
13
|
-
...res,
|
|
14
|
-
[key]: {
|
|
15
|
-
...slots[key],
|
|
16
|
-
blocks: getMobileBlocks(slots[key].blocks || [], blocksRegistry),
|
|
17
|
-
},
|
|
18
|
-
}), {}),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function getMobileBlocks(blocks, blocksRegistry) {
|
|
22
|
-
return blocks
|
|
23
|
-
?.filter((block) => isBlockInRegistry(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
24
|
-
!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":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,UAAU,aAAa,CAC3B,WAA8C,EAC9C,cAA8B;IAE9B,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,eAAe,CAAC,MAAM,EAAE,cAAc,CAAC;QAC/C,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,IAAI,EAAE,EAAE,cAAc,CAAC;iBAC3E;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,MAAkB,EAAE,cAA8B;IACzE,OAAO,MAAM;QACX,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,iBAAiB,CAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC;QACrE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACxB;SACA,GAAG,CAAC,cAAc,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { BlockDef, ContentPageDef, Slot } from '../../types';
|
|
2
|
-
import { BlocksRegistry } from './ContentPage';
|
|
3
|
-
import { isBlockInRegistry } from './isBlockInRegistry';
|
|
4
|
-
import { normalizeBlock } from './normalizeBlock';
|
|
5
|
-
|
|
6
|
-
export function normalizePage(
|
|
7
|
-
contentPage: ContentPageDef | undefined | null,
|
|
8
|
-
blocksRegistry: BlocksRegistry,
|
|
9
|
-
): ContentPageDef | undefined {
|
|
10
|
-
if (!contentPage) {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const { blocks = [], slots } = contentPage;
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
...contentPage,
|
|
18
|
-
blocks: getMobileBlocks(blocks, blocksRegistry),
|
|
19
|
-
slots:
|
|
20
|
-
slots &&
|
|
21
|
-
Object.keys(slots).reduce(
|
|
22
|
-
(res, key) => ({
|
|
23
|
-
...res,
|
|
24
|
-
[key]: {
|
|
25
|
-
...slots[key],
|
|
26
|
-
blocks: getMobileBlocks((slots[key] as Slot).blocks || [], blocksRegistry),
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
{},
|
|
30
|
-
),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getMobileBlocks(blocks: BlockDef[], blocksRegistry: BlocksRegistry) {
|
|
35
|
-
return blocks
|
|
36
|
-
?.filter(
|
|
37
|
-
(block) =>
|
|
38
|
-
isBlockInRegistry(block?.type || block?.mobile?.type, blocksRegistry) &&
|
|
39
|
-
!block.mobile?.hidden,
|
|
40
|
-
)
|
|
41
|
-
.map(normalizeBlock);
|
|
42
|
-
}
|