Commit Graph

1988 Commits

Author SHA1 Message Date
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