From 12a32890609e222e904cdbc30dbd311088e4b6f8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:10:55 +0000 Subject: [PATCH 1/3] Update version and add changelog entries for release 8.2.1 --- changelog.txt | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- readme.txt | 5 ++++- woocommerce-payments.php | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index f7bccd8a1d5..92d0bac6084 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,7 @@ *** WooPayments Changelog *** += 8.2.1 - 2024-09-12 = + = 8.2.0 - 2024-09-11 = * Add - add: test instructions icon animation * Add - Added Embdedded KYC, currently behind feature flag. diff --git a/package-lock.json b/package-lock.json index 23ef7829ee6..fb0a1965e2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "woocommerce-payments", - "version": "8.2.0", + "version": "8.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "woocommerce-payments", - "version": "8.2.0", + "version": "8.2.1", "hasInstallScript": true, "license": "GPL-3.0-or-later", "dependencies": { diff --git a/package.json b/package.json index 00dea7ef57a..fd6d97fe3f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "woocommerce-payments", - "version": "8.2.0", + "version": "8.2.1", "main": "webpack.config.js", "author": "Automattic", "license": "GPL-3.0-or-later", diff --git a/readme.txt b/readme.txt index f89a0a662c1..0d1a94a8c5c 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: woocommerce payments, apple pay, credit card, google pay, payment, payment Requires at least: 6.0 Tested up to: 6.6 Requires PHP: 7.3 -Stable tag: 8.2.0 +Stable tag: 8.2.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -94,6 +94,9 @@ Please note that our support for the checkout block is still experimental and th == Changelog == += 8.2.1 - 2024-09-12 = + + = 8.2.0 - 2024-09-11 = * Add - add: test instructions icon animation * Add - Added Embdedded KYC, currently behind feature flag. diff --git a/woocommerce-payments.php b/woocommerce-payments.php index 149100add8e..dde0e058b69 100644 --- a/woocommerce-payments.php +++ b/woocommerce-payments.php @@ -11,7 +11,7 @@ * WC tested up to: 9.2.0 * Requires at least: 6.0 * Requires PHP: 7.3 - * Version: 8.2.0 + * Version: 8.2.1 * Requires Plugins: woocommerce * * @package WooCommerce\Payments From 3c2b21fec8f3321a9ab6518465e2ba903e22ad65 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Thu, 12 Sep 2024 16:25:16 -0500 Subject: [PATCH 2/3] Fix React error when the Express Checkout's container element is not found. (#9420) --- .../as-fix-react-error-container-not-found | 4 +++ .../utils/checkPaymentMethodIsAvailable.js | 15 ++++++---- ...xpress-checkout-button-display-handler.php | 29 ------------------- 3 files changed, 14 insertions(+), 34 deletions(-) create mode 100644 changelog/as-fix-react-error-container-not-found diff --git a/changelog/as-fix-react-error-container-not-found b/changelog/as-fix-react-error-container-not-found new file mode 100644 index 00000000000..4ca1309b3e3 --- /dev/null +++ b/changelog/as-fix-react-error-container-not-found @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Create div container element with JS dynamically. diff --git a/client/express-checkout/utils/checkPaymentMethodIsAvailable.js b/client/express-checkout/utils/checkPaymentMethodIsAvailable.js index a42d7ffefe9..0792974909b 100644 --- a/client/express-checkout/utils/checkPaymentMethodIsAvailable.js +++ b/client/express-checkout/utils/checkPaymentMethodIsAvailable.js @@ -15,11 +15,15 @@ import { getUPEConfig } from 'wcpay/utils/checkout'; export const checkPaymentMethodIsAvailable = memoize( ( paymentMethod, cart, resolve ) => { - const root = ReactDOM.createRoot( - document.getElementById( - `express-checkout-check-availability-container-${ paymentMethod }` - ) - ); + // Create the DIV container on the fly + const containerEl = document.createElement( 'div' ); + + // Ensure the element is hidden and doesn’t interfere with the page layout. + containerEl.style.display = 'none'; + + document.querySelector( 'body' ).appendChild( containerEl ); + + const root = ReactDOM.createRoot( containerEl ); const api = new WCPayAPI( { @@ -71,6 +75,7 @@ export const checkPaymentMethodIsAvailable = memoize( } resolve( canMakePayment ); root.unmount(); + containerEl.remove(); } } /> diff --git a/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php b/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php index a5e3e08939c..4a78920db88 100644 --- a/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php +++ b/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php @@ -95,10 +95,6 @@ public function init() { $is_woopay_enabled = WC_Payments_Features::is_woopay_enabled(); $is_payment_request_enabled = 'yes' === $this->gateway->get_option( 'payment_request' ); - if ( $is_payment_request_enabled ) { - $this->add_html_container_for_test_express_checkout_buttons(); - } - if ( $is_woopay_enabled || $is_payment_request_enabled ) { add_action( 'wc_ajax_wcpay_add_to_cart', [ $this->express_checkout_ajax_handler, 'ajax_add_to_cart' ] ); add_action( 'wc_ajax_wcpay_empty_cart', [ $this->express_checkout_ajax_handler, 'ajax_empty_cart' ] ); @@ -178,31 +174,6 @@ public function add_order_attribution_inputs() { echo ''; } - - /** - * Add HTML containers to be used by the Express Checkout buttons that check if the payment method is available. - * - * @return void - */ - private function add_html_container_for_test_express_checkout_buttons() { - add_filter( - 'the_content', - function ( $content ) { - $supported_payment_methods = [ 'applePay' , 'googlePay' ]; - // Restrict adding these HTML containers to only the necessary pages. - if ( $this->express_checkout_helper->is_checkout() || $this->express_checkout_helper->is_cart() ) { - foreach ( $supported_payment_methods as $value ) { - // The inline styles ensure that the HTML elements don't occupy space on the page. - $content = '
' . $content; - } - } - return $content; - }, - 10, - 1 - ); - } - /** * Check if the pay-for-order flow is supported. * From b962d2733c211b71d13edd6ad55dff371283ac65 Mon Sep 17 00:00:00 2001 From: botwoo Date: Thu, 12 Sep 2024 23:00:32 +0000 Subject: [PATCH 3/3] Amend changelog entries for release 8.2.1 --- changelog.txt | 3 ++- changelog/as-fix-react-error-container-not-found | 4 ---- readme.txt | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 changelog/as-fix-react-error-container-not-found diff --git a/changelog.txt b/changelog.txt index 92d0bac6084..a0ab5a31932 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ *** WooPayments Changelog *** -= 8.2.1 - 2024-09-12 = += 8.2.1 - 2024-09-13 = +* Fix - Create div container element with JS dynamically. = 8.2.0 - 2024-09-11 = * Add - add: test instructions icon animation diff --git a/changelog/as-fix-react-error-container-not-found b/changelog/as-fix-react-error-container-not-found deleted file mode 100644 index 4ca1309b3e3..00000000000 --- a/changelog/as-fix-react-error-container-not-found +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fix - -Create div container element with JS dynamically. diff --git a/readme.txt b/readme.txt index 0d1a94a8c5c..c4f1b121e3c 100644 --- a/readme.txt +++ b/readme.txt @@ -94,7 +94,8 @@ Please note that our support for the checkout block is still experimental and th == Changelog == -= 8.2.1 - 2024-09-12 = += 8.2.1 - 2024-09-13 = +* Fix - Create div container element with JS dynamically. = 8.2.0 - 2024-09-11 =