feat(pages): add reusable page block editor and renderer baseline

This commit is contained in:
2026-02-12 22:38:00 +01:00
parent d016650463
commit 6e9c0ad4e5
8 changed files with 576 additions and 44 deletions

View File

@@ -6,6 +6,8 @@ import {
createCustomerInputSchema,
createNavigationMenuInputSchema,
createPageInputSchema,
parsePageBlocks,
serializePageBlocks,
updateCommissionStatusInputSchema,
updateNavigationItemInputSchema,
} from "./index"
@@ -64,4 +66,23 @@ describe("domain schemas", () => {
expect(menu.success).toBe(true)
expect(navUpdate.success).toBe(false)
})
it("parses and serializes page blocks with legacy fallback", () => {
const legacy = parsePageBlocks("Legacy body")
expect(legacy[0]?.type).toBe("rich_text")
const serialized = serializePageBlocks([
{
id: "hero-1",
type: "hero",
heading: "Hello",
subheading: null,
ctaLabel: null,
ctaHref: null,
},
])
const parsed = parsePageBlocks(serialized)
expect(parsed[0]?.type).toBe("hero")
})
})