@cmssy/react 0.5.4 → 0.5.5

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/client.cjs CHANGED
@@ -447,7 +447,7 @@ function useDragAgent(config) {
447
447
  }
448
448
 
449
449
  // src/components/block-context.ts
450
- function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms) {
450
+ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms, extra) {
451
451
  return {
452
452
  locale: {
453
453
  current: locale,
@@ -455,7 +455,9 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
455
455
  enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
456
456
  },
457
457
  isPreview: isPreview ?? false,
458
- forms
458
+ forms,
459
+ ...{},
460
+ ...{}
459
461
  };
460
462
  }
461
463
 
package/dist/client.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-DLiN9uHz.cjs';
3
- export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-DLiN9uHz.cjs';
2
+ import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-D4tjQ9BL.cjs';
3
+ export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-D4tjQ9BL.cjs';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  interface EditBridgeConfig {
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-DLiN9uHz.js';
3
- export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-DLiN9uHz.js';
2
+ import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-D4tjQ9BL.js';
3
+ export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-D4tjQ9BL.js';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  interface EditBridgeConfig {
package/dist/client.js CHANGED
@@ -445,7 +445,7 @@ function useDragAgent(config) {
445
445
  }
446
446
 
447
447
  // src/components/block-context.ts
448
- function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms) {
448
+ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms, extra) {
449
449
  return {
450
450
  locale: {
451
451
  current: locale,
@@ -453,7 +453,9 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
453
453
  enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
454
454
  },
455
455
  isPreview: isPreview ?? false,
456
- forms
456
+ forms,
457
+ ...{},
458
+ ...{}
457
459
  };
458
460
  }
459
461
 
@@ -155,12 +155,30 @@ interface CmssyLocaleContext {
155
155
  default: string;
156
156
  enabled: string[];
157
157
  }
158
+ interface CmssyBlockMember {
159
+ recordId: string;
160
+ email: string;
161
+ }
162
+ interface CmssyBlockAuthContext {
163
+ isAuthenticated: boolean;
164
+ member: CmssyBlockMember | null;
165
+ }
166
+ interface CmssyBlockWorkspace {
167
+ id: string;
168
+ slug: string;
169
+ }
158
170
  interface CmssyBlockContext {
159
171
  locale: CmssyLocaleContext;
160
172
  isPreview: boolean;
161
173
  forms?: Record<string, CmssyFormDefinition>;
174
+ auth?: CmssyBlockAuthContext;
175
+ workspace?: CmssyBlockWorkspace;
176
+ }
177
+ interface BuildBlockContextExtra {
178
+ auth?: CmssyBlockAuthContext;
179
+ workspace?: CmssyBlockWorkspace;
162
180
  }
163
- declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>): CmssyBlockContext;
181
+ declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
164
182
 
165
183
  declare const PROTOCOL_VERSION = 1;
166
184
  type FieldType = "singleLine" | "multiLine" | "richText" | "numeric" | "date" | "media" | "link" | "select" | "multiselect" | "boolean" | "color" | "repeater";
@@ -425,4 +443,4 @@ interface CmssyOrder {
425
443
  createdAt?: string;
426
444
  }
427
445
 
