@remkoj/optimizely-cms-react 6.0.0-pre9 → 6.0.0-rc.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.
Files changed (37) hide show
  1. package/README.md +3 -4
  2. package/dist/components/cms-content/get-content-type.js +1 -1
  3. package/dist/components/cms-content/get-content-type.js.map +1 -1
  4. package/dist/components/cms-content/get-content.js +1 -1
  5. package/dist/components/cms-content/get-content.js.map +1 -1
  6. package/dist/components/cms-content/resolve-component.js +3 -9
  7. package/dist/components/cms-content/resolve-component.js.map +1 -1
  8. package/dist/components/cms-content/types.d.ts +38 -2
  9. package/dist/components/cms-content-area/types.d.ts +51 -10
  10. package/dist/components/cms-editable/index.d.ts +82 -19
  11. package/dist/components/cms-editable/index.js +10 -6
  12. package/dist/components/cms-editable/index.js.map +1 -1
  13. package/dist/components/rich-text/index.d.ts +2 -1
  14. package/dist/components/rich-text/index.js +6 -3
  15. package/dist/components/rich-text/index.js.map +1 -1
  16. package/dist/components/rsc-components.d.ts +154 -5
  17. package/dist/components/rsc-components.js +153 -5
  18. package/dist/components/rsc-components.js.map +1 -1
  19. package/dist/components/visual-builder/functions.js +7 -14
  20. package/dist/components/visual-builder/functions.js.map +1 -1
  21. package/dist/components/visual-builder/index.d.ts +3 -1
  22. package/dist/components/visual-builder/index.js +15 -16
  23. package/dist/components/visual-builder/index.js.map +1 -1
  24. package/dist/factory/default.d.ts +20 -3
  25. package/dist/factory/default.js +43 -24
  26. package/dist/factory/default.js.map +1 -1
  27. package/dist/factory/types.d.ts +24 -4
  28. package/dist/factory/undef.d.ts +7 -5
  29. package/dist/factory/undef.js +10 -4
  30. package/dist/factory/undef.js.map +1 -1
  31. package/dist/rsc.d.ts +24 -0
  32. package/dist/rsc.js +24 -0
  33. package/dist/rsc.js.map +1 -1
  34. package/dist/utilities.d.ts +2 -2
  35. package/dist/utilities.js +12 -7
  36. package/dist/utilities.js.map +1 -1
  37. package/package.json +12 -12
@@ -4,18 +4,167 @@ import { type CmsContentComponent } from './cms-content/rsc.js';
4
4
  import { type OptimizelyCompositionComponent } from './visual-builder/index.js';
5
5
  import { type RichTextComponent } from './rich-text/index.js';
6
6
  /**
7
- * Client side Optimizely CMS Editable
7
+ * Optimizely CMS editable marker wrapper for React Server Components.
8
+ *
9
+ * `CmsEditable` renders an element (default `div`) and conditionally injects
10
+ * Optimizely edit-mode attributes (`data-epi-*`) based on the current CMS
11
+ * context. In non-edit mode it behaves like a transparent wrapper.
12
+ *
13
+ * Key behavior:
14
+ * - Uses `ctx` from props when provided, otherwise resolves server context.
15
+ * - Injects edit attributes only when rendering in edit mode.
16
+ * - Supports custom wrapper elements/components via `as`.
17
+ * - Can forward `ctx` to custom components via `forwardCtx`.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * import { CmsEditable } from '@remkoj/optimizely-cms-react/rsc'
22
+ *
23
+ * export function PageTitle({ title, id }: { title: string, id: string }) {
24
+ * return (
25
+ * <CmsEditable as="h1" cmsId={id} cmsFieldName="Title">
26
+ * {title}
27
+ * </CmsEditable>
28
+ * )
29
+ * }
30
+ * ```
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * import { CmsEditable } from '@remkoj/optimizely-cms-react/rsc'
35
+ *
36
+ * function Heading(props: { children: React.ReactNode, cmsCtx?: unknown }) {
37
+ * return <h2>{props.children}</h2>
38
+ * }
39
+ *
40
+ * export function Teaser({ id, title }: { id: string, title: string }) {
41
+ * return (
42
+ * <CmsEditable
43
+ * as={Heading}
44
+ * cmsId={id}
45
+ * cmsFieldName="Heading"
46
+ * forwardCtx="cmsCtx"
47
+ * >
48
+ * {title}
49
+ * </CmsEditable>
50
+ * )
51
+ * }
52
+ * ```
53
+ *
54
+ * @remarks
55
+ * For a full prop reference, see `CmsEditableProps`.
8
56
  */
