New state props for client ID and secret

This commit is contained in:
Philipp Stracker 2024-10-23 18:15:37 +02:00
parent e20a6fdbce
commit 52d04c7347
No known key found for this signature in database
4 changed files with 57 additions and 0 deletions

View file

@ -7,6 +7,8 @@ export const useOnboardingDetails = () => {
setSandboxMode,
setManualConnectionMode,
persist,
setClientId,
setClientSecret,
} = useDispatch( STORE_NAME );
// Transient accessors.
@ -14,6 +16,15 @@ export const useOnboardingDetails = () => {
return select( STORE_NAME ).getTransientData().isSaving;
}, [] );
const clientId = useSelect( ( select ) => {
return select( STORE_NAME ).getTransientData().clientId;
}, [] );
const clientSecret = useSelect( ( select ) => {
return select( STORE_NAME ).getTransientData().clientSecret;
}, [] );
// Persistent accessors.
const onboardingStep = useSelect( ( select ) => {
return select( STORE_NAME ).getPersistentData().step || 0;
}, [] );
@ -36,6 +47,10 @@ export const useOnboardingDetails = () => {
isSaving,
isSandboxMode,
isManualConnectionMode,
clientId,
setClientId,
clientSecret,
setClientSecret,
setOnboardingStep: ( step ) =>
setDetailAndPersist( setOnboardingStep, step ),
setSandboxMode: ( state ) =>