* Improve the type for callbacks registered by extensions
The previous type was CanMakePaymentCallback, used for the payment methods's own canMakePayment callbacks, which could also return Promises. In order to eliminate the confusion, a new type has been created that defines callbacks that only return true or false.
* Document registerPaymentMethodExtensionCallbacks
* Update docs/extensibility/filtering-payment-methods.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Add information about payment method name in documentation
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* WIP getting to work on frontend
* restore frontend.tsx
* fix layout
* remove unit tests living where they shouldn't be living
* remove skeleton
* support emtpy cart in frontend
* remove extra todo
* use fragment instead of div
* Add empty cart event
* Remove extra fragment
* 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
* woocommerce/woocommerce-blocks#3906 screen reader fix for order summary block
* removing tabIndex and extra accesibility text
* adding aria-hidden to total price and translation comments change order
* Support express payment methods filtering by extensions
* Add tests for getCanMakePayment and fix payment tests' TS errors
* Add comments for payment-method-config-helper test
* Throw an exception if there is no selected shipping method on an item that needs shipping
* Update src/StoreApi/Utilities/OrderController.php for ensure error message ends with a period.
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* add missing blocks and update old links
* features behind a feature flag
* update filters and JS methods
* Apply suggestions from code review
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Remove i2 from build
* Remove i2 php registration
* Rename old checkout dir
* Rename i2 dir
* Migrate i1 to i2 code
* Register block metadata to fix frontend rendering when migrating to i2
* Register in correct order
* Missing styles
* add register-components to side effectful list
* wrong block class in e2e test
* wp prefix missing on selector
* Fix top level block test
* Reselect labels to work around rerendering
* missing empty cart styles
* Consolodate duplicate styles
* remove init code
* update selectBlockByName
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* 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