Skip to content

Remove wpcom-migration customization from Login and Jetpack Connect #103766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

jsnajdr
Copy link
Member

@jsnajdr jsnajdr commented May 28, 2025

This removes a no-longer-used customization of the /jetpack/connect/authorize and /log-in/jetpack pages when the user comes from a WP.com migration plugin flow (from=wpcom-migration query param. As you can read in #103445 (comment) the wpcom-migration plugin on WP.org has been changed to a completely different implementation and this flow is no longer used.

There were many design customizations as you can see in these /jetpack/connect/authorize screenshots:

Customized flow Customization removed
Screenshot 2025-05-28 at 10 38 18 Screenshot 2025-05-28 at 10 45 08

The customized flow changed the vanilla Jetpack Connect screen by changing the colors (to WP.com blue), removing the Jetpack header, rendering a different header and subheader, different label on the "Approve" button, displaying the user name and gravatar differently... This is now all gone.

I'm keeping the customization that affect functionality: like redirecting to /start/site-migration or /start/account on certain conditions that involve the from=wpcom-migration query param. The flow will still work flawlessy if someone goes through it. But the visual customizations are all removed.

Testing instructions:

  1. Go to /jetpack/connect/authorize in dev Calypso.
  2. In client/jetpack-connect/controller.js, modify the line:
    const transformedQuery = parseAuthorizationQuery( query );
    
    into
    const transformedQuery = {};
    
    or
    const transformedQuery = { from: 'wpcom-migration' };
    
    so that you avoid the NoDirectAccessError screen.
  3. Verify how the page is displayed pre- and post- this patch, both with wpcom-migration and without.

@jsnajdr jsnajdr requested review from anomiex, andrewserong and a team May 28, 2025 11:07
@jsnajdr jsnajdr self-assigned this May 28, 2025
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 28, 2025
Copy link

github-actions bot commented May 28, 2025

@matticbot
Copy link
Contributor

matticbot commented May 28, 2025

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~203 bytes removed 📉 [gzipped])

name         parsed_size           gzip_size
entry-login       -613 B  (-0.0%)     -203 B  (-0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~440 bytes removed 📉 [gzipped])

name               parsed_size           gzip_size
jetpack-connect        -1279 B  (-0.1%)     -313 B  (-0.1%)
stepper-user-step       -210 B  (-0.0%)      -62 B  (-0.0%)
security                -210 B  (-0.0%)      -65 B  (-0.0%)
purchase-product         -46 B  (-0.0%)      -27 B  (-0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~206 bytes removed 📉 [gzipped])

name                          parsed_size           gzip_size
async-load-design-blocks           -447 B  (-0.0%)     -148 B  (-0.0%)
async-load-signup-steps-user       -210 B  (-0.0%)      -58 B  (-0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

if ( ! this.retryingAuth ) {
return translate( 'Approve' );
}
return translate( 'Approve' );
Copy link
Member Author

Choose a reason for hiding this comment

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

The this.retryingAuth condition is handled a few lines above. If we get to this statement, it's already guaranteed to be false.

includes( get( currentQuery, 'redirect_to' ), '/jetpack/connect/authorize' ) &&
includes( get( currentQuery, 'redirect_to' ), '_wp_nonce' )
includes( redirectTo, '/jetpack/connect/authorize' ) &&
includes( redirectTo, '_wp_nonce' )
Copy link
Member Author

Choose a reason for hiding this comment

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

Here and at a few other places I'm reusing the existing redirectTo value. It's guaranteed to be non-empty because it satisfied checks for a substring.

@@ -149,6 +137,8 @@ export function getSignupUrl( currentQuery, currentRoute, oauth2Client, locale,
oauth2_client_id: oauth2Client.id,
oauth2_redirect: redirectTo,
} );

const wccomFrom = get( currentQuery, 'wccom-from' );
Copy link
Member Author

Choose a reason for hiding this comment

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

Here I'm moving the variable assignment closer to the (single) usage. Similarly for signupFlow a few lines below.

isFromPublicAPIConnectFlow ||
( includes( redirectTo, 'action=jetpack-sso' ) && includes( redirectTo, 'sso_nonce=' ) ) ||
redirectTo
) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of this condition is redundant since https://github.com/Automattic/wp-calypso/pull/83026/files#r1361480491 because if redirectTo is non-empty, the entire condition is true.

@jsnajdr jsnajdr force-pushed the remove/login-wpcom-migration-variant branch from 6ebbf69 to 94ea5ff Compare May 29, 2025 07:40
@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • help-center
  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug remove/login-wpcom-migration-variant on your sandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Type] Janitorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants