Skip to content

feat(cms): mark a page published once its Wix post is live, read when the Library opens and daily (#1331) - #1750

Merged
gkhngyk merged 84 commits into
ansvisor:mainfrom
cihan-gyk:feature/cms-wix-published
Oct 29, 2026
Merged

gkhngyk merged 84 commits into
ansvisor:mainfrom
cihan-gyk:feature/cms-wix-published

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Send to CMS, Wix (phase 2): mark a page published once its Wix post is live. The page is read when the Library opens and every day, as WordPress's and Framer's are.

Stacked on #1749 (Wix web, on #1721). Review the commits after its head; merge after #1749.

Wix calls nothing back when a post goes live, so Ansvisor reads the posts its sends made (lib/cms/wix-status.js):

  • For each page, the latest send to the connected site (60 days back) is read: its draft post, with the key.
  • PUBLISHED with no unpublished changes left marks the page published at the post's address. An address without a scheme is completed.
  • A live post whose draft holds the send's changes waits for the person to publish them.
  • A post deleted or gone closes its send ("Removed in Wix").
  • A refused key stops the check and marks the connection.
  • Daily for brands on an active plan, shuffled, under a deadline. server.js runs it beside WordPress's.
  • POST /api/content-drafts/wix-status: any member, a brand at most every two minutes; the Library calls it when it opens. On a read-only workspace the Library skips it.

Related issue

#1331 (Send to CMS).

Type of change

  • feat — New feature

How to test

  1. Send a page to Wix, then publish the post in Wix. Open the Library: the page shows as published at the post's address.
  2. Edit the post's draft in Wix without publishing: the page waits.
  3. Delete the post in Wix: the send shows "Removed in Wix".

Checklist

🤖 Generated with Claude Code

cihan-gyk and others added 30 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]>
Node 20 is end of life since 2026-04-30, and Framer's official Server API
package (framer-api, for Send to CMS ansvisor#1331) needs Node 22 or later for its
global WebSocket. Node 24 is LTS until April 2028. The Dockerfile, CI's
server job and the server README move to 24; the web job stays on 20.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#1331)

Framer's official Server API (framer-api, needs Node 22+): a brand's
project connects with an API key made in it, sealed as WordPress's
sign-in is. 00295 adds provider 'framer' (site_id = project id) and the
'framer' delivery target, and reserve_content_deliveries keeps one queued
send per page for it too. Routes check the project, list the user's own
collections with their fields, save the collection and field map (title
to text, page to formatted text, required fields refused as for Webflow)
and disconnect (Framer has no API to revoke a key).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ons (ansvisor#1331)

The Framer card connects the brand's project with an API key made in it,
lists the project's own collections with their fields, suggests and saves
which field takes the title, the page, meta and JSON-LD (required fields
it can't fill and missing title or page fields marked), replaces the key,
shows a refused key, and disconnects with a reminder to delete the key in
Framer, which has no API to revoke it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Send dialog (editor, Library row, bulk) offers the brand's Framer
collection beside Webflow, WordPress and the webhook, in a 2x2 grid when
all four are there. Framer is ready with a collection and its title and
page fields; a remembered CMS that isn't ready goes to the webhook. The
toast says made or updated, images left out, and that a non-draft item's
change waits for the site's next publish. The Library marks rows sent to
Framer and asks /framer-status once per brand per visit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… 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]>
… 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 and
WordPress's disconnects do. Framer's disconnect deletes the project's API
key, so it joins the list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd pages to its Blog as draft posts (ansvisor#1331)

Send to CMS, Wix (phase 2), server. After Webflow, WordPress and Framer, a
brand connects its Wix site: the site's id (or its dashboard's address) and
an API key its owner makes in Wix's API Keys Manager with the Wix Blog
permissions. Pages go to the site's Blog as draft posts; nothing publishes.

- 00372: brand_cms_connections and content_draft_deliveries take 'wix'
  (site_id and the posts' owner member in `account`); the key is sealed in
  brand_cms_credentials as WordPress's sign-in is; reserve_content_deliveries
  keeps a page from being sent to Wix twice at once. Applied on the dev DB.
- lib/cms/wix.js: Authorization: <key> with wix-site-id; checkSite (the
  Blog answers, a member owns the posts: its newest post's, else its first
  member; the site's name when the key may read it); the page's HTML
  turned into Wix's rich content by Wix's converter in pieces of 10,000
  characters; draft posts created, read and updated, a live post as its
  draft version (UPDATE_PUBLICATION), never the post people read.
- lib/cms/wix-delivery.js: a page updates the post its last send made on
  that site, else makes one; title, meta description and JSON-LD go as the
  post's SEO tags; images stay out and are counted; a refused key marks the
  connection for a new one.
- routes/cms-wix.js: GET / POST { siteId, apiKey } / DELETE, admins and
  managers to write; the key is never logged or sent back. Disconnecting
  works after a plan ends. content-delivery.js sends target 'wix'.

Real Wix keys are tried by the maintainer; tests run against a fake of the
API (its answers as Wix's reference shows them).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d send pages to it from Send to CMS (ansvisor#1331)

Send to CMS, Wix (phase 2), web. The API connects a brand's Wix site and
sends pages to its Blog as draft posts (PR 1); here a person does it.

- lib/wix-client.ts: the connection read, connected with { siteId, apiKey }
  and disconnected through the API's proxy; the key goes to the API once.
- Settings › Integrations › Wix (wix-card.tsx): admins and managers paste
  the site's id (or its dashboard's address) and an API key, change the key
  and disconnect (the key is deleted here; the card says to delete it in
  Wix's API Keys Manager too); members see where pages go. A refused key
  asks to connect again.
- Send to CMS: Wix is a target beside Webflow, WordPress and Framer, in the
  editor's dialog and the Library's bulk send (five cards go three in a
  row); "A draft post on {site}'s Blog"; the toast says how many images
  stayed out; Wix's errors in our words; the Library's mark says "In Wix
  as a draft post".

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

Send to CMS, Wix (phase 2), the published check, as WordPress's and
Framer's. Wix calls nothing back when a post goes live, so Ansvisor reads
the posts its sends made.

- lib/cms/wix-status.js: each page's latest send to the connected site
  (60 days back), its draft post read with the key: PUBLISHED with no
  changes left unpublished marks the page published at the post's address;
  a live post whose draft version holds the send's changes waits for the
  person to publish them; a post deleted or gone closes its send; a key
  refused stops the check and marks the connection. Daily for brands on an
  active plan, shuffled, under a deadline.
- wix.js reads hasUnpublishedChanges as `pending`.
- POST /api/content-drafts/wix-status: any member, a brand at most every
  two minutes; server.js runs the daily sweep beside WordPress's.
- Web: the Library asks once per brand per visit when a page sits in Wix
  as a draft post, and reads the list again when any went live.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk and others added 17 commits October 28, 2026 20:20
Main now has Framer's send (ansvisor#1576) and published check (ansvisor#1579): Wix is
added beside Framer as a delivery target in content-delivery.js (its
connection, the NATIVE entry, the codes) and in its tests.
Main now has Framer's published check (ansvisor#1579): Wix's /wix-status route,
its daily sweep and their route tests sit beside Framer's.
…is read-only

Connect and Change API key open it before anything is sent, and a
connect or disconnect the API refuses for the plan opens it instead of
an error. Disconnect stays open, as WordPress's, Framer's and Webflow's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 29, 2026
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged main forward through #1749's updated branch (no conflicts of its own; it carries #1749's resolution, where lastSend now lives in main's lib/content/cms-status.ts and reads wix targets). Typecheck passes, as do this PR's own tests (wix-status, wix, content-drafts-send, the Library page, cms-send-client); server lint clean.

@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 follow-ups

At merge time: /wix-status uses cmsStatusLimiter (main's #1783 removed cmsLimiter from that file, so the old import would have stopped the route file from loading), the Wix card's read has the same time limit as the other integration cards, the Send hint names Wix, /wix-status is under the demo guard, and the daily Wix sweep leaves demo brands out like Webflow's. Each has a test.

Reviewed this PR's own change (#1749's head 581a304 → 6cf1953), read as merged on main 3b7611c. On its own it conflicts with main in supabase/schema.sql and web/src/lib/content/cms-send-client.ts, the same two files as #1721 and #1749. take-1750 (809d6cb3) is this head with take-1749 merged in. It carries #1749's fix, which is needed here: without it, the Library never sees a send as a Wix one and never runs this check. take-1750 merges on main with no conflicts.

What I checked

  • What's read. Only the connected site's sends (target_collection = site_id), with status sent, an external_id, and less than 60 days old. Only each page's latest send counts. The Library reads 10, the daily run 100 a brand. Each read is a GET to the fixed Wix API host with a GUID-checked post id, using the brand's own key.
  • What's marked. A post marked PUBLISHED with no unpublished changes left is marked published at its address. An address that comes without a scheme gets https://, and anything that isn't a web address is skipped. A live post whose draft still holds the send waits. A post deleted or gone closes the send as "Removed in Wix", and only while it is still sent.
  • Failures. A refused key stops the check and marks only the connection as it was read. Three failed reads in a row stop a brand. Logs carry the error's name and code only.
  • The route. POST /api/content-drafts/wix-status is for any member of the brand (assertBrandAccess), runs at most once every two minutes per brand, and sits behind cmsLimiter. On a read-only workspace the 402 middleware refuses it and the Library doesn't call it, as with WordPress's and Framer's.
  • The daily run. It runs beside WordPress's and Framer's in runDailyTracking, on connected brands of active plans only, shuffled, with at most 1,000 connections and a 10-minute deadline. One brand's failure is logged and the run goes on.
  • Embeds: brand_cms_connections → brands!inner(organizations!inner(subscription_status)) in sweepWixPublished. There is one FK each way (brand_cms_connections.brand_id, brands.organization_id), the same embed the Webflow, WordPress and Framer runs already use on prod. No hint is needed.
  • Tests: full server suite on take-1750: 298 files, 4,164 passed. One known timing test (content-people) failed under load and passes alone. The web tests listed on #1749, including the Library's page.test.tsx, pass. eslint and prettier are clean.

Before merging

  • After #1749. Deploy the API before the web; with the web first, the Library's call answers 404 and is ignored.

Follow-ups

  1. The daily run checks its deadline only between brands. A brand with 100 sends can take a while when Wix is slow, because each read may wait 30 s and a GET is retried. Checking the deadline between posts as well would keep the run inside its 10 minutes. The WordPress run has the same follow-up.
  2. wixChecked (like the Webflow, WordPress and Framer maps beside it) keeps every brand id it has seen until the API restarts. It's small, but a sweep of old entries would bound it.

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