woocommerce/plugins/woocommerce-blocks/assets/js
Rua Haszard 201cb4ff50 Support updating quantity of cart items & sold_individually product option (https://github.com/woocommerce/woocommerce-blocks/pull/1824)
* first cut - removing an item from cart:
- add actions to cart store for removing an item and keeping track of
pending removal API call
- add reducer logic for storing pending state on an item, and removing
an item
- expose removeCartItem on new useStoreCartItems hook
- hook it up to remove link / trashcan icon in row item

* disable cart quantity picker/remove link while API request in progress:
- expose cart item pending status from store using selector
- use selector to disable quantity related components in line item row

* add typedef for cart items store object provided by hook

* allow user to change quantity of cart items (first cut):
- add action for replacing a cart item in the store
- add generator action for changing quantity
- expose change quantity action on useStoreCartItems hook
- hook up to quantity UI in cart block
(work in progress)

* post-rebase fixes & fix broken typedef:
- rework cart item change quantity callback - now supplies item key like
remove callback
- fix hook StoreCartItem return value typedef - single item with
specified key, was array of all items
- add quantity JSDoc for changeCartItemQuantity action
- remove changeQuantity callback from UI (currently infinite looping)

* fix bug in recieveCartItem reducer - check keys for equality:
- was key === object

* fix invalid url in POST cart/items/quantity request

* hook up cart line item quantity to API:
- remove internal state/ref for QuantitySelector, is now a controlled
component
- call changeQuantity action from QuantitySelector change callback

* QuantitySelector no longer needs a ref to wrangle number input value

* hoist quantity state out of QuantitySelector into story (fix storybook)

* add product sold_individually option to cart item API response

* limit sold_individually items to 1 per cart/order:
- support optional max value in QuantitySelector
- set maximum dependent on sold_individually API field

* prevent user from requesting zero x cart item (API 500 errors):
- add minimum limit to QuantitySelector
- default limit to 1
+ fix bug with limiting to maximum value in number input change handler

* remove useStoreCartItems, zombie hook coming back from rebase 🧟‍♂️

* address various review feedback:
- inline undefined check, don't use lodash
- quantityInputOnKeyDown callback hook depends on canIncrease/canDecrease
- also removed undefined check for minimum, as minimum has default 0

* use safer typeof check for presence of maximum prop
2020-03-03 14:08:19 +13:00
..
atomic add new icons and remove old ones (https://github.com/woocommerce/woocommerce-blocks/pull/1644) 2020-01-31 19:20:33 +01:00
base Support updating quantity of cart items & sold_individually product option (https://github.com/woocommerce/woocommerce-blocks/pull/1824) 2020-03-03 14:08:19 +13:00
blocks Support updating quantity of cart items & sold_individually product option (https://github.com/woocommerce/woocommerce-blocks/pull/1824) 2020-03-03 14:08:19 +13:00
blocks-registry Add payment method api and components to checkout steps (https://github.com/woocommerce/woocommerce-blocks/pull/1349) 2020-01-06 17:28:09 -05:00
components add new icons and remove old ones (https://github.com/woocommerce/woocommerce-blocks/pull/1644) 2020-01-31 19:20:33 +01:00
data Support updating quantity of cart items & sold_individually product option (https://github.com/woocommerce/woocommerce-blocks/pull/1824) 2020-03-03 14:08:19 +13:00
filters Only populate default attributes on initial mount of block. (https://github.com/woocommerce/woocommerce-blocks/pull/1640) 2020-01-24 11:53:15 -05:00
hocs add new icons and remove old ones (https://github.com/woocommerce/woocommerce-blocks/pull/1644) 2020-01-31 19:20:33 +01:00
icons Validate proptypes as any element (https://github.com/woocommerce/woocommerce-blocks/pull/1737) 2020-02-17 16:45:27 +00:00
legacy All Products with Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1032) 2019-10-28 09:53:09 -04:00
payment-methods-demo fix errors caused by demo payment methods (https://github.com/woocommerce/woocommerce-blocks/pull/1547) 2020-01-13 10:08:14 -05:00
previews show discount badge in line items in cart (https://github.com/woocommerce/woocommerce-blocks/pull/1784) 2020-02-25 12:17:13 +00:00
settings Checkout block: don't show message of missing shipping options if they are already set (https://github.com/woocommerce/woocommerce-blocks/pull/1804) 2020-02-26 15:50:53 +00:00
type-defs Support updating quantity of cart items & sold_individually product option (https://github.com/woocommerce/woocommerce-blocks/pull/1824) 2020-03-03 14:08:19 +13:00
utils Update NPM dependencies and script dependency handling (https://github.com/woocommerce/woocommerce-blocks/pull/1337) 2019-12-10 12:17:46 -05:00
index.js Give Woo Icon special treatment by making it a component (https://github.com/woocommerce/woocommerce-blocks/pull/1702) 2020-02-10 14:24:02 +01:00