Skip to content

Commit

Permalink
My Jetpack: fix redirect URL after connection
Browse files Browse the repository at this point in the history
  • Loading branch information
IanRamosC committed Nov 1, 2024
1 parent ded2a7f commit 4a0f70c
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -75,6 +74,8 @@ const ConnectionStep = ( {
resetNotice();
setNotice( NOTICE_SITE_CONNECTED, resetNotice );
refetchOwnershipData();

onUpdateWelcomeFlowExperiment( state => ( { ...state, isLoading: false } ) );
}
}, [
jetpackPlansPath,
Expand Down

0 comments on commit 4a0f70c

Please sign in to comment.