9
57
  export declare const CmsEditable: CmsEditableComponent;
58
+ export type { CmsEditableComponent, CmsEditableProps } from './cms-editable/index.js';
10
59
  /**
11
- * Client side Optimizely CMS Content, leveraging the CMS Context to load the
12
- * content type and content data when needed
60
+ * Optimizely CMS content renderer for React Server Components.
61
+ *
62
+ * `CmsContent` resolves the component template for a content item and provides
63
+ * that template with loaded data and edit metadata.
64
+ *
65
+ * Key behavior:
66
+ * - Resolves content type from `contentType`, `fragmentData`, or Graph lookup.
67
+ * - Resolves template using context component dictionary and optional
68
+ * `contentTypePrefix` / `variant`.
69
+ * - Loads content data unless `noDataLoad` is set.
70
+ * - Passes `editProps` to resolved CMS templates for in-context editing.
71
+ *
72
+ * Required props:
73
+ * - `contentLink`
74
+ *
75
+ * Optional props:
76
+ * - `contentType`, `contentTypePrefix`, `variant`, `fragmentData`, `layoutProps`,
77
+ * `noDataLoad`, `editorComponentId`, `ctx`
78
+ *
79
+ * @example
80
+ * ```tsx
81
+ * import { CmsContent } from '@remkoj/optimizely-cms-react/rsc'
82
+ *
83
+ * export default async function Slot({ contentLink }: { contentLink: { key: string, locale?: string } }) {
84
+ * return (
85
+ * <CmsContent
86
+ * contentLink={contentLink}
87
+ * contentTypePrefix="Page"
88
+ * variant="default"
89
+ * />
90
+ * )
91
+ * }
92
+ * ```
93
+ *
94
+ * @example
95
+ * ```tsx
96
+ * import { CmsContent } from '@remkoj/optimizely-cms-react/rsc'
97
+ *
98
+ * export function PreloadedBlock({ contentLink, fragmentData }: { contentLink: { key: string }, fragmentData: Record<string, any> }) {
99
+ * return (
100
+ * <CmsContent
101
+ * contentLink={contentLink}
102
+ * fragmentData={fragmentData}
103
+ * contentType={["Component", "TeaserBlock"]}
104
+ * />
105
+ * )
106
+ * }
107
+ * ```
108
+ *
109
+ * @remarks
110
+ * For a full prop reference, see `CmsContentProps`.
13
111
  */
14
112
  export declare const CmsContent: CmsContentComponent;
15
113
  export type { CmsContentComponent, CmsContentProps } from './cms-content/rsc.js';
16
114
  /**
17
- * Client side Optimizely CMS Content Area, leveraging the CMS Context to infer
18
- * the connection to Optimizely Graph and component dictionary.
115
+ * Optimizely CMS Content Area renderer for React Server Components.
116
+ *
117
+ * `CmsContentArea` renders a list of content area items by delegating each item
118
+ * to `CmsContent`, with optional container and item-wrapper customization.
119
+ *
120
+ * Key behavior:
121
+ * - Renders each item as `CmsContent` with normalized content link and type.
122
+ * - Adds edit markers for the content area in edit mode when `fieldName` is set.
123
+ * - Supports optional wrappers (`as`, `itemWrapper`) or no wrappers.
124
+ * - Supports per-item suspense boundaries (`useSuspense`, `fallback`).
125
+ *
126
+ * Required props:
127
+ * - `items`
128
+ *
129
+ * Optional props:
130
+ * - `fieldName`, `variant`, `as`, `itemsProperty`, `className`, `classMapper`,
131
+ * `itemWrapper`, `noWrapper`, `useSuspense`, `fallback`, `ctx`
132
+ *
133
+ * @example
134
+ * ```tsx
135
+ * import { CmsContentArea } from '@remkoj/optimizely-cms-react/rsc'
136
+ *
137
+ * export function MainArea({ items }: { items: any[] }) {
138
+ * return (
139
+ * <CmsContentArea
140
+ * items={items}
141
+ * fieldName="MainContentArea"
142
+ * as="section"
143
+ * className="main-content-area"
144
+ * />
145
+ * )
146
+ * }
147
+ * ```
148
+ *
149
+ * @example
150
+ * ```tsx
151
+ * import { CmsContentArea } from '@remkoj/optimizely-cms-react/rsc'
152
+ *
153
+ * export function GridArea({ items }: { items: any[] }) {
154
+ * return (
155
+ * <CmsContentArea
156
+ * items={items}
157
+ * itemWrapper={{ as: 'article', className: 'grid-item' }}
158
+ * classMapper={(displayOption) => `display-${displayOption}`}
159
+ * useSuspense
160
+ * fallback={<div>Loading component…</div>}
161
+ * />
162
+ * )
163
+ * }
164
+ * ```
165
+ *
166
+ * @remarks
167
+ * For a full prop reference, see `CmsContentAreaProps`.
19
168
  */
20
169
  export declare const CmsContentArea: CmsContentAreaComponent;
21
170
  export type { CmsContentAreaClassMapper, CmsContentAreaComponent, CmsContentAreaProps, ContentAreaItemDefinition, } from './cms-content-area/index.js';
@@ -27,17 +27,165 @@ function serverContextAware(component) {
27
27
  return ServerContextInjector;
28
28
  }
29
29
  /**
30
- * Client side Optimizely CMS Editable
30
+ * Optimizely CMS editable marker wrapper for React Server Components.
31
+ *
32
+ * `CmsEditable` renders an element (default `div`) and conditionally injects
33
+ * Optimizely edit-mode attributes (`data-epi-*`) based on the current CMS
34
+ * context. In non-edit mode it behaves like a transparent wrapper.
35
+ *
36
+ * Key behavior:
37
+ * - Uses `ctx` from props when provided, otherwise resolves server context.
38
+ * - Injects edit attributes only when rendering in edit mode.
39
+ * - Supports custom wrapper elements/components via `as`.
40
+ * - Can forward `ctx` to custom components via `forwardCtx`.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * import { CmsEditable } from '@remkoj/optimizely-cms-react/rsc'
45
+ *
46
+ * export function PageTitle({ title, id }: { title: string, id: string }) {
47
+ * return (
48
+ * <CmsEditable as="h1" cmsId={id} cmsFieldName="Title">
49
+ * {title}
50
+ * </CmsEditable>
51
+ * )
52
+ * }
53
+ * ```
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * import { CmsEditable } from '@remkoj/optimizely-cms-react/rsc'
58
+ *
59
+ * function Heading(props: { children: React.ReactNode, cmsCtx?: unknown }) {
60
+ * return <h2>{props.children}</h2>
61
+ * }
62
+ *
63
+ * export function Teaser({ id, title }: { id: string, title: string }) {
64
+ * return (
65
+ * <CmsEditable
66
+ * as={Heading}
67
+ * cmsId={id}
68
+ * cmsFieldName="Heading"
69
+ * forwardCtx="cmsCtx"
70
+ * >
71
+ * {title}
72
+ * </CmsEditable>
73
+ * )
74
+ * }
75
+ * ```
76
+ *
77
+ * @remarks
78
+ * For a full prop reference, see `CmsEditableProps`.
31
79
  */
32
80
  export const CmsEditable = serverContextAware(BaseEditable);
33
81
  /**
34
- * Client side Optimizely CMS Content, leveraging the CMS Context to load the
35
- * content type and content data when needed
82
+ * Optimizely CMS content renderer for React Server Components.
83
+ *
84
+ * `CmsContent` resolves the component template for a content item and provides
85
+ * that template with loaded data and edit metadata.
86
+ *
87
+ * Key behavior:
88
+ * - Resolves content type from `contentType`, `fragmentData`, or Graph lookup.
89
+ * - Resolves template using context component dictionary and optional
90
+ * `contentTypePrefix` / `variant`.
91
+ * - Loads content data unless `noDataLoad` is set.
92
+ * - Passes `editProps` to resolved CMS templates for in-context editing.
93
+ *
94
+ * Required props:
95
+ * - `contentLink`
96
+ *
97
+ * Optional props:
98
+ * - `contentType`, `contentTypePrefix`, `variant`, `fragmentData`, `layoutProps`,
99
+ * `noDataLoad`, `editorComponentId`, `ctx`
100
+ *
101
+ * @example
102
+ * ```tsx
103
+ * import { CmsContent } from '@remkoj/optimizely-cms-react/rsc'
104
+ *
105
+ * export default async function Slot({ contentLink }: { contentLink: { key: string, locale?: string } }) {
106
+ * return (
107
+ * <CmsContent
108
+ * contentLink={contentLink}
109
+ * contentTypePrefix="Page"
110
+ * variant="default"
111
+ * />
112
+ * )
113
+ * }
114
+ * ```
115
+ *
116
+ * @example
117
+ * ```tsx
118
+ * import { CmsContent } from '@remkoj/optimizely-cms-react/rsc'
119
+ *
120
+ * export function PreloadedBlock({ contentLink, fragmentData }: { contentLink: { key: string }, fragmentData: Record<string, any> }) {
121
+ * return (
122
+ * <CmsContent
123
+ * contentLink={contentLink}
124
+ * fragmentData={fragmentData}
125
+ * contentType={["Component", "TeaserBlock"]}
126
+ * />
127
+ * )
128
+ * }
129
+ * ```
130
+ *
131
+ * @remarks
132
+ * For a full prop reference, see `CmsContentProps`.
36
133
  */
