mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +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 = (
|
const useAxoSetup = (
|
||||||
ppcpConfig,
|
ppcpConfig,
|
||||||
fastlaneSdk,
|
fastlaneSdk,
|
||||||
|
paymentComponent,
|
||||||
onChangeCardButtonClick,
|
onChangeCardButtonClick,
|
||||||
setShippingAddress,
|
setShippingAddress,
|
||||||
setCard,
|
setCard,
|
||||||
|
@ -34,7 +35,7 @@ const useAxoSetup = (
|
||||||
setBillingAddress: setWooBillingAddress,
|
setBillingAddress: setWooBillingAddress,
|
||||||
} = useCustomerData();
|
} = useCustomerData();
|
||||||
|
|
||||||
usePhoneSyncHandler( setWooPhone );
|
usePhoneSyncHandler( paymentComponent, setWooPhone );
|
||||||
|
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
console.log( 'Initializing class toggles' );
|
console.log( 'Initializing class toggles' );
|
||||||
|
@ -77,6 +78,7 @@ const useAxoSetup = (
|
||||||
onChangeCardButtonClick,
|
onChangeCardButtonClick,
|
||||||
setShippingAddress,
|
setShippingAddress,
|
||||||
setCard,
|
setCard,
|
||||||
|
paymentComponent,
|
||||||
] );
|
] );
|
||||||
|
|
||||||
return paypalLoaded;
|
return paypalLoaded;
|
||||||
|
|
|
@ -36,8 +36,9 @@ const getSanitizedPhoneNumber = ( select ) => {
|
||||||
* Custom hook to synchronize the WooCommerce phone number with a React component state.
|
* 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 {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.
|
// Fetch and sanitize phone number from WooCommerce.
|
||||||
const phoneNumber = useSelect( ( select ) =>
|
const phoneNumber = useSelect( ( select ) =>
|
||||||
getSanitizedPhoneNumber( select )
|
getSanitizedPhoneNumber( select )
|
||||||
|
|
|
@ -43,6 +43,7 @@ const Axo = ( props ) => {
|
||||||
useAxoSetup(
|
useAxoSetup(
|
||||||
ppcpConfig,
|
ppcpConfig,
|
||||||
fastlaneSdk,
|
fastlaneSdk,
|
||||||
|
paymentComponent,
|
||||||
onChangeCardButtonClick,
|
onChangeCardButtonClick,
|
||||||
setShippingAddress,
|
setShippingAddress,
|
||||||
setCard,
|
setCard,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue