* Fix Sale badge markup discrepancy. Fixeswoocommerce/woocommerce-blocks#2107
* Fix product link markup discrepancy
* Use same class name for ratings markup in product grid blocks
* Remove editor specific class name for product title
* Unify price layout between product grid blocks and All Products block
* Change specificity raising classes to avoid editor class names
* Make small images fill the available width in product grid blocks
* Avoid increasing selector specificity in the frontend
* Undo AbstractProductGrid.php template changes
* Do not remove .wc-block-grid__product-rating__stars from CSS
* Add theming docs
* Remove underline from discounted prices
* Fix position of on sale badge in Twenty Twenty
* Make sure we reset styles from Core
* Fix image on sale badge not correctly positioned
* Fix sale badge alignment when they are on in the right
* Use named font sizes instead of values in px
* Convert rem mixin to em
* Remove unnecessary line-height
* 'Design' -> 'layout'
* Add comment to magic line-heihgt number
* Update a couple of class names to use BEM
* Use consistent name for SCSS variables
* Fix order summary line heights
* Update docs/contributors/coding-guidelines.md
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Remove todos for colors (see woocommerce/woocommerce-blocks#1331)
* remove todo for payment method express payments placeholder
No placeholder is needed because we don’t want to show this at all if there are no payment methods setup (or initialized based on `canMakePayment`). The payment methods step will have instructions in the editor for users to setup their payment methods.
So this todo was invalid.
* Remove todo comment for useStoreOrder (see woocommerce/woocommerce-blocks#2555)
* remove obsolete todos for usePaymentMethodInterface
* changed todo into a Note for the useQueryState tests
With focused work happening on tests, this is better as a note that can be picked up when this file is touched again.
* remove obsolete todo from payment method registration validation
* remove todo covered by created issue (see woocommerce/woocommerce-blocks#2166)
* remove obsolete todo for stripe utils
* Convert todo to a Note for Checkout Block php registration
For now, I think having the comment block noting what is happening here is sufficient. Whether or not we extend the blocks to cover the other endpoints is something that will surface in future planning and putting in an issue right now coudl be premature (and likely just land the issue in the icebox)
* Remove todo related to ReserveStock covered by woocommerce/woocommerce-blocks#2556
* Remove todo in AbstractRoute covered by issue in WooCommerce project
see https://github.com/woocommerce/woocommerce/pull/26219 for the issue.
* Convert todo to note for wp_version check in Library class
* Fix different heading size of Cart block between frontend and editor
* Increase Cart submit button specificity so styles are applied in the editor
* Ensure buttons don't inherit borders
* Simplify styles
* Create Title component
* Rename 'level' prop to 'headingLevel'
* Add TwentyTwenty styles from Core
* Increase product on sale selector specificity
* Add theme class name to admin
* Fix some more style discrepancies
* Use em instead of rem
* WIP
* convert to reakit
* rebase and fix styling issues
* add forget initialTabName
* delete button and force manual select
* fix git diff problem in package-lock
* directly render tabs
* fix regression
* gaurd against unset values
* update reakit and guard against empty tabs
* fix dependencies
* refactor stripe payment-request to extract things into smaller units
- adds/fixes typedefs
- fixes dependencies
- improves logic.
* implement memoizing for functions.
* if same shipping address is selected, just call updateWith immediately
* add separate handler for failed shipping rate retrieval
* improve logic around shipping rate fail/success status
* add notice suppression logic to store notices.
- this is implemented in checkout processor to suppress notices when express payment methods are active.
* add error detection for shipping address errors and update the shipping status accordingly
* update type-def
* set billingData before shippingData
This is needed because of the shipping data and billing data sync logic in use-checkout-address.
* have to tighten dependencies to prevent unnecessary firing
With us now adding error status setters for shippping, the potential for the shipping status changes to trigger the effect went up. So tightening the dependencies to only the stati we care about prevent unnecessary effect calls.
* refactor event handlers to be named and remove all listeners.
This is an undocumented api on the stripe `paymentRequest.on` return value, but I’m trusting it will be relatively stable for this api.
The need for this is caused by the fact that without it, the listeners are re-registered on the paymentRequest event everytime the paymentRequest modal is closed and reopened.
* fix typo in doc block
* remove unnecessary shipping field and shipping fields setter
* remove a commented out block
* account for billingData having values but billingFields not when shipping address changes.
* Refactor usePaymentMethodRegistration so initialisation happens at same point as dispatch
* Update NoPaymentMethods conditonal
* Suggested changes to payment init
* always default "save my card for next time" checkbox to unchecked:
This is based on the previous checkout behaviour.
I.e. the shopper has to actively opt-in to save their card.
* Implement "save payment method for next purchase" in checkout:
- send "save card" option using existing post key
- wc-stripe-new-payment-method
- comment out inappropriate use of "save" when using a saved card (tbc)
* don't hard code the payment gateway name in 'save payment method' key
* refactor "save payment info" checkbox so payment methods can opt-in:
- Add options.allowSavePaymentToken to payment method
registration / config.
- Opt-in in Stripe CC, it allows saved cards.
- Remove render of "save my card" checkbox from Stripe CC UI component.
- Render "save my card" checkbox automatically in payment method tab
(based on allowSavePaymentToken option).
+ todo/follow up comments
* rejig "save my payment method" behaviour so it's generic:
- Any payment method that supports "save" can opt-in:
- options.allowSavePaymentToken = true/false
- handle `wc-XXX-new-payment-method` key server side to persist
- Add support in payment context/state reducer for storing checkbox
state, expose value and action via context
- Convert state flag to appropriate API key/value in payment processor
- Remove previous stripe-specific implementation
+ bonus add comment to payment context about preserving state in
PRISTINE action
* rename payment method "allow save" option, more consistent with UI
* remove last vestiges of gateway-specific "save card" impl:
- No need to pass CheckboxControl to payment methods; checkbox is
now handled automatically by checkout.
- Remove shouldSavePayment prop passing through various layers of
stripe payment processing code. (Now handled in context/processor.)
* change new option property name and shape. Also adds validation.
* update type-defs
* use more reliable `activePaymentMethod` for saved payment method
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* fix arguments
* only set payment status to pristine if it isn’t already successful
* add server side handling for saved tokens
* ensure correct gateway is selected when using saved card:
- reset the active payment method when user selects saved payment method
(card); this ensures that the correct gateway is used when switching
from another gateway to a saved card
* enhance radiocontrol to receive option specific change events.
* implement specific option change events
This commit:
- ensures selecting a saved payment option updates active payment method for the selected option.
- Sets the saved token key for the selected option correctly.
* remove unnecessary php side code
* fix bug with default saved payment option not applying:
When the payment options are initialised, we now call the onChange
handler for the default (`is_default`) option. This triggers payment
success() so checkout succeeds with default payment method, even if user
doesn't touch payment options.
* fix effect dependencies
Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
* add typedefs for store notice context
* improve useStoreNotices hook so returned interfaces are fairly constant
* fix dependencies, defaults, and add types
* fix dependencies
* fix dependencies
* improve functions exposed on validation context so they are more constant
* fixing dependencies
* normalize tokenId to string everywhere
Assuming the token is a number is a bad idea because it is feasible that source for some payment methods could be a string. Also when retrieved as an input value, the id will be a string anyways.
* refactor to move payment processing into it’s own effect
- this is the first step in trying to improve the createSource behaviour.
* memoize setValidationErrors so onPaymentProcessing event effect doesn’t re-run unnecessarily.
* Update assets/js/payment-method-extensions/payment-methods/stripe/credit-card/use-payment-processing.js
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* fix docs alignment
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update notices to say `card` instead of `card's`
* Track isEmpty per field so placeholders are not visible when focusing and defocusing other fields
* Make payment notices non-dissmissable, and removed on payment method switch
* Don't add validation notices
* implement nullish coalescing operator
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Remove summary from API
* Add wordCountType to assets
* Update packages
* Remove summary from test data
* Featured product uses short desc
* Pass description instead of summary
* Use new Summary Component
* Component and tests
* Increased versititilty of methods
* Update assets/js/base/components/cart-checkout/product-summary/index.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Extra tests for html tags
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Remove unused shippingAsBilling prop from billing data context
* Move functions out of component and add docblocks
* Local address state
* Refactor into new custom hook
* Remove TODO and code fixed in core
* useShallowEqual to prevent updates on all field changes
* Fix stale validation errors
* cleanup
* Should be setting local state not global state for email and phone
* Combine useEffects and pass correct deps
* Update assets/js/base/hooks/checkout/use-checkout-address.js
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Prettier
* Move validation update check into updateValidationError
* Fix state updaters
* Fix context definition for setShippingAddress
* Fix validation updates
* errorId dep
* Reapply changes to checkout block
* Update equality checks
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Use container queries to load Cart and Checkout responsive styles
* Update package-lock.json
* Make form-step react to container queries instead of media queries
* Make sidebar layout inner padding relative to the full-width
* Make container queries breakpoints smaller