Skip to content

feat(cms): send pages to WordPress from Send to CMS (#1331) - #1572

Merged
gkhngyk merged 29 commits into
ansvisor:mainfrom
cihan-gyk:feature/cms-wordpress-send
Oct 28, 2026
Merged

gkhngyk merged 29 commits into
ansvisor:mainfrom
cihan-gyk:feature/cms-wordpress-send

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Send to CMS, phase 2 (#1331): WordPress, part 4. The Send dialog now sends to a brand's WordPress site, from the editor, a Library row and the Library's bulk send.

Stacked on #1571, which is stacked on #1570 and #1569. This PR's own change is its last commit, web only.

Where pages go (components/content/cms-target.tsx):

  • useCmsTarget reads the brand's Webflow and WordPress together. A connected WordPress is ready; one whose sign-in was refused shows, off, with what to do.
  • The picker shows the targets the brand has: Webflow, WordPress and the webhook, or two of them.
    • Three cards sit in one row from sm up, and stack below it.
    • The arrow keys go round them, past one that's off.
  • The choice is remembered per brand, in this browser, as for Webflow.
    • Nothing remembered, or the remembered CMS no longer connected: the first ready of Webflow and WordPress.
    • The remembered CMS connected but not ready: the webhook, as before. The page never goes to another CMS than the one picked.
  • A connection that couldn't be read is left out. A person who picked it is told, with Try again, and the page goes to the webhook meanwhile.

The dialog (send-to-cms-dialog.tsx):

  • It says the page goes as a draft post, with its slug and its meta description as the excerpt. The meta title isn't sent; the dialog says to set it in the SEO plugin.
  • The toast:
  • WordPress's refusals have their own messages: not set up, not connected, sign-in refused, a page already on its way.
  • "No webhook" names the CMS to fix only when no CMS is ready. With one ready, the person picked the webhook, and the plain message says to set one up.

The Library:

  • Bulk send. It offers WordPress the same way. Its description says a published or scheduled post gets a new draft, and that the meta title and JSON-LD aren't sent. The bulk send doesn't read back each page's live or jsonLd, so the dialog says it up front.
  • A row sent to WordPress says "In WordPress as a draft post since …".
  • Opening the Library asks /wordpress-status (feat(cms): mark a page published once its WordPress post is put live, read when the Library opens and daily (#1331) #1570) once per brand per visit, when a listed page is in WordPress as a draft. The list is read again when it marked any published, as for Webflow.
    • refreshWebflowPublished and refreshWordPressPublished share one helper in cms-send-client.ts.

Strings are in en.json (contentEditor.editor.send, contentEditor.library.bulk, contentEditor.library.cms.wordpress).

Next: part 5, the docs (send-to-cms.mdx, a WordPress section).

Related issue

Part of #1331 (phase 2, WordPress). Stacked on #1571 → #1570 → #1569.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. cd web && yarn vitest run src/components/content/send-to-cms-dialog.test.tsx "src/app/[locale]/(dashboard)/dashboard/content/library" src/lib/content/cms-send-client.test.ts
  2. With feat(cms): connect a brand's WordPress site with an Application Password and send pages to it as draft posts (#1331) #1569's API (CONNECTOR_CREDENTIALS_KEY set) and a WordPress site connected in Settings › Integrations (a real site: gkhngyk), open a page in the editor and click Send to CMS.
    • WordPress is picked when it's the brand's only CMS. Send makes a draft post with the page's slug and its meta description as the excerpt.
    • Send again: the toast says the draft post was updated.
    • Publish the post in WordPress, then send again: the toast says the page went as a new draft.
    • Open the Library: the row says it's in WordPress as a draft post. Once the post is published, the next visit marks it published.
  3. In the Library, select pages and Send to CMS: WordPress is offered the same way.

Checked in the browser (this branch's API and web, against the dev DB with 00294) at 1024 px, light and dark. The brand had two temporary connection rows, a Webflow one and a WordPress one, removed afterwards. Nothing was sent.

  • The editor's dialog with three cards, nothing remembered: Webflow first. Picking WordPress shows its description.
  • A remembered Webflow, made not ready: Webflow off, the webhook picked, not WordPress.
  • At 600 px the three cards stack.
  • The Library's bulk dialog with WordPress remembered, with its description.

Screenshots follow in a comment.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run: yarn format, yarn lint (0 errors), yarn typecheck, yarn test (4,163 tests) and yarn build in web/. This was after the pre-push review's fixes:

  • a remembered CMS that isn't ready goes to the webhook, not the other CMS;
  • the "no webhook" message;
  • the bulk description;
  • three wordings;
  • the cards stacking below sm.

Each new test for the first two fails with its fix reverted. I checked that by reverting each one.

🤖 Generated with Claude Code

cihan-gyk and others added 7 commits October 27, 2026 10:18
…ord and send pages to it as draft posts (ansvisor#1331)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… read when the Library opens and daily (ansvisor#1331)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ss-server

# Conflicts:
#	server/src/lib/content-delivery.test.js
#	supabase/schema.sql
The Send dialog (editor, Library row, bulk) offers the brand's WordPress
site beside Webflow and the webhook. A remembered CMS that isn't ready
goes to the webhook, never the other CMS. The toast says when a live post
got a new draft and when JSON-LD was left out. The Library marks rows sent
to WordPress and asks /wordpress-status once per brand per visit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk and others added 5 commits October 28, 2026 03:07
… has ended

Since ansvisor#1589 a workspace whose plan has ended can't write, but taking back an
outside account's access stays open (COST_STOPPING), as Webflow's disconnect
does. WordPress's disconnect revokes the Application Password where the site
allows, so it joins the list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged #1571's new head in (49799b3), no conflicts. Not checked on a real site: a product grid (#1607) goes to WordPress with its inline styles, and WordPress's HTML filter may strip some of them for an Author-role user. Checks: typecheck on every web tip, the server suite at #1579 (3,522 tests), and the whole web suite (4,438 tests) and yarn build at #1580.

@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged main forward (8356ba3, incl. menu access) through #1569–#1571; resolved send-to-cms-dialog.tsx with both sides kept. Server lint and web typecheck pass on the chain tip.

@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged main (cfd8a35) through #1571: the read-only "subscription" refusal now opens the plan dialog next to the WordPress target, and the Library's WordPress published read skips while locked.

@gkhngyk gkhngyk 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.

Looks good with 1eb0b4d: your merge of main resolved send-to-cms-dialog.tsx, library/_bulk-send-dialog.tsx and library/page.tsx exactly as I had (a refused send on an ended plan opens the plan dialog and keeps its target; the Library doesn't ask WordPress for published posts while the workspace is read-only). On top of it I merged in #1571's card fix and put back the Library read-only test's WordPress row, which fails without the guard.

What I checked

  • The target choice (useCmsTarget):
    • A remembered CMS that's connected but not ready falls back to the webhook. It never switches to the other CMS.
    • With nothing remembered, the first ready CMS is picked: Webflow, then WordPress.
    • A failed read leaves that CMS out, and says so only to someone who picked it before.
  • The picker shows Webflow and WordPress only when they're connected. The arrow keys skip a card that's off.
  • Toasts say whether the post was made or updated, whether it was live (so a new draft was made), and whether JSON-LD was left out. The Library shows "In WordPress as a draft post", and the published check runs once per brand per visit.
  • Tests on the merged tree: send-to-cms-dialog, cms-send-client, _bulk-send-dialog, the Library page and the editor page (435 passed). Web tsc, eslint and prettier are clean.

Before merging

  • The web goes out on merge. Apply 00294 and deploy the API with #1569/#1570 first. Without them, the Send dialog can't read WordPress and keeps sending to the webhook, and the card says it can't read the connection.

@gkhngyk
gkhngyk merged commit 33fba08 into ansvisor:main Oct 28, 2026
4 of 5 checks passed
@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 28, 2026
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.

2 participants