@remkoj/optimizely-cms-nextjs 6.0.0-pre13 → 6.0.0-pre15
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 +5 -1
- package/dist/ope/load-content.d.ts +11 -0
- package/dist/ope/load-content.js +49 -0
- package/dist/ope/load-content.js.map +1 -0
- package/dist/ope/page.js +10 -47
- package/dist/ope/page.js.map +1 -1
- package/dist/ope/types.d.ts +1 -1
- package/package.json +16 -16
- package/dist/ope/data.d.ts +0 -2
- package/dist/ope/data.js +0 -31
- package/dist/ope/data.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# Optimizely SaaS CMS - Next.js Integration
|
|
2
|
+
|
|
3
|
+
> [!WARNING]
|
|
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).
|
|
5
|
+
|
|
2
6
|
[](./LICENSE)
|
|
3
7
|
|
|
4
8
|
> [!TIP]
|
|
@@ -76,4 +80,4 @@ The package provides the following enhancements for Next.js middleware:
|
|
|
76
80
|
| withEditFallback | `@remkoj/optimizely-cms-nextjs/preview` | Rewrite incoming Optimizely CMS 12 preview / on-page-edit URLs to Optimizely SaaS CMS preview URLs |
|
|
77
81
|
| withLanguagePrefix | `@remkoj/optimizely-cms-nextjs/page` | Handle the redirect of the homepage `/` to the locale that best matches the incoming request, such as `/en`. The locales and their URLs are taken from the second parameter - the ChannelDefinition.
|
|
78
82
|
|
|
79
|
-
If you use both wrappers, the `withEditFallback` wrapper must wrap the `withLanguagePrefix` wrapper, to ensure that the edit mode URL is rewritten before the language prefix is applied.
|
|
83
|
+
If you use both wrappers, the `withEditFallback` wrapper must wrap the `withLanguagePrefix` wrapper, to ensure that the edit mode URL is rewritten before the language prefix is applied.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ContentLinkWithLocale, IOptiGraphClient } from "@remkoj/optimizely-graph-client";
|
|
2
|
+
import type { GetContentByIdMethod, ContentRequest } from "./types.js";
|
|
3
|
+
export declare function loadContent(contentRequest: Omit<ContentRequest, 'token' | 'ctx'>, client: IOptiGraphClient, getContentById?: GetContentByIdMethod): Promise<{
|
|
4
|
+
contentLink: ContentLinkWithLocale;
|
|
5
|
+
contentItem: ({
|
|
6
|
+
__typename?: string | null;
|
|
7
|
+
_type?: string | null;
|
|
8
|
+
} & Record<string, any>) | undefined;
|
|
9
|
+
contentType: import("@remkoj/optimizely-cms-react/rsc").ContentType | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
export default loadContent;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { localeToGraphLocale } from '@remkoj/optimizely-graph-client/utils';
|
|
2
|
+
import { Utils } from '@remkoj/optimizely-cms-react/rsc';
|
|
3
|
+
export async function loadContent(contentRequest, client, getContentById) {
|
|
4
|
+
const contentLink = {
|
|
5
|
+
key: contentRequest.key,
|
|
6
|
+
changeset: contentRequest.changeset,
|
|
7
|
+
isInline: false,
|
|
8
|
+
variation: contentRequest.variation ? contentRequest.variation.include == "SOME" ? contentRequest.variation.value.join(',') : null : undefined,
|
|
9
|
+
version: contentRequest.version,
|
|
10
|
+
locale: (contentRequest.version ? undefined : Array.isArray(contentRequest.locale) ? contentRequest.locale[0] : contentRequest.locale) ?? undefined
|
|
11
|
+
};
|
|
12
|
+
const contentInfo = getContentById ? await getContentById(client, {
|
|
13
|
+
...contentRequest,
|
|
14
|
+
locale: contentRequest.locale && contentRequest.locale.length > 0
|
|
15
|
+
? localeToGraphLocale(Array.isArray(contentRequest.locale)
|
|
16
|
+
? contentRequest.locale.at(0)
|
|
17
|
+
: contentRequest.locale)
|
|
18
|
+
: undefined,
|
|
19
|
+
changeset: client.getChangeset(),
|
|
20
|
+
}).catch((e) => {
|
|
21
|
+
console.warn('🟠 [OnPageEdit][loadContent] getContentById for ' +
|
|
22
|
+
JSON.stringify(contentRequest) +
|
|
23
|
+
' returned an error', e);
|
|
24
|
+
return undefined;
|
|
25
|
+
}) : undefined;
|
|
26
|
+
if (contentInfo && (contentInfo?.content?.total ?? 0) > 1) {
|
|
27
|
+
console.warn('🟠 [OnPageEdit][loadContent] getContentById for ' +
|
|
28
|
+
JSON.stringify(contentRequest) +
|
|
29
|
+
' yielded more then one item, picking first matching');
|
|
30
|
+
}
|
|
31
|
+
const contentItem = (Array.isArray(contentInfo?.content?.items)
|
|
32
|
+
? contentInfo?.content?.items[0]
|
|
33
|
+
: contentInfo?.content?.items) ?? undefined;
|
|
34
|
+
const contentType = contentItem ? Utils.normalizeContentType(contentItem?._metadata.types) : undefined;
|
|
35
|
+
if (contentItem) {
|
|
36
|
+
contentLink.key = contentItem._metadata.key;
|
|
37
|
+
contentLink.locale = contentItem._metadata.locale;
|
|
38
|
+
contentLink.version = contentItem._metadata.version;
|
|
39
|
+
}
|
|
40
|
+
if (client.debug) {
|
|
41
|
+
console.log('⚪ [OnPageEdit] Resolved content:', JSON.stringify({
|
|
42
|
+
...contentLink,
|
|
43
|
+
type: contentItem?.contentType ? contentItem.contentType.join('/') : undefined,
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
return { contentLink, contentItem, contentType };
|
|
47
|
+
}
|
|
48
|
+
export default loadContent;
|
|
49
|
+
//# sourceMappingURL=load-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-content.js","sourceRoot":"","sources":["../../src/ope/load-content.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,cAAqD,EAAE,MAAwB,EAAE,cAAqC;IAEtJ,MAAM,WAAW,GAA0B;QACzC,GAAG,EAAE,cAAc,CAAC,GAAG;QACvB,SAAS,EAAE,cAAc,CAAC,SAAS;QACnC,QAA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,17 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import 'server-only';
|
|
3
|
-
import { contentLinkToString,
|
|
4
|
-
import { ServerContext,
|
|
3
|
+
import { contentLinkToString, } from '@remkoj/optimizely-graph-client/utils';
|
|
4
|
+
import { ServerContext, CmsContent, OptimizelyComposition, isNode, } from '@remkoj/optimizely-cms-react/rsc';
|
|
5
5
|
import { notFound } from 'next/navigation.js';
|
|
6
6
|
import OnPageEdit from '../components/on-page-edit.js';
|
|
7
7
|
import { createAuthorizedClient } from '../client.js';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import Script from 'next/script.js';
|
|
10
|
-
import { getContentById } from './data.js';
|
|
11
10
|
import { getContentRequest, isValidRequest } from './tools.js';
|
|
11
|
+
import loadContent from './load-content.js';
|
|
12
12
|
const defaultOptions = {
|
|
13
13
|
refreshNotice: () => _jsx(_Fragment, {}),
|
|
14
14
|
layout: (props) => _jsx(_Fragment, { children: props.children }),
|
|
15
|
-
loader: getContentById,
|
|
16
15
|
clientFactory: (token) => createAuthorizedClient(token),
|
|
17
16
|
communicationInjectorPath: '/util/javascript/communicationinjector.js',
|
|
18
17
|
contentResolver: getContentRequest,
|
|
@@ -63,54 +62,18 @@ export function createEditPageComponent(factory, options) {
|
|
|
63
62
|
console.log('⚪ [OnPageEdit] Requested content:', JSON.stringify(contentRequest));
|
|
64
63
|
}
|
|
65
64
|
try {
|
|
66
|
-
const
|
|
67
|
-
...contentRequest,
|
|
68
|
-
locale: contentRequest.locale && contentRequest.locale.length > 0
|
|
69
|
-
? localeToGraphLocale(Array.isArray(contentRequest.locale)
|
|
70
|
-
? contentRequest.locale.at(0)
|
|
71
|
-
: contentRequest.locale)
|
|
72
|
-
: undefined,
|
|
73
|
-
changeset: client.getChangeset(),
|
|
74
|
-
});
|
|
75
|
-
if ((contentInfo?.content?.total ?? 0) > 1) {
|
|
76
|
-
console.warn('🟠 [OnPageEdit] Content request ' +
|
|
77
|
-
JSON.stringify(contentRequest) +
|
|
78
|
-
' yielded more then one item, picking first matching');
|
|
79
|
-
}
|
|
80
|
-
const contentItem = (Array.isArray(contentInfo?.content?.items)
|
|
81
|
-
? contentInfo?.content?.items[0]
|
|
82
|
-
: contentInfo?.content?.items) ?? undefined;
|
|
83
|
-
const contentType = Utils.normalizeContentType(contentItem?._metadata.types);
|
|
84
|
-
// Return a 404 if the content item or type could not be resolved
|
|
85
|
-
if (!contentItem) {
|
|
86
|
-
console.warn(`🟠 [OnPageEdit] The content item for ${JSON.stringify(contentRequest)} could not be loaded from Optimizely Graph`);
|
|
87
|
-
return notFound();
|
|
88
|
-
}
|
|
89
|
-
if (!contentType) {
|
|
90
|
-
console.warn(`🟠 [OnPageEdit] The content item for ${JSON.stringify(contentRequest)} did not contain content type information`);
|
|
91
|
-
return notFound();
|
|
92
|
-
}
|
|
93
|
-
const contentLink = {
|
|
94
|
-
key: contentItem._metadata.key,
|
|
95
|
-
locale: contentItem._metadata.locale,
|
|
96
|
-
version: contentItem._metadata.version,
|
|
97
|
-
};
|
|
98
|
-
if (context.isDebug) {
|
|
99
|
-
console.log('⚪ [OnPageEdit] Resolved content:', JSON.stringify({
|
|
100
|
-
...contentLink,
|
|
101
|
-
type: (contentItem.contentType ?? []).join('/'),
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
65
|
+
const { contentLink, contentItem, contentType } = await loadContent(contentRequest, client, getContentById);
|
|
104
66
|
// Store the editable content so it can be tested
|
|
105
67
|
context.setEditableContentId(contentLink);
|
|
106
68
|
if (contentLink.locale)
|
|
107
69
|
context.setLocale(contentLink.locale);
|
|
108
70
|
// Determine rendering flow controls
|
|
109
|
-
const isPage = contentType.some((x) => x?.toLowerCase()
|
|
110
|
-
const isSection = contentType
|
|
111
|
-
const sectionData = isSection &&
|
|
71
|
+
const isPage = contentType ? contentType.some((x) => x?.toLowerCase() === 'page') ?? false : false;
|
|
72
|
+
const isSection = contentType?.some(x => x?.toLowerCase() == 'section') ?? false;
|
|
73
|
+
const sectionData = isSection && isNode(contentItem?.composition) ? contentItem.composition : undefined;
|
|
112
74
|
if (sectionData) {
|
|
113
|
-
|
|
75
|
+
if (contentItem?.composition)
|
|
76
|
+
delete contentItem.composition;
|
|
114
77
|
sectionData.component = contentItem;
|
|
115
78
|
context.setEditableContentIsExperience(true);
|
|
116
79
|
}
|
|
@@ -118,7 +81,7 @@ export function createEditPageComponent(factory, options) {
|
|
|
118
81
|
const injectorUrl = new URL(communicationInjectorPath, client.siteInfo.cmsURL).href;
|
|
119
82
|
// Render edit page
|
|
120
83
|
const Layout = isPage ? PageLayout : React.Fragment;
|
|
121
|
-
const output = (_jsxs(_Fragment, { children: [_jsx(Script, { src: injectorUrl, strategy: "afterInteractive" }), _jsxs(Layout, { locale: contentItem
|
|
84
|
+
const output = (_jsxs(_Fragment, { children: [_jsx(Script, { src: injectorUrl, strategy: "afterInteractive" }), _jsxs(Layout, { locale: contentItem?.locale?.name ?? '', children: [_jsx(OnPageEdit, { refreshTimeout: refreshTimeout, children: _jsx(RefreshNotice, {}) }), sectionData ?
|
|
122
85
|
_jsx(OptimizelyComposition, { node: sectionData, ctx: context }) :
|
|
123
86
|
_jsx(CmsContent, { contentType: contentType, contentLink: contentLink, fragmentData: contentItem, ctx: context })] }), context.isDebug && (_jsxs("div", { className: "optly-contentLink", children: ["ContentItem:", ' ', contentLink
|
|
124
87
|
? contentLinkToString(contentLink)
|
package/dist/ope/page.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/ope/page.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,CAAA;AAOpB,OAAO,EACL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/ope/page.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,CAAA;AAOpB,OAAO,EACL,mBAAmB,GAEpB,MAAM,uCAAuC,CAAA;AAE9C,OA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,KAAG,GACN,EACX,WAAW,CAAC,CAAC;gCACb,KAAC,qBAAqB,IAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,GAAI,CAAC,CAAC;gCAC5D,KAAC,UAAU,IAAC,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,GAAI,IAEtG,EACR,OAAO,CAAC,OAAO,IAAI,CAClB,eAAK,SAAS,EAAC,mBAAmB,6BACnB,GAAG,EACf,WAAW;gCACV,CAAC,CAAC,mBAAmB,CAAC,WAAW,CAAC;gCAClC,CAAC,CAAC,qDAAqD,IACrD,CACP,IACA,CACJ,CAAA;YACD,OAAO,MAAM,CAAA;QACf,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAA;YAChD,OAAO,QAAQ,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,eAAe,uBAAuB,CAAA"}
|
package/dist/ope/types.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export type EditViewOptions<LocaleType = string> = {
|
|
|
70
70
|
* which actually loads the data of content to be shown to the
|
|
71
71
|
* editor.
|
|
72
72
|
*/
|
|
73
|
-
loader
|
|
73
|
+
loader?: GetContentByIdMethod<LocaleType>;
|
|
74
74
|
/**
|
|
75
75
|
* The third step of the handling of a Preview/On-Page-Edit view,
|
|
76
76
|
* which gets the Optimizely Graph client for the token/auth method
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@remkoj/optimizely-cms-nextjs",
|
|
3
3
|
"description": "Next.JS integration for Optimizely SaaS CMS",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "6.0.0-
|
|
5
|
+
"version": "6.0.0-pre15",
|
|
6
6
|
"repository": "https://github.com/remkoj/optimizely-dxp-clients.git",
|
|
7
7
|
"author": "Remko Jantzen <693172+remkoj@users.noreply.github.com>",
|
|
8
8
|
"homepage": "https://github.com/remkoj/optimizely-dxp-clients",
|
|
@@ -44,31 +44,31 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@remkoj/optimizely-cms-react": "6.0.0-
|
|
48
|
-
"@remkoj/optimizely-graph-client": "6.0.0-
|
|
47
|
+
"@remkoj/optimizely-cms-react": "6.0.0-pre15",
|
|
48
|
+
"@remkoj/optimizely-graph-client": "6.0.0-pre15",
|
|
49
49
|
"@types/negotiator": "^0.6.4",
|
|
50
|
-
"@types/node": "^22.
|
|
51
|
-
"@types/react": "^19.2.
|
|
52
|
-
"@types/react-dom": "19.2.
|
|
53
|
-
"next": "^16.
|
|
50
|
+
"@types/node": "^22.19.6",
|
|
51
|
+
"@types/react": "^19.2.8",
|
|
52
|
+
"@types/react-dom": "19.2.3",
|
|
53
|
+
"next": "^16.1.1",
|
|
54
54
|
"prop-types": "^15.8.1",
|
|
55
|
-
"react": "^19.2.
|
|
56
|
-
"react-dom": "^19.2.
|
|
55
|
+
"react": "^19.2.3",
|
|
56
|
+
"react-dom": "^19.2.3",
|
|
57
57
|
"scheduler": "^0.27.0",
|
|
58
58
|
"typescript": "^5.9.3"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@formatjs/intl-localematcher": "^0.
|
|
62
|
-
"@remkoj/optimizely-cms-react": "6.0.0-
|
|
63
|
-
"@remkoj/optimizely-graph-client": "6.0.0-
|
|
61
|
+
"@formatjs/intl-localematcher": "^0.7.5",
|
|
62
|
+
"@remkoj/optimizely-cms-react": "6.0.0-pre15",
|
|
63
|
+
"@remkoj/optimizely-graph-client": "6.0.0-pre15",
|
|
64
64
|
"deepmerge": "^4.3.1",
|
|
65
65
|
"entities": "^7.0.0",
|
|
66
|
-
"graphql": "^16.
|
|
67
|
-
"graphql-request": "^7.
|
|
66
|
+
"graphql": "^16.12.0",
|
|
67
|
+
"graphql-request": "^7.4.0",
|
|
68
68
|
"negotiator": "^1.0.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"next": "^
|
|
71
|
+
"next": "^16",
|
|
72
72
|
"react": "^19",
|
|
73
73
|
"react-dom": "^19"
|
|
74
74
|
},
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"watch": "yarn tsc --watch",
|
|
79
79
|
"recompile": "yarn tsc --build --clean && yarn tsc --build --force"
|
|
80
80
|
},
|
|
81
|
-
"stableVersion": "5.
|
|
81
|
+
"stableVersion": "5.2.0"
|
|
82
82
|
}
|
package/dist/ope/data.d.ts
DELETED
package/dist/ope/data.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-request';
|
|
2
|
-
export const getContentById = async (client, variables) => {
|
|
3
|
-
return await client.request(gqlQuery, variables);
|
|
4
|
-
};
|
|
5
|
-
const gqlQuery = gql `query getContentByIdBase($key: String!, $version: String, $locale: [Locales!], $path: String, $domain: String) {
|
|
6
|
-
content: _Content(
|
|
7
|
-
where: {
|
|
8
|
-
_or: [
|
|
9
|
-
{ _metadata: { key: { eq: $key }, version: { eq: $version } } }
|
|
10
|
-
{ _metadata: { url: { hierarchical: { eq: $path }, base: { eq: $domain } }, version: { eq: $version } } }
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
locale: $locale
|
|
14
|
-
variation: {include: ALL}
|
|
15
|
-
) {
|
|
16
|
-
total
|
|
17
|
-
items {
|
|
18
|
-
_metadata {
|
|
19
|
-
key
|
|
20
|
-
locale
|
|
21
|
-
types
|
|
22
|
-
displayName
|
|
23
|
-
version
|
|
24
|
-
changeset
|
|
25
|
-
variation
|
|
26
|
-
}
|
|
27
|
-
_type: __typename
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}`;
|
|
31
|
-
//# sourceMappingURL=data.js.map
|
package/dist/ope/data.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/ope/data.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAEzD,MAAM,CAAC,MAAM,cAAc,GAAyB,KAAK,EAAuB,MAAqB,EAAE,SAAwC,EAAE,EAAE;IACjJ,OAAO,MAAM,MAAM,CAAC,OAAO,CAAoD,QAAQ,EAAE,SAAS,CAAC,CAAA;AACrG,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAyBlB,CAAA"}
|