* move shipping-rates-control and shipping totals back into base/components/cart-checkout
* fix notice styling
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Add left vertical bar to payments methods step.
* Remove horizontal borders around order notes.
* Add class to order notes component.
We need it to traget that element with CSS.
* Update padding on order notes checkbox to match desing.
* Remove full stop to match the design.
* Add label for not saved payment methods option.
* Remove use new payment radio.
* Always show new ayment methods selector
* Remove editor context for now.
* Add accordion component skeleton.
* Small component refactor.
* Use accordion for new payment options.
* Fix jsdoc.
* Add styling.
* Add input styling.
* Hide label if we don't have saved methods.
* Cleanup.
* Cleanup and styling.
* Add target class to aid with alignment.
* Update use new payments label styling.
* Update Place Order button location.
* add full stop to payment method copy
* ensure that there is always a (default) selected payment method:
- using `activePaymentMethod` from context
- this ensures there is a default selected on initial render
- and handles any dynamic changes to available payment methods
- e.g. COD disappearing when change shipping option
- remove unused / redundant selectedMethod prop - context is best
* use tab-based payment UI for 2 or fewer payment methods:
- move saved payment state to payment context; it's shared state needed
by both PaymentMethodOptions and SavedPaymentMethodOptions
- show previous tabs UI if:
- customer has no saved payment methods (cards)
- store has 2 or fewer payment methods available
- when initialising SavedPaymentMethodOptions, only select one if the
user hasn't selected a real payment method - this ensures radio
buttons switch correctly between saved card => `Use another`
- remove various props and local state that is no longer required (🤞🏻)
* experimental - styling tweaks for single payment tab (remove "tab" UI)
* Revert "experimental - styling tweaks for single payment tab (remove "tab" UI)"
This reverts commit e09dd4862b97d989d950a9d67672d83e7b8992e4.
* Add single payment method UI.
* Adjust single method styling.
* Add outline and margin to two methods version.
* Fix gap for order notes on/off option.
* Update Order button spacing CSS.
* Reuse computed values.
* Remove tabs and single payment option.
* We no longer need this test as the UI was changed.
* Fix payment methods labels height.
* Simplify.
* Remove not needed import.
* Typecheck an option.
* Refactor code.
* Rename.
* Rename.
* Update typdefs.
* Remove border for add order notes.
* Correct spacing for radio-button and label.
* Add simple test. Switch to payment method.
* Update style.
Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Improve nonce handling by rejecting previous nonces from cache
* use timestamp instead of previous nonce
* Switch back to time()
* Seconds not ms
* Add comment about the date code
* Add supports data to payment methods abstractions. Implement in Stripe.
* Add capabilities to the payment gateway.
* Payment requirements in cart schema.
* Supported features format update.
* Formatting.
* Check required payment features.
* Refactor capabilieties check.
* No need for the cart parameter.
* Allow external modifiacation of features capability.
* Use ExtendRestApi to inject payment requirements into cart endpoint.
* Simplify the code.
* Enable more integrations.
* Enable Stripe payment request.
* Move the filter to a more correc location.
* Add features check.
* Update typedefs and documentation.
* Update tests with new functionality.
* Style fixes.
* Expose schemas
* Accept strings for select shipping rate
* strings are allowed
* Refactor shipping package to hold it's own state
* Add extension data to cart hook
* Progress but state is broken
* Move state back to hook
* Progress but state is broken
* use shipping hook updates
* Fix re-render issue
* hide x1
* Shipping slot fill
* Working slot fills
* Do not export package
* Update extend usage in unit tests
* update mock test data
* Package per slotfill
* Resolved merge conflicts
* Update assets/js/blocks/cart-checkout/subscriptions-integration.js
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* rename slot
* deriveSelectedRates return doc
* useCallback in throwError
* final class ExtendRestApi
* spacing
* Move shipping rate selection to package level
* remove const for counts
* Remove schemas from extend
* unused use
* move to a single fill for packages
* add todos
* move subs code
* fix extra extensions
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* enable rules and add exceptions
The `import/no-unresolved` and `import/no-extraneous-dependencies` rules defaults are enabled and configuration for adding exceptions for both webpack config resolution and externals or indirect dependencies are added.
* woops forgot to commit eslint-import-plugin-webpack resolver dependency
* I guess node resolver needs installed too?
* remove default resolve (doesn’t seem to help with the GH action errors)
* change config to lowercase for node
* Fix image link in all products block.
- add alt text on product image
- prevent the appearance of both product and placeholder image at the same time
- make anchor with placeholder image accessible
* Add testing for product-elements/image block.
* implement prettier config for importing wordpress/prettier config
* update packages
This updates @wordpress/scripts to latest version so we are using the latest `@wordpress/eslint-plugin` rules.
Also installs a new required dependency due to the above update.
* temporarily convert new rules to warnings to handle in followups.
* fix stylint configuration and temporarily block rule
Latest @wordpress/scripts update requires the `@wordpress/stylelint-config` package instead of the previous builtin configuration. So applies a fix needed from that change.
* update puppeteer dependency version
* package-lock update
* Add missing wrapper from FeaturedCategory block
In the rendered block we now have a div.wc-block-featured-category__wrapper around inner elements.
* Add missing inner wrapper for Featured Product block
In the rendered block we now have a div.wc-block-featured-product__wrapper around inner elements.
* Create new vars to differentiate between single and multiple item price
This is because we need to display the subtotal of the item AND the total (subtotal * quantity)
* Add subtotal and move quantity picker
As per the new designs, the quantity picker should be moved below the product metadata, and the product subtotals should appear below the product name.
* Move line item total to top of grid on mobile/medium/small
* Remove CSS for trash icon that is no longer used.
* Remove link style colour override from product name and make total bold
* Remove quantity column from CartLineItem
This is because the quantity picker is now displayed below the product metadata and name.
* Fix margins around quantity picker and its width
* Always disable link to product in OrderSummaryItem
* Add single price below product name in OrderSummaryItem
* Add styles for new OrderItemSummary design
* Move total into its own "column"
This is to stop product description text flowing under the total and making it look untidy.
* Add styles to cater for total price being its own column
* Convert precision after multiplication instead of before
* Remove unnecessary div from OrderSummaryItem
* Remove line height from product names on order summary
* Add more margin to the bottom of the product metadata div
* Delete trash icon
* Only remove margin from the bottom of last product-details
* Move quantity input to below product name in cart skeleton
* Add placeholder for individual price to Cart skeleton
* Honor hidden property of cart item data and add support for experimental property
* Add docs to experimental property
* Typo
* Add protection in ProductDetails for the case where 'details' is not an array
* Update ProductDetails so it works properly in cases where 'name' is not provided
* Add snapshot testing to ProductDetails
* Remove savePaymentInfo check when displaying payment methods
This is because the savePaymentInfo is derived from whether the save payment method checkbox shows. This check doesn't make sense to do because it's not a good indicator of whether the payment method is enabled. Subscriptions for example hides the checkbox because it is implied that the method will be saved. We should instead rely on the server-side to only send permitted saved payment methods.
* Add safely_get_request_payment_method
This will allow us to try to get the payment method if it was passed in the request, but will default to an empty string if not. This is different to get_request_payment_method because it doesn't throw any errors. We need it to be different because get_request_payment_method is used when the order definitely needs payment (so a normal checkout scenario, vs. a £0 subscription checkout)
* Add action to update order meta when checking out
This is needed because some extensions rely on this action to add their information to the metadata of order items.
* Remove safely_get_request_payment_method
This is no longer needed.
* Remove @since from experimental hook
* Add PHPDoc for new update_order_meta hook
* Document use of experimental hook
* Reinstate the check for allowing saved cards
* Add method to Stripe integration to determine if saved_cards is enabled
* Add new field to get_payment_method_data
This adds displaySavePaymentMethodCheckbox which will be used to determine if the checkbox to save payment methods should display.
* Add displaySavePaymentMethodCheckbox option to client
This will determine whether the "Save payment information" checkbox will be displayed.
* Add requiresSaving option to Stripe payment method data
This is informed by the saved_cards option and the result of the wc_stripe_display_save_payment_method_checkbox filter.
* Rename displaySavePaymentMethodCheckbox to requiresSaving & fix logic
* Revert negation on display_save_payment method_checkbox filter & rename
We are going to rename the properties we use to determine whether saved cards are shown, or whether the save payment method checkbox is shown, so that their names are more descriptive of what they are for.
* Rename allowSavedCards and requiresSaving in Stripe integration
* Rename savePaymentInfo&requiresSaving to showSavedCards & showSaveOption
This is so we can hide the checkbox independently of hiding the saved payment methods.
* Show deprecated message if payment methods use savePaymentInfo
This is because we are leaving it in to enable backward compatibility but payment methods registering using this should be informed of the change in case it gets removed.
* Update Stripe typedefs and keys of supports object
* Show customer payment methods if showSavedCards is true on the method
* Make PaymentMethodTab accept showSaveOption prop
This will allow us to show the save checkbox only if the payment method says it should be shown.
* Update tests to use new keys in supports when reg'ing payment methods
* Add optional chaining when validating payment method config
This makes the code a little tidier :)
* Update assets/js/blocks-registry/payment-methods/payment-method-config.js
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Add more information to deprecated call in payment method config
* Fix lint error
* Fix prop types for PaymentMethodTab
* Add information about supports on payment methods to docs
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* move items to package
* move components to package
* fix dep issue
* pass down classname
* move Panel and Price utils
* expose extensions
* fix import
* move cart call to inside slot
* fix unit tests
* fixes after rebase
* move ShippingRatesControl into packages/checkout
This fixes the `wc-blocks-checkout` circular dependency because `Package` was importing from `@woocommerce/checkout`.
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* add circular dependency check and fix it
* only throw error
* udpate error message
* only throw on production
* better defaults
* add variable to travis
* double echo
* echo with -e
* generating changeset for pull request
* generating changeset for pull request
* Update changelog.txt for 4.3.0 release.
* Update testing instructions for 4.3.0 releae.
* Update testing instruction for review.
* Revert "Improve error displayed to customers when an item's stock status changes during checkout. (https://github.com/woocommerce/woocommerce-blocks/pull/3656)"
This reverts commit a30179f165.
* Revert 3656 documentation changes.
* Update test zip link.
* Update release date for 4.2.0.
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: budzanowski <bartosz.budzanowski@gmail.com>
* fix circular dependency in text-input
* fix circular dependency in chip component
* fix circular dependencies in AddressForm component
* fix circular dependencies in product-list
* fix circular dependencies in hooks
* fix circular dependencies in context
* Fix circular dependencies in components/cart-checkout
* fix use-checkout-submit test
- can’t mock the hook alias anymore
- account for undefined object returned from `usePaymentMethods`
* Add new exceptions for out of stock scenarios
These are needed to differentiate between the different stock validation errors, and so we can create the correct error message.
* Catch new out of stock exceptions when checking the cart for errors
This is so we can get the cart sent back to the client, if we don't catch these, then the route will just return a 500 error and crash.
* Add ArrayUtils class
This will contain methods used to operate on arrays that don't fit anywhere else.
* Handle the case in Checkout where the error is already a WP_Error
This will happen when the cart fails validation.
* Handle StockAvailabilityException in AbstractRoute
This will happen when an item or number of items in the cart are out of stock/insufficient stock.
* Throw exceptions for each type of invalid stock in validate_cart_items
This will allow us to create an error message for each type of violation to display to the user.
* Display additional error notices returned by the API
* Fix wording when throwing exceptions relating to stock
* Handle TooManyInCartException in CartController
* Abstract the merging of cart, status, and additional data into new fn
This allows us to simplify the way errors are returned from the API. The reason we have to add all of the data at once is because of how WP_Error works with the additional data, if there is already existing data in a WP_Error object, it gets moved into additional_data. By adding all of the data in one place, we stop this from happening. Also since we're only adding status and/or cart explicitly, it makes sense to just do it in one place.
* Add get_route_error_response_from_object method
This is so we can differentiate between a string and WP_Error object.
* Remove unnecessary slashes from WP_Error instantiation
* Add option to enclose each item in quotes in natural_language_join
* Abstract adding error messages to error object into single function
A lot of code was repeated, so doing this cuts down on that and ensures any changes only need to be made in one place.
* Create new parent exception for each type of out of stock exception
This is so we don't have to repeat code inside each different exception and we can simply inherit StockAvailabilityException.
* Catch the generic StockAvailabilityException in get_cart_item_errors
* No longer recalculate totals in validate function
It is not needed, the totals are recalculated elsewhere. This call was superfluous.
* Reduce nesting, and only throw exception if error object has errors
* Improve comment on get_route_error_response_from_object method
* Fix nesting when throwing the InvalidStockLevelsInCartException