Skip to content

Implement connect and disconnect endpoints in site kit set up flow#22039

Merged
vraja-pro merged 11 commits intotrunkfrom
435-implement-connect-and-disconnect-endpoints-in-site-kit-set-up-flow
Feb 13, 2025
Merged

Implement connect and disconnect endpoints in site kit set up flow#22039
vraja-pro merged 11 commits intotrunkfrom
435-implement-connect-and-disconnect-endpoints-in-site-kit-set-up-flow

Conversation

@igorschoester
Copy link
Copy Markdown
Contributor

@igorschoester igorschoester commented Feb 13, 2025

Context

Summary

This PR can be summarized in the following changelog entry:

  • Adds the ability to connect/disconnect from Site Kit in the integrations page.
  • Adds the ability grant consent in the Dashboard Site Kit widget.

Relevant technical choices:

  • Added a setter to the data provider, not sure if that is actually how we should go about it, but needed for interactivity
  • As per request from product owner, ignoring any potential errors from granting the request
  • Removed the image link in favor of importing the svg, saves on having to know the full URL of the image and passing that along in both places
  • Having to add the endpoint in both places, a bit strange to have a slightly different usage in the integrations page, but it works? 🤷
  • Took over the image change from Change image foe site kit setup widget #22033 due to it being the same image as for this, just slightly different internals. Making sure we only have 1 image saves on zip size.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Enable the feature flag by adding the code:
define( 'YOAST_SEO_GOOGLE_SITE_KIT_FEATURE', true );
  • Go to Yoast SEO => General
  • Check you see the Site kit widget and check the image has changed to:
    Screenshot 2025-02-12 at 16 54 58
  • Follow the steps until connect
  • Verify the Learn more link is https://yoa.st/dashboard-site-kit-learn-more
  • Verify the "Top 5 most popular content" widget is not on the dashboard.
  • Click on Connect
  • Verify you get a consent modal that looks like:
    image
  • Verify the above is like the design
  • Verify the Learn more link is https://yoa.st/dashboard-site-kit-consent-learn-more
  • Open your network tab in the console
  • Click on Grant consent
  • Verify you get a request to site_kit_manage_consent with consent true
  • Verify the modal closed and the last step is done
  • Verify you get a Got it! primary button, that closes the setup widget.
  • Refresh the page and check you don't see the setup widget and you see the "Top 5 most popular content" widget instead.
  • Go to Yoast SEO => Integrations, and focus on the Site Kit integration
  • Verify the Learn more link is https://yoa.st/integrations-about-site-kit
  • As we just connected in the setup widget, you should see a Disconnect button
  • Click on Disconnect
  • Click on Yes, disconnect
  • Verify you get a request (network tab in the console) to site_kit_manage_consent with consent false
  • Verify the integration card changed to present you with the connect again
  • Click on Connect Site Kit by Google
  • Verify you get the consent modal, just like in the dashboard setup widget
  • Verify the Learn more link is https://yoa.st/integrations-site-kit-consent-learn-more
  • Click on Grant consent
  • Verify you get a request to site_kit_manage_consent with consent true
  • Verify the modal closed and you are back to the disconnect button

Nothing without feature flag

  • Before disabling the feature flag, disconnect via the integrations page, to make the widget appear again?
    • Note: this might not work anymore if we went with permanent dismissal
  • Go to the dashboard
  • Verify the setup widget is there
  • Disable the feature flag
  • Refresh the dashboard page
  • Verify the setup widget is not there anymore
  • Go to the integrations page
  • Verify there is no Site Kit integration

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:

  • Site Kit setup widget on the dashboard and integration card on the integrations page

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 https://github.com/Yoast/reserved-tasks/issues/435

@igorschoester igorschoester added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Feb 13, 2025
@igorschoester igorschoester force-pushed the 435-implement-connect-and-disconnect-endpoints-in-site-kit-set-up-flow branch 3 times, most recently from a5e8822 to f924c7b Compare February 13, 2025 10:57
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.

Now that we can connect and disconnect, we should change isActive to isConnected:
packages/js/src/general/initialize.js

// If site kit feature is enabled and connected: add the top pages widget.
if ( siteKitConfiguration.isFeatureEnabled && siteKitConfiguration.isActive ) {
initialWidgets.push( "topPages" );
}

The dismissal of the widget after connecting should be permanently dismissed if we don't have "take a tour" button. Following Create an endpoint for permanently dismissing the site kit set up flow, maybe for a separate issue.

@igorschoester
Copy link
Copy Markdown
Contributor Author

For the first, yes, that is good addition! 👍
We will need adjustment of the setup widget too, for sure with permanent dismissal implementation.

About the permanent dismissal, that is indeed a separate issue: https://github.com/Yoast/reserved-tasks/issues/450

@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.

igorschoester and others added 11 commits February 13, 2025 15:19
# Conflicts:
#	packages/js/src/dashboard/index.js
#	packages/js/src/general/initialize.js
# Conflicts:
#	packages/js/src/dashboard/index.js
#	packages/js/src/general/initialize.js
Not actual functionality
Using import instead of imageLink to prevent having to know the plugin URL
* remove tour for now
* change dismiss to primary with Got it! instead
Using the same in the setup widget as in the grant consent modal
@igorschoester igorschoester force-pushed the 435-implement-connect-and-disconnect-endpoints-in-site-kit-set-up-flow branch from a46781b to 0106c02 Compare February 13, 2025 14:20
@vraja-pro
Copy link
Copy Markdown
Contributor

vraja-pro commented Feb 13, 2025

CR & AC ✅

We need a follow up issue to show the "Top 5 most popular content" once connected on the dashboard (now it's only after refresh) and consider the order of the widgets. With this patch it is added last and we might want it first

@uxkai, @manuelaugustin

@vraja-pro vraja-pro added this to the 24.6 milestone Feb 13, 2025
@vraja-pro vraja-pro merged commit 565d8cf into trunk Feb 13, 2025
@vraja-pro vraja-pro deleted the 435-implement-connect-and-disconnect-endpoints-in-site-kit-set-up-flow branch February 13, 2025 14:49
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 968b0b709b30bf218fcedaabe3e170e95f223ff7

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 46 of 55 (83.64%) changed or added relevant lines in 8 files are covered.
  • 1081 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 54.626%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/dashboard/services/widget-factory.js 2 3 66.67%
packages/js/src/integrations-page/recommended-integrations.js 0 1 0.0%
packages/js/src/general/initialize.js 0 2 0.0%
packages/js/src/integrations-page/site-kit-integration.js 17 19 89.47%
src/dashboard/infrastructure/integrations/site-kit.php 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
packages/js/src/integrations-page/recommended-integrations.js 1 0.0%
src/generated/container.php 1080 0.38%
Totals Coverage Status
Change from base Build 68d0437bfdc340b62f28a92e339bc7e4abe5978c: 0.02%
Covered Lines: 30374
Relevant Lines: 56020

💛 - Coveralls

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.

3 participants