Skip to content

feat(integrations): add inactive plugin state#4721

Open
chickenn00dle wants to merge 4 commits into
trunkfrom
feat/add-newsletters-inactive-state
Open

feat(integrations): add inactive plugin state#4721
chickenn00dle wants to merge 4 commits into
trunkfrom
feat/add-newsletters-inactive-state

Conversation

@chickenn00dle
Copy link
Copy Markdown
Contributor

@chickenn00dle chickenn00dle commented May 13, 2026

All Submissions:

Changes proposed in this Pull Request:

Surfaces the install/active status of an integration's required plugins on the Audience → Integrations screen so admins can resolve missing dependencies without leaving the page.

  • Adds Integration::get_required_plugins() so integrations can declare the plugins they depend on. The base implementation returns an empty array; ESP overrides it to report newspack-newsletters install/active state via Plugin_Manager::get_managed_plugin_status().
  • Exposes the new required_plugins payload on each integration in the wizard REST response.
  • Updates the integrations card UI so that, when a required plugin is installed but inactive, the primary action becomes "Activate" and triggers a POST /newspack/v1/plugins/{slug}/activate call followed by a refetch. When a required plugin is not installed at all, the card renders a "Requires …" requirements affordance instead.
Screenshot 2026-05-14 at 12 27 49

How to test the changes in this Pull Request:

  1. Check out the branch, build the plugin (n build newspack-plugin), and load Newspack → Audience → Integrations in the admin.
  2. With Newspack Newsletters active: confirm the ESP integration card behaves as before (Enable / Connect / Configure actions, no requirements text).
  3. Deactivate Newspack Newsletters (keep it installed): reload the page and confirm the ESP card now shows an Activate button. Click it and confirm the plugin activates, the page state refreshes, and the card returns to its normal Enable/Connect state.
  4. Uninstall Newspack Newsletters entirely (or rename its directory): reload the page and confirm the ESP card shows a "Requires Newspack Newsletters" requirements label and no Activate action is offered.
  5. Verify the REST response feeding the screen includes a required_plugins array for the ESP integration with slug, name, is_active, and is_installed keys.
  6. Sanity-check other integrations (without overrides) still load with an empty required_plugins array and unchanged UI.

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

Surfaces required plugin status for Audience integrations so admins can see missing/inactive dependencies and activate installed dependencies from the Integrations screen.

Changes:

  • Adds a required_plugins integration API contract and includes it in integration settings responses.
  • Declares Newspack Newsletters as the ESP integration dependency.
  • Updates the integrations card UI to show requirements or an Activate action based on dependency status.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/wizards/audience/views/integrations/settings-section.js Renders plugin requirement labels and Activate actions on integration cards.
src/wizards/audience/views/integrations/index.js Adds plugin activation API handler and refetches settings after activation.
includes/reader-activation/integrations/class-integration.php Adds base get_required_plugins() method.
includes/reader-activation/integrations/class-esp.php Reports Newspack Newsletters install/active status for ESP.
includes/reader-activation/class-integrations.php Exposes required_plugins in the integrations settings payload.

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

Comment thread src/wizards/audience/views/integrations/settings-section.js
Comment thread includes/reader-activation/integrations/class-integration.php Outdated
Comment thread includes/reader-activation/integrations/class-esp.php
Comment thread includes/reader-activation/class-integrations.php
chickenn00dle and others added 2 commits May 14, 2026 12:16
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chickenn00dle chickenn00dle force-pushed the feat/add-newsletters-inactive-state branch from e258e82 to d957f2e Compare May 14, 2026 16:16
chickenn00dle and others added 2 commits May 14, 2026 12:26
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chickenn00dle chickenn00dle marked this pull request as ready for review May 14, 2026 16:31
@chickenn00dle chickenn00dle requested a review from a team as a code owner May 14, 2026 16:31
@chickenn00dle chickenn00dle requested a review from Copilot May 14, 2026 16:31
@chickenn00dle chickenn00dle self-assigned this May 14, 2026
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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread src/wizards/audience/views/integrations/index.js
@chickenn00dle chickenn00dle added the [Status] Needs Review The issue or pull request needs to be reviewed label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Review The issue or pull request needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants