@remkoj/optimizely-cms-react 6.0.0-pre9 → 6.0.0-rc.3
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/AGENTS.md +168 -0
- package/README.md +3 -4
- package/dist/components/client.js.map +1 -1
- package/dist/components/cms-content/get-content-type.js +1 -1
- package/dist/components/cms-content/get-content-type.js.map +1 -1
- package/dist/components/cms-content/get-content.js +1 -1
- package/dist/components/cms-content/get-content.js.map +1 -1
- package/dist/components/cms-content/resolve-component.js +3 -9
- package/dist/components/cms-content/resolve-component.js.map +1 -1
- package/dist/components/cms-content/resolve-content-type.js.map +1 -1
- package/dist/components/cms-content/types.d.ts +38 -2
- package/dist/components/cms-content-area/types.d.ts +51 -10
- package/dist/components/cms-editable/index.d.ts +82 -19
- package/dist/components/cms-editable/index.js +10 -6
- package/dist/components/cms-editable/index.js.map +1 -1
- package/dist/components/cms-styles/index.js.map +1 -1
- package/dist/components/rich-text/components.d.ts +1 -1
- package/dist/components/rich-text/index.d.ts +2 -1
- package/dist/components/rich-text/index.js +6 -3
- package/dist/components/rich-text/index.js.map +1 -1
- package/dist/components/rich-text/utils.js.map +1 -1
- package/dist/components/rsc-components.d.ts +154 -5
- package/dist/components/rsc-components.js +153 -5
- package/dist/components/rsc-components.js.map +1 -1
- package/dist/components/visual-builder/functions.js +7 -14
- package/dist/components/visual-builder/functions.js.map +1 -1
- package/dist/components/visual-builder/index.d.ts +3 -1
- package/dist/components/visual-builder/index.js +15 -16
- package/dist/components/visual-builder/index.js.map +1 -1
- package/dist/context/client.d.ts +12 -12
- package/dist/context/client.js +8 -0
- package/dist/context/client.js.map +1 -1
- package/dist/context/rsc.js +6 -1
- package/dist/context/rsc.js.map +1 -1
- package/dist/data/queries.js.map +1 -1
- package/dist/errors.js +1 -0
- package/dist/errors.js.map +1 -1
- package/dist/factory/default.d.ts +20 -3
- package/dist/factory/default.js +45 -25
- package/dist/factory/default.js.map +1 -1
- package/dist/factory/index.js.map +1 -1
- package/dist/factory/types.d.ts +24 -4
- package/dist/factory/undef.d.ts +7 -5
- package/dist/factory/undef.js +10 -4
- package/dist/factory/undef.js.map +1 -1
- package/dist/rsc-utilities.js.map +1 -1
- package/dist/rsc.d.ts +24 -0
- package/dist/rsc.js +24 -0
- package/dist/rsc.js.map +1 -1
- package/dist/utilities.d.ts +2 -2
- package/dist/utilities.js +12 -7
- package/dist/utilities.js.map +1 -1
- package/package.json +22 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/cms-editable/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/cms-editable/index.tsx"],"names":[],"mappings":";AAqJA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAA6B,CAAyB,EAC5E,GAAG,EACH,UAAU,GAAG,KAAK,EAClB,EAAE,EACF,KAAK,GAAG,IAAI,EACZ,YAAY,GAAG,IAAI,EACnB,QAAQ,EACR,GAAG,EACH,YAAY,GAAG,KAAK,EACpB,OAAO,GAAG,IAAI,EACd,cAAc,EACd,QAAQ,GAAG,IAAI,EACf,GAAG,KAAK,EAC+B,EAAE,EAAE;IAC3C,MAAM,EACJ,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,eAAe,EACf,2BAA2B,GAC5B,GAAG,GAAG,IAAI;QACT,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,IAAI;QACb,oBAAoB,EAAE,IAAI;QAC1B,2BAA2B,EAAE,KAAK;KACnC,CAAA;IACD,MAAM,cAAc,GAAG,EAAE,IAAI,KAAK,CAAA;IAElC,IAAI,oBAAoB,IAAI,UAAU,IAAI,CAAC,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC;QAClE,OAAO,CAAC,IAAI,CACV,4FAA4F,CAC7F,CAAA;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,CAAC,oBAAo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C,CAAC;YACA,GAAG,KAAK;SACT,CAAA;IAEH,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;QACvC,IAAI,UAAU,KAAK,IAAI;YAAE,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG,CAAA;QAC/C,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;YACzD,SAAS,CAAC,UAAU,CAAC,GAAG,GAAG,CAAA;IAC/B,CAAC;IAED,OAAO,KAAC,cAAc,OAAK,SAAS,YAAG,QAAQ,GAAkB,CAAA;AACnE,CAAC,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/cms-styles/index.tsx"],"names":[],"mappings":"AA0CA;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAIzB,IAAmB,EAAE,WAAc,EAAE,YAAiB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/cms-styles/index.tsx"],"names":[],"mappings":"AA0CA;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAIzB,IAAmB,EAAE,WAAc,EAAE,YAAiB;IAGtD,MAAM,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAA;IACtE,OAAO,CAAC,EAAE,IAAI,YAAY,CAAO,CAAA;AACnC,CAAC;AAED,MAAM,UAAU,eAAe,CAA6B,IAAmB;IAG7E,IAAI,CAAC,IAAI;QACP,OAAO,EAAQ,CAAA;IACjB,MAAM,SAAS,GAAiB,EAAE,CAAA;IAClC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,KAAK;YACX,SAAS,CAAC,GAAG,CAAC,GAAe,CAAC,GAAG,GAAG,CAAC,KAAqB,CAAA;IAC9D,CAAC,CAAC,CAAA;IACF,OAAO,SAAe,CAAA;AACxB,CAAC"}
|
|
@@ -19,7 +19,7 @@ import { type PropsWithOptionalContext } from '../../context/types.js';
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function createHtmlComponent<E extends keyof JSX.IntrinsicElements>(element: E, ignoreChildren?: boolean, defaultProps?: JSX.IntrinsicElements[E] & Record<string, string>): ({ children, node, ctx, ...props }: PropsWithOptionalContext<PropsWithChildren<JSX.IntrinsicElements[E] & {
|
|
21
21
|
node: TypedNode;
|
|
22
|
-
}>>) =>
|
|
22
|
+
}>>) => JSX.Element;
|
|
23
23
|
export declare const DefaultTextNode: FunctionComponent<PropsWithOptionalContext<{
|
|
24
24
|
node: TextNode;
|
|
25
25
|
}>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
1
2
|
import type { RichTextImplProps } from './types.js';
|
|
2
3
|
import type { ElementWithChildrenType } from '../type-utils.js';
|
|
3
4
|
export * from './types.js';
|
|
4
|
-
export declare const RichText: <ET extends ElementWithChildrenType>({ factory, text, className, as: Wrapper, debug, noWrapper, cmsFieldName, cmsId, ctx, children, ...props }: RichTextImplProps<ET>) => import("react
|
|
5
|
+
export declare const RichText: <ET extends ElementWithChildrenType>({ factory, text, className, as: Wrapper, debug, noWrapper, cmsFieldName, cmsId, ctx, children, ...props }: RichTextImplProps<ET>) => string | number | bigint | boolean | JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
@@ -14,10 +14,13 @@ export const RichText = ({ factory, text = '{ "type": "richText" }', className =
|
|
|
14
14
|
const elementId = id + '::' + idx;
|
|
15
15
|
return (_jsx(RichTextElement, { factory: richTextFactory, node: child, idPrefix: elementId + '::', ctx: ctx }, elementId));
|
|
16
16
|
}) || children;
|
|
17
|
+
if (noWrapper || !Wrapper) {
|
|
18
|
+
if (isDebug)
|
|
19
|
+
console.warn('🟠 [Rich Text] Text without wrapper, make sure you add your own `CmsEditable` as one of the parents of this component');
|
|
20
|
+
return textContent;
|
|
21
|
+
}
|
|
17
22
|
if (cmsId || cmsFieldName)
|
|
18
|
-
return (_jsx(CmsEditable, { as:
|
|
19
|
-
if (noWrapper || !Wrapper)
|
|
20
|
-
return _jsx(_Fragment, { children: textContent });
|
|
23
|
+
return (_jsx(CmsEditable, { as: Wrapper, className: className, cmsId: cmsId || undefined, cmsFieldName: cmsFieldName || undefined, ctx: ctx, ...props, children: textContent }));
|
|
21
24
|
return (
|
|
22
25
|
//@ts-expect-error
|
|
23
26
|
_jsx(Wrapper, { className: className, ...props, children: textContent }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/rich-text/index.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAGtD,cAAc,YAAY,CAAA;AAE1B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAqC,EAC3D,OAAO,EACP,IAAI,GAAG,wBAAwB,EAC/B,SAAS,GAAG,WAAW,EACvB,EAAE,EAAE,OAAO,GAAG,KAAW,EACzB,KAAK,GAAG,KAAK,EACb,SAAS,GAAG,KAAK,EACjB,YAAY,GAAG,IAAI,EACnB,KAAK,GAAG,IAAI,EACZ,GAAG,EACH,QAAQ,EACR,GAAG,KAAK,EACc,EAAE,EAAE;IAC1B,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;IACzC,MAAM,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C,KAAK,EAAE,GAAG,EAAE,EAAE;YACjC,MAAM,SAAS,GAAG,QAAQ,GAAG,GAAG,CAAA;YAChC,OAAO,CACL,KAAC,eAAe,IAEd,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,SAAS,GAAG,IAAI,EAC1B,GAAG,EAAE,GAAG,IAJH,SAAS,CAKd,CACH,CAAA;QACH,CAAC,CAAC;QACF,CAAC,CAAC,SAAS,CAAA;IAEf,4DAA4D;IAC5D,IAAI,SAAS,GAAG,OAAO,EAAE,OAAO,CAAC,YAAY,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;IACzD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAI,OAAO;YACT,OAAO,CAAC,IAAI,CACV,sFAAsF,IAAI,CAAC,IAAI,eAAe,IAAI,CAAC,IAAI,EAAE,CAC1H,CAAA;QACH,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAmC,CAAC,CAAA;QACzE,OAAO,EAAE,QAAQ,CAAC,YAAY,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,CAAC,CAAA;IACvD,CAAC;IAED,mBAAmB;IACnB,OAAO,CACL,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,YAC5B,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GAChD,CACb,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/rich-text/utils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,MAAM,CAAC,MAA+B;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/rich-text/utils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,MAAM,CAAC,MAA+B;IAEpD,OAAO,CACL,OAAO,MAAM,IAAI,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,GAAG,KAAK,KAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAE,EAAE,CAAA;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAW;IAErC,OAAO,cAAc,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,CAAA;AACvD,CAAC"}
|
|
@@ -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
|
-
*
|
|
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
|
-
*
|
|
12
|
-
*
|
|
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
|
-
*
|
|
18
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
35
|
-
*
|
|
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
|
-
*
|
|
40
|
-
*
|
|
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,4BAA4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B,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
|
-
|
|
68
|
-
node.template
|
|
69
|
-
[ucFirst(node.
|
|
70
|
-
|
|
71
|
-
|
|
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;
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/components/visual-builder/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACxE,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,MAAW;IAChC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,QAAQ,IAAI,MAAM,IAAI,IAAI;QAC/C,OAAO,KAAK,CAAA;IAEd,MAAM,SAAS,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;IACzE,MA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QAAQ;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAA;IAED,IAAI,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,2CAA2C,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;IAEjI,OAAO,CAAC,WAAW,EAAE,cAAc,EAAE,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE,aAAa,EAAE,UAAU,CAAC,CAAA;AACxF,CAAC,CAAA;AAED,MAAM,UAAU,OAAO,CAAC,KAAgC;IACtD,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAChD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IACpD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -7,5 +7,7 @@ export type * from './types.js';
|
|
|
7
7
|
* @param param0
|
|
8
8
|
* @returns The
|
|
9
9
|
*/
|
|
10
|
-
export declare function OptimizelyComposition({ node, leafPropsFactory, nodePropsFactory, ctx, cmsContent: CmsContent, }: BaseOptimizelyCompositionProps
|
|
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
|
|
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
|
|
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,
|
|
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,gBAAgB,GAAG,mBAAmB,EACtC,gBAAgB,GAAG,uBAAuB,EAC1C,GAAG,EACH,UAAU,EAAE,UAAU,EACtB,QAAQ,GAAG,IAAI,EACwC;IACvD,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAA;IAEvB,4FAA4F;IAC5F,qDAAqD;IACrD,IAAI,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5F,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAC9B,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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,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClL,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,EACtB,QAAQ,EAAE,KAAK,IANV,QAAQ,CAOb,CACH,CAAA;QACH,CAAC,CAAC,GACS,CACd,CAAA;AACH,CAAC;AAED,eAAe,qBAAqB,CAAA"}
|
package/dist/context/client.d.ts
CHANGED
|
@@ -57,25 +57,25 @@ export type OptimizelyCmsProps = {
|
|
|
57
57
|
initialMode?: OptimizelyCmsMode;
|
|
58
58
|
} & ({
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
* The component factory to be used to resolve content within the scope
|
|
61
|
+
* of this provider.
|
|
62
|
+
*/
|
|
63
63
|
factory: ComponentFactory;
|
|
64
64
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
* The defaults components to apply when there's no factory provided. If a
|
|
66
|
+
* factory is provided, these components will not be added to the factory.
|
|
67
|
+
*/
|
|
68
68
|
initialComponents?: never;
|
|
69
69
|
} | {
|
|
70
70
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
* The component factory to be used to resolve content within the scope
|
|
72
|
+
* of this provider.
|
|
73
|
+
*/
|
|
74
74
|
factory?: never;
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
* The defaults components to apply when there's no factory provided. If a
|
|
77
|
+
* factory is provided, these components will not be added to the factory.
|
|
78
|
+
*/
|
|
79
79
|
initialComponents: ComponentTypeDictionary;
|
|
80
80
|
});
|
|
81
81
|
export declare const OptimizelyCms: FunctionComponent<PropsWithChildren<OptimizelyCmsProps>>;
|
package/dist/context/client.js
CHANGED
|
@@ -12,6 +12,14 @@ export var OptimizelyCmsMode;
|
|
|
12
12
|
OptimizelyCmsMode["preview"] = "preview";
|
|
13
13
|
})(OptimizelyCmsMode || (OptimizelyCmsMode = {}));
|
|
14
14
|
export class ClientContextInstance {
|
|
15
|
+
client;
|
|
16
|
+
factory;
|
|
17
|
+
locale;
|
|
18
|
+
inEditMode;
|
|
19
|
+
inPreviewMode;
|
|
20
|
+
isDevelopment;
|
|
21
|
+
isDebug;
|
|
22
|
+
isDebugOrDevelopment;
|
|
15
23
|
constructor(cfg, components) {
|
|
16
24
|
this.client = isOptiGraphClient(cfg.client)
|
|
17
25
|
? cfg.client
|