Refactor the email button, shipping change button, and watermark code to a more modular structure

This commit is contained in:
Daniel Dudzic 2024-09-13 15:27:10 +02:00
parent f470fb0c53
commit 3315fbe116
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
22 changed files with 438 additions and 237 deletions

View file

@ -1,4 +1,5 @@
import { useCallback } from '@wordpress/element';
import useFastlaneSdk from "./useFastlaneSdk";
export const useCardChange = ( fastlaneSdk, setCard, setWooBillingAddress ) => {
return useCallback( async () => {
@ -33,3 +34,5 @@ export const useCardChange = ( fastlaneSdk, setCard, setWooBillingAddress ) => {
}
}, [ fastlaneSdk, setCard ] );
};
export default useCardChange;

View file

@ -1,5 +1,6 @@
import { useCallback, useMemo } from '@wordpress/element';
import { useDispatch, useSelect } from '@wordpress/data';
import useFastlaneSdk from "./useFastlaneSdk";
export const useCustomerData = () => {
const customerData = useSelect( ( select ) =>
@ -40,3 +41,5 @@ export const useCustomerData = () => {
]
);
};
export default useCustomerData;

View file

@ -33,3 +33,5 @@ export const useShippingAddressChange = (
}
}, [ fastlaneSdk, setShippingAddress, setWooShippingAddress ] );
};
export default useShippingAddressChange;