@cmssy/next 8.0.1 → 8.0.3

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.
@@ -11,6 +11,7 @@ interface CmssyEditorProps {
11
11
  enabledLocales?: string[];
12
12
  edit: EditBridgeConfig;
13
13
  forms?: Record<string, CmssyFormDefinition>;
14
+ data?: Record<string, unknown>;
14
15
  }
15
16
  interface CreateCmssyPageOptions {
16
17
  editor?: ComponentType<CmssyEditorProps>;
@@ -11,6 +11,7 @@ interface CmssyEditorProps {
11
11
  enabledLocales?: string[];
12
12
  edit: EditBridgeConfig;
13
13
  forms?: Record<string, CmssyFormDefinition>;
14
+ data?: Record<string, unknown>;
14
15
  }
15
16
  interface CreateCmssyPageOptions {
16
17
  editor?: ComponentType<CmssyEditorProps>;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CMSSY_SESSION_COOKIE, CmssyAuthConfig, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, DEFAULT_CMSSY_EDITOR_ORIGINS, assertAuthConfig, defineCmssyConfig, resolveEditorOrigin } from '@cmssy/core';
2
- export { C as CmssyEditorProps, a as CreateCmssyPageOptions } from './index-D-mfavEO.cjs';
2
+ export { C as CmssyEditorProps, a as CreateCmssyPageOptions } from './index-C7l1HgN0.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
1
  export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_LOCALE_HEADER, CMSSY_SECRET_QUERY_PARAM, CMSSY_SESSION_COOKIE, CmssyAuthConfig, CmssyConfig, CmssyEnvConfig, CmssyPageData, CmssyPageMeta, CmssyPageSummary, DEFAULT_CMSSY_EDITOR_ORIGINS, assertAuthConfig, defineCmssyConfig, resolveEditorOrigin } from '@cmssy/core';
2
- export { C as CmssyEditorProps, a as CreateCmssyPageOptions } from './index-D-mfavEO.js';
2
+ export { C as CmssyEditorProps, a as CreateCmssyPageOptions } from './index-C7l1HgN0.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import '@cmssy/react';
package/dist/server.cjs CHANGED
@@ -123,6 +123,15 @@ function buildCmssyPageRenderer(config, blocks, options, editRoute) {
123
123
  };
