Skip to content

Move and refactor ai generator integrations#22313

Closed
pls78 wants to merge 24 commits intomove-and-refactor-ai-generator-rest-endpointsfrom
move-and-refactor-ai-generator-integrations
Closed

Move and refactor ai generator integrations#22313
pls78 wants to merge 24 commits intomove-and-refactor-ai-generator-rest-endpointsfrom
move-and-refactor-ai-generator-integrations

Conversation

@pls78
Copy link
Copy Markdown
Member

@pls78 pls78 commented May 27, 2025

Context

  • Move integrations for the AI Generator from Premium to Free.

Summary

This PR can be summarized in the following changelog entry:

  • Moves integrations for the AI Generator from Premium to Free.

Relevant technical choices:

  • N/A

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Make sure you don't have premium installed
  • Smoke test the AI Generator feature

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:

  • N/A

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 #556

@pls78 pls78 added this to the feature/ai-generator-in-free milestone May 27, 2025
@pls78 pls78 added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label May 27, 2025
@pls78 pls78 changed the base branch from trunk to feature/ai-generator-in-free May 27, 2025 20:59
@pls78 pls78 changed the base branch from feature/ai-generator-in-free to move-and-refactor-ai-generator-rest-endpoints May 27, 2025 20:59
@pls78 pls78 mentioned this pull request May 27, 2025
18 tasks
Copy link
Copy Markdown
Member

@diedexx diedexx left a comment

Choose a reason for hiding this comment

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

Nice work!
Only some non-blocking comments

Comment thread packages/js/src/ai-consent/components/revoke-consent.js Outdated
*/
public function get_script_data(): array {
return [
'hasConsent' => $this->user_helper->get_meta( $this->user_helper->get_current_user_id(), '_yoast_wpseo_ai_consent', true ),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: It'd be nice if this was delegated to /application. Ideally the UI layer doesn't know about where things are stored.
The way I see it:

  • ui/ConsentIntegration
    • private app/ConsentQueryHandler
  • app/ConsentQueryHandler
    • private app/ports/ConsentRepositoryInterface
  • app/ports/ConsentRepositoryInterface
    • public get()
    • public set()
    • public delete()
  • infra/(UserMeta)ConsentRepository implements ConsentRepositoryInterface
    • private UserHelper

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to extract the UserMeta out of the solution since that is very WordPress. And relying on the Application layer to get a repository that in this case happens to be a UserMeta repo since that is what WP uses 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure if we want to use the QueryHandler naming and things since we don't really do that a lot in the plugin. But this might be a nice time to start? 🤔 Might be good to do a little refresh on CQRS to know when to do a Command and when to do a Query

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah that doesn't matter too much. This is how we'd do it in the Platform team, but let's keep things consistent in each project 😄 As long as there's a way to get consent information from the app layer I'm more than happy

* @return void
*/
public function register_hooks() {
if ( ! $this->options_helper->get( 'enable_ai_generator', false ) ) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't this covered by the AI_Conditional?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes! I forgot to remove this test! 😅

Co-authored-by: Diede Exterkate <5352634+diedexx@users.noreply.github.com>
@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.

@pls78
Copy link
Copy Markdown
Member Author

pls78 commented May 28, 2025

Close in favor of #22315

@pls78 pls78 closed this May 28, 2025
@pls78 pls78 deleted the move-and-refactor-ai-generator-integrations branch July 7, 2025 10:06
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.

5 participants