@squiz/dx-page-contents-lib 1.75.0 → 1.75.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.
Files changed (34) hide show
  1. package/lib/formatted-text.d.ts +93 -0
  2. package/lib/formatted-text.js +62 -1
  3. package/lib/formatted-text.js.map +1 -1
  4. package/lib/formatted-text.spec.js +52 -0
  5. package/lib/formatted-text.spec.js.map +1 -1
  6. package/lib/layout-content.d.ts +168 -4
  7. package/lib/layout-content.js +2 -1
  8. package/lib/layout-content.js.map +1 -1
  9. package/lib/layout-content.spec.js +18 -6
  10. package/lib/layout-content.spec.js.map +1 -1
  11. package/lib/layouts/custom-layout.d.ts +226 -0
  12. package/lib/layouts/index.d.ts +1001 -1
  13. package/lib/layouts/raw.layout.d.ts +200 -0
  14. package/lib/layouts/single-column.layout.d.ts +200 -0
  15. package/lib/layouts/two-column.layout.d.ts +400 -0
  16. package/lib/mocks/PageContentsHelpers.d.ts +1351 -1
  17. package/lib/mocks/PageContentsHelpers.js +7 -0
  18. package/lib/mocks/PageContentsHelpers.js.map +1 -1
  19. package/lib/mocks/PageContentsMocks.d.ts +1 -0
  20. package/lib/mocks/PageContentsMocks.js +36 -0
  21. package/lib/mocks/PageContentsMocks.js.map +1 -1
  22. package/lib/page-contents-lib.d.ts +50 -0
  23. package/lib/page-contents-lib.spec.js +61 -15
  24. package/lib/page-contents-lib.spec.js.map +1 -1
  25. package/lib/resolvers/create-variant-resolver.js +6 -1
  26. package/lib/resolvers/create-variant-resolver.js.map +1 -1
  27. package/lib/resolvers/create-variant-resolver.spec.js +21 -17
  28. package/lib/resolvers/create-variant-resolver.spec.js.map +1 -1
  29. package/lib/resolvers/default-layout-resolver.spec.d.ts +1 -0
  30. package/lib/resolvers/default-layout-resolver.spec.js +36 -0
  31. package/lib/resolvers/default-layout-resolver.spec.js.map +1 -0
  32. package/lib/resolvers/default-variation-resolver.spec.js +8 -4
  33. package/lib/resolvers/default-variation-resolver.spec.js.map +1 -1
  34. package/package.json +1 -1
@@ -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.infer<typeof LayoutNode>>;
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,72 @@ 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>;
194
+ type: z.ZodLiteral<"link-to-dam-asset">;
195
+ damSystemType: z.ZodEnum<["bynder"]>;
196
+ damSystemIdentifier: z.ZodString;
197
+ damObjectId: z.ZodString;
198
+ damAdditional: z.ZodOptional<z.ZodObject<{
199
+ variant: z.ZodOptional<z.ZodString>;
200
+ }, "strip", z.ZodTypeAny, {
201
+ variant?: string | undefined;
202
+ }, {
203
+ variant?: string | undefined;
204
+ }>>;
205
+ target: z.ZodEnum<["_blank", "_self", "_parent", "_top"]>;
206
+ formattingOptions: z.ZodOptional<z.ZodObject<{
207
+ alignment: z.ZodEnum<["left", "center", "right", "justify"]>;
208
+ }, "strip", z.ZodTypeAny, {
209
+ alignment: "left" | "center" | "right" | "justify";
210
+ }, {
211
+ alignment: "left" | "center" | "right" | "justify";
212
+ }>>;
213
+ attributes: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodString>, z.ZodObject<{
214
+ href: z.ZodOptional<z.ZodNever>;
215
+ target: z.ZodOptional<z.ZodNever>;
216
+ }, "strip", z.ZodTypeAny, {
217
+ target?: undefined;
218
+ href?: undefined;
219
+ }, {
220
+ target?: undefined;
221
+ href?: undefined;
222
+ }>>>;
223
+ }, "strip", z.ZodTypeAny, {
224
+ type: "link-to-dam-asset";
225
+ nodeId: string;
226
+ target: "_blank" | "_self" | "_parent" | "_top";
227
+ damSystemType: "bynder";
228
+ damSystemIdentifier: string;
229
+ damObjectId: string;
230
+ attributes?: (Record<string, string> & {
231
+ target?: undefined;
232
+ href?: undefined;
233
+ }) | undefined;
234
+ formattingOptions?: {
235
+ alignment: "left" | "center" | "right" | "justify";
236
+ } | undefined;
237
+ damAdditional?: {
238
+ variant?: string | undefined;
239
+ } | undefined;
240
+ }, {
241
+ type: "link-to-dam-asset";
242
+ target: "_blank" | "_self" | "_parent" | "_top";
243
+ damSystemType: "bynder";
244
+ damSystemIdentifier: string;
245
+ damObjectId: string;
246
+ nodeId?: string | undefined;
247
+ attributes?: (Record<string, string> & {
248
+ target?: undefined;
249
+ href?: undefined;
250
+ }) | undefined;
251
+ formattingOptions?: {
252
+ alignment: "left" | "center" | "right" | "justify";
253
+ } | undefined;
254
+ damAdditional?: {
255
+ variant?: string | undefined;
256
+ } | undefined;
257
+ }>, z.ZodObject<{
258
+ nodeId: z.ZodDefault<z.ZodString>;
178
259
  type: z.ZodLiteral<"matrix-image">;
179
260
  matrixIdentifier: z.ZodOptional<z.ZodString>;
180
261
  matrixDomain: z.ZodString;
@@ -195,6 +276,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
195
276
  }>>>;
