@remkoj/optimizely-cms-react 6.0.0-pre12 → 6.0.0-pre14
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 -4
- package/dist/components/cms-content/get-content-type.js +1 -1
- package/dist/components/cms-content/get-content-type.js.map +1 -1
- package/dist/components/cms-content/resolve-component.js +3 -9
- package/dist/components/cms-content/resolve-component.js.map +1 -1
- package/dist/components/visual-builder/functions.js +7 -14
- package/dist/components/visual-builder/functions.js.map +1 -1
- package/dist/components/visual-builder/index.js +2 -2
- package/dist/components/visual-builder/index.js.map +1 -1
- package/dist/factory/default.d.ts +20 -3
- package/dist/factory/default.js +43 -24
- package/dist/factory/default.js.map +1 -1
- package/dist/factory/types.d.ts +19 -4
- package/dist/factory/undef.d.ts +7 -5
- package/dist/factory/undef.js +10 -4
- package/dist/factory/undef.js.map +1 -1
- package/dist/utilities.d.ts +2 -2
- package/dist/utilities.js +12 -7
- package/dist/utilities.js.map +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Optimizely SaaS CMS React Components
|
|
2
|
+
|
|
2
3
|
> [!WARNING]
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
> For some of the commonly used old exports it still contains placeholders, however those are deprecated and will be removed in a future version
|
|
4
|
+
> There'll be an update of Optimizely SaaS CMS that is incompatible with all SDK versions prior to 5.1.6. If you don't upgrade, you will see empty pages (main website) and "Component not found" messages (preview).
|
|
6
5
|
|
|
7
6
|
This package provides two main entry points, depending on your build environment:
|
|
8
7
|
- `@remkoj/optimizely-cms-react` This export contains the library, whith React components that use a client side context
|
|
@@ -46,4 +45,4 @@ An entry within the factory consists of the following fields:
|
|
|
46
45
|
- ***type:*** The identifier of the content type, can either be an array of strings or a string. The implementation *should* normalize the type. The `DefaultComponentFactory` normalized to a string, using `/` as item separator.
|
|
47
46
|
- ***component:*** The component to do the actual rendering of the data. *The factory is indifferent to the actual type, so this could be the output of `next/dynamic` to trigger bundle splitting in Next.js.*
|
|
48
47
|
- ***useSuspense:*** When set to `true` the component will be wrapped in the `<Suspense></Suspense>` from React. Optional, the default value is `false`.
|
|
49
|
-
- ***loader:*** The component to show while Suspense is awaiting the actual component. This component is given to the `fallback` property of `<Suspense>`. Optional, the default value is `undefined`.
|
|
48
|
+
- ***loader:*** The component to show while Suspense is awaiting the actual component. This component is given to the `fallback` property of `<Suspense>`. Optional, the default value is `undefined`.
|
|
@@ -34,7 +34,7 @@ export async function getContentType(link, gqlClient) {
|
|
|
34
34
|
console.error(`🔴 [CmsContent][getContentType] Expected exactly one type, received ${gqlResponse.Content?.total ?? 0} types for`, gqlQueryVars);
|
|
35
35
|
return undefined;
|
|
36
36
|
}
|
|
37
|
-
const contentType = normalizeContentType(gqlResponse.Content?.item?.
|
|
37
|
+
const contentType = normalizeContentType(gqlResponse.Content?.item?.metadata?.types);
|
|
38
38
|
if (!contentType) {
|
|
39
39
|
console.error(`🔴 [CmsContent][getContentType] The item did not contain type information! (${contentLinkToString(link)})`);
|
|
40
40
|
throw new Error("The item did not contain type information");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-content-type.js","sourceRoot":"","sources":["../../../src/components/cms-content/get-content-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,mBAAmB,EAAmE,MAAM,iCAAiC,CAAA;AAE1K,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAIxF,MAAM,UAAU,kBAAkB,CAAI,KAAQ;IAC5C,MAAM,EAAE,GAAmB;QACzB,IAAI,EAAE,CAAe,WAAiF,EAAE,EAAE;YACxG,IAAI,CAAC,WAAW;gBACd,OAAO,KAAyC,CAAA;YAClD,OAAO,WAAW,CAAC,KAAK,CAA0B,CAAA;QACpD,CAAC;KACF,C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K,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;QACjJ,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,WAAW,GAAG,oBAAoB,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;IACpF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,+EAA+E,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC1H,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,eAAe,cAAc,CAAA;AAa7B,MAAM,mBAAmB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;EAe7B,CAAA"}
|
|
@@ -24,22 +24,16 @@ export function resolveComponent(contentType, prefix, variant, ctx) {
|
|
|
24
24
|
console.error(`🔴 [CmsContent][resolveComponent] No content type factory registered in the context`);
|
|
25
25
|
throw new Error('Empty factory on the context');
|
|
26
26
|
}
|
|
27
|
-
//
|
|
28
|
-
const myContentType =
|
|
29
|
-
? Utils.normalizeAndPrefixContentType(Array.isArray(contentType) ? [...contentType].reverse() : contentType, prefix)
|
|
30
|
-
: Utils.normalizeContentType(Array.isArray(contentType) ? [...contentType].reverse() : contentType, true);
|
|
27
|
+
// Make sure that we normalize the input from graph into a string array
|
|
28
|
+
const myContentType = Utils.normalizeContentType(contentType, false);
|
|
31
29
|
// Validate that we have a value to ask the factory a component for
|
|
32
30
|
if (!myContentType || myContentType.length == 0) {
|
|
33
31
|
if (isDebug)
|
|
34
32
|
console.error(`🔴 [CmsContent][resolveComponent] The content type ${JSON.stringify(contentType)}, with prefix ${JSON.stringify(prefix)} yielded an empty normalized type`);
|
|
35
33
|
throw new Error(`The content type ${JSON.stringify(contentType)}, with prefix ${JSON.stringify(prefix)} yielded an empty normalized type`);
|
|
36
34
|
}
|
|
37
|
-
/*if (isDebug)
|
|
38
|
-
console.log(
|
|
39
|
-
`⚪ [CmsContent][resolveComponent] Normalized content type ${JSON.stringify(contentType)} to ${myContentType}`
|
|
40
|
-
)*/
|
|
41
35
|
// Resolve component
|
|
42
|
-
const Component = Utils.resolveComponentType(factory, myContentType,
|
|
36
|
+
const Component = Utils.resolveComponentType(factory, myContentType, [variant, prefix].filter(Utils.isNotNullOrUndefined));
|
|
43
37
|
// Handle component not found in factory
|
|
44
38
|
if (!Component) {
|
|
45
39
|
const contentTypeDisplay = Array.isArray(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;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,CAC9B,WAAmD,EACnD,MAAiC,EACjC,OAAkC,EAClC,GAAmB;IAEnB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;IAE5C,sFAAsF;IACtF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CACX,qFAAqF,CACtF,CAAA;QACD,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACjD,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"resolve-component.js","sourceRoot":"","sources":["../../../src/components/cms-content/resolve-component.tsx"],"names":[],"m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OrUndefined } from '../../utilities.js';
|
|
2
2
|
import { isContentLink, isInlineContentLink } from '@remkoj/optimizely-graph-client';
|
|
3
3
|
/**
|
|
4
4
|
* Test if the Node within VisualBuilder is an Element
|
|
@@ -63,20 +63,13 @@ export const defaultPropsFactory = (node) => {
|
|
|
63
63
|
return [contentLink, contentType, node.key || undefined, node.component, layoutData];
|
|
64
64
|
};
|
|
65
65
|
export const defaultNodePropsFactory = (node) => {
|
|
66
|
+
const componentMainName = node.type ? (node.layoutType === 'experience' ? node.type + "Node" : node.type) : undefined;
|
|
66
67
|
const componentTypes = [
|
|
67
|
-
|
|
68
|
-
node.template
|
|
69
|
-
[ucFirst(node.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
node.template && [node.template, ucFirst(node.layoutType), "Nodes", "Content"].filter(x => x),
|
|
73
|
-
// Old style logic
|
|
74
|
-
[node.template, ucFirst(node.type), ucFirst(node.layoutType), "Component", "Content"].filter(x => x),
|
|
75
|
-
(node.template && node.type) ? [node.type ? ucFirst(node.type) : null, ucFirst(node.layoutType), "Component", "Content"].filter(x => x) : null,
|
|
76
|
-
// Fallback
|
|
77
|
-
["Node", "Content"],
|
|
78
|
-
["Node", "Component", "Content"]
|
|
79
|
-
].filter(x => x);
|
|
68
|
+
componentMainName ? [componentMainName] : undefined,
|
|
69
|
+
node.template ? [node.template] : undefined,
|
|
70
|
+
[ucFirst(node.layoutType) + 'Node'],
|
|
71
|
+
['Node']
|
|
72
|
+
].filter(isNotNullOrUndefined);
|
|
80
73
|
const contentLink = { key: node.key ?? '', isInline: true };
|
|
81
74
|
const componentData = { __name: node.name, ...node.component };
|
|
82
75
|
const layoutData = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/components/visual-builder/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../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CAAC,WAAW,EAAE,cAAc,EAAE,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE,aAAa,EAAE,UAAU,CAAC,CAAA;AACxF,CAAC,CAAA;AAED,MAAM,UAAU,OAAO,CAAC,KAAgC;IACtD,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAChD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IACpD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -27,11 +27,11 @@ export function OptimizelyComposition({ node, leafPropsFactory = defaultPropsFac
|
|
|
27
27
|
throw new Error('🟡 [VisualBuilder] [OptimizelyComposition] The factory must be defined within the Context');
|
|
28
28
|
const [contentLink, contentTypes, nodeId, fragmentData, layoutProps] = nodePropsFactory(node);
|
|
29
29
|
const firstExistingType = contentTypes
|
|
30
|
-
.map((ct) => factory.has([...ct].reverse()))
|
|
30
|
+
.map((ct) => factory.has(Array.isArray(ct) ? [...ct].reverse() : ct))
|
|
31
31
|
.indexOf(true);
|
|
32
32
|
const contentType = contentTypes[firstExistingType];
|
|
33
33
|
if (!contentType)
|
|
34
|
-
throw new Error(`🟡 [VisualBuilder] [OptimizelyComposition] The factory must have a definition for one of these types: ${contentTypes.map((x) => x.join('/')).join(', ')}`);
|
|
34
|
+
throw new Error(`🟡 [VisualBuilder] [OptimizelyComposition] The factory must have a definition for one of these types: ${contentTypes.map((x) => Array.isArray(x) ? x.join('/') : x).join(', ')}`);
|
|
35
35
|
return (_jsx(CmsContent, { contentType: contentType, contentLink: contentLink, fragmentData: fragmentData, layoutProps: layoutProps, editorComponentId: nodeId || contentLink.key || undefined, noDataLoad: true, ctx: ctx, children: (node.nodes ?? []).map((child) => {
|
|
36
36
|
const childKey = child.key ? child.key : `vb::${JSON.stringify(child)}`;
|
|
37
37
|
return (_jsx(OptimizelyComposition, { node: child, leafPropsFactory: leafPropsFactory, nodePropsFactory: nodePropsFactory, ctx: ctx, cmsContent: CmsContent }, childKey));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/visual-builder/index.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,gBAAgB,CAAA;AAIvB;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,IAAI,EACJ,gBAAgB,GAAG,mBAAmB,EACtC,gBAAgB,GAAG,uBAAuB,EAC1C,GAAG,EACH,UAAU,EAAE,UAAU,GACS;IAC/B,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAAA;IAEhC,qBAAqB;IACrB,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B;;;aAGK;QACL,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,GACjE,gBAAgB,CAAC,IAAI,CAAC,CAAA;QACxB,OAAO,CACL,KAAC,UAAU,IACT,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,MAAM,IAAI,WAAW,CAAC,GAAG,IAAI,SAAS,EACzD,GAAG,EAAE,GAAG,GACR,CACH,CAAA;IACH,CAAC;IAED,QAAQ;IACR;;;SAGK;IAEL,6BAA6B;IAC7B,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAA;IAEH,MAAM,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,GAClE,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACxB,MAAM,iBAAiB,GAAG,YAAY;SACnC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/visual-builder/index.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,gBAAgB,CAAA;AAIvB;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,IAAI,EACJ,gBAAgB,GAAG,mBAAmB,EACtC,gBAAgB,GAAG,uBAAuB,EAC1C,GAAG,EACH,UAAU,EAAE,UAAU,GACS;IAC/B,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAAA;IAEhC,qBAAqB;IACrB,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B;;;aAGK;QACL,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,GACjE,gBAAgB,CAAC,IAAI,CAAC,CAAA;QACxB,OAAO,CACL,KAAC,UAAU,IACT,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,MAAM,IAAI,WAAW,CAAC,GAAG,IAAI,SAAS,EACzD,GAAG,EAAE,GAAG,GACR,CACH,CAAA;IACH,CAAC;IAED,QAAQ;IACR;;;SAGK;IAEL,6BAA6B;IAC7B,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAA;IAEH,MAAM,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,GAClE,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACxB,MAAM,iBAAiB,GAAG,YAAY;SACnC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAA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+8,15 @@ export declare const EmptyComponentHandle = "$$fragment$$";
|
|
|
8
8
|
export declare class DefaultComponentFactory implements ComponentFactory {
|
|
9
9
|
private registry;
|
|
10
10
|
private dbg;
|
|
11
|
+
/**
|
|
12
|
+
* A list of interfaces to ignore when resolving components. Adjust this
|
|
13
|
+
* list if you're experiencing issues with resolving components due to
|
|
14
|
+
* contracts. Values **must be** provided lowercase and without leading
|
|
15
|
+
* underscore. For example `_Item` must be provided as `item`.
|
|
16
|
+
*
|
|
17
|
+
* The default value includes the common ones for SaaS CMS.
|
|
18
|
+
*/
|
|
19
|
+
ignoredContracts: string[];
|
|
11
20
|
/**
|
|
12
21
|
* Create a new instance of the DefaultComponentFactory
|
|
13
22
|
*
|
|
@@ -15,10 +24,18 @@ export declare class DefaultComponentFactory implements ComponentFactory {
|
|
|
15
24
|
* with the factory.
|
|
16
25
|
*/
|
|
17
26
|
constructor(initialComponents?: ComponentTypeDictionary);
|
|
18
|
-
register(type: ComponentTypeHandle, component: ComponentType, useSuspense?: boolean, loader?: ComponentType): void;
|
|
27
|
+
register(type: ComponentTypeHandle, component: ComponentType, useSuspense?: boolean, loader?: ComponentType, variant?: string): void;
|
|
19
28
|
registerAll(components: ComponentTypeDictionary): void;
|
|
20
|
-
has(type: ComponentTypeHandle): boolean;
|
|
21
|
-
resolve(type: ComponentTypeHandle): undefined | ComponentType;
|
|
29
|
+
has(type: ComponentTypeHandle, variant?: string): boolean;
|
|
30
|
+
resolve(type: ComponentTypeHandle, variant?: string): undefined | ComponentType;
|
|
22
31
|
extract(): ComponentTypeDictionary;
|
|
23
32
|
remove(type: ComponentTypeHandle): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Process the component variant handle into
|
|
35
|
+
*
|
|
36
|
+
* @param handle
|
|
37
|
+
* @param variant
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
private processComponentTypeHandle;
|
|
24
41
|
}
|
package/dist/factory/default.js
CHANGED
|
@@ -15,6 +15,15 @@ export class DefaultComponentFactory {
|
|
|
15
15
|
*/
|
|
16
16
|
constructor(initialComponents) {
|
|
17
17
|
this.registry = new Map();
|
|
18
|
+
/**
|
|
19
|
+
* A list of interfaces to ignore when resolving components. Adjust this
|
|
20
|
+
* list if you're experiencing issues with resolving components due to
|
|
21
|
+
* contracts. Values **must be** provided lowercase and without leading
|
|
22
|
+
* underscore. For example `_Item` must be provided as `item`.
|
|
23
|
+
*
|
|
24
|
+
* The default value includes the common ones for SaaS CMS.
|
|
25
|
+
*/
|
|
26
|
+
this.ignoredContracts = ['item', 'assetitem', 'imageitem', 'content'];
|
|
18
27
|
// Resolve debug mode
|
|
19
28
|
try {
|
|
20
29
|
this.dbg = process.env.OPTIMIZELY_DEBUG == '1';
|
|
@@ -26,26 +35,27 @@ export class DefaultComponentFactory {
|
|
|
26
35
|
if (initialComponents)
|
|
27
36
|
this.registerAll(initialComponents);
|
|
28
37
|
}
|
|
29
|
-
register(type, component, useSuspense = false, loader) {
|
|
30
|
-
const registryKey = processComponentTypeHandle(type);
|
|
31
|
-
this.
|
|
38
|
+
register(type, component, useSuspense = false, loader, variant = 'default') {
|
|
39
|
+
const registryKey = this.processComponentTypeHandle(type, variant);
|
|
40
|
+
if (this.dbg)
|
|
41
|
+
console.log(`➕ [DefaultComponentFactory] Registering ${registryKey}`);
|
|
42
|
+
this.registry.set(registryKey, { type: registryKey, component, useSuspense, loader, variant });
|
|
32
43
|
}
|
|
33
44
|
registerAll(components) {
|
|
34
|
-
components.forEach(
|
|
35
|
-
const registryKey = processComponentTypeHandle(c.type);
|
|
36
|
-
this.registry.set(registryKey, c);
|
|
37
|
-
});
|
|
45
|
+
components.forEach(c => this.register(c.type, c.component, c.useSuspense, c.loader, c.variant));
|
|
38
46
|
}
|
|
39
|
-
has(type) {
|
|
40
|
-
const registryKey = processComponentTypeHandle(type);
|
|
47
|
+
has(type, variant = 'default') {
|
|
48
|
+
const registryKey = this.processComponentTypeHandle(type, variant);
|
|
49
|
+
if (this.dbg)
|
|
50
|
+
console.log(`🔎 [DefaultComponentFactory] Checking for ${registryKey} - ${this.registry.has(registryKey) ? 'YES' : 'NO'}`);
|
|
41
51
|
return this.registry.has(registryKey);
|
|
42
52
|
}
|
|
43
|
-
resolve(type) {
|
|
44
|
-
const registryKey = processComponentTypeHandle(type);
|
|
53
|
+
resolve(type, variant = 'default') {
|
|
54
|
+
const registryKey = this.processComponentTypeHandle(type, variant);
|
|
45
55
|
const entry = this.registry.get(registryKey);
|
|
46
56
|
if (!entry) {
|
|
47
57
|
if (this.dbg)
|
|
48
|
-
console.warn(
|
|
58
|
+
console.warn(`❌ [DefaultComponentFactory] Unable to resolve ${registryKey}, this will prevent the item from rendering`);
|
|
49
59
|
return undefined; // The key is not registered in the factory
|
|
50
60
|
}
|
|
51
61
|
if (entry.useSuspense != true)
|
|
@@ -64,23 +74,32 @@ export class DefaultComponentFactory {
|
|
|
64
74
|
});
|
|
65
75
|
}
|
|
66
76
|
remove(type) {
|
|
67
|
-
const registryKey = processComponentTypeHandle(type);
|
|
77
|
+
const registryKey = this.processComponentTypeHandle(type);
|
|
68
78
|
if (this.dbg)
|
|
69
79
|
console.log(`🔎 [DefaultComponentFactory] Removing ${registryKey}`);
|
|
70
80
|
if (!this.registry.has(registryKey))
|
|
71
81
|
return true;
|
|
72
82
|
return this.registry.delete(registryKey);
|
|
73
83
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Process the component variant handle into
|
|
86
|
+
*
|
|
87
|
+
* @param handle
|
|
88
|
+
* @param variant
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
processComponentTypeHandle(handle, variant) {
|
|
92
|
+
let handleToProcess = typeof handle === 'string' ? handle.split(MERGE_SYMBOL) : [...handle];
|
|
93
|
+
if (Array.isArray(handleToProcess) && handleToProcess.every((s) => typeof s === 'string')) {
|
|
94
|
+
const offset = (['component', 'page', 'experience'].includes(handleToProcess.at(handleToProcess.length - 3)?.toLowerCase() ?? '') &&
|
|
95
|
+
!['row', 'column', 'section', 'experience', 'media'].includes(handleToProcess.at(handleToProcess.length - 2)?.toLowerCase() ?? '')) ? 1 : 0;
|
|
96
|
+
const typeName = handleToProcess.at(handleToProcess.length - (1 + offset));
|
|
97
|
+
const prefix = handleToProcess.at(handleToProcess.length - (2 + offset)) === 'RichText' ? 'RichText/' : '';
|
|
98
|
+
const actualVariant = offset > 0 ? handleToProcess.at(handleToProcess.length - 1) ?? variant ?? 'default' : variant ?? 'default';
|
|
99
|
+
const newHandle = prefix + typeName + '/' + actualVariant;
|
|
100
|
+
return newHandle;
|
|
101
|
+
}
|
|
102
|
+
throw new Error(`Invalid component type handle: ${typeof handle}`);
|
|
103
|
+
}
|
|
85
104
|
}
|
|
86
105
|
//# sourceMappingURL=default.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/factory/default.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;AAE/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAA;AAElD;;;GAGG;AACH,MAAM,OAAO,uBAAuB;
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/factory/default.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;AAE/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAA;AAElD;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAclC;;;;;OAKG;IACH,YAAmB,iBAA2C;QAnBtD,aAAQ,GAAG,IAAI,GAAG,EAAwC,CAA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AC,CAAC,CAAA;YAET,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,GAAC,MAAM,CAAC,CAAC,CAAA;YACxE,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,GAAC,MAAM,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;YACxG,MAAM,aAAa,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI,SAAS,CAAA;YAChI,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,GAAG,GAAG,aAAa,CAAA;YAEzD,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,kCAAkC,OAAO,MAAM,EAAE,CAAC,CAAA;IACpE,CAAC;CACF"}
|
package/dist/factory/types.d.ts
CHANGED
|
@@ -25,18 +25,31 @@ export type ComponentTypeDictionaryEntry = {
|
|
|
25
25
|
* The component to use as "loading" state by the <Suspense />
|
|
26
26
|
*/
|
|
27
27
|
loader?: ComponentType;
|
|
28
|
+
/**
|
|
29
|
+
* Used for the loading of a specific variant of the component (for example 'header', 'footer', 'menu')
|
|
30
|
+
*/
|
|
31
|
+
variant?: string;
|
|
28
32
|
};
|
|
29
33
|
/**
|
|
30
34
|
* Component Factory
|
|
31
35
|
*/
|
|
32
36
|
export interface ComponentFactory {
|
|
37
|
+
/**
|
|
38
|
+
* A list of interfaces to ignore when resolving components. Adjust this
|
|
39
|
+
* list if you're experiencing issues with resolving components due to
|
|
40
|
+
* contracts. Values **must be** provided lowercase and without leading
|
|
41
|
+
* underscore. For example `_Item` must be provided as `item`.
|
|
42
|
+
*
|
|
43
|
+
* The default value includes the common ones for SaaS CMS.
|
|
44
|
+
*/
|
|
45
|
+
ignoredContracts: string[];
|
|
33
46
|
/**
|
|
34
47
|
* Check if the component type has been registered within the factory
|
|
35
48
|
*
|
|
36
49
|
* @param type The component type to check for
|
|
37
50
|
* @returns Whether or not the type exists within the factory
|
|
38
51
|
*/
|
|
39
|
-
has(type: ComponentTypeHandle): boolean;
|
|
52
|
+
has(type: ComponentTypeHandle, variant?: string): boolean;
|
|
40
53
|
/**
|
|
41
54
|
* Register an individual component. When the component type has already
|
|
42
55
|
* been registered it will be updated.
|
|
@@ -45,8 +58,9 @@ export interface ComponentFactory {
|
|
|
45
58
|
* @param component The component to bind to the type
|
|
46
59
|
* @param useSuspense If set to 'true' the registered component will be wrapped in <Suspense />
|
|
47
60
|
* @param loader The component to use as "loading" state by the <Suspense />
|
|
61
|
+
* @param variant The specific variant of the component (for example 'header', 'footer', 'menu')
|
|
48
62
|
*/
|
|
49
|
-
register(type: ComponentTypeHandle, component: ComponentType, useSuspense?: boolean, loader?: ComponentType): void;
|
|
63
|
+
register(type: ComponentTypeHandle, component: ComponentType, useSuspense?: boolean, loader?: ComponentType, variant?: string): void;
|
|
50
64
|
/**
|
|
51
65
|
* Register all components provided through the dictionary. When the
|
|
52
66
|
* component type has already been registered it will be updated.
|
|
@@ -59,17 +73,18 @@ export interface ComponentFactory {
|
|
|
59
73
|
* the implemenation supports it.
|
|
60
74
|
*
|
|
61
75
|
* @param type The component type to remove
|
|
76
|
+
* @param variant The variant of the component type, will remove all if not specified
|
|
62
77
|
* @returns `true` If the component was not found or removed, `false`
|
|
63
78
|
* otherwise
|
|
64
79
|
*/
|
|
65
|
-
remove?: (type: ComponentTypeHandle) => boolean;
|
|
80
|
+
remove?: (type: ComponentTypeHandle, variant?: string) => boolean;
|
|
66
81
|
/**
|
|
67
82
|
* Resolve a component type
|
|
68
83
|
*
|
|
69
84
|
* @param type The type to search the component for
|
|
70
85
|
* @returns The component that was resolved for the provided type
|
|
71
86
|
*/
|
|
72
|
-
resolve(type: ComponentTypeHandle): ComponentType | undefined;
|
|
87
|
+
resolve(type: ComponentTypeHandle, variant?: string): ComponentType | undefined;
|
|
73
88
|
/**
|
|
74
89
|
* Retrieve the registered components as a dictionary that can be used to
|
|
75
90
|
* be imported in a new instance.
|
package/dist/factory/undef.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { ComponentType, ComponentTypeDictionary,
|
|
1
|
+
import { ComponentType, ComponentTypeDictionary, type ComponentFactory } from "./types.js";
|
|
2
2
|
export declare class UndefinedComponentFactory implements ComponentFactory {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
get ignoredContracts(): string[];
|
|
4
|
+
set ignoredContracts(newList: string[]);
|
|
5
|
+
has(): boolean;
|
|
6
|
+
register(): void;
|
|
7
|
+
registerAll(): void;
|
|
8
|
+
resolve(): ComponentType | undefined;
|
|
7
9
|
extract(): ComponentTypeDictionary;
|
|
8
10
|
}
|
|
9
11
|
export default UndefinedComponentFactory;
|
package/dist/factory/undef.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
export class UndefinedComponentFactory {
|
|
2
|
-
|
|
2
|
+
get ignoredContracts() {
|
|
3
3
|
throw new Error("Factory not specified, please specify a factory.");
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
set ignoredContracts(newList) {
|
|
6
6
|
throw new Error("Factory not specified, please specify a factory.");
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
has() {
|
|
9
9
|
throw new Error("Factory not specified, please specify a factory.");
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
register() {
|
|
12
|
+
throw new Error("Factory not specified, please specify a factory.");
|
|
13
|
+
}
|
|
14
|
+
registerAll() {
|
|
15
|
+
throw new Error("Factory not specified, please specify a factory.");
|
|
16
|
+
}
|
|
17
|
+
resolve() {
|
|
12
18
|
throw new Error("Factory not specified, please specify a factory.");
|
|
13
19
|
}
|
|
14
20
|
extract() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undef.js","sourceRoot":"","sources":["../../src/factory/undef.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,yBAAyB;
|
|
1
|
+
{"version":3,"file":"undef.js","sourceRoot":"","sources":["../../src/factory/undef.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,yBAAyB;IACpC,IAAI,gBAAgB;QAClB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,IAAI,gBAAgB,CAAC,OAAiB;QACpC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,GAAG;QACD,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,QAAQ;QACN,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,WAAW;QACT,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO;QACL,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO;QACL,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;CACF;AAED,eAAe,yBAAyB,CAAA"}
|
package/dist/utilities.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ComponentType } from 'react';
|
|
|
2
2
|
import type { DocumentNode } from 'graphql';
|
|
3
3
|
import type { ContentLinkWithLocale, ContentLink, IOptiGraphClient, InlineContentLink } from '@remkoj/optimizely-graph-client';
|
|
4
4
|
import type { ContentType, BaseCmsComponent, CmsComponentWithQuery, CmsComponentWithFragment, WithGqlFragment, ContentQueryProps, CmsComponentProps } from './types.js';
|
|
5
|
-
import type { ComponentFactory
|
|
5
|
+
import type { ComponentFactory } from './factory/types.js';
|
|
6
6
|
export * from './components/rich-text/utils.js';
|
|
7
7
|
/**
|
|
8
8
|
* Safeguard filter to remove default properties from the CmsComponent, intended
|
|
@@ -55,7 +55,7 @@ export declare function normalizeAndPrefixContentType(contentType: Array<string
|
|
|
55
55
|
* @param variants The variants to test
|
|
56
56
|
* @returns The resolved Component or undefined if not found
|
|
57
57
|
*/
|
|
58
|
-
export declare function resolveComponentType(factory: ComponentFactory, type:
|
|
58
|
+
export declare function resolveComponentType(factory: ComponentFactory, type: ContentType, variants?: Array<string>): ReturnType<ComponentFactory['resolve']>;
|
|
59
59
|
export declare function isCmsComponentWithDataQuery<T = DocumentNode>(toTest?: BaseCmsComponent<T>): toTest is CmsComponentWithQuery<T>;
|
|
60
60
|
export declare function isCmsComponentWithFragment<T = DocumentNode>(toTest?: BaseCmsComponent<T>): toTest is CmsComponentWithFragment<T>;
|
|
61
61
|
export declare function validatesFragment<T extends ComponentType<any>>(toTest?: T): toTest is T & Pick<Required<WithGqlFragment<T, any>>, "validateFragment">;
|
package/dist/utilities.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OptiCmsSchema } from '@remkoj/optimizely-graph-client';
|
|
2
|
-
import { TYPE_MERGE_SYMBOL } from './factory/index.js';
|
|
3
2
|
import { localeToGraphLocale } from '@remkoj/optimizely-graph-client/utils';
|
|
4
3
|
//Export the Rich-Text utilities
|
|
5
4
|
export * from './components/rich-text/utils.js';
|
|
@@ -91,13 +90,19 @@ export function normalizeAndPrefixContentType(contentType, prefix) {
|
|
|
91
90
|
* @returns The resolved Component or undefined if not found
|
|
92
91
|
*/
|
|
93
92
|
export function resolveComponentType(factory, type, variants = []) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
const contentTypeKey = type.at(0);
|
|
94
|
+
if (contentTypeKey) {
|
|
95
|
+
for (const variant of variants) {
|
|
96
|
+
const variantComponent = factory.resolve(contentTypeKey, variant);
|
|
97
|
+
if (variantComponent)
|
|
98
|
+
return variantComponent;
|
|
99
|
+
}
|
|
100
|
+
const mainComponent = factory.resolve(contentTypeKey);
|
|
101
|
+
if (mainComponent)
|
|
102
|
+
return mainComponent;
|
|
99
103
|
}
|
|
100
|
-
|
|
104
|
+
console.warn(`❌ [Component Resolution] Unable to resolve ${contentTypeKey} in any of the requested variants: ${[...variants, 'default'].join(', ')}`);
|
|
105
|
+
return undefined;
|
|
101
106
|
}
|
|
102
107
|
export function isCmsComponentWithDataQuery(toTest) {
|
|
103
108
|
const toTestType = typeof (toTest);
|
package/dist/utilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,gCAAgC;AAChC,cAAc,iCAAiC,CAAA;AAE/C;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAmB,QAAW;IACnE,MAAM,kBAAkB,GAAwC,CAAC,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,CAAC,CAAA;IACpJ,SAAS,UAAU,CAAC,eAAwB;QAC1C,IAAI,OAAO,eAAe,KAAK,QAAQ,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC;YACxE,OAAO,KAAK,CAAA;QACd,IAAI,kBAAkB,CAAC,QAAQ,CAAC,eAA+C,CAAC;YAC9E,OAAO,KAAK,CAAA;QACd,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAQ,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAiB,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;QACh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 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remkoj/optimizely-cms-react",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "6.0.0-
|
|
4
|
+
"version": "6.0.0-pre14",
|
|
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",
|
|
@@ -27,24 +27,24 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@remkoj/optimizely-graph-client": "6.0.0-
|
|
30
|
+
"@remkoj/optimizely-graph-client": "6.0.0-pre14",
|
|
31
31
|
"@types/crypto-js": "^4.2.2",
|
|
32
|
-
"@types/node": "^22.
|
|
33
|
-
"@types/react": "^19.2.
|
|
34
|
-
"@types/react-dom": "^19.2.
|
|
32
|
+
"@types/node": "^22.19.6",
|
|
33
|
+
"@types/react": "^19.2.8",
|
|
34
|
+
"@types/react-dom": "^19.2.3",
|
|
35
35
|
"prop-types": "^15.8.1",
|
|
36
|
-
"react": "^19.2.
|
|
37
|
-
"react-dom": "^19.2.
|
|
36
|
+
"react": "^19.2.3",
|
|
37
|
+
"react-dom": "^19.2.3",
|
|
38
38
|
"scheduler": "^0.27.0",
|
|
39
39
|
"typescript": "^5.9.3"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
43
|
-
"@remkoj/optimizely-graph-client": "6.0.0-
|
|
43
|
+
"@remkoj/optimizely-graph-client": "6.0.0-pre14",
|
|
44
44
|
"crypto-js": "^4.2.0",
|
|
45
45
|
"entities": "^7.0.0",
|
|
46
|
-
"graphql": "^16.
|
|
47
|
-
"graphql-request": "^7.
|
|
46
|
+
"graphql": "^16.12.0",
|
|
47
|
+
"graphql-request": "^7.4.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": "^19",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"watch": "tsc --watch",
|
|
57
57
|
"recompile": "tsc --build --clean && tsc --build --force"
|
|
58
58
|
},
|
|
59
|
-
"stableVersion": "5.
|
|
59
|
+
"stableVersion": "5.2.0"
|
|
60
60
|
}
|