Commit Graph

4335 Commits

Author SHA1 Message Date
Thomas Roberts 65c0bfc0df Refactor `getValidationError` and `getValidationErrorId` selectors in `wc/store/validation` data store (https://github.com/woocommerce/woocommerce-blocks/pull/7146)
* 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>

* 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>

* Refactor selectors to not return functions anymore

This is a poor DevEx and naming did not reflect what the selector was returning.

* Update combobox to be more explicit when selecting validation error

* Update useValidation to use the new getValidationError selector

* Include @woocommerce/base-hooks in tsconfig

* Update ValidationInputError to use new selector

* Update ValidatedTextInput to use new selectors

* Prevent reference errors when getting validation errors in ComboBox

* Defend against case where message prop of error object is undefined

* Fix totals/coupon to use new validation selector

* Use validation data store in CheckoutTerms block

* Update AddressForm to use new validation selector

* Update AttributeSelectControl to use new validation selector

* Fix syntax error in ValidatedTextInput

* Fix multiple import error from rebase

* Fix lint issue in useStoreCartItemQantity

* Fix tests to reflect new selector API

* Remove unused validation prop from CheckoutTermsBlock

* Change CheckoutTermsBlock unit tests to use validation data store

* Fix JSDOC syntax

* fix merge conflict in checkout-api.md

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Niels Lange <info@nielslange.de>
2022-09-28 13:45:42 +01:00
Thomas Roberts 512aa911f3 Fix failing express payment method unit test (https://github.com/woocommerce/woocommerce-blocks/pull/7165) 2022-09-28 13:45:42 +01:00
Alex Florisca 37d6802252 Remove unused properties from store select 2022-09-28 13:45:42 +01:00
Alex Florisca 080cdbeac2 Fix bug where active payment methods were checked too early 2022-09-28 13:45:42 +01:00
Alex Florisca dfe5151f7f Fix payment status being set to pristine not working correctly 2022-09-28 13:45:42 +01:00
Thomas Roberts dcffe242dd Fix docs linting errors 2022-09-28 13:45:42 +01:00
Alex Florisca 4ac0806990 Update assets/js/blocks/cart-checkout-shared/payment-methods/payment-method-card.js
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-09-28 13:45:42 +01:00
Thomas Roberts 53650ff6ba Only allow payment methods to show that are in availablePaymentMethods 2022-09-28 13:45:42 +01:00
Thomas Roberts 3a49e0bd57 Revert "Include @wordpress/redux-routine in transformIgnorePatterns jest config"
This reverts commit 6b132358327ce9a36289e9f27defe7e28caee94a.
2022-09-28 13:45:42 +01:00
Alex Florisca ef1dc66068 Remove all traces of Notification Context 2022-09-28 13:45:42 +01:00
Thomas Roberts 1d78f097cb Remove missing import 2022-09-28 13:45:42 +01:00
Alex Florisca b927fcfe80 Remove Notices context 2022-09-28 13:45:42 +01:00
Thomas Roberts 28659ee653 Refactor registration of payment methods and update unit tests for payment data store (https://github.com/woocommerce/woocommerce-blocks/pull/6669)
* Mock getCartTotals

* Change test to use data store instead of context

* Move payment method context test to data store selectors

* Change description of test suite

* Bump commit to trigger tests

* Fix path in test

* update package lock

* Set correct state payment method reducer tests/use correct actions

* Get saved payment methods from store not context

* Mock stores and update tests to allow switching payment methods

* Update tests to get onSubmit from checkoutEventsContext

* Remove cartTotalsLoaded check from payment method initialize check

* Make PaymentMethods test wait until payments initialized

* initialize payment method data store when cart is loaded

* Remove unneeded actions and add initializePaymentMethodDataStore

* Remove check for cart totals loaded in checkPaymentMethods

* Remove updateAvilablePaymentMethods from registry

* Remove unneeded mock

* Remove unused import

* Rename imports to fix eslint errors

* Remove unused imports

* Remove return false from checkPaymentMethods

* Remove unnecessary setPaymentMethodsInitialized call

* Add todo comment to track refactoring opportunity

* Remove savedpayment methods from payment method context and rename it

* Rename payment method data context to payment method events context

* Add tests for setDefaultPaymentMethods

* Optimize the availablePaymentMethods state data

Store only the "name" attribute for now.

* Get list of payment methods from the registry instead of the store

We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.

* Fix payment state not loading on the Checkout edit page

* Handle checkout edit page case

* Fix infinite loop error on C&C Blocks

* Include @wordpress/redux-routine in transformIgnorePatterns jest config

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-09-28 13:45:42 +01:00
Thomas Roberts aa9fd66e8e Fix lint errors 2022-09-28 13:45:42 +01:00
Alex Florisca d13d5b3fdd Feature: Data Store Migration - Payments (https://github.com/woocommerce/woocommerce-blocks/pull/6619)
* Move paymentMethodDataProvider into a data store (https://github.com/woocommerce/woocommerce-blocks/pull/6208)

* Fix typographical error on LegacyRegisterExpressPaymentMethodFunction type

* Add default state for PaymentMethod data store

* Add preliminary action types

* Add preliminary action dispatchers

* Create payment method data store

* Add preliminary reducers for payment method data store

* Add preliminary selectors for payment method data store

* Add reducers/actions for registering payment methods

* Export payment method data store key

* Add test for payment method data reducers

* Add shouldSavePaymentMethod selector

* Add store key as constant

* Add more action types for registering and initializing payment methods

* Get active payment method from data store instead of from context

* Add registered methods to default state of payment method data store

* Dispatch name of registered payment method to payment method data store

* Remove setShouldSavePayment from payment method dispatcher and types

* Get payment methods from registry instead of payment context

* Add available payment methods to store

* Add function to check whether payment methods are allowed to be used

* Add selector to check if payments are initialised

* Remove resolvers and add controls to payment method data store

* Change type of payment requirements to string[]

* Turn addRegistered and addRegisteredExpress into generators

This is so we can check each payment method's validity before adding it to the list of available payment methods

* Add action type for setting express payments as initialized

* Only select from available methods in payment method options

* Remove argument from addRegisteredPaymentMethod in payment method registry

* Rename folder and store name to not contain the word data

* Add selectors for express payment methods and their initialisation

* Delete controls again in favour of thunks

* Rename payment-method-data to payment-methdods

* Create new setDefaultPaymentMethod function

This will set the payment method when the cart loads.

* Add CustomerPaymentMethodConfiguration type

* Make getAvailableExpressPaymentMethods return correct data

* Check express methods and normal methods when cart changes

* Add action for setting active express payment methods

* Handle express methods in checkPaymentMethodCanPay

* Hide express payments area if none are available

* Add selector for paymentMethodData

* Add customer data to default state and add selector for it

* Add setPaymentStatus action and reducer case

* Set the default payment method when one isn't selected

* Correct types on getCustomerPaymentMethods

* Set status in data store alongside context status

* Comment out active gateway selection - remove later

* Set status in express payment methods in data store

* Use correct key in payment method data context

* Directly check payment methods from the list in blocks-registry

* Add semicolon to import statement

* Fix payment method data state call

* Get paymentMethodData from store not context

* Fix linting issues

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

* Rebase on the update/checkout-data-store branch & Fix failed payments (https://github.com/woocommerce/woocommerce-blocks/pull/6587)

* 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

* Fix typographical error on LegacyRegisterExpressPaymentMethodFunction type

* Add default state for PaymentMethod data store

* Add preliminary action types

* Add preliminary action dispatchers

* Create payment method data store

* Add preliminary reducers for payment method data store

* Add preliminary selectors for payment method data store

* Add reducers/actions for registering payment methods

* Export payment method data store key

* Add test for payment method data reducers

* Add shouldSavePaymentMethod selector

* Add store key as constant

* Add more action types for registering and initializing payment methods

* Get active payment method from data store instead of from context

* Add registered methods to default state of payment method data store

* Dispatch name of registered payment method to payment method data store

* Remove setShouldSavePayment from payment method dispatcher and types

* Get payment methods from registry instead of payment context

* Add available payment methods to store

* Add function to check whether payment methods are allowed to be used

* Add selector to check if payments are initialised

* Remove resolvers and add controls to payment method data store

* Change type of payment requirements to string[]

* Turn addRegistered and addRegisteredExpress into generators

This is so we can check each payment method's validity before adding it to the list of available payment methods

* Add action type for setting express payments as initialized

* Only select from available methods in payment method options

* Remove argument from addRegisteredPaymentMethod in payment method registry

* Rename folder and store name to not contain the word data

* Add selectors for express payment methods and their initialisation

* Delete controls again in favour of thunks

* Rename payment-method-data to payment-methdods

* Create new setDefaultPaymentMethod function

This will set the payment method when the cart loads.

* Add CustomerPaymentMethodConfiguration type

* Make getAvailableExpressPaymentMethods return correct data

* Check express methods and normal methods when cart changes

* Add action for setting active express payment methods

* Handle express methods in checkPaymentMethodCanPay

* Hide express payments area if none are available

* Add selector for paymentMethodData

* Add customer data to default state and add selector for it

* Add setPaymentStatus action and reducer case

* Set the default payment method when one isn't selected

* Correct types on getCustomerPaymentMethods

* Set status in data store alongside context status

* Comment out active gateway selection - remove later

* Set status in express payment methods in data store

* Directly check payment methods from the list in blocks-registry

* Add semicolon to import statement

* Fix payment method data state call

* Get paymentMethodData from store not context

* Add addPaymentMethodData action/reducer case

* Update payment method on payment success

* Add 'getCurrentStatus' selector

* Remove the temporary solution

For getting payment method data into the data store

* Prevent the 'success' context action from being dispatched

* Update the "setPaymentStatus" data store action

Accept status as an object instead of string

* Fix the "currentStatus" reducer state update value

* Get payment data into data store

* Set the correct payment status to data store

* Get the success status of payment from data store

* Use store data in the payment dispatchers

Replace the React useReducers action in the payment dispatchers file with
the payment method data store

* Get payment status from data store

* Use data store for the payment error status

* Use payment data store failed status

* Use payment data store for the isFinished status

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>

* Fix merge conflict error

* Set & get the provider's state from our data store instead of React's useReducer (https://github.com/woocommerce/woocommerce-blocks/pull/6588)

* 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

* Fix typographical error on LegacyRegisterExpressPaymentMethodFunction type

* Add default state for PaymentMethod data store

* Add preliminary action types

* Add preliminary action dispatchers

* Create payment method data store

* Add preliminary reducers for payment method data store

* Add preliminary selectors for payment method data store

* Add reducers/actions for registering payment methods

* Export payment method data store key

* Add test for payment method data reducers

* Add shouldSavePaymentMethod selector

* Add store key as constant

* Add more action types for registering and initializing payment methods

* Get active payment method from data store instead of from context

* Add registered methods to default state of payment method data store

* Dispatch name of registered payment method to payment method data store

* Remove setShouldSavePayment from payment method dispatcher and types

* Get payment methods from registry instead of payment context

* Add available payment methods to store

* Add function to check whether payment methods are allowed to be used

* Add selector to check if payments are initialised

* Remove resolvers and add controls to payment method data store

* Change type of payment requirements to string[]

* Turn addRegistered and addRegisteredExpress into generators

This is so we can check each payment method's validity before adding it to the list of available payment methods

* Add action type for setting express payments as initialized

* Only select from available methods in payment method options

* Remove argument from addRegisteredPaymentMethod in payment method registry

* Rename folder and store name to not contain the word data

* Add selectors for express payment methods and their initialisation

* Delete controls again in favour of thunks

* Rename payment-method-data to payment-methdods

* Create new setDefaultPaymentMethod function

This will set the payment method when the cart loads.

* Add CustomerPaymentMethodConfiguration type

* Make getAvailableExpressPaymentMethods return correct data

* Check express methods and normal methods when cart changes

* Add action for setting active express payment methods

* Handle express methods in checkPaymentMethodCanPay

* Hide express payments area if none are available

* Add selector for paymentMethodData

* Add customer data to default state and add selector for it

* Add setPaymentStatus action and reducer case

* Set the default payment method when one isn't selected

* Correct types on getCustomerPaymentMethods

* Set status in data store alongside context status

* Comment out active gateway selection - remove later

* Set status in express payment methods in data store

* Directly check payment methods from the list in blocks-registry

* Add semicolon to import statement

* Fix payment method data state call

* Get paymentMethodData from store not context

* Add addPaymentMethodData action/reducer case

* Update payment method on payment success

* Add 'getCurrentStatus' selector

* Remove the temporary solution

For getting payment method data into the data store

* Prevent the 'success' context action from being dispatched

* Update the "setPaymentStatus" data store action

Accept status as an object instead of string

* Fix the "currentStatus" reducer state update value

* Get payment data into data store

* Set the correct payment status to data store

* Get the success status of payment from data store

* Use store data in the payment dispatchers

Replace the React useReducers action in the payment dispatchers file with
the payment method data store

* Get payment status from data store

* Use data store for the payment error status

* Use payment data store failed status

* Use payment data store for the isFinished status

* Update the setPaymentStatus argument

* Set up setRegisteredPaymentMethods in data store

* Use the data store version of the registeredPaymentMethods

* Fix the default state type of the registeredPaymentMethods

* Set up setRegisteredExpressPaymentMethod in data store

* Use the data version of the registred express payment methods

* Set the correct action type for removing payment methods

* Fix default state express payment methods type

* Use the store data version of activePaymentMethod

* Use setActivePaymentMethod in the dispatchers file

And refactor code

* Update payment status arguments for express payment methods

* Use paymentMethodData from the data store

* Use payment method's errorMessage from data store

* Update paymentMethods list in data store reducer

* Replace remaining payment context data with data store

* Clean up payment method context file

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>

* Get payment method data directly from the data store instead of the usePaymentMethodDataContext hook (https://github.com/woocommerce/woocommerce-blocks/pull/6589)

* 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

* Fix typographical error on LegacyRegisterExpressPaymentMethodFunction type

* Add default state for PaymentMethod data store

* Add preliminary action types

* Add preliminary action dispatchers

* Create payment method data store

* Add preliminary reducers for payment method data store

* Add preliminary selectors for payment method data store

* Add reducers/actions for registering payment methods

* Export payment method data store key

* Add test for payment method data reducers

* Add shouldSavePaymentMethod selector

* Add store key as constant

* Add more action types for registering and initializing payment methods

* Get active payment method from data store instead of from context

* Add registered methods to default state of payment method data store

* Dispatch name of registered payment method to payment method data store

* Remove setShouldSavePayment from payment method dispatcher and types

* Get payment methods from registry instead of payment context

* Add available payment methods to store

* Add function to check whether payment methods are allowed to be used

* Add selector to check if payments are initialised

* Remove resolvers and add controls to payment method data store

* Change type of payment requirements to string[]

* Turn addRegistered and addRegisteredExpress into generators

This is so we can check each payment method's validity before adding it to the list of available payment methods

* Add action type for setting express payments as initialized

* Only select from available methods in payment method options

* Remove argument from addRegisteredPaymentMethod in payment method registry

* Rename folder and store name to not contain the word data

* Add selectors for express payment methods and their initialisation

* Delete controls again in favour of thunks

* Rename payment-method-data to payment-methdods

* Create new setDefaultPaymentMethod function

This will set the payment method when the cart loads.

* Add CustomerPaymentMethodConfiguration type

* Make getAvailableExpressPaymentMethods return correct data

* Check express methods and normal methods when cart changes

* Add action for setting active express payment methods

* Handle express methods in checkPaymentMethodCanPay

* Hide express payments area if none are available

* Add selector for paymentMethodData

* Add customer data to default state and add selector for it

* Add setPaymentStatus action and reducer case

* Set the default payment method when one isn't selected

* Correct types on getCustomerPaymentMethods

* Set status in data store alongside context status

* Comment out active gateway selection - remove later

* Set status in express payment methods in data store

* Directly check payment methods from the list in blocks-registry

* Add semicolon to import statement

* Fix payment method data state call

* Get paymentMethodData from store not context

* Add addPaymentMethodData action/reducer case

* Update payment method on payment success

* Add 'getCurrentStatus' selector

* Remove the temporary solution

For getting payment method data into the data store

* Prevent the 'success' context action from being dispatched

* Update the "setPaymentStatus" data store action

Accept status as an object instead of string

* Fix the "currentStatus" reducer state update value

* Get payment data into data store

* Set the correct payment status to data store

* Get the success status of payment from data store

* Use store data in the payment dispatchers

Replace the React useReducers action in the payment dispatchers file with
the payment method data store

* Get payment status from data store

* Use data store for the payment error status

* Use payment data store failed status

* Use payment data store for the isFinished status

* Update the setPaymentStatus argument

* Set up setRegisteredPaymentMethods in data store

* Use the data store version of the registeredPaymentMethods

* Fix the default state type of the registeredPaymentMethods

* Set up setRegisteredExpressPaymentMethod in data store

* Use the data version of the registred express payment methods

* Set the correct action type for removing payment methods

* Fix default state express payment methods type

* Use the store data version of activePaymentMethod

* Use setActivePaymentMethod in the dispatchers file

And refactor code

* Update payment status arguments for express payment methods

* Use paymentMethodData from the data store

* Use payment method's errorMessage from data store

* Update paymentMethods list in data store reducer

* Replace remaining payment context data with data store

* Clean up payment method context file

* Get payment method state from data store in the checkout submit hook

* Copy types.ts file into the payment data store folder

* Fix isExpressPaymentMethodActive selector

* Move the entire currentStatus into the data store

* Replace the payment context state with the data store

* Fix getActiveSavedToken & clean up the context file

* Use the accutrate name of the "createErrorNotice"

* Update the payment method data store key import

* Diable unused state from the context

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>

* Refactor the payment method data store & context (https://github.com/woocommerce/woocommerce-blocks/pull/6607)

* 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

* Fix typographical error on LegacyRegisterExpressPaymentMethodFunction type

* Add default state for PaymentMethod data store

* Add preliminary action types

* Add preliminary action dispatchers

* Create payment method data store

* Add preliminary reducers for payment method data store

* Add preliminary selectors for payment method data store

* Add reducers/actions for registering payment methods

* Export payment method data store key

* Add test for payment method data reducers

* Add shouldSavePaymentMethod selector

* Add store key as constant

* Add more action types for registering and initializing payment methods

* Get active payment method from data store instead of from context

* Add registered methods to default state of payment method data store

* Dispatch name of registered payment method to payment method data store

* Remove setShouldSavePayment from payment method dispatcher and types

* Get payment methods from registry instead of payment context

* Add available payment methods to store

* Add function to check whether payment methods are allowed to be used

* Add selector to check if payments are initialised

* Remove resolvers and add controls to payment method data store

* Change type of payment requirements to string[]

* Turn addRegistered and addRegisteredExpress into generators

This is so we can check each payment method's validity before adding it to the list of available payment methods

* Add action type for setting express payments as initialized

* Only select from available methods in payment method options

* Remove argument from addRegisteredPaymentMethod in payment method registry

* Rename folder and store name to not contain the word data

* Add selectors for express payment methods and their initialisation

* Delete controls again in favour of thunks

* Rename payment-method-data to payment-methdods

* Create new setDefaultPaymentMethod function

This will set the payment method when the cart loads.

* Add CustomerPaymentMethodConfiguration type

* Make getAvailableExpressPaymentMethods return correct data

* Check express methods and normal methods when cart changes

* Add action for setting active express payment methods

* Handle express methods in checkPaymentMethodCanPay

* Hide express payments area if none are available

* Add selector for paymentMethodData

* Add customer data to default state and add selector for it

* Add setPaymentStatus action and reducer case

* Set the default payment method when one isn't selected

* Correct types on getCustomerPaymentMethods

* Set status in data store alongside context status

* Comment out active gateway selection - remove later

* Set status in express payment methods in data store

* Directly check payment methods from the list in blocks-registry

* Add semicolon to import statement

* Fix payment method data state call

* Get paymentMethodData from store not context

* Add addPaymentMethodData action/reducer case

* Update payment method on payment success

* Add 'getCurrentStatus' selector

* Remove the temporary solution

For getting payment method data into the data store

* Prevent the 'success' context action from being dispatched

* Update the "setPaymentStatus" data store action

Accept status as an object instead of string

* Fix the "currentStatus" reducer state update value

* Get payment data into data store

* Set the correct payment status to data store

* Get the success status of payment from data store

* Use store data in the payment dispatchers

Replace the React useReducers action in the payment dispatchers file with
the payment method data store

* Get payment status from data store

* Use data store for the payment error status

* Use payment data store failed status

* Use payment data store for the isFinished status

* Update the setPaymentStatus argument

* Set up setRegisteredPaymentMethods in data store

* Use the data store version of the registeredPaymentMethods

* Fix the default state type of the registeredPaymentMethods

* Set up setRegisteredExpressPaymentMethod in data store

* Use the data version of the registred express payment methods

* Set the correct action type for removing payment methods

* Fix default state express payment methods type

* Use the store data version of activePaymentMethod

* Use setActivePaymentMethod in the dispatchers file

And refactor code

* Update payment status arguments for express payment methods

* Use paymentMethodData from the data store

* Use payment method's errorMessage from data store

* Update paymentMethods list in data store reducer

* Replace remaining payment context data with data store

* Clean up payment method context file

* Get payment method state from data store in the checkout submit hook

* Copy types.ts file into the payment data store folder

* Fix isExpressPaymentMethodActive selector

* Move the entire currentStatus into the data store

* Replace the payment context state with the data store

* Fix getActiveSavedToken & clean up the context file

* Use the accutrate name of the "createErrorNotice"

* Update the payment method data store key import

* Diable unused state from the context

* Get enabled customer payment methods using data store selector

* Remove remaining useReducer action from the dispatchers file

* Update types and remove unused vars

* Remove the payment method dispatchers hook

* Refactor & clean up (remove unused files)

* Remove commented line from payment methods types

* Move event emitter into thunks

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>

* Remove checkout-state after merge conflicts

* Fix linting errors

* Move types to types.ts

* Move default states into respective store folders

* Fix types and add comment

* Move setExpressPaymentError to payment-methods store

* fix express payment methods not showing up

* Check if payment method is active from the state

* Add comments

* Remove commented out code in payment method data context

* Display an error in the check-payment-methods directly from data store

* Remove use-emit-response hook and move utils in event-emit/utils.ts

* Use correct action property to remove payment methods

* Fix formatting

* Only try to initialize payment methods when cart is done loading

* Add function to order payment methods from server

* Add payment methods in the correct order

* Prevent adding registered payment methods before cart is ready

* Ensure payment methods get removed from state when deregistered

* Reorder setting default payment methods to add customer methods first

* Get customer methods from store not context

* Remove error from payment-method state and associated selectors

* Remove use-payment-method-registration and update the payment method state to remove the duplicated registeredPaymentMethods

* Remove errorMessage from payment-methods store

* Rename customerPaymentMethods -> savedPaymentMethods

* Order payment methods when validating

* Refactor payment-methods.js

* Fix "Payment methods not set in editor" woocommerce/woocommerce-blocks#6655 bug

We never get to load the payment methods object in the editor mode
because there are no cart totals to load.

* Initialize payment methods when available payments are loaded

* Remove duplicate code

* Fix data store state mutation anti-pattern

A Redux rule is to never mutate the state in a reducer to avoid any unexpected results

* Set availablePaymentMethods to the paymentMethods object

Instead of its keys. We can get the keys using "Object.keys".

* Use the available ordered payment methods

The `getPaymentMethods` & `getExpressPaymentMethods` may include unordored
& unavailable payment methods.

* Get the correct value from the emit event response

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2022-09-28 13:45:42 +01:00
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
github-actions 2ed8a5d770 Empty commit for release pull request 2022-09-23 11:33:03 +00: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