Commit Graph

3345 Commits

Author SHA1 Message Date
renovate[bot] 7822affe2e Update dependency @types/wordpress__compose to v4.0.1 (https://github.com/woocommerce/woocommerce-blocks/pull/5334)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-08 05:51:31 +00:00
renovate[bot] 5e3528a05c Pin dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/5333)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-08 03:25:48 +00:00
Mike Jolley cfeb5558b7 Update WordPress Monorepo packages with React 17x support (https://github.com/woocommerce/woocommerce-blocks/pull/5223)
* Use npm 14

* Update WP packages

* Update non-dev wordpress dependencies

* Remove usage of @automattic/data-stores

* Moves tag, search-list-control components back into private `editor-components` to mitigate dependency conflicts with`@woocommerce/components`

* Fix tests with act()

* package-lock

* fix broken maps

* Patch 14x package

* update locks

* Revert nvmrc change

* Fix tests due to debounce

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2021-12-07 15:47:50 +00:00
M. L. Giannotta 77c237d6a2 Storybook migration of `CountryInput` component (https://github.com/woocommerce/woocommerce-blocks/pull/5312)
* Enable `exactOptionalPropertyTypes` in TS config

This option will create more strict types out of optional properties.
Read more: https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-beta/#exact-optional-property-types

* Extract `ComboBoxProps` as own interface

This way we can export it to use it somewhere else. In this specific case,
I'll need to use it as a base to extend the `CountryInputProps`.

Also fixed some types to be optional, as the component requires.

* Fix stories and props for `CountryInput` (https://github.com/woocommerce/woocommerce-blocks/pull/5252)
2021-12-07 16:07:21 +01:00
Mike Jolley de068d2fc3 Rest API - Namespace error handling (https://github.com/woocommerce/woocommerce-blocks/pull/5319)
* get_routes_from_namespace needs to handle WP_Error responses

* is_request_to_store_api is not static
2021-12-07 15:03:58 +00:00
Tung Du 185f1d5bd9 Fix: Mini Cart block button should be disabled in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/5308) 2021-12-07 21:29:56 +07:00
Tung Du 90a54b6cf0 Mini Cart Contents block: implement view switcher in editor (https://github.com/woocommerce/woocommerce-blocks/pull/5304) 2021-12-07 21:07:53 +07:00
Mike Jolley 587e3b98d4 Add missing Exception use statement in RoutesController (https://github.com/woocommerce/woocommerce-blocks/pull/5330) 2021-12-07 13:13:48 +00:00
Mike Jolley 7fd25d4b37 Typedefs and cartData for `usePaymentMethodInterface` (https://github.com/woocommerce/woocommerce-blocks/pull/5177)
* Typedefs and cartData for the payment interface

* fix case on noticeContexts

* typeof for enums

* immutable note

* Add cartData to docs table

* Rebase docs
2021-12-07 13:02:57 +00:00
Tom Cafferkey 44aaf67caa Updated version numbers for the next release 2021-12-07 11:51:42 +00:00
github-actions[bot] 212085bbd8 Release: 6.5.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5321)
* Empty commit for release pull request

* Update readme.txt and add 6.5.0 testing notes

* Update build link

* Update CSV link

* Testing instruction titles.

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
2021-12-07 11:47:28 +00:00
Albert Juhé Lluveras b927ca6a9f Convert renderFrontend to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/5238)
* Rename render-frontend file to tsx

* Add types to renderFrontend

* Reorder code

* Use PascalCase for types

* add generics

* fix TS error

* restore interface

Co-authored-by: Luigi <gigitux@gmail.com>
2021-12-07 11:07:32 +01:00
Tung Du 66a3ac1d33 Refactor: use StyleAttributesUtils to generate classes and styles (https://github.com/woocommerce/woocommerce-blocks/pull/5307) 2021-12-07 12:21:40 +07:00
Tung Du e3620307df Fix: Mini Cart: don't allow users to create extra template parts in the Mini Cart template part area (https://github.com/woocommerce/woocommerce-blocks/pull/5306) 2021-12-07 12:20:37 +07:00
renovate[bot] 5565b3030a Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/5313)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-07 01:23:20 +01:00
M. L. Giannotta 4651f64341 Storybook and TS migration of ReadMore component (https://github.com/woocommerce/woocommerce-blocks/pull/5300)
* Update packages to latest Storybook deps

* Migrate `ReadMore` component and its utils to TypeScript

* Add type definitions for `trim-html` package

* Migrate `ReadMore` stories to newest Storybook

Fixes woocommerce/woocommerce-blocks#5254
2021-12-06 18:00:33 +01:00
Luigi Teschio 4a134c7fb5 Set WooCommerce like source of WC templates woocommerce/woocommerce-blocks#5271 (https://github.com/woocommerce/woocommerce-blocks/pull/5320)
Set WooCommerce like source of WC templates woocommerce/woocommerce-blocks#5271
2021-12-06 15:41:00 +01:00
Albert Juhé Lluveras b7051c8cd0 Fix JS error in Filter Products by Attribute block (https://github.com/woocommerce/woocommerce-blocks/pull/5301) 2021-12-06 11:03:18 +01:00
Alex Florisca 0a8415e3a6 More ts conversions (https://github.com/woocommerce/woocommerce-blocks/pull/5263)
* WIP

* Converted block-error-boundary to TS

* Convert CheckboxList to TS

* Converted Chip and Removable Chip components to TS

* Change type to React.FC<T>

* Fix tests

* Implement Lucio feedback
2021-12-03 17:23:25 +00:00
Albert Juhé Lluveras 48a29c5bba Refactor Mini Cart contents block unmount to fix ESLint warning (https://github.com/woocommerce/woocommerce-blocks/pull/5216) 2021-12-03 11:37:15 +01:00
Luigi Teschio 2358c0c90b Mini Cart block: Add label for tax when it should be visible in accordance with WC settings (https://github.com/woocommerce/woocommerce-blocks/pull/5184)
* Mini Cart block: Add label for tax when it should be visible in accordance with WC settings woocommerce/woocommerce-blocks#4849

Mini Cart block: Add label for tax when it should be visible in accordance with WC settings

* improve the tax label handling

* fix code after conflict

* fix tax label handling when it is added the first product

* add another check for avoid PHP error

* rename variables; add test for the function getSettingWithCoercion

* add margin-right for tax-label; add test to check if type guard works correctly
2021-12-03 10:45:06 +01:00
Luigi Teschio c2ebf26c1c Enable stylelint for the entire project woocommerce/woocommerce-blocks#5262 (https://github.com/woocommerce/woocommerce-blocks/pull/5298)
Enable stylelint for the entire project
2021-12-03 10:07:51 +01:00
Alex Florisca e8b4b3467c Fix Featured Product Search not working for large stores (https://github.com/woocommerce/woocommerce-blocks/pull/5156)
* Remove the dependency from the getProducts useEffect

* using ref instead of empty dependency array for useEffect
2021-12-02 18:51:46 +00:00
M. L. Giannotta 12bb68d970 Storybook and TS migration of `Icon` component (https://github.com/woocommerce/woocommerce-blocks/pull/5291)
* Migrate icons to TypeScript

* Fix `Icons` stories (https://github.com/woocommerce/woocommerce-blocks/pull/5257)

* Enable the correct controls
* Include a base story with a default icon and all controls
* Include a second story with the filterable icons library (no controls)

Fix woocommerce/woocommerce-blocks#5257
2021-12-02 17:56:53 +01:00
M. L. Giannotta bee06b6005 Storybook and TS migration of `ErrorPlaceholder` component (https://github.com/woocommerce/woocommerce-blocks/pull/5294)
* Convert `ErrorPlaceholder` and `ErrorMessage` to TypeScript

* Add stories for `ErrorPlaceholder` and `ErrorMessage` (https://github.com/woocommerce/woocommerce-blocks/pull/5255)

Stories include:

* Default generic error
* API error
* Unknown error
* Error without possibility to retry
* Base Error atom

Where applicable, the **Retry** button will not only trigger the appropriate
action, but also simulate the loading state of the error component.

* Update references to `ErrorMessage` component to leave the file extension out

Fix woocommerce/woocommerce-blocks#5255
Refs woocommerce/woocommerce-blocks#5249
2021-12-02 17:56:03 +01:00
M. L. Giannotta 66454293c1 Fix `ExternalLinkCard` story (https://github.com/woocommerce/woocommerce-blocks/pull/5256) (https://github.com/woocommerce/woocommerce-blocks/pull/5292) 2021-12-02 17:38:39 +01:00
Tom Cafferkey d3f4223510 Refactor BlockTemplateController (https://github.com/woocommerce/woocommerce-blocks/pull/5200)
* Move template slug creation to utility method

* Move theme_has_template to BlockTemplateUtils method
2021-12-02 10:35:39 +00:00
Néstor Soriano 79722aec00 Fix code that causes PHP 8.1 deprecation in BlockTypesController (https://github.com/woocommerce/woocommerce-blocks/pull/5287) 2021-12-01 12:58:56 +00:00
M. L. Giannotta 7e9f8c822d Migrate Storybook to 6.4.0 and enable auto-detection of controls (https://github.com/woocommerce/woocommerce-blocks/pull/5249) (https://github.com/woocommerce/woocommerce-blocks/pull/5264)
* Migrate Storybook to 6.4.0 and enable auto-detection of controls (https://github.com/woocommerce/woocommerce-blocks/pull/5249)

Previously our Babel configuration conflicted with the one provided by
default by Storybook, making us unable to leverage the automatic
detection of properties from both JS and TS components to create
controls (formerly known as knobs).

Upgrading to 6.4.0 fixes a bug that makes it easier to work with
Babel configurations. Also done here:

* Removed a few deprecated addons in favor of the replacement ones
bundled within Storybook Essentials.
* Add auto-detection of certain control types depending on the property names
* Add support for TS stories

More context: https://github.com/storybookjs/storybook/issues/12292

* Use `react-docgen` only in development environments

This should reduce production bundle size dramatically. The only
problem here is that Storybook runs its `build` command with the
`NODE_ENV` set to `production`. For this reason, we change the
script to provide `BABEL_ENV` set to `development` to still make sure
the correct configuration is loaded, while trying to reduce any
side-effects on changing the whole `NODE_ENV`.
2021-12-01 12:28:27 +01:00
Luigi Teschio 1aca1eaa7c Add recommended extensions for VSCode woocommerce/woocommerce-blocks#5233 (https://github.com/woocommerce/woocommerce-blocks/pull/5237)
* Add recommended extension for vs code woocommerce/woocommerce-blocks#5233

Add recommended extension for vs code

* replace PHP extensions

* add editor config extension

* update gitignore
2021-12-01 09:50:28 +01:00
renovate[bot] 302807474a Update dependency @storybook/addon-knobs to v6.4.0 (https://github.com/woocommerce/woocommerce-blocks/pull/5283)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-01 03:09:42 +00:00
renovate[bot] 3f7c17553b Update dependency jest-environment-puppeteer to v6.0.2 (https://github.com/woocommerce/woocommerce-blocks/pull/5282)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-01 03:07:03 +00:00
Luigi Teschio dfef363e15 Add global style for Product Categories List block (https://github.com/woocommerce/woocommerce-blocks/pull/5133)
* Add global style for product categories list block woocommerce/woocommerce-blocks#4965

Add global style for product categories list block

* add support for link color

* add feature flag

* fix code style and PHP warning

* update doc comment

* remove empty space

* refactor StyleAttributesUtils (https://github.com/woocommerce/woocommerce-blocks/pull/5277)

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2021-11-30 16:28:45 +01:00
renovate[bot] 2e4a303fed Update dependency json-schema to 0.4.0 [SECURITY] (https://github.com/woocommerce/woocommerce-blocks/pull/5275)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-30 10:01:52 +00:00
Luigi Teschio 67ad9e4f27 Mini Cart Block: add link to edit template part from sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/5201)
* Mini Cart Block: add link to edit template part from sidebar woocommerce/woocommerce-blocks#5186

Mini Cart Block: add link to edit template part from sidebar

* fix e2e tests
2021-11-30 10:42:07 +01:00
Alex Florisca a9fbc828c0 Product details component accepts `key` or `name` as props (https://github.com/woocommerce/woocommerce-blocks/pull/5165)
* Product details metadata now accepts  as a default prop, with  as an optional alternative

* Updated product details test snapshot

* Don't overwrite key prop

* One of key or value must be entered in ProductItemResponseData type
2021-11-30 09:39:55 +00:00
Niels Lange c9bfd5bbbd Remove obsolete files and folders from deploy zip (https://github.com/woocommerce/woocommerce-blocks/pull/5234) 2021-11-30 14:56:47 +07:00
Albert Juhé Lluveras 98d9dbdcf0 Don't run enqueue_assets on REST requests (https://github.com/woocommerce/woocommerce-blocks/pull/5260) 2021-11-29 10:45:53 +01:00
Albert Juhé Lluveras 76f2ff32d5 Create dev packages with a blocks.ini file (https://github.com/woocommerce/woocommerce-blocks/pull/5261) 2021-11-28 19:37:26 +01:00
Alex Florisca d9bf1ba94c Convert components to Typescript (https://github.com/woocommerce/woocommerce-blocks/pull/5241)
* Convert ReturnToCartButton component to TS

* Convert FormStep component to TS

* Remoe proptypes from FormStep and AddressFormn components

* Converted order-summary component to TS

* Convert product-price component to TS

* alias path to type-defs

* Fix errors

* Changes from Thomas feedback

* Change minPrice maxPrice logic to be more robust

* Changed types from inline to interface in ReturnToCartButton component

* Check for string type in order-summary-item

* add missing isString check
2021-11-26 17:03:12 +00:00
Mike Jolley c067e990b4 Introduce `<Noninteractive>` component to disable form elements non-visually (https://github.com/woocommerce/woocommerce-blocks/pull/5157)
* Noninteractive component based on Disabled

* Implement in cart/checkout

* Pass down props

* Update 'use-debounce' library

* aria disabled
2021-11-26 14:47:37 +00:00
Tom Cafferkey cbdbc6c7a1 Change source value on WooCommerce block templates to be plugin instead of woocommerce (https://github.com/woocommerce/woocommerce-blocks/pull/5215) 2021-11-26 12:40:41 +00:00
Albert Juhé Lluveras 9803b51d1f Revert "Create dev packages with a blocks.ini file"
This reverts commit cc3b77c256.
2021-11-26 12:54:45 +01:00
Albert Juhé Lluveras cc3b77c256 Create dev packages with a blocks.ini file 2021-11-26 12:51:51 +01:00
M. L. Giannotta 57fcb28720 Checkbox Control: Fix squished checkboxes when label text wraps (https://github.com/woocommerce/woocommerce-blocks/pull/5192) (https://github.com/woocommerce/woocommerce-blocks/pull/5206)
On the front-end, checkboxes with labels would look squished when the labels wrapped
on a second line. That was due to the flex container taking too much space for the label
as the checkbox minimum dimensions was set in `px` rather than `em`, making it work
differently depending on the relative font size.
2021-11-25 15:31:47 +01:00
Albert Juhé Lluveras 6e079b9a4b Add 6.3.3 testing steps 2021-11-25 13:26:12 +01:00
Albert Juhé Lluveras cd95ca5a9f Add 6.3.3 changelog 2021-11-25 13:25:48 +01:00
Tung Du 0875884304 Fix: When creating a template part for the Mini Cart area, it should be created already containing the Mini Cart Contents block (https://github.com/woocommerce/woocommerce-blocks/pull/5231)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-11-25 00:33:57 +07:00
Alex Florisca 3aa9655e8c Update folder structure doc (https://github.com/woocommerce/woocommerce-blocks/pull/5235) 2021-11-24 14:19:32 +00:00
Niels Lange 29d0cd0b64 Display decimals if intended by the merchant (https://github.com/woocommerce/woocommerce-blocks/pull/5219) 2021-11-24 20:21:40 +07:00