Commit Graph

64436 Commits

Author SHA1 Message Date
Vladimir Reznichenko 68532ce433
CI: update linting jobs to skip build step (#49193)
In this PR, we introduce changes to linting and PHPUnit jobs in order to speed them up: skip or minimize the build step.
2024-07-08 08:39:39 +02:00
Eason 6d17019827
Fix the inconsistent formatting of the numeric columns in the Leaderboards on the Analytics > Dashboard page (#49097)
* Add the `format` property to the items of the `rows` array in Analytics' Leaderboards API response to indicate how it's formatted.

* Make the `Leaderboard` component within Analytics aware of the currency context and format the numeric columns accordingly.

* Avoid a warning from the test of `Leaderboard` component when running JS tests.

File: client/analytics/components/leaderboard/test/index.js
Ref: https://github.com/woocommerce/woocommerce/blob/9.0.2/packages/js/components/src/pagination/pagination.tsx#L44

* Apply better practice to the test of `Leaderboard` component.

File: client/analytics/components/leaderboard/test/index.js

* Add changelog.

* Make the `Leaderboard` component not create a new function for every `row` rendering.

Address: https://github.com/woocommerce/woocommerce/pull/49097#discussion_r1667009910
2024-07-08 11:15:12 +08:00
Nathan Silveira e62f28b3ca
Allow selecting categories through keyboard (#49049)
* Remove portal and use inline popup

* Allow selecting existing values through , or ENTER

* Add help to taxonomy block

* Provide help attribute to taxonomy block

* Add changelogs

* Remove help text

* Add help text and a11y instructions

* Try to fix unit test

* Add changelog

* Fix E2E test

* Allow navigating up from first list item into the input

* Add scenario for single selection as well
2024-07-05 14:20:28 -03:00
Adrian Moldovan 178466aa06
[e2e tests] Tweak Playwright config - retries and test artifacts (#49148) 2024-07-05 15:38:49 +02:00
Luigi Teschio 615513144d
CYS: Fix color button (#49181)
* CYS: Fix color button

* Add colors to the just arrived full hero button

* Add changefile(s) from automation for the following project(s): woocommerce

* fix just arrived full hero on sidebar

* improving name

* reorganize code

* Fix lint errors

---------

Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
2024-07-05 12:41:27 +00:00
Manish Menaria 2d6448d9b4
Product Collection: Fix alignment of the first item in Grid layout for WP 6.6 (#49096)
* Remove `__experimentalLayout` from Product Template block

This commit removes `__experimentalLayout` from Product Template block. This is because we don't want to use `layout` from Gutenberg for now. This change fixes the alignment of the first item in Grid layout.

* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce

* Fix linting errors in SCSS file

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-05 17:24:27 +05:30
Manish Menaria fa11141726
Expose `__experimentalRegisterProductCollection` in @woocommerce/blocks-registry Package (#48141)
* Expose registerProductCollection in @woocommerce/blocks-registry Package

This commit exposes the `registerProductCollection` function as part of the `@woocommerce/blocks-registry` package. This enhancement facilitates the registration of new product collections by 3PDs, promoting better modularity and extensibility within the WooCommerce Blocks ecosystem.

Changes include:
- Migration of `register-product-collection.tsx` to `packages/checkout/blocks-registry`.
- Export `registerProductCollection` from `@woocommerce/blocks-registry/index.ts`.
- Updated related imports and references to the new path.

This update enables 3PDs to register product collections more seamlessly, enhancing the extensibility of Product Collection block.

* Replace @woocommerce/blocks-checkout with @woocommerce/blocks-registry

* Add __experimental prefix

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Improve registerproductcollection for 3pds

* Set isDefault value to false

* Don't export all the types

* Update changelog

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Add plugin to test __experimentalRegisterProductCollection

* Add E2E tests

* Fix Lint errors

* Improve E2E tests for __experimentalRegisterProductCollection

- Reduced preview timeout from 2000ms to 1000ms.
- Expanded E2E tests to cover new attributes and preview functionalities.

* Refactor code to improve readability and maintainability

- Added a warning comment to indicate that `__experimentalRegisterProductCollection` is an experimental API.
- Refactored variable names and imports in `register-product-collection.tsx` and `index.tsx` for clarity.
- Simplified and reorganized type definitions and imports in `types.ts` and `utils.tsx`.
- Renamed function in `register-product-collection-tester.php` for consistency.

* E2E: Also test the Frontend

* Use alias for import statement

* Don't pass isActive to registerProductCollection

Now it's handle by registerProductCollection itself.

* Update registerproductcollection API structure

Refactored the product collection block to enhance attribute management and ensure consistency in query defaults. This change includes:
- Importing `DEFAULT_QUERY` from constants and using it to set default query attributes.
- Removing `DEFAULT_ATTRIBUTES` from specific collections and directly defining required attributes.
- Ensuring `postType` and `isProductCollectionBlock` are set to default values in the query object.
- Setting `inherit` attribute to `false` by default in all collections.

* Hide inherit control in collections

Ensure the "inherit" control is always hidden, as collections should not be able to change this attribute. This includes:
- Adding `CoreFilterNames.INHERIT` to the `hideControls` set in `register-product-collection.tsx`.
- Adjusting the `hideControls` attribute in individual collection files to remove redundant hiding of the `INHERIT` control.

* Fix: Filters not showing in inspector controls

* Set inherit to false for all collections

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Product Collection: Add validation for `__experimentalRegisterProductCollection` arguments (#48513)

* Add validation for `__experimentalRegisterProductCollection` arguments

Introduced comprehensive validation for the `ProductCollectionConfig` object in `__experimentalRegisterProductCollection` to ensure correct data types and values, enhancing error handling and robustness.

- Added a new function `isValidProductCollectionConfig` to perform various checks on the `ProductCollectionConfig` object.
- Validates properties such as `name`, `title`, `description`, `category`, `keywords`, `icon`, `isDefault`, `innerBlocks`, `example`, `scope`, `isActive`, `attributes`, and `preview`.
- Ensures correct data types and provides detailed console error messages for invalid configurations.
- Updated `__experimentalRegisterProductCollection` to use the validation function before proceeding with the registration process.

**Impact**
- Improves stability and prevents invalid configurations from causing runtime errors.
- Provides clearer error messages for developers, aiding in quicker debugging and development.

* Fix typo

* Refactor: Replace console.error with console.warn

Updated the error logging in the isValidProductCollectionConfig function to use console.warn instead of console.error for invalid configuration properties. This address the feedback from the PR review.

- Replaced console.error with console.warn for various validation checks in isValidProductCollectionConfig.
- Removed redundant return statements after console.warn calls.
- Improved logging messages to better inform about invalid configuration properties without treating them as critical errors.
- Simplified the logic in __experimentalRegisterProductCollection by combining query and attribute properties and ensuring defaults are set properly.

* Refactor: Rename isValidProductCollectionConfig to isValidCollectionConfig

Updated the function name from isValidProductCollectionConfig to isValidCollectionConfig for better clarity and consistency. Also, renamed related variables for improved readability.

* Add validation for name property

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Title is required for new collection

* Update comments

* Fix E2E tests

* Address PR feedback

---------

Co-authored-by: github-actions <github-actions@github.com>

* Add README file for __experimentalRegisterProductCollection

* Add screenshots in README file

* Try to fix lint issue

* Docs: add example for collection with inner blocks

Enhanced the documentation for `__experimentalRegisterProductCollection` to include an example demonstrating how to define a collection with inner blocks. This example shows how to create a custom collection with nested blocks, including a heading and product elements, providing a clear guide for developers.

New content added:
- Example 4: Collection with inner blocks
- Sample code for defining a collection with inner blocks
- Tips and links to further resources on inner blocks and core collection definitions

* Fix Lint errors

* Address PR feedback

* Reduce number of JS files on /shop page

**Problem:** There was increase in number of JS files on /shop page after exposing `registerProductCollection` function in `@woocommerce/blocks-registry` package. This package is loaded on the frontend. For example, previously 45 JS files were loaded on /shop page but now 55 JS files are loaded on /shop page.

**Solution:**
1. After a bit of debugging I found out that constant file which we are importing i.e. `plugins/woocommerce-blocks/assets/js/blocks/product-collection/constants.ts` contain some heavy dependencies & it's not pure. Therefore, I decided to split this file into two files. I moved all the constants that are used in `registerProductCollection` function to a new file i.e. `plugins/woocommerce-blocks/assets/js/blocks/product-collection/constants-register-product-collection.ts`. This way, we don't need to load all the constants on the frontend i.e. /shop page.
  - This reduced 4 JS files i.e. 51 JS files are loaded on /shop page.

2. After some more investigation, I found out that importing `registerBlockVariation` function is increasing number of JS files on Frontend. Therefore, I decided to use global `wp` object to call `registerBlockVariation` function. This way, we don't need to import it. This reduced last 6 files i.e. 45 JS files are loaded on /shop page.

This way, I was able to reduce number of JS files on /shop page from 55 to 45, which is same as before this PR.

* Refactor: product collection constants

- Moved constants from `constants-register-product-collection.ts` to `constants.ts`
- Deleted `constants-register-product-collection.ts`
- Updated import paths in relevant files to reflect the changes
- Moved utility functions to `utils.ts`

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-05 16:55:35 +05:30
Chris Lilitsas d3df046f97
[Product Collection] Parse front-end context (#44145)
* Parse global context

* Refactor the util to only parse global context, provide the location context to collection children

* cleanup

* Cleanup

* Add changelog

* Make linters happy

* provide context to each inner block recursively

* Fix linters

* Remove debug

* Update plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection.php

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>

* Rename the provider method

* Fix typo on cart item products

* Use the query context instead

* Lint

* Lint again

* Minor change on docs

* Polish

* Cleanup

---------

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
2024-07-05 13:49:24 +03:00
Mike Jolley be849473e0
Checkout: Update legacy status handling (#48788)
* Allow same status as API expects

* changelog
2024-07-05 11:42:38 +01:00
Luigi Teschio 9fc207b1a6
CYS: fix: Assembler follows admin color schema (#49159)
* CYS: fix: Assembler follows admin color schema

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-05 12:20:49 +02:00
Vladimir Reznichenko 1675c63bba
Monorepo: tweak CodeSniffer rules conflicting with strict types declaration requirements (#49183) 2024-07-05 11:46:30 +02:00
Alba Rincón dae47a6a5f
CYS - Remove non-default patterns and register them from the PTK and update margins (#49101)
* Remove not default patterns

* Add margins

* Include woocommerce patterns from PTK

* Add changefile(s) from automation for the following project(s): woocommerce

* Bring back some patterns

* Bring back footer and headers

* Update snapshots after updating margins

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-05 08:55:05 +02:00
Alba Rincón c4d160bf21
CYS - Add missing patterns to their categories for the assembler (#49154)
* Add the Featured Category Cover Image to Intro category

* Add missing patterns to their categories for the assembler

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-05 08:54:23 +02:00
Chi-Hsuan Huang e59f4e406d
Fix the Coming Soon Site Page heading color is white after completing the CYS task (#49129)
* Fix site coming soon page heading color

* Add changelog
2024-07-05 10:51:30 +08:00
Joshua T Flowers 1c8698c684
Prevent product editor styles loading on non wc-admin pages (#49170)
* Only load product editor styles on WC admin pages

* Manually load interface styles to exclude fullscreen styles

* Add changefile(s) from automation for the following project(s): @woocommerce/product-editor, woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-04 14:17:14 -07:00
Alba Rincón c0d102a93c
CYS - Replace customer account block icon in headers used in the assembler (#49133)
* Replace customer account block icon in headers used in the assembler

* Add changefile(s) from automation for the following project(s): woocommerce

* Change icons style for injected blocks

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-04 18:59:52 +02:00
Fernando Marichal 914348d887
Add clear button to `Categories` dropdown (#49036)
* Add clear button to Categories dropdown

* Add changelog

* Add component changelog

* Fix button styles

* Rename methods and prop
2024-07-04 13:35:57 -03:00
Vladimir Reznichenko c706510049
Monorepo: update git postmerge hook. (#49130)
This PR updates the post-merge git hook, which executes pnpm install (now with --frozen-lockfile flag) in order to speed it up. See https://pnpm.io/cli/install#--frozen-lockfile for details.
2024-07-04 17:45:09 +02:00
Veljko V 59a1e5394b
Fix flaky connect to Woo e2e test (#48926) 2024-07-04 18:21:15 +03:00
Mik cf7fc7b2a9
Fix deprecated get_option notice when viewing Analytics > Orders (#49092)
* Add option for orders_report_date_tour_shown to allow list

* Disable the orders report date tour in E2E test
2024-07-04 16:09:58 +01:00
Jorge A. Torres 04fa888b2f
Fix toggling of permission details in downloadable product permissions metabox (order screen) (#49022)
* Work around WP's handlediv functionality in download permissions metabox

* Add changelog
2024-07-04 08:06:45 -07:00
Alba Rincón a712e54005
CYS - Include the dotcom reviews patterns (#49140)
* Include the dotcom reviews patterns

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-04 16:51:59 +02:00
Alba Rincón c2973c3fe1
CYS - Make some titles bold on CYS patterns (#49151)
* Make some titles bold on cys patterns

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-04 16:05:09 +02:00
Nathan Silveira 96739fd6fd
Allow returning to input on selectTree when pressing escape (#49106)
* Allow returning to input on selectTree when pressing escape

* Call onEscape in single mode as well

* Close the menu on escape

* Extract handleEscapePress function
2024-07-04 14:00:32 +00:00
Matt Sherman d66e1a2438
Product Editor: Fix tab switching when variations are generated (#49058)
* Remove selected tab state from Tabs, handle via props

* Pass selected tab via props to Header

* Fix Tabs unit tests

* Remove unused imports

* Changelog
2024-07-04 09:58:26 -04:00
Luigi Teschio d95b43a6f5
CYS: Fix Shuffle feature logic (#49153)
* CYS: fix shuffle feature

* improve types and add comment

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-04 15:46:18 +02:00
Nathan Silveira ac915f6905
Use default cursor for everything in select and tree components (#49048) 2024-07-04 10:14:32 -03:00
Roy Ho 780f27256f
Remove IE11 specific styles (#49027)
* Remove IE11 specific styles

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Remove unused mixin

* Remove additional IE/edge styles

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-04 05:28:26 -07:00
piinthecloud 025b5f1a8f
add front matter and cleanup docs in V1 migration for docs site (#49010)
* add front matter and cleanup docs in V1 migration for docs site

* add changelog entry and fix remaining HTML tables to markdown

* bypass linter rules

* update rule

* rever rule change for incorrect file

* rever rule change for incorrect file

* lint filtering-payment-methods.md rule

* address comments

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/hooks/migrated-hooks.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/hooks/migrated-hooks.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-payment-methods/payment-method-integration.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-payment-methods/filtering-payment-methods.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-block/available-filters/totals-footer-item.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-block/available-filters/checkout-and-place-order-button.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-block/available-filters/additional-cart-checkout-inner-block-types.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-block/available-filters/cart-line-items.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-block/additional-checkout-fields.md

Co-authored-by: Niels Lange <info@nielslange.de>

* Update plugins/woocommerce-blocks/docs/third-party-developers/extensibility/checkout-block/how-checkout-processes-an-order.md

Co-authored-by: Niels Lange <info@nielslange.de>

---------

Co-authored-by: Niels Lange <info@nielslange.de>
2024-07-04 13:54:43 +02:00
Adrian Moldovan cef644078e
Remove the matrix.testEnv condition from the build step (#49149) 2024-07-04 14:50:49 +03:00
Adrian Moldovan 32b7dd646a
Updated ignored jobs list for evaluation script (#49141) 2024-07-04 14:05:15 +03:00
Veljko V c9f8480a3f
Fix flaky filling SKU field in e2e test (#49134) 2024-07-04 14:00:14 +03:00
Amit Raj e562ed4ede
Add product count visibility option to mini cart block (#48545) 2024-07-04 13:52:01 +03:00
github-actions[bot] 41314eccb7
Delete changelog files based on PR 49113 (#49138)
Delete changelog files for 49113

Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
2024-07-04 10:54:43 +01:00
Niels Lange 0089b2359c
Use `createRoot().render()` instead of `render()` (#48858)
* Use createRoot().render() instead of render()

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Remove “ReactDOM.render is no longer supported” checks

* Add “ReactDOM.render is no longer supported” checks again

* Adjust JS unit tests

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-04 11:36:38 +02:00
Luigi Teschio c8e4938548
CYS: fix not template set correctly (#49113)
* CYS: fix not template set correctly

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-04 09:35:16 +00:00
Adrian Moldovan 62c74d0ed4
[e2e tests] Add support for external sites in CI (#49017) 2024-07-04 12:15:43 +03:00
RJ e61313b33d
Use createRoot in classic product editor cases (#48834)
mothra

mothra

mothra
2024-07-04 05:38:19 -03:00
Vladimir Reznichenko 7959060850
Monorepo: disable autoloading optimization by default (take 2) (#48980)
This PR is the second attempt to speed up monorepo installation by removing autoloading optimization setting from the configuration and performing the optimization where it is appropriate (composer post-install hooks and when building releases).

In the installation context, the composer post-install hook will execute a background task to dump the optimized autoloading, while the installation process completes other tasks.
2024-07-04 10:12:52 +02:00
Karol Manijak ab646ace8e
Product Collection: "Sync with current query" should only apear in archive context and not other places (#48917)
* Show Sync with current query option only in archive templates

* Add changelog

* Add e2e test

* Remove unused variable
2024-07-04 09:13:36 +02:00
Vladimir Reznichenko f8c95a8db8
CI: caching tune (part one - relocate playwright caching) (#49081)
In this PR we ar relocating playwright downloads caching into the monorepo action (behind input parameter). That consolidates monorepo-related caching and also reduces the time fetching the cache action in external workflows.
2024-07-04 06:55:24 +02:00
Paul Sealock 7aa42a6d76
LYS: Fix missing CSS (#49075) 2024-07-04 11:10:12 +12:00
Adrian Moldovan f50119bd1b
Update action/pnpm-setup version (#49116) 2024-07-03 15:59:15 -03:00
github-actions[bot] 0b00aec60a
Delete changelog files based on PR 49104 (#49115)
Delete changelog files for 49104

Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
2024-07-03 13:46:43 -04:00
Adrian Duffell 9af58923de
Place Printful behind a feature flag (#49104)
* Add printful feature flag

* Place printful placement behind feature flag

* Add changelog
2024-07-03 17:01:37 +00:00
Adrian Duffell b36083403d
Ensure WooPayments is the only enabled gateway when offering to delete test orders (#49032)
* Add a check for woopayments is the only gateway

* Try fix TS error

* Add changelog

* Fix lint issues
2024-07-03 23:22:27 +08:00
Thomas Roberts 20e7128775
Update WC blocks wp-env to use WP 6.6 RC1 (#49037)
Co-authored-by: github-actions <github-actions@github.com>
2024-07-03 16:09:43 +01:00
Nathan Silveira 85cedf2d2b
Add unique_id field to product (#47364)
* Add unique_id field to product

* Fix documentation

* Fix wrong comment

* Update description

* Add unique_id for variations

* Update lint

* Update tests

* Add changelog

* Update variations unit test

* Add unique_id to wc_product_meta_lookup

* Add unique_id methods to cpt interface

* Add new methods for unique_id and add it to lookup table

* Add unique_id functions to product functions

* Throw error when unique_id is duplicated

* Handle error message for unique_id on the front-end

* Add changelog

* Rename unique_id description in REST API

* Fix lint issues

* Add unique_id tracking for product publish

* Rename to 'global_unique_id'

* Fix lint

* Fix lint

* Bump documentation version

* Update controller description of fields
2024-07-03 11:45:48 -03:00
Luigi Teschio 496df1b7a2
CYS: fix default intro pattern (#49082)
* CYS: fix default intro pattern

* Add changefile(s) from automation for the following project(s): woocommerce

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-03 16:17:25 +02:00
Manish Menaria ab826271d3
Update revert button text and description (#48717)
* Update Revert button text and description

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Add (Classic) as suffix instead of prefix

* Button text should be in center

* Fix: Button text isn't in center

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-07-03 19:31:50 +05:30