@cmssy/next 11.6.0 → 11.8.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.
@@ -15,15 +15,6 @@ interface CmssyEditorProps {
15
15
  resolvedContent?: Record<string, Record<string, unknown>>;
16
16
  appContext?: Record<string, unknown>;
17
17
  }
18
- /**
19
- * What the app wants its blocks to see, beyond the content: a signed-in member,
20
- * a feature flag, the active path. Given a function it is called per request
21
- * with the page being rendered, which is the useful form - a value fixed at
22
- * module scope cannot vary by visitor.
23
- *
24
- * Whatever it returns lands on `context.app`, untouched, on the deployed page
25
- * and in the editor alike.
26
- */
27
18
  type CmssyAppContext = Record<string, unknown> | ((args: {
28
19
  page: CmssyPageData;
29
20
  locale: string;
@@ -42,23 +33,7 @@ interface CatchAllProps {
42
33
  params?: Promise<CatchAllParams>;
43
34
  searchParams?: Promise<SearchParams>;
44
35
  }
45
- /**
46
- * Public catch-all page. Statically renderable: it never reads
47
- * `searchParams` or `headers()` - awaiting either forces every route
48
- * dynamic and kills ISR (CMS-952). Draft-mode preview (the authenticated
49
- * /api/draft cookie) still works per-request via `draftMode()`, which is
50
- * static-safe, and renders draft CONTENT without the editor (CMS-948).
51
- * The editor-iframe flow (`?cmssyEdit=1&cmssySecret=...`) is served by
52
- * the middleware rewrite (`cmssyEditRewrite`) onto the dynamic edit route
53
- * mounted with `createCmssyEditPage`.
54
- */
55
36
  declare function createCmssyPage(config: CmssyConfig, blocks: BlockDefinition[], options?: CreateCmssyPageOptions): ({ params, searchParams, }: CatchAllProps) => Promise<react_jsx_runtime.JSX.Element>;
56
- /**
57
- * Editor page for the middleware-rewritten edit route
58
- * (`app/cmssy-edit/[[...path]]/page.tsx`, `dynamic = "force-dynamic"`).
59
- * Re-verifies the `cmssyEdit` + `cmssySecret` pair itself, so a direct hit
60
- * on the route path (bypassing the middleware) cannot mount the editor.
61
- */
62
37
  declare function createCmssyEditPage(config: CmssyConfig, blocks: BlockDefinition[], options?: CreateCmssyPageOptions): ({ params, searchParams, }: CatchAllProps) => Promise<react_jsx_runtime.JSX.Element>;
63
38
 
64
39
  export { type CmssyAppContext as C, type CmssyEditorProps as a, type CreateCmssyPageOptions as b, createCmssyEditPage as c, createCmssyPage as d };
@@ -15,15 +15,6 @@ interface CmssyEditorProps {
15
15
  resolvedContent?: Record<string, Record<string, unknown>>;
16
16
  appContext?: Record<string, unknown>;
17
17
  }
18
- /**
19
- * What the app wants its blocks to see, beyond the content: a signed-in member,
20
- * a feature flag, the active path. Given a function it is called per request
21
- * with the page being rendered, which is the useful form - a value fixed at
22
- * module scope cannot vary by visitor.
23
- *
24
- * Whatever it returns lands on `context.app`, untouched, on the deployed page
25
- * and in the editor alike.
26
- */
27
18
  type CmssyAppContext = Record<string, unknown> | ((args: {
28
19
  page: CmssyPageData;
29
20
  locale: string;
@@ -42,23 +33,7 @@ interface CatchAllProps {
42
33
  params?: Promise<CatchAllParams>;
43
34
  searchParams?: Promise<SearchParams>;
44
35
  }
45
- /**
46
- * Public catch-all page. Statically renderable: it never reads
47
- * `searchParams` or `headers()` - awaiting either forces every route
48
- * dynamic and kills ISR (CMS-952). Draft-mode preview (the authenticated
49
- * /api/draft cookie) still works per-request via `draftMode()`, which is
50
- * static-safe, and renders draft CONTENT without the editor (CMS-948).
51
- * The editor-iframe flow (`?cmssyEdit=1&cmssySecret=...`) is served by
52
- * the middleware rewrite (`cmssyEditRewrite`) onto the dynamic edit route
53
- * mounted with `createCmssyEditPage`.
54
- */
55
36
  declare function createCmssyPage(config: CmssyConfig, blocks: BlockDefinition[], options?: CreateCmssyPageOptions): ({ params, searchParams, }: CatchAllProps) => Promise<react_jsx_runtime.JSX.Element>;
56
- /**
57
- * Editor page for the middleware-rewritten edit route
58
- * (`app/cmssy-edit/[[...path]]/page.tsx`, `dynamic = "force-dynamic"`).
59
- * Re-verifies the `cmssyEdit` + `cmssySecret` pair itself, so a direct hit
60
- * on the route path (bypassing the middleware) cannot mount the editor.
61
- */
62
37
  declare function createCmssyEditPage(config: CmssyConfig, blocks: BlockDefinition[], options?: CreateCmssyPageOptions): ({ params, searchParams, }: CatchAllProps) => Promise<react_jsx_runtime.JSX.Element>;
63
38
 
64
39
  export { type CmssyAppContext as C, type CmssyEditorProps as a, type CreateCmssyPageOptions as b, createCmssyEditPage as c, createCmssyPage as d };
package/dist/index.cjs CHANGED
@@ -20,6 +20,10 @@ Object.defineProperty(exports, "CMSSY_SECRET_QUERY_PARAM", {
20
20
  enumerable: true,
21
21
  get: function () { return core.CMSSY_SECRET_QUERY_PARAM; }
22
22
  });
23
+ Object.defineProperty(exports, "CmssyWebhookError", {
24
+ enumerable: true,
25
+ get: function () { return core.CmssyWebhookError; }
26
+ });
23
27
  Object.defineProperty(exports, "DEFAULT_CMSSY_EDITOR_ORIGINS", {
24
28
  enumerable: true,
25
29
  get: function () { return core.DEFAULT_CMSSY_EDITOR_ORIGINS; }
@@ -36,3 +40,7 @@ Object.defineProperty(exports, "resolveEditorOrigin", {
36
40
  enumerable: true,
37
41
  get: function () { return core.resolveEditorOrigin; }
38
42
  });
43
+ Object.defineProperty(exports, "verifyCmssyWebhook", {
44
+ enumerable: true,
45
+ get: function () { return core.verifyCmssyWebhook; }
46
+ });
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, DEFAULT_CMSSY_EDITOR_ORIGINS, defineCmssyConfig, localizeHref, resolveEditorOrigin } from '@cmssy/core';
2
- export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions } from './index-B64zk2X7.cjs';
1
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, VerifyCmssyWebhookOptions, defineCmssyConfig, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
2
+ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions } from './index-BCHSAhKJ.cjs';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import '@cmssy/react';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, DEFAULT_CMSSY_EDITOR_ORIGINS, defineCmssyConfig, localizeHref, resolveEditorOrigin } from '@cmssy/core';
2
- export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions } from './index-B64zk2X7.js';
1
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, VerifyCmssyWebhookOptions, defineCmssyConfig, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
2
+ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions } from './index-BCHSAhKJ.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import '@cmssy/react';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, DEFAULT_CMSSY_EDITOR_ORIGINS, defineCmssyConfig, localizeHref, resolveEditorOrigin } from '@cmssy/core';
1
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, DEFAULT_CMSSY_EDITOR_ORIGINS, defineCmssyConfig, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
@@ -75,9 +75,6 @@ function createCmssyProxy(config, options = {}) {
75
75
  response.cookies.set(write.name, write.value, {
76
76
  ...DEFAULT_COOKIE_OPTIONS,
77
77
  ...write.options,
78
- // Deletion wins over the caller's options. They will be the same
79
- // options the cookie was written with, maxAge included, and honoring
80
- // that here would keep an emptied cookie alive instead of removing it.
81
78
  ...write.value ? {} : { maxAge: 0 }
82
79
  });
83
80
  }
@@ -2,90 +2,24 @@ import { NextResponse, NextRequest } from 'next/server';
2
2
  import { CmssyConfig } from '@cmssy/core';
3
3
  export { CMSSY_EDIT_HEADER, CmssyCspOptions, applyCmssyCsp } from '@cmssy/core';
4
4
 
5
- /** A cookie the proxy writes on this request. An empty value deletes it. */
6
5
  interface CmssyProxyCookie {
7
6
  name: string;
8
7
  value: string;
9
- /** Passed to `response.cookies.set`; defaults to httpOnly + sameSite lax. */
10
8
  options?: Omit<Parameters<NextResponse["cookies"]["set"]>[2], "name" | "value">;
11
9
  }
12
10
  interface CmssyProxyOptions {
13
- /**
14
- * Strip the language prefix before the app sees it, so static routes like
15
- * `/shop/cart` serve `/no/shop/cart` too. Leave it off for a catch-all app
16
- * that reads the language off the path itself.
17
- */
18
11
  stripLocalePrefix?: boolean;
19
- /**
20
- * Cookies this request has to write - a refreshed session, a freshly minted
21
- * cart id. They are set on the response AND merged into the cookie header the
22
- * app is about to be rendered with, so THIS render already sees them; setting
23
- * them on the response alone means the value only arrives on the next
24
- * navigation, which is how a signed-in visitor renders signed-out once.
25
- *
26
- * It is the escape hatch that keeps an app from re-implementing the whole
27
- * preset - locale, edit rewrite and CSP included - to add one cookie.
28
- */
29
12
  cookies?: (request: NextRequest) => Promise<CmssyProxyCookie[]> | CmssyProxyCookie[];
30
13
  }
31
- /**
32
- * The whole middleware a cmssy app needs, in the order it has to happen:
33
- *
34
- * 1. resolve the language and pass it on (a route cannot read the prefix it
35
- * never sees);
36
- * 2. send a VERIFIED editor request to /cmssy-edit, carrying that language and
37
- * the edit flag - the public pages are static, and a static page never sees
38
- * the query string that would put it in edit mode;
39
- * 3. strip the language prefix for everything else, if asked.
40
- *
41
- * The order is not a detail: resolve the locale after the rewrite and the editor
42
- * preview renders in the wrong language; forget the edit flag and the header and
43
- * footer become markup the editor can select but not fill. Both mistakes shipped
44
- * before this existed.
45
- */
46
14
  declare function createCmssyProxy(config: CmssyConfig, options?: CmssyProxyOptions): (request: NextRequest) => Promise<NextResponse>;
47
- /**
48
- * The matcher a cmssy app wants: everything except Next internals, API routes
49
- * and files with an extension.
50
- *
51
- * Next parses `export const config` at COMPILE time, so it rejects an imported
52
- * constant - copy this value into your proxy literally:
53
- *
54
- * export const config = { matcher: ["/((?!_next/|api/|.*\\..*).*)"] };
55
- */
56
15
  declare const cmssyProxyMatcher: string[];
57
16
 
58
- /**
59
- * Where the middleware rewrites editor-preview traffic. Mount the matching
60
- * dynamic route in the consumer app:
61
- *
62
- * app/cmssy-edit/[[...path]]/page.tsx
63
- * export const dynamic = "force-dynamic";
64
- * export default createCmssyEditPage(cmssy, blocks, { editor: Editor });
65
- */
66
17
  declare const CMSSY_EDIT_PATH_PREFIX = "/cmssy-edit";
67
- /**
68
- * Rewrite VERIFIED editor requests (`cmssyEdit=1` + a `cmssySecret` matching
69
- * the site's draft secret, CMS-948) onto the dedicated dynamic edit route, so
70
- * the public catch-all can stay fully static. A static page never sees its
71
- * query string - this rewrite is what makes the editor iframe work at all
72
- * once ISR is on. Draft-mode preview (the authenticated /api/draft cookie) is
73
- * NOT rewritten: it renders draft content on the public route via
74
- * `draftMode()`, without the editor. Returns null for normal traffic so it
75
- * composes with other middleware.
76
- */
77
18
  declare function cmssyEditRewrite(request: NextRequest, config: {
78
19
  draftSecret: string;
79
20
  }, options?: {
80
- /**
81
- * Headers to forward to the edit route, for a site whose middleware tells
82
- * the app something the path alone does not - a resolved locale, say.
83
- * Without them the editor preview renders in the default language while the
84
- * public page renders in the visitor's.
85
- */
86
21
  requestHeaders?: Headers;
87
22
  }): Promise<NextResponse | null>;
88
- /** Standalone middleware when the consumer has no other middleware to compose. */
89
23
  declare function createCmssyEditMiddleware(config: {
90
24
  draftSecret: string;
91
25
  }): (request: NextRequest) => Promise<NextResponse>;
@@ -2,90 +2,24 @@ import { NextResponse, NextRequest } from 'next/server';
2
2
  import { CmssyConfig } from '@cmssy/core';
3
3
  export { CMSSY_EDIT_HEADER, CmssyCspOptions, applyCmssyCsp } from '@cmssy/core';
4
4
 
5
- /** A cookie the proxy writes on this request. An empty value deletes it. */
6
5
  interface CmssyProxyCookie {
7
6
  name: string;
8
7
  value: string;
9
- /** Passed to `response.cookies.set`; defaults to httpOnly + sameSite lax. */
10
8
  options?: Omit<Parameters<NextResponse["cookies"]["set"]>[2], "name" | "value">;
11
9
  }
12
10
  interface CmssyProxyOptions {
13
- /**
14
- * Strip the language prefix before the app sees it, so static routes like
15
- * `/shop/cart` serve `/no/shop/cart` too. Leave it off for a catch-all app
16
- * that reads the language off the path itself.
17
- */
18
11
  stripLocalePrefix?: boolean;
19
- /**
20
- * Cookies this request has to write - a refreshed session, a freshly minted
21
- * cart id. They are set on the response AND merged into the cookie header the
22
- * app is about to be rendered with, so THIS render already sees them; setting
23
- * them on the response alone means the value only arrives on the next
24
- * navigation, which is how a signed-in visitor renders signed-out once.
25
- *
26
- * It is the escape hatch that keeps an app from re-implementing the whole
27
- * preset - locale, edit rewrite and CSP included - to add one cookie.
28
- */
29
12
  cookies?: (request: NextRequest) => Promise<CmssyProxyCookie[]> | CmssyProxyCookie[];
30
13
  }
31
- /**
32
- * The whole middleware a cmssy app needs, in the order it has to happen:
33
- *
34
- * 1. resolve the language and pass it on (a route cannot read the prefix it
35
- * never sees);
36
- * 2. send a VERIFIED editor request to /cmssy-edit, carrying that language and
37
- * the edit flag - the public pages are static, and a static page never sees
38
- * the query string that would put it in edit mode;
39
- * 3. strip the language prefix for everything else, if asked.
40
- *
41
- * The order is not a detail: resolve the locale after the rewrite and the editor
42
- * preview renders in the wrong language; forget the edit flag and the header and
43
- * footer become markup the editor can select but not fill. Both mistakes shipped
44
- * before this existed.
45
- */
46
14
  declare function createCmssyProxy(config: CmssyConfig, options?: CmssyProxyOptions): (request: NextRequest) => Promise<NextResponse>;
47
- /**
48
- * The matcher a cmssy app wants: everything except Next internals, API routes
49
- * and files with an extension.
50
- *
51
- * Next parses `export const config` at COMPILE time, so it rejects an imported
52
- * constant - copy this value into your proxy literally:
53
- *
54
- * export const config = { matcher: ["/((?!_next/|api/|.*\\..*).*)"] };
55
- */
56
15
  declare const cmssyProxyMatcher: string[];
57
16
 
58
- /**
59
- * Where the middleware rewrites editor-preview traffic. Mount the matching
60
- * dynamic route in the consumer app:
61
- *
62
- * app/cmssy-edit/[[...path]]/page.tsx
63
- * export const dynamic = "force-dynamic";
64
- * export default createCmssyEditPage(cmssy, blocks, { editor: Editor });
65
- */
66
17
  declare const CMSSY_EDIT_PATH_PREFIX = "/cmssy-edit";
67
- /**
68
- * Rewrite VERIFIED editor requests (`cmssyEdit=1` + a `cmssySecret` matching
69
- * the site's draft secret, CMS-948) onto the dedicated dynamic edit route, so
70
- * the public catch-all can stay fully static. A static page never sees its
71
- * query string - this rewrite is what makes the editor iframe work at all
72
- * once ISR is on. Draft-mode preview (the authenticated /api/draft cookie) is
73
- * NOT rewritten: it renders draft content on the public route via
74
- * `draftMode()`, without the editor. Returns null for normal traffic so it
75
- * composes with other middleware.
76
- */
77
18
  declare function cmssyEditRewrite(request: NextRequest, config: {
78
19
  draftSecret: string;
79
20
  }, options?: {
80
- /**
81
- * Headers to forward to the edit route, for a site whose middleware tells
82
- * the app something the path alone does not - a resolved locale, say.
83
- * Without them the editor preview renders in the default language while the
84
- * public page renders in the visitor's.
85
- */
86
21
  requestHeaders?: Headers;
87
22
  }): Promise<NextResponse | null>;
88
- /** Standalone middleware when the consumer has no other middleware to compose. */
89
23
  declare function createCmssyEditMiddleware(config: {
90
24
  draftSecret: string;
91
25
  }): (request: NextRequest) => Promise<NextResponse>;
@@ -74,9 +74,6 @@ function createCmssyProxy(config, options = {}) {
74
74
  response.cookies.set(write.name, write.value, {
75
75
  ...DEFAULT_COOKIE_OPTIONS,
76
76
  ...write.options,
77
- // Deletion wins over the caller's options. They will be the same
78
- // options the cookie was written with, maxAge included, and honoring
79
- // that here would keep an emptied cookie alive instead of removing it.
80
77
  ...write.value ? {} : { maxAge: 0 }
81
78
  });
82
79
  }
package/dist/server.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, c as createCmssyEditPage, d as createCmssyPage } from './index-B64zk2X7.cjs';
1
+ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, c as createCmssyEditPage, d as createCmssyPage } from './index-BCHSAhKJ.cjs';
2
2
  import { CmssyConfig, LayoutPosition } from '@cmssy/core';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ComponentType } from 'react';
@@ -15,32 +15,9 @@ declare function isCmssyEditMode(): Promise<boolean>;
15
15
  interface CmssyLayoutSlotBaseProps {
16
16
  config: CmssyConfig;
17
17
  blocks: BlockDefinition[];
18
- /**
19
- * Which layout position to render. Six exist - `top`, `header`,
20
- * `sidebar_left`, `sidebar_right`, `footer`, `bottom` - and most sites use
21
- * two of them; the type is what tells you about the other four.
22
- */
23
18
  position: LayoutPosition;
24
- /**
25
- * Whether to render through the edit bridge. A parameter rather than a
26
- * lookup: every way of asking the request - `headers()`, `draftMode()` - is a
27
- * dynamic API, and one read makes the whole route uncacheable. The route
28
- * segment already knows the answer, so it passes it.
29
- *
30
- * Required on purpose. A slot that guessed `false` in an edit route would
31
- * wrap draft content in published chrome, and nothing would report it.
32
- */
33
19
  editMode: boolean;
34
- /** The page whose layout to render. Defaults to the site-wide header/footer. */
35
20
  page?: string;
36
- /**
37
- * The client wrapper around `CmssyLazyLayout`, rendered in edit mode.
38
- *
39
- * Required, and a component rather than a loader: the block registry has to
40
- * be imported lazily ON THE CLIENT, and a function cannot cross the server
41
- * boundary. Without it the editor gets a header it can select and not fill -
42
- * which is why this is a type error rather than a runtime warning.
43
- */
44
21
  editable: ComponentType<{
45
22
  groups: CmssyLayoutGroup[];
46
23
  position: string;
@@ -54,19 +31,8 @@ interface CmssyLayoutSlotBaseProps {
54
31
  resolvedContent?: Record<string, Record<string, unknown>>;
55
32
  appContext?: Record<string, unknown>;
56
33
  }>;
57
- /** Forwarded untouched to every block as `context.app`. */
58
34
  appContext?: Record<string, unknown>;
59
35
  }
60
- /**
61
- * Where the language comes from - one of two, never neither.
62
- *
63
- * `path` is the catch-all segments **as routed**: the language prefix in them
64
- * IS the language, and reading it costs the route nothing. A caller with no
65
- * params (a root layout) has to resolve the language itself and pass `locale`;
66
- * there is deliberately no fallback to the request header, because a static
67
- * route never sees the header the proxy set and would render the wrong
68
- * language while looking like it worked.
69
- */
70
36
  type CmssyLayoutSlotLocaleSource = {
71
37
  path: string[];
72
38
  locale?: never;
@@ -75,20 +41,6 @@ type CmssyLayoutSlotLocaleSource = {
75
41
  path?: never;
76
42
  };
77
43
  type CmssyLayoutSlotProps = CmssyLayoutSlotBaseProps & CmssyLayoutSlotLocaleSource;
78
- /**
79
- * The site-wide header and footer, which are layout **blocks** rather than
80
- * markup the app owns. Rendered the way each mode needs them:
81
- *
82
- * - published traffic: server-rendered blocks, no client cost;
83
- * - the editor: the same blocks through the edit bridge, fetched with the
84
- * preview secret and handed their server-resolved content, so a relation
85
- * field shows records rather than the ids it stores.
86
- *
87
- * Getting any of that wrong is invisible - the site looks right while the
88
- * editor shows a header it cannot fill, or the published version of one. Every
89
- * app that wrote this by hand between 10.0 and 10.9 got at least one of the
90
- * three wrong, which is why it is back.
91
- */
92
44
  declare function CmssyLayoutSlot({ config, blocks, position, path, locale: explicitLocale, editMode, page, editable: Editable, appContext, }: CmssyLayoutSlotProps): Promise<react_jsx_runtime.JSX.Element>;
93
45
 
94
46
  export { type CmssyDraftRouteConfig, CmssyLayoutSlot, type CmssyLayoutSlotProps, createDraftRoute, isCmssyEditMode };
package/dist/server.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, c as createCmssyEditPage, d as createCmssyPage } from './index-B64zk2X7.js';
1
+ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, c as createCmssyEditPage, d as createCmssyPage } from './index-BCHSAhKJ.js';
2
2
  import { CmssyConfig, LayoutPosition } from '@cmssy/core';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ComponentType } from 'react';
