@cmssy/next 12.9.0 → 12.11.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.
@@ -1,4 +1,4 @@
1
- import { RetryPolicy, CmssyConfig } from '@cmssy/core';
1
+ import { RetryOption, CmssyConfig } from '@cmssy/core';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { ComponentType } from 'react';
4
4
  import { CmssyPageData, CmssyFormDefinition, BlockDefinition } from '@cmssy/react';
@@ -24,7 +24,7 @@ interface CreateCmssyPageOptions {
24
24
  editor?: ComponentType<CmssyEditorProps>;
25
25
  path?: string;
26
26
  appContext?: CmssyAppContext;
27
- retry?: RetryPolicy | false;
27
+ retry?: RetryOption;
28
28
  }
29
29
  interface CatchAllParams {
30
30
  path?: string[];
@@ -1,4 +1,4 @@
1
- import { RetryPolicy, CmssyConfig } from '@cmssy/core';
1
+ import { RetryOption, CmssyConfig } from '@cmssy/core';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { ComponentType } from 'react';
4
4
  import { CmssyPageData, CmssyFormDefinition, BlockDefinition } from '@cmssy/react';
@@ -24,7 +24,7 @@ interface CreateCmssyPageOptions {
24
24
  editor?: ComponentType<CmssyEditorProps>;
25
25
  path?: string;
26
26
  appContext?: CmssyAppContext;
27
- retry?: RetryPolicy | false;
27
+ retry?: RetryOption;
28
28
  }
29
29
  interface CatchAllParams {
30
30
  path?: string[];
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, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, RetryPolicy, VerifyCmssyWebhookOptions, defineCmssyConfig, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
2
- export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions } from './index-Q_bLE9vs.cjs';
1
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, defineCmssyConfig, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
2
+ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions } from './index-DMEBgr68.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, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, RetryPolicy, VerifyCmssyWebhookOptions, defineCmssyConfig, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
2
- export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions } from './index-Q_bLE9vs.js';
1
+ export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRetryMode, CmssyWebhookError, CmssyWebhookEvent, DEFAULT_CMSSY_EDITOR_ORIGINS, RetryOption, RetryPolicy, VerifyCmssyWebhookOptions, defineCmssyConfig, localizeHref, resolveEditorOrigin, verifyCmssyWebhook } from '@cmssy/core';
2
+ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions } from './index-DMEBgr68.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import '@cmssy/react';
package/dist/server.cjs CHANGED
@@ -11,6 +11,13 @@ var core = require('@cmssy/core');
11
11
  var jsxRuntime = require('react/jsx-runtime');
12
12
 
13
13
  // src/server.ts
14
+
15
+ // src/retry-mode.ts
16
+ var NEXT_BUILD_PHASE = "phase-production-build";
17
+ function nextRetryMode() {
18
+ const phase = typeof process !== "undefined" ? process.env?.NEXT_PHASE : void 0;
19
+ return phase === NEXT_BUILD_PHASE ? "build" : "interactive";
20
+ }
14
21
  function hasEditFlag(value) {
15
22
  return Array.isArray(value) ? value.includes("1") : value === "1";
16
23
  }
@@ -42,7 +49,7 @@ function buildCmssyPageRenderer(config, blocks, options, editRoute) {
42
49
  workspaceSlug: config.workspaceSlug
43
50
  };
44
51
  const client = react.createCmssyClient(clientConfig);
45
- const requestOptions = { retry: options?.retry ?? {} };
52
+ const requestOptions = { retry: options?.retry ?? nextRetryMode() };
46
53
  const fixedPath = options?.path?.split("/").map((segment) => segment.trim()).filter(Boolean);
