Ask for consent before using the Content Planner feature#23171
Conversation
…oints-' into 1136-add-the-consent-modal-before-using-the-first-request-alternative
Coverage Report for CI Build 9779Coverage increased (+0.02%) to 53.558%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
There was a problem hiding this comment.
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.consentstate and route Content Planner entry points to it when the user hasn’t granted AI consent. - Introduce
AiGrantConsentas a shared, store-connected wrapper aroundAiConsent, 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.
| <AiGrantConsent | ||
| storeName="yoast-seo/ai-generator" | ||
| linkStoreName="yoast-seo/editor" | ||
| onConsentGranted={ fetchContentSuggestions } |
There was a problem hiding this comment.
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.
vraja-pro
left a comment
There was a problem hiding this comment.
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.
|
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
00fd894 to
9a318b3
Compare
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
AiGrantConsentas a shared component — The consent flow (reading links/endpoint from stores, dispatchingstoreAiGeneratorConsent, renderingAiConsent) was duplicated acrossai-generator/Introductionandai-consent/GrantConsent. The newAiGrantConsentcomponent inshared-admin/components/centralizes this wiring and acceptsstoreName,linkStoreName, and optionallinksoverrides. Both existing consumers were refactored to delegate to it.Modal.Panellayout), 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:
Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
before.
GrantConsentcomponent.GrantConsentcomponent.Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation
Quality assurance
grunt build:imagesand commited the results, if my PR introduces new images or SVGs.Innovation
innovationlabel.Fixes #