@cmssy/next 14.0.0 → 14.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/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/server.cjs +17 -34
- package/dist/server.d.cts +14 -20
- package/dist/server.d.ts +14 -20
- package/dist/server.js +19 -37
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyLayout, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, LayoutRegion, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, defineCmssyConfig, defineCmssyLayout, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
|
|
1
|
+
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyLayout, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRegionSettingsOf, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, LayoutRegion, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, defineCmssyConfig, defineCmssyLayout, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
|
|
2
2
|
export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, N as NEXT_BUILD_PHASE, n as nextRetryMode } from './index-ZUEbpOlo.cjs';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyLayout, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, LayoutRegion, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, defineCmssyConfig, defineCmssyLayout, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
|
|
1
|
+
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyLayout, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRegionSettingsOf, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, LayoutRegion, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, defineCmssyConfig, defineCmssyLayout, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
|
|
2
2
|
export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, N as NEXT_BUILD_PHASE, n as nextRetryMode } from './index-ZUEbpOlo.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
package/dist/server.cjs
CHANGED
|
@@ -264,51 +264,33 @@ async function CmssyLayoutSlot({
|
|
|
264
264
|
path,
|
|
265
265
|
locale: explicitLocale,
|
|
266
266
|
editMode,
|
|
267
|
+
preview,
|
|
267
268
|
page,
|
|
268
|
-
editable
|
|
269
|
+
editable,
|
|
269
270
|
appContext,
|
|
270
|
-
retry
|
|
271
|
+
retry,
|
|
272
|
+
children
|
|
271
273
|
}) {
|
|
272
|
-
const
|
|
274
|
+
const layout = await react.resolveCmssyLayout(config, {
|
|
273
275
|
position,
|
|
274
276
|
blocks,
|
|
275
277
|
editMode,
|
|
278
|
+
preview,
|
|
279
|
+
editable,
|
|
276
280
|
...page !== void 0 ? { page } : {},
|
|
277
281
|
appContext,
|
|
278
282
|
retry: retry ?? nextRetryMode(),
|
|
279
283
|
...explicitLocale !== void 0 ? { locale: explicitLocale } : { path: path ?? [] }
|
|
280
284
|
});
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
defaultLocale,
|
|
291
|
-
enabledLocales,
|
|
292
|
-
config,
|
|
293
|
-
appContext
|
|
294
|
-
}
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
const origin = resolved.editorOrigin;
|
|
298
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
299
|
-
Editable,
|
|
300
|
-
{
|
|
301
|
-
groups,
|
|
302
|
-
position,
|
|
303
|
-
locale,
|
|
304
|
-
defaultLocale,
|
|
305
|
-
enabledLocales,
|
|
306
|
-
edit: { editorOrigin: origin ?? "" },
|
|
307
|
-
data: resolved.data,
|
|
308
|
-
resolvedContent: resolved.resolvedContent,
|
|
309
|
-
appContext
|
|
310
|
-
}
|
|
311
|
-
);
|
|
285
|
+
if (!children) return layout.element;
|
|
286
|
+
const { groups, settings, page: routed, element } = layout;
|
|
287
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children({ groups, settings, page: routed, element }) });
|
|
288
|
+
}
|
|
289
|
+
function resolveCmssyLayout2(config, options) {
|
|
290
|
+
return react.resolveCmssyLayout(config, {
|
|
291
|
+
...options,
|
|
292
|
+
retry: options.retry ?? nextRetryMode()
|
|
293
|
+
});
|
|
312
294
|
}
|
|
313
295
|
|
|
314
296
|
exports.CmssyLayoutSlot = CmssyLayoutSlot;
|
|
@@ -318,3 +300,4 @@ exports.createCmssyPage = createCmssyPage;
|
|
|
318
300
|
exports.createDraftRoute = createDraftRoute;
|
|
319
301
|
exports.isCmssyEditMode = isCmssyEditMode;
|
|
320
302
|
exports.nextRetryMode = nextRetryMode;
|
|
303
|
+
exports.resolveCmssyLayout = resolveCmssyLayout2;
|
package/dist/server.d.cts
CHANGED
|
@@ -2,8 +2,9 @@ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOption
|
|
|
2
2
|
import { CmssyConfig, CmssyRegionOf, RetryOption } from '@cmssy/core';
|
|
3
3
|
export { CmssyRetryMode, RetryOption, RetryPolicy } from '@cmssy/core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
-
import { ComponentType } from 'react';
|
|
6
|
-
import { BlockDefinition,
|
|
5
|
+
import { ComponentType, ReactNode } from 'react';
|
|
6
|
+
import { BlockDefinition, CmssyLayoutEditableProps, CmssyLayoutResolution, ResolveCmssyLayoutOptions } from '@cmssy/react';
|
|
7
|
+
export { CmssyLayoutEditableProps, CmssyLayoutResolution, ResolveCmssyLayoutOptions } from '@cmssy/react';
|
|
7
8
|
import '@cmssy/react/client';
|
|
8
9
|
|
|
9
10
|
type CmssyDraftRouteConfig = Pick<CmssyConfig, "draftSecret"> & {
|
|
@@ -13,27 +14,18 @@ declare function createDraftRoute(config: CmssyDraftRouteConfig): (request: Requ
|
|
|
13
14
|
|
|
14
15
|
declare function isCmssyEditMode(): Promise<boolean>;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
type CmssyLayoutSlotRenderProps<C extends CmssyConfig = CmssyConfig, P extends CmssyRegionOf<C> = CmssyRegionOf<C>> = Pick<CmssyLayoutResolution<C, P>, "groups" | "settings" | "page" | "element">;
|
|
18
|
+
interface CmssyLayoutSlotBaseProps<C extends CmssyConfig, P extends CmssyRegionOf<C>> {
|
|
17
19
|
config: C;
|
|
18
20
|
blocks: BlockDefinition[];
|
|
19
|
-
position:
|
|
21
|
+
position: P;
|
|
20
22
|
editMode: boolean;
|
|
23
|
+
preview?: boolean;
|
|
21
24
|
page?: string;
|
|
22
|
-
editable: ComponentType<
|
|
23
|
-
groups: CmssyLayoutGroup[];
|
|
24
|
-
position: string;
|
|
25
|
-
locale: string;
|
|
26
|
-
defaultLocale: string;
|
|
27
|
-
enabledLocales: string[];
|
|
28
|
-
edit: {
|
|
29
|
-
editorOrigin: string | string[];
|
|
30
|
-
};
|
|
31
|
-
data?: Record<string, unknown>;
|
|
32
|
-
resolvedContent?: Record<string, Record<string, unknown>>;
|
|
33
|
-
appContext?: Record<string, unknown>;
|
|
34
|
-
}>;
|
|
25
|
+
editable: ComponentType<CmssyLayoutEditableProps>;
|
|
35
26
|
appContext?: Record<string, unknown>;
|
|
36
27
|
retry?: RetryOption;
|
|
28
|
+
children?: (layout: CmssyLayoutSlotRenderProps<C, P>) => ReactNode;
|
|
37
29
|
}
|
|
38
30
|
type CmssyLayoutSlotLocaleSource = {
|
|
39
31
|
path: string[];
|
|
@@ -42,7 +34,9 @@ type CmssyLayoutSlotLocaleSource = {
|
|
|
42
34
|
locale: string;
|
|
43
35
|
path?: never;
|
|
44
36
|
};
|
|
45
|
-
type CmssyLayoutSlotProps<C extends CmssyConfig = CmssyConfig> = CmssyLayoutSlotBaseProps<C> & CmssyLayoutSlotLocaleSource;
|
|
46
|
-
declare function CmssyLayoutSlot<C extends CmssyConfig
|
|
37
|
+
type CmssyLayoutSlotProps<C extends CmssyConfig = CmssyConfig, P extends CmssyRegionOf<C> = CmssyRegionOf<C>> = CmssyLayoutSlotBaseProps<C, P> & CmssyLayoutSlotLocaleSource;
|
|
38
|
+
declare function CmssyLayoutSlot<C extends CmssyConfig, P extends CmssyRegionOf<C>>({ config, blocks, position, path, locale: explicitLocale, editMode, preview, page, editable, appContext, retry, children, }: CmssyLayoutSlotProps<C, P>): Promise<react_jsx_runtime.JSX.Element>;
|
|
47
39
|
|
|
48
|
-
|
|
40
|
+
declare function resolveCmssyLayout<C extends CmssyConfig, P extends CmssyRegionOf<C>>(config: C, options: ResolveCmssyLayoutOptions<C, P>): Promise<CmssyLayoutResolution<C, P>>;
|
|
41
|
+
|
|
42
|
+
export { type CmssyDraftRouteConfig, CmssyLayoutSlot, type CmssyLayoutSlotProps, type CmssyLayoutSlotRenderProps, createDraftRoute, isCmssyEditMode, resolveCmssyLayout };
|
package/dist/server.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOption
|
|
|
2
2
|
import { CmssyConfig, CmssyRegionOf, RetryOption } from '@cmssy/core';
|
|
3
3
|
export { CmssyRetryMode, RetryOption, RetryPolicy } from '@cmssy/core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
-
import { ComponentType } from 'react';
|
|
6
|
-
import { BlockDefinition,
|
|
5
|
+
import { ComponentType, ReactNode } from 'react';
|
|
6
|
+
import { BlockDefinition, CmssyLayoutEditableProps, CmssyLayoutResolution, ResolveCmssyLayoutOptions } from '@cmssy/react';
|
|
7
|
+
export { CmssyLayoutEditableProps, CmssyLayoutResolution, ResolveCmssyLayoutOptions } from '@cmssy/react';
|
|
7
8
|
import '@cmssy/react/client';
|
|
8
9
|
|
|
9
10
|
type CmssyDraftRouteConfig = Pick<CmssyConfig, "draftSecret"> & {
|
|
@@ -13,27 +14,18 @@ declare function createDraftRoute(config: CmssyDraftRouteConfig): (request: Requ
|
|
|
13
14
|
|
|
14
15
|
declare function isCmssyEditMode(): Promise<boolean>;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
type CmssyLayoutSlotRenderProps<C extends CmssyConfig = CmssyConfig, P extends CmssyRegionOf<C> = CmssyRegionOf<C>> = Pick<CmssyLayoutResolution<C, P>, "groups" | "settings" | "page" | "element">;
|
|
18
|
+
interface CmssyLayoutSlotBaseProps<C extends CmssyConfig, P extends CmssyRegionOf<C>> {
|
|
17
19
|
config: C;
|
|
18
20
|
blocks: BlockDefinition[];
|
|
19
|
-
position:
|
|
21
|
+
position: P;
|
|
20
22
|
editMode: boolean;
|
|
23
|
+
preview?: boolean;
|
|
21
24
|
page?: string;
|
|
22
|
-
editable: ComponentType<
|
|
23
|
-
groups: CmssyLayoutGroup[];
|
|
24
|
-
position: string;
|
|
25
|
-
locale: string;
|
|
26
|
-
defaultLocale: string;
|
|
27
|
-
enabledLocales: string[];
|
|
28
|
-
edit: {
|
|
29
|
-
editorOrigin: string | string[];
|
|
30
|
-
};
|
|
31
|
-
data?: Record<string, unknown>;
|
|
32
|
-
resolvedContent?: Record<string, Record<string, unknown>>;
|
|
33
|
-
appContext?: Record<string, unknown>;
|
|
34
|
-
}>;
|
|
25
|
+
editable: ComponentType<CmssyLayoutEditableProps>;
|
|
35
26
|
appContext?: Record<string, unknown>;
|
|
36
27
|
retry?: RetryOption;
|
|
28
|
+
children?: (layout: CmssyLayoutSlotRenderProps<C, P>) => ReactNode;
|
|
37
29
|
}
|
|
38
30
|
type CmssyLayoutSlotLocaleSource = {
|
|
39
31
|
path: string[];
|
|
@@ -42,7 +34,9 @@ type CmssyLayoutSlotLocaleSource = {
|
|
|
42
34
|
locale: string;
|
|
43
35
|
path?: never;
|
|
44
36
|
};
|
|
45
|
-
type CmssyLayoutSlotProps<C extends CmssyConfig = CmssyConfig> = CmssyLayoutSlotBaseProps<C> & CmssyLayoutSlotLocaleSource;
|
|
46
|
-
declare function CmssyLayoutSlot<C extends CmssyConfig
|
|
37
|
+
type CmssyLayoutSlotProps<C extends CmssyConfig = CmssyConfig, P extends CmssyRegionOf<C> = CmssyRegionOf<C>> = CmssyLayoutSlotBaseProps<C, P> & CmssyLayoutSlotLocaleSource;
|
|
38
|
+
declare function CmssyLayoutSlot<C extends CmssyConfig, P extends CmssyRegionOf<C>>({ config, blocks, position, path, locale: explicitLocale, editMode, preview, page, editable, appContext, retry, children, }: CmssyLayoutSlotProps<C, P>): Promise<react_jsx_runtime.JSX.Element>;
|
|
47
39
|
|
|
48
|
-
|
|
40
|
+
declare function resolveCmssyLayout<C extends CmssyConfig, P extends CmssyRegionOf<C>>(config: C, options: ResolveCmssyLayoutOptions<C, P>): Promise<CmssyLayoutResolution<C, P>>;
|
|
41
|
+
|
|
42
|
+
export { type CmssyDraftRouteConfig, CmssyLayoutSlot, type CmssyLayoutSlotProps, type CmssyLayoutSlotRenderProps, createDraftRoute, isCmssyEditMode, resolveCmssyLayout };
|
package/dist/server.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import 'server-only';
|
|
2
2
|
import { draftMode, headers } from 'next/headers';
|
|
3
3
|
import { notFound, redirect } from 'next/navigation';
|
|
4
|
-
import { createCmssyClient, CmssyServerPage,
|
|
4
|
+
import { createCmssyClient, CmssyServerPage, resolveCmssyLayout } from '@cmssy/react';
|
|
5
5
|
import { CmssyLocaleProvider } from '@cmssy/react/internal';
|
|
6
6
|
import { blocksToSchemas, resolveEditorBlockData } from '@cmssy/react/internal-server';
|
|
7
7
|
import { isDevelopment, resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, toCspOrigin, cmssySecretsMatch } from '@cmssy/core/internal';
|
|
8
8
|
import { CMSSY_SECRET_QUERY_PARAM, resolveEditorOrigin, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM } from '@cmssy/core';
|
|
9
|
-
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
// src/server.ts
|
|
12
12
|
|
|
@@ -262,51 +262,33 @@ async function CmssyLayoutSlot({
|
|
|
262
262
|
path,
|
|
263
263
|
locale: explicitLocale,
|
|
264
264
|
editMode,
|
|
265
|
+
preview,
|
|
265
266
|
page,
|
|
266
|
-
editable
|
|
267
|
+
editable,
|
|
267
268
|
appContext,
|
|
268
|
-
retry
|
|
269
|
+
retry,
|
|
270
|
+
children
|
|
269
271
|
}) {
|
|
270
|
-
const
|
|
272
|
+
const layout = await resolveCmssyLayout(config, {
|
|
271
273
|
position,
|
|
272
274
|
blocks,
|
|
273
275
|
editMode,
|
|
276
|
+
preview,
|
|
277
|
+
editable,
|
|
274
278
|
...page !== void 0 ? { page } : {},
|
|
275
279
|
appContext,
|
|
276
280
|
retry: retry ?? nextRetryMode(),
|
|
277
281
|
...explicitLocale !== void 0 ? { locale: explicitLocale } : { path: path ?? [] }
|
|
278
282
|
});
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
defaultLocale,
|
|
289
|
-
enabledLocales,
|
|
290
|
-
config,
|
|
291
|
-
appContext
|
|
292
|
-
}
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
const origin = resolved.editorOrigin;
|
|
296
|
-
return /* @__PURE__ */ jsx(
|
|
297
|
-
Editable,
|
|
298
|
-
{
|
|
299
|
-
groups,
|
|
300
|
-
position,
|
|
301
|
-
locale,
|
|
302
|
-
defaultLocale,
|
|
303
|
-
enabledLocales,
|
|
304
|
-
edit: { editorOrigin: origin ?? "" },
|
|
305
|
-
data: resolved.data,
|
|
306
|
-
resolvedContent: resolved.resolvedContent,
|
|
307
|
-
appContext
|
|
308
|
-
}
|
|
309
|
-
);
|
|
283
|
+
if (!children) return layout.element;
|
|
284
|
+
const { groups, settings, page: routed, element } = layout;
|
|
285
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children({ groups, settings, page: routed, element }) });
|
|
286
|
+
}
|
|
287
|
+
function resolveCmssyLayout2(config, options) {
|
|
288
|
+
return resolveCmssyLayout(config, {
|
|
289
|
+
...options,
|
|
290
|
+
retry: options.retry ?? nextRetryMode()
|
|
291
|
+
});
|
|
310
292
|
}
|
|
311
293
|
|
|
312
|
-
export { CmssyLayoutSlot, NEXT_BUILD_PHASE, createCmssyEditPage, createCmssyPage, createDraftRoute, isCmssyEditMode, nextRetryMode };
|
|
294
|
+
export { CmssyLayoutSlot, NEXT_BUILD_PHASE, createCmssyEditPage, createCmssyPage, createDraftRoute, isCmssyEditMode, nextRetryMode, resolveCmssyLayout2 as resolveCmssyLayout };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/next",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"dist"
|
|
72
72
|
],
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@cmssy/react": "^14.
|
|
74
|
+
"@cmssy/react": "^14.1.0",
|
|
75
75
|
"next": ">=15",
|
|
76
76
|
"react": "^18.2.0 || ^19.0.0",
|
|
77
77
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
"tsup": "^8.3.0",
|
|
86
86
|
"typescript": "^5.6.0",
|
|
87
87
|
"vitest": "^2.1.0",
|
|
88
|
-
"@cmssy/react": "14.
|
|
88
|
+
"@cmssy/react": "14.1.0"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@cmssy/types": "0.
|
|
91
|
+
"@cmssy/types": "0.39.0",
|
|
92
92
|
"server-only": "^0.0.1",
|
|
93
|
-
"@cmssy/core": "14.
|
|
93
|
+
"@cmssy/core": "14.1.0"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build": "tsup",
|