feat(reader-activation): replace RAS auto-enable with manual toggle#4754
Draft
miguelpeixe wants to merge 9 commits into
Draft
feat(reader-activation): replace RAS auto-enable with manual toggle#4754miguelpeixe wants to merge 9 commits into
miguelpeixe wants to merge 9 commits into
Conversation
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ActionCardtoggle is added above the prerequisites checklist. It writes through the existingaudience-managementsettings endpoint — no new endpoint.Reader_Activation::skip()/is_skipped()/is_ras_ready_to_configure(), the/audience-management/skipREST route, theSKIP_CAMPAIGN_SETUP_OPTIONconstant, and theis_skipped_campaign_setuplocalized field are gone./campaignand/complete) is preserved as an optional path reachable from the campaign checklist item. Publishing the campaign no longer flips the enabled flag.Plugin independence
PluginInstallerinstead of being hidden behind it, and the notice text reflects the new reality.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).Migration
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. Thenewspack_reader_activation_*_skippedoptions are left in the database, intentionally unread.How to test the changes in this Pull Request:
PluginInstallershows alongside the checklist; the warning text reads "recommended for full Audience Management functionality" rather than "required".account_link_menu_locations(defaulttertiary-menu).ras_campaignchecklist item, click into the campaign flow (#/campaign→#/complete). Confirm publishing the campaign does not change the toggle state.Other information: