Commit Graph

3345 Commits

Author SHA1 Message Date
Mike Jolley 0a8fe0a0c6 Remove `useSelectShippingRate` hook and adjust how local state works for `PackageRates` (https://github.com/woocommerce/woocommerce-blocks/pull/5802)
* Convert radio component to TS and support uncontrolled components

* Further radio control to typescript changes

* Combine useSelectShippingRate and useSelectShippingRates

* Remove useSelectShippingRate hook

* Move local radio checked state to PackageRates

* This is a Controlled component - update inline docs

* useSelectShippingRates -> useSelectShippingRate rename
2022-02-10 11:59:43 +00:00
Raluca Stan 051bb64138 Fix wide appender buttons overlap in Cart & Checkout blocks in the Editor (https://github.com/woocommerce/woocommerce-blocks/pull/5801)
* Add the correct appender button for non empty groups

* Revert "Add the correct appender button for non empty groups"

This reverts commit 4b41d7d7f82461813b3464d1b4f931c442bce3be.

* Force position relative for custom InnerBlocks.ButtonBlockAppender  appenders.

Removing InnerBlocks.ButtonBlockAppender  from renderAppender = {InnerBlocks.ButtonBlockAppender } results in the black appender button beeing shown only when the block is selected, and we need the appender to be visible by default.
2022-02-10 11:33:48 +01:00
Luigi Teschio a594ea5ef5 Fix Mini Cart doesn't update data (https://github.com/woocommerce/woocommerce-blocks/pull/5741)
* Remove api hydration for the Mini Cart Block woocommerce/woocommerce-blocks#5729

Remove api hydration for the Mini Cart Block

* fix PHP error

* send event when the button is clicked

* fix import order
2022-02-10 10:26:09 +01:00
Saad Tarhi d53551d4a7 Fix/cart button focus hover states (https://github.com/woocommerce/woocommerce-blocks/pull/5712)
* Add hover & focus styles for component buttons

We are using an old version of the "@wordpress/component" package,
that's why we are not getting the latest style fixes from Gutenberg.

The reason to not using the latest version is that we had some issues
with the bundle size.

The current solution is to set our own focus & hover styles

* Replace raw value with Sass variable

* Fix hover style for the mini cart block

We don't have the outlined button yet. This styles is unique for the
mini cart button.

To refactor this code, maybe we should create a reusable outlined button

* Add variant to the Woo Block Button component

To refactor our code, adding a "variant" prop looks logical since we are
have already "contained" & "outlined" buttons. So, for future need for an
outlined button, no need to manually apply the same style again.

The "contained" variant is set by default for legacy reasons. Our Button
component was first built as a contained one.

* Fix height difference: oulined & contained buttons

The outlined buttons have more height because of the added border value.

To fix it we can replace the border with the inner shadow.

Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-02-09 18:32:05 +01:00
renovate[bot] 74c5e7fbd1 Update dependency nanoid to 3.1.31 [SECURITY] (https://github.com/woocommerce/woocommerce-blocks/pull/5797)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-09 12:24:22 +00:00
Luigi Teschio 62cabea003 Set focus on Empty Mini Cart Contents Block (https://github.com/woocommerce/woocommerce-blocks/pull/5744)
* Set focus on Empty Mini Cart Contents Block woocommerce/woocommerce-blocks#4618

Set focus on Empty Mini Cart Contents Block

* fix useEffect logic
2022-02-09 10:51:30 +01:00
Tomasz Tunik ee6d1b5ae3 Add to cart button ignored redirect to cart setting (https://github.com/woocommerce/woocommerce-blocks/pull/5708)
* Expose products settings in wcSettings

For the time being we expose only what is used by the blocks
which is `cartRedirectAfterAdd`. In the future more can be added
as needed. Setting is accessible via `getSetting( 'productsSettings' )`.

We namespace the settings under productsSettigns to reflect
the domain and how settings are organised in Woo admin and to
inform that this is an object with more settings within.

This setting normally was available **only** if AJAX add to cart was set
as a js global `wc_add_to_cart_params.cart_redirect_after_add`.
By accessing the option directly we ensure it’s exposed
to blocks regardless of if AJAX option is enabled.

* update AddToCartButton to respect cartRedirectAfterAdd

This adds the redirect directly on the AddToCartButton after succesful
add to cart action. This follows convention that redirects or other side
effects shouldn’t happen as part of the action but rather be part of the
control that triggers such flow.
2022-02-09 09:26:25 +01:00
renovate[bot] 4156e0f532 Update dependency @testing-library/jest-dom to v5.16.2 (https://github.com/woocommerce/woocommerce-blocks/pull/5750)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-09 04:07:40 +00:00
renovate[bot] a9697cb3b5 Pin dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/5749)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-09 04:04:30 +00:00
Thomas Roberts 3c16e7f533 Spread metadata when loading block in frontend (https://github.com/woocommerce/woocommerce-blocks/pull/5732) 2022-02-08 10:33:27 +00:00
Alex Florisca 16d5e773bc Reformatted prettier files (https://github.com/woocommerce/woocommerce-blocks/pull/5735) 2022-02-07 16:59:44 +00:00
Raluca Stan b72744988b Update release-initial-checklist.md (https://github.com/woocommerce/woocommerce-blocks/pull/5690)
* Update release-initial-checklist.md

This PR creates a new section `If this release is deployed to WordPress.org...` similar to the one in `patch-initial-checklist.md`

* Update patch release checklist
2022-02-07 16:16:00 +01:00
Mike Jolley e85e610b2a Free order handling (https://github.com/woocommerce/woocommerce-blocks/pull/5720) 2022-02-07 11:21:14 +00:00
Tung Du 4dab187dbe Fix: only allow Mini Cart block in Widgets and Site Editor (https://github.com/woocommerce/woocommerce-blocks/pull/5653)
* fix: exclude Mini Cart from the blocks editor

* fix: explicitly register Mini Cart blocks for Site Editor and Widgets

* add check to loading the block on frontend

* add e2e tests for widget area

* improve test title

Co-authored-by: Luigi <gigitux@gmail.com>
2022-02-07 11:29:22 +01:00
Alex Florisca 9b3fdbb0b0 Ts blocks (https://github.com/woocommerce/woocommerce-blocks/pull/5668)
* filter-element-label -> ts

* filter-submit-button -> ts

* form -> ts

* load-more-button -> ts

* loading-mask -> ts

* pagination -> ts

* ProductList -> ts (in progress)

* ProductList -> ts continued

* ProductList -> ts - done + fix some ts errors

* ProductList -> ts continued

* ProductList -> ts

* Tidy up

* Extract type for RegisteredBlockComponent

* Feedback from Mike

* Fix unit tests
2022-02-07 09:34:30 +00:00
Tom Cafferkey d533ae42e7 Add a Remove Image option to the Featured Category block (https://github.com/woocommerce/woocommerce-blocks/pull/5719) 2022-02-07 08:35:02 +00:00
Tomasz Tunik 729de5ea05 Revert "fix: accessibility of search products block (https://github.com/woocommerce/woocommerce-blocks/pull/5691)" (https://github.com/woocommerce/woocommerce-blocks/pull/5717)
This reverts commit d4d3f18453.
2022-02-04 11:26:34 +01:00
Daniel Dudzic 0b28bdf0dd Add stories for Button component woocommerce/woocommerce-blocks#5250 (https://github.com/woocommerce/woocommerce-blocks/pull/5706)
* Add stories for Button component woocommerce/woocommerce-blocks#5250

Add stories for Button component
Co-authored-by: gigitux <gigitux@gmail.com>

* Button: Change With Spinner story title to Loading
2022-02-03 13:29:06 +01:00
Tomasz Tunik d4d3f18453 fix: accessibility of search products block (https://github.com/woocommerce/woocommerce-blocks/pull/5691)
When output with php the block had correct accessibility on
the frontend but in the editor or when rendered as block
the correct aria label was missing because of misspelled
aria-label attribute.

Also fixed wrong value type provided for tabIndex in editor
while at it.
2022-02-02 19:56:56 +01:00
Luigi Teschio 86bbf5a037 Attribute Filter block: Enable global style (https://github.com/woocommerce/woocommerce-blocks/pull/5557)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* move hooks in a specific folder

* fix crash on WP 5.8

* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965

Featured Category block: Add support for global style

* fix border color

* Attribute Filter block: enable global style woocommerce/woocommerce-blocks#4965

Attribute Filter block: enable global style woocommerce/woocommerce-blocks#4965

* fix eslint error

* fix test

* add comments about !important
2022-02-02 18:41:39 +01:00
Tomasz Tunik d68f6d25b8 Fix Twenty Twenty-Two Products by Category block item tile styling issues (https://github.com/woocommerce/woocommerce-blocks/pull/5684)
* fixes products by category added to cart style

fixes woocommerce/woocommerce-blocks#5285 - View cart after adding item to cart was squeezed
in on the same line as the Add to Cart button

* fixes products by category sale price styles

fixes woocommerce/woocommerce-blocks#5286 - sale price was underlined because of the default
styles on the used ins HTML element
2022-02-02 18:21:39 +01:00
renovate[bot] 0554288807 Update dependency @types/react to v16.14.22 (https://github.com/woocommerce/woocommerce-blocks/pull/5696)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-02 15:05:42 +00:00
Mike Jolley 67283c02be Compare assets from builds (https://github.com/woocommerce/woocommerce-blocks/pull/5634)
* Comparison workflow

* Update locks
2022-02-02 14:56:16 +00:00
Mike Jolley 81bb982c5e Include issue submission link in the footer of all documention (.md files) (https://github.com/woocommerce/woocommerce-blocks/pull/5655)
* Add links to single routes in main index woocommerce/woocommerce-blocks#4473

* Footer

* Feedback template

* Remove footer from existing MD files

* Add doc footer script

* Apply script to all docs

* Fix examples
2022-02-02 14:27:46 +00:00
Tomasz Tunik eb54c4bec0 fix: Category List element not visible on all products item edit (https://github.com/woocommerce/woocommerce-blocks/pull/5688)
fixes woocommerce/woocommerce-blocks#5674 - item edit relied on data from @woocommerce/previews
productsPreview which was missing mock data for product category
2022-02-02 12:57:52 +01:00
Alex Florisca 072115ee75 Update version to 7.0.0-dev (https://github.com/woocommerce/woocommerce-blocks/pull/5705) 2022-02-02 11:57:48 +00:00
github-actions[bot] 8ce88ad3c4 Release: 6.9.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5680)
* Empty commit for release pull request

* Empty commit for release pull request

* Update readme.txt

* Update versions

* Update testing notes and changelog

* Empty commit for release pull request

* Empty commit for release pull request

* Update readme.txt

* Update versions

* Update testing notes and changelog

* Empty commit for release pull request

* Empty commit for release pull request

* Update readme.txt

* Update versions

* Update testing notes and changelog

* Empty commit for release pull request

* Empty commit for release pull request

* REadme.txt update

* new zip for testing

* update zip file

* Add `CopyWebpackPlugin` to ensure `block.json` is copied to `build` (https://github.com/woocommerce/woocommerce-blocks/pull/5692)

* Add CopyWebpackPlugin and add block metadata to build

* Check build directory for block.json

* New zip file

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-02-02 11:40:45 +00:00
Luigi Teschio accce8e024 Fix 404 HTTP error for Product Title, Product Summary, and Product Stock indicator blocks woocommerce/woocommerce-blocks#5468 (https://github.com/woocommerce/woocommerce-blocks/pull/5649)
Fix 404 HTTP error for Product Title, Product Summary, and Product Stock indicator blocks
2022-02-02 10:20:17 +01:00
renovate[bot] bc9ae24aaa Update dependency @testing-library/jest-dom to v5.16.1 (https://github.com/woocommerce/woocommerce-blocks/pull/5698)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-02 08:19:03 +00:00
renovate[bot] 61bd3cb4eb Update storybook monorepo to v6.4.17 (https://github.com/woocommerce/woocommerce-blocks/pull/5697)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-02 04:51:46 +00:00
renovate[bot] ba476ac34d Pin dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/5695)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-02 02:17:49 +00:00
Mike Jolley 2b5f115d41 Remove custom `Icon` component in favour of `@wordpress/icons` where possible (https://github.com/woocommerce/woocommerce-blocks/pull/5599)
* Remove atom icon

* Swap icon usage to WordPress package

* remove unused icons from library

* Use @wordpress/primitives

* Product cats block to listView

* On-sale to use percent instead of tag icon

* add to cart button use button icon

* on sale products block icon

* Handpicked products use stack icon

* Products by stock box icon

* Make sparkles woo purple

* Fix icon name

* Correct more tag name

* fix path to icons

* Update snaps

* Update readme to explain updated usage

* Import SVG and path from primitives

* Missing isFeaturePluginBuild

* Update assets/js/icons/README.md

Co-authored-by: Raluca Stan <raluca.stan@automattic.com>

* Update assets/js/icons/README.md

Co-authored-by: Raluca Stan <raluca.stan@automattic.com>

* Update assets/js/icons/README.md

Co-authored-by: Raluca Stan <raluca.stan@automattic.com>

* update lock

Co-authored-by: Raluca Stan <raluca.stan@automattic.com>
2022-02-01 16:54:38 +00:00
Thomas Roberts 5e32fb0576 Add `CopyWebpackPlugin` to ensure `block.json` is copied to `build` (https://github.com/woocommerce/woocommerce-blocks/pull/5692)
* Add CopyWebpackPlugin and add block metadata to build

* Check build directory for block.json
2022-02-01 16:42:15 +00:00
Tung Du 995d41e2a9 Fix: Empty Mini Cart contents overflow issue (https://github.com/woocommerce/woocommerce-blocks/pull/5635)
* fix: add wrapper for empty mini cart contents inner blocks. Allow inner content to be scrollable

* fix overflow issue for the editor

* add padding for the empty cart view
2022-02-01 17:19:41 +01:00
Luigi Teschio 9d1464baf3 Featured Product: Enable global style (https://github.com/woocommerce/woocommerce-blocks/pull/5555)
* Product title: add support global style woocommerce/woocommerce-blocks#4965

* add specific type

* add custom save function

* move hooks in a specific folder

* fix crash on WP 5.8

* Featured Category block: Add support for global style woocommerce/woocommerce-blocks#4965

Featured Category block: Add support for global style

* fix border color

* Featured Product block: enable global style woocommerce/woocommerce-blocks#4965

Featured Product block: enable global style

* fix border color

* fix eslint error

* fix opacity

* fix border radius

* fix opacity

* disable font-size support

* restore height for featured product and featured category
2022-02-01 15:01:31 +01:00
Thomas Roberts 426eb51830 Update Checkout block E2E fixture and increase node version in GH actions (https://github.com/woocommerce/woocommerce-blocks/pull/5678)
* Remove unnecessary setup step and use node v16 in E2E action

* Ensure storefront is active

* Use new checkout fixture

* Try with only checkout test

* Update package.json

* Run all tests, not just checkout
2022-02-01 11:14:16 +00:00
Luigi Teschio 2438fcd434 Disable font-size for the Featured Category block woocommerce/woocommerce-blocks#5681 (https://github.com/woocommerce/woocommerce-blocks/pull/5682)
Disable font-size for the Featured Category block
2022-01-31 18:03:54 +01:00
Manos Psychogyiopoulos 6ed7034223 Add inner wrapper div in 'td.wc-block-cart-item__product' (https://github.com/woocommerce/woocommerce-blocks/pull/5240)
* Add inner wrapper div in td.wc-block-cart-item__product

Adding this wrapper element is necessary in order to be able to "fake" item grouping in a theme-agnostic manner: https://user-images.githubusercontent.com/1783726/118831630-97855600-b8c8-11eb-8906-c7f9ada769e7.png

* Whoops

* Remove classnames function

* Update indentation for QuantitySelector

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2022-01-31 15:18:29 +00:00
Niels Lange 83ae876898 Keep top margin for create account section in editor (https://github.com/woocommerce/woocommerce-blocks/pull/5633) 2022-01-31 22:15:46 +07:00
Tomasz Tunik 54ca9e16b0 Fix ReadMore component maxLines prop reactivity (https://github.com/woocommerce/woocommerce-blocks/pull/5673)
when changing property value of maxLines component would not
update until remounted or reloaded with new settings
2022-01-31 13:56:19 +01:00
Thomas Roberts c7aa3a75b9 Update tests to use `useEvent` (https://github.com/woocommerce/woocommerce-blocks/pull/5573)
* Update payment-method-data-context tests to use userEvent

* Update mini cart block tests to use userEvent

* Update payment methods tests to use userEvent
2022-01-31 10:53:21 +00:00
Thomas Roberts afd9d42805 Add Checkout Order Summary inner block tests (https://github.com/woocommerce/woocommerce-blocks/pull/5675)
* Add fake items fixture

* Add test for rendering items in sidebar

* Add test for items with addons

* Add textContentMatcherAccrossSiblings helper

This is needed to match text when it's spread over a few elements

* Add test to ensure subtotal renders correctly

* Add test to ensure discounts are rendered correctly

* Add test to ensure fees are shown correctly

* Add test to check coupon entry form isn't present when coupons disabled

* Add more mock data to useStoreCart

* Mock useShippingDataContext

* Rename useStoreCartValue to useStoreCartReturnValue

* Remove unnecessary coupon button test

This should be tested within the TotalsCoupon component

* Add tests for shipping presence

* Add test for coupons

* Remove cart items fixtures

These are no longer needed

* Move the findByText utils to the utils folder

* Move inner blocks test to correct directory
2022-01-31 10:53:08 +00:00
Thomas Roberts a46f13c6c5 Move Checkout block attributes into metadata (`block.json`) (https://github.com/woocommerce/woocommerce-blocks/pull/5594)
* Add block title to AbstractBlock class

* Add block title to Checkout block

* Include all block.json files in tsconfig

* Add get_block_title method to Checkout.php

* Remove redundant block_title field

* Add block.json and remove static attributes from attributes.ts

* Register block using attributes from block.json

* Add metadata_path to AbstractBlock

* Add function to AssetsApi to get the metadata path from the plugin root

* Register the block using metadata if it's set in the block's class

* Remove get_block_title method

* Only add supports and attributes to the block when not registering with metadata

* Change get_block_metadata to get_block_metadata_path

* Change indentation to tabs in block.json

* Update comment to clarify why attributes and supports are set later

* Check if path to metadata is not empty instead of set and not empty

* Move checkout block out of cart-checkout directory

* Update get_block_metadata_path function to find block.json automatically

* Remove metadata path from AbstractBlock

* Check if there's a metadata file and register blocks with metadata if so

* Move deprecated attributes out of metadata and into attributes.ts

* Re-add deprecated attributes to checkout index

* Move order notes test

* Move test for checkout phone number in edito

* Fix indentation in checkout/block.json

* Move checkout terms tests

* Try forcing storefront theme in e2e tests

* Revert "Try forcing storefront theme in e2e tests"

This reverts commit 5b0fd47a2c39aadb0141a4ed28cbc0e6baa89625.

* Try capturing screenshot on test failures

* Try uploading error in try catch

* Try uploading artefacts on error

* Test uploading artefacts

* Screenshot just before looking for edit post layout

* Revert "Screenshot just before looking for edit post layout"

This reverts commit 61dff027789ce13a0d84e7b6f11e431637c5a450.

* Revert "Test uploading artefacts"

This reverts commit adf5cc55bcdb677f889bf5a62803b4150d98e665.

* Revert "Try uploading artefacts on error"

This reverts commit 7441a832a113a95fef89cc1b8db6dc79271be516.

* Revert "Try uploading error in try catch"

This reverts commit ca412ce505d56286b164f588a201a451f6bceeb6.

* Revert "Try capturing screenshot on test failures"

This reverts commit 0de6e97df19b116091a7bb3b8652713867d2d80f.

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-01-28 16:37:06 +00:00
Mike Jolley d8fb1933ef Fix devtool config broken in woocommerce/woocommerce-blocks#5589 2022-01-28 14:34:36 +00:00
Mike Jolley 1f6f97d860 Implement `@wordpress/scripts` analyze script (https://github.com/woocommerce/woocommerce-blocks/pull/5589)
* Add analyze-bundles command, replacing explore

* Replace source map explorer from webpack in favour of BundleAnalyzerPlugin

* Update deps

* update locks
2022-01-28 11:40:23 +00:00
Tung Du d6e6470937 Fix Mini Cart Edit template link (https://github.com/woocommerce/woocommerce-blocks/pull/5615) 2022-01-27 20:47:35 +07:00
Thomas Roberts b7560ebed5 Add tests for Checkout Terms block (https://github.com/woocommerce/woocommerce-blocks/pull/5621)
* Install @wordpress/block-editor package

* Add test for checkout terms frontend block

* Add tests for checkout terms in editor

* Add tests for Checkout Terms in editor

* Use void 0 as function's return type

* Update tests to use toBeInTheDocument and split checkbox test in two

* Use void 0 for empty function
2022-01-27 12:34:52 +00:00
Tung Du 6f4c00a2fd Fix: Exclude Mini Cart and other blocks inside the Mini Cart Contents block (https://github.com/woocommerce/woocommerce-blocks/pull/5616) 2022-01-27 17:10:53 +07:00
Tom Cafferkey 9934533375 Revert "Allow LegacyTemplate block to be reinserted, only on WooCommerce block templates. (https://github.com/woocommerce/woocommerce-blocks/pull/5545)" (https://github.com/woocommerce/woocommerce-blocks/pull/5643)
This reverts commit cf9c82e02e.
2022-01-27 09:45:00 +00:00
Tung Du 7e67bf62ca Fix: Mini Cart global style is not applied (https://github.com/woocommerce/woocommerce-blocks/pull/5618) 2022-01-27 08:38:49 +07:00