@brunoalz/smartgesti-site-editor 1.4.2 → 1.4.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.
@@ -130,27 +130,27 @@ const y = {
130
130
  },
131
131
  onActivate(s) {
132
132
  d.debug("Blog plugin activating...");
133
- const l = new Set(s.pages.map((e) => e.id)), o = [...s.pages], t = s.pages.find((e) => e.slug === "home") || s.pages[0], n = t?.structure.find((e) => e.type === "navbar"), i = t?.structure.find((e) => e.type === "footer");
133
+ const l = new Set(s.pages.map((e) => e.id)), a = [...s.pages], t = s.pages.find((e) => e.slug === "home") || s.pages[0], n = t?.structure.find((e) => e.type === "navbar"), i = t?.structure.find((e) => e.type === "footer");
134
134
  if (t && n) {
135
- const e = o.findIndex((r) => r.id === t.id);
135
+ const e = a.findIndex((r) => r.id === t.id);
136
136
  if (e >= 0) {
137
- const r = n.props, a = Array.isArray(r.links) ? [...r.links] : [];
138
- if (!a.some(
137
+ const r = n.props, o = Array.isArray(r.links) ? [...r.links] : [];
138
+ if (!o.some(
139
139
  (p) => p.href === "/p/blog"
140
140
  )) {
141
- const p = a.length > 0 ? a.length - 1 : 0;
142
- a.splice(p, 0, { text: "Blog", href: "/p/blog" });
143
- const b = o[e].structure.map((c) => c.id === n.id ? { ...c, props: { ...c.props, links: a } } : c);
144
- o[e] = { ...o[e], structure: b }, d.debug("Blog link added to home navbar"), n.props = { ...r, links: a };
141
+ const p = o.length > 0 ? o.length - 1 : 0;
142
+ o.splice(p, 0, { text: "Blog", href: "/p/blog" });
143
+ const b = a[e].structure.map((c) => c.id === n.id ? { ...c, props: { ...c.props, links: o } } : c);
144
+ a[e] = { ...a[e], structure: b }, d.debug("Blog link added to home navbar"), n.props = { ...r, links: o };
145
145
  }
146
146
  }
147
147
  }
148
148
  if (t) {
149
- const e = o.findIndex((a) => a.id === t.id), r = t.structure.some(
150
- (a) => a.id === u
149
+ const e = a.findIndex((o) => o.id === t.id), r = t.structure.some(
150
+ (o) => o.id === u
151
151
  );
152
152
  if (e >= 0 && !r) {
153
- const a = {
153
+ const o = {
154
154
  id: u,
155
155
  type: "blogPostGrid",
156
156
  props: {
@@ -163,11 +163,11 @@ const y = {
163
163
  viewAllText: "Ver todos os posts",
164
164
  viewAllHref: "/site/p/blog"
165
165
  }
166
- }, g = [...o[e].structure], p = g.findIndex(
166
+ }, g = [...a[e].structure], p = g.findIndex(
167
167
  (b) => b.type === "footer"
168
168
  );
169
- p >= 0 ? g.splice(p, 0, a) : g.push(a), o[e] = {
170
- ...o[e],
169
+ p >= 0 ? g.splice(p, 0, o) : g.push(o), a[e] = {
170
+ ...a[e],
171
171
  structure: g
172
172
  }, d.debug("Blog section injected into home page");
173
173
  }
@@ -226,7 +226,7 @@ const y = {
226
226
  viewAllText: "Ver todos",
227
227
  viewAllHref: "/site/p/blog"
228
228
  }
229
- }), i && e.push(m(i, "blog-page-footer")), o.push({
229
+ }), i && e.push(m(i, "blog-page-footer")), a.push({
230
230
  id: "blog",
231
231
  name: "Blog",
232
232
  slug: "blog",
@@ -235,7 +235,8 @@ const y = {
235
235
  structure: e,
236
236
  dataSource: {
237
237
  provider: "blog-posts",
238
- mode: "list"
238
+ mode: "list",
239
+ defaultParams: { limit: 15 }
239
240
  }
240
241
  }), d.debug("Blog listing page created");
241
242
  }
@@ -260,7 +261,7 @@ const y = {
260
261
  showReadingTime: !0,
261
262
  contentMaxWidth: "720px"
262
263
  }
263
- }), i && e.push(m(i, "post-page-footer")), o.push({
264
+ }), i && e.push(m(i, "post-page-footer")), a.push({
264
265
  id: "blog-post",
265
266
  name: "Post",
266
267
  slug: "blog/:slug",
@@ -281,22 +282,22 @@ const y = {
281
282
  }
282
283
  return {
283
284
  ...s,
284
- pages: o
285
+ pages: a
285
286
  };
286
287
  },
287
288
  onDeactivate(s) {
288
289
  d.debug("Blog plugin deactivating...");
289
- const l = s.pages.filter((o) => o.pluginId !== "blog").map((o) => {
290
- let t = o.structure;
290
+ const l = s.pages.filter((a) => a.pluginId !== "blog").map((a) => {
291
+ let t = a.structure;
291
292
  return t.some(
292
293
  (i) => i.id === u
293
294
  ) && (t = t.filter(
294
295
  (i) => i.id !== u
295
296
  )), t = t.map((i) => {
296
297
  if (i.type !== "navbar") return i;
297
- const e = i.props, r = Array.isArray(e.links) ? e.links : [], a = r.filter((g) => g.href !== "/p/blog");
298
- return a.length !== r.length ? { ...i, props: { ...e, links: a } } : i;
299
- }), t !== o.structure ? { ...o, structure: t } : o;
298
+ const e = i.props, r = Array.isArray(e.links) ? e.links : [], o = r.filter((g) => g.href !== "/p/blog");
299
+ return o.length !== r.length ? { ...i, props: { ...e, links: o } } : i;
300
+ }), t !== a.structure ? { ...a, structure: t } : a;
300
301
  });
301
302
  return d.debug(
302
303
  `Removed ${s.pages.length - l.length} blog page(s) and injected section`
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sources":["../../../../../src/engine/plugins/builtin/blog/manifest.ts"],"sourcesContent":["/**\n * Blog Plugin Manifest\n * Plugin para blog com posts, categorias e tags.\n *\n * onActivate:\n * 1. Injeta seção blogPostGrid na home page (antes do footer)\n * 2. Cria página \"Blog\" com navbar + grid de posts + footer\n * 3. Cria página \"Post\" com navbar + detalhe do post + footer\n *\n * onDeactivate:\n * 1. Remove a seção injetada na home page\n * 2. Remove as páginas do plugin\n */\n\nimport type { PluginRegistration } from \"../../types\";\nimport type { SiteDocument, Block, BlockType } from \"../../../schema/siteDocument\";\nimport { pluginRegistry } from \"../../pluginRegistry\";\nimport { logger } from \"../../../../utils/logger\";\n\n// ─── ID usado para a seção de blog injetada na home page ───\nconst BLOG_HOME_SECTION_ID = \"plugin-blog-home-grid\";\n\n// ─── Sample blog cards para preview ───\nconst SAMPLE_BLOG_CARDS = [\n {\n title: \"Feira de Ciências 2026: Inovação e Criatividade\",\n excerpt:\n \"Nossos alunos apresentaram projetos incríveis na Feira de Ciências deste ano. Confira os destaques e premiações!\",\n image:\n \"https://images.unsplash.com/photo-1567168544230-3b9e5ec47659?w=800&h=400&fit=crop\",\n category: \"Eventos\",\n date: \"05 Fev 2026\",\n linkHref: \"/site/p/blog/feira-de-ciencias-2026\",\n linkText: \"Ler mais\",\n },\n {\n title: \"Matrículas Abertas para o Segundo Semestre\",\n excerpt:\n \"Garanta a vaga do seu filho na melhor escola da região. Condições especiais para matrículas antecipadas.\",\n image:\n \"https://images.unsplash.com/photo-1523050854058-8df90110c9f1?w=800&h=400&fit=crop\",\n category: \"Institucional\",\n date: \"01 Fev 2026\",\n linkHref: \"/site/p/blog/matriculas-segundo-semestre\",\n linkText: \"Ler mais\",\n },\n {\n title: \"5 Dicas para Preparar seu Filho para o Ano Letivo\",\n excerpt:\n \"Dicas práticas para uma transição tranquila e um início de ano produtivo para toda a família.\",\n image:\n \"https://images.unsplash.com/photo-1503676260728-1c00da094a0b?w=800&h=400&fit=crop\",\n category: \"Educação\",\n date: \"28 Jan 2026\",\n linkHref: \"/site/p/blog/dicas-preparar-ano-letivo\",\n linkText: \"Ler mais\",\n },\n];\n\n// ─── Conteúdo HTML rico para o post de exemplo ───\nconst SAMPLE_POST_CONTENT = `\n<h2>O que é a Feira de Ciências?</h2>\n<p>A Feira de Ciências é um evento anual que celebra a curiosidade, a pesquisa e a criatividade dos nossos alunos. Nesta edição especial de 2026, recebemos mais de <strong>500 visitantes</strong> e contamos com a participação de todas as turmas do Ensino Fundamental e Médio.</p>\n<p>Este ano, o tema central foi <em>\"Ciência e Sustentabilidade\"</em>, incentivando os estudantes a desenvolverem projetos que aliassem inovação tecnológica com responsabilidade ambiental.</p>\n\n<h2>Destaques da Edição 2026</h2>\n<p>Entre os mais de 50 projetos apresentados, alguns se destacaram pela originalidade e impacto:</p>\n<ul>\n <li><strong>Jardim Sustentável Inteligente</strong> — Alunos do 5º ano desenvolveram um sistema de irrigação automática usando sensores de umidade e placa Arduino.</li>\n <li><strong>Robótica Educacional</strong> — A turma do 8º ano criou um robô que auxilia no ensino de matemática para crianças do 1º ao 3º ano.</li>\n <li><strong>Energia Solar na Escola</strong> — Projeto do 2º ano do Ensino Médio demonstrou como painéis solares poderiam reduzir em 40% o consumo de energia da escola.</li>\n</ul>\n\n<blockquote>\n <p>\"A Feira de Ciências é um dos momentos mais importantes do nosso calendário escolar. Ver a dedicação e o brilho nos olhos dos alunos ao apresentarem seus projetos nos enche de orgulho e nos motiva a continuar investindo em educação de qualidade.\"</p>\n <p><strong>— Prof. Maria Silva, Coordenadora Pedagógica</strong></p>\n</blockquote>\n\n<h2>Premiações</h2>\n<p>O júri, composto por professores universitários e profissionais da área de tecnologia, selecionou os três melhores projetos:</p>\n<ol>\n <li><strong>1º Lugar:</strong> Jardim Sustentável Inteligente (5º ano)</li>\n <li><strong>2º Lugar:</strong> Energia Solar na Escola (2º EM)</li>\n <li><strong>3º Lugar:</strong> Robótica Educacional (8º ano)</li>\n</ol>\n\n<h2>Próximos Passos</h2>\n<p>Os três projetos finalistas representarão nossa escola na <strong>Feira Regional de Ciências</strong>, que acontecerá em março na capital. Os alunos já estão se preparando para levar suas apresentações a um público ainda maior.</p>\n<p>Parabéns a todos os participantes, professores orientadores e famílias que apoiaram essa jornada de descobertas!</p>\n`.trim();\n\n/**\n * Deep-clone um bloco com novo ID\n */\nfunction cloneBlock(block: Block, newId: string): Block {\n const cloned: Block = JSON.parse(JSON.stringify(block));\n return { ...cloned, id: newId };\n}\n\nexport const blogPlugin: PluginRegistration = {\n manifest: {\n id: \"blog\",\n version: \"1.0.0\",\n name: \"Blog\",\n description: \"Blog com posts, categorias e tags\",\n icon: \"FileText\",\n\n capabilities: {\n blocks: [\"blogPostCard\", \"blogPostGrid\", \"blogPostDetail\", \"blogCategoryFilter\", \"blogSearchBar\"],\n\n pageTemplates: [\n {\n id: \"blog-listing\",\n name: \"Blog\",\n slug: \"blog\",\n pluginId: \"blog\",\n structure: [],\n dataSource: {\n provider: \"blog-posts\",\n mode: \"list\",\n },\n },\n {\n id: \"blog-post\",\n name: \"Post\",\n slug: \"blog/:slug\",\n pluginId: \"blog\",\n structure: [],\n dataSource: {\n provider: \"blog-posts\",\n mode: \"single\",\n paramMapping: { slug: \":slug\" },\n },\n editRestrictions: {\n lockedStructure: true,\n nonRemovable: true,\n },\n },\n ],\n\n dataSchemas: [\n {\n type: \"blog-post\",\n label: \"Blog Post\",\n fields: [\n { name: \"title\", type: \"string\", required: true, label: \"Title\" },\n { name: \"slug\", type: \"string\", required: true, label: \"Slug\" },\n { name: \"excerpt\", type: \"string\", label: \"Excerpt\" },\n { name: \"content\", type: \"richtext\", required: true, label: \"Content\" },\n { name: \"featuredImage\", type: \"image\", label: \"Featured Image\" },\n { name: \"category\", type: \"string\", label: \"Category\" },\n { name: \"tags\", type: \"array\", label: \"Tags\" },\n { name: \"authorVariant\", type: \"string\", label: \"Author Variant\" },\n { name: \"readingTime\", type: \"number\", label: \"Reading Time\" },\n { name: \"metaTitle\", type: \"string\", label: \"Meta Title (SEO)\" },\n { name: \"metaDescription\", type: \"string\", label: \"Meta Description (SEO)\" },\n { name: \"ogImage\", type: \"image\", label: \"Open Graph Image\" },\n ],\n },\n ],\n\n contentProviders: [\"blog-posts\", \"blog-categories\"],\n },\n\n restrictions: {\n lockedFields: {\n blogPostDetail: [\"content\", \"date\"],\n },\n requiredPages: [\"blog-listing\", \"blog-post\"],\n },\n },\n\n onActivate(document: SiteDocument): SiteDocument {\n logger.debug(\"Blog plugin activating...\");\n\n const existingPageIds = new Set(document.pages.map((p) => p.id));\n const newPages = [...document.pages];\n\n // ── Encontrar home page para clonar navbar/footer ──\n const homePage =\n document.pages.find((p) => p.slug === \"home\") || document.pages[0];\n\n const homeNavbar = homePage?.structure.find((b) => b.type === \"navbar\");\n const homeFooter = homePage?.structure.find((b) => b.type === \"footer\");\n\n // ── 1. Adicionar link \"Blog\" à navbar da home page ──\n // Preserva os links existentes e apenas insere \"Blog\" antes do último item.\n if (homePage && homeNavbar) {\n const homeIdx = newPages.findIndex((p) => p.id === homePage.id);\n if (homeIdx >= 0) {\n const navbarProps = homeNavbar.props as Record<string, any>;\n const existingLinks: Array<{ text: string; href: string }> =\n Array.isArray(navbarProps.links) ? [...navbarProps.links] : [];\n const hasBlogLink = existingLinks.some(\n (l) => l.href === \"/p/blog\",\n );\n\n if (!hasBlogLink) {\n // Inserir \"Blog\" antes do último link (geralmente \"Contato\")\n const insertIdx = existingLinks.length > 0 ? existingLinks.length - 1 : 0;\n existingLinks.splice(insertIdx, 0, { text: \"Blog\", href: \"/p/blog\" });\n\n // Atualizar navbar na home page com o novo link\n const updatedStructure = newPages[homeIdx].structure.map((b) => {\n if (b.id === homeNavbar.id) {\n return { ...b, props: { ...b.props, links: existingLinks } } as Block;\n }\n return b;\n });\n newPages[homeIdx] = { ...newPages[homeIdx], structure: updatedStructure };\n logger.debug(\"Blog link added to home navbar\");\n\n // Atualizar referência para que clones nas páginas do blog usem navbar com link\n // (homeNavbar é const, então criamos a versão atualizada para uso nos clones)\n (homeNavbar as any).props = { ...navbarProps, links: existingLinks };\n }\n }\n }\n\n // ── 2. Injetar seção de blog na home page (antes do footer) ──\n if (homePage) {\n const homeIdx = newPages.findIndex((p) => p.id === homePage.id);\n const alreadyInjected = homePage.structure.some(\n (b) => b.id === BLOG_HOME_SECTION_ID,\n );\n\n if (homeIdx >= 0 && !alreadyInjected) {\n const blogHomeSection: Block = {\n id: BLOG_HOME_SECTION_ID,\n type: \"blogPostGrid\",\n props: {\n title: \"Blog\",\n subtitle: \"Últimas publicações\",\n columns: 3,\n cards: SAMPLE_BLOG_CARDS,\n variant: \"default\",\n showViewAll: true,\n viewAllText: \"Ver todos os posts\",\n viewAllHref: \"/site/p/blog\",\n },\n } as Block;\n\n const updatedStructure = [...newPages[homeIdx].structure];\n const footerIdx = updatedStructure.findIndex(\n (b) => b.type === \"footer\",\n );\n\n if (footerIdx >= 0) {\n updatedStructure.splice(footerIdx, 0, blogHomeSection);\n } else {\n updatedStructure.push(blogHomeSection);\n }\n\n newPages[homeIdx] = {\n ...newPages[homeIdx],\n structure: updatedStructure,\n };\n logger.debug(\"Blog section injected into home page\");\n }\n }\n\n // ── 3. Criar página \"Blog\" (listagem completa) ──\n if (!existingPageIds.has(\"blog\")) {\n const blogPageStructure: Block[] = [];\n\n // Navbar clonada da home\n if (homeNavbar) {\n blogPageStructure.push(cloneBlock(homeNavbar, \"blog-page-navbar\"));\n }\n\n // Hero banner do blog\n blogPageStructure.push({\n id: \"blog-page-hero\",\n type: \"hero\",\n props: {\n title: \"Blog\",\n subtitle: \"Novidades & Publicações\",\n description:\n \"Acompanhe as últimas novidades, eventos e conquistas da nossa comunidade escolar.\",\n variant: \"centered\",\n align: \"center\",\n overlay: true,\n overlayColor: \"rgba(79, 70, 229, 0.9)\",\n background: \"#4f46e5\",\n minHeight: \"280px\",\n },\n } as Block);\n\n // Search bar\n blogPageStructure.push({\n id: \"blog-search-bar\",\n type: \"blogSearchBar\",\n props: {\n placeholder: \"Buscar posts...\",\n variant: \"simple\",\n showIcon: true,\n searchUrl: \"/site/p/blog\",\n },\n } as Block);\n\n // Category filter\n blogPageStructure.push({\n id: \"blog-category-filter\",\n type: \"blogCategoryFilter\",\n props: {\n title: \"\",\n categories: SAMPLE_BLOG_CARDS.map((c) => ({\n name: c.category,\n slug: c.category.toLowerCase().replace(/\\s+/g, \"-\"),\n count: 1,\n })),\n variant: \"chips\",\n showCount: false,\n showAll: true,\n allLabel: \"Todas\",\n filterUrl: \"/site/p/blog\",\n },\n } as Block);\n\n // Grid de posts\n blogPageStructure.push({\n id: \"blog-grid-main\",\n type: \"blogPostGrid\",\n props: {\n title: \"\",\n subtitle: \"\",\n columns: 3,\n cards: SAMPLE_BLOG_CARDS,\n variant: \"default\",\n showViewAll: false,\n viewAllText: \"Ver todos\",\n viewAllHref: \"/site/p/blog\",\n },\n } as Block);\n\n // Footer clonado da home\n if (homeFooter) {\n blogPageStructure.push(cloneBlock(homeFooter, \"blog-page-footer\"));\n }\n\n newPages.push({\n id: \"blog\",\n name: \"Blog\",\n slug: \"blog\",\n pluginId: \"blog\",\n pageTemplateId: \"blog-listing\",\n structure: blogPageStructure,\n dataSource: {\n provider: \"blog-posts\",\n mode: \"list\",\n },\n });\n logger.debug(\"Blog listing page created\");\n }\n\n // ── 4. Criar página \"Post\" (detalhe) ──\n if (!existingPageIds.has(\"blog-post\")) {\n const postPageStructure: Block[] = [];\n\n if (homeNavbar) {\n postPageStructure.push(cloneBlock(homeNavbar, \"post-page-navbar\"));\n }\n\n postPageStructure.push({\n id: \"blog-detail-main\",\n type: \"blogPostDetail\",\n props: {\n title: \"Feira de Ciências 2026: Inovação e Criatividade\",\n content: SAMPLE_POST_CONTENT,\n featuredImage:\n \"https://images.unsplash.com/photo-1567168544230-3b9e5ec47659?w=1200&h=600&fit=crop\",\n date: \"05 Fev 2026\",\n category: \"Eventos\",\n authorVariant: \"inline\",\n readingTime: \"5 min de leitura\",\n tags: [\"Feira de Ciências\", \"Eventos\", \"Sustentabilidade\", \"Projetos\"],\n showFeaturedImage: true,\n showAuthor: true,\n showDate: true,\n showTags: true,\n showReadingTime: true,\n contentMaxWidth: \"720px\",\n },\n } as Block);\n\n if (homeFooter) {\n postPageStructure.push(cloneBlock(homeFooter, \"post-page-footer\"));\n }\n\n newPages.push({\n id: \"blog-post\",\n name: \"Post\",\n slug: \"blog/:slug\",\n pluginId: \"blog\",\n pageTemplateId: \"blog-post\",\n isDynamic: true,\n structure: postPageStructure,\n dataSource: {\n provider: \"blog-posts\",\n mode: \"single\",\n paramMapping: { slug: \":slug\" },\n },\n editRestrictions: {\n lockedStructure: true,\n nonRemovable: true,\n },\n });\n logger.debug(\"Blog post detail page created\");\n }\n\n return {\n ...document,\n pages: newPages,\n };\n },\n\n onDeactivate(document: SiteDocument): SiteDocument {\n logger.debug(\"Blog plugin deactivating...\");\n\n const newPages = document.pages\n // Remover páginas do plugin\n .filter((page) => page.pluginId !== \"blog\")\n // Remover seção de blog injetada + link \"Blog\" da navbar\n .map((page) => {\n let structure = page.structure;\n\n // Remover seção de blog injetada\n const hasInjected = structure.some(\n (b) => b.id === BLOG_HOME_SECTION_ID,\n );\n if (hasInjected) {\n structure = structure.filter(\n (b) => b.id !== BLOG_HOME_SECTION_ID,\n );\n }\n\n // Remover link \"Blog\" (/p/blog) da navbar\n structure = structure.map((b) => {\n if (b.type !== \"navbar\") return b;\n const props = b.props as Record<string, any>;\n const links: Array<{ text: string; href: string }> = Array.isArray(props.links) ? props.links : [];\n const filtered = links.filter((l) => l.href !== \"/p/blog\");\n if (filtered.length !== links.length) {\n return { ...b, props: { ...props, links: filtered } } as Block;\n }\n return b;\n });\n\n if (structure !== page.structure) {\n return { ...page, structure };\n }\n return page;\n });\n\n logger.debug(\n `Removed ${document.pages.length - newPages.length} blog page(s) and injected section`,\n );\n\n return {\n ...document,\n pages: newPages,\n };\n },\n\n getEditorRestrictions(blockType: BlockType) {\n if (blockType === \"blogPostDetail\") {\n return {\n lockedFields: [\"content\", \"date\"],\n };\n }\n if (blockType === \"blogCategoryFilter\") {\n return {\n lockedFields: [\"categories\"],\n };\n }\n return undefined;\n },\n};\n\n// Auto-registrar o plugin (side effect — como os blocos fazem com componentRegistry)\npluginRegistry.register(blogPlugin);\n"],"names":["BLOG_HOME_SECTION_ID","SAMPLE_BLOG_CARDS","SAMPLE_POST_CONTENT","cloneBlock","block","newId","blogPlugin","document","logger","existingPageIds","p","newPages","homePage","homeNavbar","b","homeFooter","homeIdx","navbarProps","existingLinks","l","insertIdx","updatedStructure","alreadyInjected","blogHomeSection","footerIdx","blogPageStructure","c","postPageStructure","page","structure","props","links","filtered","blockType","pluginRegistry"],"mappings":";;AAoBA,MAAMA,IAAuB,yBAGvBC,IAAoB;AAAA,EACxB;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEZ;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IACV,MAAM;AA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AGgB,GAAO,OAAOE,IAAS,IAE7ClB;AAAA,MACT,CAAC,GAEGe,MAAcD,EAAK,YACd,EAAE,GAAGA,GAAM,WAAAC,EAAA,IAEbD;AAAA,IACT,CAAC;AAEH,WAAApB,EAAO;AAAA,MACL,WAAWD,EAAS,MAAM,SAASI,EAAS,MAAM;AAAA,IAAA,GAG7C;AAAA,MACL,GAAGJ;AAAA,MACH,OAAOI;AAAA,IAAA;AAAA,EAEX;AAAA,EAEA,sBAAsBsB,GAAsB;AAC1C,QAAIA,MAAc;AAChB,aAAO;AAAA,QACL,cAAc,CAAC,WAAW,MAAM;AAAA,MAAA;AAGpC,QAAIA,MAAc;AAChB,aAAO;AAAA,QACL,cAAc,CAAC,YAAY;AAAA,MAAA;AAAA,EAIjC;AACF;AAGAC,EAAe,SAAS5B,CAAU;"}
1
+ {"version":3,"file":"manifest.js","sources":["../../../../../src/engine/plugins/builtin/blog/manifest.ts"],"sourcesContent":["/**\n * Blog Plugin Manifest\n * Plugin para blog com posts, categorias e tags.\n *\n * onActivate:\n * 1. Injeta seção blogPostGrid na home page (antes do footer)\n * 2. Cria página \"Blog\" com navbar + grid de posts + footer\n * 3. Cria página \"Post\" com navbar + detalhe do post + footer\n *\n * onDeactivate:\n * 1. Remove a seção injetada na home page\n * 2. Remove as páginas do plugin\n */\n\nimport type { PluginRegistration } from \"../../types\";\nimport type { SiteDocument, Block, BlockType } from \"../../../schema/siteDocument\";\nimport { pluginRegistry } from \"../../pluginRegistry\";\nimport { logger } from \"../../../../utils/logger\";\n\n// ─── ID usado para a seção de blog injetada na home page ───\nconst BLOG_HOME_SECTION_ID = \"plugin-blog-home-grid\";\n\n// ─── Sample blog cards para preview ───\nconst SAMPLE_BLOG_CARDS = [\n {\n title: \"Feira de Ciências 2026: Inovação e Criatividade\",\n excerpt:\n \"Nossos alunos apresentaram projetos incríveis na Feira de Ciências deste ano. Confira os destaques e premiações!\",\n image:\n \"https://images.unsplash.com/photo-1567168544230-3b9e5ec47659?w=800&h=400&fit=crop\",\n category: \"Eventos\",\n date: \"05 Fev 2026\",\n linkHref: \"/site/p/blog/feira-de-ciencias-2026\",\n linkText: \"Ler mais\",\n },\n {\n title: \"Matrículas Abertas para o Segundo Semestre\",\n excerpt:\n \"Garanta a vaga do seu filho na melhor escola da região. Condições especiais para matrículas antecipadas.\",\n image:\n \"https://images.unsplash.com/photo-1523050854058-8df90110c9f1?w=800&h=400&fit=crop\",\n category: \"Institucional\",\n date: \"01 Fev 2026\",\n linkHref: \"/site/p/blog/matriculas-segundo-semestre\",\n linkText: \"Ler mais\",\n },\n {\n title: \"5 Dicas para Preparar seu Filho para o Ano Letivo\",\n excerpt:\n \"Dicas práticas para uma transição tranquila e um início de ano produtivo para toda a família.\",\n image:\n \"https://images.unsplash.com/photo-1503676260728-1c00da094a0b?w=800&h=400&fit=crop\",\n category: \"Educação\",\n date: \"28 Jan 2026\",\n linkHref: \"/site/p/blog/dicas-preparar-ano-letivo\",\n linkText: \"Ler mais\",\n },\n];\n\n// ─── Conteúdo HTML rico para o post de exemplo ───\nconst SAMPLE_POST_CONTENT = `\n<h2>O que é a Feira de Ciências?</h2>\n<p>A Feira de Ciências é um evento anual que celebra a curiosidade, a pesquisa e a criatividade dos nossos alunos. Nesta edição especial de 2026, recebemos mais de <strong>500 visitantes</strong> e contamos com a participação de todas as turmas do Ensino Fundamental e Médio.</p>\n<p>Este ano, o tema central foi <em>\"Ciência e Sustentabilidade\"</em>, incentivando os estudantes a desenvolverem projetos que aliassem inovação tecnológica com responsabilidade ambiental.</p>\n\n<h2>Destaques da Edição 2026</h2>\n<p>Entre os mais de 50 projetos apresentados, alguns se destacaram pela originalidade e impacto:</p>\n<ul>\n <li><strong>Jardim Sustentável Inteligente</strong> — Alunos do 5º ano desenvolveram um sistema de irrigação automática usando sensores de umidade e placa Arduino.</li>\n <li><strong>Robótica Educacional</strong> — A turma do 8º ano criou um robô que auxilia no ensino de matemática para crianças do 1º ao 3º ano.</li>\n <li><strong>Energia Solar na Escola</strong> — Projeto do 2º ano do Ensino Médio demonstrou como painéis solares poderiam reduzir em 40% o consumo de energia da escola.</li>\n</ul>\n\n<blockquote>\n <p>\"A Feira de Ciências é um dos momentos mais importantes do nosso calendário escolar. Ver a dedicação e o brilho nos olhos dos alunos ao apresentarem seus projetos nos enche de orgulho e nos motiva a continuar investindo em educação de qualidade.\"</p>\n <p><strong>— Prof. Maria Silva, Coordenadora Pedagógica</strong></p>\n</blockquote>\n\n<h2>Premiações</h2>\n<p>O júri, composto por professores universitários e profissionais da área de tecnologia, selecionou os três melhores projetos:</p>\n<ol>\n <li><strong>1º Lugar:</strong> Jardim Sustentável Inteligente (5º ano)</li>\n <li><strong>2º Lugar:</strong> Energia Solar na Escola (2º EM)</li>\n <li><strong>3º Lugar:</strong> Robótica Educacional (8º ano)</li>\n</ol>\n\n<h2>Próximos Passos</h2>\n<p>Os três projetos finalistas representarão nossa escola na <strong>Feira Regional de Ciências</strong>, que acontecerá em março na capital. Os alunos já estão se preparando para levar suas apresentações a um público ainda maior.</p>\n<p>Parabéns a todos os participantes, professores orientadores e famílias que apoiaram essa jornada de descobertas!</p>\n`.trim();\n\n/**\n * Deep-clone um bloco com novo ID\n */\nfunction cloneBlock(block: Block, newId: string): Block {\n const cloned: Block = JSON.parse(JSON.stringify(block));\n return { ...cloned, id: newId };\n}\n\nexport const blogPlugin: PluginRegistration = {\n manifest: {\n id: \"blog\",\n version: \"1.0.0\",\n name: \"Blog\",\n description: \"Blog com posts, categorias e tags\",\n icon: \"FileText\",\n\n capabilities: {\n blocks: [\"blogPostCard\", \"blogPostGrid\", \"blogPostDetail\", \"blogCategoryFilter\", \"blogSearchBar\"],\n\n pageTemplates: [\n {\n id: \"blog-listing\",\n name: \"Blog\",\n slug: \"blog\",\n pluginId: \"blog\",\n structure: [],\n dataSource: {\n provider: \"blog-posts\",\n mode: \"list\",\n },\n },\n {\n id: \"blog-post\",\n name: \"Post\",\n slug: \"blog/:slug\",\n pluginId: \"blog\",\n structure: [],\n dataSource: {\n provider: \"blog-posts\",\n mode: \"single\",\n paramMapping: { slug: \":slug\" },\n },\n editRestrictions: {\n lockedStructure: true,\n nonRemovable: true,\n },\n },\n ],\n\n dataSchemas: [\n {\n type: \"blog-post\",\n label: \"Blog Post\",\n fields: [\n { name: \"title\", type: \"string\", required: true, label: \"Title\" },\n { name: \"slug\", type: \"string\", required: true, label: \"Slug\" },\n { name: \"excerpt\", type: \"string\", label: \"Excerpt\" },\n { name: \"content\", type: \"richtext\", required: true, label: \"Content\" },\n { name: \"featuredImage\", type: \"image\", label: \"Featured Image\" },\n { name: \"category\", type: \"string\", label: \"Category\" },\n { name: \"tags\", type: \"array\", label: \"Tags\" },\n { name: \"authorVariant\", type: \"string\", label: \"Author Variant\" },\n { name: \"readingTime\", type: \"number\", label: \"Reading Time\" },\n { name: \"metaTitle\", type: \"string\", label: \"Meta Title (SEO)\" },\n { name: \"metaDescription\", type: \"string\", label: \"Meta Description (SEO)\" },\n { name: \"ogImage\", type: \"image\", label: \"Open Graph Image\" },\n ],\n },\n ],\n\n contentProviders: [\"blog-posts\", \"blog-categories\"],\n },\n\n restrictions: {\n lockedFields: {\n blogPostDetail: [\"content\", \"date\"],\n },\n requiredPages: [\"blog-listing\", \"blog-post\"],\n },\n },\n\n onActivate(document: SiteDocument): SiteDocument {\n logger.debug(\"Blog plugin activating...\");\n\n const existingPageIds = new Set(document.pages.map((p) => p.id));\n const newPages = [...document.pages];\n\n // ── Encontrar home page para clonar navbar/footer ──\n const homePage =\n document.pages.find((p) => p.slug === \"home\") || document.pages[0];\n\n const homeNavbar = homePage?.structure.find((b) => b.type === \"navbar\");\n const homeFooter = homePage?.structure.find((b) => b.type === \"footer\");\n\n // ── 1. Adicionar link \"Blog\" à navbar da home page ──\n // Preserva os links existentes e apenas insere \"Blog\" antes do último item.\n if (homePage && homeNavbar) {\n const homeIdx = newPages.findIndex((p) => p.id === homePage.id);\n if (homeIdx >= 0) {\n const navbarProps = homeNavbar.props as Record<string, any>;\n const existingLinks: Array<{ text: string; href: string }> =\n Array.isArray(navbarProps.links) ? [...navbarProps.links] : [];\n const hasBlogLink = existingLinks.some(\n (l) => l.href === \"/p/blog\",\n );\n\n if (!hasBlogLink) {\n // Inserir \"Blog\" antes do último link (geralmente \"Contato\")\n const insertIdx = existingLinks.length > 0 ? existingLinks.length - 1 : 0;\n existingLinks.splice(insertIdx, 0, { text: \"Blog\", href: \"/p/blog\" });\n\n // Atualizar navbar na home page com o novo link\n const updatedStructure = newPages[homeIdx].structure.map((b) => {\n if (b.id === homeNavbar.id) {\n return { ...b, props: { ...b.props, links: existingLinks } } as Block;\n }\n return b;\n });\n newPages[homeIdx] = { ...newPages[homeIdx], structure: updatedStructure };\n logger.debug(\"Blog link added to home navbar\");\n\n // Atualizar referência para que clones nas páginas do blog usem navbar com link\n // (homeNavbar é const, então criamos a versão atualizada para uso nos clones)\n (homeNavbar as any).props = { ...navbarProps, links: existingLinks };\n }\n }\n }\n\n // ── 2. Injetar seção de blog na home page (antes do footer) ──\n if (homePage) {\n const homeIdx = newPages.findIndex((p) => p.id === homePage.id);\n const alreadyInjected = homePage.structure.some(\n (b) => b.id === BLOG_HOME_SECTION_ID,\n );\n\n if (homeIdx >= 0 && !alreadyInjected) {\n const blogHomeSection: Block = {\n id: BLOG_HOME_SECTION_ID,\n type: \"blogPostGrid\",\n props: {\n title: \"Blog\",\n subtitle: \"Últimas publicações\",\n columns: 3,\n cards: SAMPLE_BLOG_CARDS,\n variant: \"default\",\n showViewAll: true,\n viewAllText: \"Ver todos os posts\",\n viewAllHref: \"/site/p/blog\",\n },\n } as Block;\n\n const updatedStructure = [...newPages[homeIdx].structure];\n const footerIdx = updatedStructure.findIndex(\n (b) => b.type === \"footer\",\n );\n\n if (footerIdx >= 0) {\n updatedStructure.splice(footerIdx, 0, blogHomeSection);\n } else {\n updatedStructure.push(blogHomeSection);\n }\n\n newPages[homeIdx] = {\n ...newPages[homeIdx],\n structure: updatedStructure,\n };\n logger.debug(\"Blog section injected into home page\");\n }\n }\n\n // ── 3. Criar página \"Blog\" (listagem completa) ──\n if (!existingPageIds.has(\"blog\")) {\n const blogPageStructure: Block[] = [];\n\n // Navbar clonada da home\n if (homeNavbar) {\n blogPageStructure.push(cloneBlock(homeNavbar, \"blog-page-navbar\"));\n }\n\n // Hero banner do blog\n blogPageStructure.push({\n id: \"blog-page-hero\",\n type: \"hero\",\n props: {\n title: \"Blog\",\n subtitle: \"Novidades & Publicações\",\n description:\n \"Acompanhe as últimas novidades, eventos e conquistas da nossa comunidade escolar.\",\n variant: \"centered\",\n align: \"center\",\n overlay: true,\n overlayColor: \"rgba(79, 70, 229, 0.9)\",\n background: \"#4f46e5\",\n minHeight: \"280px\",\n },\n } as Block);\n\n // Search bar\n blogPageStructure.push({\n id: \"blog-search-bar\",\n type: \"blogSearchBar\",\n props: {\n placeholder: \"Buscar posts...\",\n variant: \"simple\",\n showIcon: true,\n searchUrl: \"/site/p/blog\",\n },\n } as Block);\n\n // Category filter\n blogPageStructure.push({\n id: \"blog-category-filter\",\n type: \"blogCategoryFilter\",\n props: {\n title: \"\",\n categories: SAMPLE_BLOG_CARDS.map((c) => ({\n name: c.category,\n slug: c.category.toLowerCase().replace(/\\s+/g, \"-\"),\n count: 1,\n })),\n variant: \"chips\",\n showCount: false,\n showAll: true,\n allLabel: \"Todas\",\n filterUrl: \"/site/p/blog\",\n },\n } as Block);\n\n // Grid de posts\n blogPageStructure.push({\n id: \"blog-grid-main\",\n type: \"blogPostGrid\",\n props: {\n title: \"\",\n subtitle: \"\",\n columns: 3,\n cards: SAMPLE_BLOG_CARDS,\n variant: \"default\",\n showViewAll: false,\n viewAllText: \"Ver todos\",\n viewAllHref: \"/site/p/blog\",\n },\n } as Block);\n\n // Footer clonado da home\n if (homeFooter) {\n blogPageStructure.push(cloneBlock(homeFooter, \"blog-page-footer\"));\n }\n\n newPages.push({\n id: \"blog\",\n name: \"Blog\",\n slug: \"blog\",\n pluginId: \"blog\",\n pageTemplateId: \"blog-listing\",\n structure: blogPageStructure,\n dataSource: {\n provider: \"blog-posts\",\n mode: \"list\",\n defaultParams: { limit: 15 },\n },\n });\n logger.debug(\"Blog listing page created\");\n }\n\n // ── 4. Criar página \"Post\" (detalhe) ──\n if (!existingPageIds.has(\"blog-post\")) {\n const postPageStructure: Block[] = [];\n\n if (homeNavbar) {\n postPageStructure.push(cloneBlock(homeNavbar, \"post-page-navbar\"));\n }\n\n postPageStructure.push({\n id: \"blog-detail-main\",\n type: \"blogPostDetail\",\n props: {\n title: \"Feira de Ciências 2026: Inovação e Criatividade\",\n content: SAMPLE_POST_CONTENT,\n featuredImage:\n \"https://images.unsplash.com/photo-1567168544230-3b9e5ec47659?w=1200&h=600&fit=crop\",\n date: \"05 Fev 2026\",\n category: \"Eventos\",\n authorVariant: \"inline\",\n readingTime: \"5 min de leitura\",\n tags: [\"Feira de Ciências\", \"Eventos\", \"Sustentabilidade\", \"Projetos\"],\n showFeaturedImage: true,\n showAuthor: true,\n showDate: true,\n showTags: true,\n showReadingTime: true,\n contentMaxWidth: \"720px\",\n },\n } as Block);\n\n if (homeFooter) {\n postPageStructure.push(cloneBlock(homeFooter, \"post-page-footer\"));\n }\n\n newPages.push({\n id: \"blog-post\",\n name: \"Post\",\n slug: \"blog/:slug\",\n pluginId: \"blog\",\n pageTemplateId: \"blog-post\",\n isDynamic: true,\n structure: postPageStructure,\n dataSource: {\n provider: \"blog-posts\",\n mode: \"single\",\n paramMapping: { slug: \":slug\" },\n },\n editRestrictions: {\n lockedStructure: true,\n nonRemovable: true,\n },\n });\n logger.debug(\"Blog post detail page created\");\n }\n\n return {\n ...document,\n pages: newPages,\n };\n },\n\n onDeactivate(document: SiteDocument): SiteDocument {\n logger.debug(\"Blog plugin deactivating...\");\n\n const newPages = document.pages\n // Remover páginas do plugin\n .filter((page) => page.pluginId !== \"blog\")\n // Remover seção de blog injetada + link \"Blog\" da navbar\n .map((page) => {\n let structure = page.structure;\n\n // Remover seção de blog injetada\n const hasInjected = structure.some(\n (b) => b.id === BLOG_HOME_SECTION_ID,\n );\n if (hasInjected) {\n structure = structure.filter(\n (b) => b.id !== BLOG_HOME_SECTION_ID,\n );\n }\n\n // Remover link \"Blog\" (/p/blog) da navbar\n structure = structure.map((b) => {\n if (b.type !== \"navbar\") return b;\n const props = b.props as Record<string, any>;\n const links: Array<{ text: string; href: string }> = Array.isArray(props.links) ? props.links : [];\n const filtered = links.filter((l) => l.href !== \"/p/blog\");\n if (filtered.length !== links.length) {\n return { ...b, props: { ...props, links: filtered } } as Block;\n }\n return b;\n });\n\n if (structure !== page.structure) {\n return { ...page, structure };\n }\n return page;\n });\n\n logger.debug(\n `Removed ${document.pages.length - newPages.length} blog page(s) and injected section`,\n );\n\n return {\n ...document,\n pages: newPages,\n };\n },\n\n getEditorRestrictions(blockType: BlockType) {\n if (blockType === \"blogPostDetail\") {\n return {\n lockedFields: [\"content\", \"date\"],\n };\n }\n if (blockType === \"blogCategoryFilter\") {\n return {\n lockedFields: [\"categories\"],\n };\n }\n return undefined;\n },\n};\n\n// Auto-registrar o plugin (side effect — como os blocos fazem com componentRegistry)\npluginRegistry.register(blogPlugin);\n"],"names":["BLOG_HOME_SECTION_ID","SAMPLE_BLOG_CARDS","SAMPLE_POST_CONTENT","cloneBlock","block","newId","blogPlugin","document","logger","existingPageIds","p","newPages","homePage","homeNavbar","b","homeFooter","homeIdx","navbarProps","existingLinks","l","insertIdx","updatedStructure","alreadyInjected","blogHomeSection","footerIdx","blogPageStructure","c","postPageStructure","page","structure","props","links","filtered","blockType","pluginRegistry"],"mappings":";;AAoBA,MAAMA,IAAuB,yBAGvBC,IAAoB;AAAA,EACxB;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEZ;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IAC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,EAAM,SACrB,EAAE,GAAGjB,GAAG,OAAO,EAAE,GAAGgB,GAAO,OAAOE,IAAS,IAE7ClB;AAAA,MACT,CAAC,GAEGe,MAAcD,EAAK,YACd,EAAE,GAAGA,GAAM,WAAAC,EAAA,IAEbD;AAAA,IACT,CAAC;AAEH,WAAApB,EAAO;AAAA,MACL,WAAWD,EAAS,MAAM,SAASI,EAAS,MAAM;AAAA,IAAA,GAG7C;AAAA,MACL,GAAGJ;AAAA,MACH,OAAOI;AAAA,IAAA;AAAA,EAEX;AAAA,EAEA,sBAAsBsB,GAAsB;AAC1C,QAAIA,MAAc;AAChB,aAAO;AAAA,QACL,cAAc,CAAC,WAAW,MAAM;AAAA,MAAA;AAGpC,QAAIA,MAAc;AAChB,aAAO;AAAA,QACL,cAAc,CAAC,YAAY;AAAA,MAAA;AAAA,EAIjC;AACF;AAGAC,EAAe,SAAS5B,CAAU;"}
@@ -1,18 +1,18 @@
1
1
  import { logger as u } from "../../utils/logger.js";
2
- async function v(t, n, e, r) {
2
+ async function B(t, n, e, r) {
3
3
  if (!t.dataSource)
4
4
  return t;
5
- const { provider: o, mode: i, paramMapping: s } = t.dataSource, a = n.get(o);
6
- if (!a)
5
+ const { provider: o, mode: a, paramMapping: s } = t.dataSource, i = n.get(o);
6
+ if (!i)
7
7
  return u.warn(
8
8
  `ContentProvider "${o}" not found for page "${t.id}". Rendering with static props.`
9
9
  ), t;
10
10
  try {
11
- if (i === "list")
12
- return await m(t, a, r);
13
- if (i === "single") {
14
- const c = l(s, e);
15
- return c ? await y(t, a, c) : (u.warn(
11
+ if (a === "list")
12
+ return await h(t, i, r);
13
+ if (a === "single") {
14
+ const c = v(s, e);
15
+ return c ? await P(t, i, c) : (u.warn(
16
16
  `Could not resolve ID/slug for page "${t.id}" from URL params. Using static props.`
17
17
  ), t);
18
18
  }
@@ -21,54 +21,67 @@ async function v(t, n, e, r) {
21
21
  return u.error(`Error hydrating page "${t.id}":`, c), t;
22
22
  }
23
23
  }
24
- async function m(t, n, e) {
24
+ function y(t, n) {
25
+ const r = `/site/p/${t.slug && t.slug !== "home" ? t.slug : "blog"}`, o = new URLSearchParams(), a = n?.filter;
26
+ return a?.search && o.set("busca", a.search), a?.category && o.set("categoria", a.category), o.toString() ? `${r}?${o.toString()}` : r;
27
+ }
28
+ async function h(t, n, e) {
25
29
  const r = {
26
30
  limit: 12,
27
31
  ...t.dataSource?.defaultParams,
28
32
  ...e
29
- }, i = ((await n.fetchList(r)).items || []).map((a) => n.toBlockProps(a)), s = t.structure.map((a) => {
30
- let c = d(a, i);
31
- return c = f(c, i), c;
33
+ }, o = await n.fetchList(r), a = (o.items || []).map((d) => n.toBlockProps(d)), s = !!t.dataSource?.defaultParams?._noPagination, i = Math.ceil((o.total || 0) / (o.limit || r.limit || 12)), c = !s && i > 1 ? {
34
+ currentPage: o.page || 1,
35
+ totalPages: i,
36
+ paginationBaseUrl: y(t, e)
37
+ } : void 0, g = t.structure.map((d) => {
38
+ let f = p(d, a, c);
39
+ return f = m(f, a), f;
32
40
  });
33
41
  return {
34
42
  ...t,
35
- structure: s
43
+ structure: g
36
44
  };
37
45
  }
38
- function d(t, n) {
46
+ function p(t, n, e) {
39
47
  if (t.type === "blogPostGrid")
40
48
  return {
41
49
  ...t,
42
50
  props: {
43
51
  ...t.props,
44
- cards: n
52
+ cards: n,
53
+ ...e ? {
54
+ currentPage: e.currentPage,
55
+ totalPages: e.totalPages,
56
+ paginationBaseUrl: e.paginationBaseUrl
57
+ } : {}
45
58
  }
46
59
  };
47
- const e = t.props;
48
- return e.children && Array.isArray(e.children) ? {
60
+ const r = t.props;
61
+ return r.children && Array.isArray(r.children) ? {
49
62
  ...t,
50
63
  props: {
51
- ...e,
52
- children: e.children.map(
53
- (r) => d(r, n)
64
+ ...r,
65
+ children: r.children.map(
66
+ (o) => p(o, n, e)
54
67
  )
55
68
  }
56
69
  } : t;
57
70
  }
58
- async function y(t, n, e) {
71
+ async function P(t, n, e) {
59
72
  const r = await n.fetchById(e);
60
73
  if (!r)
61
74
  return u.warn(`Content item "${e}" not found. Using static props.`), t;
62
- const o = n.toBlockProps(r), i = t.structure.map(
63
- (a) => p(a, o, r)
64
- ), s = h(r, o);
75
+ const o = n.toBlockProps(r), a = t.structure.map(
76
+ (i) => l(i, o, r)
77
+ ), s = S(r, o);
65
78
  return {
66
79
  ...t,
67
- structure: i,
80
+ structure: a,
68
81
  ...s ? { seo: s } : {}
69
82
  };
70
83
  }
71
- function p(t, n, e) {
84
+ function l(t, n, e) {
72
85
  if (t.type === "blogPostDetail")
73
86
  return {
74
87
  ...t,
@@ -94,31 +107,31 @@ function p(t, n, e) {
94
107
  props: {
95
108
  ...r,
96
109
  children: r.children.map(
97
- (o) => p(o, n, e)
110
+ (o) => l(o, n, e)
98
111
  )
99
112
  }
100
113
  } : t;
101
114
  }
102
- function h(t, n) {
103
- const e = t.metadata?.seo, r = e?.metaTitle || n.metaTitle || n.title, o = e?.metaDescription || n.metaDescription || n.excerpt, i = e?.ogImage || n.ogImage || n.featuredImage;
104
- if (!(!r && !o && !i))
115
+ function S(t, n) {
116
+ const e = t.metadata?.seo, r = e?.metaTitle || n.metaTitle || n.title, o = e?.metaDescription || n.metaDescription || n.excerpt, a = e?.ogImage || n.ogImage || n.featuredImage;
117
+ if (!(!r && !o && !a))
105
118
  return {
106
119
  metaTitle: r,
107
120
  metaDescription: o,
108
- ogImage: i,
121
+ ogImage: a,
109
122
  ogType: "article"
110
123
  };
111
124
  }
112
- function f(t, n) {
125
+ function m(t, n) {
113
126
  if (t.type === "blogCategoryFilter") {
114
127
  const r = /* @__PURE__ */ new Map();
115
- for (const i of n) {
116
- const s = i.category;
128
+ for (const a of n) {
129
+ const s = a.category;
117
130
  s && r.set(s, (r.get(s) || 0) + 1);
118
131
  }
119
- const o = Array.from(r.entries()).map(([i, s]) => ({
120
- name: i,
121
- slug: i,
132
+ const o = Array.from(r.entries()).map(([a, s]) => ({
133
+ name: a,
134
+ slug: a,
122
135
  count: s
123
136
  }));
124
137
  return {
@@ -135,18 +148,18 @@ function f(t, n) {
135
148
  props: {
136
149
  ...e,
137
150
  children: e.children.map(
138
- (r) => f(r, n)
151
+ (r) => m(r, n)
139
152
  )
140
153
  }
141
154
  } : t;
142
155
  }
143
- function l(t, n) {
156
+ function v(t, n) {
144
157
  if (!(!t || !n)) {
145
158
  for (const e of ["slug", "id"]) {
146
159
  const r = t[e];
147
160
  if (r) {
148
- const o = r.startsWith(":") ? r.slice(1) : r, i = n[o];
149
- if (i) return i;
161
+ const o = r.startsWith(":") ? r.slice(1) : r, a = n[o];
162
+ if (a) return a;
150
163
  }
151
164
  }
152
165
  for (const e of Object.values(t)) {
@@ -156,6 +169,6 @@ function l(t, n) {
156
169
  }
157
170
  }
158
171
  export {
159
- v as hydratePageWithContent
172
+ B as hydratePageWithContent
160
173
  };
161
174
  //# sourceMappingURL=contentHydration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contentHydration.js","sources":["../../../src/engine/plugins/contentHydration.ts"],"sourcesContent":["/**\n * Content Hydration\n * Hydrates page blocks with data from ContentProviders before rendering.\n *\n * This works at the data level, before either rendering pipeline\n * (React renderers or HTML exporters) processes the blocks.\n */\n\nimport { logger } from \"../../utils/logger\";\nimport type { SitePage, Block, PageSeoConfig } from \"../schema/siteDocument\";\nimport type { ContentProvider, ContentItem, ContentListParams } from \"./types\";\n\n/**\n * Map of provider type → ContentProvider instance\n */\nexport type ContentProviderMap = Map<string, ContentProvider>;\n\n/**\n * Hydrates a page's blocks with data from ContentProviders.\n *\n * For pages with a dataSource:\n * - mode \"list\": fetches list and populates grid blocks' `cards` prop\n * - mode \"single\": fetches single item and spreads props onto detail blocks\n *\n * Returns a new page with hydrated block props (original page is not mutated).\n */\nexport async function hydratePageWithContent(\n page: SitePage,\n providers: ContentProviderMap,\n urlParams?: Record<string, string>,\n fetchParams?: ContentListParams,\n): Promise<SitePage> {\n // No dataSource → return page as-is\n if (!page.dataSource) {\n return page;\n }\n\n const { provider: providerType, mode, paramMapping } = page.dataSource;\n const provider = providers.get(providerType);\n\n if (!provider) {\n logger.warn(\n `ContentProvider \"${providerType}\" not found for page \"${page.id}\". Rendering with static props.`,\n );\n return page;\n }\n\n try {\n if (mode === \"list\") {\n return await hydrateListPage(page, provider, fetchParams);\n }\n\n if (mode === \"single\") {\n // Resolve the ID/slug from URL params\n const idOrSlug = resolveIdFromParams(paramMapping, urlParams);\n if (!idOrSlug) {\n logger.warn(\n `Could not resolve ID/slug for page \"${page.id}\" from URL params. Using static props.`,\n );\n return page;\n }\n return await hydrateSinglePage(page, provider, idOrSlug);\n }\n\n return page;\n } catch (error) {\n logger.error(`Error hydrating page \"${page.id}\":`, error);\n return page;\n }\n}\n\n/**\n * Hydrates a list-mode page: fetches items and populates grid blocks.\n */\nasync function hydrateListPage(\n page: SitePage,\n provider: ContentProvider,\n fetchParams?: ContentListParams,\n): Promise<SitePage> {\n const params: ContentListParams = {\n limit: 12,\n ...page.dataSource?.defaultParams,\n ...fetchParams,\n };\n\n const result = await provider.fetchList(params);\n\n // Convert items to block props (empty array if no results — shows empty state, never mock data)\n const cardProps = (result.items || []).map((item) => provider.toBlockProps(item));\n\n // Hydrate all grid blocks and category filters on the page\n const hydratedStructure = page.structure.map((block) => {\n let hydrated = hydrateGridBlock(block, cardProps);\n hydrated = hydrateCategoryFilterBlock(hydrated, cardProps);\n return hydrated;\n });\n\n return {\n ...page,\n structure: hydratedStructure,\n };\n}\n\n/**\n * Hydrates grid blocks (blogPostGrid, etc.) with card data.\n */\nfunction hydrateGridBlock(\n block: Block,\n cardProps: Record<string, unknown>[],\n): Block {\n // Direct match: blogPostGrid gets cards populated\n if (block.type === \"blogPostGrid\") {\n return {\n ...block,\n props: {\n ...block.props,\n cards: cardProps,\n },\n };\n }\n\n // Recurse into children for nested structures\n const props = block.props as Record<string, unknown>;\n if (props.children && Array.isArray(props.children)) {\n return {\n ...block,\n props: {\n ...props,\n children: (props.children as Block[]).map((child) =>\n hydrateGridBlock(child, cardProps),\n ),\n },\n };\n }\n\n return block;\n}\n\n/**\n * Hydrates a single-mode page: fetches one item and populates detail blocks.\n */\nasync function hydrateSinglePage(\n page: SitePage,\n provider: ContentProvider,\n idOrSlug: string,\n): Promise<SitePage> {\n const item = await provider.fetchById(idOrSlug);\n\n if (!item) {\n logger.warn(`Content item \"${idOrSlug}\" not found. Using static props.`);\n return page;\n }\n\n const blockProps = provider.toBlockProps(item);\n\n // Hydrate all detail blocks on the page\n const hydratedStructure = page.structure.map((block) =>\n hydrateDetailBlock(block, blockProps, item),\n );\n\n // Extract SEO from content item and set on page\n const seo = extractSeoFromContent(item, blockProps);\n\n return {\n ...page,\n structure: hydratedStructure,\n ...(seo ? { seo } : {}),\n };\n}\n\n/**\n * Hydrates detail blocks (blogPostDetail, etc.) with item data.\n */\nfunction hydrateDetailBlock(\n block: Block,\n blockProps: Record<string, unknown>,\n item: ContentItem,\n): Block {\n if (block.type === \"blogPostDetail\") {\n return {\n ...block,\n props: {\n ...block.props,\n ...blockProps,\n // Preserve metadata\n _contentItemId: item.id,\n _contentItemSlug: item.slug,\n },\n };\n }\n\n // Also hydrate blogPostCard blocks that reference the same item\n if (block.type === \"blogPostCard\") {\n return {\n ...block,\n props: {\n ...block.props,\n ...blockProps,\n },\n };\n }\n\n // Recurse into children\n const props = block.props as Record<string, unknown>;\n if (props.children && Array.isArray(props.children)) {\n return {\n ...block,\n props: {\n ...props,\n children: (props.children as Block[]).map((child) =>\n hydrateDetailBlock(child, blockProps, item),\n ),\n },\n };\n }\n\n return block;\n}\n\n/**\n * Extracts SEO configuration from a ContentItem and block props.\n * Priority: item.metadata.seo > blockProps (metaTitle/title, metaDescription/excerpt, ogImage/featuredImage)\n */\nfunction extractSeoFromContent(\n item: ContentItem,\n blockProps: Record<string, unknown>,\n): PageSeoConfig | undefined {\n const seoMeta = item.metadata?.seo;\n\n const metaTitle = seoMeta?.metaTitle || (blockProps.metaTitle as string) || (blockProps.title as string);\n const metaDescription = seoMeta?.metaDescription || (blockProps.metaDescription as string) || (blockProps.excerpt as string);\n const ogImage = seoMeta?.ogImage || (blockProps.ogImage as string) || (blockProps.featuredImage as string);\n\n if (!metaTitle && !metaDescription && !ogImage) {\n return undefined;\n }\n\n return {\n metaTitle,\n metaDescription,\n ogImage,\n ogType: \"article\",\n };\n}\n\n/**\n * Hydrates blogCategoryFilter blocks with category data extracted from posts.\n */\nfunction hydrateCategoryFilterBlock(\n block: Block,\n cardProps: Record<string, unknown>[],\n): Block {\n if (block.type === \"blogCategoryFilter\") {\n // Extract unique categories from posts with counts\n const categoryMap = new Map<string, number>();\n for (const card of cardProps) {\n const cat = card.category as string;\n if (cat) {\n categoryMap.set(cat, (categoryMap.get(cat) || 0) + 1);\n }\n }\n\n const categories = Array.from(categoryMap.entries()).map(([name, count]) => ({\n name,\n slug: name,\n count,\n }));\n\n return {\n ...block,\n props: {\n ...block.props,\n categories,\n },\n };\n }\n\n // Recurse into children\n const props = block.props as Record<string, unknown>;\n if (props.children && Array.isArray(props.children)) {\n return {\n ...block,\n props: {\n ...props,\n children: (props.children as Block[]).map((child) =>\n hydrateCategoryFilterBlock(child, cardProps),\n ),\n },\n };\n }\n\n return block;\n}\n\n/**\n * Resolves the item ID/slug from URL params using paramMapping.\n * e.g., paramMapping: { slug: \":slug\" }, urlParams: { slug: \"my-post\" } → \"my-post\"\n */\nfunction resolveIdFromParams(\n paramMapping?: Record<string, string>,\n urlParams?: Record<string, string>,\n): string | undefined {\n if (!paramMapping || !urlParams) return undefined;\n\n // Try slug first, then id\n for (const key of [\"slug\", \"id\"]) {\n const paramPattern = paramMapping[key];\n if (paramPattern) {\n // Extract param name from pattern (e.g., \":slug\" → \"slug\")\n const paramName = paramPattern.startsWith(\":\")\n ? paramPattern.slice(1)\n : paramPattern;\n const value = urlParams[paramName];\n if (value) return value;\n }\n }\n\n // Fallback: return first available param value\n for (const paramPattern of Object.values(paramMapping)) {\n const paramName = paramPattern.startsWith(\":\")\n ? paramPattern.slice(1)\n : paramPattern;\n const value = urlParams[paramName];\n if (value) return value;\n }\n\n return undefined;\n}\n"],"names":["hydratePageWithContent","page","providers","urlParams","fetchParams","providerType","mode","paramMapping","provider","logger","hydrateListPage","idOrSlug","resolveIdFromParams","hydrateSinglePage","error","params","cardProps","item","hydratedStructure","block","hydrated","hydrateGridBlock","hydrateCategoryFilterBlock","props","child","blockProps","hydrateDetailBlock","seo","extractSeoFromContent","seoMeta","metaTitle","metaDescription","ogImage","categoryMap","card","cat","categories","name","count","key","paramPattern","paramName","value"],"mappings":";AA0BA,eAAsBA,EACpBC,GACAC,GACAC,GACAC,GACmB;AAEnB,MAAI,CAACH,EAAK;AACR,WAAOA;AAGT,QAAM,EAAE,UAAUI,GAAc,MAAAC,GAAM,cAAAC,EAAA,IAAiBN,EAAK,YACtDO,IAAWN,EAAU,IAAIG,CAAY;AAE3C,MAAI,CAACG;AACH,WAAAC,EAAO;AAAA,MACL,oBAAoBJ,CAAY,yBAAyBJ,EAAK,EAAE;AAAA,IAAA,GAE3DA;AAGT,MAAI;AACF,QAAIK,MAAS;AACX,aAAO,MAAMI,EAAgBT,GAAMO,GAAUJ,CAAW;AAG1D,QAAIE,MAAS,UAAU;AAErB,YAAMK,IAAWC,EAAoBL,GAAcJ,CAAS;AAC5D,aAAKQ,IAME,MAAME,EAAkBZ,GAAMO,GAAUG,CAAQ,KALrDF,EAAO;AAAA,QACL,uCAAuCR,EAAK,EAAE;AAAA,MAAA,GAEzCA;AAAA,IAGX;AAEA,WAAOA;AAAA,EACT,SAASa,GAAO;AACd,WAAAL,EAAO,MAAM,yBAAyBR,EAAK,EAAE,MAAMa,CAAK,GACjDb;AAAA,EACT;AACF;AAKA,eAAeS,EACbT,GACAO,GACAJ,GACmB;AACnB,QAAMW,IAA4B;AAAA,IAChC,OAAO;AAAA,IACP,GAAGd,EAAK,YAAY;AAAA,IACpB,GAAGG;AAAA,EAAA,GAMCY,MAHS,MAAMR,EAAS,UAAUO,CAAM,GAGpB,SAAS,CAAA,GAAI,IAAI,CAACE,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I,GAAMC,CAAK,OAAO;AAAA,MAC3E,MAAAD;AAAA,MACA,MAAMA;AAAA,MACN,OAAAC;AAAA,IAAA,EACA;AAEF,WAAO;AAAA,MACL,GAAGnB;AAAA,MACH,OAAO;AAAA,QACL,GAAGA,EAAM;AAAA,QACT,YAAAiB;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAGA,QAAMb,IAAQJ,EAAM;AACpB,SAAII,EAAM,YAAY,MAAM,QAAQA,EAAM,QAAQ,IACzC;AAAA,IACL,GAAGJ;AAAA,IACH,OAAO;AAAA,MACL,GAAGI;AAAA,MACH,UAAWA,EAAM,SAAqB;AAAA,QAAI,CAACC,MACzCF,EAA2BE,GAAOR,CAAS;AAAA,MAAA;AAAA,IAC7C;AAAA,EACF,IAIGG;AACT;AAMA,SAASP,EACPL,GACAJ,GACoB;AACpB,MAAI,GAACI,KAAgB,CAACJ,IAGtB;AAAA,eAAWoC,KAAO,CAAC,QAAQ,IAAI,GAAG;AAChC,YAAMC,IAAejC,EAAagC,CAAG;AACrC,UAAIC,GAAc;AAEhB,cAAMC,IAAYD,EAAa,WAAW,GAAG,IACzCA,EAAa,MAAM,CAAC,IACpBA,GACEE,IAAQvC,EAAUsC,CAAS;AACjC,YAAIC,EAAO,QAAOA;AAAA,MACpB;AAAA,IACF;AAGA,eAAWF,KAAgB,OAAO,OAAOjC,CAAY,GAAG;AACtD,YAAMkC,IAAYD,EAAa,WAAW,GAAG,IACzCA,EAAa,MAAM,CAAC,IACpBA,GACEE,IAAQvC,EAAUsC,CAAS;AACjC,UAAIC,EAAO,QAAOA;AAAA,IACpB;AAAA;AAGF;"}
1
+ {"version":3,"file":"contentHydration.js","sources":["../../../src/engine/plugins/contentHydration.ts"],"sourcesContent":["/**\n * Content Hydration\n * Hydrates page blocks with data from ContentProviders before rendering.\n *\n * This works at the data level, before either rendering pipeline\n * (React renderers or HTML exporters) processes the blocks.\n */\n\nimport { logger } from \"../../utils/logger\";\nimport type { SitePage, Block, PageSeoConfig } from \"../schema/siteDocument\";\nimport type { ContentProvider, ContentItem, ContentListParams } from \"./types\";\n\n/**\n * Map of provider type → ContentProvider instance\n */\nexport type ContentProviderMap = Map<string, ContentProvider>;\n\n/**\n * Hydrates a page's blocks with data from ContentProviders.\n *\n * For pages with a dataSource:\n * - mode \"list\": fetches list and populates grid blocks' `cards` prop\n * - mode \"single\": fetches single item and spreads props onto detail blocks\n *\n * Returns a new page with hydrated block props (original page is not mutated).\n */\nexport async function hydratePageWithContent(\n page: SitePage,\n providers: ContentProviderMap,\n urlParams?: Record<string, string>,\n fetchParams?: ContentListParams,\n): Promise<SitePage> {\n // No dataSource → return page as-is\n if (!page.dataSource) {\n return page;\n }\n\n const { provider: providerType, mode, paramMapping } = page.dataSource;\n const provider = providers.get(providerType);\n\n if (!provider) {\n logger.warn(\n `ContentProvider \"${providerType}\" not found for page \"${page.id}\". Rendering with static props.`,\n );\n return page;\n }\n\n try {\n if (mode === \"list\") {\n return await hydrateListPage(page, provider, fetchParams);\n }\n\n if (mode === \"single\") {\n // Resolve the ID/slug from URL params\n const idOrSlug = resolveIdFromParams(paramMapping, urlParams);\n if (!idOrSlug) {\n logger.warn(\n `Could not resolve ID/slug for page \"${page.id}\" from URL params. Using static props.`,\n );\n return page;\n }\n return await hydrateSinglePage(page, provider, idOrSlug);\n }\n\n return page;\n } catch (error) {\n logger.error(`Error hydrating page \"${page.id}\":`, error);\n return page;\n }\n}\n\n/**\n * Pagination metadata passed from hydration to grid blocks.\n */\ninterface PaginationMeta {\n currentPage: number;\n totalPages: number;\n paginationBaseUrl: string;\n}\n\n/**\n * Builds a pagination base URL from the page slug and current filter params.\n * Preserves search/category so pagination links keep the active filters.\n * Uses /site/p/ prefix to match the consumer route pattern (same as viewAllHref, linkHref).\n */\nfunction buildPaginationBaseUrl(\n page: SitePage,\n fetchParams?: ContentListParams,\n): string {\n // Always paginate on the blog listing page — home page widget points to blog page\n const slug = page.slug && page.slug !== \"home\" ? page.slug : \"blog\";\n const basePath = `/site/p/${slug}`;\n\n const params = new URLSearchParams();\n const filter = fetchParams?.filter as Record<string, string> | undefined;\n if (filter?.search) params.set(\"busca\", filter.search);\n if (filter?.category) params.set(\"categoria\", filter.category);\n\n return params.toString() ? `${basePath}?${params.toString()}` : basePath;\n}\n\n/**\n * Hydrates a list-mode page: fetches items and populates grid blocks.\n */\nasync function hydrateListPage(\n page: SitePage,\n provider: ContentProvider,\n fetchParams?: ContentListParams,\n): Promise<SitePage> {\n const params: ContentListParams = {\n limit: 12,\n ...page.dataSource?.defaultParams,\n ...fetchParams,\n };\n\n const result = await provider.fetchList(params);\n\n // Convert items to block props (empty array if no results — shows empty state, never mock data)\n const cardProps = (result.items || []).map((item) => provider.toBlockProps(item));\n\n // Build pagination metadata (only when there are multiple pages)\n // _noPagination flag suppresses pagination for synthetic dataSource (e.g., home page blog widget)\n const noPagination = !!(page.dataSource?.defaultParams as Record<string, unknown> | undefined)?._noPagination;\n const totalPages = Math.ceil((result.total || 0) / (result.limit || params.limit || 12));\n const pagination: PaginationMeta | undefined = !noPagination && totalPages > 1\n ? {\n currentPage: result.page || 1,\n totalPages,\n paginationBaseUrl: buildPaginationBaseUrl(page, fetchParams),\n }\n : undefined;\n\n // Hydrate all grid blocks and category filters on the page\n const hydratedStructure = page.structure.map((block) => {\n let hydrated = hydrateGridBlock(block, cardProps, pagination);\n hydrated = hydrateCategoryFilterBlock(hydrated, cardProps);\n return hydrated;\n });\n\n return {\n ...page,\n structure: hydratedStructure,\n };\n}\n\n/**\n * Hydrates grid blocks (blogPostGrid, etc.) with card data and pagination.\n */\nfunction hydrateGridBlock(\n block: Block,\n cardProps: Record<string, unknown>[],\n pagination?: PaginationMeta,\n): Block {\n // Direct match: blogPostGrid gets cards + pagination populated\n if (block.type === \"blogPostGrid\") {\n return {\n ...block,\n props: {\n ...block.props,\n cards: cardProps,\n ...(pagination ? {\n currentPage: pagination.currentPage,\n totalPages: pagination.totalPages,\n paginationBaseUrl: pagination.paginationBaseUrl,\n } : {}),\n },\n };\n }\n\n // Recurse into children for nested structures\n const props = block.props as Record<string, unknown>;\n if (props.children && Array.isArray(props.children)) {\n return {\n ...block,\n props: {\n ...props,\n children: (props.children as Block[]).map((child) =>\n hydrateGridBlock(child, cardProps, pagination),\n ),\n },\n };\n }\n\n return block;\n}\n\n/**\n * Hydrates a single-mode page: fetches one item and populates detail blocks.\n */\nasync function hydrateSinglePage(\n page: SitePage,\n provider: ContentProvider,\n idOrSlug: string,\n): Promise<SitePage> {\n const item = await provider.fetchById(idOrSlug);\n\n if (!item) {\n logger.warn(`Content item \"${idOrSlug}\" not found. Using static props.`);\n return page;\n }\n\n const blockProps = provider.toBlockProps(item);\n\n // Hydrate all detail blocks on the page\n const hydratedStructure = page.structure.map((block) =>\n hydrateDetailBlock(block, blockProps, item),\n );\n\n // Extract SEO from content item and set on page\n const seo = extractSeoFromContent(item, blockProps);\n\n return {\n ...page,\n structure: hydratedStructure,\n ...(seo ? { seo } : {}),\n };\n}\n\n/**\n * Hydrates detail blocks (blogPostDetail, etc.) with item data.\n */\nfunction hydrateDetailBlock(\n block: Block,\n blockProps: Record<string, unknown>,\n item: ContentItem,\n): Block {\n if (block.type === \"blogPostDetail\") {\n return {\n ...block,\n props: {\n ...block.props,\n ...blockProps,\n // Preserve metadata\n _contentItemId: item.id,\n _contentItemSlug: item.slug,\n },\n };\n }\n\n // Also hydrate blogPostCard blocks that reference the same item\n if (block.type === \"blogPostCard\") {\n return {\n ...block,\n props: {\n ...block.props,\n ...blockProps,\n },\n };\n }\n\n // Recurse into children\n const props = block.props as Record<string, unknown>;\n if (props.children && Array.isArray(props.children)) {\n return {\n ...block,\n props: {\n ...props,\n children: (props.children as Block[]).map((child) =>\n hydrateDetailBlock(child, blockProps, item),\n ),\n },\n };\n }\n\n return block;\n}\n\n/**\n * Extracts SEO configuration from a ContentItem and block props.\n * Priority: item.metadata.seo > blockProps (metaTitle/title, metaDescription/excerpt, ogImage/featuredImage)\n */\nfunction extractSeoFromContent(\n item: ContentItem,\n blockProps: Record<string, unknown>,\n): PageSeoConfig | undefined {\n const seoMeta = item.metadata?.seo;\n\n const metaTitle = seoMeta?.metaTitle || (blockProps.metaTitle as string) || (blockProps.title as string);\n const metaDescription = seoMeta?.metaDescription || (blockProps.metaDescription as string) || (blockProps.excerpt as string);\n const ogImage = seoMeta?.ogImage || (blockProps.ogImage as string) || (blockProps.featuredImage as string);\n\n if (!metaTitle && !metaDescription && !ogImage) {\n return undefined;\n }\n\n return {\n metaTitle,\n metaDescription,\n ogImage,\n ogType: \"article\",\n };\n}\n\n/**\n * Hydrates blogCategoryFilter blocks with category data extracted from posts.\n */\nfunction hydrateCategoryFilterBlock(\n block: Block,\n cardProps: Record<string, unknown>[],\n): Block {\n if (block.type === \"blogCategoryFilter\") {\n // Extract unique categories from posts with counts\n const categoryMap = new Map<string, number>();\n for (const card of cardProps) {\n const cat = card.category as string;\n if (cat) {\n categoryMap.set(cat, (categoryMap.get(cat) || 0) + 1);\n }\n }\n\n const categories = Array.from(categoryMap.entries()).map(([name, count]) => ({\n name,\n slug: name,\n count,\n }));\n\n return {\n ...block,\n props: {\n ...block.props,\n categories,\n },\n };\n }\n\n // Recurse into children\n const props = block.props as Record<string, unknown>;\n if (props.children && Array.isArray(props.children)) {\n return {\n ...block,\n props: {\n ...props,\n children: (props.children as Block[]).map((child) =>\n hydrateCategoryFilterBlock(child, cardProps),\n ),\n },\n };\n }\n\n return block;\n}\n\n/**\n * Resolves the item ID/slug from URL params using paramMapping.\n * e.g., paramMapping: { slug: \":slug\" }, urlParams: { slug: \"my-post\" } → \"my-post\"\n */\nfunction resolveIdFromParams(\n paramMapping?: Record<string, string>,\n urlParams?: Record<string, string>,\n): string | undefined {\n if (!paramMapping || !urlParams) return undefined;\n\n // Try slug first, then id\n for (const key of [\"slug\", \"id\"]) {\n const paramPattern = paramMapping[key];\n if (paramPattern) {\n // Extract param name from pattern (e.g., \":slug\" → \"slug\")\n const paramName = paramPattern.startsWith(\":\")\n ? paramPattern.slice(1)\n : paramPattern;\n const value = urlParams[paramName];\n if (value) return value;\n }\n }\n\n // Fallback: return first available param value\n for (const paramPattern of Object.values(paramMapping)) {\n const paramName = paramPattern.startsWith(\":\")\n ? paramPattern.slice(1)\n : paramPattern;\n const value = urlParams[paramName];\n if (value) return value;\n }\n\n return undefined;\n}\n"],"names":["hydratePageWithContent","page","providers","urlParams","fetchParams","providerType","mode","paramMapping","provider","logger","hydrateListPage","idOrSlug","resolveIdFromParams","hydrateSinglePage","error","buildPaginationBaseUrl","basePath","params","filter","result","cardProps","item","noPagination","totalPages","pagination","hydratedStructure","block","hydrated","hydrateGridBlock","hydrateCategoryFilterBlock","props","child","blockProps","hydrateDetailBlock","seo","extractSeoFromContent","seoMeta","metaTitle","metaDescription","ogImage","categoryMap","card","cat","categories","name","count","key","paramPattern","paramName","value"],"mappings":";AA0BA,eAAsBA,EACpBC,GACAC,GACAC,GACAC,GACmB;AAEnB,MAAI,CAACH,EAAK;AACR,WAAOA;AAGT,QAAM,EAAE,UAAUI,GAAc,MAAAC,GAAM,cAAAC,EAAA,IAAiBN,EAAK,YACtDO,IAAWN,EAAU,IAAIG,CAAY;AAE3C,MAAI,CAACG;AACH,WAAAC,EAAO;AAAA,MACL,oBAAoBJ,CAAY,yBAAyBJ,EAAK,EAAE;AAAA,IAAA,GAE3DA;AAGT,MAAI;AACF,QAAIK,MAAS;AACX,aAAO,MAAMI,EAAgBT,GAAMO,GAAUJ,CAAW;AAG1D,QAAIE,MAAS,UAAU;AAErB,YAAMK,IAAWC,EAAoBL,GAAcJ,CAAS;AAC5D,aAAKQ,IAME,MAAME,EAAkBZ,GAAMO,GAAUG,CAAQ,KALrDF,EAAO;AAAA,QACL,uCAAuCR,EAAK,EAAE;AAAA,MAAA,GAEzCA;AAAA,IAGX;AAEA,WAAOA;AAAA,EACT,SAASa,GAAO;AACd,WAAAL,EAAO,MAAM,yBAAyBR,EAAK,EAAE,MAAMa,CAAK,GACjDb;AAAA,EACT;AACF;AAgBA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AM;AACpB,SAAII,EAAM,YAAY,MAAM,QAAQA,EAAM,QAAQ,IACzC;AAAA,IACL,GAAGJ;AAAA,IACH,OAAO;AAAA,MACL,GAAGI;AAAA,MACH,UAAWA,EAAM,SAAqB;AAAA,QAAI,CAACC,MACzCF,EAA2BE,GAAOX,CAAS;AAAA,MAAA;AAAA,IAC7C;AAAA,EACF,IAIGM;AACT;AAMA,SAASd,EACPL,GACAJ,GACoB;AACpB,MAAI,GAACI,KAAgB,CAACJ,IAGtB;AAAA,eAAW2C,KAAO,CAAC,QAAQ,IAAI,GAAG;AAChC,YAAMC,IAAexC,EAAauC,CAAG;AACrC,UAAIC,GAAc;AAEhB,cAAMC,IAAYD,EAAa,WAAW,GAAG,IACzCA,EAAa,MAAM,CAAC,IACpBA,GACEE,IAAQ9C,EAAU6C,CAAS;AACjC,YAAIC,EAAO,QAAOA;AAAA,MACpB;AAAA,IACF;AAGA,eAAWF,KAAgB,OAAO,OAAOxC,CAAY,GAAG;AACtD,YAAMyC,IAAYD,EAAa,WAAW,GAAG,IACzCA,EAAa,MAAM,CAAC,IACpBA,GACEE,IAAQ9C,EAAU6C,CAAS;AACjC,UAAIC,EAAO,QAAOA;AAAA,IACpB;AAAA;AAGF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BlogPostGridRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/render/renderers/sections/BlogPostGridRenderer.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,CAAC,SAAS,CA+G9D"}
1
+ {"version":3,"file":"BlogPostGridRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/render/renderers/sections/BlogPostGridRenderer.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AA+B1B,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,CAAC,SAAS,CAyP9D"}