@@ -15,32 +15,9 @@ declare function isCmssyEditMode(): Promise<boolean>;
15
15
  interface CmssyLayoutSlotBaseProps {
16
16
  config: CmssyConfig;
17
17
  blocks: BlockDefinition[];
18
- /**
19
- * Which layout position to render. Six exist - `top`, `header`,
20
- * `sidebar_left`, `sidebar_right`, `footer`, `bottom` - and most sites use
21
- * two of them; the type is what tells you about the other four.
22
- */
23
18
  position: LayoutPosition;
24
- /**
25
- * Whether to render through the edit bridge. A parameter rather than a
26
- * lookup: every way of asking the request - `headers()`, `draftMode()` - is a
27
- * dynamic API, and one read makes the whole route uncacheable. The route
28
- * segment already knows the answer, so it passes it.
29
- *
30
- * Required on purpose. A slot that guessed `false` in an edit route would
31
- * wrap draft content in published chrome, and nothing would report it.
32
- */
33
19
  editMode: boolean;
34
- /** The page whose layout to render. Defaults to the site-wide header/footer. */
35
20
  page?: string;
36
- /**
37
- * The client wrapper around `CmssyLazyLayout`, rendered in edit mode.
38
- *
39
- * Required, and a component rather than a loader: the block registry has to
40
- * be imported lazily ON THE CLIENT, and a function cannot cross the server
41
- * boundary. Without it the editor gets a header it can select and not fill -
42
- * which is why this is a type error rather than a runtime warning.
43
- */
44
21
  editable: ComponentType<{
45
22
  groups: CmssyLayoutGroup[];
46
23
  position: string;
@@ -54,19 +31,8 @@ interface CmssyLayoutSlotBaseProps {
54
31
  resolvedContent?: Record<string, Record<string, unknown>>;
55
32
  appContext?: Record<string, unknown>;
56
33
  }>;
57
- /** Forwarded untouched to every block as `context.app`. */
58
34
  appContext?: Record<string, unknown>;
59
35
  }
60
- /**
61
- * Where the language comes from - one of two, never neither.
62
- *
63
- * `path` is the catch-all segments **as routed**: the language prefix in them
64
- * IS the language, and reading it costs the route nothing. A caller with no
65
- * params (a root layout) has to resolve the language itself and pass `locale`;
66
- * there is deliberately no fallback to the request header, because a static
67
- * route never sees the header the proxy set and would render the wrong
68
- * language while looking like it worked.
69
- */
70
36
  type CmssyLayoutSlotLocaleSource = {
71
37
  path: string[];
72
38
  locale?: never;
@@ -75,20 +41,6 @@ type CmssyLayoutSlotLocaleSource = {
75
41
  path?: never;
76
42
  };
77
43
  type CmssyLayoutSlotProps = CmssyLayoutSlotBaseProps & CmssyLayoutSlotLocaleSource;
78
- /**
79
- * The site-wide header and footer, which are layout **blocks** rather than
80
- * markup the app owns. Rendered the way each mode needs them:
81
- *
82
- * - published traffic: server-rendered blocks, no client cost;
83
- * - the editor: the same blocks through the edit bridge, fetched with the
84
- * preview secret and handed their server-resolved content, so a relation
85
- * field shows records rather than the ids it stores.
86
- *
87
- * Getting any of that wrong is invisible - the site looks right while the
88
- * editor shows a header it cannot fill, or the published version of one. Every
89
- * app that wrote this by hand between 10.0 and 10.9 got at least one of the
90
- * three wrong, which is why it is back.
91
- */
92
44
  declare function CmssyLayoutSlot({ config, blocks, position, path, locale: explicitLocale, editMode, page, editable: Editable, appContext, }: CmssyLayoutSlotProps): Promise<react_jsx_runtime.JSX.Element>;
93
45
 
94
46
  export { type CmssyDraftRouteConfig, CmssyLayoutSlot, type CmssyLayoutSlotProps, createDraftRoute, isCmssyEditMode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/next",
3
- "version": "11.6.0",
3
+ "version": "11.8.0",
4
4
  "description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -24,24 +24,44 @@
24
24
  "sideEffects": false,
25
25
  "exports": {
26
26
  ".": {
27
- "types": "./dist/index.d.ts",
28
- "import": "./dist/index.js",
29
- "require": "./dist/index.cjs"
27
+ "import": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "require": {
32
+ "types": "./dist/index.d.cts",
33
+ "default": "./dist/index.cjs"
34
+ }
30
35
  },
31
36
  "./server": {
32
- "types": "./dist/server.d.ts",
33
- "import": "./dist/server.js",
34
- "require": "./dist/server.cjs"
37
+ "import": {
38
+ "types": "./dist/server.d.ts",
39
+ "default": "./dist/server.js"
40
+ },
41
+ "require": {
42
+ "types": "./dist/server.d.cts",
43
+ "default": "./dist/server.cjs"
44
+ }
35
45
  },
36
46
  "./middleware": {
37
- "types": "./dist/middleware.d.ts",
38
- "import": "./dist/middleware.js",
39
- "require": "./dist/middleware.cjs"
47
+ "import": {
48
+ "types": "./dist/middleware.d.ts",
49
+ "default": "./dist/middleware.js"
50
+ },
51
+ "require": {
52
+ "types": "./dist/middleware.d.cts",
53
+ "default": "./dist/middleware.cjs"
54
+ }
40
55
  },
41
56
  "./testing": {
42
- "types": "./dist/testing.d.ts",
43
- "import": "./dist/testing.js",
44
- "require": "./dist/testing.cjs"
57
+ "import": {
58
+ "types": "./dist/testing.d.ts",
59
+ "default": "./dist/testing.js"
60
+ },
61
+ "require": {
62
+ "types": "./dist/testing.d.cts",
63
+ "default": "./dist/testing.cjs"
64
+ }
45
65
  }
46
66
  },
47
67
  "main": "./dist/index.cjs",
@@ -65,12 +85,12 @@
65
85
  "tsup": "^8.3.0",
66
86
  "typescript": "^5.6.0",
67
87
  "vitest": "^2.1.0",
68
- "@cmssy/react": "11.6.0"
88
+ "@cmssy/react": "11.8.0"
69
89
  },
70
90
  "dependencies": {
71
91
  "@cmssy/types": "0.33.0",
72
92
  "server-only": "^0.0.1",
73
- "@cmssy/core": "11.6.0"
93
+ "@cmssy/core": "11.8.0"
74
94
  },
75
95
  "scripts": {
76
96
  "build": "tsup",