From fb7d6db9e9a758061258e69280a760c9017f256d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 06:51:10 +0000 Subject: [PATCH 1/3] Update version and add changelog entries for release 8.7.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 d6ecbad8a2c..869a31db157 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,7 @@ *** WooPayments Changelog *** += 8.7.1 - 2025-01-14 = + = 8.7.0 - 2024-12-25 = * Add - Add seller_message to failed order notes * Add - Add WooPay Klaviyo newsletter integration. diff --git a/package-lock.json b/package-lock.json index 9df1527f16d..2800d41701d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "woocommerce-payments", - "version": "8.7.0", + "version": "8.7.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "woocommerce-payments", - "version": "8.7.0", + "version": "8.7.1", "hasInstallScript": true, "license": "GPL-3.0-or-later", "dependencies": { diff --git a/package.json b/package.json index f177e2babbb..8180f9d1d8c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "woocommerce-payments", - "version": "8.7.0", + "version": "8.7.1", "main": "webpack.config.js", "author": "Automattic", "license": "GPL-3.0-or-later", diff --git a/readme.txt b/readme.txt index b94d68e854d..1e9f75500eb 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.7 Requires PHP: 7.3 -Stable tag: 8.6.1 +Stable tag: 8.7.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.7.1 - 2025-01-14 = + + = 8.7.0 - 2024-12-25 = * Add - Add seller_message to failed order notes * Add - Add WooPay Klaviyo newsletter integration. diff --git a/woocommerce-payments.php b/woocommerce-payments.php index 5a8f4fb0485..f1c25560444 100644 --- a/woocommerce-payments.php +++ b/woocommerce-payments.php @@ -11,7 +11,7 @@ * WC tested up to: 9.4.0 * Requires at least: 6.0 * Requires PHP: 7.3 - * Version: 8.7.0 + * Version: 8.7.1 * Requires Plugins: woocommerce * * @package WooCommerce\Payments From fd00e8c6b7d8aee565673d2a95b9333ee8d437c7 Mon Sep 17 00:00:00 2001 From: Timur Karimov Date: Sat, 11 Jan 2025 22:29:55 +0100 Subject: [PATCH 2/3] Broaden billing field queries from form-scoped to document-scoped (#10134) Co-authored-by: Timur Karimov --- .../fix-scope-out-billing-fields-selectors | 4 ++++ client/checkout/classic/event-handlers.js | 2 +- client/checkout/utils/test/upe.test.js | 22 ++++++++++++------- client/checkout/utils/upe.js | 16 ++++++++------ 4 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 changelog/fix-scope-out-billing-fields-selectors diff --git a/changelog/fix-scope-out-billing-fields-selectors b/changelog/fix-scope-out-billing-fields-selectors new file mode 100644 index 00000000000..2d064e70aab --- /dev/null +++ b/changelog/fix-scope-out-billing-fields-selectors @@ -0,0 +1,4 @@ +Significance: minor +Type: fix + +Broaden billing field queries from form-scoped to document-scoped diff --git a/client/checkout/classic/event-handlers.js b/client/checkout/classic/event-handlers.js index ca00bcbd7a6..f5a3c226162 100644 --- a/client/checkout/classic/event-handlers.js +++ b/client/checkout/classic/event-handlers.js @@ -76,7 +76,7 @@ jQuery( function ( $ ) { } ); $checkoutForm.on( generateCheckoutEventNames(), function () { - if ( isBillingInformationMissing( this ) ) { + if ( isBillingInformationMissing() ) { return; } diff --git a/client/checkout/utils/test/upe.test.js b/client/checkout/utils/test/upe.test.js index 91ad592d5cf..de5a870acc2 100644 --- a/client/checkout/utils/test/upe.test.js +++ b/client/checkout/utils/test/upe.test.js @@ -36,6 +36,7 @@ function buildForm( fields ) { input.value = field.value; form.appendChild( input ); } ); + document.body.appendChild( form ); return form; } @@ -57,6 +58,11 @@ describe( 'UPE checkout utils', () => { } ); beforeEach( () => { + const existingCheckoutForm = document.querySelector( 'form' ); + if ( existingCheckoutForm ) { + existingCheckoutForm.remove(); + } + getUPEConfig.mockImplementation( ( argument ) => { if ( argument === 'enabledBillingFields' ) { return { @@ -99,7 +105,7 @@ describe( 'UPE checkout utils', () => { } ); it( 'should return false when the billing information is not missing', () => { - const form = buildForm( [ + buildForm( [ { id: 'billing_first_name', value: 'Test' }, { id: 'billing_last_name', value: 'User' }, { id: 'billing_email', value: 'test@example.com' }, @@ -108,11 +114,11 @@ describe( 'UPE checkout utils', () => { { id: 'billing_city', value: 'Anytown' }, { id: 'billing_postcode', value: '12345' }, ] ); - expect( isBillingInformationMissing( form ) ).toBe( false ); + expect( isBillingInformationMissing() ).toBe( false ); } ); it( 'should return true when the billing information is missing', () => { - const form = buildForm( [ + buildForm( [ { id: 'billing_first_name', value: 'Test' }, { id: 'billing_last_name', value: 'User' }, { id: 'billing_email', value: 'test@example.com' }, @@ -121,11 +127,11 @@ describe( 'UPE checkout utils', () => { { id: 'billing_city', value: 'Anytown' }, { id: 'billing_postcode', value: '' }, ] ); - expect( isBillingInformationMissing( form ) ).toBe( true ); + expect( isBillingInformationMissing() ).toBe( true ); } ); it( 'should use the defaults when there is no specific locale data for a country', () => { - const form = buildForm( [ + buildForm( [ { id: 'billing_first_name', value: 'Test' }, { id: 'billing_last_name', value: 'User' }, { id: 'billing_email', value: 'test@example.com' }, @@ -134,11 +140,11 @@ describe( 'UPE checkout utils', () => { { id: 'billing_city', value: 'Anytown' }, { id: 'billing_postcode', value: '' }, ] ); - expect( isBillingInformationMissing( form ) ).toBe( true ); + expect( isBillingInformationMissing() ).toBe( true ); } ); it( 'should return false when the locale data for a country has no required fields', () => { - const form = buildForm( [ + buildForm( [ { id: 'billing_first_name', value: 'Test' }, { id: 'billing_last_name', value: 'User' }, { id: 'billing_email', value: 'test@example.com' }, @@ -147,7 +153,7 @@ describe( 'UPE checkout utils', () => { { id: 'billing_city', value: 'Anytown' }, { id: 'billing_postcode', value: '' }, ] ); - expect( isBillingInformationMissing( form ) ).toBe( true ); + expect( isBillingInformationMissing() ).toBe( true ); } ); } ); diff --git a/client/checkout/utils/upe.js b/client/checkout/utils/upe.js index c8201ff1ba1..61bcfb71334 100644 --- a/client/checkout/utils/upe.js +++ b/client/checkout/utils/upe.js @@ -404,17 +404,18 @@ function getParsedLocale() { } } -export const isBillingInformationMissing = ( form ) => { +export const isBillingInformationMissing = () => { const enabledBillingFields = getUPEConfig( 'enabledBillingFields' ); // first name and last name are kinda special - we just need one of them to be at checkout const name = `${ - form.querySelector( + document.querySelector( `#${ SHORTCODE_BILLING_ADDRESS_FIELDS.first_name }` )?.value || '' } ${ - form.querySelector( `#${ SHORTCODE_BILLING_ADDRESS_FIELDS.last_name }` ) - ?.value || '' + document.querySelector( + `#${ SHORTCODE_BILLING_ADDRESS_FIELDS.last_name }` + )?.value || '' }`.trim(); if ( ! name && @@ -435,14 +436,15 @@ export const isBillingInformationMissing = ( form ) => { const country = billingFieldsToValidate.includes( SHORTCODE_BILLING_ADDRESS_FIELDS.country ) - ? form.querySelector( `#${ SHORTCODE_BILLING_ADDRESS_FIELDS.country }` ) - ?.value + ? document.querySelector( + `#${ SHORTCODE_BILLING_ADDRESS_FIELDS.country }` + )?.value : null; // We need to just find one field with missing information. If even only one is missing, just return early. return Boolean( billingFieldsToValidate.find( ( fieldName ) => { - const field = form.querySelector( `#${ fieldName }` ); + const field = document.querySelector( `#${ fieldName }` ); let isRequired = enabledBillingFields[ fieldName ]?.required; const locale = getParsedLocale(); From 282f3460d83df9996aa99e5d5d0f1dee4b512490 Mon Sep 17 00:00:00 2001 From: botwoo Date: Tue, 14 Jan 2025 06:54:28 +0000 Subject: [PATCH 3/3] Amend changelog entries for release 8.7.1 --- changelog.txt | 1 + changelog/fix-scope-out-billing-fields-selectors | 4 ---- readme.txt | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 changelog/fix-scope-out-billing-fields-selectors diff --git a/changelog.txt b/changelog.txt index 869a31db157..148a96e8062 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,7 @@ *** WooPayments Changelog *** = 8.7.1 - 2025-01-14 = +* Fix - Broaden billing field queries from form-scoped to document-scoped = 8.7.0 - 2024-12-25 = * Add - Add seller_message to failed order notes diff --git a/changelog/fix-scope-out-billing-fields-selectors b/changelog/fix-scope-out-billing-fields-selectors deleted file mode 100644 index 2d064e70aab..00000000000 --- a/changelog/fix-scope-out-billing-fields-selectors +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: fix - -Broaden billing field queries from form-scoped to document-scoped diff --git a/readme.txt b/readme.txt index 1e9f75500eb..672d7f8df31 100644 --- a/readme.txt +++ b/readme.txt @@ -95,6 +95,7 @@ Please note that our support for the checkout block is still experimental and th == Changelog == = 8.7.1 - 2025-01-14 = +* Fix - Broaden billing field queries from form-scoped to document-scoped = 8.7.0 - 2024-12-25 =