@cmssy/next 0.14.0 → 0.16.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 +10 -6
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,14 +23,18 @@ export default createCmssyPage(cmssy, blocks, { editor: CmssyEditor });
|
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
25
|
// cmssy/config.ts
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
import { defineCmssyConfig } from "@cmssy/next";
|
|
27
|
+
|
|
28
|
+
// defineCmssyConfig validates the required env vars and throws a clear error if
|
|
29
|
+
// any is missing - never mask them with `?? ""` (an empty org/slug builds a
|
|
30
|
+
// broken delivery URL like `/public//graphql`).
|
|
31
|
+
export const cmssy = defineCmssyConfig({
|
|
32
|
+
org: process.env.CMSSY_ORG_SLUG,
|
|
33
|
+
workspaceSlug: process.env.CMSSY_WORKSPACE_SLUG,
|
|
34
|
+
draftSecret: process.env.CMSSY_DRAFT_SECRET, // edit-mode preview handshake
|
|
31
35
|
defaultLocale: "en",
|
|
32
36
|
// apiUrl + editorOrigin default to cmssy cloud; set them only for self-host/staging.
|
|
33
|
-
};
|
|
37
|
+
});
|
|
34
38
|
```
|
|
35
39
|
|
|
36
40
|
`createCmssyPage` fetches the page for the request path and renders it. In edit
|
package/dist/index.cjs
CHANGED
|
@@ -96,6 +96,7 @@ function resolveEditorOrigin(editorOrigin) {
|
|
|
96
96
|
return value.trim().length > 0 ? value : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
97
97
|
}
|
|
98
98
|
var REQUIRED_CONFIG_ENV = [
|
|
99
|
+
["org", "CMSSY_ORG_SLUG"],
|
|
99
100
|
["workspaceSlug", "CMSSY_WORKSPACE_SLUG"],
|
|
100
101
|
["draftSecret", "CMSSY_DRAFT_SECRET"]
|
|
101
102
|
];
|
|
@@ -216,6 +217,7 @@ function createCmssyPage(config, blocks, options) {
|
|
|
216
217
|
const Editor = options?.editor;
|
|
217
218
|
const clientConfig = {
|
|
218
219
|
apiUrl: config.apiUrl,
|
|
220
|
+
org: config.org,
|
|
219
221
|
workspaceSlug: config.workspaceSlug
|
|
220
222
|
};
|
|
221
223
|
const client$1 = react.createCmssyClient(clientConfig);
|
|
@@ -370,6 +372,7 @@ function createCmssyNotFound(config, blocks, options) {
|
|
|
370
372
|
}
|
|
371
373
|
const clientConfig = {
|
|
372
374
|
apiUrl: config.apiUrl,
|
|
375
|
+
org: config.org,
|
|
373
376
|
workspaceSlug: config.workspaceSlug
|
|
374
377
|
};
|
|
375
378
|
const fallback = options?.fallback ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultNotFound, {});
|
|
@@ -488,6 +491,7 @@ function localizedPath(slug, locale, defaultLocale) {
|
|
|
488
491
|
function createCmssySitemap(config, options = {}) {
|
|
489
492
|
const clientConfig = {
|
|
490
493
|
apiUrl: config.apiUrl,
|
|
494
|
+
org: config.org,
|
|
491
495
|
workspaceSlug: config.workspaceSlug
|
|
492
496
|
};
|
|
493
497
|
return async function sitemap() {
|
|
@@ -539,6 +543,7 @@ function pick(value, locale, defaultLocale) {
|
|
|
539
543
|
async function buildCmssyMetadata(config, path, options = {}) {
|
|
540
544
|
const clientConfig = {
|
|
541
545
|
apiUrl: config.apiUrl,
|
|
546
|
+
org: config.org,
|
|
542
547
|
workspaceSlug: config.workspaceSlug
|
|
543
548
|
};
|
|
544
549
|
const [meta, siteConfig, baseUrl] = await Promise.all([
|
|
@@ -669,6 +674,7 @@ async function resolveLocaleFromPathname(config, pathname) {
|
|
|
669
674
|
const hasStaticLocales = !!config.enabledLocales?.length;
|
|
670
675
|
const fetched = config.defaultLocale && hasStaticLocales ? null : await react.resolveSiteLocales({
|
|
671
676
|
apiUrl: config.apiUrl,
|
|
677
|
+
org: config.org,
|
|
672
678
|
workspaceSlug: config.workspaceSlug
|
|
673
679
|
});
|
|
674
680
|
const siteLocales = {
|
package/dist/index.d.cts
CHANGED
|
@@ -18,6 +18,8 @@ interface CmssyNextConfig {
|
|
|
18
18
|
* (`https://api.cmssy.io/graphql`); set it only for self-hosted / staging.
|
|
19
19
|
*/
|
|
20
20
|
apiUrl?: string;
|
|
21
|
+
/** Organization slug - part of the org-scoped delivery path. */
|
|
22
|
+
org: string;
|
|
21
23
|
workspaceSlug: string;
|
|
22
24
|
draftSecret: string;
|
|
23
25
|
/**
|
|
@@ -53,7 +55,8 @@ interface CmssyNextConfig {
|
|
|
53
55
|
* through without a `?? ""` fallback (which would mask a missing value as an
|
|
54
56
|
* empty string) or a cast.
|
|
55
57
|
*/
|
|
56
|
-
type CmssyEnvConfig = Omit<CmssyNextConfig, "workspaceSlug" | "draftSecret"> & {
|
|
58
|
+
type CmssyEnvConfig = Omit<CmssyNextConfig, "org" | "workspaceSlug" | "draftSecret"> & {
|
|
59
|
+
org?: string;
|
|
57
60
|
workspaceSlug?: string;
|
|
58
61
|
draftSecret?: string;
|
|
59
62
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ interface CmssyNextConfig {
|
|
|
18
18
|
* (`https://api.cmssy.io/graphql`); set it only for self-hosted / staging.
|
|
19
19
|
*/
|
|
20
20
|
apiUrl?: string;
|
|
21
|
+
/** Organization slug - part of the org-scoped delivery path. */
|
|
22
|
+
org: string;
|
|
21
23
|
workspaceSlug: string;
|
|
22
24
|
draftSecret: string;
|
|
23
25
|
/**
|
|
@@ -53,7 +55,8 @@ interface CmssyNextConfig {
|
|
|
53
55
|
* through without a `?? ""` fallback (which would mask a missing value as an
|
|
54
56
|
* empty string) or a cast.
|
|
55
57
|
*/
|
|
56
|
-
type CmssyEnvConfig = Omit<CmssyNextConfig, "workspaceSlug" | "draftSecret"> & {
|
|
58
|
+
type CmssyEnvConfig = Omit<CmssyNextConfig, "org" | "workspaceSlug" | "draftSecret"> & {
|
|
59
|
+
org?: string;
|
|
57
60
|
workspaceSlug?: string;
|
|
58
61
|
draftSecret?: string;
|
|
59
62
|
};
|
package/dist/index.js
CHANGED
|
@@ -95,6 +95,7 @@ function resolveEditorOrigin(editorOrigin) {
|
|
|
95
95
|
return value.trim().length > 0 ? value : DEFAULT_CMSSY_EDITOR_ORIGINS;
|
|
96
96
|
}
|
|
97
97
|
var REQUIRED_CONFIG_ENV = [
|
|
98
|
+
["org", "CMSSY_ORG_SLUG"],
|
|
98
99
|
["workspaceSlug", "CMSSY_WORKSPACE_SLUG"],
|
|
99
100
|
["draftSecret", "CMSSY_DRAFT_SECRET"]
|
|
100
101
|
];
|
|
@@ -215,6 +216,7 @@ function createCmssyPage(config, blocks, options) {
|
|
|
215
216
|
const Editor = options?.editor;
|
|
216
217
|
const clientConfig = {
|
|
217
218
|
apiUrl: config.apiUrl,
|
|
219
|
+
org: config.org,
|
|
218
220
|
workspaceSlug: config.workspaceSlug
|
|
219
221
|
};
|
|
220
222
|
const client = createCmssyClient(clientConfig);
|
|
@@ -369,6 +371,7 @@ function createCmssyNotFound(config, blocks, options) {
|
|
|
369
371
|
}
|
|
370
372
|
const clientConfig = {
|
|
371
373
|
apiUrl: config.apiUrl,
|
|
374
|
+
org: config.org,
|
|
372
375
|
workspaceSlug: config.workspaceSlug
|
|
373
376
|
};
|
|
374
377
|
const fallback = options?.fallback ?? /* @__PURE__ */ jsx(DefaultNotFound, {});
|
|
@@ -487,6 +490,7 @@ function localizedPath(slug, locale, defaultLocale) {
|
|
|
487
490
|
function createCmssySitemap(config, options = {}) {
|
|
488
491
|
const clientConfig = {
|
|
489
492
|
apiUrl: config.apiUrl,
|
|
493
|
+
org: config.org,
|
|
490
494
|
workspaceSlug: config.workspaceSlug
|
|
491
495
|
};
|
|
492
496
|
return async function sitemap() {
|
|
@@ -538,6 +542,7 @@ function pick(value, locale, defaultLocale) {
|
|
|
538
542
|
async function buildCmssyMetadata(config, path, options = {}) {
|
|
539
543
|
const clientConfig = {
|
|
540
544
|
apiUrl: config.apiUrl,
|
|
545
|
+
org: config.org,
|
|
541
546
|
workspaceSlug: config.workspaceSlug
|
|
542
547
|
};
|
|
543
548
|
const [meta, siteConfig, baseUrl] = await Promise.all([
|
|
@@ -668,6 +673,7 @@ async function resolveLocaleFromPathname(config, pathname) {
|
|
|
668
673
|
const hasStaticLocales = !!config.enabledLocales?.length;
|
|
669
674
|
const fetched = config.defaultLocale && hasStaticLocales ? null : await resolveSiteLocales({
|
|
670
675
|
apiUrl: config.apiUrl,
|
|
676
|
+
org: config.org,
|
|
671
677
|
workspaceSlug: config.workspaceSlug
|
|
672
678
|
});
|
|
673
679
|
const siteLocales = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@cmssy/react": "^0.
|
|
44
|
+
"@cmssy/react": "^0.16.0",
|
|
45
45
|
"next": ">=15",
|
|
46
46
|
"react": "^18.2.0 || ^19.0.0",
|
|
47
47
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"tsup": "^8.3.0",
|
|
56
56
|
"typescript": "^5.6.0",
|
|
57
57
|
"vitest": "^2.1.0",
|
|
58
|
-
"@cmssy/react": "0.
|
|
58
|
+
"@cmssy/react": "0.16.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"jose": "^6.2.3"
|