From 6cff322e9167634f63641151b0e992904bccde96 Mon Sep 17 00:00:00 2001 From: Guilherme Pressutto Date: Tue, 3 Dec 2024 11:48:48 -0300 Subject: [PATCH] Fixed Affirm using black logo on dark themes (#9805) --- changelog/fix-upe-theme-block | 4 ++++ client/checkout/blocks/index.js | 2 -- client/checkout/blocks/payment-method-label.js | 14 +++++--------- 3 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 changelog/fix-upe-theme-block diff --git a/changelog/fix-upe-theme-block b/changelog/fix-upe-theme-block new file mode 100644 index 00000000000..6afa59f04d3 --- /dev/null +++ b/changelog/fix-upe-theme-block @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fixed Affirm using black logo on dark themes diff --git a/client/checkout/blocks/index.js b/client/checkout/blocks/index.js index cdb3d105861..3f98863d707 100644 --- a/client/checkout/blocks/index.js +++ b/client/checkout/blocks/index.js @@ -64,7 +64,6 @@ const upeMethods = { }; const enabledPaymentMethodsConfig = getUPEConfig( 'paymentMethodsConfig' ); -const upeAppearanceTheme = getUPEConfig( 'wcBlocksUPEAppearanceTheme' ); const isStripeLinkEnabled = isLinkEnabled( enabledPaymentMethodsConfig ); // Create an API object, which will be used throughout the checkout. @@ -116,7 +115,6 @@ Object.entries( enabledPaymentMethodsConfig ) iconLight={ upeConfig.icon } iconDark={ upeConfig.darkIcon } upeName={ upeName } - upeAppearanceTheme={ upeAppearanceTheme } /> ), ariaLabel: 'WooPayments', diff --git a/client/checkout/blocks/payment-method-label.js b/client/checkout/blocks/payment-method-label.js index 7a18cef4bcd..752a9b830db 100644 --- a/client/checkout/blocks/payment-method-label.js +++ b/client/checkout/blocks/payment-method-label.js @@ -47,20 +47,15 @@ const PaymentMethodMessageWrapper = ( { ); }; -export default ( { - api, - title, - countries, - iconLight, - iconDark, - upeName, - upeAppearanceTheme, -} ) => { +export default ( { api, title, countries, iconLight, iconDark, upeName } ) => { const cartData = wp.data.select( 'wc/store/cart' ).getCartData(); const isTestMode = getUPEConfig( 'testMode' ); const [ appearance, setAppearance ] = useState( getUPEConfig( 'wcBlocksUPEAppearance' ) ); + const [ upeAppearanceTheme, setUpeAppearanceTheme ] = useState( + getUPEConfig( 'wcBlocksUPEAppearanceTheme' ) + ); // Stripe expects the amount to be sent as the minor unit of 2 digits. const amount = parseInt( @@ -86,6 +81,7 @@ export default ( { 'blocks_checkout' ); setAppearance( upeAppearance ); + setUpeAppearanceTheme( upeAppearance.theme ); } if ( ! appearance ) {