@avocadostudio-ai/site-sdk 0.16.0 → 0.17.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.
@@ -46,9 +46,27 @@ function makeGenerateStaticParams(cmsGetSlugs) {
46
46
  function nextDraftAdapter(draft, getCookie) {
47
47
  return { isDraftMode: draft.isEnabled, getCookie };
48
48
  }
49
+ /**
50
+ * The footer to draw: the one the host configured, or the Footer block the page
51
+ * itself carries.
52
+ *
53
+ * `renderBlocks` filters every chrome block type, because a host that passes
54
+ * `config.footer` would otherwise draw its footer twice. The cost was that a
55
+ * Footer authored in the editor and stored in page content got validated,
56
+ * published, and then silently dropped by every host that did not ALSO wire it
57
+ * through config — which is every project this package scaffolds. Nothing
58
+ * failed; the block went to a renderer that had been told to skip it.
59
+ *
60
+ * Config still wins, so a host that supplies its own footer is unaffected.
61
+ */
62
+ function footerFor(c, page) {
63
+ if (c.footer)
64
+ return c.footer;
65
+ return page?.blocks.find((b) => b.type === "Footer");
66
+ }
49
67
  /** The site chrome around whatever the outcome turned out to be. */
50
- function withChrome(chrome, c, body, after) {
51
- return (_jsxs(_Fragment, { children: [c.chrome && _jsx(SharedBlockRenderer, { block: chrome.header }), body, c.chrome && c.footer ? _jsx(SharedBlockRenderer, { block: c.footer }) : null, after] }));
68
+ function withChrome(chrome, c, footer, body, after) {
69
+ return (_jsxs(_Fragment, { children: [c.chrome && _jsx(SharedBlockRenderer, { block: chrome.header }), body, c.chrome && footer ? _jsx(SharedBlockRenderer, { block: footer }) : null, after] }));
52
70
  }
53
71
  function renderOutcome(outcome, c) {
54
72
  /*
@@ -61,12 +79,12 @@ function renderOutcome(outcome, c) {
61
79
  if (outcome.kind === "not-found")
62
80
  notFound();
63
81
  if (outcome.kind === "draft-unavailable") {
64
- return withChrome(outcome.chrome, c, _jsxs("main", { style: { padding: "4rem", textAlign: "center" }, children: [_jsx("h1", { children: "Draft unavailable" }), _jsxs("p", { children: ["Could not load draft content for ", outcome.slug, "."] })] }));
82
+ return withChrome(outcome.chrome, c, footerFor(c), _jsxs("main", { style: { padding: "4rem", textAlign: "center" }, children: [_jsx("h1", { children: "Draft unavailable" }), _jsxs("p", { children: ["Could not load draft content for ", outcome.slug, "."] })] }));
65
83
  }
66
84
  if (!outcome.editor) {
67
- return withChrome(outcome.chrome, c, _jsxs("main", { children: [renderBlocks(outcome.page.blocks), _jsx(BlocksHydrator, {})] }));
85
+ return withChrome(outcome.chrome, c, footerFor(c, outcome.page), _jsxs("main", { children: [renderBlocks(outcome.page.blocks), _jsx(BlocksHydrator, {})] }));
68
86
  }
69
- return withChrome(outcome.chrome, c, _jsx("main", { className: "editor-mode", children: renderBlocks(outcome.page.blocks, { editable: true }) }), _jsx(EditorOverlay, { slug: outcome.slug, editorOrigin: outcome.editor.editorOrigin }));
87
+ return withChrome(outcome.chrome, c, footerFor(c, outcome.page), _jsx("main", { className: "editor-mode", children: renderBlocks(outcome.page.blocks, { editable: true }) }), _jsx(EditorOverlay, { slug: outcome.slug, editorOrigin: outcome.editor.editorOrigin }));
70
88
  }
71
89
  /**
72
90
  * Metadata for a page, mirroring the render's own choice of source.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avocadostudio-ai/site-sdk",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -147,17 +147,17 @@
147
147
  ],
148
148
  "dependencies": {
149
149
  "zod": "^4.3.6",
150
- "@avocadostudio-ai/blocks": "^0.16.0",
151
- "@avocadostudio-ai/richtext": "^0.16.0",
152
- "@avocadostudio-ai/preview-adapter": "^0.16.0",
153
- "@avocadostudio-ai/shared": "^0.16.0"
150
+ "@avocadostudio-ai/blocks": "^0.17.0",
151
+ "@avocadostudio-ai/shared": "^0.17.0",
152
+ "@avocadostudio-ai/preview-adapter": "^0.17.0",
153
+ "@avocadostudio-ai/richtext": "^0.17.0"
154
154
  },
155
155
  "peerDependencies": {
156
156
  "next": ">=15.0.0",
157
157
  "react": ">=19.0.0",
158
158
  "react-dom": ">=19.0.0",
159
159
  "better-sqlite3": ">=12.0.0",
160
- "@avocadostudio-ai/orchestrator-core": "^0.16.0"
160
+ "@avocadostudio-ai/orchestrator-core": "^0.17.0"
161
161
  },
162
162
  "peerDependenciesMeta": {
163
163
  "@avocadostudio-ai/orchestrator-core": {