Inject paymentComponent to phone-sync-handler

This commit is contained in:
Philipp Stracker 2024-09-16 17:52:32 +02:00
parent 55635d11c0
commit 50daa3e99e
No known key found for this signature in database
3 changed files with 6 additions and 2 deletions

View file

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

View file

@ -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 )

View file

@ -43,6 +43,7 @@ const Axo = ( props ) => {
useAxoSetup(
ppcpConfig,
fastlaneSdk,
paymentComponent,
onChangeCardButtonClick,
setShippingAddress,
setCard,