@remkoj/optimizely-cms-react 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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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C,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 = Array.isArray(contentType) ? (prefix ?
20
- Utils.normalizeAndPrefixContentType(contentType.reverse(), prefix) :
21
- Utils.normalizeContentType(contentType.reverse(), true)) : contentType;
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 = factory.resolve(myContentType);
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;IAExI,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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AC,QAAQ,IACjB,CAAA;YACH,cAAc,CAAC,WAAW,GAAG,wBAAwB,CAAA;YACrD,OAAO,cAAc,CAAA;QACzB,CAAC;QACD,MAAM,cAAc,GAA+B,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAA;QAC1E,cAAc,CAAC,WAAW,GAAG,wBAAwB,CAAA;QACrD,OAAO,cAAc,CAAA;IACzB,CAAC;IAED,uBAAuB;IACvB,IAAI,OAAO;QACP,OAAO,CAAC,GAAG,CAAC,gDAAgD,EAAE,SAAS,EAAE,WAAW,IAAI,SAAS,CAAC,CAAA;IACtG,OAAO,SAAS,CAAA;AACpB,CAAC;AAED,eAAe,gBAAgB,CAAA;AAM/B,MAAM,UAAU,2BAA2B,CAAC,MAA6C;IAErF,OAAO,MAAM,EAAE,WAAW,IAAI,wBAAwB,CAAA;AAC1D,CAAC"}
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,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AAC,WAAW,GAAG,wBAAwB,CAAA;YACrD,OAAO,cAAc,CAAA;QACzB,CAAC;QACD,MAAM,cAAc,GAA+B,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAA;QAC1E,cAAc,CAAC,WAAW,GAAG,wBAAwB,CAAA;QACrD,OAAO,cAAc,CAAA;IACzB,CAAC;IAED,uBAAuB;IACvB,IAAI,OAAO;QACP,OAAO,CAAC,GAAG,CAAC,gDAAgD,EAAE,SAAS,EAAE,WAAW,IAAI,SAAS,CAAC,CAAA;IACtG,OAAO,SAAS,CAAA;AACpB,CAAC;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,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AAO,CAAC,GAAG,CAAC,mBAAoB,IAAK,qCAAsC,mBAAmB,CAAC,WAAW,CAAE,YAAa,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,EAAE,CAAC,CAAA;QACjK,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,eAAe,IAAI,QAAQ,CAAC,MAAM;YACvF,OAAO,CAAC,IAAI,CAAC,mBAAoB,IAAK,iIAAiI,CAAC,CAAA;IAChL,CAAC;IAED,kDAAkD;IAClD,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;IAClF,IAAI,2BAA2B,CAAC,SAAS,CAAC;QACtC,OAAO,KAAC,SAAS,KAAG,CAAA;IAExB,kDAAkD;IAClD,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,WAAW,EAAE,WAAW,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 actualItems = (items || []).filter(forValidContentAreaItems);
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: contentItemElement, className: contentItemBaseClassName, itemsProperty: contentItemTarget, ...contentItemElementProps } = itemWrapper ?? {};
25
- // Generate element wrapper properties
26
- const contentAreaItemContainerKey = `ContentAreaItem-${idx}-${contentLinkToString(contentLink)}`;
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 = _jsx(CmsContent, { contentLink: contentLink, contentType: contentType, fragmentData: fragmentData, contentTypePrefix: "Component" });
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
- const ContentAreaItemContainer = contentItemElement || "div";
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;AAK3G,YAAY;AAEZ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAA+D,EACzF,KAAK,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,EAAE,EAAE,WAAW,EACf,aAAa,EACb,WAAW,EAEX,GAAG,EACH,UAAU,EAAE,UAAU,EAEtB,GAAG,e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;IAEF,IAAI,sBAAsB;QACtB,OAAO,4BAAI,aAAa,GAAK,CAAA;IAEjC,0BAA0B;IAC1B,MAAM,yBAAyB,GAAS;QACpC,SAAS,EAAE,qBAAsB,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAE,SAAS,IAAI,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE;QAC7G,eAAe,EAAE,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QAChE,gBAAgB,EAAE,aAAa;QAC/B,GAAG,eAAe;KACrB,CAAA;IACD,MAAM,kCAAkC,GAAG,aAAa,IAAI,UAAU,CAAA;IACtE,IAAI,4BAA4B,GAAG,SAAS,CAAA;IAC5C,IAAI,kCAAkC,IAAI,UAAU;QAChD,4BAA4B,GAAG,aAAa,CAAA;;QAE5C,yBAAyB,CAAC,kCAAkC,CAAC,GAAG,aAAa,CAAA;IACjF,MAAM,oBAAoB,GAAG,WAAW,IAAI,KAAK,CAAA;IACjD,OAAO,KAAC,oBAAoB,OAAM,yBAAyB,YAAK,4BAA4B,GAAyB,CAAA;AACzH,CAAC,CAAA;AAED,SAAS,wBAAwB,CAAC,GAAsC;IAEpE,OAAO,OAAM,CAAC,GAAG,CAAC,IAAI,QAAQ,IAAI,GAAG,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
  */
