Add ButtonOptions support for the Google Pay button

This commit is contained in:
Daniel Dudzic 2024-11-07 01:00:53 +01:00
parent 7832f853ff
commit b117ff9b7c
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
9 changed files with 305 additions and 93 deletions

View file

@ -20,7 +20,7 @@ if ( typeof window.PayPalCommerceGateway === 'undefined' ) {
window.PayPalCommerceGateway = ppcpConfig;
}
const GooglePayComponent = ( { isEditing } ) => {
const GooglePayComponent = ( { isEditing, buttonAttributes } ) => {
const [ paypalLoaded, setPaypalLoaded ] = useState( false );
const [ googlePayLoaded, setGooglePayLoaded ] = useState( false );
const [ manager, setManager ] = useState( null );
@ -48,11 +48,18 @@ const GooglePayComponent = ( { isEditing } ) => {
const newManager = new GooglepayManager(
namespace,
buttonConfig,
ppcpConfig
ppcpConfig,
buttonAttributes
);
setManager( newManager );
}
}, [ paypalLoaded, googlePayLoaded, isEditing, manager ] );
}, [
paypalLoaded,
googlePayLoaded,
isEditing,
manager,
buttonAttributes,
] );
if ( isEditing ) {
return (
@ -60,6 +67,7 @@ const GooglePayComponent = ( { isEditing } ) => {
namespace={ namespace }
buttonConfig={ buttonConfig }
ppcpConfig={ ppcpConfig }
buttonAttributes={ buttonAttributes }
/>
);
}
@ -89,5 +97,6 @@ registerExpressPaymentMethod( {
canMakePayment: () => buttonData.enabled,
supports: {
features,
style: [ 'height', 'borderRadius' ],
},
} );