Commit Graph

5615 Commits

Author SHA1 Message Date
dependabot[bot] dfd6a7ee21 Bump commander from 9.4.0 to 11.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/9889)
Bumps [commander](https://github.com/tj/commander.js) from 9.4.0 to 11.0.0.
- [Release notes](https://github.com/tj/commander.js/releases)
- [Changelog](https://github.com/tj/commander.js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tj/commander.js/compare/v9.4.0...v11.0.0)

---
updated-dependencies:
- dependency-name: commander
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-26 08:42:49 -07:00
Alba Rincón 51ca561130 Remove styles from `Product Details Product Listing` pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10362)
* Fix black and white colors

* Remove styles from button and title
2023-07-26 16:12:11 +02:00
Roy Ho a57642318a Change custom toolbar item to use toolbar button (https://github.com/woocommerce/woocommerce-blocks/pull/10246) 2023-07-26 06:19:41 -07:00
Karol Manijak b5d3580ccf Check if WordPress version is higher than 6.2.2 to make Products block compatible with Gutenberg 16+ (https://github.com/woocommerce/woocommerce-blocks/pull/10360)
* Check if WordPress version is higher than 6.2.2 to make Products block compatible with Gutenberg 16+

* Extract the logic of checking the post template support for grid view toi separate function

* Change the versions comparison and improve description of custom version compare function
2023-07-26 15:13:54 +02:00
Roy Ho 02c95b9b1a Remove uneeded testin step for 10198 (https://github.com/woocommerce/woocommerce-blocks/pull/10371) 2023-07-26 06:12:58 -07:00
Patricia Hillebrandt 529f17dac9 Store Customization > Large Footer pattern - Update the pattern to become wireframed (https://github.com/woocommerce/woocommerce-blocks/pull/10323)
* Remove opinionated font styles and sizes from the Large Footer pattern.

* Ensure the year is dinamically changed in the footer.

* Make string translatable

* Update translation to include the WooCommerce brand.
2023-07-26 13:51:14 +02:00
Albert Juhé Lluveras 84849ca99d Fix Checkout Order Route markdown link (https://github.com/woocommerce/woocommerce-blocks/pull/10364) 2023-07-26 11:37:51 +01:00
Paulo Arromba 73633ee3d1 Render Checkout/Cart containing pages without template overriding (https://github.com/woocommerce/woocommerce-blocks/pull/10359)
* Render Checkout/Cart containing pages without template overriding

* Fix checkout typo

---------

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-07-26 11:25:49 +01:00
Mike Jolley 025a280b33 Babel and Autoprefixer updates (https://github.com/woocommerce/woocommerce-blocks/pull/10341) 2023-07-26 10:58:17 +01:00
Karol Manijak e09962d65a Optimise imports of Product Query variation (https://github.com/woocommerce/woocommerce-blocks/pull/10340)
* Optimise imports of Product Query variation

* Lint: add whitespace
2023-07-26 11:08:01 +02:00
Alex Florisca 99e1f46281 Change stable version and changelog after release of 10.7.1 2023-07-26 09:53:27 +01:00
Hsing-yu Flowers 35760814d6 Add an endpoint for processing pay for order orders (https://github.com/woocommerce/woocommerce-blocks/pull/10287)
* Register order route

* Check authorization for getting the order

* Add order data to the response

* Add order schema for the endpoint

* Move validation check to order controller

* Add order item schema

* Check if the order is associated with current user

* Fix after rebase

* Add checkout order endpoint

* Add order authorization trait

* Allow to use the order update customer endpoint in dev build only

* Get both customer and guest details

* Remove duplicate function

* Update the cart update customer class doc block

* Remove duplicate order route

* Update documentation for feature flags

* Add checkout trait

* Remove checkout trait

* Update billing address and order

* Only allow checkout pending orders

* Create checout trait

* Use sanitize text field

* Extend from checkout schema

* Update response message

* Allow failed orders to be paid for

* Update authorization error message
2023-07-25 13:00:01 -07:00
Patricia Hillebrandt e29360642d Store Customization > Introduce the new Featured Products: Fresh & Tasty pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10339)
* Introduce the new Featured Products: Fresh & Tasty pattern.

* Update lettuce image.

* Update indentation.

* Make all strings translatable.

* Align all prices right

* Ensure text doesnt stack on mobile

* Update mobile display for the prices

* Update mobile display for the product names

* Remove the image id and the text styles
2023-07-25 17:11:11 +02:00
Patricia Hillebrandt 15db0701f2 Store Customization > Featured Category Triple pattern - Update the pattern to become wireframed (https://github.com/woocommerce/woocommerce-blocks/pull/10343)
* Remove custom font color from the cover block.

* Update indentation for the Featured Category Triple pattern.

* Update indentation for the third column

* Make all strings translatable.

* replate all paragraph blocks with a wp-block-heading

* Ensure the central text is also white

* replace the buttons with a paragraphs.

* Remove unnecessary styles from wp:column

* Remove more unnecessary styles from wp-block-cover

* Remove the has-text-color class and other unnecessary positioning styles

* Update headings from h4 to h3 and update the paragraph styles.

* Replate theme's has-base-color with has-white-color
2023-07-25 16:00:22 +02:00
Albert Juhé Lluveras c74e27d666 Remove opinionated styles from Alternating Image and Text pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10292)
* Remove opinionated styles from Alternating Image and Text pattern

* Vertically center all columns
2023-07-25 10:12:29 +02:00
Mike Jolley 8223e71085 Revert "Bump fast-xml-parser from 4.2.4 to 4.2.5 (https://github.com/woocommerce/woocommerce-blocks/pull/10136)"
This reverts commit 77ffa1fede.
2023-07-24 17:15:37 +01:00
Mike Jolley b0fca9482a Revert "Bump word-wrap from 1.2.3 to 1.2.5 (https://github.com/woocommerce/woocommerce-blocks/pull/10333)"
This reverts commit 70f174a5e1.
2023-07-24 17:14:37 +01:00
Mike Jolley 3b60cfcf08 Revert "Bump autoprefixer from 10.4.7 to 10.4.14 (https://github.com/woocommerce/woocommerce-blocks/pull/8794)"
This reverts commit 457700ff9d.
2023-07-24 17:13:24 +01:00
dependabot[bot] 70f174a5e1 Bump word-wrap from 1.2.3 to 1.2.5 (https://github.com/woocommerce/woocommerce-blocks/pull/10333)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.5.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.5)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 15:46:01 +01:00
Alexandre Lara f2d313d1a6 Add to cart form: Fix fatal error when missing `product` param in add_to_cart_redirect_filter (https://github.com/woocommerce/woocommerce-blocks/pull/10316)
* Transform product param optional in add_to_cart_redirect_filter method

* Remove unnecessary argument from add_to_cart_redirect_filter

* Remove mocked filter call

* Remove unnecessary argument from function docs
2023-07-24 11:45:40 -03:00
dependabot[bot] 457700ff9d Bump autoprefixer from 10.4.7 to 10.4.14 (https://github.com/woocommerce/woocommerce-blocks/pull/8794)
Bumps [autoprefixer](https://github.com/postcss/autoprefixer) from 10.4.7 to 10.4.14.
- [Release notes](https://github.com/postcss/autoprefixer/releases)
- [Changelog](https://github.com/postcss/autoprefixer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/autoprefixer/compare/10.4.7...10.4.14)

---
updated-dependencies:
- dependency-name: autoprefixer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 15:44:49 +01:00
dependabot[bot] 77ffa1fede Bump fast-xml-parser from 4.2.4 to 4.2.5 (https://github.com/woocommerce/woocommerce-blocks/pull/10136)
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 4.2.4 to 4.2.5.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v4.2.4...v4.2.5)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2023-07-24 15:21:59 +01:00
Alba Rincón a4233a957c Remove opinionated styles from pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10306) 2023-07-24 12:25:34 +02:00
Albert Juhé Lluveras ce16b98893 Fix SearchListControl styles (II) (https://github.com/woocommerce/woocommerce-blocks/pull/10308) 2023-07-24 11:30:54 +02:00
Alba Rincón b8f798b017 Use the `Single Product` block for the `Product Details Product Listing` pattern (https://github.com/woocommerce/woocommerce-blocks/pull/9978)
* Show alignment toolbar also when the block is in the single product block

* Start using `Single Product` for the `Product Details Product Listing` pattern

* Use counter and stars blocks in the pattern

* Undo button change

* Make the new rating blocks not experimental

* Add Beta to the average rating block

* Add blocks to block types controller
2023-07-24 11:02:24 +02:00
Roy Ho ef7b811e4b Remove border control (https://github.com/woocommerce/woocommerce-blocks/pull/10277) 2023-07-21 05:46:55 -07:00
Roy Ho 37e197c149 Move sale badge to top right of product image (https://github.com/woocommerce/woocommerce-blocks/pull/10297) 2023-07-21 05:45:09 -07:00
Roy Ho 84f2e47b14 Check if index element exists before using (https://github.com/woocommerce/woocommerce-blocks/pull/10300) 2023-07-21 05:44:16 -07:00
Niels Lange ebf4bef204 Add missing page titles in Cart and Checkout templates (https://github.com/woocommerce/woocommerce-blocks/pull/10281)
* Add missing page titles to the Cart and Checkout templates

* Adjust headline level

* Add i18n support for Cart and Checkout template titles

* Keep empty line between “wp:group” and “wp:template-part”

* Add empty line between “wp:template-part” and “wp:group”
2023-07-21 14:38:08 +02:00
Manish Menaria 6e10e2fbcb Product Collection - Add PHP unit tests (https://github.com/woocommerce/woocommerce-blocks/pull/10289)
* Add PHPUnit tests for the ProductCollection block type

This commit introduces PHPUnit tests for the ProductCollection block type. A new test file, `ProductCollection.php`, has been added under the `BlockTypes` directory within the tests. The test file sets up a mock instance of `ProductCollection` and verifies its behavior. Particularly, it tests the merging of on-sale queries, ensuring the results are as expected.

To assist in the testing, a new mock class, `ProductCollectionMock`, has been created under the `Mocks` directory. This class extends the `ProductCollection` block type and provides methods for setting parsed block data and attribute filter query arguments.

These tests should help ensure the correctness and reliability of the `ProductCollection` block type.

* Expand PHPUnit tests for ProductCollection block to cover stock status queries

This commit expands the existing PHPUnit tests for the ProductCollection block type to cover scenarios involving stock status queries. Specifically, a new test method, `test_merging_stock_status_queries`, has been added.

This method tests if the 'woocommerceStockStatus' attribute is correctly merged into the query parameters. It verifies that the stock status is correctly incorporated into the 'meta_query' array as part of the constructed query.

This addition enhances the coverage of our test suite, ensuring that the ProductCollection block behaves as expected in scenarios involving stock status queries.

* Add extensive testing for ProductCollection block's query merging

The following test methods were added:

1. `test_merging_default_stock_queries`: This tests the merging of default stock queries, verifying the absence of meta_query in certain conditions.

2. `test_merging_attribute_queries`: This tests the merging of attribute queries, ensuring the correct taxonomy and terms are used in the merged tax_query.

3. `test_merging_order_by_rating_queries` and `test_merging_order_by_popularity_queries`: These test the merging of order by queries, checking for the right orderby and meta_key in the merged query.

4. `test_product_visibility_query_exist_in_merged_query`: This tests if the product visibility query exists in the merged query.

This additional testing improves the reliability and coverage of our tests, ensuring the correct functionality of the ProductCollection block's query merging process.

* Add unit tests for merged queries in ProductCollection block

- Merging multiple queries
- Merging filter by max price queries
- Merging filter by min price queries
- Merging filter by min and max price queries
- Merging filter by stock status queries
- Merging filter by attribute queries
- Merging multiple filter queries

These tests use PHPUnit assertions to validate the correctness of the merged queries.

* Add tests for REST query modifications in ProductCollection block

This commit adds two new test cases and a helper method to the `ProductCollection` test class.

The helper method, `build_request()`, constructs a simplified `WP_REST_Request` object for testing purposes. This request object simulates a typical request from the ProductCollection block, including potential WooCommerce parameters such as 'woocommerceOnSale', 'woocommerceAttributes', and 'woocommerceStockStatus'.

The first new test, `test_updating_rest_query_without_attributes()`, tests the block's capability to modify a REST query that doesn't include any product attribute filters. It verifies that the correct '_stock_status' and 'product_visibility' parameters are set in the meta and tax queries respectively.

The second test, `test_updating_rest_query_with_attributes()`, does the same as the previous one but with the inclusion of a product attribute filter in the REST request. This test verifies that the block can handle REST queries with attribute filters correctly.

These tests improve coverage on the ProductCollection block's REST query handling, ensuring that it can merge different filter queries correctly.

* Add test for merging taxonomies query in ProductCollection block

This commit introduces a new test, `test_merging_taxonomies_query()`, in the `ProductCollection` test class.

The test simulates a situation where the block has to merge taxonomy queries related to product categories and tags. The parsed block attributes are configured to include 'product_cat' and 'product_tag' taxonomies with certain term IDs.

The test then asserts that the merged query correctly includes these taxonomies with the appropriate term IDs and 'include_children' set to false. This confirms that the block correctly merges taxonomy filters when building the final query.

* Fix failing test

* Try again

* Try again

* Remove test_merging_filter_by_attribute_queries test

This commit removes the `test_merging_filter_by_attribute_queries()` test from the `ProductCollection` test class.
2023-07-21 15:43:22 +05:30
Darren Ethier f708593adb Add Color Panel (https://github.com/woocommerce/woocommerce-blocks/pull/10062)
* Add new ColorPanel component

* Implement new ColorPanel component for the Mini-Cart

* Move ColorPanel types into their own types.ts file alongside the ColorPanel component

* Add useColorPanelStyles hook

* Rename classes to className

* Disable @wordpress/no-unsafe-wp-apis

* Fix tests: Move defaultColorItem object to utils file

* Remove unnecssary types from QuantityBadge

* Fix conflicts

* Remove context

* Fix color picker JS error

* Migrate attribute data to be compatible with ColorPanel component

* Fix incompatible attributes

* Remove useColorPanelStyles hook

* migrateAttributesToColorPanel JS unit tests

* PHP MiniCartUtils tests

* Remove unncessary code for classNames in MiniCart edit

---------

Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
2023-07-21 10:35:32 +01:00
Alba Rincón aee01c5f9e Update the `Footer with 3 menus` pattern to have no opinionated styles (https://github.com/woocommerce/woocommerce-blocks/pull/10294)
* Remove opinionated styles from pattern

* Make search strings translatable
2023-07-21 10:53:40 +02:00
Albert Juhé Lluveras d248d62db1 Add Mini-Cart block Playwright e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/9757)
* Add Mini-Cart block Playwright e2e tests

* Verify tests fail

* Revert "Verify tests fail"

This reverts commit 47f666657d8a37bb486a4510ece44fd4d82c031d.

* Fix permalink-settings test
2023-07-21 09:44:01 +02:00
Karol Manijak 7018ff47b6 Add manual path to upgrade Products block (https://github.com/woocommerce/woocommerce-blocks/pull/10268)
* Add option to manually update Products block to Product Collection

* Disable manual upgrade of Products yet

* Manual update flag doesn't have to be dependant on auto update

* Removed commented out console info logs

* Disable option to upgrade Products block

* Change the way to bold text in Upgrade Notices so it's translatable

* Change the way UpgradeNotice is rendered conditionally
2023-07-21 08:22:49 +02:00
Albert Juhé Lluveras c763f39cd4 Update 10.6.0 testing steps to specify that Gutenberg is required to test woocommerce/woocommerce-blocks#9647 (II) 2023-07-20 14:38:37 +02:00
Alba Rincón 8299771b06 Update the `Testimonials Single` pattern to have no opinionated styles (https://github.com/woocommerce/woocommerce-blocks/pull/10275)
* Testimonials Single pattern - Update the pattern to become wireframed

* Use the correct function for translating strings
2023-07-20 14:34:01 +02:00
Alexandre Lara f6b84e02e2 Add to Cart Form: Fix broken styles for the block when using inside the Single Product Block (https://github.com/woocommerce/woocommerce-blocks/pull/10282)
* Fix broken styles for Add to Cart Form block

* Fix PHP CS error
2023-07-20 09:28:15 -03:00
Albert Juhé Lluveras 0302f5a878 Update 10.6.0 testing steps to specify that Gutenberg is required to test woocommerce/woocommerce-blocks#9647 2023-07-20 14:23:59 +02:00
Alexandre Lara b8fa7b7e9f Update versions 2023-07-20 08:49:11 -03:00
Alexandre Lara 5ea4295df9 Update changelog and testing notes for release 10.7.0 2023-07-20 08:49:11 -03:00
Brian d46997a84f fix woocommerce/woocommerce-blocks#10027 (https://github.com/woocommerce/woocommerce-blocks/pull/10150) 2023-07-20 04:40:40 -07:00
Hsing-yu Flowers 26f1a59378 Add an endpoint for getting pay for order orders (https://github.com/woocommerce/woocommerce-blocks/pull/8960) (https://github.com/woocommerce/woocommerce-blocks/pull/10199)
* Register order route

* Get order it

* Add order schema

* Check authorization for getting the order

* Add order data to the response

* Add order schema for the endpoint

* Move validation check to order controller

* Update the error codes

* Add order item schema

* Check if the order is associated with current user

* Update order schema to match cart schema

* Update order item schema to match cart item schema

* Add product item trait

* Update sold individually property

* Allow guests to pay for order

* Update wording for logged out customers

* Allow getting all orders from the endpoint

* Add inline explanation for pay_for_order capability

* Remove unused $user_id and $order variables

* Remove duplicate pay_for_order capability check from validate_order_key

* Update exception wording when missing order id or key, or user mismatch

* Ensure $order_key is not null to avoid fatal error when left blank

* Resolve linting errors in order route class

* Adjust order ID description

* Create an abstract item schema

* Remove unused properties

* Remove unused properties

* Add billing email validation

* Allow to use the order endpoint in dev build only

* Add order status property

* Fix coupon and fee handling

* Update documentation for feature flags

* Update typo in total fees tax

* Update typo in tax lines

* Add missing payment methods to cart response

---------

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-07-19 06:49:46 -07:00
Roy Ho 537c1070ce Update 1060.md (https://github.com/woocommerce/woocommerce-blocks/pull/10274) 2023-07-19 06:31:18 -07:00
Albert Juhé Lluveras f22c462d5f Remove opinionated styles from Hero Product 3 Split pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10260)
* Remove opinionated styles from Hero Product 3 Split pattern

* Make strings in Hero Product 3 Split pattern translatable
2023-07-19 14:38:12 +02:00
Patricia Hillebrandt 2ca0a113da Store Customization > Hero Product Split pattern - Update the pattern to become wireframed (https://github.com/woocommerce/woocommerce-blocks/pull/10270)
* Remove opinionated styles from the Hero Product Split pattern.

* Remove additional has-text-color and has-background
2023-07-19 14:21:41 +02:00
Alba Rincón 0b81176d3b Remove styles from `Newest arrivals` pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10256)
* Remove styles from `Newest arrivals` pattern

* Remove id

* Replace row with columns to be able to stack blocks on mobile

* Make string translatable

* Make button string translatable
2023-07-19 13:24:32 +02:00
Alba Rincón afecefbdf3 Remove styles from the `Testimonials 3 cols` pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10258)
* Remove styles from the `Testimonials 3 cols` pattern

* Make strings translatable
2023-07-19 13:24:21 +02:00
Mike Jolley 464d5b4385 Prepend CSS src with correct url scheme (https://github.com/woocommerce/woocommerce-blocks/pull/10240)
* Prepend src with correct url scheme

* set_url_scheme
2023-07-19 11:23:25 +01:00
Patricia Hillebrandt e1222b8033 Remove opinionated styles from the Minimal Header pattern. (https://github.com/woocommerce/woocommerce-blocks/pull/10227) 2023-07-19 12:05:44 +02:00
Mike Jolley bd537e1008 Get latest cart when triggering events (https://github.com/woocommerce/woocommerce-blocks/pull/10254) 2023-07-19 10:42:25 +01:00
Patricia Hillebrandt f017fbe1b1 Remove opinionated styles from the Centered Header Menu with Search pattern. (https://github.com/woocommerce/woocommerce-blocks/pull/10226) 2023-07-19 11:35:35 +02:00
Alba Rincón 5eef9bff65 Add new `Product Average Rating` block (https://github.com/woocommerce/woocommerce-blocks/pull/10207)
* Add new Product Average Rating block

* Add new blocks to the feature flag docs

* Translate 'No ratings'

* Fix condition

* Small improvements after review

* Avoid duplication of styles

* Update supports in php class
2023-07-19 11:21:30 +02:00
Karol Manijak 67dbd22dfe Fix incorrect filter application in Product Collection (https://github.com/woocommerce/woocommerce-blocks/pull/10263)
* Fix the incorrectly applied filter in Product Collection

* Get the block name from metadata
2023-07-19 11:15:37 +02:00
Albert Juhé Lluveras e38c33c2de Remove opinionated styles from Product Hero pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10255) 2023-07-19 11:14:11 +02:00
Manish Menaria 1ea6355a04 Enable auto-expand for product selection in HandPickedProductsControl (https://github.com/woocommerce/woocommerce-blocks/pull/10250)
This commit adds a new `__experimentalExpandOnFocus` attribute to the component within the `HandPickedProductsControl`. The value is set to `true`, enabling automatic expansion of the list when the user focuses on the product selection field.

This change aims to improve the user experience by making it easier for the user to see all available options when they focus on the selection list.
2023-07-19 12:07:24 +05:30
Albert Juhé Lluveras 4e68edff91 Remove work-around code in EditableButton component to fix typing Space (https://github.com/woocommerce/woocommerce-blocks/pull/10248) 2023-07-18 18:04:50 +02:00
Roy Ho cd666ee081 Add class specificity to fix indent (https://github.com/woocommerce/woocommerce-blocks/pull/10245) 2023-07-18 06:21:13 -07:00
Albert Juhé Lluveras f43ced978b Remove Featured Category Cover Image pattern (https://github.com/woocommerce/woocommerce-blocks/pull/10252)
* Remove Featured Category Cover Image pattern

* Remove Featured Category Cover Image pattern image
2023-07-18 15:10:53 +02:00
Thomas Roberts 9e686e0a71 Update changelog and testing notes after release 10.6.1 2023-07-18 11:12:11 +01:00
Albert Juhé Lluveras bf20e670dd Create Mini-Cart template part area (https://github.com/woocommerce/woocommerce-blocks/pull/10203)
* Create Mini-Cart template part area

* Update Mini-Cart template part name to exclude it

* Update src/BlockTemplatesController.php

Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>

* Update src/BlockTemplatesController.php

Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>

* Keep both variations of the template part name when excluding them

* Revert "Keep both variations of the template part name when excluding them"

This reverts commit c3f293511536d1ebbac0f50caaf74cded28d0025.

---------

Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
2023-07-18 09:12:43 +02:00
Karol Manijak 333c850567 Newest Products: fix Stock Status filter (https://github.com/woocommerce/woocommerce-blocks/pull/10201)
* Newest Products: fix Stock Status filter

* Change the default of Product Stock Control to ALL available stock statuses
2023-07-18 08:39:09 +02:00
Thomas Roberts 5b6fde512e Update changelog and testing notes after release 10.4.6 2023-07-17 19:35:13 +01:00
Mike Jolley ac1d7a251e Replace sanitization functions to enforce string values (https://github.com/woocommerce/woocommerce-blocks/pull/10242) 2023-07-17 08:47:25 -07:00
Seghir Nadir 23cb8fe320 Don't send headers early in Store API (https://github.com/woocommerce/woocommerce-blocks/pull/10241) 2023-07-17 16:16:02 +01:00
Albert Juhé Lluveras 42db1bb4ab Remove opinionated font sizes from Essential Header patterns (https://github.com/woocommerce/woocommerce-blocks/pull/10219)
* Remove opinionated styles from Essential Header pattern

* Remove opinionated font sizes from Essential Header Dark pattern
2023-07-17 14:49:00 +02:00
Seghir Nadir 0eab61f93f Merge pull request from GHSA-gxfx-93xq-pr6p
* Add cors check

* refactor logic

* Refactor add_cors_headers to allow null and allowed hosts

* Move remove_filter inline

* Revert unrelated code style changes

* Add explainer to docblock

* Remove access for null origin

* Move CORS handling to auth class so it applies API wide

* Move only Authentication to priority 11

* Handle preflight requests so cart-tokens work

---------

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-07-17 12:51:34 +01:00
Karol Manijak 3f7284f978 Remove unused variables from ProductImage.php (https://github.com/woocommerce/woocommerce-blocks/pull/10213) 2023-07-17 11:51:46 +02:00
Daniel Dudzic 2412e9dadb Mini Cart: Remove deprecated print_inline_script() (https://github.com/woocommerce/woocommerce-blocks/pull/10165)
* Mini Cart: Replace the deprecated print_inline_script() with supported get_inline_script_data(). Fixes woocommerce/woocommerce-blocks#10004

* Mini Cart: Add version check for the new get_inline_script_data() function

* Update the variable names and fix a typo

* Mini Cart: Add regex to check for the WP version

* Abstract the WP version comparison regex to a separate Utils class
2023-07-14 23:22:34 +00:00
Daniel Dudzic e5b4bdf3a5 Product Gallery Large Image: Add the php experimental flag (https://github.com/woocommerce/woocommerce-blocks/pull/10158) 2023-07-14 16:31:12 -03:00
Albert Juhé Lluveras 55a6e38598 Prevent Mini-Cart template part preview in Site Editor being too high (https://github.com/woocommerce/woocommerce-blocks/pull/10204)
* Prevent Mini-Cart template part preview in Site Editor being too high

* Remove Mini-Cart Contents styles related to Style Book
2023-07-14 16:12:40 +02:00
Albert Juhé Lluveras a3ac0e2c62 Fix SearchListControl styles (https://github.com/woocommerce/woocommerce-blocks/pull/10192)
* Fix SearchListControl checkbox styles

* Encode SearchListControl labels

* Fix SearchListControl styling

* Update snapshots
2023-07-14 13:50:23 +02:00
Daniel Dudzic 2240504d51 Mini Cart: Fix styling of the Start Shopping button in the drawer. Fixes woocommerce/woocommerce-blocks#10035 (https://github.com/woocommerce/woocommerce-blocks/pull/10169) 2023-07-14 11:47:23 +00:00
Luigi Teschio 9e9425b092 fix migration (https://github.com/woocommerce/woocommerce-blocks/pull/10205) 2023-07-14 11:16:06 +00:00
Karol Manijak 041d4ad4b1 Stop reading Product IDs from asset store in filter blocks (https://github.com/woocommerce/woocommerce-blocks/pull/10195)
* Remove queries that fetch all products for manipulating the results returned by the Store API for certain use-cases.

* Remove the code that's supposed to read product ids for filter context and logic around that in useCollectionData

* Fix incorrect merge

---------

Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
2023-07-14 11:18:10 +02:00
Patricia Hillebrandt 53668eb066 Product Filters > Fix Performance issue and Fatal error on stores with a high volume of products (https://github.com/woocommerce/woocommerce-blocks/pull/10198)
* Remove queries that fetch all products for manipulating the results returned by the Store API for certain use-cases.

* Keep support for Product Collection block
2023-07-14 10:34:55 +02:00
Alba Rincón 3d8331363c `Rating Stars` block improvements (https://github.com/woocommerce/woocommerce-blocks/pull/10148)
* Rating start block improvements

Fix classes, register in single product, remove unused code

* Allow to use block on product & product collection

* Fix star missalignment

* Restrict the block to be insertable only in single product
2023-07-14 09:41:58 +02:00
Alba Rincón d82a4b671f Add new `Ratings counter` block (https://github.com/woocommerce/woocommerce-blocks/pull/10114)
* Add new rating counter block

* Fix colors and register globally

* Add missing import

* Remove unused file

* Reorder blocks alphabetically

* Remove unnecessary html

* Change registration, fix classes

* Fix margin

* Remove icon from block.json, add ancestors

* Move icon and remove unused constants

* Fix classes

* Remove condition

* Allow to use block on product & product collection

* Enable block only on single product

* Move ancestors to block.json
2023-07-14 08:57:19 +02:00
Manish Menaria bd892c4781 Add E2E tests for 'Inherit query from template' control in Product Collection block (https://github.com/woocommerce/woocommerce-blocks/pull/10174)
Key updates:

1. Additional CSS class to Inherit Query Control: A CSS class named `wc-block-product-collection__inherit-query-control` has been added to the ToggleControl component. This provides a precise target for E2E tests and potential custom styles.

2. E2E tests for 'Inherit query from template' control: Numerous scenarios have been covered to ensure the control's correct behavior. These scenarios include verifying visibility under different circumstances and checking its functionality in a Product Catalog template.

3. E2E test code enhancements: The E2E test code now exports the `SELECTORS` object to assist in locating different elements during the tests. This includes the new 'Inherit query from template' control. The `setShowOnlyProductsOnSale()` function has been refactored to improve readability and provide more granular control over its operations.

4. Test scenario for 'Show only products on sale': The existing E2E test for this functionality has been extended to check that it retains its state when the 'Inherit query from template' control is toggled.

These changes increase the robustness of our E2E tests, providing better coverage for the 'Inherit query from template' control in the Product Collection block.
2023-07-14 10:52:19 +05:30
Bernie Reiter 1aaf7384d2 README: Update required Node version to 16.15, add note on version management tools (https://github.com/woocommerce/woocommerce-blocks/pull/10175)
* README: Set required Node version to v16.15

* Add note about Node version management tools.
2023-07-12 18:10:13 +02:00
Karol Manijak de0cc88147 Automatic migration path from Products to Product Collection - step 3 - allow reverting migration (https://github.com/woocommerce/woocommerce-blocks/pull/10144)
* Add logic to revert migration from Product to Product Collection
2023-07-12 17:01:49 +02:00
Alex Florisca 52506cbe81 Fix margin issue with the Proceed to checkout button on the site editor (https://github.com/woocommerce/woocommerce-blocks/pull/10182)
* Fix margin issue with the Proceed to checkout button on the site editor

* Remove unecessary selector
2023-07-12 15:28:37 +01:00
Patricia Hillebrandt 64405c7a43 Mini Cart block > Update block registration to rely on a metadata file. (https://github.com/woocommerce/woocommerce-blocks/pull/10168)
* Introduce the block.json file for the mini-cart block.

* Update the index.tsx file to use the new metadata file for registering the mini cart.
2023-07-12 16:20:19 +02:00
Darren Ethier 2efe99126f Account for classic theme support of template parts (https://github.com/woocommerce/woocommerce-blocks/pull/9780)
* allow for handling classic theme template part support

Note this logic is currently not right - just a quick implementation for testing POC

* Account for classic theme support of template parts

* Update supports_block_templates signature so it accepts the template type instead of a bool

* Simplify logic in supports_block_templates

* Test

* Fix supports_block_templates check to test correct template type

---------

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2023-07-12 15:51:30 +02:00
Karol Manijak dbfa57bd67 Automatic migration path from Products to Product Collection - step 2 - display notice (https://github.com/woocommerce/woocommerce-blocks/pull/10139)
* Display upgrade notice after successful replacement
2023-07-12 11:19:35 +02:00
Karol Manijak 9b0c610ced Automatic migration path from Products to Product Collection - step 1 - automatic migration (https://github.com/woocommerce/woocommerce-blocks/pull/10115)
* Foundation of the Products block replacement with Product Collection

* Provide logic to replace Products with Product Collection

* Make sure the blocks can be replaced

* Add types and refactor replacement a bit

* Fix the query attributes transform

* Add upgrade Notice to the Product Collection block

* Force upgrade notice to be displayed at the top of the Inspector Controls

* Externalise migration code so it can be reused in both ways

* Add util to get block IDs byt its name

* Add a way to revert the Product Collection blocks to Products

* Move the subscription to another place where it's triggered only once

* Add default values

* Remove attributes from Products block if they're not used to avoid incorrect query

* WIP logic of unseen/seen/reverted notice

* Change the state reading

* Revert changes regarding notice displaying logic

* Change the logc of firing replacement and bail early if there's no core/query blocks

* Add todos

* Implement inner blocks migration

* Implement the revert transformation of inner blocks

* Refactor types

* Add layout transformation from Products to Product Collection

* Add layout migration from Product Collection to Products

* Disable migration by default

* Simplify some parts of code

* Remove additional keyword from Product Collection to move it to another PR

* Adjust the logic to introduce the first step: conversion from Products to Product Collection

* Disable automatic migration
2023-07-12 10:01:36 +02:00
Luigi Teschio 98a61d3a4d Enable declaration-block-no-duplicate-properties stylelint rule (https://github.com/woocommerce/woocommerce-blocks/pull/10163) 2023-07-11 13:03:05 +00:00
Karol Manijak d7d550f983 Product Collection - check the value before consuming it to avoid frontend warning (https://github.com/woocommerce/woocommerce-blocks/pull/10162) 2023-07-11 14:40:15 +02:00
Luigi Teschio 45d994d47f Revert "Fix image over content (https://github.com/woocommerce/woocommerce-blocks/pull/10092)" (https://github.com/woocommerce/woocommerce-blocks/pull/10160)
This reverts commit b82c0de69d.
2023-07-11 12:16:12 +00:00
DAnn2012 edd3588ef2 Fix minimum required PHP version in readme.txt file (https://github.com/woocommerce/woocommerce-blocks/pull/10085) 2023-07-11 14:04:57 +02:00
Niels Lange 73f1ebf605 Return null or object for ImageAttachmentSchema response (https://github.com/woocommerce/woocommerce-blocks/pull/9962)
* Return null or object for ImageAttachmentSchema response

* Adjust docblock

* Update unit tests for ImageAttachmentSchema
2023-07-11 13:43:58 +02:00
Karol Manijak c55343b736 Product Collection - refactor inspector controls props (https://github.com/woocommerce/woocommerce-blocks/pull/10154)
* Refactor Columns Control inspector controls in Product Collection

* Refactor Order By inspector controls in Product Collection

* Reorder imports in Product Collection Inspector Controls

* Refactor On Sale inspector controls in Product Collection

* Refactor Stock Status inspector controls in Product Collection

* Refactor Keyword inspector controls in Product Collection

* Unify interface of query controlling Inspector Controls

* Unify interfaces of Inspector Controls that modify Query in Product Collection

* Unify other Query modifying Controls

* Simplify types
2023-07-11 13:05:49 +02:00
Manish Menaria d4c3d43f9d Product Collection - Add more E2E tests (https://github.com/woocommerce/woocommerce-blocks/pull/10090)
* Add E2E tests for category-based product filtering

This commit refactors the product filtering in the product collection E2E tests and adds the ability to filter products based on their category.

Changes:
1. The method `setHandpickedProducts` was renamed to `setFilterComboboxValue` to reflect the fact that it's now used for more than just handpicked products. This method is now used to set the values of different filters.
2. The `addFilter` method was extended to support the 'Show Taxonomies' filter. It also includes a delay to ensure the correct rendering of the UI before further interactions.
3. A new test was added for filtering products based on their category using the 'Show Taxonomies' filter.
4. The tests for filtering products by handpicked selection and keyword were updated to use the new `setFilterComboboxValue` method.

These changes improve the robustness of the E2E tests and increase their coverage by including category-based filtering.

* Add product attribute filters to end-to-end tests

- A new test case has been added in the `product-collection.block_theme.spec.ts` to test the functionality of filtering products based on their attributes like color and size. This is done using the `addFilter` and `setProductAttribute` methods.

- Additionally, the `addFilter` method in `product-collection.page.ts` has been updated to include the 'Show Product Attributes' filter.

- A new method `setProductAttribute` has been introduced to set the attribute value which will trigger the filter action.

These updates enhance the test coverage by verifying the functionality of product attribute filters in the product collection.

* Add responsiveness test for product collection block

This commit introduces a new end-to-end test to ensure that the product collection block responds correctly to changes in screen size.

The new test in `product-collection.block_theme.spec.ts` verifies that the number of product columns adjusts as expected for different viewport sizes. In the initial viewport size, the width of a product should be less than the parent width as multiple columns are expected. When the viewport size is reduced, the product width should be approximately equal to the parent width, indicating a single column layout.

These changes provide more robust testing of the product collection block's responsiveness, helping to ensure a consistent user experience across different device sizes.

* Refactor product assertions and add setViewportSize method in ProductCollection tests

This commit refactors the Product Collection tests to enhance test readability and consistency. It switches the product count checks from `productImages` to `products` which is more semantically correct.

Additionally, a new method `setViewportSize` has been added in the `ProductCollectionPage` class for adjusting the viewport size in the tests.

- Changed product count assertions to use `products` instead of `productImages`
- Added `setViewportSize` method to `ProductCollectionPage`
- Updated existing tests to use the newly added `setViewportSize` method

* Add test case for product filtering based on stock status in Product Collection tests

This commit adds a new test case in the Product Collection suite to test product filtering based on their stock status. The test case checks if the filter for 'Out of stock' status works correctly.

Note: This test case is currently commented out because there are no products with 'Out of stock' status in the test data. The assertions will need to be uncommented once the test data includes 'Out of stock' products.

* Add new test case for toolbar settings

This commit does two main things:

1) Adds a new test case under 'Toolbar settings' to test 'Items per page', 'offset' & 'max page to show' settings in the product collection block.

2) It extends the ProductCollectionPage class to add methods for setting display settings and for handling pagination. It also defines a new 'pagination' locator to find the pagination navigation on the page.

This update will allow us to more effectively test the behavior of the product collection block when dealing with large collections and pagination. Note: the 'Product can be filtered based on stock status' test has been marked as skipped until there are products with 'Out of stock' status in the test data.

* Refactor e2e test files for Product Collection

Changes in `product-collection.block_theme.spec.ts`:
- Marked the test 'Products can be filtered based on category' as a 'fixme'. This test is currently failing due to a bug in the product collection block.

Changes in `product-collection.page.ts`:
- Reorganized constant block data into a more extensive set of selectors.
- Introduced a new method `locateSidebarSettings` to locate the sidebar settings region, improving readability and reusability.
- Used the new method `locateSidebarSettings` in various places where settings values are being set.
- Refactored other methods to better locate elements based on the reorganized selectors.
- Adjusted the product-related locators to rely on these newly defined selectors.

* Fix: Frontend Category Filtering in Product Collection Block (https://github.com/woocommerce/woocommerce-blocks/pull/10132)

* Fix: Product collection - Product category filter isn't working on frontend

* Remove fixme from test

* Refactor variables names
2023-07-11 16:05:29 +05:30
Alexandre Lara 3f97a61a38 Update experimental flags 2023-07-10 11:50:05 -03:00
Alexandre Lara 052d21259b Add php experimental flag for Product Gallery block (https://github.com/woocommerce/woocommerce-blocks/pull/10141) 2023-07-10 11:40:12 -03:00
Karol Manijak fd378be6eb Add "grid" and "list" view switch for Product Collection (https://github.com/woocommerce/woocommerce-blocks/pull/10145)
* Add Display Layout controls to Product Collection

* Adjust the layout type name

* Add explicit display layout types

* Change the function name to setDisplayLayout so it's more explicit

* Pass only the necessary props to nested inspector controls

---------

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
2023-07-10 13:39:09 +02:00
Manish Menaria 708ed47a85 Enhance: Bring back user to 1st page when filters are changed (https://github.com/woocommerce/woocommerce-blocks/pull/9952)
* Add support for filter blocks

This commit updates the `ProductCollection` block implementation to add support for filter blocks, including the Price filter, Attributes filter, Rating filter, and In stock filter.

The changes include:

1. Adding a new property `$attributes_filter_query_args` to store the query arguments related to the filter by attributes block.

2. Adding a new method `add_support_for_filter_blocks()` to enable support for filter blocks. This method sets the necessary asset data to enable filtering and refreshes the page when a filter is applied.

3. Adding new methods to handle specific filter queries, including `get_filter_by_price_query()`, `get_filter_by_attributes_query()`, `get_filter_by_stock_status_query()`, and `get_filter_by_rating_query()`. These methods generate the respective queries based on the applied filters.

4. Refactoring the `get_final_query_args()` method to include the newly added filter queries using the `get_queries_by_applied_filters()` method.

These changes enhance the functionality of the `ProductCollection` block by allowing users to filter products based on price, attributes, rating, and stock status.

* Go to first page when filters are updated

* Enhance ProductCollection block to support filter blocks

This commit enhances the ProductCollection block to support various filter blocks such as Price filter block, Attributes filter block, Rating filter block, and In stock filter block.

The `build_query` method has been refactored into two separate methods: `build_frontend_query` and `get_final_frontend_query` to make the code more modular and readable. The `add_support_for_filter_blocks` method has been modified to support the generation of product IDs for filter blocks.

The method `update_rest_query` has been renamed to `update_rest_query_in_editor` for better clarity and understanding of its function. Similarly, `get_final_query_args` has been refactored to include the `$is_exclude_applied_filters` parameter which helps in generating product IDs for the filter blocks.

Moreover, the filter hook `pre_render_block` has been added to support the filtering of blocks before they are rendered.

This update will enhance the user experience by providing more filtering options in the ProductCollection block.

* Remove changes related to redirect to 1st page

* Go to first page when filters are updated

This commit refactors the changeUrl function in the `filters.ts` file. The purpose of this refactor is to remove the page number from the URL whenever filters are changed. This ensures that the user is always taken to the first page of results.

The commit includes the following changes:
- Added comments explaining the different page number formats in the URL.
- Updated the `newUrl` parameter by removing the page number using regular expressions.
- The page is then reloaded with the updated URL using `window.location.href`.

These changes improve the URL handling in the `changeUrl` function and enhance the user experience when interacting with filters.

* Optimize URL updates to prevent unnecessary page reloads

This commit optimizes the `changeUrl` utility function to prevent unnecessary page reloads.

Changes:
1. It checks if there are no query parameters in the URL and the URL ends with a '?'.
2. If these conditions are met, it removes the trailing '?' from the URL.

The reason for this change is that a '?' in the URL typically indicates that query parameters will follow. If there are no query parameters, the '?' is unnecessary and can cause the page to reload, which can negatively affect performance. Therefore, by removing the '?', we prevent this unnecessary page reload.

* Simplify trailing '?' removal in URL handling

This commit simplifies the removal of trailing '?' characters from URLs.
The previous implementation checked if there were any query parameters
before removing a trailing '?'.

However, upon review, it was determined that this check was unnecessary,
as a trailing '?' could be removed safely even if query parameters were
present, without any negative impact.

This change simplifies the code and prevents unnecessary computation
checking for the existence of query parameters.
2023-07-10 11:34:11 +05:30
Karol Manijak bf157c5996 Add additional Products (Beta) keyword to Product Collection so it appear next to Products in the inserter (https://github.com/woocommerce/woocommerce-blocks/pull/10112) 2023-07-07 15:50:29 +02:00
Thomas Roberts 074a502612 Regenerate composer.lock after release 2023-07-07 13:52:26 +01:00
Thomas Roberts a214bd6f6c Bump versions post-release. 10.7.0-dev 2023-07-07 12:14:02 +01:00
Thomas Roberts 516238df96 Bump versions, readme, changelog, and testing notes 2023-07-07 12:12:56 +01:00
Alba Rincón 3309fb309e Adjust `Banner` padding to improve mobile experience (https://github.com/woocommerce/woocommerce-blocks/pull/10107) 2023-07-07 11:49:47 +02:00
Patricia Hillebrandt 6ea6687144 Call wc_setup_product_data if the global product variable is not an instance of WC_Product. (https://github.com/woocommerce/woocommerce-blocks/pull/10128) 2023-07-07 11:40:46 +02:00
Alba Rincón 5a9b13295a Fix image to avoid overlapping on mobile devices (https://github.com/woocommerce/woocommerce-blocks/pull/10108) 2023-07-07 08:26:34 +02:00
Albert Juhé Lluveras cc0cf1a905 Load product-query stylesheet when rendering the Products block (https://github.com/woocommerce/woocommerce-blocks/pull/10109)
* Load product-query stylesheet when rendering the Products block

* Simplify code
2023-07-06 17:16:33 +02:00
Daniel Dudzic f6a4b3c143 Product Gallery: Add Large Image inner block (https://github.com/woocommerce/woocommerce-blocks/pull/10045)
* Product Gallery: Add an new block base code

* Product Gallery: Add experimental flag

* Product Gallery: Add Large Image block code

* Product Gallery Large Image: Remove unsed types

* Product Gallery: Move the block from registerBlockType to registerBlockSingleProductTemplate

* Product Gallery: Update icon

* Product Gallery: Add missing icon import

* Product Gallery Large Image: Add experimental mode check

* Product Gallery Large Image: Deregister unnecessary block settings

* Product Gallery Large Image: Add experimental flag to the Product Gallery Large Image and remove the icon override

* Product Gallery Large Image: Add zoom and correct styling

* Product Gallery Large Image: Remove commented out unnecessary code

* Product Gallery Large Image: Re-add the removed action after capturing the large image html

* Product Gallery Large Image: Update Large Image icon and description. Move metadata to the block.json file.
2023-07-06 15:08:39 +00:00
Albert Juhé Lluveras ad973e9b46 Fix Filter blocks e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/10116)
* Revert "fix save method"

This reverts commit f6623c55320bf55ee7fa3c23eb294f06d79ee4a5.

* Revert "Revert "fix save method""

This reverts commit 739db2e3b0b62e10fbe1ebabd1ec6bbae8425b3c.

* Update Filter by Attribute and Filter by Stock e2e test fixtures

* Update Filter by Attribute 'can hide product count' test
2023-07-06 16:39:19 +02:00
Alba Rincón 3ccfec1eee Fix `Product Rating` styles & alignment (https://github.com/woocommerce/woocommerce-blocks/pull/10097)
* Fix alignment not working on the editor

* Fix style regression on rating
2023-07-06 09:25:29 +02:00
Roy Ho 5c72cfdb4d Update/fixtures html (https://github.com/woocommerce/woocommerce-blocks/pull/10080)
* Remove data attributes from fixture for active filters

* Remove data attributes from fixture for filter by price

* Remove data attributes from fixture for filter by attribute

* Remove data attributes from fixture for filter by stock
2023-07-05 06:16:36 -07:00
Mike Jolley 599274e3d6 Fix cart and checkout conditionals when using a block based theme and templates (https://github.com/woocommerce/woocommerce-blocks/pull/10098)
* Update conditionals to deal with templates instead of cart/checkout page objects

* Include notice style in main entrypoint
2023-07-05 04:02:27 -07:00
Karol Manijak 283dfc652f Add feedback form to the Product Collection block (https://github.com/woocommerce/woocommerce-blocks/pull/10079)
* Add feedback form to the Product Collection block

* Change the airtable link to the new one related to Product Collection
2023-07-05 10:34:25 +02:00
Alba Rincón b82c0de69d Fix image over content (https://github.com/woocommerce/woocommerce-blocks/pull/10092) 2023-07-05 10:30:20 +02:00
Luigi Teschio 78d320bc47 Products block: Improve stability E2E tests (https://github.com/woocommerce/woocommerce-blocks/pull/10075) 2023-07-05 07:45:38 +00:00
Luigi Teschio 7ca65db5b0 Fix filter count display toggle (https://github.com/woocommerce/woocommerce-blocks/pull/10096)
* fix save method

* improve check

* Only display counts if showCounts is true

---------

Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2023-07-05 08:51:02 +02:00
Tarun Vijwani 6b8e4c38e0 Fix notice banner links for Legacy notices (https://github.com/woocommerce/woocommerce-blocks/pull/9996) 2023-07-04 04:16:26 -07:00
Albert Juhé Lluveras df3ff6793e Per block stylesheets (https://github.com/woocommerce/woocommerce-blocks/pull/9831)
* Clean up blank lines

* Update Webpack config

* Update PHP logic to load block styles

* Style fixes

* Style fixes (II)

* Style fixes (III)

* Style fixes (IV)

* Fix missing stylesheets in the Site Editor

* Fix wrong return values in some PHP method docs

* Fix missing ProductPrice stylesheet causing 404 in tests

* Fix missing ProductGallery stylesheet causing 404 in tests
2023-07-04 13:06:48 +02:00
Paulo Arromba 50aee9846b Render Checkout on Pay for Order for FSE themes with checkout flow templates (https://github.com/woocommerce/woocommerce-blocks/pull/10076)
* Render Checkout on Pay for Order for FSE themes with checkout flow templates.
Few typos corrected

* Render Checkout on Pay for Order for FSE themes with checkout flow templates.
Few typos corrected

* Backup and restore notices so they display on the pay page still

* Cache and restore notices during hydration to avoid breaking real notices on pages/shortcodes

---------

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-07-04 11:34:24 +01:00
Alba Rincón 25a5737ec7 Fix image not rendering on the editor and empty styles (https://github.com/woocommerce/woocommerce-blocks/pull/10089) 2023-07-04 11:02:35 +02:00
Mike Jolley d6037a2efb Check for gutenberg_render_block_core_template_part (https://github.com/woocommerce/woocommerce-blocks/pull/10078) 2023-07-03 15:43:24 +01:00
Daniel Dudzic 3700c1c42d Product Gallery: Add an new block base code (https://github.com/woocommerce/woocommerce-blocks/pull/9937)
* Product Gallery: Add an new block base code

* Product Gallery: Add experimental flag

* Product Gallery: Move the block from registerBlockType to registerBlockSingleProductTemplate

* Product Gallery: Update icon
2023-07-03 14:21:31 +00:00
Roy Ho 48f7a9fdda Remove attributes data from save function for active filters (https://github.com/woocommerce/woocommerce-blocks/pull/10047) 2023-07-03 06:52:31 -07:00
Roy Ho f8cf9fe97a Remove attributes data from save function for filter by price (https://github.com/woocommerce/woocommerce-blocks/pull/10039) 2023-07-03 05:39:45 -07:00
Luigi Teschio aa48386834 Mark order confirmation template E2E test as flaky (https://github.com/woocommerce/woocommerce-blocks/pull/10041) 2023-07-03 12:26:47 +00:00
Niels Lange 0b01b8c60d Remove the word ‘beta’ from the compatibility notice (https://github.com/woocommerce/woocommerce-blocks/pull/10019)
* Remove the word ‘beta’ from the compatibility notice

* Optimise wording
2023-07-03 12:56:12 +02:00
Daniel Dudzic 8cacfce738 Rating: Fix TS error (https://github.com/woocommerce/woocommerce-blocks/pull/10001) 2023-07-03 10:50:06 +00:00
Alba Rincón b1bc51e3f0 Add new `Product Rating Stars` block (https://github.com/woocommerce/woocommerce-blocks/pull/10005)
* Add new `Product Rating Stars` block

* Make block experimental

* Fix dep
2023-07-03 11:48:50 +02:00
Alba Rincón fd86fd2e57 Add size settings to the `Product Image` block (https://github.com/woocommerce/woocommerce-blocks/pull/10034)
* Add height & width setting to the image sidebar settings

* Extract settings and add scale options

* Add width settings

* Apply settings on the frontend

* Style placeholder image

* Replace post featured image with product image

* Allow the width to be wider than container

* Fix image on top of other elements
2023-07-03 11:33:44 +02:00
Mike Jolley a6b8e0e542 Hide "collection from" text when a location has an incomplete address. (https://github.com/woocommerce/woocommerce-blocks/pull/9808)
* Hide "collection from" text when a location has an incomplete address.

* Fix display on confirmation page

* has_valid_pickup_location helper

* Missing isset

* Update test

* Fix pickup text assertion

---------

Co-authored-by: Niels Lange <info@nielslange.de>
2023-07-03 10:10:18 +01:00
Hritik Chaudhary c1f2949a5d Converted product-tag and removed its proptypes (https://github.com/woocommerce/woocommerce-blocks/pull/9758)
* Converted product-tag and removed its proptypes

* addressed review comments

---------

Co-authored-by: Niels Lange <info@nielslange.de>
2023-07-03 10:54:46 +02:00
Albert Juhé Lluveras 74e39331fb Cleanup code to lazy-load wc-settings in the Mini-Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/10042) 2023-07-03 09:26:31 +02:00
Albert Juhé Lluveras b5080e379d Prevent prefetched Cart payload causing wrong values with cached Mini-Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/10029)
* Prevent prefetched Cart payload causing wrong values with cached Mini-Cart block

* Pass Cart Totals object entirely

* Code cleanup

* Fixes and code cleanup

* Update Mini-Cart local storage when adding or removing products from cart
2023-06-30 16:05:27 +02:00
Luigi c5f3728060 Merge branch 'release/10.4.0' of https://github.com/woocommerce/woocommerce-blocks into trunk 2023-06-30 14:56:28 +02:00
github-actions[bot] 80fabe4991 Release: 10.4.5 (https://github.com/woocommerce/woocommerce-blocks/pull/10038)
* Product Rating block > Ensure the customer reviews text is linked to the relevant reviews (https://github.com/woocommerce/woocommerce-blocks/pull/9998)

* Fix reviews count not showing on Single Product page

* Fix css style

* Product Rating block: Ensure the Customer reviews text is linked to the relevant reviews when used within the Single Product Template. When used within the Single Product Block, the link directs the user to the product template. Additionally, clear out\ PHPCS warnings.

* remove unnecessary call to wc_get_star_rating_html

---------

Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>

* Product Rating block: Fix reviews count not showing on Single Product page (https://github.com/woocommerce/woocommerce-blocks/pull/9995)

* Fix reviews count not showing on Single Product page

* Fix css style

* Single Product: Fix Product SKU not loading for different variations (https://github.com/woocommerce/woocommerce-blocks/pull/9990)

* Single Product: Fix incorrect add to cart form markup (https://github.com/woocommerce/woocommerce-blocks/pull/9986)

* Product Image Gallery block: Fix overflow when multiple images are used (https://github.com/woocommerce/woocommerce-blocks/pull/10013)

* Fix Product Image Gallery block overflow when multiple images are used

* Increase css specificity for the Product Image Gallery images

* Fix whitespace

* Fix style issue when using smaller images in the product image gallery

* Empty commit for release pull request

* update version

* add testing instructions

* update zip link

* Product Rating: append #reviews on the Single Product Block (https://github.com/woocommerce/woocommerce-blocks/pull/10040)

* Product Rating: append #reviews on the Single Product Block

* refactor after feedback

* fix version

* update zip link

* Single Product Block: avoid to register incompatibility blocks with the Single Product Block on the post/page editor (https://github.com/woocommerce/woocommerce-blocks/pull/10044)

* update testing instructions

* update zip link

---------

Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luigi <gigitux@gmail.com>
2023-06-30 14:53:38 +02:00
Luigi Teschio cf8b73d79f Single Product Block: avoid to register incompatibility blocks with the Single Product Block on the post/page editor (https://github.com/woocommerce/woocommerce-blocks/pull/10044) 2023-06-30 14:06:12 +02:00
Luigi Teschio 6a35063dd1 Product Rating: append #reviews on the Single Product Block (https://github.com/woocommerce/woocommerce-blocks/pull/10040)
* Product Rating: append #reviews on the Single Product Block

* refactor after feedback
2023-06-30 11:31:14 +02:00
Luigi Teschio a06dd1d7c9 Add FrontendUtils class (https://github.com/woocommerce/woocommerce-blocks/pull/10033)
* Add FrontendUtils class

* fix conflicts

* use locator

* restore click usage

* fix util
2023-06-30 09:08:14 +02:00
Alexandre Lara 388605027b Product Image Gallery block: Fix overflow when multiple images are used (https://github.com/woocommerce/woocommerce-blocks/pull/10013)
* Fix Product Image Gallery block overflow when multiple images are used

* Increase css specificity for the Product Image Gallery images

* Fix whitespace

* Fix style issue when using smaller images in the product image gallery
2023-06-29 20:24:33 +02:00
Paulo Arromba f1df8fb975 Add Cart/Checkout/Order-Received Templates (https://github.com/woocommerce/woocommerce-blocks/pull/9301)
* WIP: dirty attempt to dry run Cart & Checkout templates

* Added Cart and Checkout to the template hierarchies

* Merge branch 'trunk' into poc/cart_and_checkout_fse_templates

* Updated cart & Checkout templates

* Order Received FSE template (https://github.com/woocommerce/woocommerce-blocks/pull/8937)

* Order Received template bootstrap

* typo

* WIP: new block

* add logic here

* Order received classic template

* reverted constants.ts

* Added the post title (buggy)

* Corrected page title

* Updated constants.ts

* Fixed template typo

* removed placeholder for order received block

* add order-received template description

* updated placeholder description

* Formatting fixes

* Template description.

* replaced hardcoded string with OrderReceivedTemplate::SLUG

---------

Co-authored-by: Luigi <gigitux@gmail.com>

* Code formatting (https://github.com/woocommerce/woocommerce-blocks/pull/8350)

* Code formatting

* page_template_hierarchy priority to 1 (https://github.com/woocommerce/woocommerce-blocks/pull/9323)

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Migrate Cart and Checkout Pages to the Template Editor when using a FSE theme (https://github.com/woocommerce/woocommerce-blocks/pull/9339)

* Introduce woocommerce_blocks_template_content hook

* Migrate cart and checkout page content to the template editor

* Add redirection from edit page to edit template

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Removed header and footer from checkout template. (https://github.com/woocommerce/woocommerce-blocks/pull/9378)

* Removed header and footer from checkout template.

* Removed header and footer from checkout template migration

* Permalink solution for the checkout endpoint/template (https://github.com/woocommerce/woocommerce-blocks/pull/9406)

* Checkout endpoint work

* Move setting field to util

* Include link to edit the template

* Remove todo

* Refactor checkout templates to share logic (https://github.com/woocommerce/woocommerce-blocks/pull/9411)

* Sync endpoints with pages (https://github.com/woocommerce/woocommerce-blocks/pull/9426)

* Switch to page syncing

* Update settings descriptions

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Migrate pages to templates once (https://github.com/woocommerce/woocommerce-blocks/pull/9488)

* Migrate content on init, once

* Skip migration if page does not exist

* Put back HTML for header and footer parts

* Fix page redirect due to wrong ID

* fix loading template part

* Removed unnecessary var

* update cart and checkout html templates

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Include a notice to redirect user to template editor (https://github.com/woocommerce/woocommerce-blocks/pull/9508)

* Template Placeholder Design for the Order Received Template (https://github.com/woocommerce/woocommerce-blocks/pull/9602)

* Load frontend styles in editor iframe

* Update placeholder to include skeleton and updated icons

* Update classic template configs

* 1px border for .wp-block-woocommerce-classic-template__placeholder-copy

* Show copy on focus

* Sample data

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Add simplified header on checkout template (https://github.com/woocommerce/woocommerce-blocks/pull/9607)

* Added simplified header on checkout template

* Moved simplified header to template part

* updated constants.ts

* added template part to checkout.html

* Add missing translation

* frontpage_template_hierarchy no longer needed

* Allow plugin based template parts (https://github.com/woocommerce/woocommerce-blocks/pull/9667)

* Merge branch 'trunk' into add/9288_cart-checkout-order-received_fse_templates

* Synced templates on blockified folder

* Add blockified order-received.html

* removed WooCommerce prefix

* Refactor/rebrand order received template to order confirmation (https://github.com/woocommerce/woocommerce-blocks/pull/9734)

* rebrand order received to order confirmation

* updated descriptions for templates

* updated descriptions for order confirmation placeholder

* Resolve merge conflict

* Resolve merge conflicts

* Resolve more merge conflicts after rebase

* Fix formatting

* Use patterns for localisation (https://github.com/woocommerce/woocommerce-blocks/pull/9883)

* e2e tests for cart and checkout templates (https://github.com/woocommerce/woocommerce-blocks/pull/9939)

* Merge branch 'trunk' into poc/cart_and_checkout_fse_templates

* Merge branch 'trunk' into add/9288_cart-checkout-order-received_fse_templates

* Resolve merge conflicts

* Add e2e for permalink settings

* Test that templates exist

* Add test to check that templates can be edited

* Add tests to confirm templates can be edited

* Ensure cart has contents before running tests on frontend views

* Commend out problem test

* Make sure search has multiple results

* Remove useThrottle - bad rebase

* Revert changes to docs after rebase

* Revert function call for noReviewsPlaceholder

* Bad rebase

* Reverts

* Remove revertTemplate

* Spacing

* Wait for networkidle after navigation

* Always wait for network

* Use button roles in site editor

* More specific button locator

* Update option comparison

* Fix template content

* Disable failing tests

* Disable failing classic template tests

* Use enterEditMode

* More enterEditMode usage

* enterEditMode

* Use test.skip

* More robust selectors

* Alt iframe selector

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

* Skip flakey test

---------

Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-06-29 14:41:22 +01:00
Roy Ho 6d36b2547b Make filter by rating preview consistent with default settings (https://github.com/woocommerce/woocommerce-blocks/pull/10007)
* Make filter by rating preview consistent with default settings

* Remove unneeded classnames
2023-06-29 06:15:52 -07:00
Albert Juhé Lluveras 559f712e35 Avoid usage of __experimentalUseFocusOutside (https://github.com/woocommerce/woocommerce-blocks/pull/10017)
* Avoid usage of __experimentalUseFocusOutside

* Remove unnecessary fix in QuantitySelector

* Add explanatory comment
2023-06-28 14:43:03 +02:00
Alba Rincón 6de8172053 Use the single product block on the Hero Product pattern (https://github.com/woocommerce/woocommerce-blocks/pull/9935)
* Use the single product block on the Hero Product pattern

* Use the add to cart button block

* Use featured image and fix alignment
2023-06-28 14:34:51 +02:00
Thomas Roberts d76fa0a6cc Prevent saved payment methods showing if their main method `canPay` function returns `false` (https://github.com/woocommerce/woocommerce-blocks/pull/9917)
* Change type of payment requirements to string[]

* Add CanMakePaymentArgumentCart type and update CanMakePaymentArgument

* Add getCanMakePaymentArg function to get the arg, allows reusability

* Check saved methods gateway's to see if they can make payment

* Make canMakePaymentArg a dependency of the useMemo

* Remove await from sync function call

* Update variable names to better reflect what they store

* Add tests to ensure saved payment methods don't show if canPay is false

* Rename save-payment-method-options to tsx

* Update saved payment method options to TS

* Fix TS error in saved-payment-method-options test
2023-06-28 01:43:38 -07:00
Daniel Dudzic 254c7e8086 Product Rating: Remove empty markup if no ratings are present (https://github.com/woocommerce/woocommerce-blocks/pull/9822)
* Product Rating: Remove empty markup if no real or mocked ratings are present

* Fix TS errors

* Remove unrelated TS fixes
2023-06-27 19:14:47 +00:00
Daniel Dudzic a2d09319a7 Single Product: Fix Product SKU not loading for different variations (https://github.com/woocommerce/woocommerce-blocks/pull/9990) 2023-06-27 20:29:54 +02:00
Luigi Teschio 0441e10623 Single Product Template: fix compatibility layer logic when the blocks aren't wrapped in a group block (https://github.com/woocommerce/woocommerce-blocks/pull/9982) 2023-06-27 18:16:18 +02:00
Patricia Hillebrandt ff04f46ed0 Remove opinionated style for the price list in grouped products from the Add to Cart with Options block. (https://github.com/woocommerce/woocommerce-blocks/pull/9988) 2023-06-27 16:34:06 +02:00
Patricia Hillebrandt 8510615169 Product Rating block > Ensure the customer reviews text is linked to the relevant reviews (https://github.com/woocommerce/woocommerce-blocks/pull/9998)
* Fix reviews count not showing on Single Product page

* Fix css style

* Product Rating block: Ensure the Customer reviews text is linked to the relevant reviews when used within the Single Product Template. When used within the Single Product Block, the link directs the user to the product template. Additionally, clear out\ PHPCS warnings.

* remove unnecessary call to wc_get_star_rating_html

---------

Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2023-06-27 14:50:58 +02:00
Daniel Dudzic 35f73b4130 Single Product: Fix incorrect add to cart form markup (https://github.com/woocommerce/woocommerce-blocks/pull/9986) 2023-06-27 12:20:56 +00:00
Alexandre Lara 00725124b8 Product Rating block: Fix reviews count not showing on Single Product page (https://github.com/woocommerce/woocommerce-blocks/pull/9995)
* Fix reviews count not showing on Single Product page

* Fix css style
2023-06-27 07:50:48 -03:00
Siddharth Thevaril 09439560b2 move to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/9801)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2023-06-27 12:48:26 +02:00
Tung Du f364aa41fb Product Image: use WC Core function to render image (https://github.com/woocommerce/woocommerce-blocks/pull/9984) 2023-06-27 17:31:19 +07:00