Commit Graph

2110 Commits

Author SHA1 Message Date
Niels Lange 627a11d045 Revert "Show Cart and Checkout blocks in Style Book (https://github.com/woocommerce/woocommerce-blocks/pull/8489)" (https://github.com/woocommerce/woocommerce-blocks/pull/8602)
This reverts commit 5944e229c2.
2023-03-06 12:19:08 +07:00
Alba Rincón b3db625215 Make the customer account icon bigger to match the mini-cart one (https://github.com/woocommerce/woocommerce-blocks/pull/8594)
* Make the customer account icon bigger to match the mini-cart one

* Add variation to increase the icon size for new blocks

* Improve class name

* Add variation explanation

* Add default attributes
2023-03-03 15:44:34 +01:00
Luigi Teschio 89cd344374 upgrade @types/wordpress__blocks package (https://github.com/woocommerce/woocommerce-blocks/pull/8624) 2023-03-03 12:42:50 +01:00
Alba Rincón 7245ca519e Make the start shopping button show the theme style (https://github.com/woocommerce/woocommerce-blocks/pull/8567)
* Make the start shopping button show the theme style

* Center the button

* Fix test
2023-03-03 10:55:28 +01:00
Albert Juhé Lluveras 1d0adeed28 Replace react imports with wordpress/element (https://github.com/woocommerce/woocommerce-blocks/pull/8520)
* Replace react imports with wordpress/element

* Fix TS errors

* Update a couple of React type imports
2023-03-02 15:26:00 +01:00
Alba Rincón 363fe84039 Switch Select by Toggle for the 'Add-to-Cart behaviour' (https://github.com/woocommerce/woocommerce-blocks/pull/8558) 2023-03-02 15:09:37 +01:00
Alba Rincón 8ff958a0e2 Remove colorClassName and style from QuantityBadge (https://github.com/woocommerce/woocommerce-blocks/pull/8557) 2023-03-02 15:08:09 +01:00
Niels Lange 465732aeb8 Show three Express Payments buttons in-line (https://github.com/woocommerce/woocommerce-blocks/pull/8601)
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2023-03-02 19:47:18 +07:00
Albert Juhé Lluveras 4b82793b33 Fix Mini Cart missing translations (https://github.com/woocommerce/woocommerce-blocks/pull/8591) 2023-03-02 11:16:32 +01:00
Paulo Arromba 6483ee08d0 Added debounce to shipping rate selection on cart (https://github.com/woocommerce/woocommerce-blocks/pull/8498) 2023-03-01 13:41:20 +00:00
Patricia Hillebrandt a7f471d9ff Add to Cart Form Block > Ensure the editor preview is properly displayed with the Gutenberg plugin disabled (https://github.com/woocommerce/woocommerce-blocks/pull/8582)
* Update the editor styles for the add to cart form button so it is properly displayed with the Gutenberg plugin disabled.

* update for the input height.

* update the min-height
2023-03-01 10:39:54 +01:00
Roy Ho b9044a72df Add explicit CSS styling to mini-cart block amount in inserter preview (https://github.com/woocommerce/woocommerce-blocks/pull/8516)
* Add explicit CSS styling to mini-cart block amount in inserter preview

* Add preview specific class name

* Fix formatting
2023-02-28 09:40:06 -08:00
David Arenas 8f76d41fe2 Serialize the Interactivity API's store from PHP and hydrate it on the client (https://github.com/woocommerce/woocommerce-blocks/pull/8447)
* Update Interactivity API

* Change `wp` prefixes to `woo`

* Use `woo` prefix for the directives runtime bundle

* Update Interactivity API runtime

* Hardcode php from interactivity API

* Temporarily add gutenberg plugin as dependency

* Exclude Interactivity API files from phpcs checks

* Update Interactivity API js files

* Update Interactivity API php files

* Remove gutenberg from wp-env plugins

* Fix registered runtime paths

* Fix prefixes when getting attributes in directives

* Fix directive prefix in constants

* Avoid a Fatal error when importing `wp-html`

* Remove TODO comments from Interactivity API files

* Add missing prefix to some global functions

* Use true as value for boolean attributes

* Add `wp-html` file

* Change requires in `wp-html` with includes
2023-02-28 17:33:33 +01:00
kmanijak 630f602f49 [Blockifying Product Archive Templates]: Implement the blockified template conversion for the Classic Template Block. (https://github.com/woocommerce/woocommerce-blocks/pull/8248)
* Extract a blockified Product Archive Template to the templates

* Add templates to tsconfig.json so the files are resolved as part of the core code

* Add a encouragement note to use blockified version IF migration is available

* Add a Row block wrapping Product Results Count and Catalog Sorting blocks

* Move blockified product-archive from templates/ to assets/ directory

* Remove unnecessary margin from Product Results Count block

When used in a Row block in a blockified Archive Product template, Product Results Count had additional unnecessary margin which caused misalignment with the Catalog Sorting block

* Update the description of the Classic Template Editor placeholder

* Remove unnecessary entry in tsconfig.json to include templates directory

It was added couple of commits earlier, since the template was kept there, but it was decided to move it to assets directory, so entry is no longer necessary

* Differentiate the Classic Template placeholder description depending on the availability to convert to Products block

* Set margin for Catalog Sorting to 0, so it aligns properly when used in blockified Archive Product template

* Make the blockification config, so it covers the Product Archive as well as Single Product templates

* Move the product-archive specific functions from classic-template/index.tsx to the product-archive.ts

* Add alignment option to the Store Notices block and make the blockified template blocks aligned wide

That is required, so the Classic Template layout is preserved

* Create single-product.ts file which is a placeholder for the blockified Single Product template

* Make Blockified Product Archive template inherit the align attibute

* Simplify the interface of blockified templates

Expose  function instead of two functions for allowing and disallowing conversion

* Add a BlockifiedTemplate type

* Rename and simplify the function checking if conversion of classic template to block version is possible

* Align the variable naming to use  instead of

* Pass the Classic Template attributes to the blockified template instead of getting it from data store

* Include Breadcrumbs block in the Blockified Product Archive Template

* Consume alignment attributes of Catalog Sorting in the PHP render function

* Consume alignment attributes of Breadcrumbs in the PHP render function

* Remove align support from Catalog Sorting and add to Store Notices block

* Extend the get_classes_and_styles_by_attributes method with align and text_align attributes

* Add Archive Title block to the Blockified Classic Template

* Minor getRowBlock function refactor

* Add  property to the classic templates and base the config on it instead of placeholder

* Add separate blockified template for a Product Search Results

* Pass  attribute from classic template to No Results block in Product Search Results

* Extract the common functions between blockified archive-template and product-search-results to utils

* Enable 'Inherit query from template' in Products block by default when converting the Classic Template to blockified one

* Improve the naming of BlockifiedTemplateConfig type

* Differentiate Product Catalog and Products By * templates. The latter include Term Description block

* Change unclear ProductsBy to ProductTaxonomy in regards to classic template conversion

* Revert the margin fix which was added already on trunk

* Move the surrounding blocks as inner blocks of Products

* Hide the conversion behind the experimental build flag (as it was before)
2023-02-27 15:34:18 +01:00
Alba Rincón 90e68175cf Fix "Product Price" block margin on the "All products" block (https://github.com/woocommerce/woocommerce-blocks/pull/8518)
* Only use margin for the feature plugin

* Return empty style if no support for spacing styling
2023-02-27 14:38:45 +01:00
Mike Jolley eae93e60b8 Do not mount form until shown (https://github.com/woocommerce/woocommerce-blocks/pull/8525) 2023-02-27 11:52:57 +00:00
Mike Jolley a454e1ee0a Avoid rendering renamed props for inner blocks (https://github.com/woocommerce/woocommerce-blocks/pull/8471) 2023-02-27 11:35:12 +00:00
Seghir Nadir 2b89cbff33 Prevent double triggering select shipping on the same rate (https://github.com/woocommerce/woocommerce-blocks/pull/8497)
* Prevent selecting already selected rates

* refactor reducer

* revert changes back to only block dubplicate requests
2023-02-27 11:52:38 +01:00
Niels Lange 49b42b627f Ensure express payment buttons are visible next to each other (https://github.com/woocommerce/woocommerce-blocks/pull/8548) 2023-02-27 17:30:22 +07:00
kmanijak 87cc35678a Move usage of wordpress-components to editor and replace with @wordpress-components (https://github.com/woocommerce/woocommerce-blocks/pull/8463) 2023-02-27 11:13:00 +01:00
Patricia Hillebrandt 25b434036d Fine-tune the Add to cart form block (https://github.com/woocommerce/woocommerce-blocks/pull/8482)
* Restrict usage to the single product template.

* Update class prefix from wc to wp

* Move the add-to-cart-form block to atomic blocks so it is aligned with the updated structure adopted for single product related blocks.

* Address CR

* ditch woocommerce class.

* remove attributes key

* Add new styles to account for the removal of the .summary and .entry-summary selectors

* Narrow down the styles to the add-to-cart-form class.
2023-02-24 23:12:53 +01:00
Luigi Teschio abd8cdbcc2 Add Related Products block (https://github.com/woocommerce/woocommerce-blocks/pull/8522) 2023-02-24 16:35:43 +01:00
Saad Tarhi 9bfc8a633c Fix Payment Options settings crash in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/8535) 2023-02-24 16:08:19 +01:00
Saad Tarhi 39b6c1c320 Improve the dismissal behavior of the incompatible gateways notice (https://github.com/woocommerce/woocommerce-blocks/pull/8299)
* Fix notice persistence after dismissal

- This fix applied to the `incompatible payment gateway notice`.
- We used the same dismissal logic in the `sidebar compatibility notice`

* Get incompatible payments when initialized

We initially get the list of `globalPaymentMethods` shared from
the back-end as incompatible payments, because the front-end
`availablePaymentMethods` is empty before the
`paymentMethodsInitialized` state

* Introduce advanced notice dismissal handling

We want to display a dismissed incompatible gateways notice, when the
list of incompatible gateways is updated (e.g., a new incompatible
gateway is enabled)

* Use the full block name for the `Cart` & `Checkout`

* Update variable name for comprehension

* Fix TS errors

* Remove unused imports
2023-02-24 11:57:24 +01:00
Albert Juhé Lluveras c915123afc Fix Product Price and Product Rating alignment (https://github.com/woocommerce/woocommerce-blocks/pull/8526)
* Fix Product Price and Product Rating default alignment

* Refactor get_text_align_class_and_style() to simplify the logic
2023-02-24 09:17:22 +01:00
Tarun Vijwani bbe5b70e80 Add declaration of noticeContext (https://github.com/woocommerce/woocommerce-blocks/pull/8495)
Add the declaration of noticeContext to make notice appear in the shipping calculator
2023-02-23 18:49:03 +04:00
kmanijak 23d9e1008c Add isLink attribute to the Products block title (https://github.com/woocommerce/woocommerce-blocks/pull/8519) 2023-02-23 14:00:44 +01:00
Niels Lange 5944e229c2 Show Cart and Checkout blocks in Style Book (https://github.com/woocommerce/woocommerce-blocks/pull/8489) 2023-02-23 12:29:05 +07:00
Albert Juhé Lluveras e580c1a6af Update Product Details block so it inherits more styles from the theme (https://github.com/woocommerce/woocommerce-blocks/pull/8494)
* Use wc-tabs selectors instead of tabs as WC core does

* Remove hardcoded colors from Product Details tabs
2023-02-22 09:31:20 +01:00
Tung Du 48a721c60c Update the archive templates to use Products block (https://github.com/woocommerce/woocommerce-blocks/pull/8308)Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
* wip: update blockified archive templates

* Update product archive title to Shop

* Update product search template to blockified version

* new default templates, all blocks are Products block inner blocks

* revert change to fallack eligible archive templates

* remove unneccessary translated strings

* only filter the archive title on the shop page

* add missing categories header for patterns

* remove the term description block on the fly

* explain the reason for removing the term description block

---------

Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
2023-02-22 08:24:04 +07:00
Albert Juhé Lluveras faa6f4ae4a Don't load opinionated button styles in themes that have button styles (https://github.com/woocommerce/woocommerce-blocks/pull/8478) 2023-02-21 15:37:41 +01:00
Albert Juhé Lluveras 081a63ab8d Fix Catalog Sorting default color in dark backgrounds (https://github.com/woocommerce/woocommerce-blocks/pull/8483) 2023-02-21 13:59:13 +01:00
kmanijak 18e6ba0659 Move the usage of Notices from @wordpress/components from frontend to editor (Filter by Rating) (https://github.com/woocommerce/woocommerce-blocks/pull/8444)
* Move Notice component usage to editor in RatingFilter

* Remove unnecessary JSdoc in Filter by Rating block
2023-02-21 11:48:52 +01:00
Daniel Dudzic 34fc847d9f All Products: Re-add alignment controls for Product Rating and Price (https://github.com/woocommerce/woocommerce-blocks/pull/8264)
* Product Rating and Price: Re-add alignment controls in the All Products context.

* Add default values to align attributes for price and rating product elements

---------

Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
2023-02-21 09:40:14 +00:00
David Arenas 2ee332d4d4 Update directives prefix to `data-woo-` (https://github.com/woocommerce/woocommerce-blocks/pull/8316)
* Update Interactivity API

* Change `wp` prefixes to `woo`

* Use `woo` prefix for the directives runtime bundle
2023-02-20 17:48:33 +01:00
Roy Ho 2e27f38953 Add parsed border props to featured items (https://github.com/woocommerce/woocommerce-blocks/pull/8472) 2023-02-20 05:45:06 -08:00
kmanijak c872a0c8f3 Move the usage of Notices from @wordpress/components from frontend to editor only (https://github.com/woocommerce/woocommerce-blocks/pull/8457) 2023-02-20 14:31:33 +01:00
kmanijak 155a693dda In editor use the components from @wordpress/components instead of wordpress-components (https://github.com/woocommerce/woocommerce-blocks/pull/8432) 2023-02-17 15:09:26 +01:00
kmanijak 766b3a20d0 Simplify unused Add to Cart button form placeholder for grouped product (https://github.com/woocommerce/woocommerce-blocks/pull/8438)
* Simplify Add to Cart grouped version as it's never displayed
2023-02-17 15:08:57 +01:00
Alex Florisca 9a6e0833cd Rename the checkout events (https://github.com/woocommerce/woocommerce-blocks/pull/8381)
* WIP

* Deprecate isPaymentPristine and undeprecate isPaymentStarted

* Set payment status to FAILED or SUCCESS when the storeAPI fetch returns

* Remove FINISHED as a status

* Remove ready status

* Revert "Remove FINISHED as a status"

This reverts commit 38d66ed1d9565756d2373533c7a7c5b107a68ddd.

* Add payment status READY

* Removed payment statuses pristine, failed and success

* Remove deprecated selectors and update docs

* Rename the checkout events

* Merge conflicts

* Update test observer

* Update deprecation notice

* deprecation versions

---------

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-02-17 11:03:13 +00:00
Albert Juhé Lluveras b67eed1ace Add minimum height to Mini Cart Contents block in the Style Book (https://github.com/woocommerce/woocommerce-blocks/pull/8458) 2023-02-17 11:45:42 +01:00
Patricia Hillebrandt 9e0c20d43e Create the Add to Cart Form Block (https://github.com/woocommerce/woocommerce-blocks/pull/8284)
* Add the initial basis for the Add to Cart button

* Trigger the single product add to cart action for each product type.

* Rename the block from add-to-cart-button to add-to-cart-form

* Update to use the cart icon.

* Implement the skeleton for the editor preview.

* Update styles and add Notice for the display in the Editor.

* Update CSS.

* Add base tests for the new Add to Cart Form component.

* Update the button CSS.

* Update styles for the cart form.

* update td style.

* Update divs and CSS.

* Use conventional input instead of the experimental InputControl

* Implement the new design and copy provided for the editor.

* Make the notice compatible with dark themes.

* Some additional CSS tweaks

* adjust the padding for the input

* Update the icon for the block to match the core icon button
2023-02-16 11:43:37 +01:00
Alexandre Lara bd9295eb32 Add Single Product Details block (https://github.com/woocommerce/woocommerce-blocks/pull/8225)
* Add minimum structure for Single Product Details block

* Add tests for Single Product Details block

* wip: create block structure and add initial styles

* Add block details to the SingleProductDetails.php file

* Render tabs title with empty content

* Use woocommerce_output_product_data_tabs function to retrieve tabs data

* Remove customizations for the Single Product Details block

* Remove unnecessary console.log from the Edit.tsx file

* Remove block classname from block wrapper

* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController

* Remove attributes property from the block registration

* Remove isExperimental flag for the Single Product Details block

* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block

* Prevent Single Product Details block from apppearing in Pages or Posts

* Fix PHP Coding Standards warnings

* update block name

* fix SCSS linter error

* move blocks into product-elements folder and rename to product-details

* avoid 404 error

* disable js asset enqueue

---------

Co-authored-by: Luigi Teschio <gigitux@gmail.com>
2023-02-16 11:18:16 +01:00
Albert Juhé Lluveras 56c154737f Fix Customer account sidebar link incorrect margin in WP 6.2 (https://github.com/woocommerce/woocommerce-blocks/pull/8437)
* Fix Customer account sidebar link incorrect margin in WP 6.2

* Update class name to match the guidelines
2023-02-16 10:07:44 +01:00
Mike Jolley ce733a07b7 Checkout/Store API - Allow partial pushes without country (https://github.com/woocommerce/woocommerce-blocks/pull/8425)
* Support partial push without country field

* Increase timeout to prevent excessive pushes

* Push on focusout

* Only flush inputs

* change debounce timer to 1s

---------

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2023-02-15 13:00:16 +01:00
Daniel Dudzic e36da268f8 Product Price: Fix typography styles in the editor. (https://github.com/woocommerce/woocommerce-blocks/pull/8398)
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
2023-02-15 11:03:42 +00:00
Luigi Teschio 336591f8d4 Add Product Image Gallery (https://github.com/woocommerce/woocommerce-blocks/pull/8235)
* Add Product Image Gallery woocommerce/woocommerce-blocks#8233

Add Product Image Gallery

* Add Product Image Gallery block

* remove support global styles

* remove support global styles

* address CSS feedback

* add support for the custom classname

* remove save function

* add second parameter to the subscribe function

* update @types/wordpress__data package

* update placeholder, icon and description

* update tsconfig
2023-02-14 14:21:48 +01:00
Alex Florisca 39682160c2 Refactor payment status (https://github.com/woocommerce/woocommerce-blocks/pull/8110)
* WIP

* Change payment status from pristine to idle

* Deprecate isPaymentStarted and isPaymentFinished

* Correct comments

* Deprecate isPaymentPristine and undeprecate isPaymentStarted

* Set payment status to FAILED or SUCCESS when the storeAPI fetch returns

* Remove FINISHED as a status

* Remove ready status

* Revert "Remove FINISHED as a status"

This reverts commit 38d66ed1d9565756d2373533c7a7c5b107a68ddd.

* Add payment status READY

* Update use-payment-interface

* Removed payment statuses pristine, failed and success

* Remove deprecated selectors and update docs

* Deprecate isPaymentStarted in favour of isExpressPaymentStarted

* Fix tests

* Update assets/js/base/context/providers/cart-checkout/payment-events/index.tsx

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

* Mikes suggestions

* Change since version

* Fix tests

---------

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-02-14 12:08:19 +00:00
Darren Ethier a371cf027c Fixes CSS spacing and availability issues for breadcrumb, catalog sort, and result count blocks. (https://github.com/woocommerce/woocommerce-blocks/pull/8391)
* Reset margin on result count block

* Reset margin for catalog sort block

* reset margin and other fixes for breadcrumb block.

* Move styles to relevant files
2023-02-14 05:53:33 -05:00
Alba Rincón 74e522e889 Set inherit default to true when products is inserted on archive product templates (https://github.com/woocommerce/woocommerce-blocks/pull/8375)
* Set inherit default to true when products is inserted on archive products templates

* Create new query attributes object

Co-authored-by: kmanijak <karol.manijak@automattic.com>

* Extract the products registration to a separate function

* Bring back variation name

* Move variation name

* Unregister the block before registering it again

* Use subscribe only on the site editor

* Undo change

* Try fixing tests

* Fix test

* Revert test only

---------

Co-authored-by: kmanijak <karol.manijak@automattic.com>
2023-02-13 16:36:38 +01:00
Thomas Roberts f3588635d7 Add stricter observer type checks in payments thunk to improve resilience to bad observer responses (https://github.com/woocommerce/woocommerce-blocks/pull/8319)
* Allow observers to set billingAddress by returning billingData

This is required since we didn't correctly deprecate billingData when we changed the name to billingAddress

* Add tests for shippingAddress and paymentMethodData

* Add mocked __internalSetPaymentMethodData to correct object

It was in registry, but should be in dispatch as the action is on the same store as the thunk. Registry is used for actions on other stores.

* Re-add FieldValidationStatus type

* Add FieldValidationStatus back

* Remove empty file

* Import FieldValidationStatus from correct place

* Remove import of deleted types file

* Add isObserverResponse type guard

* Use error constant instead of magic string in event emitter

* Remove composite project tsconfig

* Add ObserverResponse type

* Add types to emitEventWithAbort

* Check if paymentmethod data is an object before dispatching

* Set types on observer responses

* Add validationErrors type guards

* Add tests for validation typeguards

* Add validation errors as option on observer response

* Add more granular observer response types

* Check observer response has correct types before dispatching actions

* Force type on deprecated billingData and shippingData

* Remove unnecessary comment
2023-02-13 03:43:57 -08:00
Thomas Roberts 3797418079 Graduate `__experimentalApplyCheckoutFilter` and `__experimentalRegisterCheckoutFilters` to stable. (https://github.com/woocommerce/woocommerce-blocks/pull/8346)
* Add wrapper for __experimentalRegisterCheckoutFilters and deprecate it

* Update internal references from __experimentalRegisterCheckoutFilters

* Add wrapper for deprecated __experimentalApplyCheckoutFilter

* Update references from `__experimentalApplyCheckoutFilter`
2023-02-13 03:30:09 -08:00
Lucio Giannotta a7c730fbd0 Change location of Feedback prompt in Products block. (https://github.com/woocommerce/woocommerce-blocks/pull/8382)
With WordPress 6.2, the inspector controls are going to be
tabbed into a “Styles” and “Setting” section (where applicable).
Previously, in order to display our Feedback Prompt at the bottom
of the controls, we had hooked it into the “Colors” section
as a temporary/hacky solution to the problem.

Now that the styles sections are all moved, the problem
doesn't really exist anymore, and we can just place it
at the bottom of the controls.
2023-02-13 12:26:39 +01:00
Tarun Vijwani ee9a1e9ed1 Change coupon component label to "Add a coupon" (https://github.com/woocommerce/woocommerce-blocks/pull/8385)
- Revert the label change  to "Add a coupon"  so that it will be merged to WC Core and translation for the new string will be available.

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2023-02-10 00:56:30 +01:00
Seghir Nadir b396584e50 Capture notices from hidden block into siblings block (https://github.com/woocommerce/woocommerce-blocks/pull/8390)
* Capture notices from hidden block into siblings block

* switch to using a single context

* make change bwc

* add tests

* support context as array in StoreNotice

* move filter logic to Notice component
2023-02-09 14:41:18 +01:00
Alex Florisca 495339a073 Push address changes for email, name and address fields (https://github.com/woocommerce/woocommerce-blocks/pull/8400) 2023-02-09 11:53:25 +00:00
Mike Jolley aeed7b22b0 Update Cart/Checkout Default Template Styling (https://github.com/woocommerce/woocommerce-blocks/pull/8380)
* Switch default cart headings for cross sells to h2/h3

Fixes woocommerce/woocommerce-blocks#8193

* Style empty cart icon

woocommerce/woocommerce-blocks#8360

* Ensure editable content fields are transparent in the editor

woocommerce/woocommerce-blocks#8359 woocommerce/woocommerce-blocks#7007
2023-02-07 16:47:13 +01:00
Saad Tarhi a9296c7b3f Update the incompatible gateways notice design (https://github.com/woocommerce/woocommerce-blocks/pull/8365)
* Fix the alert icon's name

* Add "status" to the Alert's API

* Update the incompatible gateways notice's design

* Set the list's bullet points from CSS
2023-02-07 08:06:05 +01:00
Tung Du 5b542fa54f Fix: color setting for Catalog Sorting (https://github.com/woocommerce/woocommerce-blocks/pull/8372)
* fix select color

* add more priority to css selector

* add missing classname
2023-02-04 00:47:36 +07:00
Lucio Giannotta a750bb1c1b Remove Cart block from Style Book. (https://github.com/woocommerce/woocommerce-blocks/pull/8369)
Currently, the Cart block doesn't fully support Global Styles,
so, in orderto avoid providing the users with a confusing
or broken experience, we have decided to remove it
for the time being, until proper support has been added.
2023-02-03 18:27:52 +01:00
Lucio Giannotta a8789a09f0 Remove Classic Template from Style Book. (https://github.com/woocommerce/woocommerce-blocks/pull/8371)
The Classic Template is not style-able, also, removing the
example doesn't make us lose much in terms of UX.
2023-02-03 18:26:41 +01:00
Thomas Roberts 130827a2c3 Allow third party methods to appear in local pickup area (https://github.com/woocommerce/woocommerce-blocks/pull/8256)
* Add get_collectible_method_ids function

* Add collectibleMethodIds to asset data registry

* Check whether method id is pickup_location/in collectibleMethodIds

* Allow selectShippingRate to be called without a package id

* Prevent collectible methods showing in the main shipping area

* Remove unnecessary pluck and add pickup_location to returned array

* No longer insert pickup_location in collectibleMethodIds

* Allow third party methods to influence low/high collection price

* Update useShippingData to consider any collectible method

* Add hasSelectedLocalPickup to shipping types

* Add dependency to selectShippingRate in useShippingData

* Register collectibleMethodIds as a callback

This is so the shipping methods get change to register before this is called. Passing a callback to `add` means it won't be called until just before it is output.

* Update supports key to 'local_pickup'

* Rename utils/shipping-rates to TS

* Convert to TS, add isPackageRateCollectible & hasCollectableRate

* Add tests for hasCollectableRate and isPackageRateCollectible

* Update shipping controller to output only method names

* Make PickupLocation shipping method support local_pickup

* Set prefersCollection based on rate ID being collectible

* Remove need to retrieve settings and use helper function instead

* rename hasCollectableRate to hasCollectibleRate

* Use array_reduce and update comments in  get_local_pickup_method_ids

* Switch order of array_unique and array_values

* Remove unneeded dependency

* Hyphenate local-pickup so it follows the same format as other features

* Update use of collectible to collectable

* Change supports feature to be hyphenated
2023-02-03 08:00:24 -08:00
Mike Jolley 093ec68061 Fix/extension data conflicts (https://github.com/woocommerce/woocommerce-blocks/pull/8354)
* Update __internalSetExtensionData to require namespaces

* Test coverage for __internalSetExtensionData

* Rename of select is no longer needed

* Update doc
2023-02-03 11:18:18 +00:00
Daniel Dudzic 04a618ba6f Sale Badge: Add support for text settings and margin (https://github.com/woocommerce/woocommerce-blocks/pull/8334)
* Sale Badge: Add support for text settings and margin.

* Sale Badge: Remove redundant __experimentalSkipSerialization.
2023-02-03 11:09:12 +01:00
Daniel Dudzic d7defe2a0c Global Styles: Add support for additional text settings (https://github.com/woocommerce/woocommerce-blocks/pull/8329)
* Global Styles: Add support for text settings

* StyleAttributesUtils: Change function order

* Global Styles: Remove redundant isFeaturePluginBuild() from useTypographyProps().
2023-02-03 10:54:16 +01:00
Daniel Dudzic 076ba46ccb Product Rating: Add support for the padding setting (https://github.com/woocommerce/woocommerce-blocks/pull/8347)
* Product Rating: Add support for padding and background color settings.

* Product Rating: Remove the background color setting.
2023-02-02 22:45:03 +01:00
Roy Ho 0b28e33b2a Remove unneeded isloading attribute (https://github.com/woocommerce/woocommerce-blocks/pull/8340) 2023-02-02 09:35:48 -08:00
Roy Ho 0a6daae35f Add reset button to all filter blocks (https://github.com/woocommerce/woocommerce-blocks/pull/8366) 2023-02-02 05:50:28 -08:00
Tom Cafferkey e0c4052bfa Use setProductRatingsQuery to reset the filter when Apply Button is enabled (https://github.com/woocommerce/woocommerce-blocks/pull/8374) 2023-02-02 11:47:17 +00:00
Seghir Nadir a1d0b6d9f1 Switch to select instead of resolveSelector (https://github.com/woocommerce/woocommerce-blocks/pull/8356) 2023-02-02 10:12:52 +01:00
Daniel W. Robert 376bbc8993 Mini Cart block - Fix the drawer content height to allow checkout button to show. (https://github.com/woocommerce/woocommerce-blocks/pull/8351)
* Add max-height to Mini Cart drawer.

By giving the Mini Cart contents a max height with the
-webkit-fill-available property, we can ensure that the browser chrome
is accounted for on mobile devices.

* Add `dvh` and keep `vh` as a fallback for height.

By adding `dvh`, we also account for non-webkit mobile browsers that
have the same hidden button issue.

See
https://github.com/woocommerce/woocommerce-blocks/pull/8351#pullrequestreview-1278867767

Keeping `vh` as a fallback, along with `-webkit-fill-available` gives us
the widest range of support.
2023-02-01 11:48:37 -05:00
Patricia Hillebrandt d329ceee89 Store breadcrumbs block > Ensure experimental global styles are limited to the Feature plugin (https://github.com/woocommerce/woocommerce-blocks/pull/8345)
* Store breadcrumbs block: Gate global styles added via experimental flags to the feature plugin.

* Rename the const to featurePluginSupport and invoke it on block registration.

* Address CR
2023-02-01 16:31:45 +01:00
Alba Rincón 011f225e2a Revert "Set inherit default to true only when is inserted in the archive product template (https://github.com/woocommerce/woocommerce-blocks/pull/8251)" (https://github.com/woocommerce/woocommerce-blocks/pull/8352)
This reverts commit b0f2198e35.
2023-02-01 13:48:17 +01:00
Albert Juhé Lluveras 4371b6a480 Remove __experimentalDefaultControls from Filter by Stock and Filter by Rating blocks (https://github.com/woocommerce/woocommerce-blocks/pull/8326)
* Remove __experimentalDefaultControls from Filter by Stock and Filter by Rating blocks

* Remove link color from Filter by Stock block
2023-02-01 11:46:50 +01:00
Albert Juhé Lluveras 831cf20a4d Remove unnecessary __experimentalDuotone instances (https://github.com/woocommerce/woocommerce-blocks/pull/8328) 2023-02-01 10:28:23 +01:00
Roy Ho 9d2c7ec30d Update apply button description to be more clear for filter blocks (https://github.com/woocommerce/woocommerce-blocks/pull/8339) 2023-01-31 05:58:00 -08:00
Luigi Teschio d0d6c756f9 Style Book: Hide all the products grid (https://github.com/woocommerce/woocommerce-blocks/pull/8315) 2023-01-31 10:07:02 +01:00
Mike Jolley 1d45dacc3e Cart Action Promises with success/reject handling (https://github.com/woocommerce/woocommerce-blocks/pull/8272)
* move thinks and create consistent promise rejection

* Remove notifyErrors

* Combine error handling

* Ensure thunk usage handles errors

* Use promise in coupon form

* onsubmit type

* receiveCartContents during checkout

* Update mocks

* receiveCartContents mocks/types

* Fix receiveCartContents tests

* Move thunks back to actions, add todo for follow up

* Sort actions alphabetically

* Null check is unnecessary
2023-01-30 15:12:17 +00:00
Roy Ho 883d856c28 Add reset button in the editor for product attributer filter (https://github.com/woocommerce/woocommerce-blocks/pull/8285)
Co-authored-by: Niels Lange <info@nielslange.de>
2023-01-30 10:45:09 +01:00
Niels Lange 30a987a27a Adjust return to cart arrow (https://github.com/woocommerce/woocommerce-blocks/pull/8289) 2023-01-30 09:53:14 +01:00
Albert Juhé Lluveras 7ee1ea00ca Remove font family styling support from Catalog Sorting and Product Results Count blocks (https://github.com/woocommerce/woocommerce-blocks/pull/8311) 2023-01-30 04:30:36 +01:00
Roy Ho 44f04c1cd1 Add border attributes to featured items block to show border styles in editor (https://github.com/woocommerce/woocommerce-blocks/pull/8304) 2023-01-27 12:29:39 -08:00
Luigi Teschio 5025b80106 Hide blocks from Style Book (https://github.com/woocommerce/woocommerce-blocks/pull/8309) 2023-01-27 19:11:18 +01:00
Patricia Hillebrandt 9563468dc1 Create Store Breadcrumbs Block (https://github.com/woocommerce/woocommerce-blocks/pull/8222)
* Initial structure for the breadcrumbs block

* ditch inline comment

* Fine-tune the store breadcrumbs

* Disable the breadcrumbs block for regular posts & pages

* Update the breadcrumbs block details.

* Add tests

* rely on sprintf to render the breadcrumb

* Ditch usesContext.

* Add a link to the breadcrumb editor preview

* Disable all pointer-events for the breadcrumb link in the editor preview

* Add the align attribute

* Use the Disabled component to prevent interactions and update the copy for the block description.
2023-01-27 18:31:13 +01:00
Luigi Teschio c02726e1c1 Style Book: Fix Featured Product and Featured Category Blocks preview (https://github.com/woocommerce/woocommerce-blocks/pull/8313)
* Subscribe only to changes on core/block-editor

* Improve performance of useForcedLayou

This is because by the time we reach this line, innerBlocks will be an empty array (or we wouldn't make it this far) and if nextBlocks contains ANY items it will, by definition be unequal, so a length check is simpler and more performant. Also we can remove the dependence on yet another lodash function by doing it this way.

* Check if templates synced before doing it again in useForcedLayout

* Style Book: Fix Featured Product and Featured Category Blocks

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-01-27 14:19:40 +01:00
Daniel Dudzic 5fc14d42a0 Product Button and Rating: Allow margin styles in WC core (https://github.com/woocommerce/woocommerce-blocks/pull/8280)
* Product Button and Rating: Allow margin styles in WC core.

* Product Button: Fix spacing logic.
2023-01-27 12:13:42 +01:00
Thomas Roberts 282bb81046 Fix `useForcedLayout` to prevent breaking style book (https://github.com/woocommerce/woocommerce-blocks/pull/8243)
* Subscribe only to changes on core/block-editor

* Improve performance of useForcedLayou

This is because by the time we reach this line, innerBlocks will be an empty array (or we wouldn't make it this far) and if nextBlocks contains ANY items it will, by definition be unequal, so a length check is simpler and more performant. Also we can remove the dependence on yet another lodash function by doing it this way.

* Check if templates synced before doing it again in useForcedLayout

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-01-27 11:45:49 +01:00
Lucio Giannotta 11fc29a4c8 Remove feature flag from Element variations (https://github.com/woocommerce/woocommerce-blocks/pull/8297)
Removes feature flag from:

* Product Summary
* Product Template
* Product Title
2023-01-26 14:33:33 +01:00
David Arenas d2c5c4a9c3 Add the Interactivity API runtime to WooCommerce blocks (https://github.com/woocommerce/woocommerce-blocks/pull/8220)
* Add Interactivity API scripts

* Enqueue scripts if Products exists for testing

* Test client-side transitions

* Remove script enqueue

* Remove hpq dependency

* Update Interactivity scripts to latest version

* Remove interactivity scripts from core entries

* Create webpack config for interactivity api

A plugin for optional chaining is required as the repo uses Webpack 4 for now.

* Enqueue the directives runtime

* Updated wp directives code

* Use a filter to enque the directives runtime

* Remove base-interactivity alias for now

* Add path for modules inside base-interactivity

* Revert "Remove base-interactivity alias for now"

This reverts commit 7c6cbee372c65e430590d98c1819b6b4b0a97d93.

* Remove unnecessary filter and enqueue

* Update router code

* Update Interactivity location and alias

* Use hook `init` for script registering

Co-authored-by: Mario Santos <santosguillamot@gmail.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
2023-01-26 12:39:25 +01:00
Mike Jolley 06b9b29454 Refresh the cart when using the browser back button (https://github.com/woocommerce/woocommerce-blocks/pull/8236)
* Refresh on back

* Move refresh code to a hook in useStoreCart

* Load mini cart scripts when page is invalid

* Update code comments

* refreshDataIfPersisted->refreshCachedCartData

* Avoid deprecated code

* Only notify if cart resolution has finished

* Fix tests to check for cart resolution

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2023-01-25 16:28:41 +00:00
Alba Rincón f830740908 Make `Notice` component legible in dark themes (https://github.com/woocommerce/woocommerce-blocks/pull/8278)
* Make Notice component color black

The Notice component text is not legible in dark themes since the background color
is light and and the text color is too. With this change we are setting the color
always to black for our blocks, so it's always legible.

* Make the text black for notices displayed on the editor

* Import editor.scss
2023-01-25 15:29:17 +01:00
kmanijak d621f4c04c Remove duplicated key from the object containing TEMPLATES in a test file (https://github.com/woocommerce/woocommerce-blocks/pull/8260) 2023-01-24 17:16:05 +01:00
Mike Jolley 1f0253795a Checkout/Store API: Push valid changes selectively (https://github.com/woocommerce/woocommerce-blocks/pull/8030)
* support partial updates

* revised error ids to reference in validation class

* Validate before push

* Fix logic + TS

* Avoid need for PUT by delaying validation/sanitization

* $cart change was not needed

* Revert changes in schema - fix is handled at route level

* Put back wc_do_deprecated_action

* Extra validation is not needed

* No need to export isValidAddressKey - its not used anywhere

* No longer using RouteException in customer update route

* Fix setting shipping to billing with changes

* Update error ids

* Only validate posted props

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2023-01-24 14:52:59 +00:00
Albert Juhé Lluveras 4c2ac7341b Product Price: allow margin styles in WC core (https://github.com/woocommerce/woocommerce-blocks/pull/8269) 2023-01-24 12:52:49 +01:00
Alba Rincón b0f2198e35 Set inherit default to true only when is inserted in the archive product template (https://github.com/woocommerce/woocommerce-blocks/pull/8251) 2023-01-24 11:04:00 +01:00
Alba Rincón eaffd05bf4 Remove the color inherit (https://github.com/woocommerce/woocommerce-blocks/pull/8270) 2023-01-24 10:57:59 +01:00
Niels Lange 3cb443ff67 Move notices to corresponding context (https://github.com/woocommerce/woocommerce-blocks/pull/8228)
* Updated package-lock.json

* fixed method sig

* PHP versions matrix

* removed extra space

* renamed step

* Update E2E and coding standards to use PHP 8.0

* Un-linted unit-tests.yml. Github flows use 4 spaces indent, while our .editorconfig file enforces 2 spaces.

* Refactor unit-tests.yml

* Linted unit-tests.yml to proper 2 space indents

* Removed composer caching

* Test without hacky permissions step

* Concurrency disable.
Jobs renaming.

* Add step to install wp-env for PHP unit tests.

* Another try at fixing perms for wp-env

* Another try at fixing perms for wp-env

* Restore missing steps

* Move notices to corresponding context

* Change `errorMessageContext` to `context`

* Fix MD lint errors

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-01-24 11:58:30 +07:00
Thomas Roberts c5aecceb5a Allow observers to set `billingAddress` by returning `billingData` (https://github.com/woocommerce/woocommerce-blocks/pull/8163)
* Allow observers to set billingAddress by returning billingData

This is required since we didn't correctly deprecate billingData when we changed the name to billingAddress

* Add link to original PR

* Set billingAddress when observer errors

* Rename  shippingData to shippingAddress

* Add isBillingAddress and isShippingAddress type guards

* Add tests for new type guards

* Only set billing and shipping if they are valid objects

* Add tests for __internalEmitPaymentProcessingEvent thunk

* Update deprecated version

* Return promise from this function to aid with testability

* Add tests for shippingAddress and paymentMethodData

* Ensure correct value is used to set shipping address

* Move test data out of tests to aid with reusability

* Improve success callback name

* Add mocked __internalSetPaymentMethodData to correct object

It was in registry, but should be in dispatch as the action is on the same store as the thunk. Registry is used for actions on other stores.

* Add test for failed observers

* Add test for mixed observers

* Add comments explaining the destructure & deprecation
2023-01-23 08:27:59 -08:00
Tarun Vijwani 018af7c3af Change coupon component label to "Apply a coupon code" (https://github.com/woocommerce/woocommerce-blocks/pull/8254)
The "Coupon code" text was changed to "Add a coupon" and it resulted in the failing of an e2e test as it couldn't find the translated text for "Coupon code". The translation for  "Add a coupon" is not available so changing the text to "Apply a coupon code" until the next WC Core release since the translation for the text "Apply a coupon code"  is already available.
2023-01-23 16:11:44 +04:00
Daniel Dudzic 48c4c71839 Product Button: Transition from using CSS margin to Global Styles (https://github.com/woocommerce/woocommerce-blocks/pull/8239) 2023-01-20 16:23:00 +01:00
Daniel Dudzic dc38c2a4a1 Product Rating: Transition from using CSS margin to Global Styles (https://github.com/woocommerce/woocommerce-blocks/pull/8202)
* Product Rating: Transition from using CSS margin to Global Styles

* Product Rating: Re-add css margins for Product Rating inside of the All Products block.

* Product Rating: Change bottom margin to 1rem

* Product Rating: Re-add the Classic Template fix.

* Product Rating: Remove the Classic Template fix.
2023-01-20 16:04:00 +01:00
Daniel Dudzic da637b8b64 Product Price: Transition from using CSS margin to Global Styles (https://github.com/woocommerce/woocommerce-blocks/pull/8195)
* Product Price: Transition from using CSS margin to Global Styles

* Product Price: Re-add css margins for Product Price inside of the All Products block.

* Product Price: Change bottom margin to 1rem

* Product Price: Fix the margin typescript declaration.
2023-01-20 15:56:29 +01:00
Mike Jolley 246f4442a9 Update free price display (https://github.com/woocommerce/woocommerce-blocks/pull/8241) 2023-01-20 14:34:25 +00:00
Albert Juhé Lluveras eaad45eb8a Avoid changing the markup of all ratings when the Product Rating block is present in the page (https://github.com/woocommerce/woocommerce-blocks/pull/8247) 2023-01-20 14:44:01 +01:00
Mike Jolley 435e341fe6 Expose cart errors as notices (https://github.com/woocommerce/woocommerce-blocks/pull/8162)
* Scroll to errors when interacting with radio buttons

* Fix full stop wrapping in checkout

* Make type guard for api response reusable

* Merge useShippingData  and useSelectShippingRate

Overlapping functionality and responsibility easily merged into a single hook.

* ShippingDataProvider Typescript

* Create errors when receiving errors via thunk

* Update DEFAULT_ERROR_MESSAGE

* Update tests since all errors are set via new action

* Correct SET_ERROR_DATA

* Update json error text and allow it to be dismissed

* Add back missing comment in types

* Put back typedef

* Allow Store Notice Containers to display subContexts without changing original context

* receiveError handles cart

* Update assets/js/data/cart/notify-errors.ts

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update assets/js/base/context/hooks/shipping/types.ts

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Remove debug

* Revise type (remove as)

* rename to unregisteredSubContexts

* getNoticeContexts comment

* Add test for unregistered errors

* Update comment

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2023-01-19 16:40:52 +00:00
Mike Jolley 9492c6f37d Update Shipping Calculator Handling so errors are reported to the customer (https://github.com/woocommerce/woocommerce-blocks/pull/8182)
* Allow the context to be overridden when processing errors

* Export all error functions

* Allow customer data update if not editing fields

* removeNoticesWithContext Helper

* Hide rates when editing the address

* New update address logic

* Handle cancel for the form
2023-01-18 17:02:38 +00:00
Alba Rincón fbd86f8762 Add Store Notices block (https://github.com/woocommerce/woocommerce-blocks/pull/8157)
* Block scaffolding

* Rename to store notices

* Register only in the site editor

* Update description

* Add woocommerce class

* Add tests

* Delete old test file

* Update notices message in the editor

* Remove customization

* Disable the block server side

* Fix TS error

* Add custom classes

* Reprashed test description

* Escape notices

* Remove unnecessary disabled component

* Only allow to insert the block once

* Improve class name

* Merge edit and block files

* Fix copy

* Simplify test case

* Remove align support

* Remove attributes

* Change editor markup

* Use the Notice component to display the notice placeholder on the editor

* Use sprintf to improve readability

* Inline component

* Remove styles and unregister scripts

* Use ordered placeholders

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

* Use info as the notices status

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

* Fix php lint error

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2023-01-18 13:40:30 +01:00
Alba Rincón 34c7fa95e1 Add Catalog Sorting filter block (https://github.com/woocommerce/woocommerce-blocks/pull/8122)
* WIP

* Render in editor and add styles

* Simplify select

* Undo change

* Update titles and description

* Wrapped text for translation

* Remove from products inner blocks

* Allow the block in the inserter

* Rename test file and add new tests for catalog-sorting block

* Register on the site editor only

* Fix tests

* Disable block server side

* Override the `enqueue_assets`

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

* Fix TS error

* Simplify edit

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

* Disable background color

* Add custom classes

* Remove alignment

* Inherit color and font properties

* Merge edit and block files

* Use sprintf to improve code readability

* Make fontsize small by default

* Add order placeholders and woocommerce class

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

* Fix floating issue

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

* Add woocommerce class

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

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2023-01-17 16:20:10 +01:00
kmanijak d00a21fbaf [Blockifying Product Archive Templates] Add Results Count block (https://github.com/woocommerce/woocommerce-blocks/pull/8078)
* Init setup to add a new block Results Count

* Render  template part as a content of ResultsCount block

* Switch to template part rendering

* Rename the block to ProductResultsCount

* Fix typo in BlockTypesController

* Change the ProductResultsCount class name

* Remove Product Results Count block from Product Query template

* Improve the way Product Results Count is rendered in the editor

* Add  prefix to places that missed renaming from ResultsCount to ProductResultsCount

* Remove unnecessary frontend.tsx file for ProductResultsCount

* Make sure global styles are applied and respected by Product Results Count block

* Make sure the Product Results Count is available inly in Product Catalog template

* Add basic tests to Product Results Count

* Remove empty line in style file

* Fix TS issue in Product Results Count

* Fix typo

* Override the enqueue_assets method to prevent unnecessary enqueue and 404 error on the frontend

* Add necessary property to block's metadata

* Address code review feedback

* Update description

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

* Remove disabled component

* Improve test description

* Merge edit and block files

* Remove align support

* Remove background support

* Simplify edit component

* Improve readability with sprintf and add custom class

* Simplify test case

* Add styles and order placeholders

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

* Fix markup to match with the frontend

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

Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2023-01-17 16:19:42 +01:00
Seghir Nadir 3f46da0424 Account for local pickup rates before disabling shipping in editor (https://github.com/woocommerce/woocommerce-blocks/pull/8207)
* Account for local pickup rates before disabling

* check for local pickup before disabling shipping in editor
2023-01-17 10:32:32 +01:00
Tarun Vijwani 93441e2e52 Add coupon link instead of dropdown in Cart and Checkout blocks (https://github.com/woocommerce/woocommerce-blocks/pull/7993)
* Add coupon link instead of dropdown in Cart and Checkout blocks

* Fix state names used for displaying the link and coupon form

* Fix storybook for coupon block

* Fix unit test for coupon block

* Fix css and accessibility

* Fix coupon block position on Checkout

* Update e2e test cases for coupon block (https://github.com/woocommerce/woocommerce-blocks/pull/8022)

* Update e2e test cases for coupon block

* Fix perfomance test for coupon block

* Fix double await typo

* Fix perfomance test for coupon block

* Remove CSS

* Use classnames to add and remove classes

Improved the code to use classnames to add and remove classes. Also, moved the logic to handle click and submit to separate functions.
2023-01-17 13:10:50 +04:00
Saad Tarhi daf36de9a5 Correctly detect compatible express payment methods (https://github.com/woocommerce/woocommerce-blocks/pull/8201)
* Remove unused action and type action

* Derive the incompatible payment methods with selector

Instead of adding the incompatiblePaymentMethods to the payment state.
Let's simply derive it using a selector to keep a minimal state.

* Check compatibility with express payments
2023-01-16 23:06:48 +01:00
Albert Juhé Lluveras 8b27294167 Remove purple color from WC Blocks icons (https://github.com/woocommerce/woocommerce-blocks/pull/8200) 2023-01-16 13:55:40 +01:00
Mike Jolley db96991492 Custom validation messages using the field name/label (https://github.com/woocommerce/woocommerce-blocks/pull/8143)
* Custom validation strings using a new function named getValidityMessageForInput

* getValidityMessageForInput tests

* Added integration test for error message

* Clear value

* update test strings
2023-01-13 15:54:35 +00:00
Nadir Seghir 380ef202e4 Local Pickup: fix checkout shipping summary test 2023-01-13 11:50:57 +01:00
Mike Jolley 7196a76577 Correctly detect selected location on first mount 2023-01-12 15:42:43 +01:00
Mike Jolley 5076541597 Local Pickup: hide regular shipping rates when Local pickup is selected. 2023-01-12 15:42:43 +01:00
Nadir Seghir 7bfda113b0 Local Pickup: Fix render logic for regular shipping rates 2023-01-12 15:42:43 +01:00
Nadir Seghir 612ddb34d2 Add default title to pickup method field 2023-01-12 15:42:43 +01:00
Nadir Seghir 3cbf0d7404 Local Pickup: don't allow negative values 2023-01-12 15:42:43 +01:00
Nadir Seghir 4cb19a2c76 Local Pickup: refactor useBillingAsShipping 2023-01-12 15:42:43 +01:00
Nadir Seghir fb18a7a76d Use custom error messages for Local Pickup admin screen 2023-01-12 15:42:43 +01:00
Nadir Seghir 737972d8a8 Local Pickup: change pickup locations block icon to Store instead of truck 2023-01-12 15:42:43 +01:00
Nadir Seghir 549358c65c Local Pickup: Change location modal to have store country as default country 2023-01-12 15:42:43 +01:00
Nadir Seghir 994491c2b8 Local Pickup: rename pickup options block 2023-01-12 15:42:43 +01:00
Nadir Seghir 86a3b2a0ef Local Pickup: Fix default status for local pickup enabling setting 2023-01-12 15:42:43 +01:00
Nadir Seghir 7f84e9348a Local Pickup: only allow digits in cost 2023-01-12 15:42:43 +01:00
Nadir Seghir fc720defb1 Parse shipping prices before getting lowest and highest 2023-01-12 15:42:43 +01:00
Seghir Nadir 3eb51342a9 Add validation to local pickup fields (https://github.com/woocommerce/woocommerce-blocks/pull/8007)
* add form validation for admin screen

* add types

* add validation to fields

* restore form ref
2023-01-12 15:42:43 +01:00
Nadir Seghir 8c64915197 Local Pickup: add testing steps 2023-01-12 15:42:43 +01:00
Mike Jolley c611635179 Handle Local Pickup Selection in the Cart (https://github.com/woocommerce/woocommerce-blocks/pull/7958)
* Shipping and collection method block package support (https://github.com/woocommerce/woocommerce-blocks/pull/7383)

* Shipment wordage

* Hide panel if collection is not available for an item

* Update selection when displayed

* Register a global local pickup method for the block based checkout (https://github.com/woocommerce/woocommerce-blocks/pull/7414)

* Register a blocks local pickup method globally

* Remove local pickup plucking from store api

* Multiple pickup locations

* Unused code

* Translate meta data

* Update UI to match zones table

* Description

* Handle new shipping method in client

* Improve location rendering

* Only split out pickup location methods

* Fix enabled toggle

* Show and hide shipping text in sidebar based on pickup

* No need for "from" when min and max are the same price

* Update sample data for the editor

* fix errors

* Force method/pickup in the checkout layout (https://github.com/woocommerce/woocommerce-blocks/pull/7910)

* Split up ShippingRatesControl for readability

* Alignment styling

* Split tidy packages for readability

* Combine hooks to prevent circular dependency

* Notice styling

* Conflict

* Hide notice with 1 package

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2023-01-12 15:42:43 +01:00
Mike Jolley 81f248b294 Local Pickup: filter out local pickup rates from regular shipping. 2023-01-12 15:42:43 +01:00
Mike Jolley 020d9f3919 Remove regressed useForcedLayout logic 2023-01-12 15:42:43 +01:00
Mike Jolley 963c8dcebe Local Pickup: set prefersCollection to false if we don't have shipping. 2023-01-12 15:42:43 +01:00
Mike Jolley d9fbaa5ec3 Force method/pickup in the checkout layout (https://github.com/woocommerce/woocommerce-blocks/pull/7910) 2023-01-12 15:42:43 +01:00
Mike Jolley cb830f5ec8 Maintain Local Pickup Selection (https://github.com/woocommerce/woocommerce-blocks/pull/7894)
* prefersCollection starts undefined

* When undefined, look at shipping rate data
2023-01-12 15:42:43 +01:00
Seghir Nadir 7d9602253c Restrict Local Pickup Checkout block users only (https://github.com/woocommerce/woocommerce-blocks/pull/7893)
* limit page visiblity to Checkout block

* only enable pickup_locations if checkout block

* always register local pickup
2023-01-12 15:42:43 +01:00
Mike Jolley abaea4fff8 Fix up the missing details section for local pickup
Fixes woocommerce/woocommerce-blocks#7898
2023-01-12 15:42:04 +01:00
Mike Jolley 1f69e4b5e6 Local Pickup: add empty state UI for location table (https://github.com/woocommerce/woocommerce-blocks/pull/7871) 2023-01-12 15:42:04 +01:00
Seghir Nadir 3c824053d7 Show notice if merchant has legacy local pickup enabled alongside the new pickup (https://github.com/woocommerce/woocommerce-blocks/pull/7842)
* add notice when there are existing enabled legacy local pickups

* Fix PHP warning

* Link though to the settings page

* Fix setting save

* Enabling this will produce duplicate options at checkout.

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-01-12 15:42:04 +01:00
Mike Jolley f2318060e1 Local Pickup: handle some UI issues
Duplicate selector

Convert to sentence case

Swap location and name in rate
2023-01-12 15:42:04 +01:00
Mike Jolley 65bc740518 Block Checkout: Apply selected Local Pickup rate to entire order (all packages) (https://github.com/woocommerce/woocommerce-blocks/pull/7484)
* Avoid duplicates in selected shipping method display

* Correct types

* Render pickup locations - not rates

* Always show "from" when there are multiple packages

* Pickup must be available for all packages

* Derive locations from rates

* Improve code style/docs

* Packagecount

* Introduce woocommerce_store_api_cart_select_shipping_rate

* Update docblock
2023-01-12 15:40:15 +01:00
Mike Jolley c49426570d React Based Local Pickup Settings Screen (https://github.com/woocommerce/woocommerce-blocks/pull/7581)
* Move payment methods

* Setup entrypoints

* Sortable implementation

* Sortable

* Basic UI in place for settings

* Hydrate real settings

* Form updates values

* Styling and save button placement

* useSettings hook

* Prepare for save

* delete

* Add location button

* Remove className

* Conditional display of taxes

* Save via API

* Update general settings to designs

* Modal styles

* Style table

* Border colors and radius

* Added e2e tests

* use node 16

* Enqueue states in admin

* Use render from wordpress/element

* Missing handle style

* Enable translations

* Remove curried function

* Todo for inline settings

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2023-01-12 15:40:15 +01:00
Mike Jolley 3d0109f1dc Enhancement/pickup location editor improvements (https://github.com/woocommerce/woocommerce-blocks/pull/7446)
* Hide form step descriptions when empty unless block has focus

* Make editor style match frontend

* Add links to settings in sidebar

* update sample costs

* phpcs
2023-01-12 15:40:15 +01:00
Mike Jolley 82e9155167 Rename collection to shipping to reflect the block purpose 2023-01-12 15:38:06 +01:00
Mike Jolley 586bc90f1b Shipping and collection method block package support (https://github.com/woocommerce/woocommerce-blocks/pull/7383)
* Shipment wordage

* Hide panel if collection is not available for an item

* Update selection when displayed

* Register a global local pickup method for the block based checkout (https://github.com/woocommerce/woocommerce-blocks/pull/7414)

* Register a blocks local pickup method globally

* Remove local pickup plucking from store api

* Multiple pickup locations

* Unused code

* Translate meta data

* Update UI to match zones table

* Description

* Handle new shipping method in client

* Improve location rendering

* Only split out pickup location methods

* Fix enabled toggle

* Show and hide shipping text in sidebar based on pickup

* No need for "from" when min and max are the same price

* Update sample data for the editor
2023-01-12 15:35:57 +01:00
Mike Jolley 23b175d246 Create Pickup Locations Block (https://github.com/woocommerce/woocommerce-blocks/pull/7316)
* prefersCollection controls shipping visibility

* Remove log

* Create skeleton pickup options block based on shipping methods

* Filter locations to local pickup methods

* Correct case of block name

* Location styling

* Pull pickup details from new core fields

* Fix linting warnings on new types

* Remove blocks_local_pickup check (this does not exist yet)

* Move enable_local_pickup_without_address so it works under all contexts

* Fix display of FREE when there are a mix of prices

* Remove undefined return value

* Update block descriptions

* fix message

* Correct case

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2023-01-12 15:35:57 +01:00
Mike Jolley b74a9f92f2 Introduce Toggle between Shipping Options and Pickup Locations (https://github.com/woocommerce/woocommerce-blocks/pull/7308)
* prefersCollection controls shipping visibility

* Toggle shipping visibility based on prefersCollection

* Remove log

* Toggle in admin
2023-01-12 15:35:57 +01:00
Mike Jolley 4263b57d2c Rename Shipping options to "method" to avoid duplicate heading 2023-01-12 15:35:57 +01:00
Seghir Nadir 1c8d2e6074 Support editing collection method titles in editor. (https://github.com/woocommerce/woocommerce-blocks/pull/7293)
* support editing blocks title in editor

* disable formats
2023-01-12 15:34:44 +01:00