428
- export { blocksToSchemas as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssyModelDefinition as D, type EditorToAppMessage as E, type FieldDefinition as F, type CmssyModelRecord as G, type CmssyPageMeta as H, type CmssyPageSummary as I, type CmssyRecordList as J, FORM_QUERY as K, type FetchLikeResponse as L, type FetchPageOptions as M, type FieldType as N, MODEL_DEFINITIONS_QUERY as O, MODEL_RECORDS_QUERY as P, PROTOCOL_VERSION as Q, type RawBlock as R, type ParentReadyMessage as S, type PatchMessage as T, type RawLayoutBlock as U, type ReadyMessage as V, SITE_CONFIG_QUERY as W, SUBMIT_FORM_MUTATION as X, type SelectMessage as Y, type SubmitFormInput as Z, blocksToMeta as _, type BlockMeta as a, buildBlockContext as a0, buildBlockMap as a1, defineBlock as a2, fetchLayouts as a3, fetchPage as a4, fetchPageById as a5, fetchPageMeta as a6, fetchPages as a7, isProtocolCompatible as a8, normalizeSlug as a9, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyLocaleContext as e, type CmssyCart as f, type CmssyOrder as g, type CmssyProduct as h, type CmssyCartDiscount as i, type CmssyCartItem as j, type CmssyCartItemSnapshot as k, type CmssyOrderItem as l, type CmssyProductVariant as m, type FetchLike as n, type CmssyClientConfig as o, type CmssySiteConfig as p, type BlockMap as q, type CmssyBlockContext as r, type BlockRect as s, type BoundsMessage as t, type ClickMessage as u, type CmssyBranding as v, type CmssyFormField as w, type CmssyFormSettings as x, type CmssyFormSubmitResponse as y, type CmssyLocalizedValue as z };
446
+ export { SUBMIT_FORM_MUTATION as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssyFormField as D, type EditorToAppMessage as E, type FieldDefinition as F, type CmssyFormSettings as G, type CmssyFormSubmitResponse as H, type CmssyLocalizedValue as I, type CmssyModelDefinition as J, type CmssyModelRecord as K, type CmssyPageMeta as L, type CmssyPageSummary as M, type CmssyRecordList as N, FORM_QUERY as O, type FetchLikeResponse as P, type FetchPageOptions as Q, type RawBlock as R, type FieldType as S, MODEL_DEFINITIONS_QUERY as T, MODEL_RECORDS_QUERY as U, PROTOCOL_VERSION as V, type ParentReadyMessage as W, type PatchMessage as X, type RawLayoutBlock as Y, type ReadyMessage as Z, SITE_CONFIG_QUERY as _, type BlockMeta as a, type SelectMessage as a0, type SubmitFormInput as a1, blocksToMeta as a2, blocksToSchemas as a3, buildBlockContext as a4, buildBlockMap as a5, defineBlock as a6, fetchLayouts as a7, fetchPage as a8, fetchPageById as a9, fetchPageMeta as aa, fetchPages as ab, isProtocolCompatible as ac, normalizeSlug as ad, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyLocaleContext as e, type CmssyCart as f, type CmssyOrder as g, type CmssyProduct as h, type CmssyCartDiscount as i, type CmssyCartItem as j, type CmssyCartItemSnapshot as k, type CmssyOrderItem as l, type CmssyProductVariant as m, type CmssyBlockAuthContext as n, type CmssyBlockWorkspace as o, type FetchLike as p, type CmssyClientConfig as q, type CmssySiteConfig as r, type BlockMap as s, type CmssyBlockContext as t, type BlockRect as u, type BoundsMessage as v, type BuildBlockContextExtra as w, type ClickMessage as x, type CmssyBlockMember as y, type CmssyBranding as z };
@@ -155,12 +155,30 @@ interface CmssyLocaleContext {
155
155
  default: string;
156
156
  enabled: string[];
157
157
  }
158
+ interface CmssyBlockMember {
159
+ recordId: string;
160
+ email: string;
161
+ }
162
+ interface CmssyBlockAuthContext {
163
+ isAuthenticated: boolean;
164
+ member: CmssyBlockMember | null;
165
+ }
166
+ interface CmssyBlockWorkspace {
167
+ id: string;
168
+ slug: string;
169
+ }
158
170
  interface CmssyBlockContext {
159
171
  locale: CmssyLocaleContext;
160
172
  isPreview: boolean;
161
173
  forms?: Record<string, CmssyFormDefinition>;
174
+ auth?: CmssyBlockAuthContext;
175
+ workspace?: CmssyBlockWorkspace;
176
+ }
177
+ interface BuildBlockContextExtra {
178
+ auth?: CmssyBlockAuthContext;
179
+ workspace?: CmssyBlockWorkspace;
162
180
  }
163
- declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>): CmssyBlockContext;
181
+ declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
164
182
 
165
183
  declare const PROTOCOL_VERSION = 1;
166
184
  type FieldType = "singleLine" | "multiLine" | "richText" | "numeric" | "date" | "media" | "link" | "select" | "multiselect" | "boolean" | "color" | "repeater";
@@ -425,4 +443,4 @@ interface CmssyOrder {
425
443
  createdAt?: string;
426
444
  }
427
445
 
428
- export { blocksToSchemas as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssyModelDefinition as D, type EditorToAppMessage as E, type FieldDefinition as F, type CmssyModelRecord as G, type CmssyPageMeta as H, type CmssyPageSummary as I, type CmssyRecordList as J, FORM_QUERY as K, type FetchLikeResponse as L, type FetchPageOptions as M, type FieldType as N, MODEL_DEFINITIONS_QUERY as O, MODEL_RECORDS_QUERY as P, PROTOCOL_VERSION as Q, type RawBlock as R, type ParentReadyMessage as S, type PatchMessage as T, type RawLayoutBlock as U, type ReadyMessage as V, SITE_CONFIG_QUERY as W, SUBMIT_FORM_MUTATION as X, type SelectMessage as Y, type SubmitFormInput as Z, blocksToMeta as _, type BlockMeta as a, buildBlockContext as a0, buildBlockMap as a1, defineBlock as a2, fetchLayouts as a3, fetchPage as a4, fetchPageById as a5, fetchPageMeta as a6, fetchPages as a7, isProtocolCompatible as a8, normalizeSlug as a9, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyLocaleContext as e, type CmssyCart as f, type CmssyOrder as g, type CmssyProduct as h, type CmssyCartDiscount as i, type CmssyCartItem as j, type CmssyCartItemSnapshot as k, type CmssyOrderItem as l, type CmssyProductVariant as m, type FetchLike as n, type CmssyClientConfig as o, type CmssySiteConfig as p, type BlockMap as q, type CmssyBlockContext as r, type BlockRect as s, type BoundsMessage as t, type ClickMessage as u, type CmssyBranding as v, type CmssyFormField as w, type CmssyFormSettings as x, type CmssyFormSubmitResponse as y, type CmssyLocalizedValue as z };
446
+ export { SUBMIT_FORM_MUTATION as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssyFormField as D, type EditorToAppMessage as E, type FieldDefinition as F, type CmssyFormSettings as G, type CmssyFormSubmitResponse as H, type CmssyLocalizedValue as I, type CmssyModelDefinition as J, type CmssyModelRecord as K, type CmssyPageMeta as L, type CmssyPageSummary as M, type CmssyRecordList as N, FORM_QUERY as O, type FetchLikeResponse as P, type FetchPageOptions as Q, type RawBlock as R, type FieldType as S, MODEL_DEFINITIONS_QUERY as T, MODEL_RECORDS_QUERY as U, PROTOCOL_VERSION as V, type ParentReadyMessage as W, type PatchMessage as X, type RawLayoutBlock as Y, type ReadyMessage as Z, SITE_CONFIG_QUERY as _, type BlockMeta as a, type SelectMessage as a0, type SubmitFormInput as a1, blocksToMeta as a2, blocksToSchemas as a3, buildBlockContext as a4, buildBlockMap as a5, defineBlock as a6, fetchLayouts as a7, fetchPage as a8, fetchPageById as a9, fetchPageMeta as aa, fetchPages as ab, isProtocolCompatible as ac, normalizeSlug as ad, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyLocaleContext as e, type CmssyCart as f, type CmssyOrder as g, type CmssyProduct as h, type CmssyCartDiscount as i, type CmssyCartItem as j, type CmssyCartItemSnapshot as k, type CmssyOrderItem as l, type CmssyProductVariant as m, type CmssyBlockAuthContext as n, type CmssyBlockWorkspace as o, type FetchLike as p, type CmssyClientConfig as q, type CmssySiteConfig as r, type BlockMap as s, type CmssyBlockContext as t, type BlockRect as u, type BoundsMessage as v, type BuildBlockContextExtra as w, type ClickMessage as x, type CmssyBlockMember as y, type CmssyBranding as z };
package/dist/index.cjs CHANGED
@@ -92,7 +92,7 @@ function getBlockContentForLanguage(content, locale, defaultLocale = "en", avail
92
92
  }
93
93
 
94
94
  // src/components/block-context.ts
95
- function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms) {
95
+ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms, extra) {
96
96
  return {
97
97
  locale: {
98
98
  current: locale,
@@ -100,7 +100,9 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
100
100
  enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
101
101
  },
102
102
  isPreview: isPreview ?? false,
103
- forms
103
+ forms,
104
+ ...extra?.auth ? { auth: extra.auth } : {},
105
+ ...extra?.workspace ? { workspace: extra.workspace } : {}
104
106
  };
105
107
  }
106
108
  var WARN_CAP = 256;
@@ -139,7 +141,9 @@ async function CmssyServerPage({
139
141
  locale = "en",
140
142
  defaultLocale = "en",
141
143
  enabledLocales,
142
- forms
144
+ forms,
145
+ auth,
146
+ workspace
143
147
  }) {
144
148
  if (!page) return null;
145
149
  const map = buildBlockMap(blocks);
@@ -149,7 +153,8 @@ async function CmssyServerPage({
149
153
  defaultLocale,
150
154
  enabledLocales,
151
155
  false,
152
- forms
156
+ forms,
157
+ { auth, workspace }
153
158
  );
154
159
  const resolved = await Promise.all(
155
160
  page.blocks.map(async (block) => {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, n as FetchLike, o as CmssyClientConfig, p as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, q as BlockMap, r as CmssyBlockContext } from './commerce-queries-DLiN9uHz.cjs';
2
- export { a as BlockMeta, s as BlockRect, B as BlockSchema, t as BoundsMessage, u as ClickMessage, v as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, w as CmssyFormField, x as CmssyFormSettings, y as CmssyFormSubmitResponse, z as CmssyLocalizedValue, D as CmssyModelDefinition, G as CmssyModelRecord, g as CmssyOrder, H as CmssyPageMeta, I as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, J as CmssyRecordList, K as FORM_QUERY, L as FetchLikeResponse, M as FetchPageOptions, N as FieldType, O as MODEL_DEFINITIONS_QUERY, P as MODEL_RECORDS_QUERY, Q as PROTOCOL_VERSION, S as ParentReadyMessage, T as PatchMessage, U as RawLayoutBlock, V as ReadyMessage, W as SITE_CONFIG_QUERY, X as SUBMIT_FORM_MUTATION, Y as SelectMessage, Z as SubmitFormInput, _ as blocksToMeta, $ as blocksToSchemas, a0 as buildBlockContext, a1 as buildBlockMap, a2 as defineBlock, a3 as fetchLayouts, a4 as fetchPage, a5 as fetchPageById, a6 as fetchPageMeta, a7 as fetchPages, a8 as isProtocolCompatible, a9 as normalizeSlug } from './commerce-queries-DLiN9uHz.cjs';
1
+ import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, n as CmssyBlockAuthContext, o as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, p as FetchLike, q as CmssyClientConfig, r as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, s as BlockMap, t as CmssyBlockContext } from './commerce-queries-D4tjQ9BL.cjs';
2
+ export { a as BlockMeta, u as BlockRect, B as BlockSchema, v as BoundsMessage, w as BuildBlockContextExtra, x as ClickMessage, y as CmssyBlockMember, z as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, D as CmssyFormField, G as CmssyFormSettings, H as CmssyFormSubmitResponse, I as CmssyLocalizedValue, J as CmssyModelDefinition, K as CmssyModelRecord, g as CmssyOrder, L as CmssyPageMeta, M as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, N as CmssyRecordList, O as FORM_QUERY, P as FetchLikeResponse, Q as FetchPageOptions, S as FieldType, T as MODEL_DEFINITIONS_QUERY, U as MODEL_RECORDS_QUERY, V as PROTOCOL_VERSION, W as ParentReadyMessage, X as PatchMessage, Y as RawLayoutBlock, Z as ReadyMessage, _ as SITE_CONFIG_QUERY, $ as SUBMIT_FORM_MUTATION, a0 as SelectMessage, a1 as SubmitFormInput, a2 as blocksToMeta, a3 as blocksToSchemas, a4 as buildBlockContext, a5 as buildBlockMap, a6 as defineBlock, a7 as fetchLayouts, a8 as fetchPage, a9 as fetchPageById, aa as fetchPageMeta, ab as fetchPages, ac as isProtocolCompatible, ad as normalizeSlug } from './commerce-queries-D4tjQ9BL.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import 'react';
5
5
 
@@ -30,13 +30,17 @@ interface CmssyServerPageProps {
30
30
  enabledLocales?: string[];
31
31
  /** Form definitions referenced by page blocks, exposed via context.forms. */
32
32
  forms?: Record<string, CmssyFormDefinition>;
33
+ /** Member auth state, exposed via context.auth. Resolved by createCmssyPage. */
34
+ auth?: CmssyBlockAuthContext;
35
+ /** Workspace identity, exposed via context.workspace. Resolved by createCmssyPage. */
36
+ workspace?: CmssyBlockWorkspace;
33
37
  }
34
38
  /**
35
39
  * Async React Server Component (Next.js App Router / RSC). It runs each block's
36
40
  * loader server-side before rendering, so it must be rendered in a server
37
41
  * component tree (as `createCmssyPage` does) - not in a client component.
38
42
  */
39
- declare function CmssyServerPage({ page, blocks, locale, defaultLocale, enabledLocales, forms, }: CmssyServerPageProps): Promise<react_jsx_runtime.JSX.Element | null>;
43
+ declare function CmssyServerPage({ page, blocks, locale, defaultLocale, enabledLocales, forms, auth, workspace, }: CmssyServerPageProps): Promise<react_jsx_runtime.JSX.Element | null>;
40
44
 
41
45
  interface CmssyServerLayoutProps {
42
46
  groups: CmssyLayoutGroup[];
@@ -126,4 +130,4 @@ interface UnknownBlockProps {
126
130
  }
127
131
  declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
128
132
 
129
- export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockContext, type CmssyBlockProps, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, CmssySiteConfig, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, localizeHref, localizeHtmlLinks, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
133
+ export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockAuthContext, CmssyBlockContext, type CmssyBlockProps, CmssyBlockWorkspace, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, CmssySiteConfig, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, localizeHref, localizeHtmlLinks, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, n as FetchLike, o as CmssyClientConfig, p as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, q as BlockMap, r as CmssyBlockContext } from './commerce-queries-DLiN9uHz.js';
2
- export { a as BlockMeta, s as BlockRect, B as BlockSchema, t as BoundsMessage, u as ClickMessage, v as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, w as CmssyFormField, x as CmssyFormSettings, y as CmssyFormSubmitResponse, z as CmssyLocalizedValue, D as CmssyModelDefinition, G as CmssyModelRecord, g as CmssyOrder, H as CmssyPageMeta, I as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, J as CmssyRecordList, K as FORM_QUERY, L as FetchLikeResponse, M as FetchPageOptions, N as FieldType, O as MODEL_DEFINITIONS_QUERY, P as MODEL_RECORDS_QUERY, Q as PROTOCOL_VERSION, S as ParentReadyMessage, T as PatchMessage, U as RawLayoutBlock, V as ReadyMessage, W as SITE_CONFIG_QUERY, X as SUBMIT_FORM_MUTATION, Y as SelectMessage, Z as SubmitFormInput, _ as blocksToMeta, $ as blocksToSchemas, a0 as buildBlockContext, a1 as buildBlockMap, a2 as defineBlock, a3 as fetchLayouts, a4 as fetchPage, a5 as fetchPageById, a6 as fetchPageMeta, a7 as fetchPages, a8 as isProtocolCompatible, a9 as normalizeSlug } from './commerce-queries-DLiN9uHz.js';
1
+ import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, n as CmssyBlockAuthContext, o as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, p as FetchLike, q as CmssyClientConfig, r as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, s as BlockMap, t as CmssyBlockContext } from './commerce-queries-D4tjQ9BL.js';
2
+ export { a as BlockMeta, u as BlockRect, B as BlockSchema, v as BoundsMessage, w as BuildBlockContextExtra, x as ClickMessage, y as CmssyBlockMember, z as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, D as CmssyFormField, G as CmssyFormSettings, H as CmssyFormSubmitResponse, I as CmssyLocalizedValue, J as CmssyModelDefinition, K as CmssyModelRecord, g as CmssyOrder, L as CmssyPageMeta, M as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, N as CmssyRecordList, O as FORM_QUERY, P as FetchLikeResponse, Q as FetchPageOptions, S as FieldType, T as MODEL_DEFINITIONS_QUERY, U as MODEL_RECORDS_QUERY, V as PROTOCOL_VERSION, W as ParentReadyMessage, X as PatchMessage, Y as RawLayoutBlock, Z as ReadyMessage, _ as SITE_CONFIG_QUERY, $ as SUBMIT_FORM_MUTATION, a0 as SelectMessage, a1 as SubmitFormInput, a2 as blocksToMeta, a3 as blocksToSchemas, a4 as buildBlockContext, a5 as buildBlockMap, a6 as defineBlock, a7 as fetchLayouts, a8 as fetchPage, a9 as fetchPageById, aa as fetchPageMeta, ab as fetchPages, ac as isProtocolCompatible, ad as normalizeSlug } from './commerce-queries-D4tjQ9BL.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import 'react';
5
5
 
@@ -30,13 +30,17 @@ interface CmssyServerPageProps {
30
30
  enabledLocales?: string[];
31
31
  /** Form definitions referenced by page blocks, exposed via context.forms. */
32
32
  forms?: Record<string, CmssyFormDefinition>;
33
+ /** Member auth state, exposed via context.auth. Resolved by createCmssyPage. */
34
+ auth?: CmssyBlockAuthContext;
35
+ /** Workspace identity, exposed via context.workspace. Resolved by createCmssyPage. */
36
+ workspace?: CmssyBlockWorkspace;
33
37
  }
34
38
  /**
35
39
  * Async React Server Component (Next.js App Router / RSC). It runs each block's
36
40
  * loader server-side before rendering, so it must be rendered in a server
37
41
  * component tree (as `createCmssyPage` does) - not in a client component.
38
42
  */
39
- declare function CmssyServerPage({ page, blocks, locale, defaultLocale, enabledLocales, forms, }: CmssyServerPageProps): Promise<react_jsx_runtime.JSX.Element | null>;
43
+ declare function CmssyServerPage({ page, blocks, locale, defaultLocale, enabledLocales, forms, auth, workspace, }: CmssyServerPageProps): Promise<react_jsx_runtime.JSX.Element | null>;
40
44
 
41
45
  interface CmssyServerLayoutProps {
42
46
  groups: CmssyLayoutGroup[];
@@ -126,4 +130,4 @@ interface UnknownBlockProps {
126
130
  }
127
131
  declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
128
132
 
129
- export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockContext, type CmssyBlockProps, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, CmssySiteConfig, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, localizeHref, localizeHtmlLinks, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
133
+ export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockAuthContext, CmssyBlockContext, type CmssyBlockProps, CmssyBlockWorkspace, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, CmssySiteConfig, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, localizeHref, localizeHtmlLinks, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
package/dist/index.js CHANGED
@@ -90,7 +90,7 @@ function getBlockContentForLanguage(content, locale, defaultLocale = "en", avail
90
90
  }
91
91
 
92
92
  // src/components/block-context.ts
93
- function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms) {
93
+ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms, extra) {
94
94
  return {
95
95
  locale: {
96
96
  current: locale,
@@ -98,7 +98,9 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
98
98
  enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
99
99
  },
100
100
  isPreview: isPreview ?? false,
101
- forms
101
+ forms,
102
+ ...extra?.auth ? { auth: extra.auth } : {},
103
+ ...extra?.workspace ? { workspace: extra.workspace } : {}
102
104
  };
103
105
  }
104
106
  var WARN_CAP = 256;
@@ -137,7 +139,9 @@ async function CmssyServerPage({
137
139
  locale = "en",
138
140
  defaultLocale = "en",
139
141
  enabledLocales,
140
- forms
142
+ forms,
143
+ auth,
144
+ workspace
141
145
  }) {
142
146
  if (!page) return null;
143
147
  const map = buildBlockMap(blocks);
@@ -147,7 +151,8 @@ async function CmssyServerPage({
147
151
  defaultLocale,
148
152
  enabledLocales,
149
153
  false,
150
- forms
154
+ forms,
155
+ { auth, workspace }
151
156
  );
152
157
  const resolved = await Promise.all(
153
158
  page.blocks.map(async (block) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/react",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
5
5
  "keywords": [
6
6
  "cmssy",