mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
✨ Inject paymentComponent to phone-sync-handler
This commit is contained in:
parent
55635d11c0
commit
50daa3e99e
3 changed files with 6 additions and 2 deletions
|
@ -14,6 +14,7 @@ import useShippingAddressChange from './useShippingAddressChange';
|
|||
const useAxoSetup = (
|
||||
ppcpConfig,
|
||||
fastlaneSdk,
|
||||
paymentComponent,
|
||||
onChangeCardButtonClick,
|
||||
setShippingAddress,
|
||||
setCard,
|
||||
|
@ -34,7 +35,7 @@ const useAxoSetup = (
|
|||
setBillingAddress: setWooBillingAddress,
|
||||
} = useCustomerData();
|
||||
|
||||
usePhoneSyncHandler( setWooPhone );
|
||||
usePhoneSyncHandler( paymentComponent, setWooPhone );
|
||||
|
||||
useEffect( () => {
|
||||
console.log( 'Initializing class toggles' );
|
||||
|
@ -77,6 +78,7 @@ const useAxoSetup = (
|
|||
onChangeCardButtonClick,
|
||||
setShippingAddress,
|
||||
setCard,
|
||||
paymentComponent,
|
||||
] );
|
||||
|
||||
return paypalLoaded;
|
||||
|
|
|
@ -36,8 +36,9 @@ const getSanitizedPhoneNumber = ( select ) => {
|
|||
* Custom hook to synchronize the WooCommerce phone number with a React component state.
|
||||
*
|
||||
* @param {Function} setWooPhone - The state setter function for the phone number.
|
||||
* @param {Object} paymentComponent - The CardField component from Fastlane.
|
||||
*/
|
||||
export const usePhoneSyncHandler = ( setWooPhone ) => {
|
||||
export const usePhoneSyncHandler = ( paymentComponent, setWooPhone ) => {
|
||||
// Fetch and sanitize phone number from WooCommerce.
|
||||
const phoneNumber = useSelect( ( select ) =>
|
||||
getSanitizedPhoneNumber( select )
|
||||
|
|
|
@ -43,6 +43,7 @@ const Axo = ( props ) => {
|
|||
useAxoSetup(
|
||||
ppcpConfig,
|
||||
fastlaneSdk,
|
||||
paymentComponent,
|
||||
onChangeCardButtonClick,
|
||||
setShippingAddress,
|
||||
setCard,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue