Skip to content

feat(newsletters): bundled-mode parity for subscription-list modal (NEWS-2152, NEWS-2168)#4707

Draft
thomasguillot wants to merge 5 commits into
trunkfrom
news-2152-bundled-mode-modal-parity
Draft

feat(newsletters): bundled-mode parity for subscription-list modal (NEWS-2152, NEWS-2168)#4707
thomasguillot wants to merge 5 commits into
trunkfrom
news-2152-bundled-mode-modal-parity

Conversation

@thomasguillot
Copy link
Copy Markdown
Contributor

@thomasguillot thomasguillot commented May 7, 2026

Companion to Automattic/newspack-newsletters#2108 (NEWS-2152) and Automattic/newspack-newsletters#2110 (NEWS-2168).

Wires the Newsletters wizard's <SubscriptionLists> per-row Edit / Delete buttons and Add New click to the documented wizard-bridge events from newspack-newsletters. Listener reloads the lists on save / delete. 500 ms fallback timer routes to the legacy CPT editor URL when the bridge bundle is missing (e.g. older newspack-newsletters build without the bridge).

NEWS-2168 stacks the ESP-row side on top: Edit on remote rows opens the same modal in kind='esp' (no audience picker, title + description only), the active toggle commits immediately via the new PATCH /lists/{db_id} route, and the bulk "Save Subscription Lists" button is retired so every interaction commits per-row.

What changed

  • <SubscriptionLists>: per-row Edit / Delete buttons replace the legacy <ExternalLink> for type === 'local' rows; Add New is now a click handler dispatching newspack-newsletters:open-local-list-modal.
  • Edit on remote rows now also goes through the bridge with kind: 'esp' (legacy edit_link survives only as the fallback URL).
  • Inline TextControl / TextareaControl pair on remote rows is gone — the modal owns title + description.
  • Active toggle PATCHes the row immediately; bulk Save button removed.
  • ActionCard description shows the user-supplied list description (with type label on a smaller line below) so publishers can see customisation at a glance.
  • useEffect listens for newspack-newsletters:local-list-saved and :local-list-deleted and re-fetches the lists (event names cover both kinds; payload now carries kind).
  • New Jest tests cover ESP-mode dispatch, immediate-commit toggle, removed bulk Save button, and the no-inline-fields-on-remote-rows invariant alongside the existing local wiring coverage.

Test plan

  • Run paired newspack-newsletters branches (NEWS-2152 already merged into the epic; NEWS-2168 on news-2168-revisit-esp-subscription-list-edit-flow-standalone).
  • Smoke-test Add / Edit / Delete on a Mailchimp + Constant Contact dev site for both local and remote rows.
  • Verify the bottom Save Subscription Lists button is gone and the active toggle on a remote row persists across reloads.
  • Disable newspack-newsletters bundle JS to confirm the fallback timer redirects to the legacy URL on Edit.

Merge order

Merge the newspack-newsletters branches first; this PR follows.

The `bridgeMounted` flag was only set via the one-shot
`newspack-newsletters:bridge-mounted` event listener. If the bridge bundle
booted before this module evaluated, the event was missed and the 500ms
fallback timer redirected to the legacy editor after every modal-open
attempt. Replace the local mutable boolean with a sync read of
`window.newspackNewslettersBridgeReady`, which the bridge now sets before
dispatching the event.

Refs NEWS-2152
…2168)

Stacks the bundled-mode side onto the same wiring as NEWS-2152's
local-list parity. The wizard's SubscriptionLists view dispatches
OPEN_MODAL with kind='esp' for remote rows (replacing the legacy
ExternalLink to the CPT editor) and the active toggle commits
immediately via PATCH /lists/{db_id}.

- Edit on remote rows opens the same modal in ESP mode through the
  wizard-bridge (legacy edit_link still serves as the fallback when
  the bridge isn't ready).
- Inline TextControl/TextareaControl pair removed for remote rows —
  the modal owns title + description.
- Active toggle on every row PATCHes that one row; bulk
  "Save Subscription Lists" button removed.
- Description string surfaced under the bold ActionCard title (with
  the type label kept on a smaller line below) so publishers see what
  customisation is in place without opening the modal.
@thomasguillot thomasguillot changed the title feat(newsletters): bundled-mode parity for local-list modal (NEWS-2152) feat(newsletters): bundled-mode parity for subscription-list modal (NEWS-2152, NEWS-2168) May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant