* Remove the experimental flag that's used to include thunks in wp.data
* bot: update checkstyle.xml
* Fix ts error from previous PR
* bot: update checkstyle.xml
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Construct args for canMakePayment with correct keys
* When the CheckoutEventsContext mounts, initialize payment store
* Destructure useSelect correctly
* Dispatch __internalInitializePaymentStore in selector tests
* Update selector name to __internalUpdateAvailablePaymentMethods
* Remove check for editor when registering checkout store
* Add check for when express payment methods have updated too
* Ensure billingAddress key exists in canMakePayment arg
* Use editor context to know if we're in editor
* Rename payment-method-data-context to payment-event-context and tidy up types and things
* Rename uses of PAYMENT_METHOD_DATA_STORE_KEY to PAYMENT_STORE_KEY
* Rename __internalInitializePaymentMethodDataStore and unsubscribeInitializePaymentMethodDataStore
* Rename unsubscribeInitializePaymentMethodDataStore
* Rename setProcessingResponse to setPaymentResult and remove setOrderId from the checkout data store actions
* Fix accidentally changing data exposed to the observers
* Rename all checkout actions with the __internal prefix
* Prefix all payment method data store actions with __internal
* Pedantic spacing
* Fix ts error
* 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>
* 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>
* 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>