@cmssy/react 10.5.0 → 10.5.1

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
@@ -807,7 +807,8 @@ function CmssyEditableLayout({
807
807
  enabledLocales,
808
808
  edit,
809
809
  data,
810
- resolvedContent
810
+ resolvedContent,
811
+ appContext
811
812
  }) {
812
813
  const blockMap = react.useMemo(() => buildBlockMap(blocks), [blocks]);
813
814
  const schemas = react.useMemo(
@@ -820,8 +821,10 @@ function CmssyEditableLayout({
820
821
  }, [groups, position]);
821
822
  const patches = useLayoutPatchBridge(position, edit);
822
823
  const context = react.useMemo(
823
- () => internal.buildBlockContext(locale, defaultLocale, enabledLocales, true),
824
- [locale, defaultLocale, enabledLocales]
824
+ () => internal.buildBlockContext(locale, defaultLocale, enabledLocales, true, void 0, {
825
+ app: appContext
826
+ }),
827
+ [locale, defaultLocale, enabledLocales, appContext]
825
828
  );
826
829
  if (layoutBlocks.length === 0) return null;
827
830
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: layoutBlocks.map((block) => /* @__PURE__ */ jsxRuntime.jsx(
package/dist/client.d.cts CHANGED
@@ -77,8 +77,10 @@ interface CmssyEditableLayoutProps {
77
77
  edit: EditBridgeConfig;
78
78
  data?: Record<string, unknown>;
79
79
  resolvedContent?: Record<string, Record<string, unknown>>;
80
+ /** Same channel the deployed layout gets, so the canvas shows the same thing. */
81
+ appContext?: Record<string, unknown>;
80
82
  }
81
- declare function CmssyEditableLayout({ groups, blocks, position, locale, defaultLocale, enabledLocales, edit, data, resolvedContent, }: CmssyEditableLayoutProps): react_jsx_runtime.JSX.Element | null;
83
+ declare function CmssyEditableLayout({ groups, blocks, position, locale, defaultLocale, enabledLocales, edit, data, resolvedContent, appContext, }: CmssyEditableLayoutProps): react_jsx_runtime.JSX.Element | null;
82
84
 
83
85
  interface CmssyLazyLayoutProps {
84
86
  groups: CmssyLayoutGroup[];
package/dist/client.d.ts CHANGED
@@ -77,8 +77,10 @@ interface CmssyEditableLayoutProps {
77
77
  edit: EditBridgeConfig;
78
78
  data?: Record<string, unknown>;
79
79
  resolvedContent?: Record<string, Record<string, unknown>>;
80
+ /** Same channel the deployed layout gets, so the canvas shows the same thing. */
81
+ appContext?: Record<string, unknown>;
80
82
  }
81
- declare function CmssyEditableLayout({ groups, blocks, position, locale, defaultLocale, enabledLocales, edit, data, resolvedContent, }: CmssyEditableLayoutProps): react_jsx_runtime.JSX.Element | null;
83
+ declare function CmssyEditableLayout({ groups, blocks, position, locale, defaultLocale, enabledLocales, edit, data, resolvedContent, appContext, }: CmssyEditableLayoutProps): react_jsx_runtime.JSX.Element | null;
82
84
 
83
85
  interface CmssyLazyLayoutProps {
84
86
  groups: CmssyLayoutGroup[];
package/dist/client.js CHANGED
@@ -805,7 +805,8 @@ function CmssyEditableLayout({
805
805
  enabledLocales,
806
806
  edit,
807
807
  data,
808
- resolvedContent
808
+ resolvedContent,
809
+ appContext
809
810
  }) {
810
811
  const blockMap = useMemo(() => buildBlockMap(blocks), [blocks]);
811
812
  const schemas = useMemo(
@@ -818,8 +819,10 @@ function CmssyEditableLayout({
818
819
  }, [groups, position]);
819
820
  const patches = useLayoutPatchBridge(position, edit);
820
821
  const context = useMemo(
821
- () => buildBlockContext(locale, defaultLocale, enabledLocales, true),
822
- [locale, defaultLocale, enabledLocales]
822
+ () => buildBlockContext(locale, defaultLocale, enabledLocales, true, void 0, {
823
+ app: appContext
824
+ }),
825
+ [locale, defaultLocale, enabledLocales, appContext]
823
826
  );
824
827
  if (layoutBlocks.length === 0) return null;
825
828
  return /* @__PURE__ */ jsx(Fragment, { children: layoutBlocks.map((block) => /* @__PURE__ */ jsx(
@@ -134,7 +134,8 @@ async function resolveEditorLayoutBlockData({
134
134
  enabledLocales,
135
135
  forms,
136
136
  isPreview = false,
137
- config
137
+ config,
138
+ appContext
138
139
  }) {
139
140
  const group = groups.find((g) => g.position === position);
140
141
  const layoutBlocks = group ? group.blocks.filter((b) => b.isActive).slice().sort((a, b) => a.order - b.order) : [];
@@ -145,7 +146,8 @@ async function resolveEditorLayoutBlockData({
145
146
  defaultLocale,
146
147
  enabledLocales,
147
148
  isPreview,
148
- forms
149
+ forms,
150
+ { app: appContext }
149
151
  );
150
152
  const resolved = await resolveBlocks(
151
153
  layoutBlocks,
@@ -32,8 +32,10 @@ interface ResolveLayoutBlockDataOptions {
32
32
  isPreview?: boolean;
33
33
  /** Workspace the relation records are read from. No config, no resolution. */
34
34
  config?: CmssyClientConfig;
35
+ /** Passed to loaders as context.app, exactly as on the deployed layout. */
36
+ appContext?: Record<string, unknown>;
35
37
  }
36
- declare function resolveEditorLayoutBlockData({ groups, blocks, position, locale, defaultLocale, enabledLocales, forms, isPreview, config, }: ResolveLayoutBlockDataOptions): Promise<EditorBlockData>;
38
+ declare function resolveEditorLayoutBlockData({ groups, blocks, position, locale, defaultLocale, enabledLocales, forms, isPreview, config, appContext, }: ResolveLayoutBlockDataOptions): Promise<EditorBlockData>;
37
39
  declare function resolveLayoutBlockData(options: ResolveLayoutBlockDataOptions): Promise<Record<string, unknown>>;
38
40
 
39
41
  export { type EditorBlockData, type ResolveBlockDataOptions, type ResolveLayoutBlockDataOptions, resolveBlockData, resolveEditorBlockData, resolveEditorLayoutBlockData, resolveLayoutBlockData };
@@ -32,8 +32,10 @@ interface ResolveLayoutBlockDataOptions {
32
32
  isPreview?: boolean;
33
33
  /** Workspace the relation records are read from. No config, no resolution. */
34
34
  config?: CmssyClientConfig;
35
+ /** Passed to loaders as context.app, exactly as on the deployed layout. */
36
+ appContext?: Record<string, unknown>;
35
37
  }
36
- declare function resolveEditorLayoutBlockData({ groups, blocks, position, locale, defaultLocale, enabledLocales, forms, isPreview, config, }: ResolveLayoutBlockDataOptions): Promise<EditorBlockData>;
38
+ declare function resolveEditorLayoutBlockData({ groups, blocks, position, locale, defaultLocale, enabledLocales, forms, isPreview, config, appContext, }: ResolveLayoutBlockDataOptions): Promise<EditorBlockData>;
37
39
  declare function resolveLayoutBlockData(options: ResolveLayoutBlockDataOptions): Promise<Record<string, unknown>>;
38
40
 
39
41
  export { type EditorBlockData, type ResolveBlockDataOptions, type ResolveLayoutBlockDataOptions, resolveBlockData, resolveEditorBlockData, resolveEditorLayoutBlockData, resolveLayoutBlockData };
@@ -132,7 +132,8 @@ async function resolveEditorLayoutBlockData({
132
132
  enabledLocales,
133
133
  forms,
134
134
  isPreview = false,
135
- config
135
+ config,
136
+ appContext
136
137
  }) {
137
138
  const group = groups.find((g) => g.position === position);
138
139
  const layoutBlocks = group ? group.blocks.filter((b) => b.isActive).slice().sort((a, b) => a.order - b.order) : [];
@@ -143,7 +144,8 @@ async function resolveEditorLayoutBlockData({
143
144
  defaultLocale,
144
145
  enabledLocales,
145
146
  isPreview,
146
- forms
147
+ forms,
148
+ { app: appContext }
147
149
  );
148
150
  const resolved = await resolveBlocks(
149
151
  layoutBlocks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/react",
3
- "version": "10.5.0",
3
+ "version": "10.5.1",
4
4
  "description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -72,7 +72,7 @@
72
72
  },
73
73
  "dependencies": {
74
74
  "@cmssy/types": "0.32.0",
75
- "@cmssy/core": "10.5.0"
75
+ "@cmssy/core": "10.5.1"
76
76
  },
77
77
  "scripts": {
78
78
  "build": "tsup",