Commit Graph

3975 Commits

Author SHA1 Message Date
Tarun Vijwani 4de3bdb0f1 Convert validation context to data store (https://github.com/woocommerce/woocommerce-blocks/pull/6402)
* Add validation reducers, actions, and action types

* Add selector for getValidationErrors

* Export store key and register store

* Export validation store key

* Move TextInput files to checkout package

* Export ValidatedTextInput from blocks-checkout package

* Update imports of ValidatedTextInput to reflect new location

* Use the validation wp-data store for showing error messages

* Export getValidationError in checkout package

* Move validation store to checkout package

* Move ValidationInputError to blocks-checkout package

* Only export "exposedSelectors" from validation

* Convert validation context to data store

* Fixed linting error

* Fixed linting error

* Change the validation selectors to return a function

* Convert reducer and selectors to TS

* Remove superfluous comments and improve test titles

* Test to ensure visible errors remain visible

* Make test for hasValidationErrors more robust

* Augment the wp-data module to include our selectors and actions

* Removed unused `exposedSelectors` variable

* Remove TS error because of `instanceId` on props

* Remove unnecessary as const

* Use function returned by getValidationError

* Use correct selector/action names now context has been decoupled

* hide validation error when input value changes

* Add correct aria-describedBy now we can get error id from store

* Clear validation error from store when component unmounts

* Clear validation error if input is valid

* convert ValidationInputError to TS and get correct id/error from store

* Ensure checkout block doesn't break when there are no errors

* Get validation data from the store instead of context

* Update country input to remove validation context

* Move validation store out of checkout package

* Move TextInput and ValidationInputError back out of the checkout package

* Remove duplicate internal styles comment

* Remove exports that no longer exist

* Get validation store key from block-data

* Make attribute-select-control use validation data store

* Export FieldValidationStatus type

* Make combobox use validation store not context

* Make Address use validation store not context

* Make Address use validation store not context

* Use hasValidationErrors selector as a function in shipping calculator

* Remove validation context from coupon story

* Import VALIDATION_STORE_KEY from correct location

* Stop coupon story from erroring

* Update useStoreCartCoupons to use validation store not context

* Make TotalsCoupon use validation store instead of context

* Make AddToCartFormContext use validation store not context

* Remove ValidationContext

* Import FieldValidationStatus from correct location

* Import ValidatedTextInput and ValidatedTextInput from correct location

* Remove ValidationContextProvider

* Update components to use validation store not context

* Update useValidation to use the data store

* Replace the validation context in checkout-events file

* Use the re-mapped path for the store key import

* Use "register" instead of the deprecated "registerStore"

* Fix import error of the "FieldValidationStatus" type

* Use TS instead of React's "PropTypes"

* Fix the type of "ValidationInputError" in the "payment-method-interface"

* Fix error not showing on the first place order click bug

We were mutating the state in the reducer, which prevented re-rendering
on state change

* Fix state mutation issue in the Validation reducer

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-09-28 13:45:42 +01:00
Alex Florisca 22f61cf4d9 Fixed missing lint error 2022-09-28 13:45:42 +01:00
Alex Florisca e2c495d7ac Fix lint issues 2022-09-28 13:45:42 +01:00
Alex Florisca 015291ccf3 Move checkout state code into thunks and rename `CheckoutState` context to `CheckoutEvents` (https://github.com/woocommerce/woocommerce-blocks/pull/6455)
* Add checkout data store

* wip on checkout data store

* CheckoutContext now uses the checkout store

* Investigated and removed setting the redirectUrl on the default state

* update extension and address hooks to use checkout data store

* use checkout data store in checkout-processor and use-checkout-button

* trim useCheckoutContext from use-payment-method-interface && use-store-cart-item-quantity

* Remove useCheckoutContext from shipping provider

* Remove isCalculating from state

* Removed useCheckoutContext from lots of places

* Remove useCheckoutContext from checkout-payment-block

* Remove useCheckoutContext in checkout-shipping-methods-block and checkout-shipping-address-block

* add isCart selector and action and update the checkoutstate context

* Fixed redirectUrl bug by using thunks

* Remove dispatchActions from checkout-state

* Change SET_HAS_ERROR action to be neater

* Thomas' feedback

* Tidy up

* Oops, deleted things I shouldn't have

* Typescript

* Fix types

* Fix tests

* Remove isCart

* Update docs and remove unecessary getRedirectUrl() selector

* validate event emitter button

* Added thunks in a separate file

* Call thunks from checkout-state

* Checkout logic tested and working

* Remove dependency injection as much as poss, tidy up and fix some TS errors

* Fix types in thunks.ts

* Fixed some ts errors

* WIP

* Fixed bug

* Shift side effects from checkout-state to checkout-processor

* Revert "Shift side effects from checkout-state to checkout-processor"

This reverts commit 059533da4eb34f9982f66cd4adacc7b2c24f939f.

* Rename CheckoutState to CheckoutEvents

* Move status check outside the thunk

* remove duplicate EVENTS constant

* remove temp buttons

* Remove console logs

* Augment @wordpress/data package with our new store types

* Add correct type for CheckoutAction

* Remove createErrorNotice arg from runCheckoutAfterProcessingWithErrorObservers

* Remove createErrorNotice from emit event types

* Use type keyword when importing types

* Add correct types for dispatch and select in thunks

* Update wordpress/data types

* Replace store creation with new preferred method

* Set correct action type on reducer

* Remove unnecessary async from thunk

* add CHECKOUT_ prefix to checkout events again

* export EVENTS with eveything else in checkout0-events/event-emit

* Remove duplicate SelectFromMap and TailParameters

* Updated type for paymentStatus

* TODO remove wp/data experimental thunks

* Remove `setCustomerId` from events and `processCheckoutResponseHeaders` (https://github.com/woocommerce/woocommerce-blocks/pull/6586)

* Prevent passing dispatch, instead get actions direct from store

* Get setCustomerId from the store instead of passing it to processCheckoutResponseHeaders

* Revert "Prevent passing dispatch, instead get actions direct from store"

This reverts commit 4479a2ef5599d9c8d99c3629616b3d662210fc08.

* Auto stash before revert of "Prevent passing dispatch, instead get actions direct from store"

* Remove duplicate dispatch

* Fix unit tests

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-09-28 13:45:42 +01:00
Alex Florisca 3630b7b03e Convert checkout context to data store - part 1 (https://github.com/woocommerce/woocommerce-blocks/pull/6232)
* Add checkout data store

* wip on checkout data store

* CheckoutContext now uses the checkout store

* Investigated and removed setting the redirectUrl on the default state

* update extension and address hooks to use checkout data store

* use checkout data store in checkout-processor and use-checkout-button

* trim useCheckoutContext from use-payment-method-interface && use-store-cart-item-quantity

* Remove useCheckoutContext from shipping provider

* Remove isCalculating from state

* Removed useCheckoutContext from lots of places

* Remove useCheckoutContext from checkout-payment-block

* Remove useCheckoutContext in checkout-shipping-methods-block and checkout-shipping-address-block

* add isCart selector and action and update the checkoutstate context

* Fixed redirectUrl bug by using thunks

* Remove dispatchActions from checkout-state

* Change SET_HAS_ERROR action to be neater

* Thomas' feedback

* Tidy up

* Oops, deleted things I shouldn't have

* Typescript

* Fix types

* Fix tests

* Remove isCart

* Update docs and remove unecessary getRedirectUrl() selector

* set correct type for preloadedCheckoutData

* Remove duplicate Address type

* Fix missing addresses from type-defs index

* Update docs/block-client-apis/checkout/checkout-api.md

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

* Update docs/block-client-apis/checkout/checkout-api.md

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

* Update docs

* Update docs/block-client-apis/checkout/checkout-api.md

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

* Update docs/block-client-apis/checkout/checkout-api.md

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

* Revert feedback changes

* REvert feedback formatting

* Update docs formatting

* Delete empty types.ts file

* remove merge conflict from docs

* Correct linting in docs

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-09-28 13:45:42 +01:00
Luigi Teschio 3732363ba6 Add to the Product Button block the support for the Product Query block (https://github.com/woocommerce/woocommerce-blocks/pull/6948)
* Adds to the Product Image Block the support for the Product Query Block

Adds to the Product Image Block the support for the Product Query Block woocommerce/woocommerce-blocks#6911

* use shared config

* use shared config

* use shared config

* Add to the Product Button Block the support for the Product Query Block

* Add to the Product Image Block the support for the Product Query Block

* fix lint errors

* address feedback

* set grid view and font-size L as default
2022-09-28 10:54:38 +02:00
Lucio Giannotta 7125b08655 Bump version strings 2022-09-27 18:04:07 +02:00
github-actions[bot] 78b02ce741 Release: 8.6.0 (https://github.com/woocommerce/woocommerce-blocks/pull/7228)
Co-authored-by: Daniel W. Robert <danielwrobert@gmail.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
Co-authored-by: Niels Lange <info@nielslange.de>
2022-09-27 17:56:29 +02:00
Manish Menaria ac064775f4 Fix not enough margin for Filter blocks woocommerce/woocommerce-blocks#7018 (https://github.com/woocommerce/woocommerce-blocks/pull/7226) 2022-09-27 12:48:06 +05:30
Niels Lange 9678673497 Allow rendering HTML in shipping package names (https://github.com/woocommerce/woocommerce-blocks/pull/7147)
* Allow renderiung HTML in shipping package names

* Sanitize HTML to render

* Create reusable util sanitizeHTML

* Solve TS error

* Remove __experimentalApplyCheckoutFilter
2022-09-26 23:16:44 +07:00
Seghir Nadir 0f57123095 Local pickup rates are always returned regardless of the shipping zone. (https://github.com/woocommerce/woocommerce-blocks/pull/7177)
* local pickup is always returned no matter the zone

* wrap filters in feature flags

* switch to experimental
2022-09-26 15:51:32 +01:00
Saad Tarhi 085242bbe9 Clean the top-level of the /build folder (https://github.com/woocommerce/woocommerce-blocks/pull/7047)
* Generate Inner Blocks' JSON files in a common folder

* Get the correct metadata path for the Inner Blocks

The Inner Blocks' metadata lives now in the `/build/inner-blocks`. But,
the function `get_block_metadata_path` was only looking for metadata
inside the top-level of the `build/` folder
2022-09-26 15:02:36 +01:00
Daniel W. Robert 1feb2202bb Update lockfile changes since DOMPurify addition. (https://github.com/woocommerce/woocommerce-blocks/pull/7225)
Fixes woocommerce/woocommerce-blocks#7224.
2022-09-26 15:13:22 +02:00
Hsing-yu Flowers 04743add72 Check tax display type before returning the tax lines (https://github.com/woocommerce/woocommerce-blocks/pull/7084)
* Check tax display type before returning the tax lines

* Return early if not itemized
2022-09-23 16:33:12 -04:00
Hsing-yu Flowers c2c639dee1 Sanitize store notices html (https://github.com/woocommerce/woocommerce-blocks/pull/7145)
Sanitizing the merchant store link in the error message added in WooPay when in some
cases the customer could run into an issue where we need to tell them an error occurred
and they have to go back to the merchant store and re-initialize WooPay to fix it.

Because previously we were only expecting strings, the text was not sanitized.
2022-09-23 20:48:28 +02:00
Lucio Giannotta d174051787 Refactor Product Query to use the latest Gutenberg APIs (https://github.com/woocommerce/woocommerce-blocks/pull/7169)
* Refactor Product Query to use the latest Gutenberg APIs

As we worked with Gutenberg folks in WordPress/gutenbergwoocommerce/woocommerce-blocks#43590,
WordPress/gutenbergwoocommerce/woocommerce-blocks#43632 and WordPress/gutenbergwoocommerce/woocommerce-blocks#44093 we have
created a standard API that could be used for our use-case. This
PR refactors our WIP experimental work to use that standardized API.
2022-09-23 15:07:44 +02:00
Beau Lebens 6b0407d200 Make sure people understand this it WP version (https://github.com/woocommerce/woocommerce-blocks/pull/7209)
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2022-09-23 13:48:15 +01:00
Luigi c3e3b29c6b Merge branch 'release/8.5.0' of https://github.com/woocommerce/woocommerce-blocks into trunk 2022-09-23 14:33:05 +02:00
github-actions[bot] 0ea0985a22 Release: 8.5.1 (https://github.com/woocommerce/woocommerce-blocks/pull/7212)
* use full link for WordPress resources (https://github.com/woocommerce/woocommerce-blocks/pull/7211)

Co-authored-by: Niels Lange <info@nielslange.de>

* Empty commit for release pull request

* update readme

* add testing instructions

* add zip file link

* update testing instructions and changelog entry

* Bumping version strings to new version.

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luigi <gigitux@gmail.com>
2022-09-23 14:29:20 +02:00
Seghir Nadir e0d968b310 use full link for WordPress resources (https://github.com/woocommerce/woocommerce-blocks/pull/7211)
Co-authored-by: Niels Lange <info@nielslange.de>
2022-09-23 18:02:05 +07:00
Seghir Nadir c52825ca7b switch to a permament link in errors (https://github.com/woocommerce/woocommerce-blocks/pull/7205) 2022-09-22 13:17:26 +01:00
Niels Lange 690ccb5191 Remove experimental flag from Cross-Sells block (https://github.com/woocommerce/woocommerce-blocks/pull/7188)
* Remove experimental flag from Cross-Sells block

* Remove experimental flag from Cross-Sells block

* Remove experimental flag from woocommerce/cart-cross-sells-products-block
2022-09-22 12:28:55 +07:00
Alex Florisca 79b1d4a38a Revert "Add static class name for product-details (https://github.com/woocommerce/woocommerce-blocks/pull/6914)" (https://github.com/woocommerce/woocommerce-blocks/pull/7191)
This reverts commit d6d94ae622.
2022-09-21 15:20:00 +01:00
Niels Lange 77a2255978 Create 2e2 tests for Cross-Sells block (https://github.com/woocommerce/woocommerce-blocks/pull/6983)
* Create Cross-Sells product list

* Show “Read more” button for out-of-stock cross-sells products

* Update assets/js/blocks/cart/inner-blocks/cart-cross-sells-products/block.tsx

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

* Update assets/js/blocks/cart/cart-cross-sells-product-list/index.tsx

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

* Remove obsolete isLoading and placeholderRows

* Fix TS errors

* Rename crossSellsProduct to product

* Fix critical error

* Create 2e2 tests for Cross-Sells block

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-09-21 13:29:16 +07:00
Niels Lange 3d55668983 Create Cross-Sells product list (https://github.com/woocommerce/woocommerce-blocks/pull/6645)
* Create Cross-Sells product list

* Show “Read more” button for out-of-stock cross-sells products

* Update assets/js/blocks/cart/inner-blocks/cart-cross-sells-products/block.tsx

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

* Update assets/js/blocks/cart/cart-cross-sells-product-list/index.tsx

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

* Remove obsolete isLoading and placeholderRows

* Fix TS errors

* Rename crossSellsProduct to product

* Fix critical error

* Lock “Cart Cross-Sells products” inner block

* Update assets/js/blocks/cart/inner-blocks/cart-cross-sells-products/block.json

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>

* Prevent moving of the Cross-Sells block

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-09-21 13:04:15 +07:00
Paulo Arromba 8a5dd65bc1 fix: Markup is visible in checkout error notices (https://github.com/woocommerce/woocommerce-blocks/pull/6800)
* Enabled __unstableHTML hidden option for HTML rendering within notices.

* Fixed margin-bottom for HTML notice content

* Fixed margin-top for HTML notice content

* Attempt to fix a broken e2e test
2022-09-20 16:54:25 +01:00
Albert Juhé Lluveras def2e0c450 Add step to release checklist to review and merge the WC core PR (https://github.com/woocommerce/woocommerce-blocks/pull/7100) 2022-09-20 07:55:03 -05:00
Niels Lange 7bd48074fb Prevent Express Checkout block from being cut off (https://github.com/woocommerce/woocommerce-blocks/pull/7152)
* Prevent Express Checkout block from being cut off

* Prevent step numbers from being cut off in editor
2022-09-20 17:45:20 +07:00
Raluca Stan 713fcd0b4d Update checkout-flow-and-events.md (https://github.com/woocommerce/woocommerce-blocks/pull/7071) 2022-09-20 11:16:53 +02:00
dependabot[bot] 2f0d6e04ef Bump @storybook/client-api from 6.5.9 to 6.5.12 (https://github.com/woocommerce/woocommerce-blocks/pull/7182)
Bumps [@storybook/client-api](https://github.com/storybookjs/storybook/tree/HEAD/lib/client-api) from 6.5.9 to 6.5.12.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/v6.5.12/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.5.12/lib/client-api)

---
updated-dependencies:
- dependency-name: "@storybook/client-api"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-19 14:12:24 -04:00
dependabot[bot] 12c668d51c Bump mockery/mockery from 1.5.0 to 1.5.1 (https://github.com/woocommerce/woocommerce-blocks/pull/7124)
Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/mockery/mockery/releases)
- [Changelog](https://github.com/mockery/mockery/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mockery/mockery/compare/1.5.0...1.5.1)

---
updated-dependencies:
- dependency-name: mockery/mockery
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-19 13:26:47 -04:00
Thomas Roberts 2e245fdf10 Fix indentation on payment method integration documentation (https://github.com/woocommerce/woocommerce-blocks/pull/7156) 2022-09-16 08:10:24 -07:00
Tarun Vijwani 4d8cc8d751 Fix: Inner blocks control position for Cart Block (https://github.com/woocommerce/woocommerce-blocks/pull/6973) 2022-09-16 11:32:46 +05:30
Luigi Teschio d1e19fc61b Add Dependabot documentation (https://github.com/woocommerce/woocommerce-blocks/pull/7141)
* Add Dependabot documentation

* fix typos

* Update docs/internal-developers/automations/dependabot.md

Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>

Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
2022-09-15 15:54:47 +02:00
Luigi Teschio 84432552a8 Product Query: Fix pagination issue (https://github.com/woocommerce/woocommerce-blocks/pull/7109) 2022-09-15 13:53:56 +02:00
Albert Juhé Lluveras 87e1748811 Make chevron clickable in Filter by Product block input (https://github.com/woocommerce/woocommerce-blocks/pull/7139)
* Make chevron clickable in Filter by Product block

* Make sure the chevron is vertically centered
2022-09-15 12:39:34 +02:00
Hsing-yu Flowers fb213b3b1b Use the eslint config at the root of the repo (https://github.com/woocommerce/woocommerce-blocks/pull/7149) 2022-09-14 15:00:20 -07:00
Albert Juhé Lluveras ca1eac7f7e Update automatic reviewer assignment to Woo FSE team name (https://github.com/woocommerce/woocommerce-blocks/pull/7143) 2022-09-14 15:04:46 +02:00
Albert Juhé Lluveras 8d03ad4f4f Remove unused CSS selectors from Filter blocks (https://github.com/woocommerce/woocommerce-blocks/pull/7150) 2022-09-14 09:47:50 +02:00
Niels Lange eee72c822d Fix broken tables in available-filters.md 2022-09-14 14:47:08 +07:00
Luigi Teschio e4cd50a4ef Run test that does snapshot only when Gutenberg is disabled (https://github.com/woocommerce/woocommerce-blocks/pull/7142) 2022-09-14 09:04:15 +02:00
Thomas Roberts 8715fe1ce9 Add stale labels to PRs, exclude additional labels, prevent closing (https://github.com/woocommerce/woocommerce-blocks/pull/7058) 2022-09-13 11:18:31 -07:00
Luigi Teschio de433503c8 Fix e2e test - Filter products by stock block (https://github.com/woocommerce/woocommerce-blocks/pull/7137) 2022-09-13 17:16:59 +02:00
Luigi 1f71891e2d Update version to 8.6.0-dev 2022-09-13 14:32:33 +02:00
github-actions[bot] 4ab8f9c768 Release: 8.5.0 (https://github.com/woocommerce/woocommerce-blocks/pull/7110)
* Empty commit for release pull request

* add changelog - 8.5.0 version

* Add testing instructions

* add missing screenshot

* Fix pills in the Filter by Attribute block dropdown overlapping with the chevron (second attempt) (https://github.com/woocommerce/woocommerce-blocks/pull/7112)

* Fix invisible Reset filter button in some themes (https://github.com/woocommerce/woocommerce-blocks/pull/7111)

* update link zip file

* 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: Albert Juhé Lluveras <contact@albertjuhe.com>
2022-09-13 14:29:51 +02:00
Luigi 56adbe912a Bumping version strings to new version. 2022-09-13 14:22:22 +02:00
Luigi be9ab04e2f update link zip file 2022-09-13 10:29:25 +02:00
Albert Juhé Lluveras aaa480f0bb Fix invisible Reset filter button in some themes (https://github.com/woocommerce/woocommerce-blocks/pull/7111) 2022-09-13 09:33:08 +02:00
Albert Juhé Lluveras 27e8dcbebb Fix pills in the Filter by Attribute block dropdown overlapping with the chevron (second attempt) (https://github.com/woocommerce/woocommerce-blocks/pull/7112) 2022-09-13 09:32:58 +02:00
Albert Juhé Lluveras 16feccdd74 Fix invisible Reset filter button in some themes (https://github.com/woocommerce/woocommerce-blocks/pull/7111) 2022-09-13 09:32:11 +02:00