@squiz/dx-page-contents-lib 1.75.0 → 1.75.1
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/formatted-text.d.ts +27 -0
- package/lib/formatted-text.js +37 -0
- package/lib/formatted-text.js.map +1 -1
- package/lib/formatted-text.spec.js +4 -0
- package/lib/formatted-text.spec.js.map +1 -1
- package/lib/layout-content.d.ts +51 -3
- package/lib/layout-content.js.map +1 -1
- package/lib/layout-content.spec.js +18 -6
- package/lib/layout-content.spec.js.map +1 -1
- package/lib/layouts/custom-layout.d.ts +73 -0
- package/lib/layouts/index.d.ts +320 -0
- package/lib/layouts/raw.layout.d.ts +64 -0
- package/lib/layouts/single-column.layout.d.ts +64 -0
- package/lib/layouts/two-column.layout.d.ts +128 -0
- package/lib/mocks/PageContentsHelpers.d.ts +432 -0
- package/lib/mocks/PageContentsHelpers.js +7 -0
- package/lib/mocks/PageContentsHelpers.js.map +1 -1
- package/lib/mocks/PageContentsMocks.d.ts +1 -0
- package/lib/mocks/PageContentsMocks.js +27 -0
- package/lib/mocks/PageContentsMocks.js.map +1 -1
- package/lib/page-contents-lib.d.ts +16 -0
- package/lib/page-contents-lib.spec.js +61 -15
- package/lib/page-contents-lib.spec.js.map +1 -1
- package/lib/resolvers/create-variant-resolver.js +6 -1
- package/lib/resolvers/create-variant-resolver.js.map +1 -1
- package/lib/resolvers/create-variant-resolver.spec.js +21 -17
- package/lib/resolvers/create-variant-resolver.spec.js.map +1 -1
- package/lib/resolvers/default-layout-resolver.spec.d.ts +1 -0
- package/lib/resolvers/default-layout-resolver.spec.js +36 -0
- package/lib/resolvers/default-layout-resolver.spec.js.map +1 -0
- package/lib/resolvers/default-variation-resolver.spec.js +8 -4
- package/lib/resolvers/default-variation-resolver.spec.js.map +1 -1
- package/package.json +1 -1
package/lib/formatted-text.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const TextNode: z.ZodObject<{
|
|
3
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
3
4
|
type: z.ZodLiteral<"text">;
|
|
4
5
|
value: z.ZodString;
|
|
5
6
|
}, "strip", z.ZodTypeAny, {
|
|
6
7
|
value: string;
|
|
7
8
|
type: "text";
|
|
9
|
+
nodeId: string;
|
|
8
10
|
}, {
|
|
9
11
|
value: string;
|
|
10
12
|
type: "text";
|
|
13
|
+
nodeId?: string | undefined;
|
|
11
14
|
}>;
|
|
12
15
|
export declare const TagNode: z.ZodObject<{
|
|
16
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
13
17
|
type: z.ZodLiteral<"tag">;
|
|
14
18
|
tag: z.ZodString;
|
|
15
19
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -44,6 +48,7 @@ export declare const TagNode: z.ZodObject<{
|
|
|
44
48
|
}>>;
|
|
45
49
|
}, "strip", z.ZodTypeAny, {
|
|
46
50
|
type: "tag";
|
|
51
|
+
nodeId: string;
|
|
47
52
|
tag: string;
|
|
48
53
|
attributes?: Record<string, string> | undefined;
|
|
49
54
|
font?: {
|
|
@@ -60,6 +65,7 @@ export declare const TagNode: z.ZodObject<{
|
|
|
60
65
|
}, {
|
|
61
66
|
type: "tag";
|
|
62
67
|
tag: string;
|
|
68
|
+
nodeId?: string | undefined;
|
|
63
69
|
attributes?: Record<string, string> | undefined;
|
|
64
70
|
font?: {
|
|
65
71
|
bold?: boolean | undefined;
|
|
@@ -74,13 +80,17 @@ export declare const TagNode: z.ZodObject<{
|
|
|
74
80
|
} | undefined;
|
|
75
81
|
}>;
|
|
76
82
|
export declare const FragmentNode: z.ZodObject<{
|
|
83
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
77
84
|
type: z.ZodLiteral<"fragment">;
|
|
78
85
|
}, "strip", z.ZodTypeAny, {
|
|
79
86
|
type: "fragment";
|
|
87
|
+
nodeId: string;
|
|
80
88
|
}, {
|
|
81
89
|
type: "fragment";
|
|
90
|
+
nodeId?: string | undefined;
|
|
82
91
|
}>;
|
|
83
92
|
export declare const LinkToMatrixAssetNode: z.ZodObject<{
|
|
93
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
84
94
|
type: z.ZodLiteral<"link-to-matrix-asset">;
|
|
85
95
|
matrixIdentifier: z.ZodOptional<z.ZodString>;
|
|
86
96
|
matrixDomain: z.ZodString;
|
|
@@ -105,6 +115,7 @@ export declare const LinkToMatrixAssetNode: z.ZodObject<{
|
|
|
105
115
|
}>>>;
|
|
106
116
|
}, "strip", z.ZodTypeAny, {
|
|
107
117
|
type: "link-to-matrix-asset";
|
|
118
|
+
nodeId: string;
|
|
108
119
|
matrixDomain: string;
|
|
109
120
|
matrixAssetId: string;
|
|
110
121
|
target: "_blank" | "_self" | "_parent" | "_top";
|
|
@@ -121,6 +132,7 @@ export declare const LinkToMatrixAssetNode: z.ZodObject<{
|
|
|
121
132
|
matrixDomain: string;
|
|
122
133
|
matrixAssetId: string;
|
|
123
134
|
target: "_blank" | "_self" | "_parent" | "_top";
|
|
135
|
+
nodeId?: string | undefined;
|
|
124
136
|
attributes?: (Record<string, string> & {
|
|
125
137
|
target?: undefined;
|
|
126
138
|
href?: undefined;
|
|
@@ -131,6 +143,7 @@ export declare const LinkToMatrixAssetNode: z.ZodObject<{
|
|
|
131
143
|
matrixIdentifier?: string | undefined;
|
|
132
144
|
}>;
|
|
133
145
|
export declare const MatrixImageNode: z.ZodObject<{
|
|
146
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
134
147
|
type: z.ZodLiteral<"matrix-image">;
|
|
135
148
|
matrixIdentifier: z.ZodOptional<z.ZodString>;
|
|
136
149
|
matrixDomain: z.ZodString;
|
|
@@ -151,6 +164,7 @@ export declare const MatrixImageNode: z.ZodObject<{
|
|
|
151
164
|
}>>>;
|
|
152
165
|
}, "strip", z.ZodTypeAny, {
|
|
153
166
|
type: "matrix-image";
|
|
167
|
+
nodeId: string;
|
|
154
168
|
matrixDomain: string;
|
|
155
169
|
matrixAssetId: string;
|
|
156
170
|
attributes?: (Record<string, string> & {
|
|
@@ -164,6 +178,7 @@ export declare const MatrixImageNode: z.ZodObject<{
|
|
|
164
178
|
type: "matrix-image";
|
|
165
179
|
matrixDomain: string;
|
|
166
180
|
matrixAssetId: string;
|
|
181
|
+
nodeId?: string | undefined;
|
|
167
182
|
attributes?: (Record<string, string> & {
|
|
168
183
|
src?: undefined;
|
|
169
184
|
}) | undefined;
|
|
@@ -173,6 +188,7 @@ export declare const MatrixImageNode: z.ZodObject<{
|
|
|
173
188
|
matrixIdentifier?: string | undefined;
|
|
174
189
|
}>;
|
|
175
190
|
export declare const DamImageNode: z.ZodObject<{
|
|
191
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
176
192
|
type: z.ZodLiteral<"dam-image">;
|
|
177
193
|
damSystemType: z.ZodEnum<["bynder"]>;
|
|
178
194
|
damSystemIdentifier: z.ZodString;
|
|
@@ -200,6 +216,7 @@ export declare const DamImageNode: z.ZodObject<{
|
|
|
200
216
|
}>>>;
|
|
201
217
|
}, "strip", z.ZodTypeAny, {
|
|
202
218
|
type: "dam-image";
|
|
219
|
+
nodeId: string;
|
|
203
220
|
damSystemType: "bynder";
|
|
204
221
|
damSystemIdentifier: string;
|
|
205
222
|
damObjectId: string;
|
|
@@ -217,6 +234,7 @@ export declare const DamImageNode: z.ZodObject<{
|
|
|
217
234
|
damSystemType: "bynder";
|
|
218
235
|
damSystemIdentifier: string;
|
|
219
236
|
damObjectId: string;
|
|
237
|
+
nodeId?: string | undefined;
|
|
220
238
|
attributes?: (Record<string, string> & {
|
|
221
239
|
src?: undefined;
|
|
222
240
|
}) | undefined;
|
|
@@ -228,6 +246,7 @@ export declare const DamImageNode: z.ZodObject<{
|
|
|
228
246
|
} | undefined;
|
|
229
247
|
}>;
|
|
230
248
|
export declare const ComponentNode: z.ZodObject<{
|
|
249
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
231
250
|
type: z.ZodLiteral<"component">;
|
|
232
251
|
componentType: z.ZodOptional<z.ZodEnum<["server", "edge"]>>;
|
|
233
252
|
componentId: z.ZodString;
|
|
@@ -250,6 +269,7 @@ export declare const ComponentNode: z.ZodObject<{
|
|
|
250
269
|
}>]>>;
|
|
251
270
|
}, "strip", z.ZodTypeAny, {
|
|
252
271
|
type: "component";
|
|
272
|
+
nodeId: string;
|
|
253
273
|
componentId: string;
|
|
254
274
|
componentSet: string;
|
|
255
275
|
componentType?: "server" | "edge" | undefined;
|
|
@@ -263,6 +283,7 @@ export declare const ComponentNode: z.ZodObject<{
|
|
|
263
283
|
type: "component";
|
|
264
284
|
componentId: string;
|
|
265
285
|
componentSet: string;
|
|
286
|
+
nodeId?: string | undefined;
|
|
266
287
|
componentType?: "server" | "edge" | undefined;
|
|
267
288
|
contentItem?: {
|
|
268
289
|
id: string;
|
|
@@ -329,16 +350,20 @@ export declare const Variant: z.ZodObject<{
|
|
|
329
350
|
};
|
|
330
351
|
}>;
|
|
331
352
|
export declare const VariationNode: z.ZodObject<{
|
|
353
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
332
354
|
type: z.ZodLiteral<"variation">;
|
|
333
355
|
default: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
334
356
|
}, "strip", z.ZodTypeAny, {
|
|
335
357
|
type: "variation";
|
|
358
|
+
nodeId: string;
|
|
336
359
|
default: {};
|
|
337
360
|
}, {
|
|
338
361
|
type: "variation";
|
|
339
362
|
default: {};
|
|
363
|
+
nodeId?: string | undefined;
|
|
340
364
|
}>;
|
|
341
365
|
export declare const LayoutNode: z.ZodObject<{
|
|
366
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
342
367
|
type: z.ZodLiteral<"layout">;
|
|
343
368
|
layout: z.ZodUnion<[z.ZodObject<{
|
|
344
369
|
name: z.ZodString;
|
|
@@ -433,6 +458,7 @@ export declare const LayoutNode: z.ZodObject<{
|
|
|
433
458
|
}>]>;
|
|
434
459
|
}, "strip", z.ZodTypeAny, {
|
|
435
460
|
type: "layout";
|
|
461
|
+
nodeId: string;
|
|
436
462
|
layout: {
|
|
437
463
|
options: Record<string, {
|
|
438
464
|
values: string[];
|
|
@@ -481,4 +507,5 @@ export declare const LayoutNode: z.ZodObject<{
|
|
|
481
507
|
}>;
|
|
482
508
|
name: string;
|
|
483
509
|
};
|
|
510
|
+
nodeId?: string | undefined;
|
|
484
511
|
}>;
|
package/lib/formatted-text.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LayoutNode = exports.VariationNode = exports.Variant = exports.ComponentNode = exports.DamImageNode = exports.MatrixImageNode = exports.LinkToMatrixAssetNode = exports.FragmentNode = exports.TagNode = exports.TextNode = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
5
6
|
// TODO: Move the FormattedText node definitions to a separate package
|
|
6
7
|
const FormattingOptions = zod_1.z.object({
|
|
7
8
|
alignment: zod_1.z.enum(['left', 'center', 'right', 'justify']),
|
|
@@ -15,10 +16,18 @@ const FontOptions = zod_1.z.object({
|
|
|
15
16
|
fontFamily: zod_1.z.string().optional(),
|
|
16
17
|
});
|
|
17
18
|
exports.TextNode = zod_1.z.object({
|
|
19
|
+
nodeId: zod_1.z
|
|
20
|
+
.string()
|
|
21
|
+
.uuid()
|
|
22
|
+
.default(() => (0, crypto_1.randomUUID)()),
|
|
18
23
|
type: zod_1.z.literal('text'),
|
|
19
24
|
value: zod_1.z.string(),
|
|
20
25
|
});
|
|
21
26
|
exports.TagNode = zod_1.z.object({
|
|
27
|
+
nodeId: zod_1.z
|
|
28
|
+
.string()
|
|
29
|
+
.uuid()
|
|
30
|
+
.default(() => (0, crypto_1.randomUUID)()),
|
|
22
31
|
type: zod_1.z.literal('tag'),
|
|
23
32
|
tag: zod_1.z.string().min(1),
|
|
24
33
|
attributes: zod_1.z.record(zod_1.z.string()).optional(),
|
|
@@ -26,9 +35,17 @@ exports.TagNode = zod_1.z.object({
|
|
|
26
35
|
formattingOptions: FormattingOptions.optional(),
|
|
27
36
|
});
|
|
28
37
|
exports.FragmentNode = zod_1.z.object({
|
|
38
|
+
nodeId: zod_1.z
|
|
39
|
+
.string()
|
|
40
|
+
.uuid()
|
|
41
|
+
.default(() => (0, crypto_1.randomUUID)()),
|
|
29
42
|
type: zod_1.z.literal('fragment'),
|
|
30
43
|
});
|
|
31
44
|
exports.LinkToMatrixAssetNode = zod_1.z.object({
|
|
45
|
+
nodeId: zod_1.z
|
|
46
|
+
.string()
|
|
47
|
+
.uuid()
|
|
48
|
+
.default(() => (0, crypto_1.randomUUID)()),
|
|
32
49
|
type: zod_1.z.literal('link-to-matrix-asset'),
|
|
33
50
|
matrixIdentifier: zod_1.z.string().optional(),
|
|
34
51
|
matrixDomain: zod_1.z.string().min(1),
|
|
@@ -44,6 +61,10 @@ exports.LinkToMatrixAssetNode = zod_1.z.object({
|
|
|
44
61
|
.optional(),
|
|
45
62
|
});
|
|
46
63
|
exports.MatrixImageNode = zod_1.z.object({
|
|
64
|
+
nodeId: zod_1.z
|
|
65
|
+
.string()
|
|
66
|
+
.uuid()
|
|
67
|
+
.default(() => (0, crypto_1.randomUUID)()),
|
|
47
68
|
type: zod_1.z.literal('matrix-image'),
|
|
48
69
|
matrixIdentifier: zod_1.z.string().optional(),
|
|
49
70
|
matrixDomain: zod_1.z.string().min(1),
|
|
@@ -57,6 +78,10 @@ exports.MatrixImageNode = zod_1.z.object({
|
|
|
57
78
|
.optional(),
|
|
58
79
|
});
|
|
59
80
|
exports.DamImageNode = zod_1.z.object({
|
|
81
|
+
nodeId: zod_1.z
|
|
82
|
+
.string()
|
|
83
|
+
.uuid()
|
|
84
|
+
.default(() => (0, crypto_1.randomUUID)()),
|
|
60
85
|
type: zod_1.z.literal('dam-image'),
|
|
61
86
|
damSystemType: zod_1.z.enum(['bynder']),
|
|
62
87
|
damSystemIdentifier: zod_1.z.string().min(1),
|
|
@@ -75,6 +100,10 @@ exports.DamImageNode = zod_1.z.object({
|
|
|
75
100
|
.optional(),
|
|
76
101
|
});
|
|
77
102
|
exports.ComponentNode = zod_1.z.object({
|
|
103
|
+
nodeId: zod_1.z
|
|
104
|
+
.string()
|
|
105
|
+
.uuid()
|
|
106
|
+
.default(() => (0, crypto_1.randomUUID)()),
|
|
78
107
|
type: zod_1.z.literal('component'),
|
|
79
108
|
componentType: zod_1.z.enum(['server', 'edge']).optional(),
|
|
80
109
|
componentId: zod_1.z.string(),
|
|
@@ -103,10 +132,18 @@ exports.Variant = zod_1.z.object({
|
|
|
103
132
|
.partial(),
|
|
104
133
|
});
|
|
105
134
|
exports.VariationNode = zod_1.z.object({
|
|
135
|
+
nodeId: zod_1.z
|
|
136
|
+
.string()
|
|
137
|
+
.uuid()
|
|
138
|
+
.default(() => (0, crypto_1.randomUUID)()),
|
|
106
139
|
type: zod_1.z.literal('variation'),
|
|
107
140
|
default: zod_1.z.object({}),
|
|
108
141
|
});
|
|
109
142
|
exports.LayoutNode = zod_1.z.object({
|
|
143
|
+
nodeId: zod_1.z
|
|
144
|
+
.string()
|
|
145
|
+
.uuid()
|
|
146
|
+
.default(() => (0, crypto_1.randomUUID)()),
|
|
110
147
|
type: zod_1.z.literal('layout'),
|
|
111
148
|
layout: zod_1.z
|
|
112
149
|
.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatted-text.js","sourceRoot":"","sources":["../src/formatted-text.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;
|
|
1
|
+
{"version":3,"file":"formatted-text.js","sourceRoot":"","sources":["../src/formatted-text.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,mCAAoC;AAEpC,sEAAsE;AACtE,MAAM,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,SAAS,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SA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C,MAAM,EAAE,EACV,OAAC,CAAC,MAAM,CAAC;YACP,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;YACvB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;YACvB,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;YAC3B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;SAC1B,CAAC,CACH;KACF,CAAC;SACD,EAAE,CACD,OAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,OAAC,CAAC,MAAM,CACf,OAAC,CAAC,MAAM,EAAE,EACV,OAAC,CAAC,MAAM,CAAC;YACP,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;SAC1B,CAAC,CACH;KACF,CAAC,CACH;CACJ,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const formatted_text_1 = require("./formatted-text");
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
5
6
|
describe('formatted-text', () => {
|
|
6
7
|
describe('LinkToMatrixAssetNode', () => {
|
|
7
8
|
const validNode = {
|
|
@@ -16,6 +17,7 @@ describe('formatted-text', () => {
|
|
|
16
17
|
attributes: {
|
|
17
18
|
title: 'Link title',
|
|
18
19
|
},
|
|
20
|
+
nodeId: (0, crypto_1.randomUUID)(),
|
|
19
21
|
};
|
|
20
22
|
it.each([['valid node', validNode]])('Does not throw when parsing a %s', (description, node) => {
|
|
21
23
|
expect(() => formatted_text_1.LinkToMatrixAssetNode.parse(node)).not.toThrow();
|
|
@@ -46,6 +48,7 @@ describe('formatted-text', () => {
|
|
|
46
48
|
attributes: {
|
|
47
49
|
title: 'Link title',
|
|
48
50
|
},
|
|
51
|
+
nodeId: (0, crypto_1.randomUUID)(),
|
|
49
52
|
};
|
|
50
53
|
it.each([['valid node', validNode]])('Does not throw when parsing a %s', (description, node) => {
|
|
51
54
|
expect(() => formatted_text_1.MatrixImageNode.parse(node)).not.toThrow();
|
|
@@ -76,6 +79,7 @@ describe('formatted-text', () => {
|
|
|
76
79
|
attributes: {
|
|
77
80
|
title: 'Link title',
|
|
78
81
|
},
|
|
82
|
+
nodeId: (0, crypto_1.randomUUID)(),
|
|
79
83
|
};
|
|
80
84
|
it.each([
|
|
81
85
|
['valid node', validNode],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatted-text.spec.js","sourceRoot":"","sources":["../src/formatted-text.spec.ts"],"names":[],"mappings":";;AAAA,qDAAwF;AACxF,6BAAkC;
|
|
1
|
+
{"version":3,"file":"formatted-text.spec.js","sourceRoot":"","sources":["../src/formatted-text.spec.ts"],"names":[],"mappings":";;AAAA,qDAAwF;AACxF,6BAAkC;AAClC,mCAAoC;AAEpC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACrC,MAAM,SAAS,GAA0C;YACvD,IAAI,EAAE,sBAAsB;YAC5B,gBAAgB,EAAE,mBAAmB;YACrC,YAAY,EAAE,6BAA6B;YAC3C,aAAa,EAAE,OAAO;YACtB,MAAM,EAAE,QAAQ;YAChB,iBAAiB,EAAE;gBACjB,SAAS,EAAE,QAAQ;aACpB;YACD,UAAU,EAAE;gBACV,KAAK,EAAE,YAAY;aACpB;YACD,MAAM,EAAE,IAAA,mBAAU,GAAE;SACrB,CAAC;QAEF,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,CAClC,kCAAkC,EAClC,CAAC,WAAmB,EAAE,IAA2C,EAAE,EAAE;YACnE,MAAM,CAAC,GAAG,EAAE,CAAC,sCAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QAChE,CAAC,CACF,CAAC;QAE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ts
CHANGED
|
@@ -3,8 +3,9 @@ import { VariationNode, Variant, LayoutNode } from './formatted-text';
|
|
|
3
3
|
export type DeveloperDefinedLayoutNode = z.infer<typeof LayoutNode> & {
|
|
4
4
|
content: Record<string, PageLayoutContent>;
|
|
5
5
|
};
|
|
6
|
-
export declare const DeveloperDefinedLayoutNode: z.ZodType<DeveloperDefinedLayoutNode, z.ZodTypeDef, z.
|
|
6
|
+
export declare const DeveloperDefinedLayoutNode: z.ZodType<DeveloperDefinedLayoutNode, z.ZodTypeDef, z.input<typeof LayoutNode>>;
|
|
7
7
|
declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
8
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
8
9
|
type: z.ZodLiteral<"component">;
|
|
9
10
|
componentType: z.ZodOptional<z.ZodEnum<["server", "edge"]>>;
|
|
10
11
|
componentId: z.ZodString;
|
|
@@ -27,6 +28,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
27
28
|
}>]>>;
|
|
28
29
|
}, "strip", z.ZodTypeAny, {
|
|
29
30
|
type: "component";
|
|
31
|
+
nodeId: string;
|
|
30
32
|
componentId: string;
|
|
31
33
|
componentSet: string;
|
|
32
34
|
componentType?: "server" | "edge" | undefined;
|
|
@@ -40,6 +42,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
40
42
|
type: "component";
|
|
41
43
|
componentId: string;
|
|
42
44
|
componentSet: string;
|
|
45
|
+
nodeId?: string | undefined;
|
|
43
46
|
componentType?: "server" | "edge" | undefined;
|
|
44
47
|
contentItem?: {
|
|
45
48
|
id: string;
|
|
@@ -48,15 +51,19 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
48
51
|
schemaName: string;
|
|
49
52
|
} | undefined;
|
|
50
53
|
}>, z.ZodObject<{
|
|
54
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
51
55
|
type: z.ZodLiteral<"text">;
|
|
52
56
|
value: z.ZodString;
|
|
53
57
|
}, "strip", z.ZodTypeAny, {
|
|
54
58
|
value: string;
|
|
55
59
|
type: "text";
|
|
60
|
+
nodeId: string;
|
|
56
61
|
}, {
|
|
57
62
|
value: string;
|
|
58
63
|
type: "text";
|
|
64
|
+
nodeId?: string | undefined;
|
|
59
65
|
}>, z.ZodObject<{
|
|
66
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
60
67
|
type: z.ZodLiteral<"tag">;
|
|
61
68
|
tag: z.ZodString;
|
|
62
69
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -91,6 +98,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
91
98
|
}>>;
|
|
92
99
|
}, "strip", z.ZodTypeAny, {
|
|
93
100
|
type: "tag";
|
|
101
|
+
nodeId: string;
|
|
94
102
|
tag: string;
|
|
95
103
|
attributes?: Record<string, string> | undefined;
|
|
96
104
|
font?: {
|
|
@@ -107,6 +115,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
107
115
|
}, {
|
|
108
116
|
type: "tag";
|
|
109
117
|
tag: string;
|
|
118
|
+
nodeId?: string | undefined;
|
|
110
119
|
attributes?: Record<string, string> | undefined;
|
|
111
120
|
font?: {
|
|
112
121
|
bold?: boolean | undefined;
|
|
@@ -120,12 +129,16 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
120
129
|
alignment: "left" | "center" | "right" | "justify";
|
|
121
130
|
} | undefined;
|
|
122
131
|
}>, z.ZodObject<{
|
|
132
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
123
133
|
type: z.ZodLiteral<"fragment">;
|
|
124
134
|
}, "strip", z.ZodTypeAny, {
|
|
125
135
|
type: "fragment";
|
|
136
|
+
nodeId: string;
|
|
126
137
|
}, {
|
|
127
138
|
type: "fragment";
|
|
139
|
+
nodeId?: string | undefined;
|
|
128
140
|
}>, z.ZodObject<{
|
|
141
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
129
142
|
type: z.ZodLiteral<"link-to-matrix-asset">;
|
|
130
143
|
matrixIdentifier: z.ZodOptional<z.ZodString>;
|
|
131
144
|
matrixDomain: z.ZodString;
|
|
@@ -150,6 +163,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
150
163
|
}>>>;
|
|
151
164
|
}, "strip", z.ZodTypeAny, {
|
|
152
165
|
type: "link-to-matrix-asset";
|
|
166
|
+
nodeId: string;
|
|
153
167
|
matrixDomain: string;
|
|
154
168
|
matrixAssetId: string;
|
|
155
169
|
target: "_blank" | "_self" | "_parent" | "_top";
|
|
@@ -166,6 +180,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
166
180
|
matrixDomain: string;
|
|
167
181
|
matrixAssetId: string;
|
|
168
182
|
target: "_blank" | "_self" | "_parent" | "_top";
|
|
183
|
+
nodeId?: string | undefined;
|
|
169
184
|
attributes?: (Record<string, string> & {
|
|
170
185
|
target?: undefined;
|
|
171
186
|
href?: undefined;
|
|
@@ -175,6 +190,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
175
190
|
} | undefined;
|
|
176
191
|
matrixIdentifier?: string | undefined;
|
|
177
192
|
}>, z.ZodObject<{
|
|
193
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
178
194
|
type: z.ZodLiteral<"matrix-image">;
|
|
179
195
|
matrixIdentifier: z.ZodOptional<z.ZodString>;
|
|
180
196
|
matrixDomain: z.ZodString;
|
|
@@ -195,6 +211,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
195
211
|
}>>>;
|
|
196
212
|
}, "strip", z.ZodTypeAny, {
|
|
197
213
|
type: "matrix-image";
|
|
214
|
+
nodeId: string;
|
|
198
215
|
matrixDomain: string;
|
|
199
216
|
matrixAssetId: string;
|
|
200
217
|
attributes?: (Record<string, string> & {
|
|
@@ -208,6 +225,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
208
225
|
type: "matrix-image";
|
|
209
226
|
matrixDomain: string;
|
|
210
227
|
matrixAssetId: string;
|
|
228
|
+
nodeId?: string | undefined;
|
|
211
229
|
attributes?: (Record<string, string> & {
|
|
212
230
|
src?: undefined;
|
|
213
231
|
}) | undefined;
|
|
@@ -216,6 +234,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
216
234
|
} | undefined;
|
|
217
235
|
matrixIdentifier?: string | undefined;
|
|
218
236
|
}>, z.ZodObject<{
|
|
237
|
+
nodeId: z.ZodDefault<z.ZodString>;
|
|
219
238
|
type: z.ZodLiteral<"dam-image">;
|
|
220
239
|
damSystemType: z.ZodEnum<["bynder"]>;
|
|
221
240
|
damSystemIdentifier: z.ZodString;
|
|
@@ -243,6 +262,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
243
262
|
}>>>;
|
|
244
263
|
}, "strip", z.ZodTypeAny, {
|
|
245
264
|
type: "dam-image";
|
|
265
|
+
nodeId: string;
|
|
246
266
|
damSystemType: "bynder";
|
|
247
267
|
damSystemIdentifier: string;
|
|
248
268
|
damObjectId: string;
|
|
@@ -260,6 +280,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
260
280
|
damSystemType: "bynder";
|
|
261
281
|
damSystemIdentifier: string;
|
|
262
282
|
damObjectId: string;
|
|
283
|
+
nodeId?: string | undefined;
|
|
263
284
|
attributes?: (Record<string, string> & {
|
|
264
285
|
src?: undefined;
|
|
265
286
|
}) | undefined;
|
|
@@ -285,20 +306,22 @@ export type LayoutVariationNode = z.infer<typeof VariationNode> & {
|
|
|
285
306
|
};
|
|
286
307
|
variants: LayoutVariant[];
|
|
287
308
|
};
|
|
288
|
-
export declare const LayoutVariationNode: z.ZodType<LayoutVariationNode, z.ZodTypeDef, z.
|
|
309
|
+
export declare const LayoutVariationNode: z.ZodType<LayoutVariationNode, z.ZodTypeDef, z.input<typeof VariationNode>>;
|
|
289
310
|
type SimpleContentNodes = Exclude<BaseLayoutContentNodes, NodesWithChildren> | (NodesWithChildren & {
|
|
290
311
|
children: LayoutContentNodes[];
|
|
291
312
|
});
|
|
292
|
-
declare const SimpleContentNodes: z.ZodType<SimpleContentNodes, z.ZodTypeDef, BaseLayoutContentNodes
|
|
313
|
+
declare const SimpleContentNodes: z.ZodType<SimpleContentNodes, z.ZodTypeDef, z.input<typeof BaseLayoutContentNodes>>;
|
|
293
314
|
/**
|
|
294
315
|
* Schema for all possible layout content nodes with checks for children
|
|
295
316
|
*/
|
|
296
317
|
export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNodes, z.ZodTypeDef, {
|
|
297
318
|
value: string;
|
|
298
319
|
type: "text";
|
|
320
|
+
nodeId?: string | undefined;
|
|
299
321
|
} | {
|
|
300
322
|
type: "tag";
|
|
301
323
|
tag: string;
|
|
324
|
+
nodeId?: string | undefined;
|
|
302
325
|
attributes?: Record<string, string> | undefined;
|
|
303
326
|
font?: {
|
|
304
327
|
bold?: boolean | undefined;
|
|
@@ -313,11 +336,13 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
|
|
|
313
336
|
} | undefined;
|
|
314
337
|
} | {
|
|
315
338
|
type: "fragment";
|
|
339
|
+
nodeId?: string | undefined;
|
|
316
340
|
} | {
|
|
317
341
|
type: "link-to-matrix-asset";
|
|
318
342
|
matrixDomain: string;
|
|
319
343
|
matrixAssetId: string;
|
|
320
344
|
target: "_blank" | "_self" | "_parent" | "_top";
|
|
345
|
+
nodeId?: string | undefined;
|
|
321
346
|
attributes?: (Record<string, string> & {
|
|
322
347
|
target?: undefined;
|
|
323
348
|
href?: undefined;
|
|
@@ -330,6 +355,7 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
|
|
|
330
355
|
type: "matrix-image";
|
|
331
356
|
matrixDomain: string;
|
|
332
357
|
matrixAssetId: string;
|
|
358
|
+
nodeId?: string | undefined;
|
|
333
359
|
attributes?: (Record<string, string> & {
|
|
334
360
|
src?: undefined;
|
|
335
361
|
}) | undefined;
|
|
@@ -342,6 +368,7 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
|
|
|
342
368
|
damSystemType: "bynder";
|
|
343
369
|
damSystemIdentifier: string;
|
|
344
370
|
damObjectId: string;
|
|
371
|
+
nodeId?: string | undefined;
|
|
345
372
|
attributes?: (Record<string, string> & {
|
|
346
373
|
src?: undefined;
|
|
347
374
|
}) | undefined;
|
|
@@ -355,6 +382,7 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
|
|
|
355
382
|
type: "component";
|
|
356
383
|
componentId: string;
|
|
357
384
|
componentSet: string;
|
|
385
|
+
nodeId?: string | undefined;
|
|
358
386
|
componentType?: "server" | "edge" | undefined;
|
|
359
387
|
contentItem?: {
|
|
360
388
|
id: string;
|
|
@@ -365,6 +393,7 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
|
|
|
365
393
|
}>, z.ZodType<LayoutVariationNode, z.ZodTypeDef, {
|
|
366
394
|
type: "variation";
|
|
367
395
|
default: {};
|
|
396
|
+
nodeId?: string | undefined;
|
|
368
397
|
}>, z.ZodType<DeveloperDefinedLayoutNode, z.ZodTypeDef, {
|
|
369
398
|
type: "layout";
|
|
370
399
|
layout: {
|
|
@@ -390,6 +419,7 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
|
|
|
390
419
|
}>;
|
|
391
420
|
name: string;
|
|
392
421
|
};
|
|
422
|
+
nodeId?: string | undefined;
|
|
393
423
|
}>]>;
|
|
394
424
|
/**
|
|
395
425
|
* Comprehensive list of all nodes and the existence of child nodes within
|
|
@@ -399,9 +429,11 @@ export declare function getNestedNodes(nodes: LayoutContentNodes[]): LayoutConte
|
|
|
399
429
|
export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodType<SimpleContentNodes, z.ZodTypeDef, {
|
|
400
430
|
value: string;
|
|
401
431
|
type: "text";
|
|
432
|
+
nodeId?: string | undefined;
|
|
402
433
|
} | {
|
|
403
434
|
type: "tag";
|
|
404
435
|
tag: string;
|
|
436
|
+
nodeId?: string | undefined;
|
|
405
437
|
attributes?: Record<string, string> | undefined;
|
|
406
438
|
font?: {
|
|
407
439
|
bold?: boolean | undefined;
|
|
@@ -416,11 +448,13 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
416
448
|
} | undefined;
|
|
417
449
|
} | {
|
|
418
450
|
type: "fragment";
|
|
451
|
+
nodeId?: string | undefined;
|
|
419
452
|
} | {
|
|
420
453
|
type: "link-to-matrix-asset";
|
|
421
454
|
matrixDomain: string;
|
|
422
455
|
matrixAssetId: string;
|
|
423
456
|
target: "_blank" | "_self" | "_parent" | "_top";
|
|
457
|
+
nodeId?: string | undefined;
|
|
424
458
|
attributes?: (Record<string, string> & {
|
|
425
459
|
target?: undefined;
|
|
426
460
|
href?: undefined;
|
|
@@ -433,6 +467,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
433
467
|
type: "matrix-image";
|
|
434
468
|
matrixDomain: string;
|
|
435
469
|
matrixAssetId: string;
|
|
470
|
+
nodeId?: string | undefined;
|
|
436
471
|
attributes?: (Record<string, string> & {
|
|
437
472
|
src?: undefined;
|
|
438
473
|
}) | undefined;
|
|
@@ -445,6 +480,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
445
480
|
damSystemType: "bynder";
|
|
446
481
|
damSystemIdentifier: string;
|
|
447
482
|
damObjectId: string;
|
|
483
|
+
nodeId?: string | undefined;
|
|
448
484
|
attributes?: (Record<string, string> & {
|
|
449
485
|
src?: undefined;
|
|
450
486
|
}) | undefined;
|
|
@@ -458,6 +494,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
458
494
|
type: "component";
|
|
459
495
|
componentId: string;
|
|
460
496
|
componentSet: string;
|
|
497
|
+
nodeId?: string | undefined;
|
|
461
498
|
componentType?: "server" | "edge" | undefined;
|
|
462
499
|
contentItem?: {
|
|
463
500
|
id: string;
|
|
@@ -468,6 +505,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
468
505
|
}>, z.ZodType<LayoutVariationNode, z.ZodTypeDef, {
|
|
469
506
|
type: "variation";
|
|
470
507
|
default: {};
|
|
508
|
+
nodeId?: string | undefined;
|
|
471
509
|
}>, z.ZodType<DeveloperDefinedLayoutNode, z.ZodTypeDef, {
|
|
472
510
|
type: "layout";
|
|
473
511
|
layout: {
|
|
@@ -493,12 +531,15 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
493
531
|
}>;
|
|
494
532
|
name: string;
|
|
495
533
|
};
|
|
534
|
+
nodeId?: string | undefined;
|
|
496
535
|
}>]>, "many">, (LayoutVariationNode | SimpleContentNodes | DeveloperDefinedLayoutNode)[], ({
|
|
497
536
|
value: string;
|
|
498
537
|
type: "text";
|
|
538
|
+
nodeId?: string | undefined;
|
|
499
539
|
} | {
|
|
500
540
|
type: "tag";
|
|
501
541
|
tag: string;
|
|
542
|
+
nodeId?: string | undefined;
|
|
502
543
|
attributes?: Record<string, string> | undefined;
|
|
503
544
|
font?: {
|
|
504
545
|
bold?: boolean | undefined;
|
|
@@ -513,11 +554,13 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
513
554
|
} | undefined;
|
|
514
555
|
} | {
|
|
515
556
|
type: "fragment";
|
|
557
|
+
nodeId?: string | undefined;
|
|
516
558
|
} | {
|
|
517
559
|
type: "link-to-matrix-asset";
|
|
518
560
|
matrixDomain: string;
|
|
519
561
|
matrixAssetId: string;
|
|
520
562
|
target: "_blank" | "_self" | "_parent" | "_top";
|
|
563
|
+
nodeId?: string | undefined;
|
|
521
564
|
attributes?: (Record<string, string> & {
|
|
522
565
|
target?: undefined;
|
|
523
566
|
href?: undefined;
|
|
@@ -530,6 +573,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
530
573
|
type: "matrix-image";
|
|
531
574
|
matrixDomain: string;
|
|
532
575
|
matrixAssetId: string;
|
|
576
|
+
nodeId?: string | undefined;
|
|
533
577
|
attributes?: (Record<string, string> & {
|
|
534
578
|
src?: undefined;
|
|
535
579
|
}) | undefined;
|
|
@@ -542,6 +586,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
542
586
|
damSystemType: "bynder";
|
|
543
587
|
damSystemIdentifier: string;
|
|
544
588
|
damObjectId: string;
|
|
589
|
+
nodeId?: string | undefined;
|
|
545
590
|
attributes?: (Record<string, string> & {
|
|
546
591
|
src?: undefined;
|
|
547
592
|
}) | undefined;
|
|
@@ -555,6 +600,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
555
600
|
type: "component";
|
|
556
601
|
componentId: string;
|
|
557
602
|
componentSet: string;
|
|
603
|
+
nodeId?: string | undefined;
|
|
558
604
|
componentType?: "server" | "edge" | undefined;
|
|
559
605
|
contentItem?: {
|
|
560
606
|
id: string;
|
|
@@ -565,6 +611,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
565
611
|
} | {
|
|
566
612
|
type: "variation";
|
|
567
613
|
default: {};
|
|
614
|
+
nodeId?: string | undefined;
|
|
568
615
|
} | {
|
|
569
616
|
type: "layout";
|
|
570
617
|
layout: {
|
|
@@ -590,6 +637,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
|
|
|
590
637
|
}>;
|
|
591
638
|
name: string;
|
|
592
639
|
};
|
|
640
|
+
nodeId?: string | undefined;
|
|
593
641
|
})[]>;
|
|
594
642
|
export type PageLayoutContent = z.infer<typeof PageLayoutContent>;
|
|
595
643
|
export type NodeResolver = (node: LayoutContentNodes) => Promise<LayoutContentNodes | void>;
|