@remkoj/optimizely-cms-react 5.0.2 → 6.0.0-pre1
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/dist/components/cms-content/client.d.ts +2 -2
- package/dist/components/cms-content/client.js +20 -12
- package/dist/components/cms-content/client.js.map +1 -1
- package/dist/components/cms-content/get-content.js +65 -28
- package/dist/components/cms-content/get-content.js.map +1 -1
- package/dist/components/cms-content/resolve-component.d.ts +5 -1
- package/dist/components/cms-content/resolve-component.js +14 -1
- package/dist/components/cms-content/resolve-component.js.map +1 -1
- package/dist/components/cms-content/rsc.js +2 -1
- package/dist/components/cms-content/rsc.js.map +1 -1
- package/dist/components/cms-content/utils.d.ts +2 -2
- package/dist/components/cms-content/utils.js +1 -1
- package/dist/components/cms-content/utils.js.map +1 -1
- package/dist/components/cms-content-area/index.js.map +1 -1
- package/dist/components/rich-text/components.d.ts +1 -1
- package/dist/components/rsc-components.d.ts +31 -0
- package/dist/components/rsc-components.js +53 -0
- package/dist/components/rsc-components.js.map +1 -0
- package/dist/components/rsc.d.ts +0 -45
- package/dist/components/rsc.js +0 -51
- package/dist/components/rsc.js.map +1 -1
- package/dist/components/type-utils.d.ts +1 -1
- package/dist/components/visual-builder/functions.js +6 -5
- package/dist/components/visual-builder/functions.js.map +1 -1
- package/dist/components/visual-builder/types.d.ts +1 -1
- package/dist/context/rsc.js +8 -6
- package/dist/context/rsc.js.map +1 -1
- package/dist/factory/types.d.ts +1 -1
- package/dist/rsc.d.ts +1 -0
- package/dist/rsc.js +1 -0
- package/dist/rsc.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/package.json +17 -23
- package/dist/components.d.ts +0 -29
- package/dist/components.js +0 -24
- package/dist/components.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { BaseCmsContentProps } from './types.js';
|
|
3
|
-
export type * from
|
|
3
|
+
export type * from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* React Server Side component for the CmsContent
|
|
6
6
|
*
|
|
7
7
|
* @param param0
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function CmsContent<LocalesType = string>({ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentData, layoutProps, noDataLoad, variant, ctx }: BaseCmsContentProps<LocalesType>): ReactNode;
|
|
10
|
+
export declare function CmsContent<LocalesType = string>({ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentData, layoutProps, noDataLoad, variant, ctx, }: BaseCmsContentProps<LocalesType>): ReactNode;
|
|
11
11
|
export default CmsContent;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import getContentType from './get-content-type.js';
|
|
4
4
|
import getContent from './get-content.js';
|
|
5
|
-
import { AuthMode, normalizeContentLink, contentLinkToString } from '@remkoj/optimizely-graph-client';
|
|
6
|
-
import resolveComponent, { isComponentMissingComponent } from './resolve-component.js';
|
|
5
|
+
import { AuthMode, normalizeContentLink, contentLinkToString, } from '@remkoj/optimizely-graph-client';
|
|
6
|
+
import resolveComponent, { isComponentMissingComponent, } from './resolve-component.js';
|
|
7
7
|
import resolveContentType from './resolve-content-type.js';
|
|
8
8
|
import { useState, useMemo, useEffect } from 'react';
|
|
9
9
|
/**
|
|
@@ -14,18 +14,25 @@ import { useState, useMemo, useEffect } from 'react';
|
|
|
14
14
|
*/
|
|
15
15
|
export function CmsContent({
|
|
16
16
|
// Own properties
|
|
17
|
-
contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentData, layoutProps, noDataLoad, variant, ctx }) {
|
|
17
|
+
contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentData, layoutProps, noDataLoad, variant, ctx, }) {
|
|
18
18
|
// Prepare context
|
|
19
19
|
const graphClient = ctx.client;
|
|
20
20
|
const [myContentType, setMyContentType] = useState(resolveContentType(contentType, fragmentData));
|
|
21
21
|
const contentLink = useMemo(() => normalizeContentLink(rawContentLink), [rawContentLink]);
|
|
22
22
|
const Component = useMemo(() => resolveComponent(myContentType, contentTypePrefix, variant, ctx), [myContentType, variant, contentTypePrefix, ctx]);
|
|
23
|
-
const [data, setData] = useState(
|
|
23
|
+
const [data, setData] = useState(
|
|
24
|
+
//@ts-expect-error
|
|
25
|
+
getContent(graphClient, contentLink, Component, fragmentData, true));
|
|
24
26
|
// Provide a bit of debugging context
|
|
25
27
|
if (graphClient?.debug) {
|
|
26
|
-
const mode = ctx.inEditMode
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
const mode = ctx.inEditMode
|
|
29
|
+
? 'Edit'
|
|
30
|
+
: ctx.inPreviewMode
|
|
31
|
+
? 'Preview'
|
|
32
|
+
: 'Public';
|
|
33
|
+
console.log(`👔 [CmsContent] ${mode} mode active for content with id: ${contentLinkToString(contentLink)} of type ${myContentType?.join('/') ?? 'unknown'}`);
|
|
34
|
+
if ((ctx.inEditMode || ctx.inPreviewMode) &&
|
|
35
|
+
graphClient.currentAuthMode == AuthMode.Public)
|
|
29
36
|
console.warn(`🟠 [CmsContent] ${mode} mode active without an authenticated graphClient, this will cause problems. Make sure the context has an authenticated client.`);
|
|
30
37
|
}
|
|
31
38
|
// Ensure we have a content type to work with
|
|
@@ -39,7 +46,7 @@ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentD
|
|
|
39
46
|
}
|
|
40
47
|
if (graphClient.debug)
|
|
41
48
|
console.warn(`🟠 [CmsContent] No content type provided for content ${contentLinkToString(contentLink)}, this causes an additional GraphQL query to resolve the myContentType`);
|
|
42
|
-
getContentType(contentLink, graphClient).then(ct => {
|
|
49
|
+
getContentType(contentLink, graphClient).then((ct) => {
|
|
43
50
|
if (!isCancelled)
|
|
44
51
|
setMyContentType(ct);
|
|
45
52
|
});
|
|
@@ -56,7 +63,8 @@ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentD
|
|
|
56
63
|
console.warn(`🔴 [CmsContent] No Optimizely Graph Client present unable to load content type`);
|
|
57
64
|
return;
|
|
58
65
|
}
|
|
59
|
-
|
|
66
|
+
//@ts-expect-error
|
|
67
|
+
getContent(graphClient, contentLink, Component, fragmentData).then((newData) => {
|
|
60
68
|
if (!isCancelled)
|
|
61
69
|
setData(newData);
|
|
62
70
|
});
|
|
@@ -65,8 +73,8 @@ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentD
|
|
|
65
73
|
};
|
|
66
74
|
}, [graphClient, contentLink, Component, fragmentData, noDataLoad]);
|
|
67
75
|
if (isComponentMissingComponent(Component))
|
|
68
|
-
return _jsx(Component, {});
|
|
69
|
-
return _jsx(Component, { contentLink: contentLink, data: data, inEditMode: ctx.inEditMode, layoutProps: layoutProps, children: children });
|
|
76
|
+
return _jsx(Component, { contentLink: contentLink });
|
|
77
|
+
return (_jsx(Component, { contentLink: contentLink, data: data, inEditMode: ctx.inEditMode, layoutProps: layoutProps, children: children }));
|
|
70
78
|
}
|
|
71
79
|
export default CmsContent;
|
|
72
80
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/components/cms-content/client.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAIZ,OAAO,cAAc,MAAM,uBAAuB,CAAA;AAClD,OAAO,UAAU,MAAM,kBAAkB,CAAA;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/components/cms-content/client.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAIZ,OAAO,cAAc,MAAM,uBAAuB,CAAA;AAClD,OAAO,UAAU,MAAM,kBAAkB,CAAA;AACzC,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,GAEpB,MAAM,iCAAiC,CAAA;AACxC,OAAO,gBAAgB,EAAE,EACvB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAA;AAC/B,OAAO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,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,IAAI,CAChE,CAAC,OAAO,EAAE,EAAE;YACV,IAAI,CAAC,WAAW;gBAAE,OAAO,CAAC,OAAO,CAAC,CAAA;QACpC,CAAC,CACF,CAAA;QAED,OAAO,GAAG,EAAE;YACV,WAAW,GAAG,IAAI,CAAA;QACpB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAA;IAEnE,IAAI,2BAA2B,CAAC,SAAS,CAAC;QACxC,OAAO,KAAC,SAAS,IAAC,WAAW,EAAE,WAA0B,GAAI,CAAA;IAC/D,OAAO,CACL,KAAC,SAAS,IACR,WAAW,EAAE,WAA0B,EACvC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,GAAG,CAAC,UAAU,EAC1B,WAAW,EAAE,WAAW,YAEvB,QAAQ,GACC,CACb,CAAA;AACH,CAAC;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -2,38 +2,47 @@ import { print } from 'graphql';
|
|
|
2
2
|
import { isContentLink, isInlineContentLink, OptiCmsSchema } from "@remkoj/optimizely-graph-client";
|
|
3
3
|
import { CmsContentFragments } from "../../data/queries.js";
|
|
4
4
|
import { validatesFragment, contentLinkToRequestVariables, isCmsComponentWithFragment, isCmsComponentWithDataQuery } from "../../utilities.js";
|
|
5
|
+
import { getComponentLabel } from './resolve-component.js';
|
|
5
6
|
export function getContent(client, contentLink, Component, fragmentData, noDataLoad) {
|
|
6
7
|
const debug = client?.debug ?? false;
|
|
7
8
|
// Handle provided fragment
|
|
8
|
-
const componentLabel = Component
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (validatesFragment(Component) && !Component.validateFragment(
|
|
13
|
-
|
|
9
|
+
const componentLabel = getComponentLabel(Component);
|
|
10
|
+
const fragmentProps = fragmentData ? Object.getOwnPropertyNames(fragmentData).filter(x => !CmsContentFragments.IContentDataProps.includes(x)) : [];
|
|
11
|
+
if (fragmentData && fragmentProps.length > 0) {
|
|
12
|
+
// Invalid fragment
|
|
13
|
+
if (validatesFragment(Component) && !Component.validateFragment(fragmentData)) {
|
|
14
|
+
if (debug)
|
|
15
|
+
console.warn("🔴 [CmsContent][getContent] Invalid fragment data received, falling back to loading for ", componentLabel);
|
|
16
|
+
// Preview mode, so load data for changeset
|
|
17
|
+
}
|
|
18
|
+
else if (client?.isPreviewEnabled() && isContentLink(contentLink) && !isInlineContentLink(contentLink)) {
|
|
19
|
+
if (debug)
|
|
20
|
+
console.warn("🔴 [CmsContent][getContent] Rendering shared instance, while in preview mode, falling back to loading for ", componentLabel);
|
|
21
|
+
contentLink.version = null;
|
|
22
|
+
// Default mode, use fragment
|
|
23
|
+
}
|
|
14
24
|
else {
|
|
15
25
|
if (debug)
|
|
16
|
-
console.log("⚪ [CmsContent][getContent] Rendering CMS Component using fragment information");
|
|
17
|
-
return (noDataLoad ?
|
|
26
|
+
console.log("⚪ [CmsContent][getContent] Rendering CMS Component using fragment information", fragmentProps);
|
|
27
|
+
return (noDataLoad ? fragmentData : Promise.resolve(fragmentData));
|
|
18
28
|
}
|
|
19
29
|
}
|
|
20
30
|
// No meaningful fragment provided with inline content, warn in debug, but just return an empty dataset
|
|
21
31
|
if (isInlineContentLink(contentLink)) {
|
|
22
32
|
if (debug)
|
|
23
33
|
console.warn(`🟠 [CmsContent][getContent] No data present for inline content item, this may cause errors if your component expects certain fields to be present`);
|
|
24
|
-
return (noDataLoad ?
|
|
34
|
+
return (noDataLoad ? fragmentData ?? {} : Promise.resolve(fragmentData ?? {}));
|
|
25
35
|
}
|
|
26
|
-
// If no data may be loaded, stop here
|
|
27
36
|
if (noDataLoad) {
|
|
28
37
|
if (debug)
|
|
29
38
|
console.log(`⚪ [CmsContent][getContent] Component of type "${componentLabel}" was prohibited to load data`);
|
|
30
|
-
return
|
|
39
|
+
return (noDataLoad ? {} : Promise.resolve({}));
|
|
31
40
|
}
|
|
32
41
|
// If we don't have a valid link, stop here
|
|
33
42
|
if (!isContentLink(contentLink)) {
|
|
34
43
|
if (debug)
|
|
35
44
|
console.warn(`🟠 [CmsContent][getContent] Unable to load data for "${componentLabel}" without a valid content link`);
|
|
36
|
-
return Promise.resolve(
|
|
45
|
+
return Promise.resolve({});
|
|
37
46
|
}
|
|
38
47
|
// Return immediately when there's no client
|
|
39
48
|
if (!client) {
|
|
@@ -45,6 +54,9 @@ export function getContent(client, contentLink, Component, fragmentData, noDataL
|
|
|
45
54
|
if (isCmsComponentWithDataQuery(Component)) {
|
|
46
55
|
const gqlQuery = Component.getDataQuery();
|
|
47
56
|
const gqlVariables = contentLinkToRequestVariables(contentLink);
|
|
57
|
+
// If the CMS Preview mode has been enabled, make sure we include that in the query
|
|
58
|
+
if (client.isPreviewEnabled())
|
|
59
|
+
gqlVariables.changeset = client.getChangeset();
|
|
48
60
|
if (client.debug)
|
|
49
61
|
console.log("⚪ [CmsContent][getContent] Component fetching data using query, provided variables:", gqlVariables);
|
|
50
62
|
return client.request(gqlQuery, gqlVariables);
|
|
@@ -52,29 +64,21 @@ export function getContent(client, contentLink, Component, fragmentData, noDataL
|
|
|
52
64
|
// Assume there's no data load required for the component
|
|
53
65
|
if (client.debug)
|
|
54
66
|
console.log(`⚪ [CmsContent] Component of type "${componentLabel}" did not request loading of data`);
|
|
55
|
-
return Promise.resolve(
|
|
67
|
+
return Promise.resolve({});
|
|
56
68
|
}
|
|
57
69
|
export default getContent;
|
|
58
70
|
async function getComponentDataFromFragment(Component, contentLink, client) {
|
|
59
71
|
const [name, fragment] = Component.getDataFragment();
|
|
60
72
|
if (client.debug)
|
|
61
73
|
console.log(`⚪ [CmsContent] Component data fetching using fragment: ${name}`);
|
|
62
|
-
const fragmentQuery = client.currentOptiCmsSchema == OptiCmsSchema.CMS12 ?
|
|
63
|
-
`query getContentFragmentById($key: String!, $version: Int, $locale: [Locales!]) { contentById: Content(where: { ContentLink: { GuidValue: { eq: $key }, WorkId: { eq: $version } } }, locale: $locale) { total, items { _type: __typename, _metadata: ContentLink { key: GuidValue, version: WorkId }, _locale: Language { name: Name } ...${name} }}}\n ${print(fragment)}` :
|
|
64
|
-
`query getContentFragmentById($key: String!, $version: String, $locale: [Locales!]) {contentById: _Content(where: {_metadata: {key: { eq: $key }, version: { eq: $version }}} locale: $locale) { total, items { _type: __typename, _metadata { key, version, locale } ...${name} }}}\n ${print(fragment)}`;
|
|
74
|
+
const fragmentQuery = client.currentOptiCmsSchema == OptiCmsSchema.CMS12 ? buildCms12Query(name, fragment) : buildCms13Query(name, fragment);
|
|
65
75
|
const fragmentVariables = contentLinkToRequestVariables(contentLink);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
fragmentVariables.version = undefined;
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
fragmentVariables.version = undefined;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
76
|
+
// CMS 12 Requires the version number to be an Int
|
|
77
|
+
if (client.currentOptiCmsSchema == OptiCmsSchema.CMS12)
|
|
78
|
+
fragmentVariables.version = tryParsePositiveInt(fragmentVariables.version);
|
|
79
|
+
// If the CMS Preview mode has been enabled, make sure we include that in the query
|
|
80
|
+
if (client.isPreviewEnabled())
|
|
81
|
+
fragmentVariables.changeset = client.getChangeset();
|
|
78
82
|
if (client.debug)
|
|
79
83
|
console.log(`⚪ [CmsContent] Component data fetching using variables: ${JSON.stringify(fragmentVariables)}`);
|
|
80
84
|
const fragmentResponse = await client.request(fragmentQuery, fragmentVariables);
|
|
@@ -90,4 +94,37 @@ async function getComponentDataFromFragment(Component, contentLink, client) {
|
|
|
90
94
|
}
|
|
91
95
|
return fragmentResponse.contentById.items[0];
|
|
92
96
|
}
|
|
97
|
+
function tryParsePositiveInt(value, defaultValue) {
|
|
98
|
+
try {
|
|
99
|
+
const versionNr = value ? Number.parseInt(value) : 0;
|
|
100
|
+
if (!isNaN(versionNr) && versionNr > 0)
|
|
101
|
+
return versionNr;
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// Ignore
|
|
105
|
+
}
|
|
106
|
+
return defaultValue;
|
|
107
|
+
}
|
|
108
|
+
const buildCms12Query = (name, fragment) => `query getContentFragmentById($key: String!, $version: Int, $locale: [Locales!]) { contentById: Content(where: { ContentLink: { GuidValue: { eq: $key }, WorkId: { eq: $version } } }, locale: $locale) { total, items { _type: __typename, _metadata: ContentLink { key: GuidValue, version: WorkId }, _locale: Language { name: Name } ...${name} }}}\n${typeof (fragment) == 'string' ? fragment : print(fragment)}`;
|
|
109
|
+
const buildCms13Query = (name, fragment) => `query getContentFragmentById($key: String!, $version: String, $locale: [Locales!], $changeset: String) {
|
|
110
|
+
contentById: _Content(
|
|
111
|
+
where: {
|
|
112
|
+
_metadata: { key: { eq: $key }, version: { eq: $version }, changeset: { eq: $changeset } }
|
|
113
|
+
}
|
|
114
|
+
locale: $locale
|
|
115
|
+
) {
|
|
116
|
+
total
|
|
117
|
+
items {
|
|
118
|
+
_type: __typename
|
|
119
|
+
__typename
|
|
120
|
+
_metadata {
|
|
121
|
+
key
|
|
122
|
+
version
|
|
123
|
+
locale
|
|
124
|
+
}
|
|
125
|
+
...${name}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
${typeof (fragment) == 'string' ? fragment : print(fragment)}`;
|
|
93
130
|
//# sourceMappingURL=get-content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-content.js","sourceRoot":"","sources":["../../../src/components/cms-content/get-content.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"get-content.js","sourceRoot":"","sources":["../../../src/components/cms-content/get-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,MAAM,SAAS,CAAA;AAExC,OAAO,EAAmE,aAAa,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AA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AC,CAAC,OAAO;YAC/C,OAAO,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IACxD,CAAC;IACD,OAAO,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAC9C,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAgC,EAAE,YAAqB;IAClF,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACpD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC;YACpC,OAAO,SAAS,CAAA;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,SAAS;IACX,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,QAA0B,EAAE,EAAE,CAAC,8UAA8U,IAAI,SAAS,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAA;AAC7d,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,QAA0B,EAAE,EAAE,CAAC;;;;;;;;;;;;;;;;WAgB3D,IAAI;;;;EAIb,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAA"}
|
|
@@ -2,6 +2,8 @@ import { type ComponentTypeHandle } from '../../factory/types.js';
|
|
|
2
2
|
import { type EnhancedCmsComponent } from './types.js';
|
|
3
3
|
import { type GenericContext } from '../../context/types.js';
|
|
4
4
|
import { type FunctionComponent, type PropsWithChildren, type ComponentType } from 'react';
|
|
5
|
+
import { type ContentLink } from '@remkoj/optimizely-graph-client';
|
|
6
|
+
export declare function getComponentLabel(componentInstance?: ComponentType | null): string;
|
|
5
7
|
/**
|
|
6
8
|
* Helper function to safely resolve a component from the ContentType information to
|
|
7
9
|
*
|
|
@@ -12,7 +14,9 @@ import { type FunctionComponent, type PropsWithChildren, type ComponentType } fr
|
|
|
12
14
|
*/
|
|
13
15
|
export declare function resolveComponent(contentType: ComponentTypeHandle | null | undefined, prefix: string | null | undefined, variant: string | null | undefined, ctx: GenericContext): EnhancedCmsComponent | ComponentMissingComponent;
|
|
14
16
|
export default resolveComponent;
|
|
15
|
-
export type ComponentMissingComponent = FunctionComponent<PropsWithChildren
|
|
17
|
+
export type ComponentMissingComponent = FunctionComponent<PropsWithChildren<{
|
|
18
|
+
contentLink?: ContentLink;
|
|
19
|
+
}>> & {
|
|
16
20
|
displayName: 'Opti::ComponentMissing';
|
|
17
21
|
};
|
|
18
22
|
export declare function isComponentMissingComponent(toTest: ComponentType<any> | null | undefined): toTest is ComponentMissingComponent;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as Utils from '../../utilities.js';
|
|
3
|
+
export function getComponentLabel(componentInstance) {
|
|
4
|
+
if (!componentInstance)
|
|
5
|
+
return 'n/a';
|
|
6
|
+
if (componentInstance.displayName)
|
|
7
|
+
return componentInstance.displayName;
|
|
8
|
+
if (typeof componentInstance == 'function' && componentInstance.name)
|
|
9
|
+
return componentInstance.name;
|
|
10
|
+
return componentInstance.toString();
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* Helper function to safely resolve a component from the ContentType information to
|
|
5
14
|
*
|
|
@@ -34,8 +43,10 @@ export function resolveComponent(contentType, prefix, variant, ctx) {
|
|
|
34
43
|
const contentTypeDisplay = Array.isArray(myContentType)
|
|
35
44
|
? myContentType.join('/')
|
|
36
45
|
: myContentType;
|
|
46
|
+
if (isDebug)
|
|
47
|
+
console.warn(`🟠 [CmsContent] Component of type "${contentTypeDisplay}" not resolved by factory`);
|
|
37
48
|
if (isDebug || inEditMode) {
|
|
38
|
-
const ErrorComponent = (
|
|
49
|
+
const ErrorComponent = ({ children, contentLink, }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "opti-error", children: ["Component of type \"", contentTypeDisplay, "\" not resolved by factory for", ' ', contentLink?.key ?? '', " version ", contentLink?.version ?? ''] }), children] }));
|
|
39
50
|
ErrorComponent.displayName = 'Opti::ComponentMissing';
|
|
40
51
|
return ErrorComponent;
|
|
41
52
|
}
|
|
@@ -44,6 +55,8 @@ export function resolveComponent(contentType, prefix, variant, ctx) {
|
|
|
44
55
|
return ErrorComponent;
|
|
45
56
|
}
|
|
46
57
|
// Return the component
|
|
58
|
+
if (isDebug)
|
|
59
|
+
console.log('⚪ [CmsContent] Rendering item using component:', getComponentLabel(Component));
|
|
47
60
|
return Component;
|
|
48
61
|
}
|
|
49
62
|
export default resolveComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-component.js","sourceRoot":"","sources":["../../../src/components/cms-content/resolve-component.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"resolve-component.js","sourceRoot":"","sources":["../../../src/components/cms-content/resolve-component.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAS3C,MAAM,UAAU,iBAAiB,CAAC,iBAAwC;IACxE,IAAI,CAAC,iBAAiB;QAAE,OAAO,KAAK,CAAA;IACpC,IAAI,iBAAiB,CAAC,WAAW;QAAE,OAAO,iBAAiB,CAAC,WAAW,CAAA;IACvE,IAAI,OAAO,iBAAiB,IAAI,UAAU,IAAI,iBAAiB,CAAC,IAAI;QAClE,OAAO,iBAAiB,CAAC,IAAI,CAAA;IAC/B,OAAO,iBAAiB,CAAC,QAAQ,EAAE,CAAA;AACrC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9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AC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use server';
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import getContentType from './get-content-type.js';
|
|
3
4
|
import getContent from './get-content.js';
|
|
@@ -47,7 +48,7 @@ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentD
|
|
|
47
48
|
// Retrieve the Component used to render this item
|
|
48
49
|
const Component = resolveComponent(myContentType, contentTypePrefix, variant, ctx);
|
|
49
50
|
if (isComponentMissingComponent(Component))
|
|
50
|
-
return _jsx(Component, {});
|
|
51
|
+
return _jsx(Component, { contentLink: contentLink });
|
|
51
52
|
// Ensure we have the data the Component requested
|
|
52
53
|
const data = await getContent(graphClient, contentLink, Component, fragmentData, noDataLoad);
|
|
53
54
|
// Output the actual component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../../../src/components/cms-content/rsc.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../../../src/components/cms-content/rsc.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAGZ,OAAO,cAAc,MAAM,uBAAuB,CAAA;AAClD,OAAO,UAAU,MAAM,kBAAkB,CAAA;AACzC,OAAO,EACL,QAAQ,EACR,oBAAoB,GAGrB,MAAM,iCAAiC,CAAA;AACxC,OAAO,gBAAgB,EAAE,EACvB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,kBAAkB,MAAM,2BAA2B,CAAA;AAI1D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAuB;AACrD,iBAAiB;AACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EAAE,cAAc,EAC3B,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,UAAU,EACV,OAAO,EACP,GAAG,GAC8B;IACjC,kBAAkB;IAClB,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAA;I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B;IAC9B,OAAO,CACL,KAAC,SAAS,IACR,WAAW,EAAE,WAA0B,EACvC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,GAAG,CAAC,UAAU,EAC1B,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,GAAG,YAEP,QAAQ,GACC,CACb,CAAA;AACH,CAAC;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type ComponentType } from
|
|
2
|
-
import { type CmsContentComponent, type PropsWithCmsContent } from
|
|
1
|
+
import { type ComponentType } from 'react';
|
|
2
|
+
import { type CmsContentComponent, type PropsWithCmsContent } from './types.js';
|
|
3
3
|
export declare function cmsContentAware<P = any>(component: ComponentType<PropsWithCmsContent<P>>, cmsContentComponent: CmsContentComponent): ComponentType<P>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
export function cmsContentAware(component, cmsContentComponent) {
|
|
3
3
|
const BaseComponent = component;
|
|
4
|
-
return (props) => _jsx(BaseComponent, { cmsContent: cmsContentComponent, ...props });
|
|
4
|
+
return (props) => (_jsx(BaseComponent, { cmsContent: cmsContentComponent, ...props }));
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/cms-content/utils.tsx"],"names":[],"mappings":";AAGA,MAAM,UAAU,eAAe,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/cms-content/utils.tsx"],"names":[],"mappings":";AAGA,MAAM,UAAU,eAAe,CAC7B,SAAgD,EAChD,mBAAwC;IAExC,MAAM,aAAa,GAAG,SAAS,CAAA;IAC/B,OAAO,CAAC,KAAQ,EAAE,EAAE,CAAC,CACnB,KAAC,aAAa,IAAC,UAAU,EAAE,mBAAmB,KAAM,KAAK,GAAI,CAC9D,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/cms-content-area/index.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,GACpB,MAAM,uCAAuC,CAAA;AAO9C,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/cms-content-area/index.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AACzC,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,GACpB,MAAM,uCAAuC,CAAA;AAO9C,OAAO,EAAE,QAAQ,EAAY,MAAM,OAAO,CAAA;AAS1C,YAAY;AAEZ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgC,CAGzD,EACA,KAAK,GAAG,EAA4C,EACpD,WAAW,EACX,SAAS,EACT,EAAE,EAAE,WAAW,EACf,aAAa,EACb,WAAW,EACX,WAAW,GAAG,KAAqD,EACnE,QAAQ,EACR,SAAS,EAAE,sBAAsB,GAAG,KAGtB,EACd,OAAO,EAEP,GAAG,EACH,UAAU,EAAE,UAAU,EAEtB,GAAG,eAAe,EACY,EAAE,EAAE;IAClC,MAAM,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,GAAG,CAAA;IAElC,8FAA8F;IAC9F,MAAM,aAAa,GACjB,CAAC,KAAK,IAAI,EAAE,CACb;SACE,MAAM,CAAC,wBAAwB,CAAC;SAChC,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QACjB,iDAAiD;QACjD,MAAM,WAAW,GAAG,8BAA8B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAClE,IAAI,CAAC,WAAW;YAAE,MA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WithChildren } from 'react';
|
|
1
|
+
import { type FunctionComponent, type PropsWithChildren, type JSX } from 'react';
|
|
2
2
|
import { ComponentTypeDictionary } from '../../factory/types.js';
|
|
3
3
|
import type { TextNode, TypedNode } from './types.js';
|
|
4
4
|
import { type PropsWithOptionalContext } from '../../context/types.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type CmsContentAreaComponent } from './cms-content-area/index.js';
|
|
2
|
+
import { type CmsEditableComponent } from './cms-editable/index.js';
|
|
3
|
+
import { type CmsContentComponent } from './cms-content/rsc.js';
|
|
4
|
+
import { type OptimizelyCompositionComponent } from './visual-builder/index.js';
|
|
5
|
+
import { type RichTextComponent } from './rich-text/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Client side Optimizely CMS Editable
|
|
8
|
+
*/
|
|
9
|
+
export declare const CmsEditable: CmsEditableComponent;
|
|
10
|
+
/**
|
|
11
|
+
* Client side Optimizely CMS Content, leveraging the CMS Context to load the
|
|
12
|
+
* content type and content data when needed
|
|
13
|
+
*/
|
|
14
|
+
export declare const CmsContent: CmsContentComponent;
|
|
15
|
+
export type { CmsContentComponent, CmsContentProps } from './cms-content/rsc.js';
|
|
16
|
+
/**
|
|
17
|
+
* Client side Optimizely CMS Content Area, leveraging the CMS Context to infer
|
|
18
|
+
* the connection to Optimizely Graph and component dictionary.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CmsContentArea: CmsContentAreaComponent;
|
|
21
|
+
export type { CmsContentAreaClassMapper, CmsContentAreaComponent, CmsContentAreaProps, ContentAreaItemDefinition, } from './cms-content-area/index.js';
|
|
22
|
+
/**
|
|
23
|
+
* Client side Optimizely Composition (e.g. Visual Builder), leveraging the CMS
|
|
24
|
+
* Context to infer the connection to Optimizely Graph and component
|
|
25
|
+
* dictionary.
|
|
26
|
+
*/
|
|
27
|
+
export declare const OptimizelyComposition: OptimizelyCompositionComponent;
|
|
28
|
+
/**
|
|
29
|
+
* Client side renderer for Rich Text
|
|
30
|
+
*/
|
|
31
|
+
export declare const RichText: RichTextComponent;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { getServerContext } from '../context/rsc.js';
|
|
4
|
+
import { cmsContentAware } from './cms-content/utils.js';
|
|
5
|
+
import { CmsContentArea as BaseContentArea, } from './cms-content-area/index.js'; // Both RSC & Client capable
|
|
6
|
+
import { CmsEditable as BaseEditable, } from './cms-editable/index.js'; // Both RSC & Client capable
|
|
7
|
+
import { CmsContent as BaseCmsContent, } from './cms-content/rsc.js'; // Different components for RSC & Client
|
|
8
|
+
import { OptimizelyComposition as BaseOptimizelyComposition, } from './visual-builder/index.js'; // Both RSC & Client capable
|
|
9
|
+
import { RichText as BaseRichText, } from './rich-text/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper function to turn context dependant components into easy to use
|
|
12
|
+
* server components
|
|
13
|
+
*
|
|
14
|
+
* @param component The component where the `ctx` parameter must be fulfilled
|
|
15
|
+
* @returns The component, without CTX parameter
|
|
16
|
+
*/
|
|
17
|
+
function serverContextAware(component) {
|
|
18
|
+
const BaseComponent = component;
|
|
19
|
+
const ServerContextInjector = ({ ctx, ...props }) => {
|
|
20
|
+
if (!ctx)
|
|
21
|
+
console.error(`🔴 [ServerContextAware] Context for context aware component ${BaseComponent.displayName ?? BaseComponent.name ?? '[ANONYMOUS]'} is not defined!`);
|
|
22
|
+
const cmpCtx = ctx || getServerContext();
|
|
23
|
+
const componentProps = { ...props, ctx: cmpCtx };
|
|
24
|
+
return _jsx(BaseComponent, { ...componentProps });
|
|
25
|
+
};
|
|
26
|
+
ServerContextInjector.displayName = 'Server Context Injector';
|
|
27
|
+
return ServerContextInjector;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Client side Optimizely CMS Editable
|
|
31
|
+
*/
|
|
32
|
+
export const CmsEditable = serverContextAware(BaseEditable);
|
|
33
|
+
/**
|
|
34
|
+
* Client side Optimizely CMS Content, leveraging the CMS Context to load the
|
|
35
|
+
* content type and content data when needed
|
|
36
|
+
*/
|
|
37
|
+
export const CmsContent = serverContextAware(BaseCmsContent);
|
|
38
|
+
/**
|
|
39
|
+
* Client side Optimizely CMS Content Area, leveraging the CMS Context to infer
|
|
40
|
+
* the connection to Optimizely Graph and component dictionary.
|
|
41
|
+
*/
|
|
42
|
+
export const CmsContentArea = cmsContentAware(serverContextAware(BaseContentArea), CmsContent);
|
|
43
|
+
/**
|
|
44
|
+
* Client side Optimizely Composition (e.g. Visual Builder), leveraging the CMS
|
|
45
|
+
* Context to infer the connection to Optimizely Graph and component
|
|
46
|
+
* dictionary.
|
|
47
|
+
*/
|
|
48
|
+
export const OptimizelyComposition = cmsContentAware(serverContextAware(BaseOptimizelyComposition), CmsContent);
|
|
49
|
+
/**
|
|
50
|
+
* Client side renderer for Rich Text
|
|
51
|
+
*/
|
|
52
|
+
export const RichText = serverContextAware(BaseRichText);
|
|
53
|
+
//# sourceMappingURL=rsc-components.js.map
|
|
@@ -0,0 +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,MAAM,sBAAsB,CAAA,CAAC,wCAAwC;AACtE,OAAO,EACL,qBAAqB,IAAI,yBAAyB,GAEnD,MAAM,2BAA2B,CAAA,CAAC,4BAA4B;AAC/D,OAAO,EACL,QAAQ,IAAI,YAAY,GAEzB,MAAM,sBAAsB,CAAA;AAS7B;;;;;;GAMG;AACH,SAAS,kBAAkB,CACzB,SAAsC;IAEtC,MAAM,aAAa,GAAG,SAA6B,CAAA;IAEnD,MAAM,qBAAqB,GAEvB,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;QACxB,IAAI,CAAC,GAAG;YACN,OAAO,CAAC,KAAK,CACX,+DAA+D,aAAa,CAAC,WAAW,IAAI,aAAa,CAAC,IAAI,IAAI,aAAa,kBAAkB,CAClJ,CAAA;QACH,MAAM,MAAM,GAAG,GAAG,IAAI,gBAAgB,EAAE,CAAA;QACxC,MAAM,cAAc,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,MAAM,EAAO,CAAA;QACrD,OAAO,KAAC,aAAa,OAAK,cAAc,GAAI,CAAA;IAC9C,CAAC,CAAA;IACD,qBAAqB,CAAC,WAAW,GAAG,yBAAyB,CAAA;IAC7D,OAAO,qBAAqB,CAAA;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAC3C,YAAY,CACW,CAAA;AAEzB;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAC1C,cAAoD,CAC9B,CAAA;AAGxB;;;GAGG;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"}
|
package/dist/components/rsc.d.ts
CHANGED
|
@@ -1,53 +1,8 @@
|
|
|
1
1
|
import 'server-only';
|
|
2
|
-
import { type ReactNode, type ComponentType } from 'react';
|
|
3
|
-
import { type PropsWithContext, type PropsWithOptionalContext } from '../context/types.js';
|
|
4
|
-
import { type CmsContentAreaComponent } from './cms-content-area/index.js';
|
|
5
|
-
import { type CmsEditableComponent } from './cms-editable/index.js';
|
|
6
|
-
import { type CmsContentComponent } from './cms-content/rsc.js';
|
|
7
|
-
import { type OptimizelyCompositionComponent } from './visual-builder/index.js';
|
|
8
|
-
import { type RichTextComponent } from './rich-text/index.js';
|
|
9
2
|
export type { BaseStyleDefinition, ElementStyleDefinition, LayoutProps, LayoutPropsSetting, LayoutPropsSettingChoices, LayoutPropsSettingKeys, LayoutPropsSettingValues, NodeStyleDefinition, StyleDefinition, StyleSetting, } from './cms-styles/index.js';
|
|
10
3
|
export { extractSettings, readSetting } from './cms-styles/index.js';
|
|
11
4
|
export * from './cms-styles/index.js';
|
|
12
5
|
export { isNode, isComponentNode, isComponentNodeOfType, isStructureNode, isElementNode, } from './visual-builder/functions.js';
|
|
13
|
-
/**
|
|
14
|
-
* Fallback while RSC hasn't been moved from Canary to Main
|
|
15
|
-
*/
|
|
16
|
-
type ReactServerComponentType<P = any> = ComponentType<P> | ((props: P) => Promise<ReactNode>);
|
|
17
|
-
/**
|
|
18
|
-
* Wrapper function to turn context dependant components into easy to use
|
|
19
|
-
* server components
|
|
20
|
-
*
|
|
21
|
-
* @param component The component where the `ctx` parameter must be fulfilled
|
|
22
|
-
* @returns The component, without CTX parameter
|
|
23
|
-
*/
|
|
24
|
-
export declare function serverContextAware<P extends PropsWithContext>(component: ReactServerComponentType<P>): ComponentType<PropsWithOptionalContext<Omit<P, 'ctx'>>>;
|
|
25
|
-
/**
|
|
26
|
-
* Client side Optimizely CMS Editable
|
|
27
|
-
*/
|
|
28
|
-
export declare const CmsEditable: CmsEditableComponent;
|
|
29
|
-
/**
|
|
30
|
-
* Client side Optimizely CMS Content, leveraging the CMS Context to load the
|
|
31
|
-
* content type and content data when needed
|
|
32
|
-
*/
|
|
33
|
-
export declare const CmsContent: CmsContentComponent;
|
|
34
|
-
export type { CmsContentComponent, CmsContentProps } from './cms-content/rsc.js';
|
|
35
|
-
/**
|
|
36
|
-
* Client side Optimizely CMS Content Area, leveraging the CMS Context to infer
|
|
37
|
-
* the connection to Optimizely Graph and component dictionary.
|
|
38
|
-
*/
|
|
39
|
-
export declare const CmsContentArea: CmsContentAreaComponent;
|
|
40
|
-
export type { CmsContentAreaClassMapper, CmsContentAreaComponent, CmsContentAreaProps, ContentAreaItemDefinition, } from './cms-content-area/index.js';
|
|
41
|
-
/**
|
|
42
|
-
* Client side Optimizely Composition (e.g. Visual Builder), leveraging the CMS
|
|
43
|
-
* Context to infer the connection to Optimizely Graph and component
|
|
44
|
-
* dictionary.
|
|
45
|
-
*/
|
|
46
|
-
export declare const OptimizelyComposition: OptimizelyCompositionComponent;
|
|
47
|
-
/**
|
|
48
|
-
* Client side renderer for Rich Text
|
|
49
|
-
*/
|
|
50
|
-
export declare const RichText: RichTextComponent;
|
|
51
6
|
export type { RichTextComponent, RichTextProps, RichTextNode, StringNode, TypedNode, NodeInput, } from './rich-text/index.js';
|
|
52
7
|
export { DefaultComponents as RichTextComponentDictionary, createHtmlComponent, } from './rich-text/components.js';
|
|
53
8
|
export { isNodeInput, isNonEmptyString, isRichTextNode, isStringNode, isText, isTypedNode, } from './rich-text/utils.js';
|
package/dist/components/rsc.js
CHANGED
|
@@ -1,59 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import 'server-only';
|
|
3
|
-
import { getServerContext } from '../context/rsc.js';
|
|
4
|
-
import { cmsContentAware } from './cms-content/utils.js';
|
|
5
|
-
import { CmsContentArea as BaseContentArea, } from './cms-content-area/index.js'; // Both RSC & Client capable
|
|
6
|
-
import { CmsEditable as BaseEditable, } from './cms-editable/index.js'; // Both RSC & Client capable
|
|
7
|
-
import { CmsContent as BaseCmsContent, } from './cms-content/rsc.js'; // Different components for RSC & Client
|
|
8
|
-
import { OptimizelyComposition as BaseOptimizelyComposition, } from './visual-builder/index.js'; // Both RSC & Client capable
|
|
9
|
-
import { RichText as BaseRichText, } from './rich-text/index.js';
|
|
10
2
|
export { extractSettings, readSetting } from './cms-styles/index.js';
|
|
11
3
|
export * from './cms-styles/index.js';
|
|
12
4
|
// Visual Builder items
|
|
13
5
|
export { isNode, isComponentNode, isComponentNodeOfType, isStructureNode, isElementNode, } from './visual-builder/functions.js';
|
|
14
|
-
/**
|
|
15
|
-
* Wrapper function to turn context dependant components into easy to use
|
|
16
|
-
* server components
|
|
17
|
-
*
|
|
18
|
-
* @param component The component where the `ctx` parameter must be fulfilled
|
|
19
|
-
* @returns The component, without CTX parameter
|
|
20
|
-
*/
|
|
21
|
-
export function serverContextAware(component) {
|
|
22
|
-
const BaseComponent = component;
|
|
23
|
-
const ServerContextInjector = ({ ctx, ...props }) => {
|
|
24
|
-
if (!ctx)
|
|
25
|
-
console.error(`🔴 [ServerContextAware] Context for context aware component ${BaseComponent.displayName ?? BaseComponent.name ?? '[ANONYMOUS]'} is not defined!`);
|
|
26
|
-
const cmpCtx = ctx || getServerContext();
|
|
27
|
-
const componentProps = { ...props, ctx: cmpCtx };
|
|
28
|
-
return _jsx(BaseComponent, { ...componentProps });
|
|
29
|
-
};
|
|
30
|
-
ServerContextInjector.displayName = 'Server Context Injector';
|
|
31
|
-
return ServerContextInjector;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Client side Optimizely CMS Editable
|
|
35
|
-
*/
|
|
36
|
-
export const CmsEditable = serverContextAware(BaseEditable);
|
|
37
|
-
/**
|
|
38
|
-
* Client side Optimizely CMS Content, leveraging the CMS Context to load the
|
|
39
|
-
* content type and content data when needed
|
|
40
|
-
*/
|
|
41
|
-
export const CmsContent = serverContextAware(BaseCmsContent);
|
|
42
|
-
/**
|
|
43
|
-
* Client side Optimizely CMS Content Area, leveraging the CMS Context to infer
|
|
44
|
-
* the connection to Optimizely Graph and component dictionary.
|
|
45
|
-
*/
|
|
46
|
-
export const CmsContentArea = cmsContentAware(serverContextAware(BaseContentArea), CmsContent);
|
|
47
|
-
/**
|
|
48
|
-
* Client side Optimizely Composition (e.g. Visual Builder), leveraging the CMS
|
|
49
|
-
* Context to infer the connection to Optimizely Graph and component
|
|
50
|
-
* dictionary.
|
|
51
|
-
*/
|
|
52
|
-
export const OptimizelyComposition = cmsContentAware(serverContextAware(BaseOptimizelyComposition), CmsContent);
|
|
53
|
-
/**
|
|
54
|
-
* Client side renderer for Rich Text
|
|
55
|
-
*/
|
|
56
|
-
export const RichText = serverContextAware(BaseRichText);
|
|
57
6
|
export { DefaultComponents as RichTextComponentDictionary, createHtmlComponent, } from './rich-text/components.js';
|
|
58
7
|
export { isNodeInput, isNonEmptyString, isRichTextNode, isStringNode, isText, isTypedNode, } from './rich-text/utils.js';
|
|
59
8
|
//# sourceMappingURL=rsc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../../src/components/rsc.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../../src/components/rsc.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAepB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACpE,cAAc,uBAAuB,CAAA;AAErC,uBAAuB;AACvB,OAAO,EACL,MAAM,EACN,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,aAAa,GACd,MAAM,+BAA+B,CAAA;AAUtC,OAAO,EACL,iBAAiB,IAAI,2BAA2B,EAChD,mBAAmB,GACpB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,MAAM,EACN,WAAW,GACZ,MAAM,sBAAsB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GenericContext } from "../rsc.js";
|
|
2
|
-
import type { PropsWithChildren } from "react";
|
|
2
|
+
import type { PropsWithChildren, JSX } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Define an element as a React Component, React ExoticComponent or string name
|
|
5
5
|
* representing a HTML Element (e.g. "div", "a", etc...), this value can be used
|
|
@@ -47,9 +47,10 @@ export const defaultPropsFactory = (node) => {
|
|
|
47
47
|
if (!isContentType(contentType))
|
|
48
48
|
throw new Error("Invalid content type: " + JSON.stringify(contentType));
|
|
49
49
|
const contentLink = {
|
|
50
|
-
key: node.key || node.
|
|
50
|
+
key: node.component?._metadata?.key || node.key || undefined,
|
|
51
51
|
version: node.component?._metadata?.version,
|
|
52
|
-
locale: node.component?._metadata?.locale
|
|
52
|
+
locale: node.component?._metadata?.locale,
|
|
53
|
+
isInline: node.component?._metadata?.key ? false : true
|
|
53
54
|
};
|
|
54
55
|
if (!(isContentLink(contentLink) || isInlineContentLink(contentLink)))
|
|
55
56
|
throw new Error("Invalid content link: " + JSON.stringify(contentLink));
|
|
@@ -57,7 +58,7 @@ export const defaultPropsFactory = (node) => {
|
|
|
57
58
|
type: node.type,
|
|
58
59
|
layoutType: node.layoutType,
|
|
59
60
|
template: node.template,
|
|
60
|
-
settings: node.settings
|
|
61
|
+
settings: node.settings,
|
|
61
62
|
};
|
|
62
63
|
return [contentLink, contentType, node.component, layoutData];
|
|
63
64
|
};
|
|
@@ -76,8 +77,8 @@ export const defaultNodePropsFactory = (node) => {
|
|
|
76
77
|
["Node", "Content"],
|
|
77
78
|
["Node", "Component", "Content"]
|
|
78
79
|
].filter(x => x);
|
|
79
|
-
const contentLink = { key: node.key ?? '' };
|
|
80
|
-
const componentData = {};
|
|
80
|
+
const contentLink = { key: node.key ?? '', isInline: true };
|
|
81
|
+
const componentData = { __name: node.name };
|
|
81
82
|
const layoutData = {
|
|
82
83
|
type: node.type,
|
|
83
84
|
layoutType: node.layoutType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/components/visual-builder/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM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AAO,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentType, type PropsWithChildren } from "react";
|
|
1
|
+
import { type ComponentType, type PropsWithChildren, type JSX } from "react";
|
|
2
2
|
import { type InlineContentLinkWithLocale, type ContentLinkWithLocale } from "@remkoj/optimizely-graph-client";
|
|
3
3
|
import { type ContentType } from "../../types.js";
|
|
4
4
|
import { type PropsWithContext, type PropsWithOptionalContext } from "../../context/types.js";
|
package/dist/context/rsc.js
CHANGED
|
@@ -87,12 +87,14 @@ export class ServerContext {
|
|
|
87
87
|
this._editableIsExperience = isExperience;
|
|
88
88
|
}
|
|
89
89
|
toJSON(key) {
|
|
90
|
-
if (this.isDebugOrDevelopment) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
/*if (this.isDebugOrDevelopment) {
|
|
91
|
+
console.warn(
|
|
92
|
+
'🦺 [ServerContext] Converting Context to JSON, this is typically a side effect of the context being passed between Server & Client components'
|
|
93
|
+
)
|
|
94
|
+
if (this.isDebug) {
|
|
95
|
+
console.trace('The conversion happened here')
|
|
96
|
+
}
|
|
97
|
+
}*/
|
|
96
98
|
return {
|
|
97
99
|
inEditMode: this.inEditMode,
|
|
98
100
|
inPreviewMode: this.inPreviewMode,
|
package/dist/context/rsc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../../src/context/rsc.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,EACL,YAAY,EACZ,iBAAiB,GAGlB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AAC;AAOD,MAAM,gBAAgB,GAAqB,CACzC,OAAU,EACV,EAAE;IACF,IAAI,OAAO,EAAE,IAAI,aAAa,EAAE;QAC9B,OAAO,CAAC,IAAI,CACV,sGAAsG,CACvG,CAAA;IACH,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,sEAAsE;AACtE,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,gBAAgB,CAAqB,CAAA;AAEnE,MAAM,wBAAwB,GAAG,KAAK,CAAC,GAAG,EAAE;IAC1C,MAAM,GAAG,GAAG,IAAI,aAAa,CAAC,EAAE,CAAC,CAAA;IACjC,IAAI,GAAG,CAAC,OAAO;QAAE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAA;IACtE,OAAO,GAAG,CAAA;AACZ,CAAC,CAAC,CAAA;AACF,YAAY"}
|
package/dist/factory/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentType as ReactComponentType, ExoticComponent as ReactExoticComponent } from "react";
|
|
1
|
+
import type { ComponentType as ReactComponentType, ExoticComponent as ReactExoticComponent, JSX } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* Basic Component Type descriptor for the Component Factory
|
|
4
4
|
*/
|
package/dist/rsc.d.ts
CHANGED
package/dist/rsc.js
CHANGED
|
@@ -12,5 +12,6 @@ export * from './context/types.js';
|
|
|
12
12
|
// Export React Server Components
|
|
13
13
|
export * from './context/rsc.js';
|
|
14
14
|
export * from './components/rsc.js';
|
|
15
|
+
export * from './components/rsc-components.js';
|
|
15
16
|
export * from './rsc-utilities.js';
|
|
16
17
|
//# sourceMappingURL=rsc.js.map
|
package/dist/rsc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../src/rsc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,SAAS,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAA;AAExC,iBAAiB;AACjB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAElC,iCAAiC;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../src/rsc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,SAAS,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAA;AAExC,iBAAiB;AACjB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AACvC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAElC,iCAAiC;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export type ContentQueryProps<LocaleType = string> = ContentLink & {
|
|
|
39
39
|
locale?: Array<LocaleType> | LocaleType | null;
|
|
40
40
|
path?: string | null;
|
|
41
41
|
domain?: string | null;
|
|
42
|
+
changeset?: string | null;
|
|
42
43
|
};
|
|
43
44
|
/**
|
|
44
45
|
* Extract the data type from a GraphQL Query
|
|
@@ -47,7 +48,7 @@ export type ResponseDataType<T extends DocumentNode> = T extends TypedDocumentNo
|
|
|
47
48
|
[key: string]: any;
|
|
48
49
|
};
|
|
49
50
|
export type GetDataQuery<T> = () => TypedDocumentNode<T, ContentQueryProps> | DocumentNode;
|
|
50
|
-
export type GetDataFragment<T> = () => [string, TypedDocumentNode<T, never> | DocumentNode];
|
|
51
|
+
export type GetDataFragment<T> = () => [string, TypedDocumentNode<T, never> | DocumentNode | string];
|
|
51
52
|
export type WithGqlFragment<BaseComponent, DataType> = BaseComponent & {
|
|
52
53
|
getDataFragment: GetDataFragment<DataType>;
|
|
53
54
|
validateFragment?: (data: any) => data is DataType;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remkoj/optimizely-cms-react",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.0-pre1",
|
|
5
5
|
"repository": "https://github.com/remkoj/optimizely-dxp-clients.git",
|
|
6
6
|
"author": "Remko Jantzen <693172+remkoj@users.noreply.github.com>",
|
|
7
7
|
"homepage": "https://github.com/remkoj/optimizely-dxp-clients/tree/main/packages/optimizely-cms-react",
|
|
@@ -13,50 +13,44 @@
|
|
|
13
13
|
],
|
|
14
14
|
"exports": {
|
|
15
15
|
".": "./dist/index.js",
|
|
16
|
-
"./components": "./dist/components.js",
|
|
17
16
|
"./rsc": "./dist/rsc.js"
|
|
18
17
|
},
|
|
19
18
|
"typesVersions": {
|
|
20
19
|
"*": {
|
|
21
|
-
"components": [
|
|
22
|
-
"dist/components.d.ts"
|
|
23
|
-
],
|
|
24
20
|
"rsc": [
|
|
25
21
|
"dist/rsc.d.ts"
|
|
26
22
|
]
|
|
27
23
|
}
|
|
28
24
|
},
|
|
29
25
|
"devDependencies": {
|
|
30
|
-
"@remkoj/optimizely-graph-client": "
|
|
26
|
+
"@remkoj/optimizely-graph-client": "6.0.0-pre1",
|
|
31
27
|
"@types/crypto-js": "^4.2.2",
|
|
32
|
-
"@types/node": "^22.
|
|
33
|
-
"@types/react": "^
|
|
34
|
-
"@types/react-dom": "
|
|
35
|
-
"entities": "^6.0.0",
|
|
36
|
-
"graphql": "^16.11.0",
|
|
37
|
-
"graphql-request": "^6.1.0",
|
|
28
|
+
"@types/node": "^22.16.0",
|
|
29
|
+
"@types/react": "^19.1.8",
|
|
30
|
+
"@types/react-dom": "^19.1.6",
|
|
38
31
|
"prop-types": "^15.8.1",
|
|
39
|
-
"react": "^
|
|
40
|
-
"react-dom": "^
|
|
41
|
-
"scheduler": "^0.
|
|
32
|
+
"react": "^19.1.0",
|
|
33
|
+
"react-dom": "^19.1.0",
|
|
34
|
+
"scheduler": "^0.26.0",
|
|
42
35
|
"typescript": "^5.8.3"
|
|
43
36
|
},
|
|
44
37
|
"dependencies": {
|
|
45
38
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
46
|
-
"
|
|
39
|
+
"@remkoj/optimizely-graph-client": "^6.0.0-pre1",
|
|
40
|
+
"crypto-js": "^4.2.0",
|
|
41
|
+
"entities": "^6.0.1",
|
|
42
|
+
"graphql": "^16.11.0",
|
|
43
|
+
"graphql-request": "^7.2.0"
|
|
47
44
|
},
|
|
48
45
|
"peerDependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"graphql": "^16",
|
|
52
|
-
"graphql-request": "^6",
|
|
53
|
-
"react": "^18",
|
|
54
|
-
"react-dom": "^18"
|
|
46
|
+
"react": "^19",
|
|
47
|
+
"react-dom": "^19"
|
|
55
48
|
},
|
|
56
49
|
"scripts": {
|
|
57
50
|
"clean": "tsc --build --clean",
|
|
58
51
|
"prepare": "yarn tsc --build --force",
|
|
59
52
|
"watch": "tsc --watch",
|
|
60
53
|
"recompile": "tsc --build --clean && tsc --build --force"
|
|
61
|
-
}
|
|
54
|
+
},
|
|
55
|
+
"stableVersion": "5.1.0"
|
|
62
56
|
}
|
package/dist/components.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been
|
|
6
|
-
* deprecated, use either `@remkoj/optimizely-cms-react` or
|
|
7
|
-
* `@remkoj/optimizely-cms-react/rsc`, dependingn on your context
|
|
8
|
-
*/
|
|
9
|
-
export declare const RichText: import("react").ComponentType<import("./rsc.js").PropsWithOptionalContext<Omit<import("./components/rich-text/types.js").RichTextImplProps<import("./components/type-utils.js").ElementWithChildrenType>, "ctx">>>;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
12
|
-
*/
|
|
13
|
-
export { DefaultComponents, DefaultTextNode, createHtmlComponent } from "./components/rich-text/components.js";
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
16
|
-
*/
|
|
17
|
-
export * as Utils from "./components/rich-text/utils.js";
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
20
|
-
*/
|
|
21
|
-
export type * from "./components/rich-text/types.js";
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
24
|
-
*/
|
|
25
|
-
export type { BaseStyleDefinition, ElementStyleDefinition, LayoutProps, LayoutPropsSetting, LayoutPropsSettingChoices, LayoutPropsSettingKeys, LayoutPropsSettingValues, NodeStyleDefinition, StyleDefinition, StyleSetting } from "./components/cms-styles/index.js";
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
28
|
-
*/
|
|
29
|
-
export { extractSettings, readSetting } from "./components/cms-styles/index.js";
|
package/dist/components.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
3
|
-
*/
|
|
4
|
-
import { RichText as BaseRichText } from "./components/rich-text/index.js";
|
|
5
|
-
import { serverContextAware } from "./rsc.js";
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been
|
|
8
|
-
* deprecated, use either `@remkoj/optimizely-cms-react` or
|
|
9
|
-
* `@remkoj/optimizely-cms-react/rsc`, dependingn on your context
|
|
10
|
-
*/
|
|
11
|
-
export const RichText = serverContextAware(BaseRichText);
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
14
|
-
*/
|
|
15
|
-
export { DefaultComponents, DefaultTextNode, createHtmlComponent } from "./components/rich-text/components.js";
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
18
|
-
*/
|
|
19
|
-
export * as Utils from "./components/rich-text/utils.js";
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated The `@remkoj/optimizely-cms-react/components` export has been deprecated
|
|
22
|
-
*/
|
|
23
|
-
export { extractSettings, readSetting } from "./components/cms-styles/index.js";
|
|
24
|
-
//# sourceMappingURL=components.js.map
|
package/dist/components.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAA;AACxD;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAC9G;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,iCAAiC,CAAA;AASxD;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA"}
|