From a0dda05abfa1cdff0de7a325f0e76affc0c2d47c Mon Sep 17 00:00:00 2001 From: Ian Ramos <5714212+IanRamosC@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:03:44 -0300 Subject: [PATCH] My Jetpack: fix redirect URL after connection --- .../components/welcome-flow/ConnectionStep.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx b/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx index 508ae01d923d2..cde375eb63448 100644 --- a/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx +++ b/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx @@ -35,14 +35,13 @@ const ConnectionStep = ( { const { recordEvent } = useAnalytics(); const { setNotice, resetNotice } = useContext( NoticeContext ); - const { siteSuffix, siteUrl, adminUrl } = getMyJetpackWindowInitialState(); - const redirectUri = `?redirect_uri=${ encodeURIComponent( window.location.href ) }`; - const connectAfterCheckoutUrl = `&connect_after_checkout=true&from_site_slug=${ siteUrl }&admin_url=${ adminUrl }`; - const query = `${ redirectUri }${ connectAfterCheckoutUrl }`; - const jetpackPlansPath = getRedirectUrl( 'jetpack-my-jetpack-site-only-plans', { - site: siteSuffix, - query, - } ); + const { siteSuffix, adminUrl } = getMyJetpackWindowInitialState(); + const connectAfterCheckoutUrl = `?connect_after_checkout=true&admin_url=${ encodeURIComponent( + adminUrl + ) }&from_site_slug=${ siteSuffix }&source=my-jetpack`; + const redirectUri = `&redirect_to=${ encodeURIComponent( window.location.href ) }`; + const query = `${ connectAfterCheckoutUrl }${ redirectUri }&unlinked=1`; + const jetpackPlansPath = getRedirectUrl( 'jetpack-my-jetpack-site-only-plans', { query } ); const activationButtonLabel = __( 'Activate Jetpack in one click', 'jetpack-my-jetpack' ); const { refetch: refetchOwnershipData } = useProductsByOwnership();