Skip to content

Ask for consent before using the Content Planner feature#23171

Merged
vraja-pro merged 18 commits intofeature/content-plannerfrom
1136-add-the-consent-modal-before-using-the-first-request-alternative
Apr 20, 2026
Merged

Ask for consent before using the Content Planner feature#23171
vraja-pro merged 18 commits intofeature/content-plannerfrom
1136-add-the-consent-modal-before-using-the-first-request-alternative

Conversation

@leonidasmi
Copy link
Copy Markdown
Contributor

@leonidasmi leonidasmi commented Apr 17, 2026

Context

Summary

This PR can be summarized in the following changelog entry:

  • Asks for consent before users use the Content Planner feature.

Relevant technical choices:

  • Extracted AiGrantConsent as a shared component — The consent flow (reading links/endpoint from stores, dispatching storeAiGeneratorConsent, rendering AiConsent) was duplicated across ai-generator/Introduction and ai-consent/GrantConsent. The new AiGrantConsent component in shared-admin/components/ centralizes this wiring and accepts storeName, linkStoreName, and optional links overrides. Both existing consumers were refactored to delegate to it.
  • Two-modal pattern for the consent gate — Rather than nesting the consent UI inside the feature modal (which would conflict with the existing Modal.Panel layout), the consent form renders in a separate <Modal> sibling. This keeps both modals independently manageable and avoids z-index or focus-trap conflicts.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • User without consent and clicking sidebar: Remove your AI consent (or use a fresh user). Open a new post, click "Get content suggestions" in the Yoast sidebar or metabox.
    • Now the approval modal is displayed, click the "Get content suggestions" button there too
    • Verify the consent modal opens instead of the suggestions flow.
    • Grant consent and verify the consent modal closes and the content suggestions loading state begins as expected.
  • User without consent and clicking inline banner: Remove your AI consent (or use a fresh user). Open a new post, click "Get content suggestions" in the inline banner.
    • Verify the consent modal opens instead of the suggestions flow.
    • Grant consent and verify the consent modal closes and the content suggestions loading state begins as expected.
  • Repeat the tests with Premium disabled, when appropriate

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • Regression test user with consent: As a user who has already granted consent, click "Get content suggestions" either from the sidebar or the inline banner.
    • Verify the suggestions flow starts immediately without showing the consent modal.
  • Consent modal dismissal: Open the consent modal (no prior consent), then close it via the close button or Escape.
    • Verify that the consent modal closes
  • Regression test: AI Generator consent flow still works: Open the AI title/description generator (not the content planner). Verify the consent modal still appears for users without consent and that granting consent works as
    before.
    • Check that the links are the same with the production version
    • Check that granting consent then moves the user to the AI Generator flow as expected
    • Check the same in all supported editors
  • Regression test: AI Fix Assessments consent flow still works: Trigger the AI fix assessments consent flow. Verify it still functions correctly with the refactored GrantConsent component.
    • Check that the links are the same with the production version
    • Check that granting consent then moves the user to the AI Fix Assessments flow as expected
    • Check the same in all supported editors
  • Regression test: AI Summarize consent flow still works: Trigger the AI Summarize consent flow. Verify it still functions correctly with the refactored GrantConsent component.
    • Check that the links are the same with the production version
    • Check that granting consent then moves the user to the AI Summarize flow as expected
    • Check the same in all supported editors
  • Regression test: Grant/Revoke consent from the user profile: Go to Users->Profile and grant/revoke consent. Go the editor and verify that you can use (or not use, in case you revoked) the AI features
    • Check that the links are the same with the production version
  • Repeat regression tests with Premium disabled, when appropriate

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.
  • This PR also affects Yoast SEO for Google Docs. I have added a changelog entry starting with [yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached the Google Docs Add-on label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.
  • I have run grunt build:images and commited the results, if my PR introduces new images or SVGs.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@leonidasmi leonidasmi added this to the feature/content-planner milestone Apr 17, 2026
@leonidasmi leonidasmi added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Apr 17, 2026
…oints-' into 1136-add-the-consent-modal-before-using-the-first-request-alternative
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 17, 2026

Coverage Report for CI Build 9779

Coverage increased (+0.02%) to 53.558%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 12 uncovered changes across 4 files (18 of 30 lines covered, 60.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
packages/js/src/ai-content-planner/blocks/banner-block.js 6 0 0.0%
packages/js/src/ai-consent/components/grant-consent.js 4 0 0.0%
packages/js/src/ai-content-planner/containers/feature-modal.js 1 0 0.0%
packages/js/src/ai-generator/components/introduction.js 2 1 50.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 65918
Covered Lines: 35148
Line Coverage: 53.32%
Relevant Branches: 16856
Covered Branches: 9184
Branch Coverage: 54.49%
Branches in Coverage %: Yes
Coverage Strength: 45634.09 hits per line

💛 - Coveralls

@leonidasmi leonidasmi changed the title Rebuild branch from scratch to avoid conflicts Ask for consent before using the Content Planner feature Apr 17, 2026
Base automatically changed from 1142-connect-content-planner-frontend-with-backend-endpoints- to feature/content-planner April 17, 2026 09:50
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 introduces an AI consent gate before users can start the Content Planner “Get content suggestions” flow, and refactors duplicated consent wiring into a shared component.

Changes:

  • Add a new FEATURE_MODAL_STATUS.consent state and route Content Planner entry points to it when the user hasn’t granted AI consent.
  • Introduce AiGrantConsent as a shared, store-connected wrapper around AiConsent, and refactor existing consent consumers to use it.
  • Extend/adjust tests to cover the “no consent → open consent flow” behavior in the Content Planner feature modal.

Reviewed changes

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

Show a summary per file
File Description
packages/js/tests/ai-content-planner/components/feature-modal.test.js Updates tests to reflect consent gating before fetching suggestions.
packages/js/src/shared-admin/components/index.js Exports the new shared AiGrantConsent component.
packages/js/src/shared-admin/components/ai-grant-consent.js Adds the new shared consent wiring component (selectors + dispatch + links).
packages/js/src/ai-generator/components/introduction.js Refactors AI generator introduction consent UI to use AiGrantConsent.
packages/js/src/ai-content-planner/containers/feature-modal.js Wires hasConsent from the AI store into the Content Planner feature modal.
packages/js/src/ai-content-planner/constants.js Adds consent to the feature modal status enum.
packages/js/src/ai-content-planner/components/feature-modal.js Implements a two-modal consent gate before starting suggestions.
packages/js/src/ai-content-planner/blocks/banner-block.js Adds consent gating when launching the modal via the inline banner.
packages/js/src/ai-consent/components/grant-consent.js Refactors AI consent “GrantConsent” to use AiGrantConsent with overridden links.

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

Comment thread packages/js/src/shared-admin/components/ai-grant-consent.js
Comment thread packages/js/src/shared-admin/components/ai-grant-consent.js Outdated
Comment thread packages/js/src/shared-admin/components/ai-grant-consent.js Outdated
Comment on lines +234 to +237
<AiGrantConsent
storeName="yoast-seo/ai-generator"
linkStoreName="yoast-seo/editor"
onConsentGranted={ fetchContentSuggestions }
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

storeName/linkStoreName are passed as string literals here, but the same values already exist as constants (STORE_NAME_AI, STORE_NAME_EDITOR in packages/js/src/ai-generator/constants/index.js). Importing and reusing those constants avoids drift/typos if store names ever change.

Copilot uses AI. Check for mistakes.
Comment thread packages/js/src/ai-content-planner/blocks/banner-block.js
Comment thread packages/js/src/shared-admin/components/ai-grant-consent.js Outdated
Comment thread packages/js/src/ai-content-planner/components/feature-modal.js Outdated
Copy link
Copy Markdown
Contributor

@vraja-pro vraja-pro left a comment

Choose a reason for hiding this comment

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

CR & AC 🚧
Few comments about the code.
While doing the acceptance I see that we loose the transition between content suggestions to content outline and also after applying the outline I see the content outline modal again.

Comment thread packages/js/src/ai-content-planner/components/feature-modal.js
@github-actions
Copy link
Copy Markdown

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

…36-add-the-consent-modal-before-using-the-first-request-alternative
@vraja-pro vraja-pro force-pushed the 1136-add-the-consent-modal-before-using-the-first-request-alternative branch from 00fd894 to 9a318b3 Compare April 20, 2026 12:53
Copy link
Copy Markdown
Contributor

@vraja-pro vraja-pro left a comment

Choose a reason for hiding this comment

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

CR & AC ✅

@vraja-pro vraja-pro merged commit 6e8bd95 into feature/content-planner Apr 20, 2026
24 of 36 checks passed
@vraja-pro vraja-pro deleted the 1136-add-the-consent-modal-before-using-the-first-request-alternative branch April 20, 2026 13:04
@vraja-pro vraja-pro mentioned this pull request Apr 28, 2026
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants