mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
🧑💻 Improve Redux debugging
This commit is contained in:
parent
09ca3d0871
commit
cbdf0c23e6
1 changed files with 15 additions and 3 deletions
|
@ -2,7 +2,10 @@ import {
|
|||
OnboardingStoreName,
|
||||
CommonStoreName,
|
||||
PaymentStoreName,
|
||||
SettingsStoreName,
|
||||
StylingStoreName,
|
||||
} from './index';
|
||||
import { setCompleted } from './onboarding/actions';
|
||||
|
||||
export const addDebugTools = ( context, modules ) => {
|
||||
if ( ! context || ! context?.debug ) {
|
||||
|
@ -50,9 +53,10 @@ export const addDebugTools = ( context, modules ) => {
|
|||
|
||||
// Reset all stores, except for the onboarding store.
|
||||
stores.push( CommonStoreName );
|
||||
// TODO: Add other stores here once they are available.
|
||||
stores.push( PaymentStoreName );
|
||||
} else {
|
||||
stores.push( PaymentStoreName );
|
||||
stores.push( SettingsStoreName );
|
||||
stores.push( StylingStoreName );
|
||||
} else {
|
||||
// Only reset the common & onboarding stores to restart the onboarding wizard.
|
||||
stores.push( CommonStoreName );
|
||||
stores.push( OnboardingStoreName );
|
||||
|
@ -80,4 +84,12 @@ export const addDebugTools = ( context, modules ) => {
|
|||
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
// Enters or completes the onboarding wizard without changing anything else.
|
||||
context.onboardingMode = ( state ) => {
|
||||
const onboarding = wp.data.dispatch( OnboardingStoreName );
|
||||
|
||||
onboarding.setCompleted( ! state );
|
||||
onboarding.persist();
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue