Commit Graph

302 Commits

Author SHA1 Message Date
Alex Florisca 48c450c469 Remove duplicate shouldSavePaymentMethod selector (https://github.com/woocommerce/woocommerce-blocks/pull/7381) 2022-10-19 04:48:04 -07:00
Tarun Vijwani 9167a04e20 Refactor force billing: remove forcedBillingAddress from conditions for showBillingFields (https://github.com/woocommerce/woocommerce-blocks/pull/7393)
Co-authored-by: Niels Lange <info@nielslange.de>
2022-10-14 11:29:06 +01:00
Tarun Vijwani 75d6e84552 Hide the shipping address form from the Checkout when the "Force shipping to the customer billing address" is enabled (https://github.com/woocommerce/woocommerce-blocks/pull/7268)
* Hide shipping address form from the Checkout when forced billing address is enabled.

* Update shipping address when billing address is changed

* Display shipping options

* Fixed needs shipping condition

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
2022-10-07 08:50:26 +01:00
Alex Florisca aefcf65dd8 Consolidate Address types (https://github.com/woocommerce/woocommerce-blocks/pull/7272)
* Consolidate Address types

* Revert "Consolidate Address types"

This reverts commit cb708a3d714621717414ec17f5e1071be5ca5e96.

* Rename EnteredAddress to CustomerAddress

* Delete unused Address type

* Thomas suggestions

* Fix duplicate ShippingAddress symbol
2022-10-06 15:48:52 +01:00
Alex Florisca 7bf79f33d9 Rename payment-method-data-context to payment-events-context and PAYMENT_METHOD_DATA_STORE_KEY to PAYMENT_STORE_KEY (https://github.com/woocommerce/woocommerce-blocks/pull/7304)
* 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
2022-10-06 13:46:46 +01:00
Thomas Roberts df3b785244 Rename `wc/store/payment-methods` to `wc/store/payment` (https://github.com/woocommerce/woocommerce-blocks/pull/7267)
* Rename wc/store/payment-methods to wc/store/payment

* Rename folder to payment

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
2022-10-05 13:01:56 +01:00
Alex Florisca eace72a31f Prefix all actions in the checkout and payment-method stores with `__internal` (https://github.com/woocommerce/woocommerce-blocks/pull/7266)
* 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
2022-10-05 11:04:16 +01:00
Hsing-yu Flowers cad30afc79 Fix use of sanitizeHTML (https://github.com/woocommerce/woocommerce-blocks/pull/7231)
* Remove object from sanitizeHTML return value

* Import sanitizeHTML from utils

* Fix dangerously set inner HTML format

* Update package-lock

* Update package-lock

* Update package-lock

* Update @types/dompurify version

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-10-05 02:59:38 -07:00
Alex Florisca 33910f316f Document the actions in the checkout and payment-method stores (https://github.com/woocommerce/woocommerce-blocks/pull/7255)
* Remove setPristine as it's not used

* Comment checkout actions

* Rename setProcessingResponse to setPaymentResult and remove setOrderId from the checkout data store actions

* Add comments to payment actions

* Update documentation with data stores

* Fix accidentally changing data exposed to the observers

* Document missing parameters for actions
2022-09-30 15:34:14 +01:00
Niels Lange c360c5654a Add filter for place order button label (https://github.com/woocommerce/woocommerce-blocks/pull/7154)
* WIP add filter for place order button label

* Solve TS issue

* Add display priority

* Refactor display priority

* WIP Implement useMemo()

* Try using a global cache

* Add docs for placeOrderLabel filter

* Update docs/third-party-developers/extensibility/checkout-block/available-filters.md

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

* Adjust docs

* Rename “placeOrderLabel” to “placeOrderButtonLabel”

* Update assets/js/types/type-defs/payments.ts

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
2022-09-29 15:46:10 +07:00
Daniel Dudzic 8ae19b5a42 Add a Products by Rating filter block (https://github.com/woocommerce/woocommerce-blocks/pull/7048)
* Add interactivity to the Product by Rating filter block

* Fix block with the latest repo changes

* Product by Rating: Code tidying up

* Add an experimental build gate and update block title and description

* Remove redundant title and description

* Add support for the CheckboxList component in the Products by Rating block

* Products by Rating: Minor code clean-up

* Active Filters: Fix the Clear All button for Ratings. Closes #woocommerce/woocommerce-blocks#7172

* Products by Rating: Add misc TS fixes
2022-09-28 23:12:14 +02:00
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
Alex Florisca 37d6802252 Remove unused properties from store select 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 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
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
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
Lucio Giannotta 5dd05d7ab2 Improve public-facing texts and labels (https://github.com/woocommerce/woocommerce-blocks/pull/7045)
We noticed that oftentimes our labels and text tend to be overly
technical or unclear. We decided to do a bulk pass to improve
the readability to non-technical users.
2022-09-12 10:39:26 +02:00
Seghir Nadir 008c63b0dc Refactor external dispatch actions from being called inside useSelect (https://github.com/woocommerce/woocommerce-blocks/pull/6718)
* refactor coupon functions outside of useSelect

* fix test
2022-07-29 16:20:48 +01:00
Thomas Roberts 488ff13ca9 Update the `previewCart` property we use to get `hasCalculatedShipping` in `useShippingData` and fix broken JS tests (https://github.com/woocommerce/woocommerce-blocks/pull/6781)
* Require the rest of the @woocommerce/block-settings module in block.test.js

* Use correct property from previewCart for hasCalculatedShipping
2022-07-28 02:22:42 -07:00
Thomas Roberts 6bf8f07c39 Ensure shipping rate names show when multiple packages are used (https://github.com/woocommerce/woocommerce-blocks/pull/6753)
* Get shipping rates from preview cart in editor

* Set showItems in ShippingRatesControl to true if multiple packages

* Move dependency in useShippingData to correct section

* Ensure getting packageData.shipping_rates.length won't error
2022-07-26 23:00:17 -07:00
Paulo Arromba ffbc39bfd3 fix: fixed colors for error input and labels on dark palette mode themes and dark controls. (https://github.com/woocommerce/woocommerce-blocks/pull/6292) 2022-07-06 15:03:15 +01:00
Tung Du 27224fd46e Fix: Convert Filter Products by Attribute Block to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/6545)
* wip: convert attribute filter to ts

* change query to optional

* update SearchListControlProps and SearchListItemType

* get default attribute from metadata

* update types

* convert attributes utils to ts

* convert attribute query utils to ts

* fix type error, remove type casting

* revert type change for SearchListItemType

* apply new format
2022-06-15 19:50:42 +07:00
Michael P. Pfeiffer 521f93619b Upgrade wp-prettier to 2.6.2 and reformat the codebase (https://github.com/woocommerce/woocommerce-blocks/pull/6566)
* Remove mixed tabs and spaces in tsconfig.json

* Update formatting in json files

* Upgrade wp-prettier to 2.6.2
2022-06-15 11:56:52 +02:00
Niels Lange d7d043cb5b Rename billingData to billingAddress (https://github.com/woocommerce/woocommerce-blocks/pull/6369)
* Rename billingData to billingAddress

* Add unit test to ensure billingData remains accessible

* add integration tests for slots

* Keep billingData in usePaymentMethodRegistration for backwards compatibility

* Gate `billingData` in deprecation gate

* Replace deprecation call

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2022-06-10 18:59:25 +02:00
Tung Du 111b4eca48 Convert `useCollectionData` hook to TS (https://github.com/woocommerce/woocommerce-blocks/pull/6535) 2022-06-09 16:05:11 +07:00
Saad Tarhi 25cb047483 Remove `useStoreSnackbarNotices` and interact directly with data store instead (https://github.com/woocommerce/woocommerce-blocks/pull/6411)
* Use wp store directly instead of React Context

We are using now actions directly from wp store in 'useStoreCartCoupons'
hook to apply and remove coupon.

* Remove unused "useStoreSnackbarNotices" related
files

* Add NoticeContext TS definition

* Remove the Provider references and refactor code

* Fix snackbar notice creation bug

* Fix "clear out snackbar coupon notice" bug

* Update "notices" API documentation

Remove snackbar hooks mentions since it's not used anymore
2022-05-25 22:00:47 +01:00
Thomas Roberts 32189c0bb5 Fix bug with server errors not showing in Cart/Checkout (https://github.com/woocommerce/woocommerce-blocks/pull/6268)
* Add correct context to checkout and cart errors from API

* Correct typo in add-to-cart context

* Add correct context in add to cart form

* Add correct context in add to cart form

* Add correct context in Checkout State
2022-04-15 13:17:09 +01:00
Alex Florisca 0c7c2db6c0 Update @woocmmerce/eslint-plugin to 2.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6203)
* Update @woocmmerce/eslint-plugin to 2.0.0

* Fixed some eslint errors

* Fix syntax errors

* Fix most linting errors

* Feedback changes

* Fix one more eslint issue
2022-04-08 14:47:19 +01:00
Thomas Roberts cab947bc2b Remove `useStoreNotices` and interact directly with data store instead (https://github.com/woocommerce/woocommerce-blocks/pull/6159)
* Make useStoreNotices interact directly with the store

* Get/set error notices directly in store in paymentMethodDataContext

* Add hasNoticesOfType util

* Remove useStoreNotices and interact directly with data store

* Create/remove notices directly in store

* Remove tests for useStoreNotices

* Add tests for notices util

* Use setIsSuppressed from useStoreNoticesContext

* remove useStoreNotices hook

* Update context typedef to define only isSuppressed and setIsSuppressed

* Remove all values from StoreNoticesContext besides setIsSuppressed

* Wrap Cart and Checkout blocks in StoreNoticesProvider (for isSuppressed)

* Make StoreNoticesContainer a named export

This is required so we can import it from @wooommerce/base-context

* Change addErrorNotice to createErrorNotice to match store action

* Remove unnecessary StoreNoticeProviders and pass only context to container

* Accept a context in StoreNoticesContainer

* Pass relevant context to StoreNoticesContainer

* Add function to remove notices by status

* Prevent checkout from breaking when removing notices during processing

* Prevent TS error about not included path

* Add StoreNoticesContainer to single product block

* Add StoreNoticesContainer to All Products Block

* Ensure errors are shown when using All Products & Single Product Blocks

* Add a context arg to removeNoticesByStatus

* Use correct contexts for all products and single product block

* Update tests to reflect new context argument

* Re-add missing block file for order-summary

* Remove block file for order-summary

* Send context to useStoreCartCoupons to show errors correctly
2022-04-08 13:11:50 +01:00
Alex Florisca e37b787e50 Move mini cart outside cart-checkout folder (https://github.com/woocommerce/woocommerce-blocks/pull/6192)
* Move shared folder to /blocks

* Moved mini-cart block in blocks dir:

* Rename shared folder to cart-checkout-shared

* Remove customDir from mini-cart webpack entry

* Update assets/js/base/context/tsconfig.json

Co-authored-by: Tung Du <dinhtungdu@gmail.com>

* Feedback changes

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-04-07 14:47:58 +01:00
Alex Florisca e15d516163 Revert "Move cart and mini-cart blocks into their own folders (https://github.com/woocommerce/woocommerce-blocks/pull/6126)" (https://github.com/woocommerce/woocommerce-blocks/pull/6190)
This reverts commit d005dbd2cf.
2022-04-05 11:14:32 +01:00
Alex Florisca d005dbd2cf Move cart and mini-cart blocks into their own folders (https://github.com/woocommerce/woocommerce-blocks/pull/6126)
* Move cart and mini-cart into their own folders

* Update other references of cart-checkout
2022-04-04 12:34:29 +01:00
Mike Jolley f926b24480 Checkout: Missing country error for virtual orders (edge case) (https://github.com/woocommerce/woocommerce-blocks/pull/6050)
* Make shipping address field optional on checkout routes

* Make update_customer_from_request use billing for shipping if omitted

* making shipping optional when needed

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2022-03-14 13:53:08 +00:00
Thomas Roberts a6bff7e6e8 Change `shippingRatesLoading` to `isLoadingRates` (https://github.com/woocommerce/woocommerce-blocks/pull/5999)
* Change `shippingRatesLoading` to `isLoadingRates`

* Revert isLoadingRates back to old name in payment method interface

* Update docs with correct names returned by usePaymentMethodInterface

* Update TS to name the selectShippingRate method correctly

* Change method name on usePaymentMethodInterface back
2022-03-14 11:29:25 +00:00
Mike Jolley 8e057a03f5 Remove X- Prefixes from custom headers (https://github.com/woocommerce/woocommerce-blocks/pull/6020)
* Remove X- Prefixes from custom headers

* Fix docs

* Handle deprecated X-WC-Store-API-Nonce header if received

* Send old nonce until future version removes this

* Add todo and cut off date

* wc_deprecated_argument

* Update todo name

* typo

* Back compat in batch

* Flip Nonce logic to make it easier to support both in client bw compat logic
2022-03-11 12:07:08 +00:00
Mike Jolley 5165611e45 Remove deprecated data controls in favour of those from the `@wordpress/data` package (https://github.com/woocommerce/woocommerce-blocks/pull/5574)
* Remove expected warnings from test suite

* Switch dispatch and select usage to `controls`, from `@wordpress/data`

* Wrap render with act

* resolveSelect to wait for resolution

* resolveSelect
2022-03-10 13:22:05 +00:00
Thomas Roberts 6b8ef2773a Try move shipping related dat to a `@wordpress/data` store (https://github.com/woocommerce/woocommerce-blocks/pull/5896)
* Add address-related items to wc/store/cart data store

* Add useUpdateCustomerData hook

This allows us to have a single hook responsible for updating the customer information on the server.

* Add useUpdateCustomerData hook in Checkout block

* Remove shippingAsBilling from previousCustomerData ref type

* Add useShippingAsBillingCheckbox hook

* Remove checkbox handling from useCheckoutAddress

* Merge with woocommerce/woocommerce-blocks#5810 changes

* Move shipping as billing to checkout state context provider

* Subscribe to changes

* Cache customerDataToUpdate

* Combine customerDataType and customerDataContextType

* Fix notice context

* Clean up inline docs for push changes

* Add useShippingData hook

* Add shipping related selectors to cart store

* Update useShippingDataContext to useCustomerData hook

* Update uses of useShippingDataContext to get data from hook instead

* Remove rogue linebreak

* Re-add linebreak

* Re-add linebreak, remove shippingAsBilling

* Re-add linebreak

* Use useShippingData and useCustomerData instead of context

* Fix fromEntriesPolyfill to use number or undefined as an index option

* Convert derive-selected-shipping-rates to TS

* Add SelectShippingRateType

* Get needsShipping from new hook and not context

* Get address data from useCustomerData instead of useShippingDataContext

* Move selectedRates, selectShippingRate and isSelectingRate

* Remove items from ShippingDatacontext that are available in data stores

* Get shipping data from stores, not context in payment method interface

* Consider shipping rates to be loading if customer data is updating

* Get rates from useShippingData hook instead of context

* Fix incorrect TypeScript types and incorrectly named destructure

* Move useShippingData into shipping folder

* Update tests to mock useShippingData instead of context

* Remove empty string fallback from shipping phone

* Get types from Cart declaration instead of Picking them

Co-authored-by: Mike Jolley <mike.jolley@me.com>
2022-03-04 17:43:45 +00:00
Thomas Roberts db1989aefb Remove `fromEntriesPolyfill` (https://github.com/woocommerce/woocommerce-blocks/pull/5981)
* Remove fromEntriesPolyfill

* Remove further instances of fromEntriesPolyfill
2022-03-04 14:42:16 +00:00
Mike Jolley 9157930349 Remove v1 from Store Keys (https://github.com/woocommerce/woocommerce-blocks/pull/5987) 2022-03-04 14:03:52 +00:00
Mike Jolley fd03b79995 StoreAPI: Rename namespace to remove `\Blocks` (https://github.com/woocommerce/woocommerce-blocks/pull/5982)
* Composer config

* Update namespace in deprecated.php

* Bulk update namespace

* Revert rename in deprecated class

* bw compat

* Store API: Add dedicated container and make Store API code self-contained (https://github.com/woocommerce/woocommerce-blocks/pull/5986)

* Move ArrayUtils to StoreApi

* Move PaymentContext/PaymentResult

* Move create account functionality to checkout endpoint. Update tests.

* Move get_routes_from_namespace to blocks

* Move RestApi logic within StoreApi namespace/directory

* StoreAPI Container

* Update functions

* Update extend docs

* Run Doc build script

* Missing container calls for 3rd party extensions

* Fix doc toc
2022-03-04 13:28:37 +00:00
Mike Jolley a58b2d0ac4 Store API: Introduce API Versioning System (https://github.com/woocommerce/woocommerce-blocks/pull/5911)
* Fix missing dependency

* Min version exceeds required 5.6

* Move exceptions

* Move schemas under V1 namespace

* Move routes to v1

* Move RouteException

* Route versioning

* Update route and schema identifiers/init

* Rework route init to support multiple versions and multiple schema

* Tests for cart routes

* Cart coupons tests

* Batch

* extensions

* Update docs

* Update remaining tests

* woocommerce_store_api_route_version was unused

* Revert unrelated change

* Fix phpcs

* Update src/StoreApi/docs/guiding-principles.md

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

* Update src/StoreApi/docs/cart-items.md

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

* Update src/StoreApi/RoutesController.php

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

* Note about v1 unversioned endpoints

* Remove unused get_route_version

* 409 comment in tests

* Remove copy pasted comments

* Update all usage to v1

* Correct namespace

* More v1 namespaces

* More missing v1

* fix mocks

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-02-23 12:00:45 +00:00
Mike Jolley 0714fa41bd Customer Data Store and revised handling for Shipping As Billing (https://github.com/woocommerce/woocommerce-blocks/pull/5817)
* Add address-related items to wc/store/cart data store

* include shippingAsBilling in return value of useCustomerData

* Add useUpdateCustomerData hook

This allows us to have a single hook responsible for updating the customer information on the server.

* Add useUpdateCustomerData hook in Checkout block

* Remove the updating customer data work from the useCustomerData hook

* Remove shippingAsBilling from previousCustomerData ref type

* Add useShippingAsBillingCheckbox hook

* Control shippingAsBilling from single hook

* Remove checkbox handling from useCheckoutAddress

* Remove CustomerDataContext typedef

* Merge with woocommerce/woocommerce-blocks#5810 changes

* Move shipping as billing to checkout state context provider

* Unused import

* Subscribe to changes

* Only receiveCartContents when updating customer data via checkout

* Cache customerDataToUpdate

* rename debounced function

* Combine customerDataType and customerDataContextType

* Change case of CustomerDataType

* debouncedUpdateCustomerData typo

* Fix notice context

* Clean up inline docs for push changes

* Comment on dirty state

* Phone is always set

* shippingAddress is never undefined

* setBillingPhone

* receiveCartContents explanation

* Tweak customerData to avoid null

* useShippingAsBilling

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2022-02-22 17:45:01 +00:00
Albert Juhé Lluveras cd6ceecd3a Fix All Products block pagination not showing up (https://github.com/woocommerce/woocommerce-blocks/pull/5850) 2022-02-15 16:31:50 +01:00
Mike Jolley 0a8fe0a0c6 Remove `useSelectShippingRate` hook and adjust how local state works for `PackageRates` (https://github.com/woocommerce/woocommerce-blocks/pull/5802)
* Convert radio component to TS and support uncontrolled components

* Further radio control to typescript changes

* Combine useSelectShippingRate and useSelectShippingRates

* Remove useSelectShippingRate hook

* Move local radio checked state to PackageRates

* This is a Controlled component - update inline docs

* useSelectShippingRates -> useSelectShippingRate rename
2022-02-10 11:59:43 +00:00
Luigi Teschio a594ea5ef5 Fix Mini Cart doesn't update data (https://github.com/woocommerce/woocommerce-blocks/pull/5741)
* Remove api hydration for the Mini Cart Block woocommerce/woocommerce-blocks#5729

Remove api hydration for the Mini Cart Block

* fix PHP error

* send event when the button is clicked

* fix import order
2022-02-10 10:26:09 +01:00
Alex Florisca 9b3fdbb0b0 Ts blocks (https://github.com/woocommerce/woocommerce-blocks/pull/5668)
* filter-element-label -> ts

* filter-submit-button -> ts

* form -> ts

* load-more-button -> ts

* loading-mask -> ts

* pagination -> ts

* ProductList -> ts (in progress)

* ProductList -> ts continued

* ProductList -> ts - done + fix some ts errors

* ProductList -> ts continued

* ProductList -> ts

* Tidy up

* Extract type for RegisteredBlockComponent

* Feedback from Mike

* Fix unit tests
2022-02-07 09:34:30 +00:00
Thomas Roberts c7aa3a75b9 Update tests to use `useEvent` (https://github.com/woocommerce/woocommerce-blocks/pull/5573)
* Update payment-method-data-context tests to use userEvent

* Update mini cart block tests to use userEvent

* Update payment methods tests to use userEvent
2022-01-31 10:53:21 +00:00
Mike Jolley bcba16e4a5 Prevent Redirect URL leaking between payment gateways (https://github.com/woocommerce/woocommerce-blocks/pull/5560)
* Reset redirectUrl to blank if not included in response.

* Force redirect URL for successful responses

* Revert "Force redirect URL for successful responses"

This reverts commit 61aae8b459843237b5428be8fa0cdb9500cd0485.
2022-01-20 11:25:40 +00:00
Mike Jolley a1695861f2 Add minimum quantity, maximum quantity, and step (multiple_of) to the Cart Block and Store API (https://github.com/woocommerce/woocommerce-blocks/pull/5406)
* add min and step to Store API

* add min and step support

* typo

* Update assets/js/base/components/quantity-selector/index.tsx

* Update assets/js/base/components/quantity-selector/index.tsx

* Fix debounce callback

* Style qty input to show steps

* Implement quantity_limits in API

* Quantity validation

* Update product API

* Normalize on + -

* Separate add to cart events from cart item events in regards to limits

* Prevent qty change for editable line items

* Unify filters

* Remove step number indicator from buttons ¯\_(ツ)_/¯

* Normalize on mount

* Update docs

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2022-01-11 11:09:59 +00:00
Mike Jolley e19abbc0c2 Remove Built-in Stripe Integration in favour of Stripe Extension (https://github.com/woocommerce/woocommerce-blocks/pull/5449)
* Remove Stripe from PHP side

* Remove stripe from client

* fix const name in tests

* Update docs
2022-01-11 10:53:38 +00:00
Raluca Stan 5c232fa7a1 Force a string token property for the activePaymentMethod (https://github.com/woocommerce/woocommerce-blocks/pull/5535) 2022-01-07 14:41:25 +01:00
Mike Jolley 0e53cea85c Fix initial population of address data in `useCustomerData` hook (https://github.com/woocommerce/woocommerce-blocks/pull/5473)
* Re-init customer data once cart has loaded

* Tweak typedef

* Track changes without capturing blank initial state in useCheckoutAddress
2021-12-31 16:10:43 +01:00
Alex Florisca e61eb3b0a4 Fix extra network request on cart (https://github.com/woocommerce/woocommerce-blocks/pull/5394) 2021-12-16 10:30:23 +00:00
Mike Jolley 226780107a Add error message for fetch errors on checkout (https://github.com/woocommerce/woocommerce-blocks/pull/5341)
* Add error message for fetch errors on checkout

* Update message text

* revert gitignore change

* Remove errorNotice variable
2021-12-13 15:31:49 +00:00
Seghir Nadir 772ee23faa Update item quantity if server result is different from client (https://github.com/woocommerce/woocommerce-blocks/pull/5352)
* respect when quantity changes from up

* add test
2021-12-10 16:26:57 +01:00
Mike Jolley 70106d45d3 Revise checkout payment statuses to avoid data loss on error (https://github.com/woocommerce/woocommerce-blocks/pull/5350)
* Clarify docs for STARTED

* Clarify docs for setActivePaymentMethod

* Remove useActivePaymentMethod hook (this held state for active methods and tokens)

* Update type defs

* Enhance setActivePaymentMethod action to accept method data

* SET_ACTIVE_PAYMENT_METHOD action

* Add setActivePaymentMethod dispatcher and make "started" status only

* Update setActivePaymentMethod usage in express methods

* Set radio control defaults

* Consolodate tokens and methods

* Update assets/js/base/context/providers/cart-checkout/payment-methods/reducer.ts

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>

* Spacing

* Split saved cards tests from regular, since saved cards are checked by default

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2021-12-10 16:26:16 +01:00
Seghir Nadir 8e62dea95d Wait until carts load before calling `canMakePayment` (https://github.com/woocommerce/woocommerce-blocks/pull/5337)
* wait till cart loads before calling canMakePayment

* fix tests
2021-12-08 13:41:31 +00:00
Mike Jolley cfeb5558b7 Update WordPress Monorepo packages with React 17x support (https://github.com/woocommerce/woocommerce-blocks/pull/5223)
* Use npm 14

* Update WP packages

* Update non-dev wordpress dependencies

* Remove usage of @automattic/data-stores

* Moves tag, search-list-control components back into private `editor-components` to mitigate dependency conflicts with`@woocommerce/components`

* Fix tests with act()

* package-lock

* fix broken maps

* Patch 14x package

* update locks

* Revert nvmrc change

* Fix tests due to debounce

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2021-12-07 15:47:50 +00:00
Mike Jolley 7fd25d4b37 Typedefs and cartData for `usePaymentMethodInterface` (https://github.com/woocommerce/woocommerce-blocks/pull/5177)
* Typedefs and cartData for the payment interface

* fix case on noticeContexts

* typeof for enums

* immutable note

* Add cartData to docs table

* Rebase docs
2021-12-07 13:02:57 +00:00
Mike Jolley c067e990b4 Introduce `<Noninteractive>` component to disable form elements non-visually (https://github.com/woocommerce/woocommerce-blocks/pull/5157)
* Noninteractive component based on Disabled

* Implement in cart/checkout

* Pass down props

* Update 'use-debounce' library

* aria disabled
2021-11-26 14:47:37 +00:00
Raluca Stan edbef32a6f Pass to registered payments a wrapper component to handle the loading state (https://github.com/woocommerce/woocommerce-blocks/pull/5135) 2021-11-22 10:41:54 +01:00
Albert Juhé Lluveras bbaa4d8798 Mini Cart as template part (https://github.com/woocommerce/woocommerce-blocks/pull/5025)
* Fix wrong event prefix in doc comment

* Make className prop in CartLineItemsTableProps optional

* Mini Cart as template part

* Remove BlockTemplatePartsController and instead use BlockTemplatesController

* Remove old code

* Clean up frontend rendering

* Update tests

* Improve if clause

* Fix wrong tests title

* Fix wrong variable name

* Make sure Mini Cart contents block is unmounted whem mini cart closes or unmounts

* Remove unnecessary waitFor

* Fix PaymentMethodDataProvider wrong children type

* TypeScript fixes

* Make comment shorter

* Remove test code

* Fix contant unmounts of Mini Cart contents block

* Fix wrong template_type passed

* Set Template part area to 'uncategorized'

* Set Template part area to the correct value

* Move template dir check outside loop
2021-11-19 12:47:48 +01:00
Alex Florisca 78c846bddc Fix 'Country is required' error on the Cart block when updating shipping address (https://github.com/woocommerce/woocommerce-blocks/pull/5129)
* Fix  error on the Cart block

* Created a cartIsHydrated variable in useStoreCart hook and used this to update the billing address in the internal state of the useCustomerData hook

* Fix the country is required error on the Cart page using refs

* Separate api calls to update shipping and billingUpdate billing and shipping addresses only when needed in API calls

* Remove redundant check for customerDataToUpdate

* remove use of refs in initial values

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2021-11-16 12:39:43 +00:00
Mike Jolley 72cf5eade8 Remove hydration hocs in favour of apiFetch Middlewares (https://github.com/woocommerce/woocommerce-blocks/pull/5022)
* Remove withRestApiHydration

* Preload checkout data via setting - server data is required for this block

* Handle cart hydration using createPreloadingMiddleware which removes the need for HOCs

* Rename variable

* Remove withStoreCartApiHydration and timestamp checking

* Empty test file
2021-11-04 11:05:58 +00:00
Albert Juhé Lluveras 4253a5fe10 Make Mini Cart block react to removed_from_cart events (https://github.com/woocommerce/woocommerce-blocks/pull/4947)
* Make Mini Cart block react to removed_from_cart events

* Move listening to add to cart and remove from cart events to the useStoreCart hook

* Add tests
2021-10-25 18:05:01 +02:00
Mike Jolley dad8331242 Cart i2 Attribute Audit (https://github.com/woocommerce/woocommerce-blocks/pull/4956)
* Add dark mode inputs toggle to top level block

* Remove top level attributes which moved to inner blocks

* Remove unused components

* Pass down hasDarkControls and currentView via context props
2021-10-18 17:12:36 +01:00
Niels Lange 63b7766586 Increase error message spacing (https://github.com/woocommerce/woocommerce-blocks/pull/4896) 2021-10-14 12:05:13 +07:00
Ovidiu Liuta ae603f3e82 WordPress Coding Standards fix for .scss files (https://github.com/woocommerce/woocommerce-blocks/pull/4918)
* adding timerange limit

* woocommerce/woocommerce-blocks#3739 fixing scss coding standard and removing spaces from parantheses values

* removing unrelated changes

* fixing further instances for parantheses
2021-10-11 14:18:32 +01:00
Seghir Nadir f1c936b7d1 Add Cart Totals to cart i2 (https://github.com/woocommerce/woocommerce-blocks/pull/4823)
* WIP getting to work on frontend

* restore frontend.tsx

* fix layout

* support emtpy cart in frontend

* add cart tital to correct place and move useEffect
2021-09-24 15:23:10 +01:00
Raluca Stan 27600b3309 Update canMakePayment to receive cart as argument and make it react to changes in billingData. (https://github.com/woocommerce/woocommerce-blocks/pull/4776)
* Add 	cartCoupons to canMakePayment argument

* Add cart to the paymentMethodArgument and improve the dependencies for the effect calling refreshCanMakePayments

* Debounce refreshCanMakePayments

The initial approach was to debounce billingData and use this value as a dependency for the useEffect that runs refreshCanMakePayments.
But because the depencies array can always change we decided to debounce the callback instead, ensuring this way that callback is not called multiple times: for example when typing a field in the billing address. Debounced was chosen instead of throttle because we want to call refreshCanMakePayments once the change event has stopped, with the final value.

* Update types and docs related to canMakePaymentArgument

* Mock the /cart call when testing payment methods

* Remove unused cartCoupons key in canMakePaymentArguments' interface
2021-09-23 16:27:02 +01:00
Raluca Stan 615b939383 Add Typescript to /blocks-registry/payment-methods (https://github.com/woocommerce/woocommerce-blocks/pull/4702)
* Type payment method under /block-registry

* Type assertions and add them back to PaymentMethodConfig

* Type ExpressPaymentMethodConfig

* Fix comment on payments types

* Fix CanMakePayment type

* Fix assertion for payment methods and the savedTokenComponent property

Because class properties come from the config object, they will never be null except if somebody explicitly adds them the the object with a value of null.
Which is not the case for savedTokenComponent for example, because it's optional and that's why we check it like this paymentMethods[ activePaymentMethod ]?.savedTokenComponent

* Add the complete CanMakePaymentReturnType and account for null for PaymentMethod.icons

- canMakePayment can also return a Promise and this was not included in the type definition
- in PaymentMethodConfig's constructor we also need to account for extensions passing {icons: null}.

* Revert Fix assertion for payment methods and the savedTokenComponent property

* Fix failing tests because of savedTokenComponent

I've reverted my changes and left the initialization of savedTokenComponent as it was.

* Rename types for more clarity

* Fix ExtensionNamespace and PaymentMethodName types

* Rename Supports and *PaymentMethodOptions type for better clarity
2021-09-15 18:36:02 +02:00
Mike Jolley cb185fabe5 Remove absolute positioning on error message (https://github.com/woocommerce/woocommerce-blocks/pull/4734) 2021-09-15 14:03:21 +01:00
Seghir Nadir 148cb91a1e Expose Validation to 3PD blocks. (https://github.com/woocommerce/woocommerce-blocks/pull/4685)
* introduce useValidation hook

* remove the hook return

* simplfy validation to avoid infinit setState

* remove extra todo
2021-09-09 16:35:53 +01:00
Mike Jolley 64fffd7051 Experimental newsletter subscription checkbox block POC and Store API supporting changes (https://github.com/woocommerce/woocommerce-blocks/pull/4607)
* remove todo from sample block

* Add newsletter block

* Block registration

* Move provider/processor so separate them from context providers

* customData implementation for setting customData for requests

* Make data and schema callbacks optional in extendrestapi class

* schema_type should be data_type

* Allow checkout endpoint to be extended

* Support validation, sanitization, and defaults on nested REST properties

* Experimental endpoint data for newsletter field

* Add extension data to requests

* SET_EXTENSION_DATA

* Update types

* Add todo

* move check within hook function

* Remove newsletter block

This is because we're testing with the integration being done in a separate extension

* Delete newsletter subscription block

* Pass the result of hooks down to the children blocks

We need to do this to allow extension blocks to modify the extensionData (so they can send custom input to the REST api when submitting the checkout form).

* Remove newsletter signup block

* remove checkoutSubmitData

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2021-08-30 15:35:20 +01:00
grogou 32d76543cf Add "Filter Products by Stock" block (https://github.com/woocommerce/woocommerce-blocks/pull/4145)
* Added Stock Status filter

* Pre pull request clean up code

* Reverted package-lock.json ( downgraded node version to 12 )

* Coped package-lock.json from trunk

* Fix label includ path

* Created new component for Filters elements labels

* Removed hideOutOfStock from AllProducts and realized hide out of stock functionality from SQL query

* Linter fix

* Review suggestion changes

* Update index.js

* Fixed preview part for stock and attribute filters

* Update assets/js/blocks/stock-filter/block.js

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

* Bring back removed css

* Allow custom stock statuses

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

* Escape statuses for sql query

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

Co-authored-by: aaron <aaron.yor@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2021-08-20 16:56:14 +01:00
Thomas Roberts c04aced323 Revert "Add "Filter Products by Stock" block (https://github.com/woocommerce/woocommerce-blocks/pull/4145)"
This reverts commit 3542b3907e.
2021-08-20 16:14:59 +01:00
Thomas Roberts 3542b3907e Add "Filter Products by Stock" block (https://github.com/woocommerce/woocommerce-blocks/pull/4145)
commit 4a14c226b739f3d88f99647206627ff351ef01ad
Merge: 8f2bc114 4fccfd88
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Fri Aug 20 16:06:19 2021 +0100

    Merge branch 'add/stock-filter' of git://github.com/NovemBit/woocommerce-gutenberg-products-block-fork into NovemBit-add/stock-filter

commit 4fccfd88998fde20b603d99d9866d3cb08cf7bf4
Merge: 8012b2b4 e7bd0e6e
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 13:17:42 2021 +0000

    Merge from trunk

commit 8012b2b40e95b90e507698de677fba059ca9ef0a
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 16:53:56 2021 +0400

    Escape statuses for sql query

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

commit 304348aeb5448153ad3365ff09ca37f265af87cc
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 16:53:18 2021 +0400

    Allow custom stock statuses

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

commit b2f01e4ed6738ef3091afbac7d4131c984b33bc7
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 28 06:22:04 2021 +0000

    Bring back removed css

commit caafffda5de6d3f31b817ab4886847958f693e24
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Tue Jul 27 23:35:15 2021 +0400

    Update assets/js/blocks/stock-filter/block.js

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

commit ae381de8aa49d0b16d2dabff7b6ecffedc511460
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Thu Jul 15 06:50:06 2021 +0000

    Fixed preview part for stock and attribute filters

commit 7df5feab0a33f93786a29a625c1f27a4737c25bc
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 20:15:05 2021 +0400

    Update index.js

commit af0294ce6a21a0032c7eeb00fe986eddda188574
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:43:06 2021 +0000

    Review suggestion changes

commit 16da25340fd7438e0fedd62b3e8b52bc33b80852
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:40:52 2021 +0000

    Linter fix

commit 594125a68c5c0d854418d5f3e76fb0e18c23b0a4
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:37:41 2021 +0000

    Removed hideOutOfStock from AllProducts and realized hide out of stock functionality from SQL query

commit 94a54e3c7c8cb94323d41a11c6bb603d0648792e
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:21:51 2021 +0000

    Created new component for Filters elements labels

commit e3d7fb2aad4b123693f0104c2ffd9af2a1273900
Author: aaron <aaron.yor@gmail.com>
Date:   Wed Jun 2 11:57:06 2021 +0400

    Fix label includ path

commit c9e3d02d5bf03614cbfd2d17ec1558dacc3252f1
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date:   Tue Jun 1 09:46:02 2021 +0100

    remove usage of mustBeString (https://github.com/woocommerce/woocommerce-blocks/pull/4294)

commit b8923390e5d5433ef2c8a14891684b907051cd7e
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon May 31 16:07:59 2021 +0100

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4290)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 6de68e41e2053a79cdce3e9d820c9b5656072685
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Thu May 27 12:57:49 2021 +0100

    Check if product can be added to cart before adding ajax class to button (https://github.com/woocommerce/woocommerce-blocks/pull/4265)

commit a1ccaf4143dd9cd86f0f88ce956bcf7edb5e419a
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Wed May 26 16:10:43 2021 +0100

    Update version for next release

commit 24f882f5d53776abe2ee6440d68485083b5a8340
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Wed May 26 15:42:21 2021 +0100

    Bumping version strings to new version.

commit e1fd0825b72d7cc87c6f26329359cc39278cc760
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Wed May 26 15:31:37 2021 +0100

    Update link to testing zip

commit 35521e54b756bf265cf6d61437cd5f55629fc2d4
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Wed May 26 14:04:42 2021 +0100

    Fix display of itemised taxes (https://github.com/woocommerce/woocommerce-blocks/pull/4279)

    * Add price to itemised tax rates & hide Total when itemised taxes are on

    * Update snapshots for taxes in sidebar

commit 7f3a1e629f04dcb71d3fb4313b3012aef13feb5f
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 26 08:52:31 2021 +0000

    Update dependency downshift to v6.1.3 (https://github.com/woocommerce/woocommerce-blocks/pull/4272)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 593ef2b07f71341b3d0fc143876c24a4d50a64fb
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 26 05:04:55 2021 +0000

    Update dependency @types/react to v16.14.8 (https://github.com/woocommerce/woocommerce-blocks/pull/4270)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 21f16d6d4ef10ada3f1631f72b4fb7dec1f4af72
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 26 03:47:54 2021 +0000

    Update dependency @woocommerce/e2e-utils to v0.1.5 (https://github.com/woocommerce/woocommerce-blocks/pull/4271)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 444256ea70c8b9ac89b4f4d5913396da9f4334cd
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 26 02:30:17 2021 +0000

    Update dependency @types/lodash to v4.14.170 (https://github.com/woocommerce/woocommerce-blocks/pull/4269)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 5f9df572aed0b07606c7a4e5b684122a48862f94
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Tue May 25 15:31:03 2021 +0100

    Create 5.2.0 testing notes

commit 45abda651a668ddc4b1d36e8c76cf19d365d94c8
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Tue May 25 14:52:37 2021 +0100

    Update package.json

    npm ci was not working correctly this will fix it.

commit c3daa6ce4c71b956e08200442626a0e29a3e5daf
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Tue May 25 14:26:32 2021 +0100

    Update changelog and WC tested up to

commit 61283092b32425450f4450d5224e156d24aa38ba
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Thu May 20 17:56:56 2021 +0100

    Revert "Move `TextInput` to checkout package and allow it to be used for input type=number (https://github.com/woocommerce/woocommerce-blocks/pull/4238)"

    This reverts commit ee9b2d20e0.

commit 193267b041e8e0fb9fe89bb68ad972b1f5b4b941
Author: Mike Jolley <mike.jolley@me.com>
Date:   Tue May 25 12:49:13 2021 +0100

    Add key to each `CartTotalItem` (https://github.com/woocommerce/woocommerce-blocks/pull/4240)

    * Move type defs

    * Move type guards

    * Fix imports

    * Extract prepareTotalItems to TS file

    * usePaymentMethodInterface as TS file

    * Fix TS props

    * Fix currency type defs

    * Add return type to usePaymentMethodInterface

    * Add key prop to CartTotalItem

    * Fixed up js tests

    * Move SymbolPosition into type-defs package

    Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>

commit c15e5123e47952f445fe159522f72cef290c9276
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date:   Tue May 25 10:46:28 2021 +0100

    Fix duplicate plugins by using wp.components global in the editor. (https://github.com/woocommerce/woocommerce-blocks/pull/4211)

    * fix duplicate slotProvider

    * load file on demand

    * add comment and load components in blocks as well

    * add todo block

commit e2cf0baad0ee91f892a1cb1919ad0edbab0122c3
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Tue May 25 08:43:46 2021 +0100

    Hide "including X in taxes" when the amount of tax is 0 (https://github.com/woocommerce/woocommerce-blocks/pull/4262)

    * Hide "including x in taxes" if tax amount is 0

    * Add jest types to tsconfig

    * Move SHOW_TAXES into component body

    This is to make the code more testable and allows us to change values. There's no significant performance impact because of this change.

    * Add tests and snapshots for TotalsFooterItem

commit 9b44c884fc68d81d6211f40f13409fac8503c2e3
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon May 24 18:14:37 2021 +0100

    Update dependency @octokit/graphql to v4.6.2 (https://github.com/woocommerce/woocommerce-blocks/pull/4230)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 4973132a90ddc88e075d6d421c8677cf032c3264
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon May 24 16:40:05 2021 +0100

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4253)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit b7eabf54bad4b7e08c7f4ef1484f7fea7ab64f20
Author: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
Date:   Fri May 21 09:53:46 2021 +0200

    Block Widgets: hide legacy widgets with a feature-complete block equivalent (https://github.com/woocommerce/woocommerce-blocks/pull/4237)

    * Block Widgets: hide legacy widgets with block equivalent

    * Unhide Products and Products by Rating widgets

commit 47556b9a39125423409dea8a3ae8c8ac34396fc0
Author: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
Date:   Fri May 21 09:52:27 2021 +0200

    Block Widgets: hide All Products and Filter blocks in the Customizer (https://github.com/woocommerce/woocommerce-blocks/pull/4225)

commit 208b21281763652bdcddb7390dfe955bddff4728
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Thu May 20 17:56:56 2021 +0100

    Move `TextInput` to checkout package and allow it to be used for input type=number (https://github.com/woocommerce/woocommerce-blocks/pull/4238)

    * Move text-input to checkout package

    * Pass validation props directly to ValidatedTextInput

    * Import label relatively instead of from package

    * Pass validation functions to ValidatedTextInput

    This is so it doesn't need to get them from useValidationContext.

    * Add InputProps to ValidatedTextInput

    This will be used to control additional props on the input element of TextInput

    * Spread inputProps onto <input> element of TextInput

    * Export TextInput from @woocommerce/blocks-checkout

    * Add @woocommerce/blocks-checkout package to tsconfig

    * Allow styling to be applied to number inputs and when value is 0

    * Make style order consistent

    * Remove inputProps to rely on rest in TextInput

    * Add specific prop for the inputErrorComponent

    * Only disallow active state if value is 0 AND type is number

    * Change all uses of ValidatedTextInput to also pass inputErrorComponent

    * Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent"

    This reverts commit ec734b99c20c4d29fcf778714246fc406ee37eaf.

    * Revert "Remove inputProps to rely on rest in TextInput"

    This reverts commit 1fc64cca4002206423d1fa443ff2d60130ba1ea0.

    * Revert "Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent""

    This reverts commit 110e3606a996668be5a32698b634b7706d16cddc.

    * Revert "Revert "Remove inputProps to rely on rest in TextInput""

    This reverts commit aeb03526c44b3fcc97a719a18930d08157a80baf.

    * Don't pass errorMessage to ValidatedTextInput

commit 55f5bfd8cd720022380de1e811e8d1abb622209b
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu May 20 15:07:12 2021 +0100

    Create LICENSE (https://github.com/woocommerce/woocommerce-blocks/pull/4235)

commit 0b10f75ddf3d01c837f466f9d3f85dbc760b3d7b
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Thu May 20 10:58:59 2021 +0200

    Update @woocommerce/components (https://github.com/woocommerce/woocommerce-blocks/pull/4100)

    * Add isCompact prop to components using SearchListControl

    * Update @woocommerce/components to 6.1.2

    * Remove legacy CSS code

    * Add some CSS rules to override conflicting editor styles

    * Replace showCount prop with has-count class name

    * Create ExpandableSearchListItem component

    * Refactor ProductControl so it uses ExpandableSearchListItem

    * Update @woocommerce/components to 6.2.0

    * Fix @woocommerce/components builds breaking

    * Fix a11y of expandable item list children

    * Set categories to an empty array by default

    * Render compact control in Attribute filter sidebar

    * Add countLabel to ProductAttributeTermControl

    * Fix ProductTagControl selected items

    * Use sentence case for countLabel

    * Fix wrong margins in block editor

    * Fix checkbox alignment

    * Update package-lock.json

    * Fix withCategories test

    * Fix JS error in Filter Products by Attribute block

    * Make input ids unique

commit 587be17d62db7b956c980fac4766456511243e10
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Wed May 19 10:55:15 2021 +0100

    Convert TextInput and ValidatedTextInput to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/4226)

    * Change index file from base/context to .ts

    This is to stop TS complaining when importing things from here.

    * Convert ValidatedTextInput to TypeScript

    * Convert TextInput to TypeScript

    * Ensure Label accepts correct HTML Attributes Props

    * Remove PropTypes from TextInput and ValidatedTextInput

    No longer needed because of TypeScript

    * Use correct error id to show validation message

    * Use HTMLElement instead of a specific element type for LabelProps

    * Update assets/js/base/components/text-input/validated-text-input.tsx

    Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

    * Update assets/js/base/components/text-input/validated-text-input.tsx

    * Use correct formatting in ValidatedTextInput

    Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

commit 731c75e03100695131b4ec6afa8994e6cf9f4c00
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 07:36:46 2021 +0000

    Update dependency @testing-library/react-hooks to v5.1.3 (https://github.com/woocommerce/woocommerce-blocks/pull/4233)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit ef6ad8882310dff6d1aa4ae847289acddc0dfebb
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 04:36:44 2021 +0000

    Update dependency @types/lodash to v4.14.169 (https://github.com/woocommerce/woocommerce-blocks/pull/4234)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 096463ea4bf1bddc7d61e1b04320886ee2f21770
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 03:46:21 2021 +0000

    Update dependency @testing-library/react to v11.2.7 (https://github.com/woocommerce/woocommerce-blocks/pull/4232)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 8722839350e6725ea80da994bb8387966b75061c
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 02:48:45 2021 +0000

    Update dependency @stripe/react-stripe-js to v1.4.1 (https://github.com/woocommerce/woocommerce-blocks/pull/4231)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 2f7e8edfebff59eeeeeb18d65fd658d5f432419e
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 01:32:34 2021 +0000

    Pin dependency @types/wordpress__deprecated to 2.4.2 (https://github.com/woocommerce/woocommerce-blocks/pull/4229)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 72e851a28c88653204ed8e4eff10c6bb2cb40c68
Author: Raluca Stan <raluca.stan@automattic.com>
Date:   Tue May 18 15:09:30 2021 +0200

    Fix e2e checkout tests and adjust jest setup (https://github.com/woocommerce/woocommerce-blocks/pull/4216)

    * Fix checkout test
    - make tests independent & test also for empty cart case
    - make sure the Order summary is expanded with a better selector
    * Remove unnecessary localStorage operations from tests
    * Go to cart page before removing an item from cart
    * Remove logging observing before tests
    This removes unnecessary console.log interception. A big part of the logic was done for Puppeteer 1.6.1, but since 3.0.0 message.text() returns string. We allow console.error messages to surface in our tests. Although they don't cause the test to fail it might be a good addition for debugging purposes.

commit 7b7119cfb0cfce5e1718804ca590a6b161d555f2
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue May 18 11:27:27 2021 +0100

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4212)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 5f84e7dabbc788b769646a9bcba5a15a57b03e33
Author: Mike Jolley <mike.jolley@me.com>
Date:   Tue May 18 10:37:31 2021 +0100

    Convert checkout state context provider to Typescript (https://github.com/woocommerce/woocommerce-blocks/pull/4200)

    * git move to ts files

    * Type the checkout state provider

    * Restore for loop for error handling

    * Types not needed

    * Consolodate response handling

    * Unused import

    * Fix defaults for onCheckoutAfterProcessingWithSuccess etc

    * Type useEmitResponse and remove isObject checks

    * useEmitResponse as const

    * Check that redirectUrl is string

    * Define actions as const

    * data.redirectUrl should be truthy

    * Add redirectURL todo item as followup

    * remove null fallback

commit fccc72bedb0f320995f62ee5d91b1c8e2e9c2fa1
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Tue May 18 09:10:31 2021 +0100

    Move Button and Label components to `@woocommerce/blocks-checkout` package (https://github.com/woocommerce/woocommerce-blocks/pull/4222)

    * Move Button to checkout package

    * Move Label to Components Package

commit 0b91fbeac282f729dbc8e8056d2e934392f401c0
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Mon May 17 15:00:57 2021 +0100

    Update design of cart and checkout sidebars (https://github.com/woocommerce/woocommerce-blocks/pull/4180)

    * Update cart/coupon/shipping design

    * Add order summary heading

    * Move and style discounts on checkout sidebar

    * Add rate to tax lines

    * Ensure the option to display taxes itemised is available to Cart block

    * Output individual tax items below the total & add styles for this

    * Add success notice under coupon input on successful coupon addition

    * Add border to bottom of Totals footer

    * Show success message when adding coupon

    * Add padding to cart item rows

    * Add preview data to cart for when taxes are enabled

    * Add rate to cart response type

    * Add showRateAfterTaxName attribute to Cart block

    * Add control to cart block to show rate percentage after rate name

    * Add rate % in cart totals only if option is toggled on

    * Pass showRateAfterTaxName attribute down to TotalsTaxes

    * Add showRateAfterTaxName to Checkout block

    * Add control to block editor for showRateAfterTaxName on Checkout

    * Pass showRateAfterTaxName down to TotalsTaxes in Checkout

    * Change label for showing tax rates in cart and checkout blocks

    * Add test to ensure Taxes section shows in Cart block

    * Add tests for cart sidebar and rate percentages

    * Remove order summary title from checkout sidebar

    * Check if taxes are enabled before rendering the option to show rate %s

    * Add ShippingVia component to show the selected rate in sidebar

    * Remove value from individual tax rates

    * Remove bold from Shipping via label

    * Remove coupon added successfully message

    * Ensure panel headings that are h2s are the same colour as others

    * Clean up eslint warnings

    * Show rate %s by default

    * Update snapshots following design changes

    Co-authored-by: Mike Jolley <mike.jolley@me.com>

commit 0464883ec668332db5a6399569880e7b3fa3ab3f
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Sun May 16 20:00:06 2021 +0200

    Don't default to fallback in getSetting if value is falsy (https://github.com/woocommerce/woocommerce-blocks/pull/4202)

commit f95f12d3215caf30f1f49e1d29c5826156914a33
Author: Mike Jolley <mike.jolley@me.com>
Date:   Sun May 16 18:59:32 2021 +0100

    Fix es lint warnings (https://github.com/woocommerce/woocommerce-blocks/pull/4206)

    * Un-used PropTypes import

    * Avoid global and use ownerDocument

    * receiveCart return type

    * ignoreRestSiblings when destructuring for @typescript-eslint/no-unused-vars

    * Replace lodash find

    * Use global rather than window

    * Remove lodash map

    * move rule to overrides

commit db589e7e7f4809504b1aa83144116506a50bdd38
Author: Raluca Stan <raluca.stan@automattic.com>
Date:   Sun May 16 19:41:34 2021 +0200

    Fix cart and checkout frontend e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/4199)

    * Wip: fix e2e fe tests

    * Test that navigation ends

    * Fix waitForNavigation

    * comment out failing php test

    * click the dom element

    * Ensure navigation happens by waiting for it. Test page title.

    * remove skip and update docs

    * Revert "comment out failing php test"

    This reverts commit 7c40e8caf3aa32e35e3b70eb32051251b06e0613.

    * Fix USD from merge conflict

    * Add missing check for page title

    * Try page.waitForFunction for text search

    * test to see checkout page title is correct

    * test checkout page url on CI

    * unde jest config change

    * Fix assertion for checkout page

    * remove extra localStorage item remove call

    Co-authored-by: Mike Jolley <mike.jolley@me.com>
    Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>

commit b9b66f93adb5b0fdc22fc4ed9560eb6e2c1c72d9
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu May 13 11:49:39 2021 +0100

    Set order status to pending when no payment is needed (https://github.com/woocommerce/woocommerce-blocks/pull/4186)

commit 8ed63f765418ae8e7b2ee58004b4a9b1306eaeef
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu May 13 11:21:21 2021 +0100

    Remove the need for the `canMakePayment` callback in the editor context (https://github.com/woocommerce/woocommerce-blocks/pull/4188)

    * Force can pay true in editor context

    * Update docs

commit 90499cb3191137264ffde07cf082db8c4d6f77de
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu May 13 11:20:37 2021 +0100

    Sync customer data during checkout with draft orders. (https://github.com/woocommerce/woocommerce-blocks/pull/4197)

    * Update store when email changes

    * Add pluckEmail helper and convert to TS

    * improve guard

    * sync draft order with customer data

commit a813c931bb5f85f139429aa3bf094b2327a7f8cd
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Thu May 13 12:14:15 2021 +0200

    Set default store currency to USD in tests (https://github.com/woocommerce/woocommerce-blocks/pull/4203)

commit b1408933f75ca47dc39335984bfc1fe570a72aaa
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu May 13 10:16:04 2021 +0200

    Update dependency config to v3.3.6 (https://github.com/woocommerce/woocommerce-blocks/pull/4195)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit d68bb11bb56d882f8755162ae6657cad76dfd16f
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu May 13 10:15:35 2021 +0200

    Update dependency cssnano to v4.1.11 (https://github.com/woocommerce/woocommerce-blocks/pull/4196)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit beadbab90fe0813c0f36cc25a9e0b14a8f8e96d2
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date:   Wed May 12 13:32:05 2021 +0100

    Add cart data to filters (https://github.com/woocommerce/woocommerce-blocks/pull/4164)

    * add cart data to filters

    * add extensions back to footer filter

commit c10fdf26bc37b1efb6b22d045e3aed72f5541a2a
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 12 13:04:44 2021 +0100

    Pin dependency lodash to 4.17.21 (https://github.com/woocommerce/woocommerce-blocks/pull/4193)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit f92aac55f1a6fd67fba3885311ec74bcdb41034e
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 12 13:04:13 2021 +0100

    Update dependency chalk to v4.1.1 (https://github.com/woocommerce/woocommerce-blocks/pull/4194)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 27cff5109889c0abca24124c1dabcb0b78da4929
Author: Mike Jolley <mike.jolley@me.com>
Date:   Wed May 12 13:02:26 2021 +0100

    Should be using value rather than name (https://github.com/woocommerce/woocommerce-blocks/pull/4187)

commit 560972a7eb306b6a27c298b7e3218df92a848e79
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Tue May 11 13:57:02 2021 +0100

    Add checkout filter for coupon names (https://github.com/woocommerce/woocommerce-blocks/pull/4166)

    * Make extensions optional, not all filters will need to pass this through

    For example the CartCouponSchema has no option for extensibility (and I don't think it's needed at any rate) so extensions will always be an empty object. Rather than explicitly specifying this when running the filter, we can let it default to an empty object.

    * Add filter for coupon code

commit 556ceb4b8a222466a73aae1ee0eac545e00802b4
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Tue May 11 11:45:02 2021 +0100

    Check if variation data is iterable before formatting (https://github.com/woocommerce/woocommerce-blocks/pull/4182)

commit 4279db88057e83eff8af077a96eeb19dd247a8d2
Author: Darren Ethier <darren@roughsmootheng.in>
Date:   Mon May 10 11:21:01 2021 -0400

    update package-lock (version change mostly)

commit f71b24ad0f634c2cb8aeac8ae80e0ccd139a4fcd
Author: Darren Ethier <darren@roughsmootheng.in>
Date:   Mon May 10 11:16:58 2021 -0400

    update version string to dev version

commit 7f9c1b2913f9c06f4d755519ef2689c56703a2c0
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Mon May 10 11:14:05 2021 -0400

    Release: 5.1.0 (https://github.com/woocommerce/woocommerce-blocks/pull/4185)

    * Empty commit for release pull request

    * Add changelog

    * update testing notes

    * Bumping version strings to new version.

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

commit 80c27354e1eb83d027eb9670aed59885c2097d3d
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon May 10 14:38:04 2021 +0200

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4184)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 90074cf871d8691d0adf5808e59a75b9ace98fa7
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Mon May 10 10:03:30 2021 +0100

    Convert shipping components to typescript (https://github.com/woocommerce/woocommerce-blocks/pull/4135)

    * Add type defs for customer

    Taken from 194ecccf78/assets/js/type-defs/customer.ts

    * Convert ShippingCalculatorAddress to TypeScript

    * Convert ShippingCalculator to TypeScript

    * Convert ShippingLocation to TypeScript

    * Allow packageId to be a number or string in useSelectShippingRate(s)

    * Convert ShippingRatesControl to TypeScript

    * Convert ShippingOptionsStep to TypeScript

    * Allow package_id to be a string or number

    This is because of Subscriptions using strings for package IDs

    * Change to use CartShippingRateItemShippingRate instead of Rate

    * Add extra props to PackageProps type

    * Make ShippingAddress have the correct type

    * Use CartShippingRateItemShippingRate instead of Rate

    * Remove Rate type

    * Set return types to JSX.Element

    * Change type of props.renderOption in ShippingRatesControl

    * Remove customer type defs and relocate aliases to default-address-fields

    * Add EnteredAddress type

    * Import EnteredAddress from new location

    * Remove unnecessary eslint ignore

    * Remove unused variable

    * Remove confusing use of word Item in Shipping types

    * Remove confusing use of word Item in Shipping types

commit 3f1be394d076bdc2a407c05d1fbf290a17c55c43
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Mon May 10 10:00:14 2021 +0200

    Feature gate PaymentApi (https://github.com/woocommerce/woocommerce-blocks/pull/4176)

    * Feature gate PaymentApi

    * Improve payment method missing dependencies error message so it's clear it only affects blocks

    * Add PaymentApi feature flags to list of feature flags in docs

commit ed7eded4d7134d1b69d0fd206cd1315fd9d2d40f
Author: Darren Ethier <darren@roughsmootheng.in>
Date:   Fri May 7 16:39:28 2021 -0400

    Improvements to `emitEventWithAbort`. (https://github.com/woocommerce/woocommerce-blocks/pull/4158)

    * modify emitEventWithAbort to change return value

    `emitEventWithAbort` now returns an array of responses up to the first response that triggered an error or fail response instead of aborting on success responses too.

    * update add to cart form context provider

    * update checkout state context provider

    * update payment method data context provider

    * update tests and fix thrown error handling.

commit 2be9a4ea4405d5df427f4e97025aa5433019b72f
Author: Raluca Stan <raluca.stan@automattic.com>
Date:   Fri May 7 15:50:55 2021 +0200

    Add lodash as a devDependency (https://github.com/woocommerce/woocommerce-blocks/pull/4179)

commit 69b3679a7e585abc8a5068df3bd2457714149939
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date:   Wed May 5 12:59:30 2021 +0100

    Don't clear email and phone fields when using separate billing address. (https://github.com/woocommerce/woocommerce-blocks/pull/4162)

    * preseve-billing-data

    * pluck empty email and phone

    * add issue number

commit 214014750c0a1414e89ce47d84754d278e5a164f
Author: Raluca Stan <raluca.stan@automattic.com>
Date:   Wed May 5 13:52:27 2021 +0200

    Fix/cart backend test (https://github.com/woocommerce/woocommerce-blocks/pull/4153)

    * Fix backend cart e2e test

    * Adjust test structure

    * Fix e2e checkout backend test.

    Make sure the confirmation window is closed

commit f8d9b9084c091f97b281f58a64f98622765a80e3
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 5 10:08:45 2021 +0000

    Update dependency @stripe/stripe-js to v1.14.0 (https://github.com/woocommerce/woocommerce-blocks/pull/4170)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 2391a40ab24439b14f56d1d6416beaf0c2d94c53
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Wed May 5 10:41:48 2021 +0100

    Add documentation for filters (https://github.com/woocommerce/woocommerce-blocks/pull/4167)

    * Rename the argument in the CheckoutFilterFunction type

    This only exists as an extra descriptive hint to anyone using this type, the value `label` was never used by anything so it does not need to be changed anywhere else.

    * Create Available Filters document

    * Add available filters to the extensibility README

    * Update docs/extensibility/available-filters.md to fix typographical error

    Co-authored-by: Mike Jolley <mike.jolley@me.com>

    Co-authored-by: Mike Jolley <mike.jolley@me.com>

commit f4af89b2fce203c4f173845244724f58669a04f9
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 5 08:10:24 2021 +0000

    Update dependency @woocommerce/e2e-utils to v0.1.4 (https://github.com/woocommerce/woocommerce-blocks/pull/4172)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 6c9e786c407fd1bd6861bde3b435cec0663b8399
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 5 03:31:52 2021 +0000

    Update dependency @types/react to v16.14.6 (https://github.com/woocommerce/woocommerce-blocks/pull/4171)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 3ba4d9ed6a46f3700a7190d09eff2ba53d1bcb60
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 5 02:23:13 2021 +0000

    Update babel monorepo (https://github.com/woocommerce/woocommerce-blocks/pull/4169)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 35f71df36f92028cfb880e314623b33c077a384d
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue May 4 14:07:05 2021 +0100

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4163)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 4c65211b375e40691aeea7273eec34f3f54a0b3b
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 14:09:28 2021 +0000

    Coped package-lock.json from trunk

commit 703cb65efb8fd4ced58234d5174dc198e225e07a
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 14:00:32 2021 +0000

    Reverted package-lock.json ( downgraded node version to 12 )

commit 41dfd79715d4b4f1e5cebd0e7dccfc1573ba4d36
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 11:12:45 2021 +0000

    Pre pull request clean up code

commit 75fc62e99ed63389c158352b73ae898c986d92bd
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Tue Apr 27 13:03:24 2021 +0000

    Added Stock Status filter

commit e7bd0e6e1e171a041ac17b8b11abc812585f7645
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 16:53:56 2021 +0400

    Escape statuses for sql query

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

commit 29c8493aaeb6dca6b3cf5e1954a39564ea304d87
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 16:53:18 2021 +0400

    Allow custom stock statuses

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

commit 63ecd04bf09a53049bdb10d3919acf6ced7ead8a
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 28 06:22:04 2021 +0000

    Bring back removed css

commit 27e0233cb67f60f650856455a0ff32c6d73c35e3
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Tue Jul 27 23:35:15 2021 +0400

    Update assets/js/blocks/stock-filter/block.js

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

commit 136c32ddd3f485be5aeab274c675743a235a8c25
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Thu Jul 15 06:50:06 2021 +0000

    Fixed preview part for stock and attribute filters

commit ef89751b634bf223f065067f47f726b662d75ef3
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 20:15:05 2021 +0400

    Update index.js

commit a63dbcef7058ffd858a71931b6fc2ead0583ae03
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:43:06 2021 +0000

    Review suggestion changes

commit 6b0f5d2206d010c1822ab7eaf4edea9a0b79526d
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:40:52 2021 +0000

    Linter fix

commit 791b38b31782367864e1bb8f26716b7fef0e63a8
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:37:41 2021 +0000

    Removed hideOutOfStock from AllProducts and realized hide out of stock functionality from SQL query

commit 1a7a002d5eac271c6f2331e3e66411f3127282b1
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:21:51 2021 +0000

    Created new component for Filters elements labels

commit d9b7fae24d4235a0f8f424e7e74cd250e62bc897
Author: aaron <aaron.yor@gmail.com>
Date:   Wed Jun 2 11:57:06 2021 +0400

    Fix label includ path

commit 5311584362dca4c6e5a91de5fdfbff29297799ea
Merge: 92a0da3f 1b87589f
Author: aaron <aaron.yor@gmail.com>
Date:   Wed Jun 2 11:52:48 2021 +0400

    Merge remote-tracking branch 'core/trunk' into add/stock-filter

    # Conflicts:
    #	package-lock.json

commit d8e6dabaa3282855c6c91c908d6a1443ea9732f1
Merge: 583113e3 2b695215
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Apr 30 12:28:09 2021 +0400

    Merge pull request woocommerce/woocommerce-blocks#1 from woocommerce/trunk

    Fork update

commit 92a0da3f8c37aa46ce2330cb8095ab7077d01555
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 14:09:28 2021 +0000

    Coped package-lock.json from trunk

commit ae0d12b57a5be6f1a39577404c017174489345f8
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 14:00:32 2021 +0000

    Reverted package-lock.json ( downgraded node version to 12 )

commit 5e0c7f9fe36bc9358743b7af7d9e47ce66f8ac08
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 11:12:45 2021 +0000

    Pre pull request clean up code

commit 105b3f75a2b42f12f6924091f51bfa91c84b4984
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Tue Apr 27 13:03:24 2021 +0000

    Added Stock Status filter
2021-08-20 16:07:14 +01:00
Thomas Roberts 8f2bc114a4 Revert "Add "Filter Products by Stock" block (https://github.com/woocommerce/woocommerce-blocks/pull/4145)"
This reverts commit 44db8317a7.
2021-08-20 16:05:38 +01:00
Thomas Roberts 44db8317a7 Add "Filter Products by Stock" block (https://github.com/woocommerce/woocommerce-blocks/pull/4145)
commit 4fccfd88998fde20b603d99d9866d3cb08cf7bf4
Merge: 8012b2b4 e7bd0e6e
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 13:17:42 2021 +0000

    Merge from trunk

commit 8012b2b40e95b90e507698de677fba059ca9ef0a
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 16:53:56 2021 +0400

    Escape statuses for sql query

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

commit 304348aeb5448153ad3365ff09ca37f265af87cc
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 16:53:18 2021 +0400

    Allow custom stock statuses

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

commit b2f01e4ed6738ef3091afbac7d4131c984b33bc7
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 28 06:22:04 2021 +0000

    Bring back removed css

commit caafffda5de6d3f31b817ab4886847958f693e24
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Tue Jul 27 23:35:15 2021 +0400

    Update assets/js/blocks/stock-filter/block.js

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

commit ae381de8aa49d0b16d2dabff7b6ecffedc511460
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Thu Jul 15 06:50:06 2021 +0000

    Fixed preview part for stock and attribute filters

commit 7df5feab0a33f93786a29a625c1f27a4737c25bc
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 20:15:05 2021 +0400

    Update index.js

commit af0294ce6a21a0032c7eeb00fe986eddda188574
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:43:06 2021 +0000

    Review suggestion changes

commit 16da25340fd7438e0fedd62b3e8b52bc33b80852
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:40:52 2021 +0000

    Linter fix

commit 594125a68c5c0d854418d5f3e76fb0e18c23b0a4
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:37:41 2021 +0000

    Removed hideOutOfStock from AllProducts and realized hide out of stock functionality from SQL query

commit 94a54e3c7c8cb94323d41a11c6bb603d0648792e
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:21:51 2021 +0000

    Created new component for Filters elements labels

commit e3d7fb2aad4b123693f0104c2ffd9af2a1273900
Author: aaron <aaron.yor@gmail.com>
Date:   Wed Jun 2 11:57:06 2021 +0400

    Fix label includ path

commit c9e3d02d5bf03614cbfd2d17ec1558dacc3252f1
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date:   Tue Jun 1 09:46:02 2021 +0100

    remove usage of mustBeString (https://github.com/woocommerce/woocommerce-blocks/pull/4294)

commit b8923390e5d5433ef2c8a14891684b907051cd7e
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon May 31 16:07:59 2021 +0100

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4290)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 6de68e41e2053a79cdce3e9d820c9b5656072685
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Thu May 27 12:57:49 2021 +0100

    Check if product can be added to cart before adding ajax class to button (https://github.com/woocommerce/woocommerce-blocks/pull/4265)

commit a1ccaf4143dd9cd86f0f88ce956bcf7edb5e419a
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Wed May 26 16:10:43 2021 +0100

    Update version for next release

commit 24f882f5d53776abe2ee6440d68485083b5a8340
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Wed May 26 15:42:21 2021 +0100

    Bumping version strings to new version.

commit e1fd0825b72d7cc87c6f26329359cc39278cc760
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Wed May 26 15:31:37 2021 +0100

    Update link to testing zip

commit 35521e54b756bf265cf6d61437cd5f55629fc2d4
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Wed May 26 14:04:42 2021 +0100

    Fix display of itemised taxes (https://github.com/woocommerce/woocommerce-blocks/pull/4279)

    * Add price to itemised tax rates & hide Total when itemised taxes are on

    * Update snapshots for taxes in sidebar

commit 7f3a1e629f04dcb71d3fb4313b3012aef13feb5f
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 26 08:52:31 2021 +0000

    Update dependency downshift to v6.1.3 (https://github.com/woocommerce/woocommerce-blocks/pull/4272)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 593ef2b07f71341b3d0fc143876c24a4d50a64fb
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 26 05:04:55 2021 +0000

    Update dependency @types/react to v16.14.8 (https://github.com/woocommerce/woocommerce-blocks/pull/4270)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 21f16d6d4ef10ada3f1631f72b4fb7dec1f4af72
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 26 03:47:54 2021 +0000

    Update dependency @woocommerce/e2e-utils to v0.1.5 (https://github.com/woocommerce/woocommerce-blocks/pull/4271)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 444256ea70c8b9ac89b4f4d5913396da9f4334cd
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 26 02:30:17 2021 +0000

    Update dependency @types/lodash to v4.14.170 (https://github.com/woocommerce/woocommerce-blocks/pull/4269)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 5f9df572aed0b07606c7a4e5b684122a48862f94
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Tue May 25 15:31:03 2021 +0100

    Create 5.2.0 testing notes

commit 45abda651a668ddc4b1d36e8c76cf19d365d94c8
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Tue May 25 14:52:37 2021 +0100

    Update package.json

    npm ci was not working correctly this will fix it.

commit c3daa6ce4c71b956e08200442626a0e29a3e5daf
Author: Thomas Roberts <thomas.roberts@automattic.com>
Date:   Tue May 25 14:26:32 2021 +0100

    Update changelog and WC tested up to

commit 61283092b32425450f4450d5224e156d24aa38ba
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Thu May 20 17:56:56 2021 +0100

    Revert "Move `TextInput` to checkout package and allow it to be used for input type=number (https://github.com/woocommerce/woocommerce-blocks/pull/4238)"

    This reverts commit ee9b2d20e0.

commit 193267b041e8e0fb9fe89bb68ad972b1f5b4b941
Author: Mike Jolley <mike.jolley@me.com>
Date:   Tue May 25 12:49:13 2021 +0100

    Add key to each `CartTotalItem` (https://github.com/woocommerce/woocommerce-blocks/pull/4240)

    * Move type defs

    * Move type guards

    * Fix imports

    * Extract prepareTotalItems to TS file

    * usePaymentMethodInterface as TS file

    * Fix TS props

    * Fix currency type defs

    * Add return type to usePaymentMethodInterface

    * Add key prop to CartTotalItem

    * Fixed up js tests

    * Move SymbolPosition into type-defs package

    Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>

commit c15e5123e47952f445fe159522f72cef290c9276
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date:   Tue May 25 10:46:28 2021 +0100

    Fix duplicate plugins by using wp.components global in the editor. (https://github.com/woocommerce/woocommerce-blocks/pull/4211)

    * fix duplicate slotProvider

    * load file on demand

    * add comment and load components in blocks as well

    * add todo block

commit e2cf0baad0ee91f892a1cb1919ad0edbab0122c3
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Tue May 25 08:43:46 2021 +0100

    Hide "including X in taxes" when the amount of tax is 0 (https://github.com/woocommerce/woocommerce-blocks/pull/4262)

    * Hide "including x in taxes" if tax amount is 0

    * Add jest types to tsconfig

    * Move SHOW_TAXES into component body

    This is to make the code more testable and allows us to change values. There's no significant performance impact because of this change.

    * Add tests and snapshots for TotalsFooterItem

commit 9b44c884fc68d81d6211f40f13409fac8503c2e3
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon May 24 18:14:37 2021 +0100

    Update dependency @octokit/graphql to v4.6.2 (https://github.com/woocommerce/woocommerce-blocks/pull/4230)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 4973132a90ddc88e075d6d421c8677cf032c3264
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon May 24 16:40:05 2021 +0100

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4253)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit b7eabf54bad4b7e08c7f4ef1484f7fea7ab64f20
Author: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
Date:   Fri May 21 09:53:46 2021 +0200

    Block Widgets: hide legacy widgets with a feature-complete block equivalent (https://github.com/woocommerce/woocommerce-blocks/pull/4237)

    * Block Widgets: hide legacy widgets with block equivalent

    * Unhide Products and Products by Rating widgets

commit 47556b9a39125423409dea8a3ae8c8ac34396fc0
Author: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
Date:   Fri May 21 09:52:27 2021 +0200

    Block Widgets: hide All Products and Filter blocks in the Customizer (https://github.com/woocommerce/woocommerce-blocks/pull/4225)

commit 208b21281763652bdcddb7390dfe955bddff4728
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Thu May 20 17:56:56 2021 +0100

    Move `TextInput` to checkout package and allow it to be used for input type=number (https://github.com/woocommerce/woocommerce-blocks/pull/4238)

    * Move text-input to checkout package

    * Pass validation props directly to ValidatedTextInput

    * Import label relatively instead of from package

    * Pass validation functions to ValidatedTextInput

    This is so it doesn't need to get them from useValidationContext.

    * Add InputProps to ValidatedTextInput

    This will be used to control additional props on the input element of TextInput

    * Spread inputProps onto <input> element of TextInput

    * Export TextInput from @woocommerce/blocks-checkout

    * Add @woocommerce/blocks-checkout package to tsconfig

    * Allow styling to be applied to number inputs and when value is 0

    * Make style order consistent

    * Remove inputProps to rely on rest in TextInput

    * Add specific prop for the inputErrorComponent

    * Only disallow active state if value is 0 AND type is number

    * Change all uses of ValidatedTextInput to also pass inputErrorComponent

    * Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent"

    This reverts commit ec734b99c20c4d29fcf778714246fc406ee37eaf.

    * Revert "Remove inputProps to rely on rest in TextInput"

    This reverts commit 1fc64cca4002206423d1fa443ff2d60130ba1ea0.

    * Revert "Revert "Change all uses of ValidatedTextInput to also pass inputErrorComponent""

    This reverts commit 110e3606a996668be5a32698b634b7706d16cddc.

    * Revert "Revert "Remove inputProps to rely on rest in TextInput""

    This reverts commit aeb03526c44b3fcc97a719a18930d08157a80baf.

    * Don't pass errorMessage to ValidatedTextInput

commit 55f5bfd8cd720022380de1e811e8d1abb622209b
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu May 20 15:07:12 2021 +0100

    Create LICENSE (https://github.com/woocommerce/woocommerce-blocks/pull/4235)

commit 0b10f75ddf3d01c837f466f9d3f85dbc760b3d7b
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Thu May 20 10:58:59 2021 +0200

    Update @woocommerce/components (https://github.com/woocommerce/woocommerce-blocks/pull/4100)

    * Add isCompact prop to components using SearchListControl

    * Update @woocommerce/components to 6.1.2

    * Remove legacy CSS code

    * Add some CSS rules to override conflicting editor styles

    * Replace showCount prop with has-count class name

    * Create ExpandableSearchListItem component

    * Refactor ProductControl so it uses ExpandableSearchListItem

    * Update @woocommerce/components to 6.2.0

    * Fix @woocommerce/components builds breaking

    * Fix a11y of expandable item list children

    * Set categories to an empty array by default

    * Render compact control in Attribute filter sidebar

    * Add countLabel to ProductAttributeTermControl

    * Fix ProductTagControl selected items

    * Use sentence case for countLabel

    * Fix wrong margins in block editor

    * Fix checkbox alignment

    * Update package-lock.json

    * Fix withCategories test

    * Fix JS error in Filter Products by Attribute block

    * Make input ids unique

commit 587be17d62db7b956c980fac4766456511243e10
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Wed May 19 10:55:15 2021 +0100

    Convert TextInput and ValidatedTextInput to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/4226)

    * Change index file from base/context to .ts

    This is to stop TS complaining when importing things from here.

    * Convert ValidatedTextInput to TypeScript

    * Convert TextInput to TypeScript

    * Ensure Label accepts correct HTML Attributes Props

    * Remove PropTypes from TextInput and ValidatedTextInput

    No longer needed because of TypeScript

    * Use correct error id to show validation message

    * Use HTMLElement instead of a specific element type for LabelProps

    * Update assets/js/base/components/text-input/validated-text-input.tsx

    Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

    * Update assets/js/base/components/text-input/validated-text-input.tsx

    * Use correct formatting in ValidatedTextInput

    Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

commit 731c75e03100695131b4ec6afa8994e6cf9f4c00
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 07:36:46 2021 +0000

    Update dependency @testing-library/react-hooks to v5.1.3 (https://github.com/woocommerce/woocommerce-blocks/pull/4233)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit ef6ad8882310dff6d1aa4ae847289acddc0dfebb
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 04:36:44 2021 +0000

    Update dependency @types/lodash to v4.14.169 (https://github.com/woocommerce/woocommerce-blocks/pull/4234)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 096463ea4bf1bddc7d61e1b04320886ee2f21770
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 03:46:21 2021 +0000

    Update dependency @testing-library/react to v11.2.7 (https://github.com/woocommerce/woocommerce-blocks/pull/4232)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 8722839350e6725ea80da994bb8387966b75061c
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 02:48:45 2021 +0000

    Update dependency @stripe/react-stripe-js to v1.4.1 (https://github.com/woocommerce/woocommerce-blocks/pull/4231)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 2f7e8edfebff59eeeeeb18d65fd658d5f432419e
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 19 01:32:34 2021 +0000

    Pin dependency @types/wordpress__deprecated to 2.4.2 (https://github.com/woocommerce/woocommerce-blocks/pull/4229)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 72e851a28c88653204ed8e4eff10c6bb2cb40c68
Author: Raluca Stan <raluca.stan@automattic.com>
Date:   Tue May 18 15:09:30 2021 +0200

    Fix e2e checkout tests and adjust jest setup (https://github.com/woocommerce/woocommerce-blocks/pull/4216)

    * Fix checkout test
    - make tests independent & test also for empty cart case
    - make sure the Order summary is expanded with a better selector
    * Remove unnecessary localStorage operations from tests
    * Go to cart page before removing an item from cart
    * Remove logging observing before tests
    This removes unnecessary console.log interception. A big part of the logic was done for Puppeteer 1.6.1, but since 3.0.0 message.text() returns string. We allow console.error messages to surface in our tests. Although they don't cause the test to fail it might be a good addition for debugging purposes.

commit 7b7119cfb0cfce5e1718804ca590a6b161d555f2
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue May 18 11:27:27 2021 +0100

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4212)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 5f84e7dabbc788b769646a9bcba5a15a57b03e33
Author: Mike Jolley <mike.jolley@me.com>
Date:   Tue May 18 10:37:31 2021 +0100

    Convert checkout state context provider to Typescript (https://github.com/woocommerce/woocommerce-blocks/pull/4200)

    * git move to ts files

    * Type the checkout state provider

    * Restore for loop for error handling

    * Types not needed

    * Consolodate response handling

    * Unused import

    * Fix defaults for onCheckoutAfterProcessingWithSuccess etc

    * Type useEmitResponse and remove isObject checks

    * useEmitResponse as const

    * Check that redirectUrl is string

    * Define actions as const

    * data.redirectUrl should be truthy

    * Add redirectURL todo item as followup

    * remove null fallback

commit fccc72bedb0f320995f62ee5d91b1c8e2e9c2fa1
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Tue May 18 09:10:31 2021 +0100

    Move Button and Label components to `@woocommerce/blocks-checkout` package (https://github.com/woocommerce/woocommerce-blocks/pull/4222)

    * Move Button to checkout package

    * Move Label to Components Package

commit 0b91fbeac282f729dbc8e8056d2e934392f401c0
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Mon May 17 15:00:57 2021 +0100

    Update design of cart and checkout sidebars (https://github.com/woocommerce/woocommerce-blocks/pull/4180)

    * Update cart/coupon/shipping design

    * Add order summary heading

    * Move and style discounts on checkout sidebar

    * Add rate to tax lines

    * Ensure the option to display taxes itemised is available to Cart block

    * Output individual tax items below the total & add styles for this

    * Add success notice under coupon input on successful coupon addition

    * Add border to bottom of Totals footer

    * Show success message when adding coupon

    * Add padding to cart item rows

    * Add preview data to cart for when taxes are enabled

    * Add rate to cart response type

    * Add showRateAfterTaxName attribute to Cart block

    * Add control to cart block to show rate percentage after rate name

    * Add rate % in cart totals only if option is toggled on

    * Pass showRateAfterTaxName attribute down to TotalsTaxes

    * Add showRateAfterTaxName to Checkout block

    * Add control to block editor for showRateAfterTaxName on Checkout

    * Pass showRateAfterTaxName down to TotalsTaxes in Checkout

    * Change label for showing tax rates in cart and checkout blocks

    * Add test to ensure Taxes section shows in Cart block

    * Add tests for cart sidebar and rate percentages

    * Remove order summary title from checkout sidebar

    * Check if taxes are enabled before rendering the option to show rate %s

    * Add ShippingVia component to show the selected rate in sidebar

    * Remove value from individual tax rates

    * Remove bold from Shipping via label

    * Remove coupon added successfully message

    * Ensure panel headings that are h2s are the same colour as others

    * Clean up eslint warnings

    * Show rate %s by default

    * Update snapshots following design changes

    Co-authored-by: Mike Jolley <mike.jolley@me.com>

commit 0464883ec668332db5a6399569880e7b3fa3ab3f
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Sun May 16 20:00:06 2021 +0200

    Don't default to fallback in getSetting if value is falsy (https://github.com/woocommerce/woocommerce-blocks/pull/4202)

commit f95f12d3215caf30f1f49e1d29c5826156914a33
Author: Mike Jolley <mike.jolley@me.com>
Date:   Sun May 16 18:59:32 2021 +0100

    Fix es lint warnings (https://github.com/woocommerce/woocommerce-blocks/pull/4206)

    * Un-used PropTypes import

    * Avoid global and use ownerDocument

    * receiveCart return type

    * ignoreRestSiblings when destructuring for @typescript-eslint/no-unused-vars

    * Replace lodash find

    * Use global rather than window

    * Remove lodash map

    * move rule to overrides

commit db589e7e7f4809504b1aa83144116506a50bdd38
Author: Raluca Stan <raluca.stan@automattic.com>
Date:   Sun May 16 19:41:34 2021 +0200

    Fix cart and checkout frontend e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/4199)

    * Wip: fix e2e fe tests

    * Test that navigation ends

    * Fix waitForNavigation

    * comment out failing php test

    * click the dom element

    * Ensure navigation happens by waiting for it. Test page title.

    * remove skip and update docs

    * Revert "comment out failing php test"

    This reverts commit 7c40e8caf3aa32e35e3b70eb32051251b06e0613.

    * Fix USD from merge conflict

    * Add missing check for page title

    * Try page.waitForFunction for text search

    * test to see checkout page title is correct

    * test checkout page url on CI

    * unde jest config change

    * Fix assertion for checkout page

    * remove extra localStorage item remove call

    Co-authored-by: Mike Jolley <mike.jolley@me.com>
    Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>

commit b9b66f93adb5b0fdc22fc4ed9560eb6e2c1c72d9
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu May 13 11:49:39 2021 +0100

    Set order status to pending when no payment is needed (https://github.com/woocommerce/woocommerce-blocks/pull/4186)

commit 8ed63f765418ae8e7b2ee58004b4a9b1306eaeef
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu May 13 11:21:21 2021 +0100

    Remove the need for the `canMakePayment` callback in the editor context (https://github.com/woocommerce/woocommerce-blocks/pull/4188)

    * Force can pay true in editor context

    * Update docs

commit 90499cb3191137264ffde07cf082db8c4d6f77de
Author: Mike Jolley <mike.jolley@me.com>
Date:   Thu May 13 11:20:37 2021 +0100

    Sync customer data during checkout with draft orders. (https://github.com/woocommerce/woocommerce-blocks/pull/4197)

    * Update store when email changes

    * Add pluckEmail helper and convert to TS

    * improve guard

    * sync draft order with customer data

commit a813c931bb5f85f139429aa3bf094b2327a7f8cd
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Thu May 13 12:14:15 2021 +0200

    Set default store currency to USD in tests (https://github.com/woocommerce/woocommerce-blocks/pull/4203)

commit b1408933f75ca47dc39335984bfc1fe570a72aaa
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu May 13 10:16:04 2021 +0200

    Update dependency config to v3.3.6 (https://github.com/woocommerce/woocommerce-blocks/pull/4195)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit d68bb11bb56d882f8755162ae6657cad76dfd16f
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu May 13 10:15:35 2021 +0200

    Update dependency cssnano to v4.1.11 (https://github.com/woocommerce/woocommerce-blocks/pull/4196)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit beadbab90fe0813c0f36cc25a9e0b14a8f8e96d2
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date:   Wed May 12 13:32:05 2021 +0100

    Add cart data to filters (https://github.com/woocommerce/woocommerce-blocks/pull/4164)

    * add cart data to filters

    * add extensions back to footer filter

commit c10fdf26bc37b1efb6b22d045e3aed72f5541a2a
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 12 13:04:44 2021 +0100

    Pin dependency lodash to 4.17.21 (https://github.com/woocommerce/woocommerce-blocks/pull/4193)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit f92aac55f1a6fd67fba3885311ec74bcdb41034e
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 12 13:04:13 2021 +0100

    Update dependency chalk to v4.1.1 (https://github.com/woocommerce/woocommerce-blocks/pull/4194)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 27cff5109889c0abca24124c1dabcb0b78da4929
Author: Mike Jolley <mike.jolley@me.com>
Date:   Wed May 12 13:02:26 2021 +0100

    Should be using value rather than name (https://github.com/woocommerce/woocommerce-blocks/pull/4187)

commit 560972a7eb306b6a27c298b7e3218df92a848e79
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Tue May 11 13:57:02 2021 +0100

    Add checkout filter for coupon names (https://github.com/woocommerce/woocommerce-blocks/pull/4166)

    * Make extensions optional, not all filters will need to pass this through

    For example the CartCouponSchema has no option for extensibility (and I don't think it's needed at any rate) so extensions will always be an empty object. Rather than explicitly specifying this when running the filter, we can let it default to an empty object.

    * Add filter for coupon code

commit 556ceb4b8a222466a73aae1ee0eac545e00802b4
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Tue May 11 11:45:02 2021 +0100

    Check if variation data is iterable before formatting (https://github.com/woocommerce/woocommerce-blocks/pull/4182)

commit 4279db88057e83eff8af077a96eeb19dd247a8d2
Author: Darren Ethier <darren@roughsmootheng.in>
Date:   Mon May 10 11:21:01 2021 -0400

    update package-lock (version change mostly)

commit f71b24ad0f634c2cb8aeac8ae80e0ccd139a4fcd
Author: Darren Ethier <darren@roughsmootheng.in>
Date:   Mon May 10 11:16:58 2021 -0400

    update version string to dev version

commit 7f9c1b2913f9c06f4d755519ef2689c56703a2c0
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Mon May 10 11:14:05 2021 -0400

    Release: 5.1.0 (https://github.com/woocommerce/woocommerce-blocks/pull/4185)

    * Empty commit for release pull request

    * Add changelog

    * update testing notes

    * Bumping version strings to new version.

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

commit 80c27354e1eb83d027eb9670aed59885c2097d3d
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon May 10 14:38:04 2021 +0200

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4184)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 90074cf871d8691d0adf5808e59a75b9ace98fa7
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Mon May 10 10:03:30 2021 +0100

    Convert shipping components to typescript (https://github.com/woocommerce/woocommerce-blocks/pull/4135)

    * Add type defs for customer

    Taken from 194ecccf78/assets/js/type-defs/customer.ts

    * Convert ShippingCalculatorAddress to TypeScript

    * Convert ShippingCalculator to TypeScript

    * Convert ShippingLocation to TypeScript

    * Allow packageId to be a number or string in useSelectShippingRate(s)

    * Convert ShippingRatesControl to TypeScript

    * Convert ShippingOptionsStep to TypeScript

    * Allow package_id to be a string or number

    This is because of Subscriptions using strings for package IDs

    * Change to use CartShippingRateItemShippingRate instead of Rate

    * Add extra props to PackageProps type

    * Make ShippingAddress have the correct type

    * Use CartShippingRateItemShippingRate instead of Rate

    * Remove Rate type

    * Set return types to JSX.Element

    * Change type of props.renderOption in ShippingRatesControl

    * Remove customer type defs and relocate aliases to default-address-fields

    * Add EnteredAddress type

    * Import EnteredAddress from new location

    * Remove unnecessary eslint ignore

    * Remove unused variable

    * Remove confusing use of word Item in Shipping types

    * Remove confusing use of word Item in Shipping types

commit 3f1be394d076bdc2a407c05d1fbf290a17c55c43
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Mon May 10 10:00:14 2021 +0200

    Feature gate PaymentApi (https://github.com/woocommerce/woocommerce-blocks/pull/4176)

    * Feature gate PaymentApi

    * Improve payment method missing dependencies error message so it's clear it only affects blocks

    * Add PaymentApi feature flags to list of feature flags in docs

commit ed7eded4d7134d1b69d0fd206cd1315fd9d2d40f
Author: Darren Ethier <darren@roughsmootheng.in>
Date:   Fri May 7 16:39:28 2021 -0400

    Improvements to `emitEventWithAbort`. (https://github.com/woocommerce/woocommerce-blocks/pull/4158)

    * modify emitEventWithAbort to change return value

    `emitEventWithAbort` now returns an array of responses up to the first response that triggered an error or fail response instead of aborting on success responses too.

    * update add to cart form context provider

    * update checkout state context provider

    * update payment method data context provider

    * update tests and fix thrown error handling.

commit 2be9a4ea4405d5df427f4e97025aa5433019b72f
Author: Raluca Stan <raluca.stan@automattic.com>
Date:   Fri May 7 15:50:55 2021 +0200

    Add lodash as a devDependency (https://github.com/woocommerce/woocommerce-blocks/pull/4179)

commit 69b3679a7e585abc8a5068df3bd2457714149939
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date:   Wed May 5 12:59:30 2021 +0100

    Don't clear email and phone fields when using separate billing address. (https://github.com/woocommerce/woocommerce-blocks/pull/4162)

    * preseve-billing-data

    * pluck empty email and phone

    * add issue number

commit 214014750c0a1414e89ce47d84754d278e5a164f
Author: Raluca Stan <raluca.stan@automattic.com>
Date:   Wed May 5 13:52:27 2021 +0200

    Fix/cart backend test (https://github.com/woocommerce/woocommerce-blocks/pull/4153)

    * Fix backend cart e2e test

    * Adjust test structure

    * Fix e2e checkout backend test.

    Make sure the confirmation window is closed

commit f8d9b9084c091f97b281f58a64f98622765a80e3
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 5 10:08:45 2021 +0000

    Update dependency @stripe/stripe-js to v1.14.0 (https://github.com/woocommerce/woocommerce-blocks/pull/4170)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 2391a40ab24439b14f56d1d6416beaf0c2d94c53
Author: Thomas Roberts <5656702+opr@users.noreply.github.com>
Date:   Wed May 5 10:41:48 2021 +0100

    Add documentation for filters (https://github.com/woocommerce/woocommerce-blocks/pull/4167)

    * Rename the argument in the CheckoutFilterFunction type

    This only exists as an extra descriptive hint to anyone using this type, the value `label` was never used by anything so it does not need to be changed anywhere else.

    * Create Available Filters document

    * Add available filters to the extensibility README

    * Update docs/extensibility/available-filters.md to fix typographical error

    Co-authored-by: Mike Jolley <mike.jolley@me.com>

    Co-authored-by: Mike Jolley <mike.jolley@me.com>

commit f4af89b2fce203c4f173845244724f58669a04f9
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 5 08:10:24 2021 +0000

    Update dependency @woocommerce/e2e-utils to v0.1.4 (https://github.com/woocommerce/woocommerce-blocks/pull/4172)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 6c9e786c407fd1bd6861bde3b435cec0663b8399
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 5 03:31:52 2021 +0000

    Update dependency @types/react to v16.14.6 (https://github.com/woocommerce/woocommerce-blocks/pull/4171)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 3ba4d9ed6a46f3700a7190d09eff2ba53d1bcb60
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed May 5 02:23:13 2021 +0000

    Update babel monorepo (https://github.com/woocommerce/woocommerce-blocks/pull/4169)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 35f71df36f92028cfb880e314623b33c077a384d
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue May 4 14:07:05 2021 +0100

    Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/4163)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 4c65211b375e40691aeea7273eec34f3f54a0b3b
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 14:09:28 2021 +0000

    Coped package-lock.json from trunk

commit 703cb65efb8fd4ced58234d5174dc198e225e07a
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 14:00:32 2021 +0000

    Reverted package-lock.json ( downgraded node version to 12 )

commit 41dfd79715d4b4f1e5cebd0e7dccfc1573ba4d36
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 11:12:45 2021 +0000

    Pre pull request clean up code

commit 75fc62e99ed63389c158352b73ae898c986d92bd
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Tue Apr 27 13:03:24 2021 +0000

    Added Stock Status filter

commit e7bd0e6e1e171a041ac17b8b11abc812585f7645
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 16:53:56 2021 +0400

    Escape statuses for sql query

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

commit 29c8493aaeb6dca6b3cf5e1954a39564ea304d87
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Aug 20 16:53:18 2021 +0400

    Allow custom stock statuses

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

commit 63ecd04bf09a53049bdb10d3919acf6ced7ead8a
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 28 06:22:04 2021 +0000

    Bring back removed css

commit 27e0233cb67f60f650856455a0ff32c6d73c35e3
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Tue Jul 27 23:35:15 2021 +0400

    Update assets/js/blocks/stock-filter/block.js

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

commit 136c32ddd3f485be5aeab274c675743a235a8c25
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Thu Jul 15 06:50:06 2021 +0000

    Fixed preview part for stock and attribute filters

commit ef89751b634bf223f065067f47f726b662d75ef3
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 20:15:05 2021 +0400

    Update index.js

commit a63dbcef7058ffd858a71931b6fc2ead0583ae03
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:43:06 2021 +0000

    Review suggestion changes

commit 6b0f5d2206d010c1822ab7eaf4edea9a0b79526d
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:40:52 2021 +0000

    Linter fix

commit 791b38b31782367864e1bb8f26716b7fef0e63a8
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:37:41 2021 +0000

    Removed hideOutOfStock from AllProducts and realized hide out of stock functionality from SQL query

commit 1a7a002d5eac271c6f2331e3e66411f3127282b1
Author: groguo <eriktadevosyan07@gmail.com>
Date:   Wed Jul 14 15:21:51 2021 +0000

    Created new component for Filters elements labels

commit d9b7fae24d4235a0f8f424e7e74cd250e62bc897
Author: aaron <aaron.yor@gmail.com>
Date:   Wed Jun 2 11:57:06 2021 +0400

    Fix label includ path

commit 5311584362dca4c6e5a91de5fdfbff29297799ea
Merge: 92a0da3f 1b87589f
Author: aaron <aaron.yor@gmail.com>
Date:   Wed Jun 2 11:52:48 2021 +0400

    Merge remote-tracking branch 'core/trunk' into add/stock-filter

    # Conflicts:
    #	package-lock.json

commit d8e6dabaa3282855c6c91c908d6a1443ea9732f1
Merge: 583113e3 2b695215
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Fri Apr 30 12:28:09 2021 +0400

    Merge pull request woocommerce/woocommerce-blocks#1 from woocommerce/trunk

    Fork update

commit 92a0da3f8c37aa46ce2330cb8095ab7077d01555
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 14:09:28 2021 +0000

    Coped package-lock.json from trunk

commit ae0d12b57a5be6f1a39577404c017174489345f8
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 14:00:32 2021 +0000

    Reverted package-lock.json ( downgraded node version to 12 )

commit 5e0c7f9fe36bc9358743b7af7d9e47ce66f8ac08
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Wed Apr 28 11:12:45 2021 +0000

    Pre pull request clean up code

commit 105b3f75a2b42f12f6924091f51bfa91c84b4984
Author: grogou <eriktadevosyan07@gmail.com>
Date:   Tue Apr 27 13:03:24 2021 +0000

    Added Stock Status filter
2021-08-20 15:49:11 +01:00
Mike Jolley 71851f25a5 Add padding in 2020 and 2021 (https://github.com/woocommerce/woocommerce-blocks/pull/4588)
* Add padding in 2020 and 2021

* add todo
2021-08-17 12:03:07 +01:00
Mike Jolley 4d72866925 Remove top rule so validation messages are positioned correctly below the fields (https://github.com/woocommerce/woocommerce-blocks/pull/4582) 2021-08-16 13:46:37 +01:00
Albert Juhé Lluveras 70ec1f8b31 Add optimizations around checkout filter calls (https://github.com/woocommerce/woocommerce-blocks/pull/4570)
* Extract productPriceValidation out of the component

* Extract checkout filter args outside of component

* Remove unnecessary default fallback

* Mark ProductName optional props as not required

* Use an empty array constant for the filteredNotices default value when there are no notices

* Refactor Panel component so hidden contents are not rendered

* Prevent extensions changing on each call of __experimentalApplyCheckoutFilter if it was an empty object

* Add missing line break

* Update tests
2021-08-13 15:42:09 +02:00
Albert Juhé Lluveras ff9c73bec5 Implement memoization in several selectors and hooks (https://github.com/woocommerce/woocommerce-blocks/pull/4548)
* Memoize cartErrors from useStoreCart

* Implement memoization to other selectors

* Use EMPTY_ARRAY in more cases

* Create getArrayOrEmptyConstant function

* Remove DEFAULT_EMPTY_ARRAY constant and use EMPTY_ARRAY instead

* Wrap removeItem into useCallback

* Fix tests

* Do not default to empty array/object for values that should exist and use different constant for empty values

* Type two empty array constants from default-states.ts
2021-08-13 15:28:41 +02:00
Brett Shumaker 946e05d70b Fix store notice classes (https://github.com/woocommerce/woocommerce-blocks/pull/4568)
The `StoreNoticesContainer` component is using an incorrect class name for a "success" notice and also applying the general `woocommerce-message` (what's used by WC core for the "success" notice) to all notices. In some instances, this could cause the general `woocommerce-message` styles to be applied instead of the `woocommerce-error` or `woocommerce-info` styles.

This PR changes the use of `woocommerce-success` to `woocommerce-message` and prevents `woocommerce-message` from being applied to all notices.
2021-08-12 14:43:35 +02:00
Thomas Roberts fb846c5b78 Update `snackbarNotices` filter to `snackbarNoticeVisibility` (https://github.com/woocommerce/woocommerce-blocks/pull/4417)
* Change snackbarNotices filter to snackbarNoticeVisibility

* Add deprecation notice to snackbarNotices

* Rename noticesToDisplay to visibleNotices

* Update link in deprecated message
2021-07-26 09:13:54 +01:00
Mike Jolley ea007aea6a Add checkout term field validation (https://github.com/woocommerce/woocommerce-blocks/pull/4496)
* Add notice if terms is unchecked when processing checkout

* Type StoreNotices and correctly scroll to error

* Checkbox error styles

* Hide input fields are invalid notice - validation notices are inline

* Scroll to error inputs

* Working inline validation for terms

* Add todo for exposing data

* update todo

* ensure checkbox is enabled before validating
2021-07-23 14:21:59 +01:00
Mike Jolley f78da3c355 WIP - Checkout i2 Feature Branch Tracking (https://github.com/woocommerce/woocommerce-blocks/pull/4268)
* Duplicate checkout block

* Contact information block

* form step block

* shipping address block

* Setup atomic blocks

* Container structure

* More formal steps rather than generic form step

* Add billing and shipping forms

* add checkout actions block

* add order note block

* Add order summary

* add payment block

* Add inspector controls for address fields

* frontend WIP

* move attributes

* wrap shipping with form step

* PhoneNumber to typescript

* Remove column block

* form steps

* move payment logic to frontend

* Express block

* inline payment block

* Add shipping method block

* Render inner blocks (not standalone blocks) and add classes to Atomic Block list on php side

* lazy again

* Add more wrappers from old frontend file

* add layout

* Checkout wrappers were missing

* Enqueue payment methods for new block

* Add missing classnames

* Move shipping as billing state to context provider

* express payments rendering

* try/block-registry

* Remove atomic components (unused)

* Fix attribute persistance due to template locking

* Fix shipping display when not needed

* Set correct parent blocks for inner blocks

* pass data to blocks

* demo/newsletter

* Skeleton styling

* only apply styles to loading state for now

* shipping method block frontend

* rename express block

* lock template

* fix ts warning for __webpack_public_path__

* Refactor to avoid duplicating atomic block logic

* remove changes in save method

* Add zones and shipping methods to the sidebar for the shipping inner block

Closes woocommerce/woocommerce-blocks#4320

* Fix script handles

* Fix method display when there are none

* Add shipping phone

* Add phone to api and sync with billing correctly

* Clear hidden fields on load

* fix requirePhoneField property

* Enable shipping and billing phone fields

* readonly field support

* Handle context attributes

* Fix createInterpolateElement usage

* add totalswrapper

* Implement Terms and Conditions block for Checkout i2  (https://github.com/woocommerce/woocommerce-blocks/pull/4436)

* Setup atomic blocks

* frontend WIP

* Express block

* try/block-registry

* Set correct parent blocks for inner blocks

* Skeleton styling

* Refactor to avoid duplicating atomic block logic

* add block locking

* add terms and conditions block

* hardcore settings image

* lock blocks from being deleted

* hide original checkout block

* mark blocks as side effectful

* move variations to block register function

* prevent core checkout blocks from needlessly showing in the inserter

* enable checkout i1

* fix broken rebase

* move save back

* Localise default text

Co-authored-by: Mike Jolley <mike.jolley@me.com>

* Add add-hoc Block locking from WooCommerce Blocks side. (https://github.com/woocommerce/woocommerce-blocks/pull/4454)

* add locking

* use subscribe instead

* fix condition

* add locking to blocks

* check if the item is not a text field

* Tidy up hacks CSS class handling

* Fix error if node is undefined

* Hide menu when move is disabled

* update package lock

* Add todo and fix issue where selector returns null

* split todos

* move todo

* edit comment

Co-authored-by: Mike Jolley <mike.jolley@me.com>

* Un-disable the billing checkbox in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/4457)

* Add missing Slot fill provider on frontend

Fixes woocommerce/woocommerce-blocks#4441 by adding the slot fill provider to the checkout-i2 block.

* Use column style appender

* Add padding/styles to actions

* Add/update icon library

* Multiline checkbox alignment

* Icons and copy changes for i2 blocks

* Add terms by default

* Add notice if text is missing links (https://github.com/woocommerce/woocommerce-blocks/pull/4466)

* Swap variations for toggle

* Add payment settings to inspector

* Update package lock

* Add inline docs to block registry

* Add inner block areas below each form step.

This does not include the form step contents, just adds inner blocks after existing content. Moving content within the inner block area is a separate discussion.

This closes woocommerce/woocommerce-blocks#4306

* Sample block registration + docs

* Add tests for registerCheckoutBlock

* Fix lazy component detection in tests

* Add basic transform between i1 and i2

* remove template lock todo

* Update scroll to top hoc

* Move shared settings to new context providers

Closes woocommerce/woocommerce-blocks#4472

* Remove readonly field support (unused)

* Remove context code

* Experimental

* remove invalid typedef

* FIx scrolling on validation due to misplaced context provider

* Update assets/js/base/context/providers/cart-checkout/checkout-state/index.tsx

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

* Update comment to remove reference to phone

* Update packages/checkout/blocks-registry/README.md

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

* Rename ScrollToTopComponent

* Add explicit list of expectedType in TypeScript definition

* Add todo to remove custom shipping phone handling

* Remove dangerouslySetInnerHTML in External Link Card Component

* Add ExternalLinkCard to storybook

* update todo wording

* Refactor withScrollToTop to remove useCallback and use typescript

* Support children on CheckboxControl, with added Typescript

* Spread getRegisteredBlocks return value

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2021-07-22 12:03:00 +01:00
Thomas Roberts f735f698e0 Add camelcase rule to eslint config (https://github.com/woocommerce/woocommerce-blocks/pull/4382)
* Add rules to allow camelCase variables as object properties

* Remove disable camelcase comments

* remove disable camelcase comments

* Remove space from eslint ignore rule
2021-07-09 17:53:45 +01:00
Seghir Nadir 2f440bbe20 Move SlotFillProvider to frontend only (https://github.com/woocommerce/woocommerce-blocks/pull/4437)
* Move SlotFillProvider to frontend only

* remove extra config for editor scripts

* update tests
2021-07-08 16:04:13 +01:00