🚧 Refactor the eligible-feature REST response

This commit is contained in:
Philipp Stracker 2025-01-08 16:50:38 +01:00
parent 33bd9ecce8
commit 6591889079
No known key found for this signature in database
8 changed files with 49 additions and 31 deletions

View file

@ -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
};
};