Skip to content

Restore consent args and refactor upsell#22325

Closed
vraja-pro wants to merge 2 commits intofeature/ai-generator-in-freefrom
fix-consent-and-refactor-upsell-state
Closed

Restore consent args and refactor upsell#22325
vraja-pro wants to merge 2 commits intofeature/ai-generator-in-freefrom
fix-consent-and-refactor-upsell-state

Conversation

@vraja-pro
Copy link
Copy Markdown
Contributor

@vraja-pro vraja-pro commented May 30, 2025

Created an upsell store to reduce prop drilling

fix lint

Context

Summary

This PR can be summarized in the following changelog entry:

  • Fixes consent in editor after a fix was done in the profile page.

Relevant technical choices:

  • Adds upsell section to the yoast-seo/ai-generator store to avoid prop drilling.
  • Dropped the FeatureError from the App since we are not checking the subscriptions. Keeping it in free, though we need to figure out if it's still required.
  • Fixed lint in default props for subscription error.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Edit a post ( on local env, use fake-ai-generator-api-response.patch)
  • Click on "Use AI".
  • Check you see the upsell, click on try for free button.
  • Grant consent.
  • Check you can use the AI generator.
  • Refresh and click on "Use AI".
  • Check you don't see the consent or the upsell.
  • Go to Yoast SEO->Settings->Site features
  • Disable "SEO analysis"
  • Edit a page or post and click on "Use AI"
  • Check you get an error message for the SEO analysis.
  • Go to profile page and look for "AI feature", click on "Revoke consent" and save.
  • Refresh and check it is saved.
  • Grant consent, refresh and check it is saved.
  • Enable SEO analysis and edit a post
  • Click on "Use AI"
  • You should see the AI generator with dummy suggestions from the fake API
  • Check you reached 10 sparks and the upsell notification is visible:
    Screenshot 2025-06-06 at 15 42 35
  • Revoke consent.
  • Edit a WooCommerce product and Click on "Use AI"
  • Check you see an upsell for WOO and premium bundle.
  • Activate Woo SEO and check the upsell button is for Premium.

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.

QA can test this PR by following these steps:

Impact check

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

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

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.

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.

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 #

Created an upsell store to reduce prop drilling

fix lint
@vraja-pro vraja-pro added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label May 30, 2025
@vraja-pro vraja-pro changed the title restore consent args and refactor upsell Restore consent args and refactor upsell May 30, 2025
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 40c5a4bf57c62511bdfc80c88b8acf192dda879f

Details

  • 1 of 14 (7.14%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.008%) to 51.835%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/ai-consent/components/grant-consent.js 0 1 0.0%
packages/js/src/ai-consent/components/revoke-consent.js 0 1 0.0%
packages/js/src/ai-generator/components/app.js 0 1 0.0%
packages/js/src/ai-generator/components/errors/subscription-error.js 0 1 0.0%
packages/js/src/ai-generator/components/upsell-modal-content.js 1 2 50.0%
packages/js/src/ai-generator/store/upsell.js 0 8 0.0%
Totals Coverage Status
Change from base Build f6f2785717466a1641053d2ffddc74e45e4e66ab: -0.008%
Covered Lines: 29748
Relevant Lines: 58587

💛 - Coveralls

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2025

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.

@vraja-pro
Copy link
Copy Markdown
Contributor Author

Closing this PR in because we decided to take a different approach.

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 merge conflict

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants