mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 16:24:33 +08:00
♻️ Extract onboarding state to custom hooks
This commit is contained in:
parent
cff9919c78
commit
6e3664ade8
4 changed files with 69 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
|||
import { useSelect, useDispatch } from '@wordpress/data';
|
||||
import { PRODUCT_TYPES, STORE_NAME } from '../constants';
|
||||
|
||||
export const useOnboardingDetails = () => {
|
||||
const useOnboardingDetails = () => {
|
||||
const {
|
||||
persist,
|
||||
setOnboardingStep,
|
||||
|
@ -94,6 +94,44 @@ export const useOnboardingDetails = () => {
|
|||
};
|
||||
};
|
||||
|
||||
export const useOnboardingStepWelcome = () => {
|
||||
const {
|
||||
isSaving,
|
||||
isSandboxMode,
|
||||
setSandboxMode,
|
||||
isManualConnectionMode,
|
||||
setManualConnectionMode,
|
||||
clientId,
|
||||
setClientId,
|
||||
clientSecret,
|
||||
setClientSecret,
|
||||
} = useOnboardingDetails();
|
||||
|
||||
return {
|
||||
isSaving,
|
||||
isSandboxMode,
|
||||
setSandboxMode,
|
||||
isManualConnectionMode,
|
||||
setManualConnectionMode,
|
||||
clientId,
|
||||
setClientId,
|
||||
clientSecret,
|
||||
setClientSecret,
|
||||
};
|
||||
};
|
||||
|
||||
export const useOnboardingStepBusiness = () => {
|
||||
const { isCasualSeller, setIsCasualSeller } = useOnboardingDetails();
|
||||
|
||||
return { isCasualSeller, setIsCasualSeller };
|
||||
};
|
||||
|
||||
export const useOnboardingStepProducts = () => {
|
||||
const { products, toggleProduct } = useOnboardingDetails();
|
||||
|
||||
return { products, toggleProduct };
|
||||
};
|
||||
|
||||
export const useOnboardingStep = () => {
|
||||
const { isReady, step, setStep, completed, setCompleted } =
|
||||
useOnboardingDetails();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue