@squiz/dx-page-contents-lib 1.73.0 → 1.75.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/lib/mocks/PageContentsHelpers.d.ts +369 -0
- package/lib/mocks/PageContentsHelpers.js +87 -1
- package/lib/mocks/PageContentsHelpers.js.map +1 -1
- package/lib/mocks/PageContentsMocks.d.ts +3 -1
- package/lib/mocks/PageContentsMocks.js +83 -1
- package/lib/mocks/PageContentsMocks.js.map +1 -1
- package/lib/page-contents-lib.d.ts +189 -1
- package/lib/page-contents-lib.js +124 -12
- package/lib/page-contents-lib.js.map +1 -1
- package/lib/page-contents-lib.spec.js +422 -0
- package/lib/page-contents-lib.spec.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.INVALID_CONTENT_NODES = exports.VALID_CONTENT_NODES = exports.mockComponentResolver = exports.mockContentItem = void 0;
|
|
4
|
+
exports.generateNestedLayout = generateNestedLayout;
|
|
5
|
+
const PageContentsHelpers_1 = require("./PageContentsHelpers");
|
|
4
6
|
exports.mockContentItem = {
|
|
5
7
|
schemaName: 'test',
|
|
6
8
|
content: {
|
|
@@ -14,6 +16,39 @@ const mockComponentResolver = async (node) => {
|
|
|
14
16
|
};
|
|
15
17
|
};
|
|
16
18
|
exports.mockComponentResolver = mockComponentResolver;
|
|
19
|
+
function generateNestedLayout(recursionLevel, mockBuilder = new PageContentsHelpers_1.PageContentResolvedMockBuilder()) {
|
|
20
|
+
const layoutNode = {
|
|
21
|
+
type: 'layout',
|
|
22
|
+
layout: {
|
|
23
|
+
template: '<div>{{{top}}}</div><div>{{{bottom}}}</div><div>{{{side}}}</div>',
|
|
24
|
+
name: 'mock-dev-layout-basic',
|
|
25
|
+
options: {
|
|
26
|
+
size: {
|
|
27
|
+
selectedValue: 'small',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
content: {
|
|
32
|
+
top: [],
|
|
33
|
+
bottom: [],
|
|
34
|
+
side: [],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
// If recursion level is 0, just add components to all sections
|
|
38
|
+
if (recursionLevel === 0) {
|
|
39
|
+
layoutNode.content.top.push(mockBuilder.nodeFactory().createNodeWithId('component', `${recursionLevel}-top`));
|
|
40
|
+
layoutNode.content.bottom.push(mockBuilder.nodeFactory().createNodeWithId('component', `${recursionLevel}-bottom`));
|
|
41
|
+
layoutNode.content.side.push(mockBuilder.nodeFactory().createNodeWithId('component', `${recursionLevel}-side`));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// For top section, add another layout node with recursion level - 1
|
|
45
|
+
layoutNode.content.top.push(generateNestedLayout(recursionLevel - 1, mockBuilder));
|
|
46
|
+
// For bottom and side sections, add component nodes
|
|
47
|
+
layoutNode.content.bottom.push(mockBuilder.nodeFactory().createNodeWithId('component', `${recursionLevel}-bottom`));
|
|
48
|
+
layoutNode.content.side.push(mockBuilder.nodeFactory().createNodeWithId('component', `${recursionLevel}-side`));
|
|
49
|
+
}
|
|
50
|
+
return layoutNode;
|
|
51
|
+
}
|
|
17
52
|
exports.VALID_CONTENT_NODES = {
|
|
18
53
|
component: {
|
|
19
54
|
type: 'component',
|
|
@@ -24,7 +59,54 @@ exports.VALID_CONTENT_NODES = {
|
|
|
24
59
|
id: '123',
|
|
25
60
|
},
|
|
26
61
|
},
|
|
27
|
-
layout: {
|
|
62
|
+
layout: {
|
|
63
|
+
type: 'layout',
|
|
64
|
+
layout: {
|
|
65
|
+
template: '<div>{{top}}</div><div>{{bottom}}</div><div>{{side}}</div>',
|
|
66
|
+
name: 'mock-dev-layout-basic',
|
|
67
|
+
version: '1.0.0',
|
|
68
|
+
options: {
|
|
69
|
+
size: {
|
|
70
|
+
selectedValue: 'small',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
content: {
|
|
75
|
+
top: [
|
|
76
|
+
{
|
|
77
|
+
type: 'component',
|
|
78
|
+
componentType: 'server',
|
|
79
|
+
componentSet: 'my-component-set',
|
|
80
|
+
componentId: 'my-component-1',
|
|
81
|
+
contentItem: {
|
|
82
|
+
id: '123',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
bottom: [
|
|
87
|
+
{
|
|
88
|
+
type: 'component',
|
|
89
|
+
componentType: 'server',
|
|
90
|
+
componentSet: 'my-component-set',
|
|
91
|
+
componentId: 'my-component-1',
|
|
92
|
+
contentItem: {
|
|
93
|
+
id: '123',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
side: [
|
|
98
|
+
{
|
|
99
|
+
type: 'component',
|
|
100
|
+
componentType: 'server',
|
|
101
|
+
componentSet: 'my-component-set',
|
|
102
|
+
componentId: 'my-component-1',
|
|
103
|
+
contentItem: {
|
|
104
|
+
id: '123',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
28
110
|
text: {
|
|
29
111
|
type: 'text',
|
|
30
112
|
value: 'test',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageContentsMocks.js","sourceRoot":"","sources":["../../src/mocks/PageContentsMocks.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"PageContentsMocks.js","sourceRoot":"","sources":["../../src/mocks/PageContentsMocks.ts"],"names":[],"mappings":";;;AAkBA,oDAqCC;AAtDD,+DAAuE;AAE1D,QAAA,eAAe,GAAG;IAC7B,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM;KACd;CACF,CAAC;AACK,MAAM,qBAAqB,GAAG,KAAK,EAAE,IAA0D,EAAE,EAAE;IACxG,OAAO;QACL,GAAG,IAAI;QACP,WAAW,EAAE,uBAAe;KAC7B,CAAC;AACJ,CAAC,CAAC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;4BACZ,KAAK,EAAE,6BAA6B;yBACrC;qBACF;iBACF;gBACD,UAAU,EAAE;oBACV,OAAO,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE;iBACxC;aACF;SACF;KACF;CACF,CAAC;AAIW,QAAA,qBAAqB,GAA6D;IAC7F,yBAAyB,EAAE;QACzB,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;YACP,IAAI,EAAE;gBACJ,IAAI,EAAE,KAAK;gBACX,GAAG,EAAE,IAAI;gBACT,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,cAAc;qBACtB;iBACF;aACF;SACF;QACD,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE;oBACJ,IAAI,EAAE,KAAK;oBACX,GAAG,EAAE,IAAI;oBACT,QAAQ,EAAE;wBACR;4BACE,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,2BAA2B;yBACnC;qBACF;iBACF;gBACD,UAAU,EAAE;oBACV,OAAO,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;iBACtC;aACF;YACD;gBACE,IAAI,EAAE;oBACJ,IAAI,EAAE,KAAK;oBACX,GAAG,EAAE,IAAI;oBACT,QAAQ,EAAE;wBACR;4BACE,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,6BAA6B;yBACrC;qBACF;iBACF;gBACD,UAAU,EAAE;oBACV,OAAO,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;iBACtC;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -1,13 +1,201 @@
|
|
|
1
1
|
import { FormattedTextResolverConfig } from '@squiz/formatted-text-lib';
|
|
2
|
-
import { PageLayoutContentResolver } from './layout-content';
|
|
2
|
+
import { DeveloperDefinedLayoutNode, LayoutContentNodes, PageLayoutContentResolver } from './layout-content';
|
|
3
3
|
import { PageLayout } from './layouts';
|
|
4
|
+
import { CustomLayout } from './layouts/custom-layout';
|
|
5
|
+
import { FullyResolvedNodesMap } from '@squiz/dx-json-schema-lib';
|
|
6
|
+
import { z } from 'zod';
|
|
4
7
|
export type RenderLayoutConfig = FormattedTextResolverConfig;
|
|
8
|
+
export interface ExtendedResolversMap extends FullyResolvedNodesMap {
|
|
9
|
+
layout: (node: DeveloperDefinedLayoutNode, blockIndex?: number) => Promise<string>;
|
|
10
|
+
}
|
|
11
|
+
type CustomLayoutRenderer = (layout: CustomLayout | DeveloperDefinedLayoutNode, resolvers: ExtendedResolversMap) => Promise<string>;
|
|
12
|
+
export declare const addLayoutSupport: (baseResolvers: FullyResolvedNodesMap, renderLayoutFn: CustomLayoutRenderer) => ExtendedResolversMap;
|
|
5
13
|
/**
|
|
6
14
|
* Validate that the provided layout is a valid page layout
|
|
7
15
|
*/
|
|
8
16
|
export declare function assertIsPageLayout(layout: unknown): asserts layout is PageLayout;
|
|
9
17
|
export declare function resolveLayout(layout: PageLayout, resolver: PageLayoutContentResolver): Promise<PageLayout>;
|
|
10
18
|
export declare function renderLayout(layout: PageLayout, config: RenderLayoutConfig): Promise<string>;
|
|
19
|
+
export declare function isDeveloperDefinedLayoutNode(node: any): node is DeveloperDefinedLayoutNode;
|
|
20
|
+
export declare function isCustomLayout(layout: any): layout is CustomLayout;
|
|
21
|
+
export declare const renderCustomLayout: CustomLayoutRenderer;
|
|
22
|
+
/**
|
|
23
|
+
* The representation of the page content as a map of zone ID to content nodes.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ContentStructure: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodType<{
|
|
26
|
+
value: string;
|
|
27
|
+
type: "text";
|
|
28
|
+
} | {
|
|
29
|
+
type: "matrix-image";
|
|
30
|
+
matrixDomain: string;
|
|
31
|
+
matrixAssetId: string;
|
|
32
|
+
attributes?: (Record<string, string> & {
|
|
33
|
+
src?: undefined;
|
|
34
|
+
}) | undefined;
|
|
35
|
+
formattingOptions?: {
|
|
36
|
+
alignment: "left" | "center" | "right" | "justify";
|
|
37
|
+
} | undefined;
|
|
38
|
+
matrixIdentifier?: string | undefined;
|
|
39
|
+
} | {
|
|
40
|
+
type: "dam-image";
|
|
41
|
+
damSystemType: "bynder";
|
|
42
|
+
damSystemIdentifier: string;
|
|
43
|
+
damObjectId: string;
|
|
44
|
+
attributes?: (Record<string, string> & {
|
|
45
|
+
src?: undefined;
|
|
46
|
+
}) | undefined;
|
|
47
|
+
formattingOptions?: {
|
|
48
|
+
alignment: "left" | "center" | "right" | "justify";
|
|
49
|
+
} | undefined;
|
|
50
|
+
damAdditional?: {
|
|
51
|
+
variant?: string | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
} | {
|
|
54
|
+
type: "component";
|
|
55
|
+
componentId: string;
|
|
56
|
+
componentSet: string;
|
|
57
|
+
componentType?: "server" | "edge" | undefined;
|
|
58
|
+
contentItem?: {
|
|
59
|
+
id: string;
|
|
60
|
+
} | {
|
|
61
|
+
content: Record<string, unknown>;
|
|
62
|
+
schemaName: string;
|
|
63
|
+
} | undefined;
|
|
64
|
+
} | (({
|
|
65
|
+
type: "tag";
|
|
66
|
+
tag: string;
|
|
67
|
+
attributes?: Record<string, string> | undefined;
|
|
68
|
+
font?: {
|
|
69
|
+
bold?: boolean | undefined;
|
|
70
|
+
italics?: boolean | undefined;
|
|
71
|
+
underline?: boolean | undefined;
|
|
72
|
+
color?: string | undefined;
|
|
73
|
+
size?: string | undefined;
|
|
74
|
+
fontFamily?: string | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
formattingOptions?: {
|
|
77
|
+
alignment: "left" | "center" | "right" | "justify";
|
|
78
|
+
} | undefined;
|
|
79
|
+
} | {
|
|
80
|
+
type: "fragment";
|
|
81
|
+
} | {
|
|
82
|
+
type: "link-to-matrix-asset";
|
|
83
|
+
matrixDomain: string;
|
|
84
|
+
matrixAssetId: string;
|
|
85
|
+
target: "_blank" | "_self" | "_parent" | "_top";
|
|
86
|
+
attributes?: (Record<string, string> & {
|
|
87
|
+
target?: undefined;
|
|
88
|
+
href?: undefined;
|
|
89
|
+
}) | undefined;
|
|
90
|
+
formattingOptions?: {
|
|
91
|
+
alignment: "left" | "center" | "right" | "justify";
|
|
92
|
+
} | undefined;
|
|
93
|
+
matrixIdentifier?: string | undefined;
|
|
94
|
+
}) & {
|
|
95
|
+
children: LayoutContentNodes[];
|
|
96
|
+
}), z.ZodTypeDef, {
|
|
97
|
+
value: string;
|
|
98
|
+
type: "text";
|
|
99
|
+
} | {
|
|
100
|
+
type: "tag";
|
|
101
|
+
tag: string;
|
|
102
|
+
attributes?: Record<string, string> | undefined;
|
|
103
|
+
font?: {
|
|
104
|
+
bold?: boolean | undefined;
|
|
105
|
+
italics?: boolean | undefined;
|
|
106
|
+
underline?: boolean | undefined;
|
|
107
|
+
color?: string | undefined;
|
|
108
|
+
size?: string | undefined;
|
|
109
|
+
fontFamily?: string | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
formattingOptions?: {
|
|
112
|
+
alignment: "left" | "center" | "right" | "justify";
|
|
113
|
+
} | undefined;
|
|
114
|
+
} | {
|
|
115
|
+
type: "fragment";
|
|
116
|
+
} | {
|
|
117
|
+
type: "link-to-matrix-asset";
|
|
118
|
+
matrixDomain: string;
|
|
119
|
+
matrixAssetId: string;
|
|
120
|
+
target: "_blank" | "_self" | "_parent" | "_top";
|
|
121
|
+
attributes?: (Record<string, string> & {
|
|
122
|
+
target?: undefined;
|
|
123
|
+
href?: undefined;
|
|
124
|
+
}) | undefined;
|
|
125
|
+
formattingOptions?: {
|
|
126
|
+
alignment: "left" | "center" | "right" | "justify";
|
|
127
|
+
} | undefined;
|
|
128
|
+
matrixIdentifier?: string | undefined;
|
|
129
|
+
} | {
|
|
130
|
+
type: "matrix-image";
|
|
131
|
+
matrixDomain: string;
|
|
132
|
+
matrixAssetId: string;
|
|
133
|
+
attributes?: (Record<string, string> & {
|
|
134
|
+
src?: undefined;
|
|
135
|
+
}) | undefined;
|
|
136
|
+
formattingOptions?: {
|
|
137
|
+
alignment: "left" | "center" | "right" | "justify";
|
|
138
|
+
} | undefined;
|
|
139
|
+
matrixIdentifier?: string | undefined;
|
|
140
|
+
} | {
|
|
141
|
+
type: "dam-image";
|
|
142
|
+
damSystemType: "bynder";
|
|
143
|
+
damSystemIdentifier: string;
|
|
144
|
+
damObjectId: string;
|
|
145
|
+
attributes?: (Record<string, string> & {
|
|
146
|
+
src?: undefined;
|
|
147
|
+
}) | undefined;
|
|
148
|
+
formattingOptions?: {
|
|
149
|
+
alignment: "left" | "center" | "right" | "justify";
|
|
150
|
+
} | undefined;
|
|
151
|
+
damAdditional?: {
|
|
152
|
+
variant?: string | undefined;
|
|
153
|
+
} | undefined;
|
|
154
|
+
} | {
|
|
155
|
+
type: "component";
|
|
156
|
+
componentId: string;
|
|
157
|
+
componentSet: string;
|
|
158
|
+
componentType?: "server" | "edge" | undefined;
|
|
159
|
+
contentItem?: {
|
|
160
|
+
id: string;
|
|
161
|
+
} | {
|
|
162
|
+
content: Record<string, unknown>;
|
|
163
|
+
schemaName: string;
|
|
164
|
+
} | undefined;
|
|
165
|
+
}>, z.ZodType<import("./layout-content").LayoutVariationNode, z.ZodTypeDef, {
|
|
166
|
+
type: "variation";
|
|
167
|
+
default: {};
|
|
168
|
+
}>, z.ZodType<DeveloperDefinedLayoutNode, z.ZodTypeDef, {
|
|
169
|
+
type: "layout";
|
|
170
|
+
layout: {
|
|
171
|
+
options: Record<string, {
|
|
172
|
+
values: string[];
|
|
173
|
+
displayName: string;
|
|
174
|
+
description: string;
|
|
175
|
+
selectedValue: string;
|
|
176
|
+
}>;
|
|
177
|
+
name: string;
|
|
178
|
+
displayName: string;
|
|
179
|
+
description: string;
|
|
180
|
+
template: string;
|
|
181
|
+
zones: Record<string, {
|
|
182
|
+
displayName: string;
|
|
183
|
+
description: string;
|
|
184
|
+
minNodes: number;
|
|
185
|
+
maxNodes?: number | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
} | {
|
|
188
|
+
options: Record<string, {
|
|
189
|
+
selectedValue: string;
|
|
190
|
+
}>;
|
|
191
|
+
name: string;
|
|
192
|
+
};
|
|
193
|
+
}>]>, "many">>;
|
|
194
|
+
export type ContentStructure = z.infer<typeof ContentStructure>;
|
|
195
|
+
/**
|
|
196
|
+
* Validate the provided page content structure.
|
|
197
|
+
*/
|
|
198
|
+
export declare function assertIsContentStructure(content: unknown): asserts content is ContentStructure;
|
|
11
199
|
export { PageLayoutContentResolver };
|
|
12
200
|
export { PageLayoutContent, LayoutContentNodes, LayoutVariant, LayoutVariationNode, DeveloperDefinedLayoutNode, } from './layout-content';
|
|
13
201
|
export { PageLayout } from './layouts';
|
package/lib/page-contents-lib.js
CHANGED
|
@@ -17,16 +17,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.PageLayout = exports.DeveloperDefinedLayoutNode = exports.LayoutVariationNode = exports.LayoutContentNodes = exports.PageLayoutContent = exports.PageLayoutContentResolver = void 0;
|
|
20
|
+
exports.PageLayout = exports.DeveloperDefinedLayoutNode = exports.LayoutVariationNode = exports.LayoutContentNodes = exports.PageLayoutContent = exports.PageLayoutContentResolver = exports.ContentStructure = exports.renderCustomLayout = exports.addLayoutSupport = void 0;
|
|
21
21
|
exports.assertIsPageLayout = assertIsPageLayout;
|
|
22
22
|
exports.resolveLayout = resolveLayout;
|
|
23
23
|
exports.renderLayout = renderLayout;
|
|
24
|
+
exports.isDeveloperDefinedLayoutNode = isDeveloperDefinedLayoutNode;
|
|
25
|
+
exports.isCustomLayout = isCustomLayout;
|
|
26
|
+
exports.assertIsContentStructure = assertIsContentStructure;
|
|
24
27
|
const formatted_text_lib_1 = require("@squiz/formatted-text-lib");
|
|
25
28
|
const layout_content_1 = require("./layout-content");
|
|
26
29
|
Object.defineProperty(exports, "PageLayoutContentResolver", { enumerable: true, get: function () { return layout_content_1.PageLayoutContentResolver; } });
|
|
27
30
|
const layouts_1 = require("./layouts");
|
|
28
31
|
const handlebars_1 = __importDefault(require("handlebars"));
|
|
29
32
|
const custom_layout_1 = require("./layouts/custom-layout");
|
|
33
|
+
const zod_1 = require("zod");
|
|
34
|
+
const addLayoutSupport = (baseResolvers, renderLayoutFn) => {
|
|
35
|
+
const extendedResolvers = {
|
|
36
|
+
...baseResolvers,
|
|
37
|
+
layout: async (node, _blockIndex) => {
|
|
38
|
+
return renderLayoutFn(node, extendedResolvers);
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
return extendedResolvers;
|
|
42
|
+
};
|
|
43
|
+
exports.addLayoutSupport = addLayoutSupport;
|
|
30
44
|
//Handlebars config and pre compilation
|
|
31
45
|
handlebars_1.default.registerHelper('joinClasses', (classes) => {
|
|
32
46
|
return Array.isArray(classes) && classes.length ? classes.join(' ') : '';
|
|
@@ -78,34 +92,132 @@ async function renderLayout(layout, config) {
|
|
|
78
92
|
const template = layouts_1.LAYOUT_TEMPLATES[layout.name];
|
|
79
93
|
if (!template)
|
|
80
94
|
return '';
|
|
81
|
-
const
|
|
95
|
+
const baseResolvers = (0, formatted_text_lib_1.createFormattedTextToHtmlStringResolvers)(config);
|
|
96
|
+
const extendedResolvers = (0, exports.addLayoutSupport)(baseResolvers, exports.renderCustomLayout);
|
|
97
|
+
//This could probably be improved, by cleaning up the resolver implementation
|
|
98
|
+
//Then rendering the result and using these functions to just call the top level template render dressing.
|
|
82
99
|
if (layout.name === 'custom-layout') {
|
|
83
|
-
return await renderCustomLayout(layout,
|
|
100
|
+
return await (0, exports.renderCustomLayout)(layout, extendedResolvers);
|
|
101
|
+
}
|
|
102
|
+
return await renderStandardLayout(template, layout, extendedResolvers);
|
|
103
|
+
}
|
|
104
|
+
function isDeveloperDefinedLayoutNode(node) {
|
|
105
|
+
try {
|
|
106
|
+
layout_content_1.DeveloperDefinedLayoutNode.parse(node);
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
return false;
|
|
84
111
|
}
|
|
85
|
-
return await renderStandardLayout(template, layout, formattedTextResolvers);
|
|
86
112
|
}
|
|
87
|
-
|
|
113
|
+
function isCustomLayout(layout) {
|
|
114
|
+
return layout && typeof layout === 'object' && layout.name === 'custom-layout' && 'config' in layout;
|
|
115
|
+
}
|
|
116
|
+
const renderCustomLayout = async (layout, resolvers) => {
|
|
88
117
|
var _a, _b;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
118
|
+
//Check if we have a dev defined layout, second condition to satisfy typescript
|
|
119
|
+
if (isDeveloperDefinedLayoutNode(layout) && (layout === null || layout === void 0 ? void 0 : layout.layout) && 'template' in layout.layout) {
|
|
120
|
+
const templateString = layout.layout.template;
|
|
121
|
+
const developerTemplate = handlebars_1.default.compile(templateString);
|
|
122
|
+
const contentSections = {};
|
|
123
|
+
for (const [sectionName, nodes] of Object.entries(layout.content)) {
|
|
124
|
+
const renderedNodes = await Promise.all(nodes.map(async (node, index) => {
|
|
125
|
+
const nodeType = node.type;
|
|
126
|
+
const resolver = resolvers[nodeType] || resolvers.default;
|
|
127
|
+
if (resolver) {
|
|
128
|
+
return await resolver(node, index);
|
|
129
|
+
}
|
|
130
|
+
return `<p class="invalid-node-type">No resolver for node of type "${node.type}"</p>`;
|
|
131
|
+
}));
|
|
132
|
+
contentSections[sectionName] = renderedNodes.join('');
|
|
133
|
+
}
|
|
134
|
+
//Prevent double encoding of the html
|
|
135
|
+
const safeContentSections = {};
|
|
136
|
+
for (const [key, value] of Object.entries(contentSections)) {
|
|
137
|
+
safeContentSections[key] = new handlebars_1.default.SafeString(value);
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const flattenedOptions = {};
|
|
141
|
+
if (layout.layout.options) {
|
|
142
|
+
// For each option key, use the selectedValue if available
|
|
143
|
+
// so that the template can read options.key not options.key.value
|
|
144
|
+
// we may need to expand this depending on how options interface changes.
|
|
145
|
+
Object.entries(layout.layout.options).forEach(([key, value]) => {
|
|
146
|
+
if (value && typeof value === 'object' && 'selectedValue' in value) {
|
|
147
|
+
flattenedOptions[key] = value.selectedValue;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
flattenedOptions[key] = value;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
//Render template
|
|
155
|
+
return developerTemplate({
|
|
156
|
+
...safeContentSections,
|
|
157
|
+
layout: layout.layout,
|
|
158
|
+
options: flattenedOptions,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
return `<p class="invalid-node-type">Error rendering developer template ${layout.layout.name}</p>`;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Narrow the types here for the return,
|
|
166
|
+
if (!isCustomLayout(layout)) {
|
|
167
|
+
return `<p class="invalid-node-type">Invalid layout: Not a CustomLayout or DeveloperDefinedLayoutNode with template</p>`;
|
|
168
|
+
}
|
|
169
|
+
const mainContentArray = Object.values(layout.content);
|
|
170
|
+
const nodeArrays = mainContentArray.flatMap((nodeArray) => nodeArray);
|
|
171
|
+
const nodeContent = await Promise.all(nodeArrays.map(async (node, index) => {
|
|
172
|
+
const nodeType = node.type;
|
|
173
|
+
const resolver = resolvers[nodeType] || resolvers.default;
|
|
174
|
+
if (node.type === 'tag' && 'tag' in node) {
|
|
175
|
+
return await (0, formatted_text_lib_1.formattedTextToHtmlString)(node, resolvers, index);
|
|
176
|
+
}
|
|
177
|
+
if (resolver) {
|
|
178
|
+
return await resolver(node, index);
|
|
179
|
+
}
|
|
180
|
+
return `<p class="invalid-node-type">No resolver for node of type "${node.type}"</p>`;
|
|
181
|
+
}));
|
|
92
182
|
return compiledCustomLayoutTemplate({
|
|
93
183
|
rootTag: layout.config.rootWrapper.tag,
|
|
94
184
|
rootClasses: layout.config.rootWrapper.classes || [],
|
|
95
185
|
nodeTag: ((_a = layout.config.nodeWrapper) === null || _a === void 0 ? void 0 : _a.tag) || undefined,
|
|
96
186
|
nodeClasses: Array.isArray((_b = layout.config.nodeWrapper) === null || _b === void 0 ? void 0 : _b.classes) ? layout.config.nodeWrapper.classes : [],
|
|
97
|
-
main:
|
|
187
|
+
main: nodeContent,
|
|
98
188
|
});
|
|
99
|
-
}
|
|
100
|
-
|
|
189
|
+
};
|
|
190
|
+
exports.renderCustomLayout = renderCustomLayout;
|
|
101
191
|
async function renderStandardLayout(template, layout, resolvers) {
|
|
102
192
|
let finalTemplate = template;
|
|
103
193
|
for (const [key, value] of Object.entries(layout.content)) {
|
|
104
|
-
const renderedTexts = await Promise.all(value.map((
|
|
194
|
+
const renderedTexts = await Promise.all(value.map(async (node, index) => {
|
|
195
|
+
// Check if it's a layout node
|
|
196
|
+
if (node && typeof node === 'object' && 'type' in node) {
|
|
197
|
+
const nodeType = node.type;
|
|
198
|
+
const resolver = resolvers[nodeType] || resolvers.default;
|
|
199
|
+
// If it's a layout node, use the layout resolver
|
|
200
|
+
if (nodeType === 'layout' && resolver) {
|
|
201
|
+
return await resolver(node, index);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// For all other nodes, use formattedTextToHtmlString
|
|
205
|
+
return await (0, formatted_text_lib_1.formattedTextToHtmlString)(node, resolvers, index);
|
|
206
|
+
}));
|
|
105
207
|
finalTemplate = finalTemplate.replace(`{{${key}}}`, renderedTexts.join(''));
|
|
106
208
|
}
|
|
107
209
|
return finalTemplate.trim();
|
|
108
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* The representation of the page content as a map of zone ID to content nodes.
|
|
213
|
+
*/
|
|
214
|
+
exports.ContentStructure = zod_1.z.record(zod_1.z.string(), zod_1.z.array(layout_content_1.LayoutContentNodes));
|
|
215
|
+
/**
|
|
216
|
+
* Validate the provided page content structure.
|
|
217
|
+
*/
|
|
218
|
+
function assertIsContentStructure(content) {
|
|
219
|
+
exports.ContentStructure.parse(content);
|
|
220
|
+
}
|
|
109
221
|
var layout_content_2 = require("./layout-content");
|
|
110
222
|
Object.defineProperty(exports, "PageLayoutContent", { enumerable: true, get: function () { return layout_content_2.PageLayoutContent; } });
|
|
111
223
|
Object.defineProperty(exports, "LayoutContentNodes", { enumerable: true, get: function () { return layout_content_2.LayoutContentNodes; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-contents-lib.js","sourceRoot":"","sources":["../src/page-contents-lib.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"page-contents-lib.js","sourceRoot":"","sources":["../src/page-contents-lib.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA0DA,gDAQC;AAGD,sCA4BC;AAED,oCAcC;AAED,oEAOC;AAED,wCAEC;AAiID,4DAEC;AAjQD,kEAImC;AACnC,qDAA6G;AA8PpG,0GA9PgD,0CAAyB,OA8PhD;AA7PlC,uCAAyD;AACzD,4DAAoC;AACpC,2DAA+E;AAE/E,6BAAwB;AAyBjB,MAAM,gBAAgB,GAAG,CAC9B,aAAoC,EACpC,cAAoC,EACd,EAAE;IACxB,MAAM,iBAAiB,GAAyB;QAC9C,GAAI,aAAqB;QACzB,MAAM,EAAE,KAAK,EAAE,IAAgC,EAAE,WAAoB,EAAE,EAAE;YACvE,OAAO,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACjD,CAAC;KACF,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAZW,QAAA,gBAAgB,oBAY3B;AAEF,uCAAuC;AACvC,oBAAU,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3E,CAAC,CAAC,CAAC;AACH,MAAM,4BAA4B,GAAG,oBAAU,CAAC,OAAO,CAAC,sCAAsB,CAAC,CAAC;AAEh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