@remkoj/optimizely-cms-react 3.0.0 → 3.1.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.
- package/README.md +3 -1
- package/dist/components/cms-content/client.d.ts +1 -1
- package/dist/components/cms-content/client.js +2 -2
- package/dist/components/cms-content/client.js.map +1 -1
- package/dist/components/cms-content/resolve-component.d.ts +1 -1
- package/dist/components/cms-content/resolve-component.js +5 -5
- package/dist/components/cms-content/resolve-component.js.map +1 -1
- package/dist/components/cms-content/rsc.d.ts +1 -1
- package/dist/components/cms-content/rsc.js +2 -2
- package/dist/components/cms-content/rsc.js.map +1 -1
- package/dist/components/cms-content/types.d.ts +5 -0
- package/dist/components/cms-content-area/index.d.ts +1 -1
- package/dist/components/cms-content-area/index.js +20 -11
- package/dist/components/cms-content-area/index.js.map +1 -1
- package/dist/components/cms-content-area/types.d.ts +24 -0
- package/dist/components/rich-text/components.js +2 -1
- package/dist/components/rich-text/components.js.map +1 -1
- package/dist/components/rich-text/index.js +7 -6
- package/dist/components/rich-text/index.js.map +1 -1
- package/dist/components/rich-text/types.d.ts +5 -0
- package/dist/factory/default.d.ts +1 -0
- package/dist/factory/default.js +1 -1
- package/dist/factory/default.js.map +1 -1
- package/dist/factory/index.d.ts +5 -0
- package/dist/factory/index.js +6 -1
- package/dist/factory/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/rsc.d.ts +1 -1
- package/dist/rsc.js +1 -1
- package/dist/utilities.d.ts +23 -9
- package/dist/utilities.js +22 -1
- package/dist/utilities.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Regardless of which export you're using, the following components are available.
|
|
|
14
14
|
|
|
15
15
|
| Component/Function | Description |
|
|
16
16
|
| --- | --- |
|
|
17
|
-
| `<CmsContent {...props} />` | This component renders a content item from the Optimizely CMS.<br/>It leverages the factory provided by the context to resolve the Optimizely CMS type to a React Component.<br/>When no, or invalid, initial data is provided, this component will use the connection to Optimizely Graph from the context to fetch the data for the component |
|
|
17
|
+
| `<CmsContent {...props} />` | This component renders a content item from the Optimizely CMS.<br/>It leverages the factory provided by the context to resolve the Optimizely CMS type to a React Component.<br/>When no, or invalid, initial data is provided, this component will use the connection to Optimizely Graph from the context to fetch the data for the component.<br/><br/>The CmsComponent has two specific properties that enable an implementor to control the component resolution:<br/>- `contentTypePrefix`: Enforce the prefix of the content type, for example 'component', which will ensure that the component will be resolved as 'component'.<br/>- `variant`: Allows setting of a preferred postfix of the content type, but will fall-back to the main component if not found in the factory.<br/>- `noDataLoad`: When set to `true`, it will not load data - even when omitted. |
|
|
18
18
|
| `<CmsContentArea {...props} />` | A helper component to quickly and easily render the contents of a Content Area type property in Optimizely CMS.<br /><br />The Content Area leverages the `<CmsContent />` internally to render each item contained within the area. It ensures that the prefix is `component`, forcing a different component to be used when a "non-component" (e.g. a page) is added to the content-area |
|
|
19
19
|
| `<CmsEditable {...props} />` | This is a basic wrapper that performs the logic needed to inject the appropriate attributes into the HTML. <br/>It will use a `div` element by default for that, but you can set any React component to be used on the `as` property. The only requirement is that the property set for this accepts the `data-*` attributes injected and outputs these into the page. Any additional attributes will be passed to the output component. |
|
|
20
20
|
| `<RichText {...props} />` | This is a renderer for the structured HTML output of Optimizely CMS, leveraging the `ComponentFactory` to resolve the actual React components used for the output. It prefixes all types with `RichText`<br/>The library exports a `DefaultComponents` constant, which can be used to populate the ComponentFactory with the basic HTML elements |
|
|
@@ -26,6 +26,8 @@ In addition to the components above, the following methods are available in the
|
|
|
26
26
|
| Component / Function | Description |
|
|
27
27
|
| --- | --- |
|
|
28
28
|
| `getServerContext()` | Retrieve the current server context in use, this leverages `React.cache` to ensure a single context is used within the cache scope defined by your React Server implementation |
|
|
29
|
+
| `isDebug()` | Test if the environment variables flag the current environment to be in debug mode. |
|
|
30
|
+
| `isDevelopment()` | Test if the environment variables flag the current environment to be a developer environment. |
|
|
29
31
|
|
|
30
32
|
### Client Side components & functions
|
|
31
33
|
In addition to the components above, the following methods are available in the `@remkoj/optimizely-cms-react` export only:
|
|
@@ -7,5 +7,5 @@ export type * from "./types.js";
|
|
|
7
7
|
* @param param0
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function CmsContent<LocalesType = string>({ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentData, layoutProps, noDataLoad, 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;
|
|
@@ -14,12 +14,12 @@ 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, 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
|
-
const Component = useMemo(() => resolveComponent(myContentType, contentTypePrefix, ctx), [myContentType, contentTypePrefix, ctx]);
|
|
22
|
+
const Component = useMemo(() => resolveComponent(myContentType, contentTypePrefix, variant, ctx), [myContentType, variant, contentTypePrefix, ctx]);
|
|
23
23
|
const [data, setData] = useState(getContent(graphClient, contentLink, Component, fragmentData, true));
|
|
24
24
|
// Provide a bit of debugging context
|
|
25
25
|
if (graphClient?.debug) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/components/cms-content/client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AAW,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAA;YAC9F,OAAM;QACV,CAAC;QACD,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YACzE,IAAI,CAAC,WAAW;gBAAE,OAAO,CAAC,OAAO,CAAC,CAAA;QACtC,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,EAAE;YACR,WAAW,GAAG,IAAI,CAAA;QACtB,CAAC,CAAA;IACL,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAA;IAEnE,IAAI,2BAA2B,CAAC,SAAS,CAAC;QACtC,OAAO,KAAC,SAAS,KAAG,CAAA;IACxB,OAAO,KAAC,SAAS,IAAC,WAAW,EAAG,WAA0B,EAAG,IAAI,EAAG,IAAI,EAAG,UAAU,EAAG,GAAG,CAAC,UAAU,EAAG,WAAW,EAAG,WAAW,YAAK,QAAQ,GAAa,CAAA;AAChK,CAAC;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -10,7 +10,7 @@ import { type FunctionComponent, type PropsWithChildren, type ComponentType } fr
|
|
|
10
10
|
* @param ctx The context in which to operate
|
|
11
11
|
* @returns The component required for rendering
|
|
12
12
|
*/
|
|
13
|
-
export declare function resolveComponent(contentType: ComponentTypeHandle | null | undefined, prefix: string | null | undefined, ctx: GenericContext): EnhancedCmsComponent | ComponentMissingComponent;
|
|
13
|
+
export declare function resolveComponent(contentType: ComponentTypeHandle | null | undefined, prefix: string | null | undefined, variant: string | null | undefined, ctx: GenericContext): EnhancedCmsComponent | ComponentMissingComponent;
|
|
14
14
|
export default resolveComponent;
|
|
15
15
|
export type ComponentMissingComponent = FunctionComponent<PropsWithChildren> & {
|
|
16
16
|
displayName: 'Opti::ComponentMissing';
|
|
@@ -8,7 +8,7 @@ import * as Utils from "../../utilities.js";
|
|
|
8
8
|
* @param ctx The context in which to operate
|
|
9
9
|
* @returns The component required for rendering
|
|
10
10
|
*/
|
|
11
|
-
export function resolveComponent(contentType, prefix, ctx) {
|
|
11
|
+
export function resolveComponent(contentType, prefix, variant, ctx) {
|
|
12
12
|
const { factory, isDebug, inEditMode } = ctx;
|
|
13
13
|
// Ensure we have a factory - we should, but lets' help by providing an explicit error
|
|
14
14
|
if (!factory) {
|
|
@@ -16,9 +16,9 @@ export function resolveComponent(contentType, prefix, ctx) {
|
|
|
16
16
|
throw new Error("Empty factory on the context");
|
|
17
17
|
}
|
|
18
18
|
// Optimizely Graph stores the type in Most Significant first order, we need least significant first, also we're stripping out the common "Content" item from it
|
|
19
|
-
const myContentType =
|
|
20
|
-
Utils.normalizeAndPrefixContentType(contentType.reverse(), prefix) :
|
|
21
|
-
Utils.normalizeContentType(contentType.reverse(), true)
|
|
19
|
+
const myContentType = prefix ?
|
|
20
|
+
Utils.normalizeAndPrefixContentType(Array.isArray(contentType) ? [...contentType].reverse() : contentType, prefix) :
|
|
21
|
+
Utils.normalizeContentType(Array.isArray(contentType) ? [...contentType].reverse() : contentType, true);
|
|
22
22
|
// Validate that we have a value to ask the factory a component for
|
|
23
23
|
if (!myContentType || myContentType.length == 0) {
|
|
24
24
|
if (isDebug)
|
|
@@ -26,7 +26,7 @@ export function resolveComponent(contentType, prefix, ctx) {
|
|
|
26
26
|
throw new Error(`The content type ${JSON.stringify(contentType)}, with prefix ${JSON.stringify(prefix)} yielded an empty normalized type`);
|
|
27
27
|
}
|
|
28
28
|
// Resolve component
|
|
29
|
-
const Component =
|
|
29
|
+
const Component = Utils.resolveComponentType(factory, myContentType, variant ? [variant] : []);
|
|
30
30
|
// Handle component not found in factory
|
|
31
31
|
if (!Component) {
|
|
32
32
|
const contentTypeDisplay = Array.isArray(myContentType) ? myContentType.join('/') : myContentType;
|
|
@@ -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;AAI3C;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmD,EAAE,MAAiC,EAAE,GAAmB;
|
|
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;AAI3C;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmD,EAAE,MAAiC,EAAE,OAAkC,EAAE,GAAmB;IAE5K,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;IAE5C,sFAAsF;IACtF,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAA;QAClF,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACnD,CAAC;IAED,gKAAgK;IAChK,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC;QACtB,KAAK,CAAC,6BAA6B,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;QACpH,KAAK,CAAC,oBAAoB,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IAE/G,mEAAmE;IACnE,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC9C,IAAI,OAAO;YACP,OAAO,CAAC,KAAK,CAAC,oCAAqC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAE,iBAA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;AAED,eAAe,gBAAgB,CAAA;AAM/B,MAAM,UAAU,2BAA2B,CAAC,MAA6C;IAErF,OAAO,MAAM,EAAE,WAAW,IAAI,wBAAwB,CAAA;AAC1D,CAAC"}
|
|
@@ -7,5 +7,5 @@ export type * from "./types.js";
|
|
|
7
7
|
* @param param0
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function CmsContent<LocalesType = string>({ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentData, layoutProps, noDataLoad, ctx }: BaseCmsContentProps<LocalesType>): Promise<ReactNode>;
|
|
10
|
+
export declare function CmsContent<LocalesType = string>({ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentData, layoutProps, noDataLoad, variant, ctx }: BaseCmsContentProps<LocalesType>): Promise<ReactNode>;
|
|
11
11
|
export default CmsContent;
|
|
@@ -12,7 +12,7 @@ import resolveContentType from './resolve-content-type.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export async function CmsContent({
|
|
14
14
|
// Own properties
|
|
15
|
-
contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentData, layoutProps, noDataLoad, ctx }) {
|
|
15
|
+
contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentData, layoutProps, noDataLoad, variant, ctx }) {
|
|
16
16
|
// Prepare context
|
|
17
17
|
const graphClient = ctx.client;
|
|
18
18
|
// Normalize the ContentLink
|
|
@@ -38,7 +38,7 @@ contentType, contentTypePrefix, contentLink: rawContentLink, children, fragmentD
|
|
|
38
38
|
console.warn(`🟠 [CmsContent] ${mode} mode active without an authenticated graphClient, this will cause problems. Make sure the context has an authenticated client.`);
|
|
39
39
|
}
|
|
40
40
|
// Retrieve the Component used to render this item
|
|
41
|
-
const Component = resolveComponent(myContentType, contentTypePrefix, ctx);
|
|
41
|
+
const Component = resolveComponent(myContentType, contentTypePrefix, variant, ctx);
|
|
42
42
|
if (isComponentMissingComponent(Component))
|
|
43
43
|
return _jsx(Component, {});
|
|
44
44
|
// Ensure we have the data the Component requested
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc.js","sourceRoot":"","sources":["../../../src/components/cms-content/rsc.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,MAAM,uBAAuB,CAAA;AAClD,OAAO,UAAU,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,mBAAmB,EAAoB,MAAM,iCAAiC,CAAA;AACvH,OAAO,gBAAgB,EAAE,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AACtF,OAAO,kBAAkB,MAAM,2BAA2B,CAAA;AAI1D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAuB;AACnD,iBAAiB;AACjB,WAAW,EACX,iBAAiB,EACjB,WAAW,EAAE,cAAc,EAC3B,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,UAAU,EACV,GAAG,EAC6B;IAEhC,kBAAkB;IAClB,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAA;IAE9B,4BAA4B;IAC5B,MAAM,WAAW,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAA;IAExD,iCAAiC;IACjC,IAAI,aAAa,GAAG,kBAAkB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;IACjE,IAAI,CAAC,aAAa,EAAE,CAAC;QACjB,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAA;YACjG,OAAM;QACV,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAA;YACtF,OAAM;QACV,CAAC;QACD,aAAa,GAAG,MAAM,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;IAClE,CAAC;IAED,qCAAqC;IACrC,IAAI,WAAW,EAAE,KAAK,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC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,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;IAE5F,8BAA8B;IAC9B,OAAO,KAAC,SAAS,IAAC,WAAW,EAAG,WAA0B,EAAG,IAAI,EAAG,IAAI,EAAG,UAAU,EAAG,GAAG,CAAC,UAAU,EAAG,WAAW,EAAG,WAAW,YAAK,QAAQ,GAAa,CAAA;AAChK,CAAC;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -32,6 +32,11 @@ export type CmsContentProps<LocalesType = string> = PropsWithChildren<{
|
|
|
32
32
|
* it will not be applied.
|
|
33
33
|
*/
|
|
34
34
|
contentTypePrefix?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The content type variant to load. This allows the loading of a variant (e.g. postfix) of
|
|
37
|
+
* the content type
|
|
38
|
+
*/
|
|
39
|
+
variant?: string;
|
|
35
40
|
/**
|
|
36
41
|
* Any layout properties inferred from the context
|
|
37
42
|
*/
|
|
@@ -7,7 +7,7 @@ export type { CmsContentAreaClassMapper, CmsContentAreaProps, ContentAreaItemDef
|
|
|
7
7
|
* @param param0 The content area information for rendering
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare const CmsContentArea: <T extends ElementType = "div", I extends ElementType = "div">({ items, classMapper, className, fieldName, as: elementType, itemsProperty, itemWrapper, ctx, cmsContent: CmsContent, ...additionalProps }: BaseCmsContentAreaProps<T, I>) => JSX.Element;
|
|
10
|
+
export declare const CmsContentArea: <T extends ElementType = "div", I extends ElementType = "div">({ items, classMapper, className, fieldName, as: elementType, itemsProperty, itemWrapper, useSuspense, fallback, noWrapper: noContentAreaContainer, variant, ctx, cmsContent: CmsContent, ...additionalProps }: BaseCmsContentAreaProps<T, I>) => JSX.Element;
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
13
|
* @param items
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as Utils from '../../utilities.js';
|
|
3
3
|
import * as Errors from '../../errors.js';
|
|
4
4
|
import { normalizeContentLinkWithLocale, contentLinkToString } from '@remkoj/optimizely-graph-client/utils';
|
|
5
|
+
import { Suspense } from 'react';
|
|
5
6
|
//#endregion
|
|
6
7
|
/**
|
|
7
8
|
* React server component to render a content area
|
|
@@ -9,11 +10,10 @@ import { normalizeContentLinkWithLocale, contentLinkToString } from '@remkoj/opt
|
|
|
9
10
|
* @param param0 The content area information for rendering
|
|
10
11
|
* @returns
|
|
11
12
|
*/
|
|
12
|
-
export const CmsContentArea = ({ items, classMapper, className, fieldName, as: elementType, itemsProperty, itemWrapper, ctx, cmsContent: CmsContent, ...additionalProps }) => {
|
|
13
|
+
export const CmsContentArea = ({ items = [], classMapper, className, fieldName, as: elementType, itemsProperty, itemWrapper, useSuspense = false, fallback, noWrapper: noContentAreaContainer = false, variant, ctx, cmsContent: CmsContent, ...additionalProps }) => {
|
|
13
14
|
const { inEditMode = false } = ctx;
|
|
14
15
|
// Convert the items to a list of enriched content types and filter out items cannot be loaded
|
|
15
|
-
const
|
|
16
|
-
const componentData = actualItems.map((item, idx) => {
|
|
16
|
+
const componentData = (items || []).filter(forValidContentAreaItems).map((item, idx) => {
|
|
17
17
|
// Prepare data from received content area format
|
|
18
18
|
const contentLink = normalizeContentLinkWithLocale(item._metadata);
|
|
19
19
|
if (!contentLink)
|
|
@@ -21,31 +21,40 @@ export const CmsContentArea = ({ items, classMapper, className, fieldName, as: e
|
|
|
21
21
|
const contentType = Utils.normalizeContentType(item._metadata.types);
|
|
22
22
|
const fragmentData = item;
|
|
23
23
|
// Read element wrapper configuration
|
|
24
|
-
const { as:
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const { as: ContentAreaItemContainer = "div", className: contentItemBaseClassName, itemsProperty: childrenTarget = "children", noWrapper: noContentAreaItemContainer = false, ...contentItemElementProps } = itemWrapper ?? {};
|
|
25
|
+
const contentAreaItemKey = `ContentAreaItem-${idx}-${contentLinkToString(contentLink)}`;
|
|
26
|
+
// Output if no wrapper is required
|
|
27
|
+
if (noContentAreaItemContainer)
|
|
28
|
+
return useSuspense ?
|
|
29
|
+
_jsx(Suspense, { fallback: fallback, children: _jsx(CmsContent, { contentLink: contentLink, contentType: contentType, fragmentData: fragmentData, contentTypePrefix: "Component", variant: variant }) }, contentAreaItemKey) :
|
|
30
|
+
_jsx(CmsContent, { contentLink: contentLink, contentType: contentType, fragmentData: fragmentData, contentTypePrefix: "Component", variant: variant }, contentAreaItemKey);
|
|
31
|
+
// Buld wrapper configuration
|
|
27
32
|
const contentAreaItemContainerProps = {
|
|
28
33
|
className: `opti-content-area-item opti-content-area-item-${idx}${contentItemBaseClassName ? ' ' + contentItemBaseClassName : ''} ${classMapper ? classMapper(item.displayOption ?? 'default', contentType ?? null, idx) : ""}`,
|
|
29
34
|
"data-epi-block-id": inEditMode && fieldName ? Utils.getContentEditId(contentLink) || undefined : undefined,
|
|
30
35
|
"data-displayoption": item.displayOption || undefined,
|
|
31
36
|
"data-tag": item.tag || undefined,
|
|
37
|
+
"data-component": contentType?.at(0),
|
|
32
38
|
...contentItemElementProps
|
|
33
39
|
};
|
|
34
|
-
const contentAraeItemContent =
|
|
40
|
+
const contentAraeItemContent = useSuspense ?
|
|
41
|
+
_jsx(Suspense, { fallback: fallback, children: _jsx(CmsContent, { contentLink: contentLink, contentType: contentType, fragmentData: fragmentData, contentTypePrefix: "Component", variant: variant }) }) :
|
|
42
|
+
_jsx(CmsContent, { contentLink: contentLink, contentType: contentType, fragmentData: fragmentData, contentTypePrefix: "Component", variant: variant });
|
|
35
43
|
// Inject the element into the wrapper
|
|
36
|
-
const childrenTarget = contentItemTarget || "children";
|
|
37
44
|
let contentAreaItemContainerChildren = undefined;
|
|
38
45
|
if (childrenTarget == "children")
|
|
39
46
|
contentAreaItemContainerChildren = contentAraeItemContent;
|
|
40
47
|
else
|
|
41
48
|
contentAreaItemContainerProps[childrenTarget] = contentAraeItemContent;
|
|
42
|
-
|
|
43
|
-
return _jsx(ContentAreaItemContainer, { ...contentAreaItemContainerProps, children: contentAreaItemContainerChildren }, contentAreaItemContainerKey);
|
|
49
|
+
return _jsx(ContentAreaItemContainer, { ...contentAreaItemContainerProps, children: contentAreaItemContainerChildren }, contentAreaItemKey);
|
|
44
50
|
});
|
|
51
|
+
if (noContentAreaContainer)
|
|
52
|
+
return _jsx(_Fragment, { children: componentData });
|
|
45
53
|
// Build container element
|
|
46
54
|
const contentAreaContainerProps = {
|
|
47
55
|
className: `opti-content-area ${Array.isArray(className) ? className.join(' ') : (className ?? '')}`.trim(),
|
|
48
56
|
"data-epi-edit": inEditMode && fieldName ? fieldName : undefined,
|
|
57
|
+
"data-component": "ContentArea",
|
|
49
58
|
...additionalProps
|
|
50
59
|
};
|
|
51
60
|
const contentAreaContainerChildrenTarget = itemsProperty ?? "children";
|
|
@@ -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,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;
|
|
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,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAE3G,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIhC,YAAY;AAEZ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAA+D,EACzF,KAAK,GAAG,EAAE,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,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G,IAAI,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,QAAQ,IAAI,GAAG,CAAC,SAAS,IAAI,IAAI,CAAA;AAChH,CAAC;AAED;;;;;GAKG;AACH;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAe,cAAc,CAAA"}
|
|
@@ -50,6 +50,11 @@ export type CmsContentAreaProps<T extends ElementType, CT extends ElementType> =
|
|
|
50
50
|
* The CSS Class to apply to the content area container
|
|
51
51
|
*/
|
|
52
52
|
className?: MayBeArray<PropTypeIfPropExists<T, "className">>;
|
|
53
|
+
/**
|
|
54
|
+
* Whether or not a suspense must be applied around each item of the
|
|
55
|
+
* ContentArea to allow dynamic content within the ContentArea items.
|
|
56
|
+
*/
|
|
57
|
+
useSuspense?: boolean;
|
|
53
58
|
/**
|
|
54
59
|
* The fallback component to use as suspense boundary
|
|
55
60
|
*/
|
|
@@ -63,11 +68,30 @@ export type CmsContentAreaProps<T extends ElementType, CT extends ElementType> =
|
|
|
63
68
|
* The HTML element, or React Component to use to render the Content Area Container
|
|
64
69
|
*/
|
|
65
70
|
as?: T;
|
|
71
|
+
/**
|
|
72
|
+
* If set to true, there will be no wrapping element around the
|
|
73
|
+
* items in the Content Area. Setting this to `true` ignores
|
|
74
|
+
*/
|
|
75
|
+
noWrapper?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Allows requesting of specific template variant, to accomodate different
|
|
78
|
+
* renditions, without changing the main path of the component.
|
|
79
|
+
*/
|
|
80
|
+
variant?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Configure the wrapper around each item within the ContentArea
|
|
83
|
+
*/
|
|
66
84
|
itemWrapper?: ({
|
|
67
85
|
/**
|
|
68
86
|
* Override the element type used to wrap the CMS Content Item
|
|
69
87
|
*/
|
|
70
88
|
as?: CT;
|
|
89
|
+
/**
|
|
90
|
+
* If set to true, there will be no wrapping element around the
|
|
91
|
+
* CmsContent used to render the item. Setting this to `true`
|
|
92
|
+
* ignores all other `itemWrapper` properties.
|
|
93
|
+
*/
|
|
94
|
+
noWrapper?: boolean;
|
|
71
95
|
/**
|
|
72
96
|
* The CSS Class to apply to the content area item wrapper
|
|
73
97
|
*/
|
|
@@ -58,6 +58,7 @@ export const DefaultComponents = [
|
|
|
58
58
|
{ type: 'RichText/br', component: createHtmlComponent("br", true) },
|
|
59
59
|
{ type: 'RichText/bulleted-list', component: createHtmlComponent("ul") },
|
|
60
60
|
{ type: 'RichText/numbered-list', component: createHtmlComponent("ol") },
|
|
61
|
-
{ type: 'RichText/list-item', component: createHtmlComponent("li") }
|
|
61
|
+
{ type: 'RichText/list-item', component: createHtmlComponent("li") },
|
|
62
|
+
{ type: 'RichText/address', component: createHtmlComponent("address") }
|
|
62
63
|
];
|
|
63
64
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../../src/components/rich-text/components.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,yBAAyB;AACzB,MAAM,UAAU,mBAAmB,CAAwC,OAAU,EAAE,iBAA0B,KAAK,EAAE,YAA+D;IAEnL,MAAM,WAAW,GAAG,OAAiB,CAAA;IACrC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAC,OAAO,EAAC,UAAU,EAAC,MAAM,CAAC,CAAA;IACvD,MAAM,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,EAAsE,EAAE,EAAE;QACnH,MAAM,SAAS,GAA8C,EAAE,CAAA;QAC/D,MAAM,WAAW,GAAG,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAA2B,CAAA;QAC9E,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GA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;IAC7D,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAC;IACtE,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAC;IACpD,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAC;IAClE,EAAE,IAAI,EAAE,wBAAwB,EAAE,SAAS,EAAE,mBAAmB,CAAC,IAAI,CAAC,EAAC;IACvE,EAAE,IAAI,EAAE,wBAAwB,EAAE,SAAS,EAAE,mBAAmB,CAAC,IAAI,CAAC,EAAC;IACvE,EAAE,IAAI,EAAE,oBAAoB,EAAE,SAAS,EAAE,mBAAmB,CAAC,IAAI,CAAC,EAAC;IACnE,EAAE,IAAI,EAAE,kBAAkB,EAAE,SAAS,EAAE,mBAAmB,CAAC,SAAS,CAAC,EAAC;CACzE,CAAA"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as Utils from './utils.js';
|
|
3
3
|
import { DefaultComponentFactory } from "../../factory/default.js";
|
|
4
4
|
import { DefaultComponents, DefaultTextNode, createHtmlComponent } from "./components.js";
|
|
5
5
|
export * from "./types.js";
|
|
6
|
-
export const RichText = ({ factory, text, className = 'rich-text', as: Wrapper = "div", debug, ...props }) => {
|
|
6
|
+
export const RichText = ({ factory, text = "{ \"type\": \"richText\" }", className = 'rich-text', as: Wrapper = "div", debug = false, noWrapper = false, ...props }) => {
|
|
7
7
|
const id = Utils.getRandomId("rich-text");
|
|
8
8
|
const richTextFactory = factory ?? new DefaultComponentFactory(DefaultComponents);
|
|
9
9
|
try {
|
|
10
10
|
const data = Utils.processNodeInput(text);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const textContent = (data?.children || []).map((child, idx) => {
|
|
12
|
+
const elementId = id + '::' + idx;
|
|
13
|
+
return _jsx(RichTextElement, { factory: richTextFactory, node: child, idPrefix: elementId + '::' }, elementId);
|
|
14
|
+
});
|
|
15
|
+
return noWrapper ? _jsx(_Fragment, { children: textContent }) : _jsx(Wrapper, { className: className, ...props, children: textContent });
|
|
15
16
|
}
|
|
16
17
|
catch {
|
|
17
18
|
if (debug)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/rich-text/index.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAEzF,cAAc,YAAY,CAAA;AAE1B,MAAM,CAAC,MAAM,QAAQ,GAAsC,CAAC,EACxD,OAAO,EACP,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/rich-text/index.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAEzF,cAAc,YAAY,CAAA;AAE1B,MAAM,CAAC,MAAM,QAAQ,GAAsC,CAAC,EACxD,OAAO,EACP,IAAI,GAAG,4BAA4B,EACnC,SAAS,GAAG,WAAW,EACvB,EAAE,EAAG,OAAO,GAAG,KAAK,EACpB,KAAK,GAAG,KAAK,EACb,SAAS,GAAG,KAAK,EACjB,GAAG,KAAK,EACX,EAAE,EAAE;IACD,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;IACzC,MAAM,eAAe,GAAG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
|
|
24
24
|
*/
|
|
25
25
|
debug?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If set to true, the output will be wrapped in a Fragment and no properties
|
|
28
|
+
* will be set on the Fragment to prevent React errors.
|
|
29
|
+
*/
|
|
30
|
+
noWrapper?: boolean;
|
|
26
31
|
} & ({
|
|
27
32
|
/**
|
|
28
33
|
* The fieldname of this Rich Text, when it is used as part of a block
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentFactory, ComponentType, ComponentTypeHandle, ComponentTypeDictionary } from './types.js';
|
|
2
|
+
export declare const MERGE_SYMBOL = "/";
|
|
2
3
|
export declare const EmptyComponentHandle = "$$fragment$$";
|
|
3
4
|
/**
|
|
4
5
|
* The default implementation of the ComponentFactory interface, which works both
|
package/dist/factory/default.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/factory/default.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAG,GAAG,CAAA;
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/factory/default.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;AAE/B,MAAM,CAAC,MAAM,oBAAoB,GAAI,cAAc,CAAA;AAEnD;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAIhC;;;;;OAKG;IACH,YAAmB,iBAA2C;QATtD,aAAQ,GAA2C,EAAE,CAAA;QAWzD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAA;QAC9C,IAAI,iBAAiB;YACjB,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAA;IAC3C,CAAC;IAED,QAAQ,CAAC,IAAyB,EAAE,SAAwB;QAExD,IAAI,GAAG,0BAA0B,CAAC,IAAI,CAAC,CAAA;QACvC,IAAI,IAAI,CAAC,GAAG;YAAE,OAAO,CAAC,GAAG,CAAC,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,CAAA;IACpB,CAAC;CACJ;AAED,SAAS,0BAA0B,CAAC,MAA2B;IAE3D,IAAI,OAAM,CAAC,MAAM,CAAC,IAAI,QAAQ;QAC1B,OAAO,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAA;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAM,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC;QACjE,OAAO,MAAM;aACR,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAG,iCAAiC;aACpF,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,SAAS,CAAC,CAAU,iCAAiC;aACpF,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAO,0BAA0B;aAC7E,IAAI,CAAC,YAAY,CAAC,CAAA,CAAiC,kCAAkC;IAC9F,MAAM,IAAI,KAAK,CAAC,kCAAmC,OAAM,CAAC,MAAM,CAAE,EAAE,CAAC,CAAA;AACzE,CAAC"}
|
package/dist/factory/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type ComponentFactory } from "./types.js";
|
|
2
2
|
export type * from "./types.js";
|
|
3
3
|
export { DefaultComponentFactory } from "./default.js";
|
|
4
|
+
/**
|
|
5
|
+
* The default merge symbol to use when converting between an array based
|
|
6
|
+
* ComponentTypeHandle and strig based ComponentTypeHandle
|
|
7
|
+
*/
|
|
8
|
+
export declare const TYPE_MERGE_SYMBOL = "/";
|
|
4
9
|
/**
|
|
5
10
|
* Create a new instance of the included DefaultComponentFactory, which should
|
|
6
11
|
* be wrapped in a form of caching provided by your project.
|
package/dist/factory/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { DefaultComponentFactory } from "./default.js";
|
|
1
|
+
import { DefaultComponentFactory, MERGE_SYMBOL } from "./default.js";
|
|
2
2
|
export { DefaultComponentFactory } from "./default.js";
|
|
3
|
+
/**
|
|
4
|
+
* The default merge symbol to use when converting between an array based
|
|
5
|
+
* ComponentTypeHandle and strig based ComponentTypeHandle
|
|
6
|
+
*/
|
|
7
|
+
export const TYPE_MERGE_SYMBOL = MERGE_SYMBOL;
|
|
3
8
|
/**
|
|
4
9
|
* Create a new instance of the included DefaultComponentFactory, which should
|
|
5
10
|
* be wrapped in a form of caching provided by your project.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAGpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAA;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAA4B,GAAG,EAAE;IACpD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAA;IAC/C,IAAI,GAAG;QAAE,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAA;IAC3E,OAAO,IAAI,uBAAuB,EAAE,CAAA;AACxC,CAAC,CAAA;AAED,eAAe,UAAU,EAAE,CAAA"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/rsc.d.ts
CHANGED
package/dist/rsc.js
CHANGED
package/dist/utilities.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
import type * as Types from './types.js';
|
|
3
2
|
import type { DocumentNode } from 'graphql';
|
|
3
|
+
import type { ContentLinkWithLocale, ContentLink } from '@remkoj/optimizely-graph-client';
|
|
4
|
+
import type { ContentType, BaseCmsComponent, CmsComponentWithQuery, CmsComponentWithFragment, WithGqlFragment, ContentQueryProps } from './types.js';
|
|
5
|
+
import type { ComponentFactory, ComponentTypeHandle } from './factory/types.js';
|
|
4
6
|
export declare function isNonEmptyString(toTest: any): toTest is string;
|
|
5
7
|
export declare function isNotNullOrUndefined<T>(toTest?: T | null): toTest is T;
|
|
6
|
-
export declare function isContentType(toTest: any): toTest is
|
|
8
|
+
export declare function isContentType(toTest: any): toTest is ContentType;
|
|
7
9
|
/**
|
|
8
10
|
* Normalizes the content type by:
|
|
9
11
|
* - Converting strings to ContentType
|
|
@@ -13,7 +15,7 @@ export declare function isContentType(toTest: any): toTest is Types.ContentType;
|
|
|
13
15
|
* @param stripContent When set to true, the global base type "Content" will be removed as well
|
|
14
16
|
* @returns
|
|
15
17
|
*/
|
|
16
|
-
export declare function normalizeContentType(toNormalize: (string | null)[] | string | null | undefined, stripContent?: boolean):
|
|
18
|
+
export declare function normalizeContentType(toNormalize: (string | null)[] | string | null | undefined, stripContent?: boolean): ContentType | undefined;
|
|
17
19
|
/**
|
|
18
20
|
* Normalizes and prefixes the content type by:
|
|
19
21
|
* - Converting strings to ContentType
|
|
@@ -25,14 +27,26 @@ export declare function normalizeContentType(toNormalize: (string | null)[] | st
|
|
|
25
27
|
* @param prefix
|
|
26
28
|
* @returns
|
|
27
29
|
*/
|
|
28
|
-
export declare function normalizeAndPrefixContentType(contentType: Array<string | null> | string | null | undefined, prefix: string):
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
export declare function normalizeAndPrefixContentType(contentType: Array<string | null> | string | null | undefined, prefix: string): ContentType;
|
|
31
|
+
/**
|
|
32
|
+
* Perform the resolution of the Component, based on the type and list of
|
|
33
|
+
* variants. It will return the first matching variant, and fall back to
|
|
34
|
+
* the main component if none match.
|
|
35
|
+
*
|
|
36
|
+
* @param factory The ComponentFactory to use for the resolution
|
|
37
|
+
* process
|
|
38
|
+
* @param type The Component Type to resolve
|
|
39
|
+
* @param variants The variants to test
|
|
40
|
+
* @returns The resolved Component or undefined if not found
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveComponentType(factory: ComponentFactory, type: ComponentTypeHandle, variants?: Array<string>): ReturnType<ComponentFactory['resolve']>;
|
|
43
|
+
export declare function isCmsComponentWithDataQuery<T = DocumentNode>(toTest?: BaseCmsComponent<T>): toTest is CmsComponentWithQuery<T>;
|
|
44
|
+
export declare function isCmsComponentWithFragment<T = DocumentNode>(toTest?: BaseCmsComponent<T>): toTest is CmsComponentWithFragment<T>;
|
|
45
|
+
export declare function validatesFragment<T extends ComponentType<any>>(toTest?: T): toTest is T & Pick<Required<WithGqlFragment<T, any>>, "validateFragment">;
|
|
46
|
+
export declare function contentLinkToRequestVariables(contentLink: ContentLinkWithLocale): ContentQueryProps;
|
|
33
47
|
export declare function toUniqueValues<R extends any>(value: R, index: number, array: Array<R>): value is R;
|
|
34
48
|
export declare function trim<T extends string | null | undefined>(valueToTrim: T): T;
|
|
35
|
-
export declare function getContentEditId(contentLink:
|
|
49
|
+
export declare function getContentEditId(contentLink: ContentLink): string;
|
|
36
50
|
/**
|
|
37
51
|
* Generate a pseudo-random identifier usable to satisfy the unique key
|
|
38
52
|
* requirement for children within a React node. However this effectively will
|
package/dist/utilities.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TYPE_MERGE_SYMBOL } from './factory/index.js';
|
|
1
2
|
import { localeToGraphLocale } from '@remkoj/optimizely-graph-client/utils';
|
|
2
3
|
export function isNonEmptyString(toTest) {
|
|
3
4
|
return typeof (toTest) == 'string' && toTest.length > 0;
|
|
@@ -41,11 +42,31 @@ export function normalizeContentType(toNormalize, stripContent = false) {
|
|
|
41
42
|
export function normalizeAndPrefixContentType(contentType, prefix) {
|
|
42
43
|
if (!contentType)
|
|
43
44
|
return [prefix];
|
|
44
|
-
const processedContentType = (
|
|
45
|
+
const processedContentType = normalizeContentType(contentType, true) ?? [];
|
|
45
46
|
if (processedContentType[0] != prefix)
|
|
46
47
|
processedContentType.unshift(prefix);
|
|
47
48
|
return processedContentType;
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Perform the resolution of the Component, based on the type and list of
|
|
52
|
+
* variants. It will return the first matching variant, and fall back to
|
|
53
|
+
* the main component if none match.
|
|
54
|
+
*
|
|
55
|
+
* @param factory The ComponentFactory to use for the resolution
|
|
56
|
+
* process
|
|
57
|
+
* @param type The Component Type to resolve
|
|
58
|
+
* @param variants The variants to test
|
|
59
|
+
* @returns The resolved Component or undefined if not found
|
|
60
|
+
*/
|
|
61
|
+
export function resolveComponentType(factory, type, variants = []) {
|
|
62
|
+
for (const variant of variants) {
|
|
63
|
+
const variantType = Array.isArray(type) ? [...type, variant] : type + TYPE_MERGE_SYMBOL + variant;
|
|
64
|
+
const variantComponent = factory.resolve(variantType);
|
|
65
|
+
if (variantComponent)
|
|
66
|
+
return variantComponent;
|
|
67
|
+
}
|
|
68
|
+
return factory.resolve(type);
|
|
69
|
+
}
|
|
49
70
|
export function isCmsComponentWithDataQuery(toTest) {
|
|
50
71
|
const toTestType = typeof (toTest);
|
|
51
72
|
if ((toTestType == 'function' || toTestType == 'object') && toTest != null) {
|
package/dist/utilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,i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;AAED,MAAM,UAAU,cAAc,CAAgB,KAAQ,EAAE,KAAa,EAAE,KAAe;IAElF,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAA;AACxC,CAAC;AAED,MAAM,UAAU,IAAI,CAAsC,WAAc;IAEpE,IAAI,OAAM,CAAC,WAAW,CAAC,IAAI,QAAQ;QAC/B,OAAO,WAAW,CAAC,IAAI,EAAO,CAAA;IAClC,OAAO,WAAW,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,WAAwB;IAErD,OAAO,WAAW,CAAC,GAAG,CAAA;AAC1B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,SAAiB,KAAK;IAE/C,IAAI,CAAC;QACD,OAAO,GAAG,MAAM,KAAK,MAAM,CAAC,UAAU,EAAE,EAAE,CAAA;IAC9C,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAA;IAClG,CAAC;AACL,CAAC"}
|
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": "3.
|
|
4
|
+
"version": "3.1.1",
|
|
5
5
|
"packageManager": "yarn@4.1.1",
|
|
6
6
|
"repository": "https://github.com/remkoj/optimizely-dxp-clients.git",
|
|
7
7
|
"author": "Remko Jantzen <693172+remkoj@users.noreply.github.com>",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@remkoj/optimizely-graph-client": "3.
|
|
31
|
+
"@remkoj/optimizely-graph-client": "3.1.1",
|
|
32
32
|
"@types/crypto-js": "^4.2.2",
|
|
33
|
-
"@types/node": "^22.
|
|
33
|
+
"@types/node": "^22.9.0",
|
|
34
34
|
"@types/react": "^18.3.12",
|
|
35
35
|
"@types/react-dom": "18.3.1",
|
|
36
36
|
"entities": "^5.0.0",
|