37
134
  export const CmsContent = serverContextAware(BaseCmsContent);
38
135
  /**
39
- * Client side Optimizely CMS Content Area, leveraging the CMS Context to infer
40
- * the connection to Optimizely Graph and component dictionary.
136
+ * Optimizely CMS Content Area renderer for React Server Components.
137
+ *
138
+ * `CmsContentArea` renders a list of content area items by delegating each item
139
+ * to `CmsContent`, with optional container and item-wrapper customization.
140
+ *
141
+ * Key behavior:
142
+ * - Renders each item as `CmsContent` with normalized content link and type.
143
+ * - Adds edit markers for the content area in edit mode when `fieldName` is set.
144
+ * - Supports optional wrappers (`as`, `itemWrapper`) or no wrappers.
145
+ * - Supports per-item suspense boundaries (`useSuspense`, `fallback`).
146
+ *
147
+ * Required props:
148
+ * - `items`
149
+ *
150
+ * Optional props:
151
+ * - `fieldName`, `variant`, `as`, `itemsProperty`, `className`, `classMapper`,
152
+ * `itemWrapper`, `noWrapper`, `useSuspense`, `fallback`, `ctx`
153
+ *
154
+ * @example
155
+ * ```tsx
156
+ * import { CmsContentArea } from '@remkoj/optimizely-cms-react/rsc'
157
+ *
158
+ * export function MainArea({ items }: { items: any[] }) {
159
+ * return (
160
+ * <CmsContentArea
161
+ * items={items}
162
+ * fieldName="MainContentArea"
163
+ * as="section"
164
+ * className="main-content-area"
165
+ * />
166
+ * )
167
+ * }
168
+ * ```
169
+ *
170
+ * @example
171
+ * ```tsx
172
+ * import { CmsContentArea } from '@remkoj/optimizely-cms-react/rsc'
173
+ *
174
+ * export function GridArea({ items }: { items: any[] }) {
175
+ * return (
176
+ * <CmsContentArea
177
+ * items={items}
178
+ * itemWrapper={{ as: 'article', className: 'grid-item' }}
179
+ * classMapper={(displayOption) => `display-${displayOption}`}
180
+ * useSuspense
181
+ * fallback={<div>Loading component…</div>}
182
+ * />
183
+ * )
184
+ * }
185
+ * ```
186
+ *
187
+ * @remarks
188
+ * For a full prop reference, see `CmsContentAreaProps`.
41
189
  */
42
190
  export const CmsContentArea = cmsContentAware(serverContextAware(BaseContentArea), CmsContent);
43
191
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"rsc-components.js","sourceRoot":"","sources":["../../src/components/rsc-components.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAMZ,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EACL,cAAc,IAAI,eAAe,GAElC,MAAM,6BAA6B,CAAA,CAAC,4BAA4B;AACjE,OAAO,EACL,WAAW,IAAI,YAAY,GAE5B,MAAM,yBAAyB,CAAA,CAAC,4BAA4B;AAC7D,OAAO,EACL,UAAU,IAAI,cAAc,GAG7B,M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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAC3C,YAAY,CACW,CAAA;AAGzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAC1C,cAAoD,CAC9B,CAAA;AAGxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAC3C,kBAAkB,CAAC,eAAe,CAAC,EACnC,UAAU,CACgB,CAAA;AAQ5B;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAClD,kBAAkB,CAAC,yBAAyB,CAAC,EAC7C,UAAU,CACuB,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,YAAY,CAAsB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { isContentType } from '../../utilities.js';
1
+ import { isContentType, isNotNullOrUndefined } from '../../utilities.js';
2
2
  import { isContentLink, isInlineContentLink } from '@remkoj/optimizely-graph-client';
3
3
  /**
4
4
  * Test if the Node within VisualBuilder is an Element
@@ -63,20 +63,13 @@ export const defaultPropsFactory = (node) => {
63
63
  return [contentLink, contentType, node.key || undefined, node.component, layoutData];
64
64
  };
65
65
  export const defaultNodePropsFactory = (node) => {
66
+ const componentMainName = node.type ? (node.layoutType === 'experience' ? node.type + "Node" : node.type) : undefined;
66
67
  const componentTypes = [
67
- // New style logic
68
- node.template && [node.template, ucFirst(node.type), ucFirst(node.layoutType), "Content"].filter(x => x),
69
- [ucFirst(node.type), ucFirst(node.layoutType), "Content"].filter(x => x),
70
- node.template && [node.template, ucFirst(node.layoutType), "Content"].filter(x => x),
71
- node.template && [node.template, "Styles", ucFirst(node.layoutType), "Content"].filter(x => x),
72
- node.template && [node.template, ucFirst(node.layoutType), "Nodes", "Content"].filter(x => x),
73
- // Old style logic
74
- [node.template, ucFirst(node.type), ucFirst(node.layoutType), "Component", "Content"].filter(x => x),
75
- (node.template && node.type) ? [node.type ? ucFirst(node.type) : null, ucFirst(node.layoutType), "Component", "Content"].filter(x => x) : null,
76
- // Fallback
77
- ["Node", "Content"],
78
- ["Node", "Component", "Content"]
79
- ].filter(x => x);
68
+ componentMainName ? [componentMainName] : undefined,
69
+ node.template ? [node.template] : undefined,
70
+ [ucFirst(node.layoutType) + 'Node'],
71
+ ['Node']
72
+ ].filter(isNotNullOrUndefined);
80
73
  const contentLink = { key: node.key ?? '', isInline: true };
81
74
  const componentData = { __name: node.name, ...node.component };
82
75
  const layoutData = {
@@ -1 +1 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/components/visual-builder/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAyB,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAG3G;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAA0C;IACtE,OAAO,eAAe,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAA0C;IACxE,OAAO,IAAI,CAAC,UAAU,IAAI,WAAW,CAAA;AACvC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAiC,IAA0C,EAAE,IAA+C;IAC/J,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;QACxB,OAAO,KAAK,CAAA;IACd,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAC7B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAA0C;IACxE,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,MAA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returns The
9
9
  */
10
- export declare function OptimizelyComposition({ node, leafPropsFactory, nodePropsFactory, ctx, cmsContent: CmsContent, }: BaseOptimizelyCompositionProps): ReactNode;
10
+ export declare function OptimizelyComposition({ node, leafPropsFactory, nodePropsFactory, ctx, cmsContent: CmsContent, isMaster }: BaseOptimizelyCompositionProps & {
11
+ isMaster: boolean;
12
+ }): ReactNode;
11
13
  export default OptimizelyComposition;
@@ -1,40 +1,39 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { isComponentNode, defaultNodePropsFactory, defaultPropsFactory, } from './functions.js';
2
+ import { isComponentNode, isStructureNode, defaultNodePropsFactory, defaultPropsFactory, } from './functions.js';
3
3
  /**
4
4
  * Render the composition as made available through Optimizely Graph for Visual Builder
5
5
  *
6
6
  * @param param0
7
7
  * @returns The
8
8
  */
9
- export function OptimizelyComposition({ node, leafPropsFactory = defaultPropsFactory, nodePropsFactory = defaultNodePropsFactory, ctx, cmsContent: CmsContent, }) {
10
- const { factory, isDebug } = ctx;
9
+ export function OptimizelyComposition({ node, leafPropsFactory = defaultPropsFactory, nodePropsFactory = defaultNodePropsFactory, ctx, cmsContent: CmsContent, isMaster = true }) {
10
+ const { factory } = ctx;
11
+ // If this is the master composition and the node is a structure node with children, render
12
+ // the children directly to avoid unnecessary nesting
13
+ if (isMaster && isStructureNode(node) && Array.isArray(node.nodes) && node.nodes.length > 0) {
14
+ return node.nodes.map((child) => {
15
+ const childKey = child.key ? child.key : `vb::${JSON.stringify(child)}`;
16
+ return (_jsx(OptimizelyComposition, { node: child, leafPropsFactory: leafPropsFactory, nodePropsFactory: nodePropsFactory, ctx: ctx, cmsContent: CmsContent, isMaster: false }, childKey));
17
+ });
18
+ }
11
19
  // Render the element
12
20
  if (isComponentNode(node)) {
13
- /*if (isDebug)
14
- console.log(
15
- `⚪ [VisualBuilder] Rendering element node ${JSON.stringify(node)}`
16
- )*/
17
21
  const [contentLink, contentType, nodeId, fragmentData, layoutProps] = leafPropsFactory(node);
18
22
  return (_jsx(CmsContent, { contentLink: contentLink, contentType: contentType, fragmentData: fragmentData, layoutProps: layoutProps, editorComponentId: nodeId || contentLink.key || undefined, ctx: ctx }));
19
23
  }
20
- // Debug
21
- /*if (isDebug)
22
- console.log(
23
- `⚪ [VisualBuilder] Rendering structure node ${JSON.stringify(node)}`
24
- )*/
25
24
  // Ensure we've got a factory
26
25
  if (!factory)
27
- throw new Error('🟡 [VisualBuilder] [OptimizelyComposition] The factory must be defined within the serverContext');
26
+ throw new Error('🟡 [VisualBuilder] [OptimizelyComposition] The factory must be defined within the Context');
28
27
  const [contentLink, contentTypes, nodeId, fragmentData, layoutProps] = nodePropsFactory(node);
29
28
  const firstExistingType = contentTypes
30
- .map((ct) => factory.has([...ct].reverse()))
29
+ .map((ct) => factory.has(Array.isArray(ct) ? [...ct].reverse() : ct))
31
30
  .indexOf(true);
32
31
  const contentType = contentTypes[firstExistingType];
33
32
  if (!contentType)
34
- throw new Error(`🟡 [VisualBuilder] [OptimizelyComposition] The factory must have a definition for one of these types: ${contentTypes.map((x) => x.join('/')).join(', ')}`);
33
+ throw new Error(`🟡 [VisualBuilder] [OptimizelyComposition] The factory must have a definition for one of these types: ${contentTypes.map((x) => Array.isArray(x) ? x.join('/') : x).join(', ')}`);
35
34
  return (_jsx(CmsContent, { contentType: contentType, contentLink: contentLink, fragmentData: fragmentData, layoutProps: layoutProps, editorComponentId: nodeId || contentLink.key || undefined, noDataLoad: true, ctx: ctx, children: (node.nodes ?? []).map((child) => {
36
35
  const childKey = child.key ? child.key : `vb::${JSON.stringify(child)}`;
37
- return (_jsx(OptimizelyComposition, { node: child, leafPropsFactory: leafPropsFactory, nodePropsFactory: nodePropsFactory, ctx: ctx, cmsContent: CmsContent }, childKey));
36
+ return (_jsx(OptimizelyComposition, { node: child, leafPropsFactory: leafPropsFactory, nodePropsFactory: nodePropsFactory, ctx: ctx, cmsContent: CmsContent, isMaster: false }, childKey));
38
37
  }) }));
39
38
  }
40
39
  export default OptimizelyComposition;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/visual-builder/index.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,gBAAgB,CAAA;AAIvB;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,IAAI,EACJ,gBAAgB,GAAG,mBAAmB,EACtC,gBAAgB,GAAG,uBAAuB,EAC1C,GAAG,EACH,UAAU,EAAE,UAAU,GACS;IAC/B,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAAA;IAEhC,qBAAqB;IACrB,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B;;;aAGK;QACL,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,GACjE,gBAAgB,CAAC,IAAI,CAAC,CAAA;QACxB,OAAO,CACL,KAAC,UAAU,IACT,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,MAAM,IAAI,WAAW,CAAC,GAAG,IAAI,SAAS,EACzD,GAAG,EAAE,GAAG,GACR,CACH,CAAA;IACH,CAAC;IAED,QAAQ;IACR;;;SAGK;IAEL,6BAA6B;IAC7B,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAA;IAEH,MAAM,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,GAClE,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACxB,MAAM,iBAAiB,GAAG,YAAY;SACnC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;SAC3C,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB,MAAM,WAAW,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAA;IACnD,IAAI,CAAC,WAAW;QACd,MAAM,IAAI,KAAK,CACb,yGAAyG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3J,CAAA;IAEH,OAAO,CACL,KAAC,UAAU,IACT,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,MAAM,IAAI,WAAW,CAAC,GAAG,IAAI,SAAS,EACzD,UAAU,QACV,GAAG,EAAE,GAAG,YAEP,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAChC,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAA;YACvE,OAAO,CACL,KAAC,qBAAqB,IAEpB,IAAI,EAAE,KAAK,EACX,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,IALjB,QAAQ,CAMb,CACH,CAAA;QACH,CAAC,CAAC,GACS,CACd,CAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/visual-builder/index.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,gBAAgB,CAAA;AAIvB;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,IAAI,EACJ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G,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAA;YACvE,OAAO,CACL,KAAC,qBAAqB,IAEpB,IAAI,EAAE,KAAK,EACX,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,KAAK,IANV,QAAQ,CAOb,CACH,CAAA;QACH,CAAC,CAAC,GACS,CACd,CAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAAA"}
@@ -8,6 +8,15 @@ export declare const EmptyComponentHandle = "$$fragment$$";
8
8
  export declare class DefaultComponentFactory implements ComponentFactory {
9
9
  private registry;
10
10
  private dbg;
11
+ /**
12
+ * A list of interfaces to ignore when resolving components. Adjust this
13
+ * list if you're experiencing issues with resolving components due to
14
+ * contracts. Values **must be** provided lowercase and without leading
15
+ * underscore. For example `_Item` must be provided as `item`.
16
+ *
17
+ * The default value includes the common ones for SaaS CMS.
18
+ */
19
+ ignoredContracts: string[];
11
20
  /**
12
21
  * Create a new instance of the DefaultComponentFactory
13
22
  *
@@ -15,10 +24,18 @@ export declare class DefaultComponentFactory implements ComponentFactory {
15
24
  * with the factory.
16
25
  */
17
26
  constructor(initialComponents?: ComponentTypeDictionary);
18
- register(type: ComponentTypeHandle, component: ComponentType, useSuspense?: boolean, loader?: ComponentType): void;
27
+ register(type: ComponentTypeHandle, component: ComponentType, useSuspense?: boolean, loader?: ComponentType, variant?: string): void;
19
28
  registerAll(components: ComponentTypeDictionary): void;
20
- has(type: ComponentTypeHandle): boolean;
21
- resolve(type: ComponentTypeHandle): undefined | ComponentType;
29
+ has(type: ComponentTypeHandle, variant?: string): boolean;
30
+ resolve(type: ComponentTypeHandle, variant?: string): undefined | ComponentType;
22
31
  extract(): ComponentTypeDictionary;
23
32
  remove(type: ComponentTypeHandle): boolean;
33
+ /**
34
+ * Process the component variant handle into
35
+ *
36
+ * @param handle
37
+ * @param variant
38
+ * @returns
39
+ */
40
+ private processComponentTypeHandle;
24
41
  }
@@ -15,6 +15,15 @@ export class DefaultComponentFactory {
15
15
  */
16
16
  constructor(initialComponents) {
17
17
  this.registry = new Map();
18
+ /**
19
+ * A list of interfaces to ignore when resolving components. Adjust this
20
+ * list if you're experiencing issues with resolving components due to
21
+ * contracts. Values **must be** provided lowercase and without leading
22
+ * underscore. For example `_Item` must be provided as `item`.
23
+ *
24
+ * The default value includes the common ones for SaaS CMS.
25
+ */
26
+ this.ignoredContracts = ['item', 'assetitem', 'imageitem', 'content'];
18
27
  // Resolve debug mode
19
28
  try {
20
29
  this.dbg = process.env.OPTIMIZELY_DEBUG == '1';
@@ -26,26 +35,27 @@ export class DefaultComponentFactory {
26
35
  if (initialComponents)
27
36
  this.registerAll(initialComponents);
28
37
  }
29
- register(type, component, useSuspense = false, loader) {
30
- const registryKey = processComponentTypeHandle(type);
31
- this.registry.set(registryKey, { type, component, useSuspense, loader });
38
+ register(type, component, useSuspense = false, loader, variant = 'default') {
39
+ const registryKey = this.processComponentTypeHandle(type, variant);
40
+ if (this.dbg)
41
+ console.log(`➕ [DefaultComponentFactory] Registering ${registryKey}`);
42
+ this.registry.set(registryKey, { type: registryKey, component, useSuspense, loader, variant });
32
43
  }
33
44
  registerAll(components) {
34
- components.forEach((c) => {
35
- const registryKey = processComponentTypeHandle(c.type);
36
- this.registry.set(registryKey, c);
37
- });
45
+ components.forEach(c => this.register(c.type, c.component, c.useSuspense, c.loader, c.variant));
38
46
  }
39
- has(type) {
40
- const registryKey = processComponentTypeHandle(type);
47
+ has(type, variant = 'default') {
48
+ const registryKey = this.processComponentTypeHandle(type, variant);
49
+ if (this.dbg)
50
+ console.log(`🔎 [DefaultComponentFactory] Checking for ${registryKey} - ${this.registry.has(registryKey) ? 'YES' : 'NO'}`);
41
51
  return this.registry.has(registryKey);
42
52
  }
43
- resolve(type) {
44
- const registryKey = processComponentTypeHandle(type);
53
+ resolve(type, variant = 'default') {
54
+ const registryKey = this.processComponentTypeHandle(type, variant);
45
55
  const entry = this.registry.get(registryKey);
46
56
  if (!entry) {
47
57
  if (this.dbg)
48
- console.warn(`⚡ [DefaultComponentFactory] Unable to resolve ${registryKey}`);
58
+ console.warn(`❌ [DefaultComponentFactory] Unable to resolve ${registryKey}, this will prevent the item from rendering`);
49
59
  return undefined; // The key is not registered in the factory
50
60
  }
51
61
  if (entry.useSuspense != true)
@@ -64,23 +74,32 @@ export class DefaultComponentFactory {
64
74
  });
65
75
  }
66
76
  remove(type) {
67
- const registryKey = processComponentTypeHandle(type);
77
+ const registryKey = this.processComponentTypeHandle(type);
68
78
  if (this.dbg)
69
79
  console.log(`🔎 [DefaultComponentFactory] Removing ${registryKey}`);
70
80
  if (!this.registry.has(registryKey))
71
81
  return true;
72
82
  return this.registry.delete(registryKey);
73
83
  }
74
- }
75
- function processComponentTypeHandle(handle) {
76
- if (typeof handle == 'string')
77
- return handle == '' ? EmptyComponentHandle : handle;
78
- if (Array.isArray(handle) && handle.every((s) => typeof s == 'string'))
79
- return handle
80
- .map((s) => (s.startsWith('_') ? s.substring(1) : s)) // Remove all leading underscores
81
- .filter((s) => s.toLowerCase() != 'content') // Remove the "Content" base type
82
- .map((s) => (s == '' ? EmptyComponentHandle : s)) // Fall back to a fragment
83
- .join(MERGE_SYMBOL); // Types are processed as a string
84
- throw new Error(`Invalid component type handle: ${typeof handle}`);
84
+ /**
85
+ * Process the component variant handle into
86
+ *
87
+ * @param handle
88
+ * @param variant
89
+ * @returns
90
+ */
91
+ processComponentTypeHandle(handle, variant) {
92
+ let handleToProcess = typeof handle === 'string' ? handle.split(MERGE_SYMBOL) : [...handle];
93
+ if (Array.isArray(handleToProcess) && handleToProcess.every((s) => typeof s === 'string')) {
94
+ const offset = (['component', 'page', 'experience'].includes(handleToProcess.at(handleToProcess.length - 3)?.toLowerCase() ?? '') &&
95
+ !['row', 'column', 'section', 'experience', 'media'].includes(handleToProcess.at(handleToProcess.length - 2)?.toLowerCase() ?? '')) ? 1 : 0;
96
+ const typeName = handleToProcess.at(handleToProcess.length - (1 + offset));
97
+ const prefix = handleToProcess.at(handleToProcess.length - (2 + offset)) === 'RichText' ? 'RichText/' : '';
98
+ const actualVariant = offset > 0 ? handleToProcess.at(handleToProcess.length - 1) ?? variant ?? 'default' : variant ?? 'default';
99
+ const newHandle = prefix + typeName + '/' + actualVariant;
100
+ return newHandle;
101
+ }
102
+ throw new Error(`Invalid component type handle: ${typeof handle}`);
103
+ }
85
104
  }
86
105
  //# sourceMappingURL=default.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/factory/default.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;AAE/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAA;AAElD;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAIlC;;;;;OAKG;IACH,YAAmB,iBAA2C;QATtD,aAAQ,GAAG,IAAI,GAAG,EAAwC,CAAA;QAUhE,qBAAqB;QACrB,IAAI,CAAC;YACH,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAA;QAChD,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,GAAG,GAAG,KAAK,CAAA;QAClB,CAAC;QAED,kCAAkC;QAClC,IAAI,iBAAiB;YAAE,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAA;IAC5D,CAAC;IAED,QAAQ,CACN,IAAyB,EACzB,SAAwB,EACxB,cAAuB,KAAK,EAC5B,MAAsB;QAEtB,MAAM,WAAW,GAAG,0BAA0B,CAAC,IAAI,CAAC,CAAA;QACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,C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