🧑‍💻 Add debug tool to disconnect merchant

This commit is contained in:
Philipp Stracker 2025-01-13 14:42:05 +01:00
parent 364c1b55c5
commit 5173954776
No known key found for this signature in database

View file

@ -5,6 +5,7 @@ export const addDebugTools = ( context, modules ) => {
return; return;
} }
// Dump the current state of all our Redux stores.
context.dumpStore = async () => { context.dumpStore = async () => {
/* eslint-disable no-console */ /* eslint-disable no-console */
if ( ! console?.groupCollapsed ) { if ( ! console?.groupCollapsed ) {
@ -43,10 +44,15 @@ export const addDebugTools = ( context, modules ) => {
} ); } );
}; };
context.startOnboarding = () => { // Disconnect the merchant and display the onboarding wizard.
const onboarding = wp.data.dispatch( OnboardingStoreName ); context.disconnect = () => {
onboarding.setCompleted( false ); const common = wp.data.dispatch( CommonStoreName );
onboarding.setStep( 0 );
onboarding.persist(); common.disconnectMerchant();
// eslint-disable-next-line no-console
console.log( 'Disconnected from PayPal. Reloading the page...' );
window.location.reload();
}; };
}; };