Skip to content

feat(reader-activation): replace RAS auto-enable with manual toggle#4754

Draft
miguelpeixe wants to merge 9 commits into
trunkfrom
nppd-1066-allow-ras-to-be-active-with-less-requisites
Draft

feat(reader-activation): replace RAS auto-enable with manual toggle#4754
miguelpeixe wants to merge 9 commits into
trunkfrom
nppd-1066-allow-ras-to-be-active-with-less-requisites

Conversation

@miguelpeixe
Copy link
Copy Markdown
Member

@miguelpeixe miguelpeixe commented May 25, 2026

All Submissions:

Changes proposed in this Pull Request:

Closes NPPD-1066.

Replaces the automatic enabling of Audience Management (RAS) with an explicit, unconditional admin toggle on the Audience → Setup tab, and removes the assumptions that previously coupled RAS to a fully-configured plugin stack (Newspack Newsletters, WooCommerce, Newspack Campaigns). An administrator can now enable RAS at any time regardless of which optional plugins are installed.

Enablement

  • An enable/disable ActionCard toggle is added above the prerequisites checklist. It writes through the existing audience-management settings endpoint — no new endpoint.
  • Prerequisites become a purely informational checklist. The "Skip" buttons and the "Waiting for all settings to be ready" disabled-action state are removed.
  • The skip subsystem is removed entirely: Reader_Activation::skip() / is_skipped() / is_ras_ready_to_configure(), the /audience-management/skip REST route, the SKIP_CAMPAIGN_SETUP_OPTION constant, and the is_skipped_campaign_setup localized field are gone.
  • The Audience Management Campaign step (/campaign and /complete) is preserved as an optional path reachable from the campaign checklist item. Publishing the campaign no longer flips the enabled flag.

Plugin independence

  • "Required plugins" become "recommended plugins": the prerequisites checklist now renders alongside the PluginInstaller instead of being hidden behind it, and the notice text reflects the new reality.
  • The Setup tab's advanced section gates the Newsletters-dependent controls ("Present newsletter signup after checkout and registration" and the ESP Advanced Settings block) on Newspack Newsletters being installed; the OAuth and Save controls stay generic.
  • Reader_Activation::setup_nav_menu() no longer requires WooCommerce: the Sign In link now renders for anonymous visitors without WC; signed-in users still need WC for the "My Account" destination (graceful no-op when absent).
  • The Audience → Donations submenu hides itself when neither WooCommerce is installed nor NRH is the configured donations platform.

Migration

  • No upgrade migration: sites already enabled keep enabled = true. A fully-configured site that has not yet revisited the Audience wizard since the last prerequisite was added would need one manual toggle click. The newspack_reader_activation_*_skipped options are left in the database, intentionally unread.

How to test the changes in this Pull Request:

  1. On a site with RAS disabled and no optional plugins installed (no Newspack Newsletters, no WooCommerce, no Newspack Campaigns), open Audience → Setup. Confirm the "Enable Audience Management" toggle appears above the prerequisites checklist.
  2. Toggle it on. Confirm the description switches to "enabled", the toggle persists across a page reload, and the advanced settings section appears with only the OAuth toggle and Save Settings button (no newsletter / ESP cards).
  3. Toggle it off. Confirm the description switches to "disabled" and the toggle persists across a page reload.
  4. Confirm the prerequisites checklist renders every item with Pending / Ready status and inline config forms, even when Newsletters / WooCommerce / Campaigns are missing. The PluginInstaller shows alongside the checklist; the warning text reads "recommended for full Audience Management functionality" rather than "required".
  5. Confirm no "Skip" buttons appear anywhere on the page.
  6. On the front-end (with WooCommerce not installed and RAS enabled), confirm the Sign In link appears for anonymous visitors in the menu location named in account_link_menu_locations (default tertiary-menu).
  7. In wp-admin, confirm the Audience → Donations submenu is hidden when WooCommerce is not installed and the donations platform is the default WooCommerce. Install WooCommerce and confirm the submenu reappears.
  8. Configure the Legal Pages and Transactional Emails inline from the checklist. Confirm the items move from Pending to Ready without any other side effect (the enabled state is not auto-flipped).
  9. From the ras_campaign checklist item, click into the campaign flow (#/campaign#/complete). Confirm publishing the campaign does not change the toggle state.
  10. On a site with RAS already enabled and all plugins present, confirm there is no visual or functional regression in the wizard, the reader auth flow, or any RAS-dependent feature.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes the Audience → Setup flow for Reader Activation (RAS) so enablement is no longer automatically inferred from prerequisites; instead, admins explicitly enable/disable Audience Management via a manual toggle, while prerequisites become informational and “skip” functionality is removed.

Changes:

  • Adds an explicit “Enable Audience Management” toggle in the Setup UI and removes skip/auto-enable wiring.
  • Simplifies prerequisites checklist behavior (no skip states; always renders checklist items) and adjusts campaign publish flow copy/actions.
  • Removes skip REST endpoint and related PHP helpers/options; makes menu behavior less dependent on WooCommerce.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit-tests/reader-activation.php Adds unit coverage ensuring skip-related keys/methods are removed.
src/wizards/audience/views/setup/setup.js Introduces manual enable toggle and updates prerequisite rendering / newsletter gating.
src/wizards/audience/views/setup/index.js Removes skip action plumbing from the wizard container.
src/wizards/audience/views/setup/complete.js Updates campaign completion step UI and removes skip-activation behavior.
src/wizards/audience/views/setup/campaign.js Removes “Skip” button/navigation dependencies from campaign step.
src/wizards/audience/types/index.d.ts Updates TS types to drop skip-related prerequisite props/fields.
src/wizards/audience/components/prerequisite.tsx Removes skip UI and simplifies prerequisite validity/status handling.
includes/wizards/audience/class-audience-wizard.php Removes skip endpoint/localized data; adjusts activation endpoint behavior.
includes/wizards/audience/class-audience-donations.php Hides Donations submenu when neither WooCommerce nor NRH platform is available.
includes/reader-activation/class-reader-activation.php Removes skip/auto-enable helpers and cleans prerequisite status payload; loosens nav menu WC dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/wizards/audience/class-audience-wizard.php
Comment thread src/wizards/audience/components/prerequisite.tsx Outdated
Comment thread src/wizards/audience/views/setup/complete.js
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