@squiz/dxp-page-content-types 1.0.1 → 1.2.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.
@@ -6,11 +6,21 @@ import { FORMATTED_TEXT_MODELS } from '@squiz/dx-json-schema-lib';
6
6
  import { Conditions } from '../PageContent/PageContent';
7
7
  /**
8
8
  * Semi-resolved (referenced content items, not resolved Matrix references) formatted nodes union type.
9
- * TODO: new layout node
10
9
  */
11
10
  export type LayoutContentNodes = (Exclude<FORMATTED_TEXT_MODELS.v1.FormattedNodes, {
12
- type: 'component';
13
- }> | ComponentNode | VariationNode) & {
11
+ type: 'component' | 'fragment' | 'layout';
12
+ }> | FormattedTextFragmentNode | ComponentNode | VariationNode | LayoutNode) & {
13
+ nodeId?: string;
14
+ };
15
+ /**
16
+ * Formatted text fragment node with i18n support.
17
+ */
18
+ export type FormattedTextFragmentNode = Extract<FORMATTED_TEXT_MODELS.v1.FormattedNodes, {
19
+ type: 'fragment';
20
+ }> & {
21
+ i18n?: Record<string, {
22
+ children?: FORMATTED_TEXT_MODELS.v1.FormattedTextFragment['children'];
23
+ }>;
14
24
  nodeId?: string;
15
25
  };
16
26
  /**
@@ -37,6 +47,10 @@ export type ComponentNode<T extends ContentItemBody = ContentItemBody> = {
37
47
  * Content item referenced by the component node. Will be undefined if component does not have a content item.
38
48
  */
39
49
  contentItem?: ContentItem<T>;
50
+ /**
51
+ * Translated content item for each language
52
+ */
53
+ i18n?: Record<string, ContentItem<T>>;
40
54
  };
41
55
  /**
42
56
  * Variation node variant.
@@ -89,3 +103,35 @@ export type ContentItem<T extends ContentItemBody> = {
89
103
  */
90
104
  content?: T;
91
105
  };
106
+ export interface LayoutZone {
107
+ description: string;
108
+ displayName: string;
109
+ maxNodes: number;
110
+ minNodes: number;
111
+ }
112
+ export interface LayoutZones {
113
+ [zoneKey: string]: LayoutZone;
114
+ }
115
+ interface LayoutOption {
116
+ description: string;
117
+ displayName: string;
118
+ values: Array<string>;
119
+ }
120
+ interface LayoutOptions {
121
+ [key: string]: LayoutOption;
122
+ }
123
+ export interface LayoutData {
124
+ name: string;
125
+ description: string;
126
+ displayName: string;
127
+ version?: string;
128
+ template?: string;
129
+ zones?: LayoutZones;
130
+ options?: LayoutOptions;
131
+ }
132
+ export interface LayoutNode {
133
+ type: 'layout';
134
+ layout: LayoutData;
135
+ content: Record<string, LayoutContentNodes[]>;
136
+ }
137
+ export {};
@@ -36,6 +36,9 @@ export type RawLayout = {
36
36
  export type PageConfig = {
37
37
  pageExperimentId?: string;
38
38
  pageSegmentIds?: string[];
39
+ languages?: Record<string, {
40
+ fallbackToDefault?: boolean;
41
+ }>;
39
42
  };
40
43
  /**
41
44
  * Resolved page content.
@@ -3,6 +3,7 @@
3
3
  * Copyright Squiz Australia Pty Ltd. All Rights Reserved.
4
4
  */
5
5
  export declare const ZoneType: {
6
+ readonly layout: "layout";
6
7
  readonly page: "page";
7
8
  readonly 'template-locked': "template-locked";
8
9
  readonly 'template-unlocked': "template-unlocked";
@@ -6,6 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ZoneType = void 0;
8
8
  exports.ZoneType = {
9
+ layout: 'layout',
9
10
  page: 'page',
10
11
  'template-locked': 'template-locked',
11
12
  'template-unlocked': 'template-unlocked',
@@ -1 +1 @@
1
- {"version":3,"file":"Zones.js","sourceRoot":"","sources":["../../src/Zones/Zones.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,QAAQ,GAAG;IACtB,IAAI,EAAE,MAAM;IACZ,iBAAiB,EAAE,iBAAiB;IACpC,mBAAmB,EAAE,mBAAmB;CAChC,CAAC"}
1
+ {"version":3,"file":"Zones.js","sourceRoot":"","sources":["../../src/Zones/Zones.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,QAAQ,GAAG;IACtB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,iBAAiB,EAAE,iBAAiB;IACpC,mBAAmB,EAAE,mBAAmB;CAChC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/dxp-page-content-types",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "repository": {