Dynamically set plugin_name when redirecting to Jetpack Auth from core profiler (#51278)
* Dynamically set plugin_name when redirecting to Jetpack Auth from core profiler * Add changelog * Update param name
This commit is contained in:
parent
45fc403f6f
commit
f89366033d
|
@ -300,15 +300,28 @@ const exitToWooHome = fromPromise( async () => {
|
||||||
window.location.href = getNewPath( {}, '/', {} );
|
window.location.href = getNewPath( {}, '/', {} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
const getPluginNameParam = (
|
||||||
|
pluginsSelected: CoreProfilerStateMachineContext[ 'pluginsSelected' ]
|
||||||
|
) => {
|
||||||
|
if ( pluginsSelected.includes( 'woocommerce-payments' ) ) {
|
||||||
|
return 'woocommerce-payments';
|
||||||
|
}
|
||||||
|
return 'jetpack-ai';
|
||||||
|
};
|
||||||
|
|
||||||
const redirectToJetpackAuthPage = ( {
|
const redirectToJetpackAuthPage = ( {
|
||||||
event,
|
event,
|
||||||
|
context,
|
||||||
}: {
|
}: {
|
||||||
context: CoreProfilerStateMachineContext;
|
context: CoreProfilerStateMachineContext;
|
||||||
event: { output: { url: string } };
|
event: { output: { url: string } };
|
||||||
} ) => {
|
} ) => {
|
||||||
const url = new URL( event.output.url );
|
const url = new URL( event.output.url );
|
||||||
url.searchParams.set( 'installed_ext_success', '1' );
|
url.searchParams.set( 'installed_ext_success', '1' );
|
||||||
url.searchParams.set( 'plugin_name', 'jetpack-ai' );
|
url.searchParams.set(
|
||||||
|
'plugin_name',
|
||||||
|
getPluginNameParam( context.pluginsSelected )
|
||||||
|
);
|
||||||
window.location.href = url.toString();
|
window.location.href = url.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: update
|
||||||
|
|
||||||
|
Dynamically set plugin_name when redirecting to Jetpack Auth from core profiler
|
Loading…
Reference in New Issue