Skip to content

feat(mesh): blog product-block editor + post publication status - #4302

Open
yuriassuncx wants to merge 10 commits into
mainfrom
feat/blog-app-product-string-editor
Open

feat(mesh): blog product-block editor + post publication status#4302
yuriassuncx wants to merge 10 commits into
mainfrom
feat/blog-app-product-string-editor

Conversation

@yuriassuncx

@yuriassuncx yuriassuncx commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Routes blog/sections/blocks/ProductCard and ProductShelf to dedicated editors that persist platform:kind:id string refs (vtex:product:123), aligned with the deco-cms/blog app schema.
  • Keeps the existing loader-ref editor for site/sections/Blog/Post/* blocks (e.g. Elux storefront sections).
  • Prevents Studio mesh saves from rewriting Spire/admin-authored posts into VTEX productList loader-ref shapes.

Context

Complements deco-cx/apps#1603, which keeps string refs as the canonical blog app contract and adds hybrid runtime coercion for loader-ref compat.

Test plan

  • bun test for product-string-blocks.test.ts and blog-data.app-blocks.test.ts
  • Open a Spire post with { product: vtex:product:ID } in mesh — field shows the ref; save keeps string format
  • Open a site section post (site/sections/Blog/Post/ProductCard) — loader-ref editor unchanged

Summary by cubic

Adds a platform‑agnostic string‑ref editor for blog/sections/blocks/ProductCard and ProductShelf, and brings post publication status to the blog editor with live draft previews. Also adds deep‑linking to open the content editor on a specific blog item.

  • New Features

    • Route blog app blocks to AppProductCardBlock and AppProductShelfBlock via isBlogAppBlockResolveType; keep loader‑ref editors for site/sections/Blog/Post/*.
    • Add post status (draft/published/archived/awaiting_review/generating), stored in post.status, with a badge + selector in the editor, a status filter and per‑row badge in the posts list; legacy posts default to published; preview URLs append ?preview=true so drafts render.
    • Support deep‑linking into the content editor via contentCollection/contentItem URL params to preselect a blog collection and open a specific record.
  • Bug Fixes

    • Use DynamicOptionsField for app product refs and thread SandboxConfig from PostEditor/CategoryEditor through BlockDocumentBlockRow → product blocks so the picker works.
    • Fix className composition in post‑status components using cn() to satisfy the new lint rule.

Written for commit f3b5e8e. Summary will update on new commits.

Review in cubic

yuriassuncx and others added 2 commits July 3, 2026 11:28
Route blog/sections/blocks/Product* to editors that persist
platform:kind:id strings so Spire/admin posts are not rewritten to
VTEX loader-ref shapes when saved from the mesh sandbox.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Re-trigger cubic

yuriassuncx and others added 5 commits July 13, 2026 14:57
AppProductCardBlock/AppProductShelfBlock rendered raw text inputs for
the platform:kind:id product ref, bypassing the DynamicOptionsField
picker that the generic SchemaForm already resolves via the app's
@Format dynamic-options / @options annotations (same UX as the admin's
loader-ref editor). Thread SandboxConfig down to the product blocks so
the picker can call the productsByTerm loader.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-string-editor

# Conflicts:
#	apps/mesh/src/web/components/sandbox/content/blog/blocks/block-registry.tsx
Mounts AppProductCardBlock/AppProductShelfBlock in a real browser with the
productsByTerm network call mocked at /deco/invoke/..., asserting the
DynamicOptionsField combobox renders (not a raw text input), resolves
selected refs to their labeled/imaged option, and persists the correct
platform:kind:id string. Regression guard for the picker fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace placeholder fixture data (picsum.photos images, arbitrary names)
with option shapes matching what productResolver.ts#toOption actually
produces per platform: VTEX refs/CDN images/BRL-formatted prices, plus a
Shopify handle ref to prove the picker UI is platform-agnostic. Drop the
screenshot captures — they were only needed to demo the fix, not to guard
against regressions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Publication status (draft/published/archived/…) lives inside the post
payload (post.status), surviving mesh saves. Adds a status selector +
badge in the post editor, an orthogonal status filter and per-row badge
in the posts list, and appends preview=true to the "See preview" URL so
drafts render on the sandbox. Legacy posts with no status are treated as
published.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yuriassuncx yuriassuncx changed the title feat(mesh): string-ref editor for deco-cms/blog product blocks feat(mesh): blog product-block editor + post publication status Jul 14, 2026
yuriassuncx and others added 3 commits July 14, 2026 15:28
ContentBrowser reads ?contentCollection=<blog kind>&contentItem=<blockKey> on
mount to seed the active collection and open a specific record (e.g. a blog
post) directly. Params added to the unified-chat route search schema. Absent
params keep the current behavior (Pages, no selection) — no regression.

Lets the Blog Manager's "Editar no Studio" redirect (spire-agent) land straight
on the post the user clicked.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The main merge brought the require-cn-classname lint rule, which flagged the
two template-literal classNames in PostStatusBadge/PostStatusSelect. Switch
them to cn(...) so the lint check passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant