diff --git a/changelog.txt b/changelog.txt index f5b4dd1a..2bb5e2af 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,17 @@ *** WooCommerce Square Changelog *** -= 4.7.3 - 2024-08-13 = += 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. +* 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/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( diff --git a/package-lock.json b/package-lock.json index be045219..50926d38 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", @@ -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", diff --git a/package.json b/package.json index d776cbdc..f614e53e 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..728042b8 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 @@ -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-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. +* 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/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 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/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 ({ 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(); diff --git a/woocommerce-square.php b/woocommerce-square.php index 634fe475..63414e25 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' ) ) {