@@ -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
@@ -1,4 +1,4 @@
1
- const MERGE_SYMBOL = '/';
1
+ export const MERGE_SYMBOL = '/';
2
2
  export const EmptyComponentHandle = '$$fragment$$';
3
3
  /**
4
4
  * The default implementation of the ComponentFactory interface, which works both
@@ -1 +1 @@
1
- {"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/factory/default.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAG,GAAG,CAAA;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAI,cAAc,CAAA;AAEnD;;;GAGG;AACH,MAAM,OAAO,uBAAuB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AAE,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"}
@@ -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.
@@ -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;AAGtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD;;;;;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"}
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
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The version of the current Optimizely DXP React SDK
3
3
  */
4
- export declare const Version = "3.0.0";
4
+ export declare const Version = "3.1.0";
5
5
  export * from './types.js';
6
6
  export * as Errors from './errors.js';
7
7
  export * as Utils from './utilities.js';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The version of the current Optimizely DXP React SDK
3
3
  */
4
- export const Version = '3.0.0';
4
+ export const Version = '3.1.0';
5
5
  // Export library
6
6
  export * from './types.js';
7
7
  export * as Errors from './errors.js';
package/dist/rsc.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The version of the current Optimizely DXP React SDK
3
3
  */
4
- export declare const Version = "3.0.0";
4
+ export declare const Version = "3.1.0";
5
5
  export * as Errors from './errors.js';
6
6
  export * as Utils from './utilities.js';
7
7
  export * from './types.js';
package/dist/rsc.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The version of the current Optimizely DXP React SDK
3
3
  */
4
- export const Version = '3.0.0';
4
+ export const Version = '3.1.0';
5
5
  // Export library
6
6
  export * as Errors from './errors.js';
7
7
  export * as Utils from './utilities.js';
@@ -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 Types.ContentType;
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): Types.ContentType | undefined;
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): Types.ContentType;
29
- export declare function isCmsComponentWithDataQuery<T = DocumentNode>(toTest?: Types.BaseCmsComponent<T>): toTest is Types.CmsComponentWithQuery<T>;
30
- export declare function isCmsComponentWithFragment<T = DocumentNode>(toTest?: Types.BaseCmsComponent<T>): toTest is Types.CmsComponentWithFragment<T>;
31
- export declare function validatesFragment<T extends ComponentType<any>>(toTest?: T): toTest is T & Pick<Required<Types.WithGqlFragment<T, any>>, "validateFragment">;
32
- export declare function contentLinkToRequestVariables(contentLink: Types.ContentLinkWithLocale): Types.ContentQueryProps;
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: Types.ContentLink): string;
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 = (typeof (contentType) == 'string' ? contentType.split('/') : contentType).filter(isNonEmptyString).map(x => x.startsWith('_') ? x.substring(1) : x).filter(x => x.toLowerCase() != 'content');
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) {
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAE3E,MAAM,UAAU,gBAAgB,CAAC,MAAW;IAExC,OAAO,OAAM,CAAC,MAAM,CAAC,I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AC,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.0.0",
4
+ "version": "3.1.0",
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.0.0",
31
+ "@remkoj/optimizely-graph-client": "3.1.0",
32
32
  "@types/crypto-js": "^4.2.2",
33
- "@types/node": "^22.8.4",
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",