mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🚧 Refactor the eligible-feature REST response
This commit is contained in:
parent
33bd9ecce8
commit
6591889079
8 changed files with 49 additions and 31 deletions
|
@ -47,10 +47,16 @@ const useHooks = () => {
|
|||
( select ) => select( STORE_NAME ).merchant(),
|
||||
[]
|
||||
);
|
||||
|
||||
// Read-only properties.
|
||||
const wooSettings = useSelect(
|
||||
( select ) => select( STORE_NAME ).wooSettings(),
|
||||
[]
|
||||
);
|
||||
const features = useSelect(
|
||||
( select ) => select( STORE_NAME ).features(),
|
||||
[]
|
||||
);
|
||||
|
||||
const savePersistent = async ( setter, value ) => {
|
||||
setter( value );
|
||||
|
@ -73,6 +79,7 @@ const useHooks = () => {
|
|||
authenticateWithOAuth,
|
||||
merchant,
|
||||
wooSettings,
|
||||
features,
|
||||
webhooks,
|
||||
startWebhookSimulation,
|
||||
checkWebhookSimulationState,
|
||||
|
@ -130,7 +137,7 @@ export const useWebhooks = () => {
|
|||
};
|
||||
};
|
||||
export const useMerchantInfo = () => {
|
||||
const { merchant } = useHooks();
|
||||
const { merchant, features } = useHooks();
|
||||
const { refreshMerchantData } = useDispatch( STORE_NAME );
|
||||
|
||||
const verifyLoginStatus = useCallback( async () => {
|
||||
|
@ -146,6 +153,7 @@ export const useMerchantInfo = () => {
|
|||
|
||||
return {
|
||||
merchant, // Merchant details
|
||||
features, // Eligible merchant features
|
||||
verifyLoginStatus, // Callback
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue