@squiz/dx-page-contents-lib 1.53.1-alpha.18 → 1.53.1-alpha.2

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.
@@ -188,183 +188,17 @@ export type LayoutVariationNode = z.infer<typeof VariationNode> & {
188
188
  variants: LayoutVariant[];
189
189
  };
190
190
  export declare const LayoutVariationNode: z.ZodType<LayoutVariationNode, z.ZodTypeDef, z.infer<typeof VariationNode>>;
191
- declare const BaseExperimentNode: z.ZodObject<{
192
- type: z.ZodLiteral<"experiment">;
193
- experimentId: z.ZodString;
194
- }, "strip", z.ZodTypeAny, {
195
- type: "experiment";
196
- experimentId: string;
197
- }, {
198
- type: "experiment";
199
- experimentId: string;
200
- }>;
201
- type OutputExperimentNode = z.infer<typeof BaseExperimentNode> & {
202
- variants: Record<string, SimpleContentNodes[]>;
203
- };
204
- type InputExperimentNode = z.infer<typeof BaseExperimentNode> & {
205
- variants: Record<string, BaseLayoutContentNodes[]>;
206
- };
207
- export declare const ExperimentNode: z.ZodType<OutputExperimentNode, z.ZodTypeDef, InputExperimentNode>;
208
- export type ExperimentNode = z.infer<typeof ExperimentNode>;
209
- type SimpleContentNodes = Exclude<BaseLayoutContentNodes, NodesWithChildren> | (NodesWithChildren & {
191
+ /**
192
+ * Comprehensive list of all nodes and the existence of child nodes within
193
+ */
194
+ export type LayoutContentNodes = Exclude<BaseLayoutContentNodes, NodesWithChildren> | LayoutVariationNode | (NodesWithChildren & {
210
195
  children: LayoutContentNodes[];
211
196
  });
212
- declare const SimpleContentNodes: z.ZodType<SimpleContentNodes, z.ZodTypeDef, BaseLayoutContentNodes>;
213
197
  /**
214
198
  * Schema for all possible layout content nodes with checks for children
215
199
  */
216
- export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNodes, z.ZodTypeDef, {
217
- value: string;
218
- type: "text";
219
- } | {
220
- type: "tag";
221
- tag: string;
222
- attributes?: Record<string, string> | undefined;
223
- font?: {
224
- bold?: boolean | undefined;
225
- italics?: boolean | undefined;
226
- underline?: boolean | undefined;
227
- color?: string | undefined;
228
- size?: string | undefined;
229
- fontFamily?: string | undefined;
230
- } | undefined;
231
- formattingOptions?: {
232
- alignment: "left" | "center" | "right" | "justify";
233
- } | undefined;
234
- } | {
235
- type: "link-to-matrix-asset";
236
- matrixDomain: string;
237
- matrixAssetId: string;
238
- target: "_blank" | "_self" | "_parent" | "_top";
239
- matrixIdentifier?: string | undefined;
240
- formattingOptions?: {
241
- alignment: "left" | "center" | "right" | "justify";
242
- } | undefined;
243
- } | {
244
- type: "matrix-image";
245
- matrixDomain: string;
246
- matrixAssetId: string;
247
- matrixIdentifier?: string | undefined;
248
- formattingOptions?: {
249
- alignment: "left" | "center" | "right" | "justify";
250
- } | undefined;
251
- } | {
252
- type: "component";
253
- componentId: string;
254
- componentSet: string;
255
- contentItem?: {
256
- id: string;
257
- } | {
258
- content: Record<string, unknown>;
259
- schemaName: string;
260
- } | undefined;
261
- }>, z.ZodType<LayoutVariationNode, z.ZodTypeDef, {
262
- type: "variation";
263
- default: {};
264
- }>, z.ZodType<OutputExperimentNode, z.ZodTypeDef, InputExperimentNode>]>;
265
- /**
266
- * Comprehensive list of all nodes and the existence of child nodes within
267
- */
268
- export type LayoutContentNodes = z.infer<typeof LayoutContentNodes>;
269
- export declare function getNestedNodes(nodes: LayoutContentNodes[]): LayoutContentNodes[];
270
- export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodType<SimpleContentNodes, z.ZodTypeDef, {
271
- value: string;
272
- type: "text";
273
- } | {
274
- type: "tag";
275
- tag: string;
276
- attributes?: Record<string, string> | undefined;
277
- font?: {
278
- bold?: boolean | undefined;
279
- italics?: boolean | undefined;
280
- underline?: boolean | undefined;
281
- color?: string | undefined;
282
- size?: string | undefined;
283
- fontFamily?: string | undefined;
284
- } | undefined;
285
- formattingOptions?: {
286
- alignment: "left" | "center" | "right" | "justify";
287
- } | undefined;
288
- } | {
289
- type: "link-to-matrix-asset";
290
- matrixDomain: string;
291
- matrixAssetId: string;
292
- target: "_blank" | "_self" | "_parent" | "_top";
293
- matrixIdentifier?: string | undefined;
294
- formattingOptions?: {
295
- alignment: "left" | "center" | "right" | "justify";
296
- } | undefined;
297
- } | {
298
- type: "matrix-image";
299
- matrixDomain: string;
300
- matrixAssetId: string;
301
- matrixIdentifier?: string | undefined;
302
- formattingOptions?: {
303
- alignment: "left" | "center" | "right" | "justify";
304
- } | undefined;
305
- } | {
306
- type: "component";
307
- componentId: string;
308
- componentSet: string;
309
- contentItem?: {
310
- id: string;
311
- } | {
312
- content: Record<string, unknown>;
313
- schemaName: string;
314
- } | undefined;
315
- }>, z.ZodType<LayoutVariationNode, z.ZodTypeDef, {
316
- type: "variation";
317
- default: {};
318
- }>, z.ZodType<OutputExperimentNode, z.ZodTypeDef, InputExperimentNode>]>, "many">, (LayoutVariationNode | SimpleContentNodes | OutputExperimentNode)[], ({
319
- value: string;
320
- type: "text";
321
- } | {
322
- type: "tag";
323
- tag: string;
324
- attributes?: Record<string, string> | undefined;
325
- font?: {
326
- bold?: boolean | undefined;
327
- italics?: boolean | undefined;
328
- underline?: boolean | undefined;
329
- color?: string | undefined;
330
- size?: string | undefined;
331
- fontFamily?: string | undefined;
332
- } | undefined;
333
- formattingOptions?: {
334
- alignment: "left" | "center" | "right" | "justify";
335
- } | undefined;
336
- } | {
337
- type: "link-to-matrix-asset";
338
- matrixDomain: string;
339
- matrixAssetId: string;
340
- target: "_blank" | "_self" | "_parent" | "_top";
341
- matrixIdentifier?: string | undefined;
342
- formattingOptions?: {
343
- alignment: "left" | "center" | "right" | "justify";
344
- } | undefined;
345
- } | {
346
- type: "matrix-image";
347
- matrixDomain: string;
348
- matrixAssetId: string;
349
- matrixIdentifier?: string | undefined;
350
- formattingOptions?: {
351
- alignment: "left" | "center" | "right" | "justify";
352
- } | undefined;
353
- } | {
354
- type: "component";
355
- componentId: string;
356
- componentSet: string;
357
- contentItem?: {
358
- id: string;
359
- } | {
360
- content: Record<string, unknown>;
361
- schemaName: string;
362
- } | undefined;
363
- } | {
364
- type: "variation";
365
- default: {};
366
- } | InputExperimentNode)[]>;
367
- export type PageLayoutContent = z.infer<typeof PageLayoutContent>;
200
+ export declare const LayoutContentNodes: z.ZodType<LayoutContentNodes, z.ZodTypeDef, z.infer<typeof VariationNode> | BaseLayoutContentNodes>;
201
+ export type PageLayoutContent = LayoutContentNodes[];
368
202
  export type NodeResolver = (node: LayoutContentNodes) => Promise<LayoutContentNodes | void>;
369
203
  export type ContentResolver<K extends LayoutContentNodes['type']> = (node: Extract<LayoutContentNodes, {
370
204
  type: K;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PageLayoutContentResolver = exports.PageLayoutContent = exports.getNestedNodes = exports.LayoutContentNodes = exports.ExperimentNode = exports.LayoutVariationNode = void 0;
3
+ exports.PageLayoutContentResolver = exports.LayoutContentNodes = exports.LayoutVariationNode = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const formatted_text_1 = require("./formatted-text");
6
6
  const resolvers_1 = require("./resolvers");
@@ -15,7 +15,8 @@ const BaseLayoutContentNodes = zod_1.z.discriminatedUnion('type', [
15
15
  * All the nodes which allow children
16
16
  */
17
17
  const NODES_WITH_CHILDREN = ['tag', 'link-to-matrix-asset'];
18
- exports.LayoutVariationNode = formatted_text_1.VariationNode.extend({
18
+ exports.LayoutVariationNode = zod_1.z
19
+ .object({
19
20
  default: zod_1.z.object({
20
21
  node: zod_1.z.lazy(() => exports.LayoutContentNodes).nullable(),
21
22
  }),
@@ -25,23 +26,26 @@ exports.LayoutVariationNode = formatted_text_1.VariationNode.extend({
25
26
  .array()
26
27
  .min(1)
27
28
  .refine((variants) => {
28
- const codes = variants.map((v) => JSON.stringify([v.conditions.segment.code]));
29
- return new Set(codes).size === codes.length;
29
+ const uniqueKeys = {};
30
+ return (variants.findIndex((variant) => {
31
+ const uniqueKey = JSON.stringify([variant.conditions.segment.code]);
32
+ if (!uniqueKeys[uniqueKey]) {
33
+ uniqueKeys[uniqueKey] = true;
34
+ return false;
35
+ }
36
+ return true;
37
+ }) < 0);
30
38
  }, { message: 'The conditions assigned to a variant must be unique.' }),
31
- }).strict();
32
- // ------- EXPERIMENT NODE --------------
33
- const BaseExperimentNode = zod_1.z.object({
34
- type: zod_1.z.literal('experiment'),
35
- experimentId: zod_1.z.string(),
36
- });
37
- exports.ExperimentNode = BaseExperimentNode.extend({
38
- variants: zod_1.z.record(zod_1.z.lazy(() => SimpleContentNodes.array())),
39
- }).strict();
40
- const SimpleContentNodes = zod_1.z
39
+ })
40
+ .and(formatted_text_1.VariationNode);
41
+ /**
42
+ * Schema for all possible layout content nodes with checks for children
43
+ */
44
+ exports.LayoutContentNodes = zod_1.z
41
45
  .object({
42
46
  children: zod_1.z.lazy(() => zod_1.z.array(exports.LayoutContentNodes)).optional(),
43
47
  })
44
- .and(BaseLayoutContentNodes)
48
+ .and(zod_1.z.union([exports.LayoutVariationNode, BaseLayoutContentNodes]))
45
49
  .refine((value) => {
46
50
  // Only certain node types to contain children
47
51
  if ('children' in value && NODES_WITH_CHILDREN.includes(value.type) === false) {
@@ -49,28 +53,6 @@ const SimpleContentNodes = zod_1.z
49
53
  }
50
54
  return true;
51
55
  });
52
- /**
53
- * Schema for all possible layout content nodes with checks for children
54
- */
55
- exports.LayoutContentNodes = zod_1.z.union([SimpleContentNodes, exports.LayoutVariationNode, exports.ExperimentNode]);
56
- function isRecursiveNode(node) {
57
- return node.type === 'variation';
58
- }
59
- function pickNestedNodes(node) {
60
- return [node.default.node].concat(node.variants.map((v) => v.node)).filter((n) => !!n);
61
- }
62
- function getNestedNodes(nodes) {
63
- const topLevelNodes = nodes.filter(isRecursiveNode).map(pickNestedNodes);
64
- return topLevelNodes.flatMap(getNestedNodes).concat(topLevelNodes.flat());
65
- }
66
- exports.getNestedNodes = getNestedNodes;
67
- exports.PageLayoutContent = zod_1.z.array(exports.LayoutContentNodes).refine((nodes) => {
68
- // Enforce singular experiment ID within the Page Content
69
- return nodes
70
- .concat(getNestedNodes(nodes))
71
- .filter((n) => n.type === 'experiment')
72
- .every((v, _, list) => v.experimentId === list[0].experimentId);
73
- }, { message: 'all experiment nodes must have same experimentId' });
74
56
  /**
75
57
  * Walk through the layout content and resolve the content items.
76
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"layout-content.js","sourceRoot":"","sources":["../src/layout-content.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,qDAQ0B;AAC1B,2CAAuD;AAEvD,MAAM,sBAAsB,GAAG,OAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC1D,8BAAa;IACb,yBAAQ;IACR,wBAAO;IACP,sCAAqB;IACrB,gCAAe;CAChB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,sBAAsB,CAAU,CAAC;AAgBxD,QAAA,mBAAmB,GAI5B,8BAAa,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,0BAAkB,CAAC,CAAC,QAAQ,EAAE;KAClD,CAAC;IACF,QAAQ,EAAE,wBAAO,CAAC,GAAG,CACnB,OAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,0BAAkB,CAAC,CAAC,QAAQ,EAAE;KAClD,CAAC,CACH;SACE,KAAK,EAAE;SACP,GAAG,CAAC,CAAC,CAAC;SACN,MAAM,CACL,CAAC,QAAQ,EAAE,EAAE;QACX,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/E,OAAO,IA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