196
277
  }, "strip", z.ZodTypeAny, {
197
278
  type: "matrix-image";
279
+ nodeId: string;
198
280
  matrixDomain: string;
199
281
  matrixAssetId: string;
200
282
  attributes?: (Record<string, string> & {
@@ -208,6 +290,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
208
290
  type: "matrix-image";
209
291
  matrixDomain: string;
210
292
  matrixAssetId: string;
293
+ nodeId?: string | undefined;
211
294
  attributes?: (Record<string, string> & {
212
295
  src?: undefined;
213
296
  }) | undefined;
@@ -216,6 +299,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
216
299
  } | undefined;
217
300
  matrixIdentifier?: string | undefined;
218
301
  }>, z.ZodObject<{
302
+ nodeId: z.ZodDefault<z.ZodString>;
219
303
  type: z.ZodLiteral<"dam-image">;
220
304
  damSystemType: z.ZodEnum<["bynder"]>;
221
305
  damSystemIdentifier: z.ZodString;
@@ -243,6 +327,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
243
327
  }>>>;
244
328
  }, "strip", z.ZodTypeAny, {
245
329
  type: "dam-image";
330
+ nodeId: string;
246
331
  damSystemType: "bynder";
247
332
  damSystemIdentifier: string;
248
333
  damObjectId: string;
@@ -260,6 +345,7 @@ declare const BaseLayoutContentNodes: z.ZodDiscriminatedUnion<"type", [z.ZodObje
260
345
  damSystemType: "bynder";
261
346
  damSystemIdentifier: string;
262
347
  damObjectId: string;
348
+ nodeId?: string | undefined;
263
349
  attributes?: (Record<string, string> & {
264
350
  src?: undefined;
265
351
  }) | undefined;
@@ -274,7 +360,7 @@ type BaseLayoutContentNodes = z.infer<typeof BaseLayoutContentNodes>;
274
360
  /**
275
361
  * All the nodes which allow children
276
362
  */
277
- declare const NODES_WITH_CHILDREN: readonly ["tag", "fragment", "link-to-matrix-asset"];
363
+ declare const NODES_WITH_CHILDREN: readonly ["tag", "fragment", "link-to-matrix-asset", "link-to-dam-asset"];
278
364
  type NodesWithChildren = ChooseNodesWithChildren<(typeof NODES_WITH_CHILDREN)[number]>;
279
365
  export type LayoutVariant = z.infer<typeof Variant> & {
280
366
  node: LayoutContentNodes | null;
@@ -285,20 +371,22 @@ export type LayoutVariationNode = z.infer<typeof VariationNode> & {
285
371
  };
286
372
  variants: LayoutVariant[];
287
373
  };
288
- export declare const LayoutVariationNode: z.ZodType<LayoutVariationNode, z.ZodTypeDef, z.infer<typeof VariationNode>>;
374
+ export declare const LayoutVariationNode: z.ZodType<LayoutVariationNode, z.ZodTypeDef, z.input<typeof VariationNode>>;
289
375
  type SimpleContentNodes = Exclude<BaseLayoutContentNodes, NodesWithChildren> | (NodesWithChildren & {
290
376
  children: LayoutContentNodes[];
291
377
  });
292
- declare const SimpleContentNodes: z.ZodType<SimpleContentNodes, z.ZodTypeDef, BaseLayoutContentNodes>;
378
+ declare const SimpleContentNodes: z.ZodType<SimpleContentNodes, z.ZodTypeDef, z.input<typeof BaseLayoutContentNodes>>;
293
379
  /**
294
380
  * Schema for all possible layout content nodes with checks for children
295
381
  */
296
382
  export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNodes, z.ZodTypeDef, {
297
383
  value: string;
298
384
  type: "text";
385
+ nodeId?: string | undefined;
299
386
  } | {
300
387
  type: "tag";
301
388
  tag: string;
389
+ nodeId?: string | undefined;
302
390
  attributes?: Record<string, string> | undefined;
303
391
  font?: {
304
392
  bold?: boolean | undefined;
@@ -313,11 +401,13 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
313
401
  } | undefined;
314
402
  } | {
315
403
  type: "fragment";
404
+ nodeId?: string | undefined;
316
405
  } | {
317
406
  type: "link-to-matrix-asset";
318
407
  matrixDomain: string;
319
408
  matrixAssetId: string;
320
409
  target: "_blank" | "_self" | "_parent" | "_top";
410
+ nodeId?: string | undefined;
321
411
  attributes?: (Record<string, string> & {
322
412
  target?: undefined;
323
413
  href?: undefined;
@@ -326,10 +416,28 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
326
416
  alignment: "left" | "center" | "right" | "justify";
327
417
  } | undefined;
328
418
  matrixIdentifier?: string | undefined;
419
+ } | {
420
+ type: "link-to-dam-asset";
421
+ target: "_blank" | "_self" | "_parent" | "_top";
422
+ damSystemType: "bynder";
423
+ damSystemIdentifier: string;
424
+ damObjectId: string;
425
+ nodeId?: string | undefined;
426
+ attributes?: (Record<string, string> & {
427
+ target?: undefined;
428
+ href?: undefined;
429
+ }) | undefined;
430
+ formattingOptions?: {
431
+ alignment: "left" | "center" | "right" | "justify";
432
+ } | undefined;
433
+ damAdditional?: {
434
+ variant?: string | undefined;
435
+ } | undefined;
329
436
  } | {
330
437
  type: "matrix-image";
331
438
  matrixDomain: string;
332
439
  matrixAssetId: string;
440
+ nodeId?: string | undefined;
333
441
  attributes?: (Record<string, string> & {
334
442
  src?: undefined;
335
443
  }) | undefined;
@@ -342,6 +450,7 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
342
450
  damSystemType: "bynder";
343
451
  damSystemIdentifier: string;
344
452
  damObjectId: string;
453
+ nodeId?: string | undefined;
345
454
  attributes?: (Record<string, string> & {
346
455
  src?: undefined;
347
456
  }) | undefined;
@@ -355,6 +464,7 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
355
464
  type: "component";
356
465
  componentId: string;
357
466
  componentSet: string;
467
+ nodeId?: string | undefined;
358
468
  componentType?: "server" | "edge" | undefined;
359
469
  contentItem?: {
360
470
  id: string;
@@ -365,6 +475,7 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
365
475
  }>, z.ZodType<LayoutVariationNode, z.ZodTypeDef, {
366
476
  type: "variation";
367
477
  default: {};
478
+ nodeId?: string | undefined;
368
479
  }>, z.ZodType<DeveloperDefinedLayoutNode, z.ZodTypeDef, {
369
480
  type: "layout";
370
481
  layout: {
@@ -390,6 +501,7 @@ export declare const LayoutContentNodes: z.ZodUnion<[z.ZodType<SimpleContentNode
390
501
  }>;
391
502
  name: string;
392
503
  };
504
+ nodeId?: string | undefined;
393
505
  }>]>;
394
506
  /**
395
507
  * Comprehensive list of all nodes and the existence of child nodes within
@@ -399,9 +511,11 @@ export declare function getNestedNodes(nodes: LayoutContentNodes[]): LayoutConte
399
511
  export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodType<SimpleContentNodes, z.ZodTypeDef, {
400
512
  value: string;
401
513
  type: "text";
514
+ nodeId?: string | undefined;
402
515
  } | {
403
516
  type: "tag";
404
517
  tag: string;
518
+ nodeId?: string | undefined;
405
519
  attributes?: Record<string, string> | undefined;
406
520
  font?: {
407
521
  bold?: boolean | undefined;
@@ -416,11 +530,13 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
416
530
  } | undefined;
417
531
  } | {
418
532
  type: "fragment";
533
+ nodeId?: string | undefined;
419
534
  } | {
420
535
  type: "link-to-matrix-asset";
421
536
  matrixDomain: string;
422
537
  matrixAssetId: string;
423
538
  target: "_blank" | "_self" | "_parent" | "_top";
539
+ nodeId?: string | undefined;
424
540
  attributes?: (Record<string, string> & {
425
541
  target?: undefined;
426
542
  href?: undefined;
@@ -429,10 +545,28 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
429
545
  alignment: "left" | "center" | "right" | "justify";
430
546
  } | undefined;
431
547
  matrixIdentifier?: string | undefined;
548
+ } | {
549
+ type: "link-to-dam-asset";
550
+ target: "_blank" | "_self" | "_parent" | "_top";
551
+ damSystemType: "bynder";
552
+ damSystemIdentifier: string;
553
+ damObjectId: string;
554
+ nodeId?: string | undefined;
555
+ attributes?: (Record<string, string> & {
556
+ target?: undefined;
557
+ href?: undefined;
558
+ }) | undefined;
559
+ formattingOptions?: {
560
+ alignment: "left" | "center" | "right" | "justify";
561
+ } | undefined;
562
+ damAdditional?: {
563
+ variant?: string | undefined;
564
+ } | undefined;
432
565
  } | {
433
566
  type: "matrix-image";
434
567
  matrixDomain: string;
435
568
  matrixAssetId: string;
569
+ nodeId?: string | undefined;
436
570
  attributes?: (Record<string, string> & {
437
571
  src?: undefined;
438
572
  }) | undefined;
@@ -445,6 +579,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
445
579
  damSystemType: "bynder";
446
580
  damSystemIdentifier: string;
447
581
  damObjectId: string;
582
+ nodeId?: string | undefined;
448
583
  attributes?: (Record<string, string> & {
449
584
  src?: undefined;
450
585
  }) | undefined;
@@ -458,6 +593,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
458
593
  type: "component";
459
594
  componentId: string;
460
595
  componentSet: string;
596
+ nodeId?: string | undefined;
461
597
  componentType?: "server" | "edge" | undefined;
462
598
  contentItem?: {
463
599
  id: string;
@@ -468,6 +604,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
468
604
  }>, z.ZodType<LayoutVariationNode, z.ZodTypeDef, {
469
605
  type: "variation";
470
606
  default: {};
607
+ nodeId?: string | undefined;
471
608
  }>, z.ZodType<DeveloperDefinedLayoutNode, z.ZodTypeDef, {
472
609
  type: "layout";
473
610
  layout: {
@@ -493,12 +630,15 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
493
630
  }>;
494
631
  name: string;
495
632
  };
633
+ nodeId?: string | undefined;
496
634
  }>]>, "many">, (LayoutVariationNode | SimpleContentNodes | DeveloperDefinedLayoutNode)[], ({
497
635
  value: string;
498
636
  type: "text";
637
+ nodeId?: string | undefined;
499
638
  } | {
500
639
  type: "tag";
501
640
  tag: string;
641
+ nodeId?: string | undefined;
502
642
  attributes?: Record<string, string> | undefined;
503
643
  font?: {
504
644
  bold?: boolean | undefined;
@@ -513,11 +653,13 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
513
653
  } | undefined;
514
654
  } | {
515
655
  type: "fragment";
656
+ nodeId?: string | undefined;
516
657
  } | {
517
658
  type: "link-to-matrix-asset";
518
659
  matrixDomain: string;
519
660
  matrixAssetId: string;
520
661
  target: "_blank" | "_self" | "_parent" | "_top";
662
+ nodeId?: string | undefined;
521
663
  attributes?: (Record<string, string> & {
522
664
  target?: undefined;
523
665
  href?: undefined;
@@ -526,10 +668,28 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
526
668
  alignment: "left" | "center" | "right" | "justify";
527
669
  } | undefined;
528
670
  matrixIdentifier?: string | undefined;
671
+ } | {
672
+ type: "link-to-dam-asset";
673
+ target: "_blank" | "_self" | "_parent" | "_top";
674
+ damSystemType: "bynder";
675
+ damSystemIdentifier: string;
676
+ damObjectId: string;
677
+ nodeId?: string | undefined;
678
+ attributes?: (Record<string, string> & {
679
+ target?: undefined;
680
+ href?: undefined;
681
+ }) | undefined;
682
+ formattingOptions?: {
683
+ alignment: "left" | "center" | "right" | "justify";
684
+ } | undefined;
685
+ damAdditional?: {
686
+ variant?: string | undefined;
687
+ } | undefined;
529
688
  } | {
530
689
  type: "matrix-image";
531
690
  matrixDomain: string;
532
691
  matrixAssetId: string;
692
+ nodeId?: string | undefined;
533
693
  attributes?: (Record<string, string> & {
534
694
  src?: undefined;
535
695
  }) | undefined;
@@ -542,6 +702,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
542
702
  damSystemType: "bynder";
543
703
  damSystemIdentifier: string;
544
704
  damObjectId: string;
705
+ nodeId?: string | undefined;
545
706
  attributes?: (Record<string, string> & {
546
707
  src?: undefined;
547
708
  }) | undefined;
@@ -555,6 +716,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
555
716
  type: "component";
556
717
  componentId: string;
557
718
  componentSet: string;
719
+ nodeId?: string | undefined;
558
720
  componentType?: "server" | "edge" | undefined;
559
721
  contentItem?: {
560
722
  id: string;
@@ -565,6 +727,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
565
727
  } | {
566
728
  type: "variation";
567
729
  default: {};
730
+ nodeId?: string | undefined;
568
731
  } | {
569
732
  type: "layout";
570
733
  layout: {
@@ -590,6 +753,7 @@ export declare const PageLayoutContent: z.ZodEffects<z.ZodArray<z.ZodUnion<[z.Zo
590
753
  }>;
591
754
  name: string;
592
755
  };
756
+ nodeId?: string | undefined;
593
757
  })[]>;
594
758
  export type PageLayoutContent = z.infer<typeof PageLayoutContent>;
595
759
  export type NodeResolver = (node: LayoutContentNodes) => Promise<LayoutContentNodes | void>;
@@ -14,13 +14,14 @@ const BaseLayoutContentNodes = zod_1.z.discriminatedUnion('type', [
14
14
  formatted_text_1.TagNode,
15
15
  formatted_text_1.FragmentNode,
16
16
  formatted_text_1.LinkToMatrixAssetNode,
17
+ formatted_text_1.LinkToDamAssetNode,
17
18
  formatted_text_1.MatrixImageNode,
18
19
  formatted_text_1.DamImageNode,
19
20
  ]);
20
21
  /**
21
22
  * All the nodes which allow children
22
23
  */
23
- const NODES_WITH_CHILDREN = ['tag', 'fragment', 'link-to-matrix-asset'];
24
+ const NODES_WITH_CHILDREN = ['tag', 'fragment', 'link-to-matrix-asset', 'link-to-dam-asset'];
24
25
  exports.LayoutVariationNode = formatted_text_1.VariationNode.extend({
25
26
  default: zod_1.z.object({
26
27
  node: zod_1.z.lazy(() => exports.LayoutContentNodes).nullable(),
@@ -1 +1 @@
1
- {"version":3,"file":"layout-content.js","sourceRoot":"","sources":["../src/layout-content.ts"],"names":[],"mappings":";;;AAwHA,wCAGC;AA3HD,6BAAwB;AACxB,qDAW0B;AAC1B,2CAA8E;AAOjE,QAAA,0BAA0B,GAInC,2BAAU,CAAC,MAAM,CAAC;IACpB,OAAO,EAAE,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,yBAAiB,CAAC,CAAC;CAC/D,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,OAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC1D,8BAAa;IACb,yBAAQ;IACR,wBAAO;IACP,6BAAY;IACZ,sCAAqB;IACrB,gCAAe;IACf,6BAAY;CACb,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,sBAAsB,CAAU,CAAC;AAgBpE,QAAA,mBAAmB,GAI5B,8BAAa,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;QAChB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,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;QACzE,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,EAAE,CAAC;YAC1D,MAAM,IAAI,KAAK,CACb,MAAM;iBACH,MAAM,CAAC,CAAC,MAAM,EAAmC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC;iBACjF,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;iBACpB,IAAI,CAAC,GAAG,CAAC,CACb,CAAC;QACJ,CAAC;QACD,OAAO,MAAM;aACV,MAAM,CAAC,CAAC,MAAM,EAAwD,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;aACvG,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aACzC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAA2B,CAAC,CAAC;IACzD,CAAC;CACF;AAvCD,8DAuCC"}
@@ -34,15 +34,17 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const l = __importStar(require("./layout-content"));
37
+ const crypto_1 = require("crypto");
37
38
  describe('layout-content', () => {
38
39
  describe('experiment nodes', () => {
39
40
  it('only allows a single experiment ID', () => {
40
41
  const experiment = {
41
42
  type: 'variation',
42
- default: { node: { type: 'text', value: 'default' } },
43
+ nodeId: (0, crypto_1.randomUUID)(),
44
+ default: { node: { type: 'text', value: 'default', nodeId: (0, crypto_1.randomUUID)() } },
43
45
  variants: [
44
46
  {
45
- node: { type: 'text', value: 'my-a-value' },
47
+ node: { type: 'text', value: 'my-a-value', nodeId: (0, crypto_1.randomUUID)() },
46
48
  conditions: { experiment: { id: 'experiment-id', variant: 'B' } },
47
49
  },
48
50
  ],
@@ -61,18 +63,24 @@ describe('layout-content', () => {
61
63
  it('only allows a single experiment ID in nested experiment blocks', () => {
62
64
  const experiment = {
63
65
  type: 'variation',
66
+ nodeId: (0, crypto_1.randomUUID)(),
64
67
  default: {
65
- node: { type: 'text', value: 'experiment' },
68
+ node: { type: 'text', value: 'experiment', nodeId: (0, crypto_1.randomUUID)() },
66
69
  },
67
70
  variants: [
68
71
  {
69
72
  conditions: { experiment: { id: '123', variant: 'B' } },
70
- node: { type: 'text', value: 'experiment' },
73
+ node: {
74
+ type: 'text',
75
+ value: 'experiment',
76
+ nodeId: (0, crypto_1.randomUUID)(),
77
+ },
71
78
  },
72
79
  ],
73
80
  };
74
81
  const variant = {
75
82
  type: 'variation',
83
+ nodeId: (0, crypto_1.randomUUID)(),
76
84
  default: {
77
85
  node: experiment,
78
86
  },
@@ -88,13 +96,14 @@ describe('layout-content', () => {
88
96
  it('allows multiple nodes with the same experiment', () => {
89
97
  const experiment = {
90
98
  type: 'variation',
99
+ nodeId: (0, crypto_1.randomUUID)(),
91
100
  default: {
92
- node: { type: 'text', value: 'experiment' },
101
+ node: { type: 'text', value: 'experiment', nodeId: (0, crypto_1.randomUUID)() },
93
102
  },
94
103
  variants: [
95
104
  {
96
105
  conditions: { experiment: { id: '123', variant: 'B' } },
97
- node: { type: 'text', value: 'experiment' },
106
+ node: { type: 'text', value: 'experiment', nodeId: (0, crypto_1.randomUUID)() },
98
107
  },
99
108
  ],
100
109
  };
@@ -103,6 +112,7 @@ describe('layout-content', () => {
103
112
  default: {
104
113
  node: experiment,
105
114
  },
115
+ nodeId: (0, crypto_1.randomUUID)(),
106
116
  variants: [
107
117
  {
108
118
  conditions: { experiment: { id: '123', variant: 'B' } },
@@ -118,12 +128,14 @@ describe('layout-content', () => {
118
128
  const experiment = {
119
129
  type: 'text',
120
130
  value: 'other',
131
+ nodeId: (0, crypto_1.randomUUID)(),
121
132
  };
122
133
  const variant = {
123
134
  type: 'variation',
124
135
  default: {
125
136
  node: experiment,
126
137
  },
138
+ nodeId: (0, crypto_1.randomUUID)(),
127
139
  variants: [
128
140
  {
129
141
  conditions: { segment: { code: '123' } },
@@ -1 +1 @@
1
- {"version":3,"file":"layout-content.spec.js","sourceRoot":"","sources":["../src/layout-content.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,UAAU,GAA0B;gBACxC,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;gBACrD,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE;wBAC3C,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;qBAClE;iBACF;aACF,CAAC;YAEF,MAAM,eAAe,GAAG;gBACtB,GAAG,UAAU;gBACb,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE;wBAC3C,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;qBACjE;iBACF;aACF,CAAC;YAEF,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAC5E,kDAAkD,CACnD,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gE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