Commit Graph

3250 Commits

Author SHA1 Message Date
renovate[bot] 047abeab84 Update dependency eslint-plugin-import to v2.25.3 (https://github.com/woocommerce/woocommerce-blocks/pull/5438)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-22 04:15:47 +00:00
renovate[bot] ba3c7e6132 Update babel monorepo to v7.16.5 (https://github.com/woocommerce/woocommerce-blocks/pull/5437)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-22 04:13:35 +00:00
renovate[bot] 2ee9c73c94 Update Node.js to v16.13.1 (https://github.com/woocommerce/woocommerce-blocks/pull/5436)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-22 02:57:41 +00:00
renovate[bot] 4f4ef36510 Pin dependency snakecase-keys to 5.1.2 (https://github.com/woocommerce/woocommerce-blocks/pull/5435)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-22 02:48:41 +00:00
Lucio Giannotta 35adae3fa4 Add Storybook documentation and remove deprecated knobs (https://github.com/woocommerce/woocommerce-blocks/pull/5407)
* Remove Storybook knobs

They are now fully replaced by controls

* Update Storybook to 6.4.9
* Add Storybook documentation and VSCode snippets
* Add VSCode snippets
* Convert stories from checkout packages and include them in Storybook
2021-12-21 18:08:57 +01:00
Tom Cafferkey 5730574fde Update testing instructions for missing PRs in 6.6.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5431) 2021-12-21 16:09:12 +00:00
Mike Jolley c1ca93aa0a 6.7.0-dev 2021-12-21 13:59:01 +00:00
github-actions[bot] 5d807a52e1 Release: 6.6.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5422)
* Empty commit for release pull request

* Add changelog and version info

* 6.6.0 testing notes

* Remove mini cart from testing instructions

* Clarify testing instructions

* Remove experimental feature from changelog

* fix not found template for the template editor

* update zip

* Remove test instructions for icon

* Testing steps for 5425

* Link order controller to cart routes

* Remove order controller from checkout route

* Fix PHP warnings in abstract schema

* Fix PHP warnings in abstract route

* Update shipping phone handling

* Includes are handled in core now

* Remove maybe_update_order_from_customer

* Add cart_updated routine to all cart routes

* Remove abstract method

* Remove test for woocommerce_blocks_cart_update_order_from_customer_request

* Remove do_order_callback

* Update readme

* Update tests

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Luigi <gigitux@gmail.com>
2021-12-21 13:57:01 +00:00
Alex Florisca a60cd66692 Remove extra padding for cart sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/5247) 2021-12-21 13:46:49 +00:00
Mike Jolley ecc80e5cff Sync order data with cart data when cart is updated from any route (https://github.com/woocommerce/woocommerce-blocks/pull/5379)
* Link order controller to cart routes

* Remove order controller from checkout route

* Fix PHP warnings in abstract schema

* Fix PHP warnings in abstract route

* Update shipping phone handling

* Includes are handled in core now

* Remove maybe_update_order_from_customer

* Add cart_updated routine to all cart routes

* Remove abstract method

* Remove test for woocommerce_blocks_cart_update_order_from_customer_request

* Remove do_order_callback
2021-12-21 13:11:51 +00:00
Luigi Teschio 14a45a4380 fix not found template for the template editor (https://github.com/woocommerce/woocommerce-blocks/pull/5425) 2021-12-21 11:55:51 +01:00
Tom Cafferkey 13d151fe2a Check for woocommerce as the theme before rendering with a more user friendly plugin name (https://github.com/woocommerce/woocommerce-blocks/pull/5420) 2021-12-20 14:36:26 +00:00
Tom Cafferkey d8dac8bb0a Check if the current theme has a product-archive block template in the absence of a product taxonomy block template. (https://github.com/woocommerce/woocommerce-blocks/pull/5380)
* Add archive-product template into block template hieachy

* Add archive-product condition to product tag block template render method

* Move taxonomy hierarchy filter to WC core

* Undo template amends

* Duplicate the themes archive-product template if it has one for taxonomy block templates

* Review feedback

* Use TextDomain instead of Name

* use correct if/else syntax

* Remove unncessary boolean syntax
2021-12-20 12:53:57 +00:00
Mike Jolley 469223fa54 Remove validateOnMount in favour of validation on state change (https://github.com/woocommerce/woocommerce-blocks/pull/5381)
* Remove validateOnMount in favour of validation on state change.

* Use useEffect

* test
2021-12-20 12:16:41 +00:00
Niels Lange ee45d9d9cf Remove full-width mode from cart and checkout block (https://github.com/woocommerce/woocommerce-blocks/pull/5315) 2021-12-20 11:27:51 +00:00
Albert Juhé Lluveras 976b158e6f Make it so WooCommerce template names are not editable (https://github.com/woocommerce/woocommerce-blocks/pull/5385)
* Make it so WooCommerce template names is not editable

* Remove source='plugin' from templates
2021-12-20 10:46:41 +00:00
Albert Juhé Lluveras ab061782f2 Fix saving WooCommerce templates in WP 5.9 beta 3 (https://github.com/woocommerce/woocommerce-blocks/pull/5408) 2021-12-20 10:58:11 +01:00
Tung Du 50066455c0 Fix: Mini Cart block: divide contents into three inner blocks (https://github.com/woocommerce/woocommerce-blocks/pull/5386)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-12-20 14:57:55 +07:00
Luigi Teschio 4524799b5e Revert theme name woocommerce/woocommerce-blocks#5411 (https://github.com/woocommerce/woocommerce-blocks/pull/5412)
Revert theme name woocommerce/woocommerce-blocks#5411
2021-12-17 16:58:56 +01:00
Tom Cafferkey 5a7adba1bd Update 640.md 2021-12-17 10:47:16 +00:00
Mike Jolley 7d8c184603 Remove the unused get_skeleton_inline_script method (https://github.com/woocommerce/woocommerce-blocks/pull/5361) 2021-12-16 17:32:35 +00:00
Albert Juhé Lluveras bffbc491a8 Add correct class to Legacy Template block icon (https://github.com/woocommerce/woocommerce-blocks/pull/5400) 2021-12-16 13:29:55 +01:00
Alex Florisca d05a43dadb Update to node 16/npm 8 (https://github.com/woocommerce/woocommerce-blocks/pull/5222)
* Update to node 16/npmm 8

* package-lock.json from trunk

* package-lock.json v2

* Revert "package-lock.json v2"

This reverts commit 9d11533da840471aed815d131f54a87d237658c7.

* Package-lock.json v2, take 2

* eslint-plugin requires npm 8
2021-12-16 11:19:30 +00:00
Alex Florisca 6624d898e8 ignore eslint-plugin-woocommerce build files (https://github.com/woocommerce/woocommerce-blocks/pull/5340) 2021-12-16 10:35:25 +00:00
Alex Florisca e61eb3b0a4 Fix extra network request on cart (https://github.com/woocommerce/woocommerce-blocks/pull/5394) 2021-12-16 10:30:23 +00:00
M. L. Giannotta 1db7ede31e Migrate storybook entries of ProductPrice component (https://github.com/woocommerce/woocommerce-blocks/pull/5371)
Closes woocommerce/woocommerce-blocks#5368
2021-12-15 19:07:49 +01:00
M. L. Giannotta 5524c0aa91 Storybook and TS migration of `PriceSlider` component (https://github.com/woocommerce/woocommerce-blocks/pull/5253) (https://github.com/woocommerce/woocommerce-blocks/pull/5293)
* Add full documentation to the component props in Storybook
* Fix `FormattedMonetaryAmount` TypeScript errors

Since this component is passing on props to `NumberFormat`,
it needs to extend all of its original props, except for `onValueChange`
which we wrap in order to accept only `number`s.

* Convert `constrainRangeSliderValues` to TypeScript
* Add docs to `Currency` types
* Convert `PriceSlider` to TypeScript

*Note:* All TypeScript errors were fixed during the conversion,
except for the IE workaround which wasn't clear to me at this time.
Opened an issue: woocommerce/woocommerce-blocks#5276

* Fix Price Slider story (https://github.com/woocommerce/woocommerce-blocks/pull/5253)
* Migrate stories for `ProductName` to latest Storybook

Also add props documentation and add named export.
2021-12-15 17:54:49 +01:00
M. L. Giannotta 703051b1bc Storybook and TS migration of some cart checkout components (https://github.com/woocommerce/woocommerce-blocks/pull/5324)
* Migrate stories for `ProductName` to latest Storybook. Also add props
documentation and add named export.
* Migrate `TotalsFooterItem` to TypeScript and latest Storybook
* Add a `LooselyMustHave` utility type.
* Export `allSettings` so that they can be manipulated in stories and tests

* Implement a way to easily define and reuse Storybook controls

Implement a currency control for a common use-case of selecting currencies.
It currently implements EUR and USD as they have different properties.

* Migrate `TotalsDiscount` to TypeScript and implement stories
* Migrate `TotalsCoupon` to TypeScript and fix stories
* Change Coupon name within Storybook
* Nicer handling of removal of a coupon from Storybook

It now dynamically calculates the discount from the actual coupons.
2021-12-15 17:30:17 +01:00
M. L. Giannotta 91c2ca2143 Migrate storybook entries of QuantitySelector component (https://github.com/woocommerce/woocommerce-blocks/pull/5370)
* Add experimental Emotion11 compatibility

Revert the changes introduced in woocommerce/woocommerce-blocks#5354. The team over at Storybook
has recently implemented a workaround to enable Emotion11 compatibility
in 6.x releases.

See: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#emotion11-quasi-compatibility

* Add `QuantitySelector` property docs and migrate stories

*Note:* Because of a Storybook bug, the number input on the control panel of the
story, is not going to get updated by the component.

See: https://github.com/storybookjs/storybook/issues/15924
2021-12-15 17:03:02 +01:00
Albert Juhé Lluveras 8030e278db Set the origin of custom templates to 'plugin' and fix plugin name on REST requests (https://github.com/woocommerce/woocommerce-blocks/pull/5375)
* Set the origin of custom WC templates to 'plugin'

* Fix plugin name
2021-12-15 11:56:41 +01:00
renovate[bot] 0b6686910f Update dependency eslint-import-resolver-typescript to v2.5.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5383)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-15 05:04:26 +00:00
renovate[bot] 6d487fd242 Update wordpress monorepo (https://github.com/woocommerce/woocommerce-blocks/pull/5382)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-15 03:18:45 +00:00
Mike Jolley c5e07b8dd2 Move class removal to render callback (https://github.com/woocommerce/woocommerce-blocks/pull/5364) 2021-12-14 10:39:14 +00:00
Tung Du b0623a8b52 Mini Cart: only display the editing link to users with site editing permission (https://github.com/woocommerce/woocommerce-blocks/pull/5372) 2021-12-14 07:54:23 +07:00
Tung Du 0350268b82 Switch to correct view if inner block is selected (https://github.com/woocommerce/woocommerce-blocks/pull/5358) 2021-12-14 07:46:10 +07:00
Mike Jolley 3fc597775c Trigger validation on change (https://github.com/woocommerce/woocommerce-blocks/pull/5373) 2021-12-13 16:44:28 +00:00
Mike Jolley 226780107a Add error message for fetch errors on checkout (https://github.com/woocommerce/woocommerce-blocks/pull/5341)
* Add error message for fetch errors on checkout

* Update message text

* revert gitignore change

* Remove errorNotice variable
2021-12-13 15:31:49 +00:00
Mike Jolley 661896ce9e Loading animation (https://github.com/woocommerce/woocommerce-blocks/pull/5362) 2021-12-13 13:57:59 +00:00
Mike Jolley 59c8c88438 Introduce 2 new hooks in Customer Update Route (https://github.com/woocommerce/woocommerce-blocks/pull/5345)
* Introduce woocommerce_blocks_cart_update_customer_from_request hook

* Introduce woocommerce_blocks_cart_update_order_from_customer_request

* Test actions fire

* Update hook docs
2021-12-13 13:57:45 +00:00
Albert Juhé Lluveras 6e2b5ebb8a Downgrade @wordpress/scripts to 17.1.0 to fix dependency mistmach issue (https://github.com/woocommerce/woocommerce-blocks/pull/5349)
* Downgrade @wordpress/scripts to 17.1.0 to fix dependency mistmach issue

* Update package-lock.json
2021-12-10 17:44:03 +01:00
M. L. Giannotta 1c837c0de7 Fix conflict between Storybook and `@emotion/styled@11.x` (https://github.com/woocommerce/woocommerce-blocks/pull/5354)
Resolve the alias for `@emotion/styled` to the root of the module in Storybook
WebPack config.

Fixes woocommerce/woocommerce-blocks#5353
2021-12-10 17:08:23 +01:00
Seghir Nadir 772ee23faa Update item quantity if server result is different from client (https://github.com/woocommerce/woocommerce-blocks/pull/5352)
* respect when quantity changes from up

* add test
2021-12-10 16:26:57 +01:00
Mike Jolley 70106d45d3 Revise checkout payment statuses to avoid data loss on error (https://github.com/woocommerce/woocommerce-blocks/pull/5350)
* Clarify docs for STARTED

* Clarify docs for setActivePaymentMethod

* Remove useActivePaymentMethod hook (this held state for active methods and tokens)

* Update type defs

* Enhance setActivePaymentMethod action to accept method data

* SET_ACTIVE_PAYMENT_METHOD action

* Add setActivePaymentMethod dispatcher and make "started" status only

* Update setActivePaymentMethod usage in express methods

* Set radio control defaults

* Consolodate tokens and methods

* Update assets/js/base/context/providers/cart-checkout/payment-methods/reducer.ts

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>

* Spacing

* Split saved cards tests from regular, since saved cards are checked by default

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2021-12-10 16:26:16 +01:00
Niels Lange 6a74887464 Limit CSS styles to WooCommerce Block icons only (https://github.com/woocommerce/woocommerce-blocks/pull/5363)
* Limit CSS styles to WooCommerce Block icons only

* Update assets/css/editor.scss

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

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-12-10 21:32:44 +07:00
Luigi Teschio 13deb1b09e Mini Cart Block: render the empty state set on template parts (https://github.com/woocommerce/woocommerce-blocks/pull/5338)
* add view switcher for mini cart contents block

* editor view switcher

* update mini cart template file

* render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674

render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674

* update selector

* allow empty mini cart block to add all blocks

* fix tests; improve code style

* install @wordpress/block-editor package

* fix warning on frontend side

* block-editor package is not necessary

* merge attributes object

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2021-12-10 12:11:59 +01:00
Tom Cafferkey 34ba6ab937 Load required scripts in LegacyTemplate.php render method (https://github.com/woocommerce/woocommerce-blocks/pull/5346) 2021-12-10 10:51:35 +00:00
Mike Jolley b0f9e524a3 Move Draft Order Handling to Shared Trait (DraftOrderTrait) (https://github.com/woocommerce/woocommerce-blocks/pull/5323)
* Introduce shared trait for draft order handling (DraftOrderTrait)

* Use trait where needed for maybe_release_stock

* Introduce woocommerce_blocks_cart_update_customer_from_request

This hook gets the request data and customer object, and from there, 3rd parties could grab a draft order and manually update it if needed (if the use cases requires this).

* Revert "Introduce woocommerce_blocks_cart_update_customer_from_request"

This reverts commit 6620818eb1e03b87c6eca0d757ec8b78802e3c57.
2021-12-10 10:49:04 +00:00
Albert Juhé Lluveras 29fa0a61e6 Fix Mini Cart template part link on WP 5.9 (https://github.com/woocommerce/woocommerce-blocks/pull/5348)
* Fix link to edit the Mini Cart template part in WP 5.9

* Use wp_is_block_theme() function

* Add protection against overwriting isSiteEditorAvailable setting

* Rename isSiteEditorAvailable to isBlockTheme
2021-12-10 11:23:16 +01:00
Niels Lange 865a0a5ffa Update icon of legacy template block (https://github.com/woocommerce/woocommerce-blocks/pull/5317)
* Update icon of legacy template block

* Display legacy block template color in Woo purple

* Display icons in white when block being selected within list view
2021-12-10 17:07:10 +07:00
Tung Du b3ba90e7e9 Fix: Mini Cart block: Edit template part link doesn't work for themes don't have mini cart template part. (https://github.com/woocommerce/woocommerce-blocks/pull/5347) 2021-12-09 20:58:03 +07:00