Commit Graph

4488 Commits

Author SHA1 Message Date
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
Tung Du 2eafec1044 Add a compatibility layer to keep extensions continue working with Blockified Archive Templates (https://github.com/woocommerce/woocommerce-blocks/pull/8172)
* wip: initial BlockTemplatesCompatibility class

* full support for archive template

* early return

* fix early return using wc conditional functions

* address code review

* remove_default_hooks is only called with inherited block

* refactor the data structure

* shorter hook name

* Move additional hooks to remove_default_hooks

* Update src/Templates/BlockTemplatesCompatibility.php

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>

* Add check that  is an array

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2023-01-20 12:44:02 +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
Daniel W. Robert c86ea1aa66 Updates version for @woocommerce/block-library (https://github.com/woocommerce/woocommerce-blocks/pull/8223)
Lockfile is using v9.4.0 for the @woocommerce/block-library dependency.
This update bumps that dep version to v9.5.0.
2023-01-18 17:23:53 -05:00
Tarun Vijwani ca8f7aa4ea Fix "Writing Your First Block Type" tutorial link in docs (https://github.com/woocommerce/woocommerce-blocks/pull/8231)
Changed the URL of  "Writing Your First Block Type" in doc from Gutenberg project to block development guide.
2023-01-18 21:04:20 +04: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
Luigi f1e79d6ca8 bump version to 9.5.0-dev 2023-01-17 15:10:39 +01:00
github-actions[bot] 67c4a4741f Release: 9.4.0 (https://github.com/woocommerce/woocommerce-blocks/pull/8198)
* Empty commit for release pull request

* update WooCommerce compatibility

* adding testing instructions

* add zip file testing for the release 9.4.0

* add gif to testing instructions

* remove add to cart testing instructions

* 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

* update testing instructions

* add new zip file for testing

* Refresh shipping cache when saving Local Pickup (https://github.com/woocommerce/woocommerce-blocks/pull/8203)

* invalidate cache on page load

* always flesh settings after save

* use correct prefix

* 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

* Bumping version strings to new version.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2023-01-17 15:09:02 +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
Lucio Giannotta 26ae17ffa0 Products: Fix variable products add to cart (https://github.com/woocommerce/woocommerce-blocks/pull/8173)
Variable products would get added to cart via the button, even
when the button said “Select options” and contained a link.

This was because the button was automatically hydrated
through a CSS class.
2023-01-16 18:54:25 +01:00
Seghir Nadir f438ea8ba2 Refresh shipping cache when saving Local Pickup (https://github.com/woocommerce/woocommerce-blocks/pull/8203)
* invalidate cache on page load

* always flesh settings after save

* use correct prefix
2023-01-16 17:56:56 +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 fcc9bacdc9 Prevent undefined variable notice on checkout (https://github.com/woocommerce/woocommerce-blocks/pull/8197) 2023-01-16 11:53:12 +01:00
Tarun Vijwani e9b07c9ebf Update package-lock.json file (https://github.com/woocommerce/woocommerce-blocks/pull/8194)
Updating the package-lock.json file to fix the nightly build release failed error: npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
2023-01-16 11:48:18 +01:00
Albert Juhé Lluveras a588d4075a Update release checklist adding a step to add highlights to WC core release post (https://github.com/woocommerce/woocommerce-blocks/pull/8183) 2023-01-16 08:21:11 +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 7d874e736a Local Pickup: Refactor E2E tests for locations 2023-01-13 13:03:48 +01:00
Nadir Seghir 380ef202e4 Local Pickup: fix checkout shipping summary test 2023-01-13 11:50:57 +01:00
Nadir Seghir 34dc0b9ac0 Local Pickup: remove zip from testing guide 2023-01-12 15:56:19 +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 2396736041 Update testing file for Local Pickup 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
Nadir Seghir 4338944681 ungate the ShippingController class 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