47
54
  return async function CmssyCatchAllPage({
48
55
  params,
@@ -256,7 +263,8 @@ async function CmssyLayoutSlot({
256
263
  editMode,
257
264
  page = "/",
258
265
  editable: Editable,
259
- appContext
266
+ appContext,
267
+ retry
260
268
  }) {
261
269
  const resolved = await react.resolveCmssyLayoutSlot(config, {
262
270
  position,
@@ -264,6 +272,7 @@ async function CmssyLayoutSlot({
264
272
  editMode,
265
273
  page,
266
274
  appContext,
275
+ retry: retry ?? nextRetryMode(),
267
276
  ...explicitLocale !== void 0 ? { locale: explicitLocale } : { path: path ?? [] }
268
277
  });
269
278
  const { groups, locale, defaultLocale, enabledLocales } = resolved;
package/dist/server.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, c as createCmssyEditPage, d as createCmssyPage } from './index-Q_bLE9vs.cjs';
2
- import { CmssyConfig, LayoutPosition } from '@cmssy/core';
3
- export { RetryPolicy } from '@cmssy/core';
1
+ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, c as createCmssyEditPage, d as createCmssyPage } from './index-DMEBgr68.cjs';
2
+ import { CmssyConfig, LayoutPosition, RetryOption } from '@cmssy/core';
3
+ export { CmssyRetryMode, RetryOption, RetryPolicy } from '@cmssy/core';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { ComponentType } from 'react';
6
6
  import { BlockDefinition, CmssyLayoutGroup } from '@cmssy/react';
@@ -33,6 +33,7 @@ interface CmssyLayoutSlotBaseProps {
33
33
  appContext?: Record<string, unknown>;
34
34
  }>;
35
35
  appContext?: Record<string, unknown>;
36
+ retry?: RetryOption;
36
37
  }
37
38
  type CmssyLayoutSlotLocaleSource = {
38
39
  path: string[];
@@ -42,6 +43,6 @@ type CmssyLayoutSlotLocaleSource = {
42
43
  path?: never;
43
44
  };
44
45
  type CmssyLayoutSlotProps = CmssyLayoutSlotBaseProps & CmssyLayoutSlotLocaleSource;
45
- declare function CmssyLayoutSlot({ config, blocks, position, path, locale: explicitLocale, editMode, page, editable: Editable, appContext, }: CmssyLayoutSlotProps): Promise<react_jsx_runtime.JSX.Element>;
46
+ declare function CmssyLayoutSlot({ config, blocks, position, path, locale: explicitLocale, editMode, page, editable: Editable, appContext, retry, }: CmssyLayoutSlotProps): Promise<react_jsx_runtime.JSX.Element>;
46
47
 
47
48
  export { type CmssyDraftRouteConfig, CmssyLayoutSlot, type CmssyLayoutSlotProps, createDraftRoute, isCmssyEditMode };
package/dist/server.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, c as createCmssyEditPage, d as createCmssyPage } from './index-Q_bLE9vs.js';
2
- import { CmssyConfig, LayoutPosition } from '@cmssy/core';
3
- export { RetryPolicy } from '@cmssy/core';
1
+ export { C as CmssyAppContext, a as CmssyEditorProps, b as CreateCmssyPageOptions, c as createCmssyEditPage, d as createCmssyPage } from './index-DMEBgr68.js';
2
+ import { CmssyConfig, LayoutPosition, RetryOption } from '@cmssy/core';
3
+ export { CmssyRetryMode, RetryOption, RetryPolicy } from '@cmssy/core';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { ComponentType } from 'react';
6
6
  import { BlockDefinition, CmssyLayoutGroup } from '@cmssy/react';
@@ -33,6 +33,7 @@ interface CmssyLayoutSlotBaseProps {
33
33
  appContext?: Record<string, unknown>;
34
34
  }>;
35
35
  appContext?: Record<string, unknown>;
36
+ retry?: RetryOption;
36
37
  }
37
38
  type CmssyLayoutSlotLocaleSource = {
38
39
  path: string[];
@@ -42,6 +43,6 @@ type CmssyLayoutSlotLocaleSource = {
42
43
  path?: never;
43
44
  };
44
45
  type CmssyLayoutSlotProps = CmssyLayoutSlotBaseProps & CmssyLayoutSlotLocaleSource;
45
- declare function CmssyLayoutSlot({ config, blocks, position, path, locale: explicitLocale, editMode, page, editable: Editable, appContext, }: CmssyLayoutSlotProps): Promise<react_jsx_runtime.JSX.Element>;
46
+ declare function CmssyLayoutSlot({ config, blocks, position, path, locale: explicitLocale, editMode, page, editable: Editable, appContext, retry, }: CmssyLayoutSlotProps): Promise<react_jsx_runtime.JSX.Element>;
46
47
 
47
48
  export { type CmssyDraftRouteConfig, CmssyLayoutSlot, type CmssyLayoutSlotProps, createDraftRoute, isCmssyEditMode };
package/dist/server.js CHANGED
@@ -9,6 +9,13 @@ import { CMSSY_SECRET_QUERY_PARAM, resolveEditorOrigin, CMSSY_EDIT_HEADER, CMSSY
9
9
  import { jsx } from 'react/jsx-runtime';
10
10
 
11
11
  // src/server.ts
12
+
13
+ // src/retry-mode.ts
14
+ var NEXT_BUILD_PHASE = "phase-production-build";
15
+ function nextRetryMode() {
16
+ const phase = typeof process !== "undefined" ? process.env?.NEXT_PHASE : void 0;
17
+ return phase === NEXT_BUILD_PHASE ? "build" : "interactive";
18
+ }
12
19
  function hasEditFlag(value) {
13
20
  return Array.isArray(value) ? value.includes("1") : value === "1";
14
21
  }
@@ -40,7 +47,7 @@ function buildCmssyPageRenderer(config, blocks, options, editRoute) {
40
47
  workspaceSlug: config.workspaceSlug
41
48
  };
42
49
  const client = createCmssyClient(clientConfig);
43
- const requestOptions = { retry: options?.retry ?? {} };
50
+ const requestOptions = { retry: options?.retry ?? nextRetryMode() };
44
51
  const fixedPath = options?.path?.split("/").map((segment) => segment.trim()).filter(Boolean);
45
52
  return async function CmssyCatchAllPage({
46
53
  params,
@@ -254,7 +261,8 @@ async function CmssyLayoutSlot({
254
261
  editMode,
255
262
  page = "/",
256
263
  editable: Editable,
257
- appContext
264
+ appContext,
265
+ retry
258
266
  }) {
259
267
  const resolved = await resolveCmssyLayoutSlot(config, {
260
268
  position,
@@ -262,6 +270,7 @@ async function CmssyLayoutSlot({
262
270
  editMode,
263
271
  page,
264
272
  appContext,
273
+ retry: retry ?? nextRetryMode(),
265
274
  ...explicitLocale !== void 0 ? { locale: explicitLocale } : { path: path ?? [] }
266
275
  });
267
276
  const { groups, locale, defaultLocale, enabledLocales } = resolved;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/next",
3
- "version": "12.9.0",
3
+ "version": "12.11.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": "^12.9.0",
74
+ "@cmssy/react": "^12.11.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": "12.9.0"
88
+ "@cmssy/react": "12.11.0"
89
89
  },
90
90
  "dependencies": {
91
91
  "@cmssy/types": "0.35.0",
92
92
  "server-only": "^0.0.1",
93
- "@cmssy/core": "12.9.0"
93
+ "@cmssy/core": "12.11.0"
94
94
  },
95
95
  "scripts": {
96
96
  "build": "tsup",