* Pass classname from DOM to react components
* Actions Block ClassName support
* Form step field classname support
* Payment block className support
* Classname support for fields and totals
* Order summary classname support
* Classname support for order note block
* Express payment classname support
* Terms block custom class
* Let useBlockProps handle class in actions block
* add handleMap
* remove useValidation from cart blocks
* add namespace options to docs
* Update packages/checkout/blocks-registry/README.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* expand on the docblock
* Update packages/checkout/blocks-registry/README.md
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Remove icons from checkout button
* Add new block type
* Register new block
* Remove unused attribute
* Add to new template
* Remove duplicate attributes
* Update Inner Block handling to use consistent appender and unlock payment methods
* 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
* Update default empty template on server side
* template->registeredBlocks wording
* useForcedLayout: insert in correct place
* Remove test div
* Clarify inline docs
* Apply changes to cart block
* Replace context with __experimentalShareWithChildBlocks
* Switch to parent block when changing views
* Swap order of views
* Drop default, use first view
* Improve block selection after changing views
* 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
* 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
* 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
* Add custom close button label to Mini Cart drawer
* Add screen reader notice when removing an item from cart
* Focus next item from cart when an item is removed
* Add back CSS to hide close button label
* Don't focus previous item after the last one is removed
* Remove period from button label
* Don't show the number of items in Cart if Mini Cart is loading
This prevents displaying outdated data. That's specially important
for screen readers, because they were reading the outdated value
before it was replaced by the new one.
* Focus cart items table when last item in list is removed
* Use a ref to focus cart items table
* Use a ref to focus cart item table rows
* Fix empty cart if Mini Cart items have been removed
* Update snapshots