124
124
  if (editorActive && Editor) {
125
125
  const bridgeOrigin = resolveBridgeOrigin(config.editorOrigin);
126
+ const editorData = await react.resolveBlockData({
127
+ page,
128
+ blocks,
129
+ locale,
130
+ defaultLocale,
131
+ enabledLocales,
132
+ forms,
133
+ isPreview: true
134
+ });
126
135
  return /* @__PURE__ */ jsxRuntime.jsx(client.CmssyLocaleProvider, { value: localeContext, children: /* @__PURE__ */ jsxRuntime.jsx(
127
136
  Editor,
128
137
  {
@@ -131,7 +140,8 @@ function buildCmssyPageRenderer(config, blocks, options, editRoute) {
131
140
  defaultLocale,
132
141
  enabledLocales,
133
142
  edit: { editorOrigin: bridgeOrigin },
134
- forms
143
+ forms,
144
+ data: editorData
135
145
  }
136
146
  ) });
137
147
  }
@@ -304,6 +314,15 @@ async function CmssyLayoutSlot({
304
314
  if (editMode && editable) {
305
315
  const origin = core.resolveEditorOrigin(config.editorOrigin);
306
316
  const Editable = editable;
317
+ const data = await react.resolveLayoutBlockData({
318
+ groups,
319
+ blocks,
320
+ position,
321
+ locale,
322
+ defaultLocale: siteLocales.defaultLocale,
323
+ enabledLocales: siteLocales.locales,
324
+ isPreview: true
325
+ });
307
326
  return /* @__PURE__ */ jsxRuntime.jsx(
308
327
  Editable,
309
328
  {
@@ -314,7 +333,8 @@ async function CmssyLayoutSlot({
314
333
  enabledLocales: siteLocales.locales,
315
334
  edit: {
316
335
  editorOrigin: (Array.isArray(origin) ? origin[0] : origin) ?? ""
317
- }
336
+ },
337
+ data
318
338
  }
319
339
  );
320
340
  }
package/dist/server.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CmssyEditorProps, a as CreateCmssyPageOptions, c as createCmssyEditPage, b as createCmssyPage } from './index-D-mfavEO.cjs';
1
+ export { C as CmssyEditorProps, a as CreateCmssyPageOptions, c as createCmssyEditPage, b as createCmssyPage } from './index-C7l1HgN0.cjs';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { ReactNode, ComponentType } from 'react';
4
4
  import { BlockDefinition, CmssyLayoutGroup } from '@cmssy/react';
@@ -47,6 +47,7 @@ interface CmssyLayoutSlotProps {
47
47
  edit: {
48
48
  editorOrigin: string;
49
49
  };
50
+ data?: Record<string, unknown>;
50
51
  }>;
51
52
  }
52
53
  /**
package/dist/server.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CmssyEditorProps, a as CreateCmssyPageOptions, c as createCmssyEditPage, b as createCmssyPage } from './index-D-mfavEO.js';
1
+ export { C as CmssyEditorProps, a as CreateCmssyPageOptions, c as createCmssyEditPage, b as createCmssyPage } from './index-C7l1HgN0.js';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { ReactNode, ComponentType } from 'react';
4
4
  import { BlockDefinition, CmssyLayoutGroup } from '@cmssy/react';
@@ -47,6 +47,7 @@ interface CmssyLayoutSlotProps {
47
47
  edit: {
48
48
  editorOrigin: string;
49
49
  };
50
+ data?: Record<string, unknown>;
50
51
  }>;
51
52
  }
52
53
  /**
package/dist/server.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'server-only';
2
2
  import { draftMode, headers, cookies } from 'next/headers';
3
3
  import { notFound, redirect } from 'next/navigation';
4
- import { createCmssyClient, resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, CmssyServerPage, fetchSiteConfig, fetchPageById, fetchLayouts, CmssyServerLayout, normalizeSlug, fetchPageMeta, fetchPages } from '@cmssy/react';
4
+ import { createCmssyClient, resolveSiteLocales, splitLocaleFromPath, fetchPage, resolveForms, resolveBlockData, CmssyServerPage, fetchSiteConfig, fetchPageById, fetchLayouts, resolveLayoutBlockData, CmssyServerLayout, normalizeSlug, fetchPageMeta, fetchPages } from '@cmssy/react';
5
5
  import { CmssyLocaleProvider } from '@cmssy/react/client';
6
6
  import { isDevelopment, resolveEditorOrigin, toCspOrigin, CMSSY_EDIT_HEADER, localeForPath, CMSSY_LOCALE_HEADER, resolveSiteLocales as resolveSiteLocales$1, resolveSeoLocales, localizedPath, normalizeSlug as normalizeSlug$1, assertAuthConfig, backendProduct, backendCheckout, backendMergeCart, backendSetShippingMethod, backendRemoveDiscount, backendApplyDiscount, backendClearCart, backendRemoveItem, backendUpdateItem, backendAddToCart, backendGetCart, backendMyOrder, backendMyOrders, cmssySecretsMatch, fetchProducts as fetchProducts$1, fetchProduct as fetchProduct$1, backendSignIn, toSessionPayload, backendRegister, backendSignOut, isAccessExpired, backendSignOutEverywhere, backendForgotPassword, backendResetPassword, backendVerifyEmail, CMSSY_SESSION_COOKIE, openSession, CMSSY_EDIT_QUERY_PARAM, CMSSY_SECRET_QUERY_PARAM, sealSession, sessionCookieOptions, backendRefresh } from '@cmssy/core';
7
7
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -121,6 +121,15 @@ function buildCmssyPageRenderer(config, blocks, options, editRoute) {
121
121
  };
122
122
  if (editorActive && Editor) {
123
123
  const bridgeOrigin = resolveBridgeOrigin(config.editorOrigin);
124
+ const editorData = await resolveBlockData({
125
+ page,
126
+ blocks,
127
+ locale,
128
+ defaultLocale,
129
+ enabledLocales,
130
+ forms,
131
+ isPreview: true
132
+ });
124
133
  return /* @__PURE__ */ jsx(CmssyLocaleProvider, { value: localeContext, children: /* @__PURE__ */ jsx(
125
134
  Editor,
126
135
  {
@@ -129,7 +138,8 @@ function buildCmssyPageRenderer(config, blocks, options, editRoute) {
129
138
  defaultLocale,
130
139
  enabledLocales,
131
140
  edit: { editorOrigin: bridgeOrigin },
132
- forms
141
+ forms,
142
+ data: editorData
133
143
  }
134
144
  ) });
135
145
  }
@@ -302,6 +312,15 @@ async function CmssyLayoutSlot({
302
312
  if (editMode && editable) {
303
313
  const origin = resolveEditorOrigin(config.editorOrigin);
304
314
  const Editable = editable;
315
+ const data = await resolveLayoutBlockData({
316
+ groups,
317
+ blocks,
318
+ position,
319
+ locale,
320
+ defaultLocale: siteLocales.defaultLocale,
321
+ enabledLocales: siteLocales.locales,
322
+ isPreview: true
323
+ });
305
324
  return /* @__PURE__ */ jsx(
306
325
  Editable,
307
326
  {
@@ -312,7 +331,8 @@ async function CmssyLayoutSlot({
312
331
  enabledLocales: siteLocales.locales,
313
332
  edit: {
314
333
  editorOrigin: (Array.isArray(origin) ? origin[0] : origin) ?? ""
315
- }
334
+ },
335
+ data
316
336
  }
317
337
  );
318
338
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/next",
3
- "version": "8.0.1",
3
+ "version": "8.0.3",
4
4
  "description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -70,12 +70,12 @@
70
70
  "tsup": "^8.3.0",
71
71
  "typescript": "^5.6.0",
72
72
  "vitest": "^2.1.0",
73
- "@cmssy/react": "8.0.1"
73
+ "@cmssy/react": "8.0.3"
74
74
  },
75
75
  "dependencies": {
76
76
  "@cmssy/types": "0.28.0",
77
77
  "server-only": "^0.0.1",
78
- "@cmssy/core": "8.0.1"
78
+ "@cmssy/core": "8.0.3"
79
79
  },
80
80
  "scripts": {
81
81
  "build": "tsup",