Commit Graph

3646 Commits

Author SHA1 Message Date
renovate[bot] 4cb5ecab32 Update dependency simple-git to 3.5.0 [SECURITY] (https://github.com/woocommerce/woocommerce-blocks/pull/6221)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-20 17:58:06 +02:00
Achyuth Ajoy a17159cb52 Allow saved payment methods labels other than card/eCheck to display brand & last 4 digits if present (https://github.com/woocommerce/woocommerce-blocks/pull/6177)
* Allow default label to use brand & last4 if present

* Lint fixes
2022-04-20 13:15:04 +02:00
Tung Du 97a3b06a66 Mini Cart: Support RTL languages (https://github.com/woocommerce/woocommerce-blocks/pull/6264) 2022-04-20 15:52:22 +07:00
renovate[bot] 2c0a935dd8 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/6183)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-20 10:24:28 +02:00
Tung Du e8d922142c E2E: Explain the reason for the addition language update command (https://github.com/woocommerce/woocommerce-blocks/pull/6280) 2022-04-20 11:48:13 +07:00
Lucio Giannotta 9b6d0e0e0f Fix Featured Product block frontend mismatch (https://github.com/woocommerce/woocommerce-blocks/pull/6263)
If the Featured Product block was added but not modified at all,
the block would not match the editor on the front end.

This was due to the fact that, on the frontend, the
block is SSR and was missing some defaults which
were present in JS.
2022-04-19 15:57:05 +02:00
Raluca Stan 54fba3fe4e Update release-initial-checklist.md 2022-04-19 11:35:00 +02:00
Niels Lange a1a7ae78fe Update information about Woo core changelog entry 2022-04-19 11:20:06 +02:00
Alex Florisca 59b4da800b Cart & Checkout translations test use nl_NL (https://github.com/woocommerce/woocommerce-blocks/pull/6267)
* Cart & Checkout translations test use the already installed language nl_NL

* Extra timeout when checking for shipping and billing addresses

* wait for selector instead of increase timeout

* Change waitForSelector selector:

* Clean up

* Increase idleTime for waitForNetworkRequest

* Fix random timeouts and increase timeout of verifying shipping option

* feedack
2022-04-19 08:56:52 +01:00
Tom Cafferkey 0d9348f618 Provide product filter blocks a method to know when to display. (https://github.com/woocommerce/woocommerce-blocks/pull/6270)
* Add has_filterable_products data to the AllProducts block to be used by product filter blocks

* Add has_filterable_products data to the ClassicTemplate block to be used by product filter blocks

* Add ClassicTemplatesCompatibility class which will add necessary data to the front-end of core PHP templates of Classic Themes for filter blocks being used as widgets.

* Update comment of set_php_template_data method on ClassicTemplatesCompatibility class

* Move conditional checking if the current theme is a block theme in ClassicTemplatesCompatibility class
2022-04-19 08:14:09 +01:00
Nadir Seghir 3021cc8de6 add releases to doc page 2022-04-15 15:03:31 +01:00
Nadir Seghir a06b2b5dcc add testing steps and readme from previous releases 2022-04-15 14:59:15 +01:00
Thomas Roberts 32189c0bb5 Fix bug with server errors not showing in Cart/Checkout (https://github.com/woocommerce/woocommerce-blocks/pull/6268)
* Add correct context to checkout and cart errors from API

* Correct typo in add-to-cart context

* Add correct context in add to cart form

* Add correct context in add to cart form

* Add correct context in Checkout State
2022-04-15 13:17:09 +01:00
Niels Lange 75f8de911a Allow running e2e test individually (https://github.com/woocommerce/woocommerce-blocks/pull/6230)
* Allow running e2e test individually

* Adjust ignore and root paths

* Simplify jest.performance.config.js

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-04-15 09:34:18 +01:00
Shendy 19dfae3dcc Call plugin_dir_url() in Package::get_url() instead of from its constructor. (https://github.com/woocommerce/woocommerce-blocks/pull/6260) 2022-04-14 17:28:32 +01:00
Tom Cafferkey 4d3c609a3c Make Attribute Filter block compatible with PHP rendered Classic Template block (https://github.com/woocommerce/woocommerce-blocks/pull/6204)
* Enable Attribute Filter block to work with the PHP rendered Classic Template block

* Check for presence of option before rendering it

* improve filter product by attribute

* fix pagination problem

* fix check when two filter block with same attribute are used

Co-authored-by: Luigi <gigitux@gmail.com>
2022-04-14 14:38:23 +02:00
Saad Tarhi 53da3a1c11 Fix release 7.4.0 changelog info 2022-04-14 13:29:57 +00:00
Saad Tarhi 91ec25424a Post release version bump (7.5.0-dev) 2022-04-14 13:23:29 +00:00
github-actions[bot] 7d96272cf0 Release: 7.4.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6225)
* Empty commit for release pull request

* Add Changelog to readme.txt

* Update WC tested and required versions

* Add testing notes

* Register missing C&C inner blocks and update fallback template for older C& C versions (https://github.com/woocommerce/woocommerce-blocks/pull/6195)

* Register missing C & C inner blocks and update fallback template for older C & C versions

This will fix the issues with missing order summary inner blocks: Coupons (both in C & C blocks) and the Cart header. The issue was happening because, for example, for Cart the coupons were registred on the on frontend, but it just wasn't forced in the attributes. Because it also wasn't added to the PHP fallback layout, the render function didn't include it. For the Checkout block the coupons inner block wasn't registered at all.

* Revert changes to Checkout.php, we don't need to test for inner blocks

* Revert "Revert changes to Checkout.php, we don't need to test for inner blocks"

This reverts commit fc39535f8476d02e35353374d9434a8723458cfa.

* Fix the returned template for older Checkout block iterations

* Fix Cart and Checkout templates to accommodate the Summary order inner blocks

* Hide coupon form div from inner blocks if coubons are not enabled

* Fix checkout coupon tests in checkout

They have been written for logged in user

* Fix Order Summary Heading inner block's default text

* Update comments with better wording

* Revert "Hide coupon form div from inner blocks if coubons are not enabled"

This reverts commit ab09021b923fad4218b3016e47760ad07f6bc960.

(cherry picked from commit 0b18ff59bd)

* Update the zip file link

* Update testing instructions

* Remove experimental build related PR from testing notes

* Fix/order summary sidebar css (https://github.com/woocommerce/woocommerce-blocks/pull/6231)

* Add box sizing to Totals item

* Add some unit tests for Order summary blocks

* Fix Proceed to checkout button size

(cherry picked from commit d22ce7cd0b)

* Update the WC required/tested versions

* Mini Cart Contents: Use block pattern to make the empty cart message translatable (https://github.com/woocommerce/woocommerce-blocks/pull/6248)

* try: use block pattern to make empty cart message translatable

* Update src/BlockTypes/MiniCart.php

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

* rename function

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Luigi <gigitux@gmail.com>
(cherry picked from commit 93ad72f6ff)

* Update the release's ZIP file

* Update testing notes

In woocommerce/woocommerce-blocks#6065, for Cart only Order Summary Heading & Coupon form can
be removed, and for Checkout only the Coupon form.

* Update the testing notes

Remove woocommerce/woocommerce-blocks#5870 testing notes because they can't be tested as a user

* Update Testing notes

Add screenshots to the woocommerce/woocommerce-blocks#5967 testing notes

* Remove woocommerce/woocommerce-blocks#6166 testing instructions

We reverted this PR

* Revert (https://github.com/woocommerce/woocommerce-blocks/pull/6166) (https://github.com/woocommerce/woocommerce-blocks/pull/6253)

Revert "Prevent Featured Product block from breaking when product is out of stock + hidden
from catalog (https://github.com/woocommerce/woocommerce-blocks/pull/6166)"

This reverts commit 92387e2

(cherry picked from commit c586b1a5f3)

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-04-14 11:55:33 +00:00
Saad Tarhi c586b1a5f3 Revert (https://github.com/woocommerce/woocommerce-blocks/pull/6166) (https://github.com/woocommerce/woocommerce-blocks/pull/6253)
Revert "Prevent Featured Product block from breaking when product is out of stock + hidden
from catalog (https://github.com/woocommerce/woocommerce-blocks/pull/6166)"

This reverts commit 92387e2
2022-04-14 10:31:01 +00:00
renovate[bot] 78ea50775a Update dependency @testing-library/react to v12.1.5 (https://github.com/woocommerce/woocommerce-blocks/pull/6241)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-14 11:19:41 +01:00
Luigi Teschio bac2c59daa Add Product Search Results Template (https://github.com/woocommerce/woocommerce-blocks/pull/6219)
* Add Search Result Product Template woocommerce/woocommerce-blocks#6218

Add Search Result Product Template

* update title

* add E2E test for Product Search Results template

* renaming class

* update E2E tests
2022-04-14 11:45:00 +02:00
renovate[bot] da7d8f664a Update dependency @testing-library/jest-dom to v5.16.4 (https://github.com/woocommerce/woocommerce-blocks/pull/6199)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-13 16:59:14 +01:00
Tung Du 93ad72f6ff Mini Cart Contents: Use block pattern to make the empty cart message translatable (https://github.com/woocommerce/woocommerce-blocks/pull/6248)
* try: use block pattern to make empty cart message translatable

* Update src/BlockTypes/MiniCart.php

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

* rename function

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Luigi <gigitux@gmail.com>
2022-04-13 17:15:48 +02:00
Tung Du ad85348151 Shopper → Mini Cart → Can view translated mini cart contents block (https://github.com/woocommerce/woocommerce-blocks/pull/6214) 2022-04-13 18:51:13 +07:00
renovate[bot] 8297085662 Update dependency @types/react to v17.0.44 (https://github.com/woocommerce/woocommerce-blocks/pull/6242)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-13 04:42:46 +00:00
Tung Du 230bc2f9f0 Fix: Shop page: Filter Products by Price block only works with Number of decimals set to 2 (https://github.com/woocommerce/woocommerce-blocks/pull/6229) 2022-04-13 11:31:55 +07:00
Lucio Giannotta ebd8774ae6 Enable more style options for the Featured Product block (https://github.com/woocommerce/woocommerce-blocks/pull/6181)
* Add support for overlay color and duotone
* Add support for custom inner padding
* Wrap all block experimental features in `isFeaturePluginBuild`
* Fix resizable container min height

The container now resizes if, e.g., padding is increased, and can't be resized down
with the handle to a height lower than it's minimum size determined by content and
padding box.

* Fix resizable handle not being fully visible

Previously, `overflow: hidden` was needed because the height constraint and
padding could push the content out of the container. Now this should not be
possible.

* Add an option to the block to decide how is the image fitted to the container
2022-04-12 17:16:00 +02:00
Raluca Stan d22ce7cd0b Fix/order summary sidebar css (https://github.com/woocommerce/woocommerce-blocks/pull/6231)
* Add box sizing to Totals item

* Add some unit tests for Order summary blocks

* Fix Proceed to checkout button size
2022-04-12 17:13:43 +02:00
Raluca Stan 0b18ff59bd Register missing C&C inner blocks and update fallback template for older C& C versions (https://github.com/woocommerce/woocommerce-blocks/pull/6195)
* Register missing C & C inner blocks and update fallback template for older C & C versions

This will fix the issues with missing order summary inner blocks: Coupons (both in C & C blocks) and the Cart header. The issue was happening because, for example, for Cart the coupons were registred on the on frontend, but it just wasn't forced in the attributes. Because it also wasn't added to the PHP fallback layout, the render function didn't include it. For the Checkout block the coupons inner block wasn't registered at all.

* Revert changes to Checkout.php, we don't need to test for inner blocks

* Revert "Revert changes to Checkout.php, we don't need to test for inner blocks"

This reverts commit fc39535f8476d02e35353374d9434a8723458cfa.

* Fix the returned template for older Checkout block iterations

* Fix Cart and Checkout templates to accommodate the Summary order inner blocks

* Hide coupon form div from inner blocks if coubons are not enabled

* Fix checkout coupon tests in checkout

They have been written for logged in user

* Fix Order Summary Heading inner block's default text

* Update comments with better wording

* Revert "Hide coupon form div from inner blocks if coubons are not enabled"

This reverts commit ab09021b923fad4218b3016e47760ad07f6bc960.
2022-04-12 12:20:22 +01:00
Thomas Roberts ab71adcd4b Pass correct number of arguments to woocommerce_blocks_checkout_update_order_from_request (https://github.com/woocommerce/woocommerce-blocks/pull/6224) 2022-04-12 10:30:27 +01:00
Jamel Noel Reid 64fcdda420 Add Product endpoint to ExtendSchema (https://github.com/woocommerce/woocommerce-blocks/pull/6122)
* Added ProductSchema Identifier

* Updated get_extended_schema & get_item_response

* Test for extensions field on products

* Updated endpoint extend Readme
2022-04-11 17:40:26 +01:00
Manos Psychogyiopoulos 62bfed8dec Decode HTML entities when formatting Store API error messages (https://github.com/woocommerce/woocommerce-blocks/pull/5870)
* Decode HTML entities when formatting Store API error messages

* 👌IMPROVE: Code formatting to avoid linting issues - woocommerce/woocommerce-blocks#5869

* 👌IMPROVE: Decode entities directly on the store notices container - woocommerce/woocommerce-blocks#5869

*  REVERT: Revert decode entities directly on the store notices container - woocommerce/woocommerce-blocks#5869

*  REVERT: Revert decode entities directly on the store notices container - woocommerce/woocommerce-blocks#5869

Co-authored-by: Panos (Panagiotis) Synetos <panos.synetos@automattic.com>
2022-04-11 15:11:25 +03:00
Daniel Dudzic 562a1afd56 Remove the ToggleButtonControl in favor of ToggleGroupControl (https://github.com/woocommerce/woocommerce-blocks/pull/5967)
* Remove the ToggleButtonControl in favor of ToggleGroupControl

* Remove ESLint errors. Use experimental feature as this is low risk

* Fix the 'Expected preceding comment block' ESLint error

Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2022-04-11 13:33:46 +02:00
Alex Florisca 5c396c4e26 Tidy up and organise e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/6206)
* rename some things

* Refactor e2e tests

* remove only from checkout test

* Typo in test

* Add --testPathIgnorePatterns performance back into package.json

* Niels feedback and fix a test

* Update import from utils
2022-04-11 11:52:33 +01:00
Alex Florisca 6c2d24e3e5 Fix/e2e tests timeout issue (https://github.com/woocommerce/woocommerce-blocks/pull/6165)
* Increase timeout of translations test to 30000

* Wait for network idle in goToCart and goToCheckout

* Increase timeout to 30000

* fix E2E tests

* try fix

* test

* test

* test

* another test

* fix test

* 60s timeout

* test

* Update product constants

* Simplify orderSummary check

* Go back to page.$

Co-authored-by: Luigi <gigitux@gmail.com>
2022-04-08 14:47:49 +01:00
Alex Florisca 0c7c2db6c0 Update @woocmmerce/eslint-plugin to 2.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6203)
* Update @woocmmerce/eslint-plugin to 2.0.0

* Fixed some eslint errors

* Fix syntax errors

* Fix most linting errors

* Feedback changes

* Fix one more eslint issue
2022-04-08 14:47:19 +01:00
Thomas Roberts cab947bc2b Remove `useStoreNotices` and interact directly with data store instead (https://github.com/woocommerce/woocommerce-blocks/pull/6159)
* Make useStoreNotices interact directly with the store

* Get/set error notices directly in store in paymentMethodDataContext

* Add hasNoticesOfType util

* Remove useStoreNotices and interact directly with data store

* Create/remove notices directly in store

* Remove tests for useStoreNotices

* Add tests for notices util

* Use setIsSuppressed from useStoreNoticesContext

* remove useStoreNotices hook

* Update context typedef to define only isSuppressed and setIsSuppressed

* Remove all values from StoreNoticesContext besides setIsSuppressed

* Wrap Cart and Checkout blocks in StoreNoticesProvider (for isSuppressed)

* Make StoreNoticesContainer a named export

This is required so we can import it from @wooommerce/base-context

* Change addErrorNotice to createErrorNotice to match store action

* Remove unnecessary StoreNoticeProviders and pass only context to container

* Accept a context in StoreNoticesContainer

* Pass relevant context to StoreNoticesContainer

* Add function to remove notices by status

* Prevent checkout from breaking when removing notices during processing

* Prevent TS error about not included path

* Add StoreNoticesContainer to single product block

* Add StoreNoticesContainer to All Products Block

* Ensure errors are shown when using All Products & Single Product Blocks

* Add a context arg to removeNoticesByStatus

* Use correct contexts for all products and single product block

* Update tests to reflect new context argument

* Re-add missing block file for order-summary

* Remove block file for order-summary

* Send context to useStoreCartCoupons to show errors correctly
2022-04-08 13:11:50 +01:00
Tung Du d5503b6e46 Fix: Mini Cart block isn't available in the Customizer > Widget (https://github.com/woocommerce/woocommerce-blocks/pull/6201) 2022-04-08 17:14:25 +07:00
Tung Du 5415c22251 Prepare the Mini Cart block for WC Core release (https://github.com/woocommerce/woocommerce-blocks/pull/6209) 2022-04-08 15:51:21 +07:00
Tung Du 1fb7274633 Refactor: Style quantity input dynamically (https://github.com/woocommerce/woocommerce-blocks/pull/6167) 2022-04-08 15:49:27 +07:00
Tarun Vijwani d85e9766a7 Increased Cart product quantity limit to 9999 (https://github.com/woocommerce/woocommerce-blocks/pull/6202)
Increased per item cart limit to 9999
2022-04-08 12:46:48 +04:00
Alex Florisca e37b787e50 Move mini cart outside cart-checkout folder (https://github.com/woocommerce/woocommerce-blocks/pull/6192)
* Move shared folder to /blocks

* Moved mini-cart block in blocks dir:

* Rename shared folder to cart-checkout-shared

* Remove customDir from mini-cart webpack entry

* Update assets/js/base/context/tsconfig.json

Co-authored-by: Tung Du <dinhtungdu@gmail.com>

* Feedback changes

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-04-07 14:47:58 +01:00
Thomas Roberts d7a52b6f67 Check for performance file existence before running reporter (https://github.com/woocommerce/woocommerce-blocks/pull/6189)
* Check for performance file existence before running

* check reports/performance-report.json file exists on setup

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-04-06 12:22:51 +01:00
AndrewJDawes fc20c8363e Fix Actions and Filters documentation with broken links woocommerce/woocommerce-blocks#5808 (https://github.com/woocommerce/woocommerce-blocks/pull/6128)
* Fix docs paths for actions and filters source links woocommerce/woocommerce-blocks#5824

* Build docs after fixes for woocommerce/woocommerce-blocks#5824 - see 0c79cb7f4e75fc5c48c9b054cbac6f0344b4048a
2022-04-05 16:22:56 +02:00
Albert Juhé Lluveras 58c649e971 Update Filter Products by Price block to work with PHP templates (https://github.com/woocommerce/woocommerce-blocks/pull/6146)
* Update Filter Products by Price block to work with PHP templates

* Reformat param formatting

* Add check for PHP template

* window guards and comments for context

* Add comment to page reload

* Addressed code review feedback

* Fix setMinPriceQuery and setMaxPriceQuery values

* Remove unnecessary snake_case comment and update newUrl to assign to window.location.href.

* package-lock.json update

Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
2022-04-05 11:52:35 +01:00
Alex Florisca e15d516163 Revert "Move cart and mini-cart blocks into their own folders (https://github.com/woocommerce/woocommerce-blocks/pull/6126)" (https://github.com/woocommerce/woocommerce-blocks/pull/6190)
This reverts commit d005dbd2cf.
2022-04-05 11:14:32 +01:00
Thomas Roberts 10793e8e18 Try adding performance tests (https://github.com/woocommerce/woocommerce-blocks/pull/6119)
* Add performance script to measure load times of cart and checkout blocks

* Temp commit

* Temp commit

* Temp commit

* Remove specific test from performance e2e command

* Add performance reporter

* Add step to clean performance file before running tests

* Add test report constant & average and logPerformanceResult test utils

* Update uses of product name constant

* Add cart coupon performance test

* Check if report file is empty before parsing

* Limit performance tests to only ones in performance directory

* Round the averages and add a linebreak after each entry in the log

* Fix formatting of report and only output after all tests

* Log each loading metric as an individual data point

* Improve formatting

* Get load times in ms from profiler

* Revert changes to fixtures

* Remove trace.json from git

* Remove checkout test file (tests not implemented)

* Check performance log file exists before truncating it

* Fix checkout coupon test

* Remove console logs

* Revert to use virtual products after rename of constant

* Ignore performance tests when running regular e2e tests

* Feedback changes

* Tidy up

* Fix packag-log.json:

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-04-04 13:30:07 +01:00
Alex Florisca d005dbd2cf Move cart and mini-cart blocks into their own folders (https://github.com/woocommerce/woocommerce-blocks/pull/6126)
* Move cart and mini-cart into their own folders

* Update other references of cart-checkout
2022-04-04 12:34:29 +01:00
Alba Rincón b56097337f Update `Product Title` link settings to match `Post Title` (https://github.com/woocommerce/woocommerce-blocks/pull/6131)
* Rename `Product Title` `Content` panel to `Link settings`

* Rename toggle `Link to Product Page` to `Make title a link`

* Remove help text

* Add `rel` and `linkTarget` to the `Product Title` settings

* Add `rel` and `linkTarget` to the `Product Title` block

* Only add the `target` attribute if the title is rendered as a link

* Keep the `nofollow` in rel as it was before

* Make `linkTarget` and `rel` optional

To not change the html generated for other components also using `ProductName`

* Add tests fotr the `Title` component

* Improve rel condition

* Extract `linkRel` variable

* Remove unnecessary undefined

* Remove the default value for `linkTarget`

Since it is the default behavior of the browsers, we don't need it.

* Remove the `nofollow` rel value

It was decided to remove it since it's a link to internal pages.
See the PR discussion for more context.

* Remove the `rel` option

It does not have much sense to have it since it's always an internal link.
See the PR discussion for more context.

* Clean-up `rel` related code
2022-04-04 09:06:24 +02:00
Saad Tarhi c636cb1bbe Shopper → Checkout → Can apply single-use coupon once (https://github.com/woocommerce/woocommerce-blocks/pull/6174)
* Add "single-use" coupon to the fixture data

* Create a first draft of the coupon e2e test

* Create single use coupon code constant

* Create "applyCouponFromCheckout" function

* Remove the "single-use" coupon from the fixture data

* Setup coupon creation using Woo's Rest API

* Add single-use coupon E2E test

* Move discount XPath definition to the expressions file

* Clean comments

* Remove unnecessary delay function

* Refactor to a more human friendly check

* Clear the setup in the afterAll branch (delete coupon)

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-04-01 23:09:54 +00:00
Mike Jolley eb196226d8 WIP: Add Inner blocks to order summary (https://github.com/woocommerce/woocommerce-blocks/pull/6065)
* Sub/Total/Fee inner blocks

* Row blocks within the inner block

* Update icons

* Resolve stying issues

* Remove old block

* Pin totals row

* Locking logic update

* Heading inner block

* Refactor where inner blocks are defined

* Add todos

* Todo for Consider deprecating OrderMetaSlotFill and DiscountSlotFill in favour of inner block areas.

* Improve frontend registration of components using new entrypoint

* Experiment- external block context

* Revert "Experiment- external block context"

This reverts commit 4b75668ec7eb62f065c6a488cd942a666e26204f.

* Duplicate inner blocks to avoid conflicts with context

* Remove todo

* Rename block dir

* Some test fixes

* Fix import

* fix import

* linting

* Remove unused attributes

* Optional classname

* fix coupons import

* fix shipping mocks

* Styling

* Fix selectors in e2e tests

* Add back the wc-block-components-totals-wrapper class that was used for each segment in the totals Order summary

Because, removing them was:
-  a breaking change for the old structure
- was making it harder to target the inner blocks. Before the class was used to target each segment
- it was making the wc-block-components-totals-item behave as a child or parent depending on the inner block, inconsitency

* Reuse the TotalsWrapper component for C& C blocks inner blocks

This component was removed in this PR, but  we wrap components in the Cart and Checkout sidebar in a TotalsWrapper. This will ensure consistent spacing and borders are applied to items in the sidebar.

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
2022-04-01 15:45:18 +02:00
renovate[bot] d6e0db14ef Update dependency @types/lodash to v4.14.181 (https://github.com/woocommerce/woocommerce-blocks/pull/6162)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-01 13:26:59 +01:00
Luigi Teschio 4f2f267cf8 Add tests for the Mini Cart Block when it is added on the FSE editor. (https://github.com/woocommerce/woocommerce-blocks/pull/6000)
* Add tests for the Mini Cart Block when it is added on the FSE editor woocommerce/woocommerce-blocks#5727

Add tests for the Mini Cart Block when it is added on the FSE editor

* not hardcoding selectors

* fix typo

* restore old searchForBlock function

* add export

* Revert "restore old searchForBlock function"

This reverts commit 7049ad85bc2752ad33933eec00da9682943ec35a.

* use searchForBlock from package only for FSE pages

* add fix for GB
2022-04-01 11:23:48 +02:00
Luigi Teschio 54b52c62ca Mini Cart block - fix translations handling woocommerce/woocommerce-blocks#6153 (https://github.com/woocommerce/woocommerce-blocks/pull/6158)
* Mini Cart block - fix translations handling woocommerce/woocommerce-blocks#6153

Mini Cart block - fix translations handling

* Mini Cart block - fix translations handling (https://github.com/woocommerce/woocommerce-blocks/pull/6164)

* loads translations for deps

Co-authored-by: Tung Du <dinhtungdu@gmail.com>

* address code review. load translations close to associated scripts

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-04-01 10:54:01 +02:00
Tomasz Tunik d62a126476 Ensure e2e tests work with TS (https://github.com/woocommerce/woocommerce-blocks/pull/6173)
* Cleanup e2e jest config from moduleFileExtensions

moduleFileExtensions by default support js, ts, tsx etc.

* convert legacy-template-blocks e2e test to TS

* clean up jest.config.json moduleFileExtensions

unnecessary defaults override
2022-04-01 10:22:54 +02:00
Alba Rincón 92387e2912 Prevent `Featured Product` block from breaking when product is out of stock + hidden from catalog (https://github.com/woocommerce/woocommerce-blocks/pull/6166)
* Prevent accessing the first element of the `parentProduct` array if empty

* Include all products regardless of their `stock_status`

By default, the `/wc/store/v1/products` endpoint does not return products with
`outofstock` stock status. We want the users to be able to select any product
regardless of its stock status, we need to explicitly request them using the
`stock_status` query param.

* Use the optional chaining operator

Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
2022-03-31 15:24:10 +02:00
Niels Lange 8943629a86 Shopper → Checkout → Can have different shipping and billing addresses (https://github.com/woocommerce/woocommerce-blocks/pull/5860)
* Shopper can have different shipping and billing addresses

* Shopper can have different shipping and billing addresses

* Shopper can have different shipping and billing addresses

* Correct billing field IDs

* Remove unused variable

* Remove unused timeout

* Remove unused commands

* Activate company field using setCheckbox

* Deactivate company field using unsetCheckbox

* Remove obsolete command

* Empty cart before and after each test

* Remove obsolete import

* Check billing and shipping company

* Remove manual code with unsetCheckbox

* Fill company if field exist

* Get checkbox ID from label

* Remove duplicate company field toFill method

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-31 13:10:50 +02:00
Tung Du 77990a5c1b Fix: Shopping Button default hover and focus style (https://github.com/woocommerce/woocommerce-blocks/pull/6157) 2022-03-30 18:38:29 +07:00
Albert Juhé Lluveras eb8bfedcf1 Remove button aligment from Featured Product and Featured Category blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6156) 2022-03-30 10:57:06 +02:00
renovate[bot] 992e84dc58 Update dependency @types/react to v17.0.43 (https://github.com/woocommerce/woocommerce-blocks/pull/6163)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-30 03:36:38 +00:00
dependabot[bot] b560a00acc Bump node-forge from 1.2.1 to 1.3.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6142)
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 16:06:13 +01:00
dependabot[bot] f2dc23a7b9 Bump plist from 3.0.4 to 3.0.5 (https://github.com/woocommerce/woocommerce-blocks/pull/6143)
Bumps [plist](https://github.com/TooTallNate/node-plist) from 3.0.4 to 3.0.5.
- [Release notes](https://github.com/TooTallNate/node-plist/releases)
- [Changelog](https://github.com/TooTallNate/plist.js/blob/master/History.md)
- [Commits](https://github.com/TooTallNate/node-plist/commits)

---
updated-dependencies:
- dependency-name: plist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 16:05:47 +01:00
Alex Florisca 1108c9994b Fix E2E Tests on trunk (https://github.com/woocommerce/woocommerce-blocks/pull/6154)
* Fire up CI

* Increase timeout after selector
2022-03-29 16:05:11 +01:00
dependabot[bot] 3201282e1a Bump minimist from 1.2.5 to 1.2.6 (https://github.com/woocommerce/woocommerce-blocks/pull/6141)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 15:58:54 +01:00
Tung Du f4d4bed2c1 Mini Cart Contents: Refactor inner blocks styling using `currentColor` (https://github.com/woocommerce/woocommerce-blocks/pull/6130) 2022-03-29 20:48:59 +07:00
Alba Rincón adca9b0c30 Convert Title component to TS (https://github.com/woocommerce/woocommerce-blocks/pull/6115) 2022-03-29 12:16:17 +02:00
Alex Florisca f344d192d9 E2E tests for translated Cart & Checkout blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6101)
* Translation tests for Cart & Checkout

* Remove comments
2022-03-28 16:20:59 +01:00
tjcafferkey beaefc0bc6 Version bump to 7.4.0-dev 2022-03-28 16:01:04 +01:00
github-actions[bot] b60a7418f1 Release: 7.3.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6129)
* Empty commit for release pull request

* Updated changelog

* Prepare the Mini Cart block for Feature Plugin (https://github.com/woocommerce/woocommerce-blocks/pull/6127)

* Release notes

* Update plugin url

* Add 730 to README testing

* Remove PR from testing notes and changelog

* Remove PR from testing notes

* Allow memoized filters to re-run if `defaultArg` changes (https://github.com/woocommerce/woocommerce-blocks/pull/6102)

* Check the last defaultArg to decide whether we re-run filters

* Fake commit to make CI run

* Revert change to .gitignore to make CI run

* Update testing instructions

* Update testing instructions

* Update download link

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-03-28 15:58:41 +01:00
Alex Florisca 2459c05d42 Critical flows: Shopper → Cart/Checkout → Can use express checkout (https://github.com/woocommerce/woocommerce-blocks/pull/6075)
* Test if express payment button is available on cart & checkout

* Remove unused uiUnblocked
2022-03-28 14:48:21 +01:00
Alba Rincón e140901142 Convert `CheckoutOrderNotes` to TS (https://github.com/woocommerce/woocommerce-blocks/pull/6118)
* Convert order-notes to TS

* Rename onChange argument name

To be consistent with the one in the `setOrderNotes` action
2022-03-28 15:44:25 +02:00
Tomasz Tunik f7f1b89dc5 Upgrade @wordpress/scripts and /env packages (https://github.com/woocommerce/woocommerce-blocks/pull/6114)
* upgrade wordpress/scripts to 22.3

* update jest config/setup

* add explicit-exports-references plugin

to handle payment-method-config.tsx spying on external methods
the way code is output now changed and tests like this would not
work anymore as transpilet files were no longer using exports but
local references to methods.

* missing snapshot

* make cart-products E2E test more stable

* surppress eslint error in test file

* fix css stylelint issues

* update eslint-plugin-woocommerce eslint package

* remove temp test:e2e:start script

* re-run

* add stylelint as recommended extension

* remove redundant types (provided by packages now)

* patch update @testing-library/jest-dom
2022-03-28 15:00:20 +02:00
Tomasz Tunik e821983447 Improve goToSiteEditor E2E utils (https://github.com/woocommerce/woocommerce-blocks/pull/6109)
* dry getAllTemplates util

* Improve goToSiteEditor e2e util

It will now properly wait for page to load
and critical parts to be available before
handing control over to the next steps

* adapt site editing tests to new goToSiteEditor API

* try to stabilize the saveTemplate

to early navigation was causing the dreaded
"Expected an Error, but "" was thrown"

* try stabilizing saveTemplate

* contextually group/sort params

* improve clarity of the goToSiteEditor E2E util

- adds goToSiteEditor private helper that hides the temporary need
for handling theme.php and site-editor.php paths
- adds two exported utils goToTemplatesList and goToTemplateEdit
that hide UX details of waiting ofr page to be ready on load including special
case for waitingFor templates list actions to be loaded

* put back page where it belongs 
2022-03-28 14:32:15 +02:00
Thomas Roberts 5cc165d7a8 Allow memoized filters to re-run if `defaultArg` changes (https://github.com/woocommerce/woocommerce-blocks/pull/6102)
* Check the last defaultArg to decide whether we re-run filters

* Fake commit to make CI run

* Revert change to .gitignore to make CI run
2022-03-28 12:10:36 +01:00
Tung Du 3b8d790efe Prepare the Mini Cart block for Feature Plugin (https://github.com/woocommerce/woocommerce-blocks/pull/6127) 2022-03-28 15:42:07 +07:00
Tung Du 7d60c8fc66 Fix: Mini Cart: Ability to choose the drawer behavior when user add products to cart (https://github.com/woocommerce/woocommerce-blocks/pull/6052) 2022-03-26 07:32:23 +07:00
Saad Tarhi ba2308f729 Shopper → Checkout → Can see warnings when form is incomplete (https://github.com/woocommerce/woocommerce-blocks/pull/6116)
* Create "isLoggedIn" shopper function

This function checks if a shopper is logged in

* Add "Can see warnings when form is incomplete" test

* Optimize login check and logout process for the test

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-25 18:34:17 +01:00
Daniel Dudzic 070852bf69 Filter Products by Attribute: Fix dropdown search case sensitivity (https://github.com/woocommerce/woocommerce-blocks/pull/6096)
* Filter Products by Attribute: Fix dropdown search case sensitivity handling

* Refactor the dropdown search logic and add an isCaseSensitive option

* Dropdown search: Match against the name rather than value

* Clean up and refactor the search dropdown code
2022-03-25 10:49:17 +01:00
Alba Rincón 88b208ebef Convert Textarea component to TS (https://github.com/woocommerce/woocommerce-blocks/pull/6113) 2022-03-25 10:21:09 +01:00
Tung Du ed83dfbafa Shopper → Mini Cart → Can remove product (https://github.com/woocommerce/woocommerce-blocks/pull/5937) 2022-03-24 22:37:17 +07:00
Tung Du 6e375408f7 Mini Cart: Fix footer buttons hover style (https://github.com/woocommerce/woocommerce-blocks/pull/6086)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2022-03-24 22:34:36 +07:00
Tom Cafferkey b3fca9a1b9 Add static keyword to function (https://github.com/woocommerce/woocommerce-blocks/pull/6112) 2022-03-24 09:55:46 +00:00
Tomasz Tunik fdb8dde033 Fix site editor E2E tests for Gutenberg latest (https://github.com/woocommerce/woocommerce-blocks/pull/6080)
* Add handling of editor context via GUTENBERG_EDITOR_CONTEXT env var
* Fix flaky tests around editing templates
* Wait for save template response to complete
2022-03-23 14:18:00 +01:00
Saad Tarhi f8c5e910d2 Shopper → Cart → Can update product quantity (https://github.com/woocommerce/woocommerce-blocks/pull/6025)
* Add XPath expressions

* Add "setCartQuantity" utility function

* Add "productIsInCart" utility function

* Add "update product qty" e2e test

* Clean up test file

* Fix test on headless mode

* Add Increase/Decrease qty test cases

* Decrease the query chain for better maintainability

* Rename expression functions/file for more clarity

* Resolve conflict with trunk

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-23 13:51:56 +01:00
Niels Lange 9346e723f3 Shopper can place an order as logged in user (https://github.com/woocommerce/woocommerce-blocks/pull/6037)
* Shopper can place an order as logged in user

* Fill billing address for logged in user

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-03-23 13:23:22 +01:00
Niels Lange e4088cc398 Update documentation-guidelines.md 2022-03-23 12:22:06 +01:00
Tarun Vijwani 532952dd31 Critical flows: Shopper → Checkout → Can view empty checkout message (https://github.com/woocommerce/woocommerce-blocks/pull/6042)
* Added new test case for Critical flows: Shopper → Checkout → Can view empty checkout message
2022-03-23 15:17:48 +04:00
Niels Lange 512ae84b09 Shopper → Checkout → Can choose payment option (https://github.com/woocommerce/woocommerce-blocks/pull/5839)
* Shopper can choose payment option

* Empty cart before and after each test

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-03-23 12:01:33 +01:00
Tom Cafferkey 7d0c2847f5 Refactor BlockTemplateUtils (https://github.com/woocommerce/woocommerce-blocks/pull/6019)
* Refactor BlockTemplateUtils.php

* Update comments

* Code review feedback

Co-authored-by: Tom Cafferkey <tom@Toms-MBP-2.broadband>
2022-03-23 09:16:07 +00:00
renovate[bot] 39b873fe76 Update dependency @types/react-dom to v17.0.14 (https://github.com/woocommerce/woocommerce-blocks/pull/6084)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-23 09:49:50 +01:00
renovate[bot] 323eca31bc Update dependency @types/gtag.js to v0.0.10 (https://github.com/woocommerce/woocommerce-blocks/pull/6082)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-23 09:00:13 +01:00
renovate[bot] 630bc9ee99 Pin dependency prettier to 2.0.5 (https://github.com/woocommerce/woocommerce-blocks/pull/6081)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-23 08:51:15 +01:00
renovate[bot] fa6e6cfb33 Update dependency @types/react to v17.0.41 (https://github.com/woocommerce/woocommerce-blocks/pull/6083)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-23 08:50:25 +01:00
Tomasz Tunik e1ae6b4552 Update GitHub actions/setup-node and add optionalDependencies handling (https://github.com/woocommerce/woocommerce-blocks/pull/6032)
* Update actions/setup-node to v2 and to use ,nvmrc file

* Fix order of actions for Bundle Size workflow

* Use actions/setup-node cache instead of actions/cache

+ ensure we always install with npm ci

* restore linting setup job to cache npm

* Don't install ndb in CI

Move ndb package to optionalDependencies and update
the CI workflows to not install optional dependencies

* Update actions/setup-node to v3

* Update actions/checkout to v3

* Update download and upload-artifact actions to v3

* Update actions/stale to v5
2022-03-23 08:41:43 +01:00
Tung Du 937bab7688 Fix: Mini Cart Contents: only show the active view (https://github.com/woocommerce/woocommerce-blocks/pull/6053) 2022-03-23 09:58:03 +07:00
Alba Rincón 1f9e4675fc Add `CurrencyCode` type (https://github.com/woocommerce/woocommerce-blocks/pull/6035)
* Create the CurrencyCode and use it for the currency `code` instead of the type `string`

Using the CurrencyCode type, the allowed values for the `code` property are restricted
to the ISO 4217 codes and not any string.

* Add and remove some currency codes to match the ones on WooCommerce

The WooCommerce supported list can be found here: https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/wc-core-functions.php#L475

* Use CurrencyCode type on CurrencyInfo and CurrencyResponse instead of string
2022-03-23 00:30:56 +01:00
Alba Rincón e7a061d56f Show the skeleton only when the slider is loading and disabled (on the first load) (https://github.com/woocommerce/woocommerce-blocks/pull/6078)
It should not be shown when the user changes the input range
2022-03-22 23:38:53 +01:00
Alba Rincón 13311e7bee Rename Legacy Template block to Classic Template block (https://github.com/woocommerce/woocommerce-blocks/pull/6021)
The internal ID has been kept after a comment by @tjcafferkey. This causes a
bit of inconsistency in the internal code, but it was deemed that it would have
been better as users who have customized templates using this
blocks ID will have saved this in their database, and it would result
in a corrupt block when loaded, and we didn't want to support both IDs at the
moment.

Otherwise, most other references to the legacy template, are now using the word
“classic”.

Co-authored-by: Alba Rincón <alba@albasauatticmbp.home>
2022-03-22 23:34:43 +01:00
Mike Jolley 89e86b4999 Create deprecated_dependency wrapper to log errors conditionally (https://github.com/woocommerce/woocommerce-blocks/pull/6074)
Store Editing  E2E tests are failing because of an upstream regression, not related to this PR
2022-03-22 15:06:14 +01:00
Tung Du 9c22f241ca Mini Cart: Improve template part description (https://github.com/woocommerce/woocommerce-blocks/pull/6054) 2022-03-22 08:56:02 +07:00
Tung Du 64ae9330a2 Shopper → Mini Cart → Can see correct tax (https://github.com/woocommerce/woocommerce-blocks/pull/5979)
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
2022-03-22 08:54:06 +07:00
renovate[bot] c735812df9 Update dependency @types/lodash to v4.14.180 (https://github.com/woocommerce/woocommerce-blocks/pull/6058)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-16 04:49:56 +00:00
renovate[bot] eaabd1eee9 Update dependency @types/gtag.js to v0.0.9 (https://github.com/woocommerce/woocommerce-blocks/pull/6057)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-16 04:46:20 +00:00
renovate[bot] 6421f80ed2 Update dependency @testing-library/react to v12.1.4 (https://github.com/woocommerce/woocommerce-blocks/pull/6056)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-16 02:35:25 +00:00
renovate[bot] fad55e9295 Pin dependency @woocommerce/e2e-utils to 0.2.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6055)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-16 02:20:32 +00:00
Mike Jolley c299411e28 7.2 testing notes 2022-03-15 11:53:56 +00:00
Mike Jolley f68890170a 7.2.0 changelog 2022-03-15 11:33:20 +00:00
Mike Jolley f926b24480 Checkout: Missing country error for virtual orders (edge case) (https://github.com/woocommerce/woocommerce-blocks/pull/6050)
* Make shipping address field optional on checkout routes

* Make update_customer_from_request use billing for shipping if omitted

* making shipping optional when needed

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2022-03-14 13:53:08 +00:00
Mike Jolley c401369e04 Revert "Remove .gitattributes file (https://github.com/woocommerce/woocommerce-blocks/pull/5242)" (https://github.com/woocommerce/woocommerce-blocks/pull/6049)
This reverts commit 6ae286f670.
2022-03-14 12:42:34 +00:00
Thomas Roberts a6bff7e6e8 Change `shippingRatesLoading` to `isLoadingRates` (https://github.com/woocommerce/woocommerce-blocks/pull/5999)
* Change `shippingRatesLoading` to `isLoadingRates`

* Revert isLoadingRates back to old name in payment method interface

* Update docs with correct names returned by usePaymentMethodInterface

* Update TS to name the selectShippingRate method correctly

* Change method name on usePaymentMethodInterface back
2022-03-14 11:29:25 +00:00
Daniel Dudzic 5a8e94d86e Product Ratings: Add Global Styles font size and spacing support (https://github.com/woocommerce/woocommerce-blocks/pull/5927)
* Product Ratings: Add font size and spacing support

* Fix useTypographyProps hook

* Set SkipSerialization for Ratings block props

* Add additional hasSpacingStyleSupport check for the spacing

Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
2022-03-11 16:52:00 +01:00
Mike Jolley 011c4cb6fd Add missing chunk to register_block_type_assets 2022-03-11 15:34:25 +00:00
Albert Juhé Lluveras 0819ab2797 Correctly load JS translations from WC core (II) (https://github.com/woocommerce/woocommerce-blocks/pull/6036)
* Correctly load JS translations from WC core (II)

* typo

* empty instead of count

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-03-11 14:18:45 +00:00
Mike Jolley 8e057a03f5 Remove X- Prefixes from custom headers (https://github.com/woocommerce/woocommerce-blocks/pull/6020)
* Remove X- Prefixes from custom headers

* Fix docs

* Handle deprecated X-WC-Store-API-Nonce header if received

* Send old nonce until future version removes this

* Add todo and cut off date

* wc_deprecated_argument

* Update todo name

* typo

* Back compat in batch

* Flip Nonce logic to make it easier to support both in client bw compat logic
2022-03-11 12:07:08 +00:00
Tomasz Tunik 2ad55b5b9e Fix box-sizing on Global Styles blocks with border width control (https://github.com/woocommerce/woocommerce-blocks/pull/6043)
Set box-sizing to border-box on affected blocks: Featured product, featured category, sale badge.
2022-03-11 13:01:15 +01:00
Luigi Teschio f78b2d8619 Remove not used attributes (https://github.com/woocommerce/woocommerce-blocks/pull/5974)
* Remove not used attributes woocommerce/woocommerce-blocks#5952

remove not used attributes

* remove not necessary jsdoc comments

Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
2022-03-11 12:44:51 +01:00
Tung Du 75bf08d2c9 Fix: Exclude Button block from the Empty Mini Cart Contents block insterter (https://github.com/woocommerce/woocommerce-blocks/pull/6034) 2022-03-11 08:17:37 +07:00
renovate[bot] dcec8f38b5 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/5724)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-10 18:16:25 +01:00
Seghir Nadir d694b9b089 Ignore storybook dist folder when running eslint (https://github.com/woocommerce/woocommerce-blocks/pull/6033)
* ignore storybook dist folder

* Add reports folder to .eslintignore

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-03-10 17:25:29 +01:00
Luigi Teschio 807720a28d Remove not necessary todo woocommerce/woocommerce-blocks#5827 (https://github.com/woocommerce/woocommerce-blocks/pull/6039)
Remove not necessary todo
2022-03-10 14:53:42 +01:00
Mike Jolley 7f512d1c26 Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-gutenberg-products-block into trunk 2022-03-10 13:38:55 +00:00
Mike Jolley bfdd50cb63 7.3.0-dev in package.json 2022-03-10 13:38:52 +00:00
Mike Jolley 5165611e45 Remove deprecated data controls in favour of those from the `@wordpress/data` package (https://github.com/woocommerce/woocommerce-blocks/pull/5574)
* Remove expected warnings from test suite

* Switch dispatch and select usage to `controls`, from `@wordpress/data`

* Wrap render with act

* resolveSelect to wait for resolution

* resolveSelect
2022-03-10 13:22:05 +00:00
Christos Lilitsas 28d647d02c Clear notices session after handling (https://github.com/woocommerce/woocommerce-blocks/pull/5983) 2022-03-10 12:29:58 +00:00
Tarun Vijwani 349c668f01 Critical flows: Shopper → Cart → Can view empty cart message (https://github.com/woocommerce/woocommerce-blocks/pull/6024)
* Added test case for Critical flows: Shopper → Cart → Can view empty cart message
2022-03-10 15:50:07 +04:00
Tarun Vijwani 0530048f4c Critical flows: Shopper → Cart → Can remove product (https://github.com/woocommerce/woocommerce-blocks/pull/6015)
* Added test case for Critical flows: Shopper → Cart → Can remove product
2022-03-10 15:47:53 +04:00
Tomasz Tunik f15d628610 Fix 404 and 500 errors in E2E test logs, editor and front-end. (https://github.com/woocommerce/woocommerce-blocks/pull/5989)
* Change atomic blocks to not use custom webpack build paths

we want to always load lazy loaded components from their default paths
to avoid having to handle importing components in different ways for
regular and atomic component packages

* Add footer parts to test themes

The Site Editor is expecting the footer parts to be there or it will try to
load them anyways and throw a 404. It's not breaking, but it's polluting
the console.

* Use REST API to tear down the templates

Previously, we used a util called `trashAllPosts` which navigated to the post UI
and deleted all the posts to tear down any side-effects of template editing tests.

However, with a [recent change](14e20f72b5),
WP Core removed the UI for those and that made our tests meet a 500 error.

Using the REST API should also make everything faster.

* Remove deprecated pupeteer waitFor usage

was still present in attribute-filter.test.js

* Update package-lock.json

* pin package versions

* Unify all atomic blocks to register on php side

* Remove Atomic Blcoks chunk_translation handling from AllBlocks

Before it was responsible for enabling translations for all the atomic blocks

* Add per atomic block chunk_translation registration

* update @wordpress/e2e-test-utils to 6.0.2

* add optional puppeteer

* pin workflows node version to 16.13.2

* upgrade package-lock

* upgrade package-lock

* set react and react-dom as peerDeps

* remove atomic block registration

Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
Co-authored-by: Luigi <gigitux@gmail.com>
2022-03-10 11:00:23 +01:00
Alex Florisca a67876e7d7 Update debug script name (https://github.com/woocommerce/woocommerce-blocks/pull/6014)
* Update debug script name

* rename to test:debug
2022-03-09 15:37:36 +00:00
Mike Jolley 235f260c04 Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-gutenberg-products-block into trunk 2022-03-09 12:26:19 +00:00
Mike Jolley 04df284fe0 7.3.0-dev 2022-03-09 12:26:15 +00:00
Mike Jolley c3bf23fd4e Prefetch cart and checkout block assets when cart has contents (https://github.com/woocommerce/woocommerce-blocks/pull/5553)
* Prefetch block resources when cart has contents

* Fix error when cart is undefined
2022-03-09 12:25:36 +00:00
Niels Lange d9dd7a0df6 Shopper can choose shipping option (https://github.com/woocommerce/woocommerce-blocks/pull/5844) 2022-03-09 13:23:52 +01:00
Mike Jolley 22e206d00a Remove `internal` comments from Store API file comments (https://github.com/woocommerce/woocommerce-blocks/pull/6005)
* Remove internal comments

* Remove line break

* Notices
2022-03-09 10:20:47 +00:00
Alex Florisca fcadeaa2e1 E2E test improvements and consolidatng (https://github.com/woocommerce/woocommerce-blocks/pull/6013)
* Refactor e2e tests slightly for better efficiency

* Add "proceedToCheckout" shopper method & refactor code

* Use "beforeEach" in case we add more test cases

I've kept the "afterAll" function to reset any side effects at the end
of this file's tests

* Use "beforeEach" in "checkout-place-order-as-guest" file

* Use BASE_URL in shopper.block.goToBlockPage

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-09 10:16:24 +00:00
Tung Du e735ffe5c2 Refactor: Use an alternative mini cart icon to fix the Mini Cart styling issues (https://github.com/woocommerce/woocommerce-blocks/pull/5985) 2022-03-09 16:13:52 +07:00
renovate[bot] 9503f03f9b Update dependency follow-redirects to v1.14.9 (https://github.com/woocommerce/woocommerce-blocks/pull/6018)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-09 03:07:12 +00:00
renovate[bot] 072c39b269 Update dependency @types/puppeteer to v5.4.5 (https://github.com/woocommerce/woocommerce-blocks/pull/6017)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-09 03:02:53 +00:00
Tung Du 22cdefd3da Cart: Accepted Payment Methods block: Use utility instead of the local function (https://github.com/woocommerce/woocommerce-blocks/pull/6001) 2022-03-09 07:06:32 +07:00
Alex Florisca 2e674dd6c0 Critical flow: Can see correct tax (https://github.com/woocommerce/woocommerce-blocks/pull/5900)
* Tax is displayed correctly e2e test

* Add extra utils to shopper

* add single e2e test script oin package.json

* Feedback changes from Niels

* Test tax is correct on summary page

* Check if CI test passes

* Longer timeout for tax test

* change timeout in jest config

* increate jest timeout

* Test

* Test

* Test

* setTimeout outside of tests to 120000

* Address raluca's feedback and timeout everywheregaa

* Increase timeout on  for search box

* set jest timeout to 120000

* Raluca's suggestions

* Debug

* Increase search timeout to 5000

* Only run Tax e2e tests in CI for quicker debug - REMOVE THIS

* use waitforSelector

* 30s delay for toMatchElement

* Let'shope this works

* Remove toMatchElement

* waitForSelector

* Run debug test only

* Debug tax test

* debug taxes

* shopper using toMatchElement again

* Remove the 30000 timeout delay from toMatchElement

* Run all tests but only once

* Remove tax test

* Revert "Remove tax test"

This reverts commit 7db34120e1e91f4fd26514fdb9525cac2a6066bb.

* Delete the minicart test

* Revert "Revert "Remove tax test""

This reverts commit 31dd654e52f37fcd02ccd25336958248bef495c6.

* Revert "Delete the minicart test"

This reverts commit 5595f0834a975d097a300bc0c7cbf643caa8b764.

* tax test

* block addToCart

* Put back block functions

* Refactor block.addToCart

* mini-cart e2e test uses shopper.block.emptyCart()

* only run shopper tests in CI

* Run frontend and shopper tests and change waitFor -> waitForTimeout

* Run frontend tests in CI

* Run CI e2e tests again

* Skip legacy template blocks

* Skip legacy template test but run all others

* Switch to storefront instead of twentytwentyone after legacy-template-blocks tests finish

* Tidy up

* fix typo

* Fix ESLint issue

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-08 14:50:16 +00:00
Saad Tarhi 1e15672b7b Shopper → Checkout → Can place an order as guest (https://github.com/woocommerce/woocommerce-blocks/pull/6009)
* Add "goToCheckout" method in "shopper.block"

Instead of using "shopper.goToCheckoutBlock" method, it will much easier
to maintain the following structure "shopper.block.goToCheckout"

* Create a constant for billing details

* Create "fillBillingDetails" shopper method

* Add "placeOrder" method to "shopper"

* Enable "Cash on delivery" payment method for our test

* Update "@woocommerce/e2e-utils" package

Some new useful e2e utility functions weren't avaiable in the previous version

* Add E2E test for "Can place an order as guest"

* Fix mini-cart failing E2E tests

In case this fix woocommerce/woocommerce-blocks#6006 isn't merged yet, this commit can be used to pass all
E2E tests

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-08 14:52:40 +01:00
Luigi Teschio fc01576a38 Additional classes are visible on frontend page woocommerce/woocommerce-blocks#5881 (https://github.com/woocommerce/woocommerce-blocks/pull/5991)
Additional classes are visible on frontend page
2022-03-08 14:24:52 +01:00
Tung Du 75b5181e0e Shopper → Mini Cart → Can view empty cart message and start shopping button (https://github.com/woocommerce/woocommerce-blocks/pull/5918) 2022-03-08 17:01:27 +07:00
Tomasz Tunik 6e185e0e2b Move __experimentalSelector outside of hasSpacingStyleSupport check (https://github.com/woocommerce/woocommerce-blocks/pull/6011) 2022-03-08 10:38:42 +01:00
Saad Tarhi c0aec1e85b Fix mini cart failling tests (https://github.com/woocommerce/woocommerce-blocks/pull/6006)
Set the correct "emptyCart" utility function

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-08 00:09:20 +01:00
Luigi Teschio 4b80f92c02 Add feature gate for enabling the global styles for Product Sale Badge block only for the feature plugin (https://github.com/woocommerce/woocommerce-blocks/pull/6008)
* Add feature gate for the global styles for Product Sale Badge block woocommerce/woocommerce-blocks#6007

Add feature gate for the global styles for Product Sale Badge block

* add a check for the spacing support
2022-03-07 18:39:11 +01:00
Luigi Teschio 299f5e1bfa Hide Mini Cart Block on Cart and Checkout page (https://github.com/woocommerce/woocommerce-blocks/pull/5996)
* Hide Mini Cart Block on cart and checkout page woocommerce/woocommerce-blocks#5931

hide Mini Cart Block on cart and checkout page

* instead to not render nothing, use visibility hidden
2022-03-07 17:29:06 +01:00
Saad Tarhi c122008d70 Test Google's "ndb" E2E testing tool (https://github.com/woocommerce/woocommerce-blocks/pull/5997)
* install ndb as a development dependency

* Add "debug" script to package.json to launch "ndb"

* Create a minimal test example

This test file is used as an example, we will add later a script in
package.json to call only this file

* Create a temporary npm script to run it from "ndb"

We want to be able to run only a selected file using "ndb", so we need to
create an npm script for it

* Clean up test file

* Clean up & ready PR to merge

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-07 17:10:17 +01:00
Saad Tarhi dee5032d41 Shopper → Cart → Can proceed to checkout (https://github.com/woocommerce/woocommerce-blocks/pull/5901)
* Shopper → Cart → Can proceed to checkout

* Refactor the code for E2E testing

Introduce some discussed solution to structure and optimize the code

* Resolve some conflicts with the trunk branch

* Remove method overriding and refactor code

We are trying to avoid overriding exiting E2E Woo's utility functions

Instead we can use our own "shopper.block"

* Use a consistent constant naming convention

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-07 16:23:31 +01:00
Mike Jolley eae1d75c86 Store API: Consistent error code and hook naming (https://github.com/woocommerce/woocommerce-blocks/pull/5992)
* Update error codes with `woocommerce_rest_` prefixes.

* Update action and filter hooks with woocommerce_store_api_ prefix

* Update hook docs

* Update error code mismatches

* Update hook name in tests

* update hook name in tests

* phpcs
2022-03-07 13:51:07 +00:00