Commit Graph

4426 Commits

Author SHA1 Message Date
kmanijak 3ddf4dd929 Update the docs with more details about external dependencies and wordpress-components alias (https://github.com/woocommerce/woocommerce-blocks/pull/8052) 2022-12-30 14:17:42 +01:00
Tung Du 8c24200e73 Update E2E tests for Gutenberg 14.8.x (https://github.com/woocommerce/woocommerce-blocks/pull/8050) 2022-12-30 18:47:33 +07:00
kmanijak 00ac537474 Make each Bundle Analyzer report open in new tab with the proper title (https://github.com/woocommerce/woocommerce-blocks/pull/8045)
* Make each Bundle Analzyer report open in new tab with the proper title
2022-12-29 17:00:30 +01:00
Stian 056e9bf73f Replace instances of wp_is_block_theme() with wc_current_theme_is_fse_theme() (https://github.com/woocommerce/woocommerce-blocks/pull/7496) 2022-12-29 13:14:00 +01:00
Rodrigo Primo 077c8fa3ff PHP 8.2: fix "Using ${var} in strings is deprecated, use {$var} instead" (https://github.com/woocommerce/woocommerce-blocks/pull/7782)
PHP 8.2 deprecated using ${var} in strings
(https://kinsta.com/blog/php-8-2/#deprecate--string-interpolation). {$var}
should be used instead. This commit fixes the occurrences of ${var} in
woocommerce-blocks to prepare for the next version of PHP which is
scheduled to be released early in December.

I found this in the context of testing MailPoet with PHP 8.2. I'm not
familiar with the woocommerce-blocks so I might be missing something. I did
not test the changes in this commit.
2022-12-29 13:13:15 +01:00
Albert Juhé Lluveras 78d8f1a626 9.1.1 testing steps: move testing steps for PR woocommerce/woocommerce-blocks#7909 and woocommerce/woocommerce-blocks#7914 under 'Feature plugin' (https://github.com/woocommerce/woocommerce-blocks/pull/8042) 2022-12-29 09:42:23 +01:00
Saad Tarhi 230606c7f7 Highlight incompatible payment gateways (https://github.com/woocommerce/woocommerce-blocks/pull/7412)
* Set up incompatiblePaymentMethods in data store

* Save incompatible payment methods in data store

* Create the IncompatibilityPaymentGatewaysNotice

* Fix hidden notice bug

* Rename "paymentAdminLink" to GlobalPaymentMethod and move to types dir

* Add all registered methods to incompatiblePaymentMethods state

* Rename selector to getIncompatiblePaymentMethods

* Remove incompatible methods when adding available ones

* Remove unused reducer cases

* Stop adding incompatible methods now that we add them in default state

* Display incompatible methods in the notice from the data store

* Refactor incompatible payment gateways notice

* Update the incompatible extensions notice's design

* Hide Make as default notice

We hide this notice while the notification for incompatible payment
gateways is visible

* Hide the sidebar compatibility notice

Hide this notice while  the notification for incompatible payment
gateways is visible. And show it otherwise.

* Capitalize the label for the button on the page settings notice

* Fix missing 'globalPaymentMethods' bug on frontend

* Highlight incompatible payments in sidebar

Highlight incompatible payment gateways within the Payment Options Block

* Rename the incompatible gateways notice's component

* Support plural and singular forms for the notice

* Update incompatible extensions notice's design

* Use the simplified types import

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

* Add translation support to notice message

* Fix failing unit tests

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Niels Lange <info@nielslange.de>
2022-12-28 17:30:46 +01:00
kmanijak 32119dc8f9 Move annotation from incorrect place to the function it describes (https://github.com/woocommerce/woocommerce-blocks/pull/8023)
* Move annotation from incorrect place to the function it described
2022-12-28 16:17:04 +01:00
kmanijak 1bb1ad5f40 Display "Add review" link if there's no product rating (https://github.com/woocommerce/woocommerce-blocks/pull/7929)
* Display Add Review link in the All Products if there's no product rating in All Products and Products

* Apply the font-size mixin to the Add Review link

* Make Add review link NOT clickable in editor

* Improve styles of Rating component so they support alignment in product grids
2022-12-28 14:24:43 +01:00
Seghir Nadir 2c6694551a Revert push changes validation check (https://github.com/woocommerce/woocommerce-blocks/pull/8029)
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-12-28 12:54:03 +01:00
Paulo Arromba 586e8ea884 Fix dev version strings (https://github.com/woocommerce/woocommerce-blocks/pull/8038) 2022-12-27 15:51:00 +00:00
Niels Lange 6bfd2b9c8f Convert product-elements/button to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/8003)
* Convert product-elements/button to TypeScript

* Fix TS errors

* Fix TS errors

* Update assets/js/atomic/blocks/product-elements/button/attributes.ts

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Import BlockAttributes from @wordpress/blocks as type

* Solve TS error

* Move BlockAttributes interface to increase readability

* Fix TS error

* Simplify TS declaration

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-12-23 23:01:16 +07:00
Niels Lange 63bb47bb3d Convert product-elements/price to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7683)
* Convert product-element/price to TypeScript

* Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR

* Export block due to Cross-Sells dependency

* Update assets/js/atomic/blocks/product-elements/price/edit.tsx

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

* bot: update checkstyle.xml

* Apply review feedback

* Outsource supports section

* bot: update checkstyle.xml

* Resolve merge conflicts

* bot: update checkstyle.xml

* Solve TS error in cart-cross-sells-product.tsx

* bot: update checkstyle.xml

* Solve TS error regarding min_amount and max_amount

* bot: update checkstyle.xml

* Empty-Commit

* Fix TS problems in product-elements/price/block.tsx

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Resolve merge conflicts

* Convert product-element/price to TypeScript

* Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR

* Export block due to Cross-Sells dependency

* Apply review feedback

* Update assets/js/atomic/blocks/product-elements/price/edit.tsx

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

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Solve TS error in cart-cross-sells-product.tsx

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Solve TS error regarding min_amount and max_amount

* Empty-Commit

* bot: update checkstyle.xml

* Fix TS problems in product-elements/price/block.tsx

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Solve TS errors

* Solve TS errors

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* bot: update checkstyle.xml

* Empty checkstyle.xml

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Use BlockAttributes from @wordpress/blocks

* Fix TS error

* Fix TS errors

* Fix TS error

Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-12-23 22:30:10 +07:00
Niels Lange 46f0330a0a Use Woo Blocks instead Woo core translation within the Checkout order Summary block (https://github.com/woocommerce/woocommerce-blocks/pull/7995)
* Use Woo Blocks instead Woo core translation

* Activale previously skipped e2e tests

* Adjust loading order of $shared_chunks, $vendor_chunks and $chunks

* Revert chunk order of MiniCart.php
2022-12-23 19:54:04 +07:00
Niels Lange aae39f5266 Simplify @woocommerce/types imports (https://github.com/woocommerce/woocommerce-blocks/pull/8019)
* Simplify @woocommerce/types imports

* Fix TS errors
2022-12-23 18:59:02 +07:00
Alba Rincón f9dd42a36a Add `Customer account` to patterns (https://github.com/woocommerce/woocommerce-blocks/pull/7944)
* Render the block in the frontend

* Add icon style selector to Display settings

This adds an icon style selector in which users can choose the customer account link icon.

* Display on the frontend depending on the icon style

* Rename attributes

* Refactor block rendering

* Improve styling

* Add link to account settings

* Split css file

* Switch to SSR

* Add customer account block to header patterns

* Add customer account block to footer patterns

* Adapt minimal header to designs

* Adapt large header to designs

* Adapt header patterns to new designs and format code

* Adapt footer patterns to the designs

* Change display style for the essential header

* Increase alt icon size

* Make the icon resize with the label

* Adjust icon size on headers

* Add padding and move second row to the right

* Remove unused enum

Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2022-12-23 10:08:44 +01:00
Mike Jolley fdbe4e7c54 Remove legacy handling on the PHP side (https://github.com/woocommerce/woocommerce-blocks/pull/7978) 2022-12-22 17:04:54 +01:00
Luigi Teschio 0dd980998c Update @wordpress/e2e-test-utils package (https://github.com/woocommerce/woocommerce-blocks/pull/7955) 2022-12-22 16:47:23 +01:00
Alba Rincón a223af0ad5 Add 'Customer Account' block (https://github.com/woocommerce/woocommerce-blocks/pull/7876)
* Add empty 'Customer Account' block

* Add edit to render the block on the editor

* Add Customer Account icon to @woocommerce/icons library

This icon is used in the Customer Account block.

* Use customerAccount icon in the Customer Account block

* Add Block Settings to Customer Account block

Add Typography and Color settings to the Customer Account block that can be used during Edit mode.

* Add Customer Account style icons

This adds the customer account style icons to be used by the customer account block.

* Render the block in the frontend

* Add Display setting to the Customer Account block

This setting allow users to choose if they want to include an icon with the customer account link.

* Add icon style selector to Display settings

This adds an icon style selector in which users can choose the customer account link icon.

* Display on the frontend depending on the icon style

* Rename attributes

* Refactor block rendering

* Improve styling

* Make the account link dynamic

* Add alignment menu

* Get dashboardUrl with getSettings and add fallback

* Add link to account settings

* Add tests

* Fix test

* Change display title

* Split css file

* Switch to SSR

* Add styles to the front end

* Address latest feedback

* Remove experimental flag

Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
2022-12-22 16:01:01 +01:00
Luigi Teschio d6b3b26c01 Mini Cart block - added notice support (https://github.com/woocommerce/woocommerce-blocks/pull/7234)
* Mini Cart block - added notice support woocommerce/woocommerce-blocks#6941

Mini Cart block - added notice support

* set isDismissible to true

* address feedback

* improve layout

* fix style and update close button label

* fix UI when the admin bar is visible

* Split out dismissible notices

* fix css

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-12-22 15:48:24 +01:00
Mike Jolley 637f47cac7 Refactor View Switcher to use Block Attributes (https://github.com/woocommerce/woocommerce-blocks/pull/8006)
* Add cart view switcher

* Attribute based switched POC

* Tidy up view handling

* Mini cart

* Not sure who clint is. Typo - rename to clientId

* Avoid string casting in TS

* Add margin to title

* Set custom source to prevent currentView saving to post content.

Note this also removes `save` which does not exist in Gutenberg.

* Remove higher order component from withViewSwitcher

* Import view switcher in main file

* Add to side effects

* Move view switcher import

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2022-12-22 14:35:24 +00:00
Mike Jolley ece76603bb Split out dismissible notices (https://github.com/woocommerce/woocommerce-blocks/pull/8018) 2022-12-22 14:15:33 +00:00
Luigi 33c41f3493 Merge branch 'release/9.1.0' of https://github.com/woocommerce/woocommerce-blocks into trunk 2022-12-22 10:22:05 +01:00
github-actions[bot] 2b29e63375 Release: 9.1.3 (https://github.com/woocommerce/woocommerce-blocks/pull/8011)
* Empty commit for release pull request

* Update the readme file with 9.1.1 release changes

* Product Query: Add `Sorted by title` preset. (https://github.com/woocommerce/woocommerce-blocks/pull/7949)

* Add `Sort by title` preset.

* sorted, thanks @nerrad

* Update the readme file with woocommerce/woocommerce-blocks#7949 changes

* 9.1.1 Release: Add testing docs

* Atomic Block: fix ancestor definition (https://github.com/woocommerce/woocommerce-blocks/pull/7947)

* Fix the incorrect layout of Rating and Price in Classic Template and Products block (https://github.com/woocommerce/woocommerce-blocks/pull/7932)

* Fix the incorrect layout of Rating and Price in Classic Template

There were styles required in Rating Filter that were added globally and influenced the layout of Rating in Products block as well as Classic template. The styles were moved to the Rating Filter block

* Add dropdown version of Filter by Stock Status (https://github.com/woocommerce/woocommerce-blocks/pull/7831)

* Extend Filter by Stock Editor options with dropdown and single/multiple choice

* Add dropdown implementation for Filter by Stock Status

* Adjust font-sizes to the rest of the filters

* Add tests to Filter by Stock: dropdown and list variants

* Change test file extension from .js to .tsx, so it handles types as well

* Add E2E test to Filter by Stock checking if display style can be toggled

* When typing in Filter by Stock dropdown, handle the space so it highlights the suggestions

* Change the name of the filter blocks in the test files

* Remove unnecessary waiting step in E2E test for Filter by Stock

toMatchElement waits for an element for 30s by itself, hence waitForSelector usage was removed

* Improve the STOCK_STATUS_OPTIONS type handling

* Extract onDropdownChange function instead of inline arrow function

* Fix overlaping dropdown content with the wrapper when Filter by Stock was set to single

* Product Query: Add patterns (https://github.com/woocommerce/woocommerce-blocks/pull/7857)

* Product Query: First attempt at adding patterns

* Product Query: Update patterns and the default block template

* Product Query: And new and update existing patterns

* Product Query: Adjust layout of the Minimal Product Row pattern

* Product Query: Update pattern names

* Product Query: Polish spaces between blocks inside the patterns

* Product Query patterns: Link product titles and improve spacing between product elements

* Product Query patterns: Button font-size update

* Product Query patterns: Center the pagination

* Product Query patterns: Center the pagination for the default pattern

* Product Query patterns: Remove an empty column

* Product Query patterns: Remove an empty column from the product list with 1:1 images pattern

* Add dropdown version of Filter by Rating (https://github.com/woocommerce/woocommerce-blocks/pull/7771)

* Rename the setting section to match Filter by Attribute

* Add Display Style toggle to the block settings

* Set list as a default value of displayStyle for Filter by Rating

* Add dropdown variant of Filter by Rating

* Extend the Editor settings with selectType: single or multiple

* Adjust the styles of a FormTokenField to other dropdown

* Align Editor settings order and wording between Filter by Attribute and Rating

* Fix the issue with cut off corners of dropdown borders

* Provide translated screen reader messages and placeholder

* Revert the label property, which is necessary to display checkbox list

* Make classname for Rating component optional and remove styling in Filter by Rating

* Cover the case when filter with zero products needs string methods for comparison

* Handle Typescript errors and add ts-ignore annotations when necessary

* Remove explicit key prop assignment in Rating component

* Remove leftover property in type definition

* Refactor JSX element extension with custom properties to more robust way with object copy

* Filter by rating tests (https://github.com/woocommerce/woocommerce-blocks/pull/7845)

* Filter by Rating tests:
  - List single
  - List multiple
  - Dropdown single
  - Dropdown multiple

* Adjust the font-size of Filter by Rating dropdown to the rest of the filters

* Fix E2E tests after the Editor settings label has been changed

* Improve sorting in Filter by Rating dropdown

With this change the order of options is always descending: in the chips, suggestions, active filters and URL

* Change the name of the filter blocks in the test files

* Prevent single dropdown input to overflow the wrapper

The issue is fixed in three filters, hence a new shared styles file is created at the path assets/js/blocks/shared/styles/style.css

* Remove the unused styles of active options in Filter by Rating

Chosen options in Filter by Rating list have been bolded. That was the only filter that was doing it. Class was removed, but not the styles themselves which became obsolete. Removing the leftover styles then

* Change the approach of shared styles to fix the dropdown issue in filters

Instead of using direct classes, rewrite it to mixin and include in the filters

* Fix the Filter by Rating with Products block

The problem was with the Products block, that there was incorrect initial value of product ratings query

* Align the logic of getting the filters from URL for Filter by Rating with Filter by Stock

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

* Product Query - Enable "Inherit Query from template" option (https://github.com/woocommerce/woocommerce-blocks/pull/7641)

* Add Inherit Query from template option

* Update label

* Product Elements: Fix block settings (https://github.com/woocommerce/woocommerce-blocks/pull/7914)

* Product Elements: Fix block settings

* Rating: Fix inactive star color

* Product Rating: Fix color inheritance

* StyleAttributesUtils: Fix PHP notices and invalid CSS output (https://github.com/woocommerce/woocommerce-blocks/pull/7909)

* StyleAttributesUtils: Fix PHP notices and invalid CSS output. Closes woocommerce/woocommerce-blocks#7899.

* StyleAttributesUtils: Fix border radius and width support

* StyleAttributesUtils: Fix border radius and border color support

* StyleAttributesUtils: Include additional checks to deal with PHP warnings

* StyleAttributesUtils: Improve the custom border array check

* Update MiniCart.php to fix price total amount on page load prices are including tax (https://github.com/woocommerce/woocommerce-blocks/pull/7832)

* Update MiniCart.php

Added an update to the '$cart_contents_total' variable on the 'get_cart_price_markup' function if $cart->display_prices_including_tax is active. Currently displaying wrong amount total on page load if items are already in the basket.

* Update MiniCart.php

Removed white spaces?

* Update MiniCart.php

Fixed IF statement

* Remove whitespace at end of line

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Product Query: implement compatibility with Filter by Rating block (https://github.com/woocommerce/woocommerce-blocks/pull/7792)

* Product Query: implement compatibility with Filter by Rating block woocommerce/woocommerce-blocks#7631

Product Query: implement compatibility with Filter by Rating block

* address feedback

* address feedback

* add comment

* add new zip file link

* add missing class

* add testing instructions about woocommerce/woocommerce-blocks#7947

* add new zip file link

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Bumping version strings to new version.

* Remove feature flag from Products block (https://github.com/woocommerce/woocommerce-blocks/pull/8001)

* Remove feature flag from Products block

* Remove Products block from feature flags documentation

* Empty commit for release pull request

* Update changelog

* Add zip file link

* Bumping version strings to new version.

* Enable Product SKU and Product Stock Indicator in Core (https://github.com/woocommerce/woocommerce-blocks/pull/8009)

* Update changelog

* Update changelog

* Empty commit for release pull request

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: kmanijak <karol.manijak@automattic.com>
Co-authored-by: Luke O'Regan <oregan.luke@gmail.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2022-12-22 10:19:31 +01:00
Niels Lange ec334678d0 Convert product-elements/rating to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7540)
* Convert product-elements/rating to TypeScript

* bot: update checkstyle.xml

* Import decleration type only

* Rebase against trunk

* Interim TS fixes

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Solve TS errors

* bot: update checkstyle.xml

* Fix TS error

* Fix TS error

* Fix TS errors

* Use BlockAttributes from @wordpress/blocks

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-12-22 14:23:11 +07:00
Tung Du b3ea73f3bb Revert woocommerce/woocommerce-blocks#7504 for ProductButton.php to avoid loading unnecessary JS files (https://github.com/woocommerce/woocommerce-blocks/pull/7966) 2022-12-22 09:05:54 +07:00
Tung Du da4221a9a7 Fix: workflows using comment-aggregator are failing on trunk (https://github.com/woocommerce/woocommerce-blocks/pull/8010) 2022-12-21 23:30:25 +07:00
github-actions[bot] 753d3478d9 Release: 9.1.2 (https://github.com/woocommerce/woocommerce-blocks/pull/8004)
* Empty commit for release pull request

* Update the readme file with 9.1.1 release changes

* Product Query: Add `Sorted by title` preset. (https://github.com/woocommerce/woocommerce-blocks/pull/7949)

* Add `Sort by title` preset.

* sorted, thanks @nerrad

* Update the readme file with woocommerce/woocommerce-blocks#7949 changes

* 9.1.1 Release: Add testing docs

* Atomic Block: fix ancestor definition (https://github.com/woocommerce/woocommerce-blocks/pull/7947)

* Fix the incorrect layout of Rating and Price in Classic Template and Products block (https://github.com/woocommerce/woocommerce-blocks/pull/7932)

* Fix the incorrect layout of Rating and Price in Classic Template

There were styles required in Rating Filter that were added globally and influenced the layout of Rating in Products block as well as Classic template. The styles were moved to the Rating Filter block

* Add dropdown version of Filter by Stock Status (https://github.com/woocommerce/woocommerce-blocks/pull/7831)

* Extend Filter by Stock Editor options with dropdown and single/multiple choice

* Add dropdown implementation for Filter by Stock Status

* Adjust font-sizes to the rest of the filters

* Add tests to Filter by Stock: dropdown and list variants

* Change test file extension from .js to .tsx, so it handles types as well

* Add E2E test to Filter by Stock checking if display style can be toggled

* When typing in Filter by Stock dropdown, handle the space so it highlights the suggestions

* Change the name of the filter blocks in the test files

* Remove unnecessary waiting step in E2E test for Filter by Stock

toMatchElement waits for an element for 30s by itself, hence waitForSelector usage was removed

* Improve the STOCK_STATUS_OPTIONS type handling

* Extract onDropdownChange function instead of inline arrow function

* Fix overlaping dropdown content with the wrapper when Filter by Stock was set to single

* Product Query: Add patterns (https://github.com/woocommerce/woocommerce-blocks/pull/7857)

* Product Query: First attempt at adding patterns

* Product Query: Update patterns and the default block template

* Product Query: And new and update existing patterns

* Product Query: Adjust layout of the Minimal Product Row pattern

* Product Query: Update pattern names

* Product Query: Polish spaces between blocks inside the patterns

* Product Query patterns: Link product titles and improve spacing between product elements

* Product Query patterns: Button font-size update

* Product Query patterns: Center the pagination

* Product Query patterns: Center the pagination for the default pattern

* Product Query patterns: Remove an empty column

* Product Query patterns: Remove an empty column from the product list with 1:1 images pattern

* Add dropdown version of Filter by Rating (https://github.com/woocommerce/woocommerce-blocks/pull/7771)

* Rename the setting section to match Filter by Attribute

* Add Display Style toggle to the block settings

* Set list as a default value of displayStyle for Filter by Rating

* Add dropdown variant of Filter by Rating

* Extend the Editor settings with selectType: single or multiple

* Adjust the styles of a FormTokenField to other dropdown

* Align Editor settings order and wording between Filter by Attribute and Rating

* Fix the issue with cut off corners of dropdown borders

* Provide translated screen reader messages and placeholder

* Revert the label property, which is necessary to display checkbox list

* Make classname for Rating component optional and remove styling in Filter by Rating

* Cover the case when filter with zero products needs string methods for comparison

* Handle Typescript errors and add ts-ignore annotations when necessary

* Remove explicit key prop assignment in Rating component

* Remove leftover property in type definition

* Refactor JSX element extension with custom properties to more robust way with object copy

* Filter by rating tests (https://github.com/woocommerce/woocommerce-blocks/pull/7845)

* Filter by Rating tests:
  - List single
  - List multiple
  - Dropdown single
  - Dropdown multiple

* Adjust the font-size of Filter by Rating dropdown to the rest of the filters

* Fix E2E tests after the Editor settings label has been changed

* Improve sorting in Filter by Rating dropdown

With this change the order of options is always descending: in the chips, suggestions, active filters and URL

* Change the name of the filter blocks in the test files

* Prevent single dropdown input to overflow the wrapper

The issue is fixed in three filters, hence a new shared styles file is created at the path assets/js/blocks/shared/styles/style.css

* Remove the unused styles of active options in Filter by Rating

Chosen options in Filter by Rating list have been bolded. That was the only filter that was doing it. Class was removed, but not the styles themselves which became obsolete. Removing the leftover styles then

* Change the approach of shared styles to fix the dropdown issue in filters

Instead of using direct classes, rewrite it to mixin and include in the filters

* Fix the Filter by Rating with Products block

The problem was with the Products block, that there was incorrect initial value of product ratings query

* Align the logic of getting the filters from URL for Filter by Rating with Filter by Stock

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

* Product Query - Enable "Inherit Query from template" option (https://github.com/woocommerce/woocommerce-blocks/pull/7641)

* Add Inherit Query from template option

* Update label

* Product Elements: Fix block settings (https://github.com/woocommerce/woocommerce-blocks/pull/7914)

* Product Elements: Fix block settings

* Rating: Fix inactive star color

* Product Rating: Fix color inheritance

* StyleAttributesUtils: Fix PHP notices and invalid CSS output (https://github.com/woocommerce/woocommerce-blocks/pull/7909)

* StyleAttributesUtils: Fix PHP notices and invalid CSS output. Closes woocommerce/woocommerce-blocks#7899.

* StyleAttributesUtils: Fix border radius and width support

* StyleAttributesUtils: Fix border radius and border color support

* StyleAttributesUtils: Include additional checks to deal with PHP warnings

* StyleAttributesUtils: Improve the custom border array check

* Update MiniCart.php to fix price total amount on page load prices are including tax (https://github.com/woocommerce/woocommerce-blocks/pull/7832)

* Update MiniCart.php

Added an update to the '$cart_contents_total' variable on the 'get_cart_price_markup' function if $cart->display_prices_including_tax is active. Currently displaying wrong amount total on page load if items are already in the basket.

* Update MiniCart.php

Removed white spaces?

* Update MiniCart.php

Fixed IF statement

* Remove whitespace at end of line

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Product Query: implement compatibility with Filter by Rating block (https://github.com/woocommerce/woocommerce-blocks/pull/7792)

* Product Query: implement compatibility with Filter by Rating block woocommerce/woocommerce-blocks#7631

Product Query: implement compatibility with Filter by Rating block

* address feedback

* address feedback

* add comment

* add new zip file link

* add missing class

* add testing instructions about woocommerce/woocommerce-blocks#7947

* add new zip file link

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

* Bumping version strings to new version.

* Remove feature flag from Products block (https://github.com/woocommerce/woocommerce-blocks/pull/8001)

* Remove feature flag from Products block

* Remove Products block from feature flags documentation

* Empty commit for release pull request

* Update changelog

* Add zip file link

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: kmanijak <karol.manijak@automattic.com>
Co-authored-by: Luke O'Regan <oregan.luke@gmail.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2022-12-21 16:49:22 +01:00
Luigi Teschio a6c30f3c70 Enable Product SKU and Product Stock Indicator in Core (https://github.com/woocommerce/woocommerce-blocks/pull/8009) 2022-12-21 16:45:43 +01:00
Tung Du 0a026ed81c Create merge comments action (https://github.com/woocommerce/woocommerce-blocks/pull/7973) 2022-12-21 22:24:01 +07:00
Tarun Vijwani 7a4fa29f0c Convert Reviews component to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7936)
* Convert review-sort-select to TS.

* Convert review-list and review-list-item to TS.

* Fix reviewer_avatar_urls type

* Fix TypeScript errors

* Fix TypeScript errors in frontend-block.js

* Update assets/js/base/components/reviews/review-sort-select/index.tsx

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

* Update assets/js/base/components/reviews/types.ts

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

* fix Review type and remove index file details

* fix ReviewSortSelect component 'value' prop type

* fix typo

Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2022-12-21 17:09:48 +04:00
Albert Juhé Lluveras 101034c4f0 Remove feature flag from Products block (https://github.com/woocommerce/woocommerce-blocks/pull/8001)
* Remove feature flag from Products block

* Remove Products block from feature flags documentation
2022-12-21 12:16:48 +01:00
Albert Juhé Lluveras 86604e8945 Rename configurateFilterProductsByAttributeBlock() to configureAttributeFilterBlock() (https://github.com/woocommerce/woocommerce-blocks/pull/7970)
* Rename configurateFilterProductsByAttributeBlock() to configurateFilterByAttributeBlock()

* Rename configurateFilterProductsByAttributeBlock() to configureAttributeFilterBlock()
2022-12-20 17:19:20 +01:00
Albert Juhé Lluveras 77b08b6ed3 Remove opinionated styles from Button component on TT3 and Zaino themes (https://github.com/woocommerce/woocommerce-blocks/pull/7992)
* Add Mini Cart button styles to Button component

* Add wp-element-button class to Button component

* Don't load opinionated button styles in TT3 and Zaino

* Remove bold styles from Mini Cart buttons
2022-12-20 16:02:12 +01:00
Alex Florisca 828ba01142 Bump version strings to 9.2.0-dev 2022-12-20 12:01:22 +00:00
github-actions[bot] 29dae38ba3 Release: 9.2.0 (https://github.com/woocommerce/woocommerce-blocks/pull/7977)
* Empty commit for release pull request

* Update readme.txt

* Update WC versions

* Testing instructions for release 9.2.0

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-12-20 11:41:14 +00:00
Mike Jolley 9e00b015fc New contexts for `StoreNoticesContainer` and notice grouping (https://github.com/woocommerce/woocommerce-blocks/pull/7711)
* Refactor Store Notices

Move snackbar hiding filter before notice creation

Implements showApplyCouponNotice

Refactor context providers

Use STORE_NOTICE_CONTEXTS

use refs to track notice containers

Refactor ref usage

Use existing noticeContexts

* Move new notice code to checkout package

* Combine store and snackbars

* Update noticeContexts imports

* Remove context provider

* Update data store

* Fix 502

* Add new error contexts

* Force types

* Unnecessary reorder of imports

* Fix global handling

* Document forceType

* Optional props are undefined

* Remove function name

* Missing condition

* Remove context prop

* Define ACTION_TYPES

* Remove controls

* Update assets/js/base/context/event-emit/utils.ts

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* CONTACT_INFORMATION

* Remove ref from registerContainer

* Abstract container locating methods

* pass context correctly when displaying notices

* Remove debugging buttons

* Update filter usage - remove useMemo so filter can work inline

* Refactor existing error notices from the API (https://github.com/woocommerce/woocommerce-blocks/pull/7728)

* Update API type defs

* Move create notice utils

* Replace useCheckoutNotices with new contexts

* processCheckoutResponseHeaders should check headers are defined

* Scroll to error notices only if we're not editing a field

* Error handling utils

* processErrorResponse when pushing changes

* processErrorResponse when processing checkout

* remove formatStoreApiErrorMessage

* Add todo for cart errors

* Remove unused deps

* unused imports

* Fix linting warnings

* Unused dep

* Update assets/js/types/type-defs/api-response.ts

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Add todo

* Use generic

* remove const

* Update array types

* Phone should be in address blocks

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update store name to wc/store/store-notices

* Fix assertResponseIsValid

* Funnel woocommerce_rest_invalid_email_address to the correct place

* woocommerce_rest_missing_email_address

* Move comments around

* Move data back into const

* Spacing

* Remove spacing

* Remove forced snack bar and styling

* Move notices within wrapper

* Remove type

* hasStoreNoticesContainer rename

* Group by status/context

* Remove global context

* Remove white space

* remove changes to simplify diff

* white space

* Move comment to typescript

* List style

* showApplyCouponNotice docs

* See if scrollIntoView exists

* fix notice tests

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-12-19 15:30:13 +00:00
Alba Rincón 5b095eb1a2 Fix overriding `archive-product` when saving a fallback template (https://github.com/woocommerce/woocommerce-blocks/pull/7975)
* Fix overriding archive-product when saving a fallback template

* Add comment
2022-12-19 15:31:00 +01:00
Niels Lange 7dfced254a Respect core settings for showing the Checkout block (https://github.com/woocommerce/woocommerce-blocks/pull/7883)
* Respect core settings for showing the Checkout block

* Add account creation option from core to checkout context provider

* Fix TS errors

* Adjust display logic of <LoginPrompt />

* Update assets/js/blocks/checkout/block.tsx

Co-authored-by: Mike Jolley <mike.jolley@me.com>

* Rename <LoginPrompt> to <MustLoginPrompt>

* Show space between login text and login link

* Fix TS error

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-12-19 21:19:52 +07:00
Tung Du b02b7f9348 Product Query: Add product visibility query support (https://github.com/woocommerce/woocommerce-blocks/pull/7951) 2022-12-19 21:05:16 +07:00
Mike Jolley e22d6e7fcf Remove country and state autocomplete fields (https://github.com/woocommerce/woocommerce-blocks/pull/7953) 2022-12-19 12:26:02 +00:00
Mike Jolley 0e1b05b92a Update MD editor config (https://github.com/woocommerce/woocommerce-blocks/pull/7968)
* Remove MD from editor config. Prettier handles formatting.

* Resave docs

* Update MD files
2022-12-19 12:06:48 +00:00
Thomas Roberts ebe05700ab Add notice on quantity change and update `wc/store/cart` to use thunks (https://github.com/woocommerce/woocommerce-blocks/pull/7938)
* Add receiveCart thunk

* Add mapCartResponseToCart helper

* Add getItemsPendingQuantityUpdate selector

* Update cart resolvers to be thunks

* Remove RECEIVE_CART action and replace with SET_CART_DATA

receiveCart will turn into a thunk.

* Add notifyQuantityChanges functions

* Remove receiveCart from action type definition, replace with setCartData

* Move apiFetchWithHeaders out of controls

This will just be a normal function since we'll be updating actions to thunks which will use this instead of a control.

* Include thunks in actions file

* Update receiveCart action to setCartData

* Update applyCoupon action to a thunk

* Update useStoreCartCoupons to get action from correct place

* Update StoreCartCoupon types

* Add types for Thunk and ThunkReturnType in mapped-types

* Change applyCoupon to a thunk

* Get applyCoupon, removeCoupon, receiveApplyingCoupon from useDispatch

This is to separate the concerns of actions vs. selectors. Previously the actions were fetched during useSelect which is not a pattern we use anywhere else in the codebase. Since we updated the MapToDispatch type, we can now get correctly typed thunks from the data store.

* Improve apiFetchWithHeaders typings

* Convert removeCoupon from generator to thunk

* Add applyCoupon and removeCoupon to CartAction type

* Remove unused old-style type-def

* Add receiveApplyingCoupon & receiveRemovingCoupon to StoreCartCoupon

* Correct issues with StoreCartCoupon type

These were not intended to reflect the actions in data store, rather the functions offered by the useStoreCartCoupons hook.

* Update applyExtensionCartUpdate to a thunk

* Update addItemToCart to thunk

* Add ResolveSelectFromMap type that works with thunks

* Add CartDispatchFromMap and CartResolveSelectFromMap types

We can add this to all data stores to get them working with thunks properly.

* Add docs and update generic name in ResolveSelectFromMap

* Add correct types for thunk resolvers in cart data store

* Update removeItemFromCart to thunk

* Update apiFetchWithHeaders to use generic

* Update selectShippingRate to thunk

* Update resolver tests to test correct thunk functionality

* Update updateCustomerData to thunk

* Update reducer test to reflect new action name

* Update comments on CartDispatchFromMap and CartResolveSelectFromMap

* Add quantity_limits to preview cart

* Make notices speak when shown

* Remove copilot comment

* Add isWithinQuantityLimits function

This is because we shouldn't show a notice if the quantity limits change, but the item's quantity is still OK.

* Add tests for notifyQuantityChanges

* Show notice when multiple_of is updated

* Update test to test for multiple_of changes

* Remove empty export

* Remove controls from cart data store

Not needed anymore since the exported value from the shared-controls file was empty.

* Export a control and async function for apiFetchWithHeaders

This is required because async functions cannot be called from sync generators.

* Use control version of apiFetchWithHeaders in the collections store

* Improve comments and remove incorrect TypeScript

* Update assets/js/data/cart/actions.ts

Co-authored-by: Mike Jolley <mike.jolley@me.com>

* Update ResolveSelectFromMap to include selectors too

* Update TS in actions

* Use finally to remove duplicate code

* remove item pending delete/qty update after action runs in all cases

This will also reset the state when the request to remove it/change quantity errors

* Remove unnecessary type from param.

Not needed because we have TS now. The description can stay though, it is useful.

* Update snackbar wording to use active voice

* Remove old WP version check

* Set max quantity to high number instead of null

This would only happen in a niche case, and would require several TS changes to fix, so it's better to set it as a number here. 9999 should be high enough, and is the default quantity limit set below in get_product_quantity_limit

* Set code on woocommerce_rest_cart_invalid_key to 409

This is so the cart is returned in the response, so the client can update.

* Fix typo in comment and add CartSelectFromMap

* Remove unnecessary docblock

* Add getItemsPendingDelete selector

This is needed so we can show a notice for items that are unexpectedly removed from the cart. We need to know which ones are pending delete so we can skip showing the notice for them.

* Add type for notifyQuantityChanges args and change args to object

* Add notifyIfRemoved function

This will check items that have been removed and show a notice for them.

* Fix TS in receiveCart & pass itemsPendingDelete to notifyQuantiyChanges

* Update wording on removal notice

* Update types for notifyQuantityChanges args

* Update tests to reflect new wording and args being an object

* Check item is truth before running comparison of keys

* Update tests for unexpectedly and expectedly removed items

* Ignore print_r to satisfy phpcs

* Update PHP tests to reflect correct response code when deleting items

* Remove unnecessary controls and dispatch events directly from thunk

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-12-16 08:06:37 -08:00
kmanijak 6ea35ccc93 Remove Legacy Webpack Configs along with FallbackModuleDirectoryWebpackPlugin (https://github.com/woocommerce/woocommerce-blocks/pull/7961) 2022-12-16 12:00:06 +01:00
Mike Jolley 5625ea46cd Correct data table (https://github.com/woocommerce/woocommerce-blocks/pull/7935) 2022-12-16 10:23:58 +00:00
Tarun Vijwani ee2adeb994 Convert cart-checkout/totals/shipping component to TypeScript. (https://github.com/woocommerce/woocommerce-blocks/pull/7881)
* Convert cart-checkout/totals/shipping component to TypeScript.

* Change hasRates tyep to boolean and fix renderOption type

* fix type for renderOption in ShippingRatesControlProps
2022-12-15 18:45:17 +04:00
Seghir Nadir b58c5beb3e Handle multiple packages coming from slots (https://github.com/woocommerce/woocommerce-blocks/pull/7829)
* Handle multiple packages coming from slots

* fix missing prop

* fix typo

* remove collapse param

* rename trinary to ternary
2022-12-15 15:17:22 +01:00
Luigi Teschio e71a2fdbb0 Filter By Stock: Add E2E for the Product Query Block (https://github.com/woocommerce/woocommerce-blocks/pull/7937) 2022-12-15 14:36:54 +01:00
Niels Lange 0cd069e9ee Remove account creation setting from Checkout block (https://github.com/woocommerce/woocommerce-blocks/pull/7941)
* Remove account creation setting from Checkout block

* Add CartCheckoutFeedbackPrompt

* Adjust e2e test
2022-12-15 18:13:28 +07:00
Niels Lange 36b37458e8 Make place order button editable (https://github.com/woocommerce/woocommerce-blocks/pull/7843)
* WIP: Make place order editable

* Remove obsolete undefined

* Wrap <ReturnToCartButton> within <Noninteractive>

* Rename const from submitButtonText to paymentMethodButtonLabel

* Simplify defaultValue logic
2022-12-15 17:28:23 +07:00