mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
✨ New Redux properties for manual connection data
This commit is contained in:
parent
d4fbde1b13
commit
ac68aa7968
3 changed files with 52 additions and 0 deletions
|
@ -30,6 +30,8 @@ const useHooks = () => {
|
|||
setStep,
|
||||
setCompleted,
|
||||
setIsCasualSeller,
|
||||
setManualClientId,
|
||||
setManualClientSecret,
|
||||
setAreOptionalPaymentMethodsEnabled,
|
||||
setProducts,
|
||||
} = useDispatch( STORE_NAME );
|
||||
|
@ -43,6 +45,8 @@ const useHooks = () => {
|
|||
|
||||
// Transient accessors.
|
||||
const isReady = useTransient( 'isReady' );
|
||||
const manualClientId = useTransient( 'manualClientId' );
|
||||
const manualClientSecret = useTransient( 'manualClientSecret' );
|
||||
|
||||
// Persistent accessors.
|
||||
const step = usePersistent( 'step' );
|
||||
|
@ -73,6 +77,14 @@ const useHooks = () => {
|
|||
setIsCasualSeller: ( value ) => {
|
||||
return savePersistent( setIsCasualSeller, value );
|
||||
},
|
||||
manualClientId,
|
||||
setManualClientId: ( value ) => {
|
||||
return savePersistent( setManualClientId, value );
|
||||
},
|
||||
manualClientSecret,
|
||||
setManualClientSecret: ( value ) => {
|
||||
return savePersistent( setManualClientSecret, value );
|
||||
},
|
||||
areOptionalPaymentMethodsEnabled,
|
||||
setAreOptionalPaymentMethodsEnabled: ( value ) => {
|
||||
return savePersistent( setAreOptionalPaymentMethodsEnabled, value );
|
||||
|
@ -88,6 +100,22 @@ const useHooks = () => {
|
|||
};
|
||||
};
|
||||
|
||||
export const useManualConnectionForm = () => {
|
||||
const {
|
||||
manualClientId,
|
||||
setManualClientId,
|
||||
manualClientSecret,
|
||||
setManualClientSecret,
|
||||
} = useHooks();
|
||||
|
||||
return {
|
||||
manualClientId,
|
||||
setManualClientId,
|
||||
manualClientSecret,
|
||||
setManualClientSecret,
|
||||
};
|
||||
};
|
||||
|
||||
export const useBusiness = () => {
|
||||
const { isCasualSeller, setIsCasualSeller } = useHooks();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue