From 7cb6d186496c84f08ae036069bbbc9776ca310bb Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 23 Aug 2024 10:07:20 -0600 Subject: [PATCH 01/10] Version bump to 4.8.0 --- package-lock.json | 4 ++-- package.json | 2 +- readme.txt | 2 +- woocommerce-square.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0ab776a..66626259 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "woocommerce-square", - "version": "4.7.3", + "version": "4.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "woocommerce-square", - "version": "4.7.3", + "version": "4.8.0", "license": "GPL-3.0-or-later", "dependencies": { "@codeamp/block-components": "^0.0.1-beta.13", diff --git a/package.json b/package.json index 1e6f493b..6a5009e8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "git://github.com/woocommerce/woocommerce-square.git" }, "title": "WooCommerce Square", - "version": "4.7.3", + "version": "4.8.0", "homepage": "https://woocommerce.com/products/woocommerce-square/", "scripts": { "build": "composer install --no-dev && npm run build:webpack && npm run makepot && npm run archive", diff --git a/readme.txt b/readme.txt index 4d110d7c..18301ba1 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync Requires at least: 6.4 Tested up to: 6.6 Requires PHP: 7.4 -Stable tag: 4.7.3 +Stable tag: 4.8.0 License: GPL-3.0-or-later License URI: https://www.gnu.org/licenses/gpl-3.0.html diff --git a/woocommerce-square.php b/woocommerce-square.php index f5859644..2efcf5dc 100644 --- a/woocommerce-square.php +++ b/woocommerce-square.php @@ -2,7 +2,7 @@ /** * Plugin Name: WooCommerce Square * Requires Plugins: woocommerce - * Version: 4.7.3 + * Version: 4.8.0 * Plugin URI: https://woocommerce.com/products/square/ * Requires at least: 6.4 * Tested up to: 6.6 @@ -29,7 +29,7 @@ defined( 'ABSPATH' ) || exit; if ( ! defined( 'WC_SQUARE_PLUGIN_VERSION' ) ) { - define( 'WC_SQUARE_PLUGIN_VERSION', '4.7.3' ); // WRCS: DEFINED_VERSION. + define( 'WC_SQUARE_PLUGIN_VERSION', '4.8.0' ); // WRCS: DEFINED_VERSION. } if ( ! defined( 'WC_SQUARE_PLUGIN_URL' ) ) { From 6e87d9745ac5fc2086251e59b847cd8dd0de2342 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 23 Aug 2024 10:17:36 -0600 Subject: [PATCH 02/10] Update changelogs --- changelog.txt | 13 ++++++++++++- readme.txt | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index f5b4dd1a..6f8c7950 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,17 @@ *** WooCommerce Square Changelog *** -= 4.7.3 - 2024-08-13 = += 4.8.0 - 2024-08-26 = +* Add - Support for the WooCommerce Product Block Editor. +* Fix - Address a potential infinite loop issue with the `pull_inventory` step when running a manual synchronization. +* Fix - Cancelling Google Pay on checkout shows validation errors. +* Fix - Missing gift card order item meta during re-order. +* Fix - Ensure we don't hardcode the database prefix in queries we run. +* Fix - Replace the use of deprecated hook `wcs_renewal_order_meta` with `wc_subscriptions_renewal_order_data`. +* Update - Change the business location button text based on the location count. +* Dev - Bump WooCommerce "tested up to" version 9.2. +* Dev - Bump WooCommerce minimum supported version to 9.0. + += 4.7.3 - 2024-08-19 = * Fix - Inconsistency in the height of Express Payment Button and compliance with the new Woo Express Payment Method Styling API. * Fix - Ensure the "Uncaught TypeError" JavaScript console error does not occur for out-of-stock products. * Fix - Ensure compatibility with WooPayments extension. diff --git a/readme.txt b/readme.txt index 18301ba1..67cc348e 100644 --- a/readme.txt +++ b/readme.txt @@ -72,7 +72,18 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o == Changelog == -= 4.7.3 - 2024-08-13 = += 4.8.0 - 2024-08-26 = +* Add - Support for the WooCommerce Product Block Editor. +* Fix - Address a potential infinite loop issue with the `pull_inventory` step when running a manual synchronization. +* Fix - Cancelling Google Pay on checkout shows validation errors. +* Fix - Missing gift card order item meta during re-order. +* Fix - Ensure we don't hardcode the database prefix in queries we run. +* Fix - Replace the use of deprecated hook `wcs_renewal_order_meta` with `wc_subscriptions_renewal_order_data`. +* Update - Change the business location button text based on the location count. +* Dev - Bump WooCommerce "tested up to" version 9.2. +* Dev - Bump WooCommerce minimum supported version to 9.0. + += 4.7.3 - 2024-08-19 = * Fix - Inconsistency in the height of Express Payment Button and compliance with the new Woo Express Payment Method Styling API. * Fix - Ensure the "Uncaught TypeError" JavaScript console error does not occur for out-of-stock products. * Fix - Ensure compatibility with WooPayments extension. From 2545b43d36a294a62543e4af3135c206982f678a Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 23 Aug 2024 10:22:01 -0600 Subject: [PATCH 03/10] Update package-lock.json file --- package-lock.json | 55 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 29d8bfae..50926d38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -325,6 +325,15 @@ "npm": ">=8.19.2" } }, + "node_modules/@automattic/i18n-utils/node_modules/gettext-parser": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.4.0.tgz", + "integrity": "sha512-sedZYLHlHeBop/gZ1jdg59hlUEcpcZJofLq2JFwJT1zTqAU3l2wFv6IsuwFHGqbiT9DWzMUW4/em2+hspnmMMA==", + "dependencies": { + "encoding": "^0.1.12", + "safe-buffer": "^5.1.1" + } + }, "node_modules/@automattic/i18n-utils/node_modules/memize": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/memize/-/memize-2.1.0.tgz", @@ -6034,6 +6043,15 @@ "url": "https://github.com/sponsors/kossnocorp" } }, + "node_modules/@woocommerce/components/node_modules/gettext-parser": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.4.0.tgz", + "integrity": "sha512-sedZYLHlHeBop/gZ1jdg59hlUEcpcZJofLq2JFwJT1zTqAU3l2wFv6IsuwFHGqbiT9DWzMUW4/em2+hspnmMMA==", + "dependencies": { + "encoding": "^0.1.12", + "safe-buffer": "^5.1.1" + } + }, "node_modules/@woocommerce/components/node_modules/path-to-regexp": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", @@ -6132,6 +6150,15 @@ "pot-to-php": "tools/pot-to-php.js" } }, + "node_modules/@woocommerce/currency/node_modules/gettext-parser": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.4.0.tgz", + "integrity": "sha512-sedZYLHlHeBop/gZ1jdg59hlUEcpcZJofLq2JFwJT1zTqAU3l2wFv6IsuwFHGqbiT9DWzMUW4/em2+hspnmMMA==", + "dependencies": { + "encoding": "^0.1.12", + "safe-buffer": "^5.1.1" + } + }, "node_modules/@woocommerce/customer-effort-score": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@woocommerce/customer-effort-score/-/customer-effort-score-2.2.0.tgz", @@ -7097,6 +7124,15 @@ "url": "https://github.com/sponsors/kossnocorp" } }, + "node_modules/@woocommerce/experimental/node_modules/gettext-parser": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.4.0.tgz", + "integrity": "sha512-sedZYLHlHeBop/gZ1jdg59hlUEcpcZJofLq2JFwJT1zTqAU3l2wFv6IsuwFHGqbiT9DWzMUW4/em2+hspnmMMA==", + "dependencies": { + "encoding": "^0.1.12", + "safe-buffer": "^5.1.1" + } + }, "node_modules/@woocommerce/experimental/node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -9670,6 +9706,15 @@ "node": ">=12" } }, + "node_modules/@wordpress/i18n/node_modules/gettext-parser": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.4.0.tgz", + "integrity": "sha512-sedZYLHlHeBop/gZ1jdg59hlUEcpcZJofLq2JFwJT1zTqAU3l2wFv6IsuwFHGqbiT9DWzMUW4/em2+hspnmMMA==", + "dependencies": { + "encoding": "^0.1.12", + "safe-buffer": "^5.1.1" + } + }, "node_modules/@wordpress/i18n/node_modules/memize": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/memize/-/memize-2.1.0.tgz", @@ -14797,7 +14842,6 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", - "dev": true, "dependencies": { "iconv-lite": "^0.6.2" } @@ -16838,15 +16882,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/gettext-parser": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.4.0.tgz", - "integrity": "sha512-sedZYLHlHeBop/gZ1jdg59hlUEcpcZJofLq2JFwJT1zTqAU3l2wFv6IsuwFHGqbiT9DWzMUW4/em2+hspnmMMA==", - "dependencies": { - "encoding": "^0.1.12", - "safe-buffer": "^5.1.1" - } - }, "node_modules/gettext-parser": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-3.1.1.tgz", From e25c43a6810c6464d1ed1c6053fdad6f7600932b Mon Sep 17 00:00:00 2001 From: Siddharth Thevaril Date: Wed, 28 Aug 2024 15:37:19 +0530 Subject: [PATCH 04/10] unblock release 4.8.0 --- includes/Admin/Product_Editor_Compatibility.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/Admin/Product_Editor_Compatibility.php b/includes/Admin/Product_Editor_Compatibility.php index f4e2eeba..56314507 100644 --- a/includes/Admin/Product_Editor_Compatibility.php +++ b/includes/Admin/Product_Editor_Compatibility.php @@ -43,8 +43,8 @@ public function __construct() { ); add_action( - 'woocommerce_block_template_area_product-form_after_add_block_product-sku-field', - array( $this, 'add_inventory_control' ) + 'woocommerce_block_template_area_product-form_after_add_block_product-track-stock', + array( $this, 'add_inventory_control' ), ); add_action( From f33dd13aab61d5dbe00c9319c2280f73106fae17 Mon Sep 17 00:00:00 2001 From: Siddharth Thevaril Date: Wed, 4 Sep 2024 23:08:50 +0530 Subject: [PATCH 05/10] fix failing test --- ...sor.spec-with-inventory-new-editor.spec.js | 28 +++++++++---------- tests/e2e/utils/helper.js | 9 ++++-- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/tests/e2e/specs/d6.woo-sor.spec-with-inventory-new-editor.spec.js b/tests/e2e/specs/d6.woo-sor.spec-with-inventory-new-editor.spec.js index 69f35082..42c76a89 100644 --- a/tests/e2e/specs/d6.woo-sor.spec-with-inventory-new-editor.spec.js +++ b/tests/e2e/specs/d6.woo-sor.spec-with-inventory-new-editor.spec.js @@ -18,11 +18,20 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => { const page = await browser.newPage(); await clearSync( page ); + + await browser.close(); +} ); + +test( 'OnePlus 8 pushed to Square with inventory', async ( { page, baseURL } ) => { + test.slow(); + await deleteAllCatalogItems(); await page.goto( '/wp-admin/admin.php?page=wc-settings&tab=square§ion' ); - await page.locator( '#wc_square_system_of_record' ).selectOption( { label: 'WooCommerce' } ); - await page.locator( '#wc_square_enable_inventory_sync' ).check(); - await page.locator( '.woocommerce-save-button' ).click(); + await page.getByTestId( 'sync-settings-field' ).selectOption( { label: 'WooCommerce' } ); + await page.getByTestId( 'push-inventory-field' ).check(); + await page.getByTestId( 'square-settings-save-button' ).click(); + + await expect( await page.getByText( 'Changes Saved!' ) ).toBeVisible(); if ( ! ( await doesProductExist( baseURL, 'oneplus-8' ) ) ) { await createProduct( @@ -50,20 +59,9 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => { .filter( { hasText: 'Publish' } ) .click(); - await page - .locator( '.woocommerce-product-publish-panel__header .components-button' ) - .filter( { hasText: 'Publish' } ) - .click(); - - await expect( await page.getByText( 'OnePlus 8 is now live.' ) ).toBeVisible(); + await expect( await page.getByText( 'Product published.' ).first() ).toBeVisible(); } - await browser.close(); -} ); - -test( 'OnePlus 8 pushed to Square with inventory', async ( { page } ) => { - test.slow(); - await page.goto( '/wp-admin/admin.php?page=wc-settings&tab=square§ion=update' ); const result = await new Promise( ( resolve ) => { diff --git a/tests/e2e/utils/helper.js b/tests/e2e/utils/helper.js index d5d6429c..2cdbefed 100644 --- a/tests/e2e/utils/helper.js +++ b/tests/e2e/utils/helper.js @@ -63,8 +63,12 @@ export async function createProduct( page, product, save = true, newEditor = fal if ( newEditor ) { await page.goto( '/wp-admin/admin.php?page=wc-settings&tab=advanced§ion=features' ); await page.locator( '#woocommerce_feature_product_block_editor_enabled' ).check(); - await page.locator( '.woocommerce-save-button' ).click(); - await expect( await page.getByText( 'Your settings have been saved' ) ).toBeVisible(); + + const saveButton = await page.locator( '.woocommerce-save-button' ); + if ( ! await saveButton.isDisabled() ) { + saveButton.click(); + await expect( await page.getByText( 'Your settings have been saved' ) ).toBeVisible(); + } await page.goto( '/wp-admin/admin.php?page=wc-admin&path=%2Fadd-product' ); @@ -72,7 +76,6 @@ export async function createProduct( page, product, save = true, newEditor = fal await page.locator( '[data-template-block-id="product-name"] input[name="name"]' ).fill( product.name ); - await page.locator( '#woocommerce-product-tab__pricing' ).click(); await page.locator( 'input[name="regular_price"]' ).fill( product.regularPrice ); await page.locator( '#woocommerce-product-tab__inventory' ).click(); From 7d97ec57532be0281bffb216657290dd436da7ca Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Tue, 10 Sep 2024 10:24:55 +0530 Subject: [PATCH 06/10] TEMP: run tests against WC 9.2 --- .wp-env.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.wp-env.json b/.wp-env.json index d36fe6d1..eed840cf 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,7 +1,7 @@ { "core": null, "plugins": [ - "https://downloads.wordpress.org/plugin/woocommerce.zip", + "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip", "https://downloads.wordpress.org/plugin/email-log.zip", ".", "./test-plugins/woocommerce-subscriptions", From 82aca40e6ce0327199fa9d40cadd53fdf57ea4ab Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Tue, 10 Sep 2024 16:51:46 +0530 Subject: [PATCH 07/10] Revert to use WC 9.3 --- .wp-env.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.wp-env.json b/.wp-env.json index eed840cf..d36fe6d1 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,7 +1,7 @@ { "core": null, "plugins": [ - "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip", + "https://downloads.wordpress.org/plugin/woocommerce.zip", "https://downloads.wordpress.org/plugin/email-log.zip", ".", "./test-plugins/woocommerce-subscriptions", From b9e0837f9ca5db80c1cf2ca227b09409acbeb23c Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Fri, 13 Sep 2024 10:51:13 +0530 Subject: [PATCH 08/10] Use classic post creator in pre-orders. --- tests/e2e/specs/f1.pre-orders.spec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/e2e/specs/f1.pre-orders.spec.js b/tests/e2e/specs/f1.pre-orders.spec.js index d1498174..51a15349 100644 --- a/tests/e2e/specs/f1.pre-orders.spec.js +++ b/tests/e2e/specs/f1.pre-orders.spec.js @@ -18,6 +18,7 @@ import { selectPaymentMethod, placeCashAppPayOrder, savePaymentGatewaySettings, + runWpCliCommand, } from '../utils/helper'; const iPhone = devices['iPhone 14 Pro Max']; @@ -43,6 +44,10 @@ test.describe('Pre-Orders Tests', () => { await saveCashAppPaySettings(page, { transactionType: 'charge', }); + + await runWpCliCommand( + 'wp option update woocommerce_feature_product_block_editor_enabled "no"' + ); }); test('[Charge upon release] Square Credit Card should work with Pre-Orders', async ({ From e0f23e2d7dcc1f1926662acd8497dadacaf1d254 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Fri, 13 Sep 2024 09:49:51 -0600 Subject: [PATCH 09/10] Update release date --- changelog.txt | 2 +- readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6f8c7950..2bb5e2af 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,6 @@ *** WooCommerce Square Changelog *** -= 4.8.0 - 2024-08-26 = += 4.8.0 - 2024-09-16 = * Add - Support for the WooCommerce Product Block Editor. * Fix - Address a potential infinite loop issue with the `pull_inventory` step when running a manual synchronization. * Fix - Cancelling Google Pay on checkout shows validation errors. diff --git a/readme.txt b/readme.txt index 67cc348e..728042b8 100644 --- a/readme.txt +++ b/readme.txt @@ -72,7 +72,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o == Changelog == -= 4.8.0 - 2024-08-26 = += 4.8.0 - 2024-09-16 = * Add - Support for the WooCommerce Product Block Editor. * Fix - Address a potential infinite loop issue with the `pull_inventory` step when running a manual synchronization. * Fix - Cancelling Google Pay on checkout shows validation errors. From b33c57b1870b99d7396cfbb79d6751de9b1b0906 Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Mon, 16 Sep 2024 15:36:10 +0530 Subject: [PATCH 10/10] E2E: Keep using old product editor. --- tests/e2e/config/env-post-setup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/e2e/config/env-post-setup.sh b/tests/e2e/config/env-post-setup.sh index eea6b370..4533ec1c 100755 --- a/tests/e2e/config/env-post-setup.sh +++ b/tests/e2e/config/env-post-setup.sh @@ -12,3 +12,6 @@ wp-env run tests-cli wp theme activate storefront # Enable the Square gateway. wp-env run tests-cli wp wc payment_gateway update square_credit_card --user=1 --enabled=1 wp-env run tests-cli wp transient delete --all + +# Keep using old product editor. +wp-env run tests-cli wp option update woocommerce_feature_product_block_editor_enabled no --user=1