Commit Graph

3314 Commits

Author SHA1 Message Date
Raluca Stan 6eb3f9e17a Account for products without variations in the On Sale Products block (https://github.com/woocommerce/woocommerce-blocks/pull/5470)
* Account for products without variations in the prime_product_variations function

* Update src/BlockTypes/AbstractProductGrid.php

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

* Fix whitespace

* Remove unnecessary variable declaration

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2021-12-30 14:53:56 +01:00
Thomas Roberts a8e094473c Revert "Remove extra padding for cart sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/5247)" (https://github.com/woocommerce/woocommerce-blocks/pull/5429)
This reverts commit a60cd66692.
2021-12-30 12:24:18 +00:00
Niels Lange 17a0325b72 Correct name of lazy loaded translation file (https://github.com/woocommerce/woocommerce-blocks/pull/5453) 2021-12-30 12:23:02 +00:00
renovate[bot] 088be50f3c Update dependency jest-environment-puppeteer to v6.0.3 (https://github.com/woocommerce/woocommerce-blocks/pull/5469)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-29 04:07:31 +00:00
renovate[bot] c8ca9deea3 Update dependency @types/lodash to v4.14.178 (https://github.com/woocommerce/woocommerce-blocks/pull/5468)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-29 04:05:36 +00:00
renovate[bot] cabfd59023 Update dependency @types/jquery to v3.5.11 (https://github.com/woocommerce/woocommerce-blocks/pull/5467)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-29 02:52:05 +00:00
renovate[bot] a08553899c Pin dependency expect-puppeteer to 6.0.2 (https://github.com/woocommerce/woocommerce-blocks/pull/5466)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-29 02:41:54 +00:00
Lucio Giannotta 0367117d15 Move block templates and parts directories to the Gutenberg 12.1.0 convention (https://github.com/woocommerce/woocommerce-blocks/pull/5455)
Gutenberg 12.1.0 has changed the convention for the directory paths from
`block-templates` and `block-template-parts` to `templates` and `parts` respectively.

Allow compatibility with themes which follow both conventions and also make sure that
we remain backwards-compatible.

Fixes woocommerce/woocommerce-blocks#5450

Some of this fix has a dependency on WooCore

See: WooCommerce/woocommercewoocommerce/woocommerce-blocks#31522
2021-12-28 23:32:15 +01:00
Lucio Giannotta 4d616d7a76 Fix custom templates with fallback being incorrectly attributed (https://github.com/woocommerce/woocommerce-blocks/pull/5447)
* Fix custom templates with fallback being incorrectly attributed

Category and tags templates can fallback to the generic archive if, e.g., the theme
provides one for the latter but not for the former. However, since Gutenberg is not
aware of this fallback mechanism, it would incorrectly attribute the custom template
to the user instead of the theme.

Here we are explicitly setting the `has_theme_file` to make sure Gutenberg knows
we do, in fact, have a theme fail (if not what it expects).

Also skip the loop if template is duplicate but has no fallback

Fixes woocommerce/woocommerce-blocks#5441
2021-12-24 16:15:19 +01:00
Thomas Roberts 5036c69638 Add E2E tests for Filter blocks (Price, Attribute, and Active Filters) (https://github.com/woocommerce/woocommerce-blocks/pull/4562)
* Add clear and fill input test util

* Add tests for Filter Products by Price

* Add class name to filter products by price block in editor

* Update wp-env

* Fix formatting

* Update lock

* Revert "Update lock"

This reverts commit f4e809e000430eea3972c94fd2aea0a19ba6961b.

* Create product attributes during setup

* Remove product attributes during teardown

* Add attributes in fixture-data

* Add two new products, for attribute testing

* Load attributes into store and apply them to products

* Add class to Filter by Attribute when editing

This is so it can be targeted in E2E tests more easily.

* Add tests for Filter Product by Attribute

* Fix formatting in attribute-filter.test.js

* Add tests for active filters block

* Add doc block for ensuteCleanAttributes

* Update wording of title test in all filter block E2E

* Update test wording to read better

* Update snapshots

* Use pptr-testing-library selectors to click elements

This makes the tests easier to reason with, and lets us take a step back from the implementation details (classnames etc.)

* Add saveOrPublish test util

* Use pptr-testing-library selectors to click elements in attribute filter

* Use pptr-testing-library selectors to click elements in price filter

* Add `puppeteer-testing-library`

* Use puppeteer-testing-library API to look for H6 button

* Use correct argument in jest-puppeteer.dev.config

* Update package.json & package-lock.json

* remove tests for 5.3

* remove snapshots

* Remove ensureCleanAttributes

* Remove puppeteer-testing-library, install missing expect-puppeteer package and update tests

The puppeteer-testing-library, although added by gutenberg is not actively used.
I have removed it and realised that the added functionality can be easily replaced by expect-puppeteer.
This is a package that we specify in the jest configuration but it was not part of our package.json.
The selectors from puppeteer-testing-library have been replaced with .toClick and the utility clearAndFillInput with .toFill

The Filter by Attribute block has been skiped until tests are fixed.

* Add back setupPageSettings to jest setup

* Fix filter by attribute block test

* Fix linting error

Co-authored-by: Raluca Stan <ralucastn@gmail.com>
2021-12-23 17:26:10 +01:00
Lucio Giannotta ba9c602006 Remove “Page” suffix from template titles (https://github.com/woocommerce/woocommerce-blocks/pull/5434) 2021-12-23 17:20:52 +01:00
Thomas Roberts 20cac18474 Don't show shipping price when no options are available (https://github.com/woocommerce/woocommerce-blocks/pull/5444)
* Add isCheckout prop to NoShippingPlaceholder and TotalsShipping

* Pass isCheckout to TotalsShipping in Checkout sidebar

* Show the NoShippingPlaceholder if no rates are found

* Show better error message when no shipping is available in checkout
2021-12-23 13:24:08 +00:00
Tung Du b2eecf3bb0 Fix: Mini Cart: Default content for empty state (https://github.com/woocommerce/woocommerce-blocks/pull/5421) 2021-12-22 18:03:58 +07:00
Niels Lange 9a1cd85779 Remove text decorations from product filter (https://github.com/woocommerce/woocommerce-blocks/pull/5384) 2021-12-22 15:33:37 +07:00
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