* add valueWithTax to CartTotalItem typedef
* Finish off `prepareTotalItems` to include totals with taxes and also add tests
* add whether prices should include tax to the payment method interface
* only export the hook, not the util function
* Indicate values are in subunits
* rename property so it’s consistent with typedef and implement
* remove throwing errors if there’s an error in state.
These type of errors should be surfaced to user as needed via an error notice, not as a blocking error boundary. Error boundary should only be for non-recoverable errors.
* prevent default behaviour for applyCoupon button
* add various hooks and improve hooks folder structure
- Also restructures hooks directory to make things a bit more organized
- Add useStoreOrder placeholder (followed up in future pull)
- Add useBillingData hook.
* implement usePaymentMethodInterface hook in payment method components
* remove obsolete hooks and implement new checkout context hooks
- add useCheckoutSubmit which exposes checkout submit button interface
- add useCheckoutRedirectUrl which exposes checkout redirect url interface
* add alias for `@woocommerce/base-utils` to jest config
* use consistent variable names for payment method id
* sticky footer checkout submit button on mobile
* fix storefront footer icons overlaying sticky checkout CTA footer:
- bump z-index of sticky CTA container
- storefront icons have weird z-index due to css opacity
* hide storefront footer on woo cart page only
* remove storefront specific bug fix for sticky cart footer:
- will log this issue separately
* add isEditor to checkotu context and implement in provider usage
* modify configuration expectations for payment method registration api
* update registration of payment methods in demo
* implement new configuration in payment method components
* fix argument order and update jsdocs
* fix proptypes declaration.
This ensures that when `lowStockRemaining` is included it’s either null or a number.
* Ensure backorders_allowed value is boolean.
* add missing properties to cart preview
- restructures `@woocommerce/base-context` imports so it pulls from `index.js` in the `base/context` folder. That way tree-shaking will be used if possible. This also helps with organizing the folder structure a bit better for the new contexts.
- Fixes all the various imports through the code due to the above change.
- Adds `CheckoutContextProvider`, `useCheckoutContext` and related files.
- Adds `PaymentMethodDataProvider`, `usePaymentMethodDataContext` and related files.
- Adds `ShippingMethodDataProvider`, `useShippingMethodDataContext` and related files.
- Adds typedefs used for the various context interfaces.
* default to the first state
* Update assets/js/base/components/state-input/state-input.js
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
- `useStoreCartItemQuantity` now receives the cartItem instead of the `cartItemKey` as an argument. I didn't notice in previous reviews how it's used in the context where we already have a cartItem so implementing this reduces complexity and makes the hook more precise for it's purpose.
- Add `backorders_allowed` to the CartItem schema for the API. This allows for client to have correct logic for maximum quantity when this value is true.
- Implement the above in the `CartLineItemRow` so that quantity picker is limited by the amount of stock remaining if that is available (`lowStockRemaining`) and the `backorders_allowed` is false.
- maximum quantity is currently hardcoded to a (filtered) value of `99` when other conditions don't apply (see related issue in woocommerce/woocommerce-blocks#1913)
* Avoid importing @wordpress/components in icon library
* Avoid @wordpress/compose and @wordpress/components in `base`
* Move hocs used on frontend to base
* Revert "Move hocs used on frontend to base"
This reverts commit bf09016fdc2fc1bea2f465018fecc76945f69d5e.
* add plukedAddress util function in order to use it for shallowEqual
* refactor useShipping so it accepts and returns the address
* refactor fields
* fix test and return shippingRates to hook
* remove unneeded shippingAddress from ShippingRatesControl
* move keys logic to hook
* refactor tests again
* increase cart size
* tidy cart totals layout on mobile:
- totals column is full width
- reset container (card) borders and padding
* increase specificity of mobile cart styles to ensure skeleton hides after load
* use "not loading" && "not skeleton" approach for more readable mobile style selector
* Move default address fields to blocks; normalise address i18n
* Use optionalLabel and other props from addressFields
* Fix apartment field display
* Country address fields
* Fix default field order
* Update for countries with no states
* Add type defs
* add typedefs for CartItem
* remove cartItem from StoreCartItem typedef
* Implement new typedef and fix defaults as well as returned object.
Now that `cartItem` is only used internally, the default set on the state only has to be the properties required internally in the hook.
* add typedefs for shared settings and implement typedef comments.
* change hook name
* rework the quantity change generator action so the UI updates quick:
- work in progress - still need to figure out how to debounce API call
- add new action for updating quantity for an item
- don't set cart item as pending while quantity is updating
- this leaves QuantitySelector enabled so user can click more/less
- use receiveCartItemQuantity to update quantity in UI before sending request
* debounce line item quantity first cut:
- use local state for quantity, so ui allows multiple clicks up/down
- debounce store updates (and server/API call)
* correct comment on cart item quantity reducer
* remove recieveCartItemQuantity - no longer needed
* remove delegation for deleted RECEIVE_CART_ITEM_QUANTITY
* only update quantity in component sideffect if it has changed:
- reduces unnecessary renders
* factor out debounced quantity update into cartItem hook (hat tip @senadir)
* use quantity from store, instead of passing in to hook +
+ fix latent bug in useStoreCartItem - the cartItem value is now object:
- was previously single-item array
- (note no client code is using this at present)
* tidy/refactor cart item hook - separate dispatch from select
* remove dud reset of item pending flag (came back in rebase)
* add quantity to StoreCartItem hook return value typedef
* fix js error when adding cart block in editor – cartItem not found
* fix typedef
* fix logic for debouncing
* don’t update quantity on server unnecessarily
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* add select shipping endpoint to router
* add select shipping method
* add selected rates to cart
* better select rates
* move schema function to seperate function
* move validation to Cart Controller
* fix wrong session key
* Update shipping/cart endpoints (https://github.com/woocommerce/woocommerce-blocks/pull/1833)
* Items should not have keys in API response
* Include package ID in response (this is just a basic index)
* /cart/select-shipping-rate/package_id
* Add package_id to package array
* Update responses and add shipping-rates to main cart endpoint
* update-shipping endpoint
* Add querying selected shipping rate to the store (https://github.com/woocommerce/woocommerce-blocks/pull/1829)
* add selecting shipping to store
* directly call useSelectShippingRate
* refactor cart keys transformation to reducer
* remove selecting first result and accept selecting
* move update shipping to new endpoint
* pass selected rates down
* select shipping right directly and fix editor issues
* fix some broken prop types
* key -> package id
* Update and fix cart/shipping-rate tests
* fix case for when rates are set
* Update useShippingRates test
* add args to rest endpoint
* move selecting shipping rate logic to hook
* fix some naming issues
* update propTypes
* update action call
* fully watch cart state
* address review issues
* fix prop type issues
* fix issue with rates not loading in checkout
* remove extra package for shipping
* move ShippingCalculatorOptions to outside
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
* ensure cart totals update when items are removed (prototype):
- return complete cart object from DELETE cart/items/:key
- use receiveCart on client to update whole cart including total
* move API endpoint for removing cart items to cart controller:
- returns full cart schema so should be part of cart controller
- is now a POST request with param - not strict REST
- fix up client action to use new API
* move API test for removing cart items (API has moved)
* use correct path for remove API in tests (doh!)
* add extra API test for remove_cart_item with bad key => 404 (experiment)
* experiment: delete test_remove_cart_item, does test_remove_bad_cart_item work?
* reinstate test_remove_cart_item with single valid request
* remove unnecessary newline
* tidy comments in PHP api tests, rerun travis?
* remove test_remove_cart_item which may be causing problems
* reinstate troublesome remove cart item api test (experiment):
- see if this works now travis issue is resolved
* whitespace
* show correct total when changing cart item quantity:
- move update cart item quantity API to cart controller
- & return full cart response
- update js action to new API route & receive full cart response
* simplify test_remove_cart_item API test - now just tests a valid remove succeeds
* remove test_update_item (API has moved) +
+ experimentally remove test_remove_bad_cart_item
- testing if cart remove tests interact with each other
* fix tests (🤞) - pass params in body, not as query params
* reinstate test for re-deleting same item
* update API docs - update/delete cart item have moved to /cart
* add response data checks to new cart API tests:
- extra protection against expected 404 "false positives"
* reinstate API test for changing cart item quantity
* fix remove cart item body tests - MIA items return error code, not cart
* fix test - quantity param is int not string
* attempt fix 404ing test_update_item:
- only allow POST, remove trailing `/`
- align array equals for good measure :)
* fix action for update-item - method=POST, now takes body params
* fix response body asserts in test_update_item
* reinstate update_item and delete_item on CartItems controller
* typos + examples in new cart items API docs
* reorder previous cart item docs to minimise diff/churn
* reinstate tabs in docs response example
* Fix background overlap of feedback box
* TS notices
* Add company name toggle
* Implement new attributes and toggles in editor
* Handle field config in address component
* Remove other hoc rule from tsconfig
* map -> forEach
* Remove return from forEach
* Export and extend field config
* Fix optional text for all field types
* unit text
* Update snapshot
* add a smaller min-width for cart column on smaller screens
* ensure full price is inline on mobile (when visible)
* ensure line item totals are bottom aligned even if quantity cell is huge
* revert price vertical alignment - in design they are aligned with quantity digit
* Create useShippingAsBilling attribute
* Fix missing prop
* Refactor FormStep so stepNumber is generated by CSS instead of being passed as a prop
* Add billing address form
* Add text before controls
* Remove old @todo comment
* Working on store provider
* Working on store provider
* Reducer implementation
* Implement core/notices
* Add notices to store coupon hook with context
* Improve store notice text and styling
* Improve JS side API for notices
* Wrap functions with context additon
* Update test to []
* Implement props feedback and useInstanceId
* Update assets/js/base/context/store-notices-context.js
Co-Authored-By: Darren Ethier <darren@roughsmootheng.in>
* Update assets/js/base/context/store-notices-context.js
Co-Authored-By: Darren Ethier <darren@roughsmootheng.in>
* remove instance id
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* 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
* Fix Product search block in last Gutenberg release
* Convert ProductSearchBlock to a functional component
* Split ProductSearchBlock into two components
* 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
* fix jsdoc - getCartItem returns undefined if not found
* add typedef for cart items store object provided by hook
* fix rebase error - key prop went awol
* orient useStoreCartItem hook to single cart item:
- simplify interface for client component
- isPending bool (was callback)
- removeItem callback no need to specify item key
+ reinstate disabled prop on remove link when updating (lost in rebase)
* move cart item pending state out of cartItems, preserve API state shape:
- pending is now stored as array of keys
- fix isItemQuantityPending selector (now much simpler)
* ensure react knows that our useSelect depends on cartItemKey
* add basic story for QuantitySelector (so can easily test disabled)
* add disabled prop to QuantitySelector:
- apply to all input controls
- add storybook knob for testing
- use disabled grey for number edit when disabled
* fix indentation of jsdoc comment (linter is coming)
* use self-closing tag in QuantitySelector story
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
* Persist previous shipping rates while loading
* Refactor ShippingRatesControl LoadingMask
* Show package name
* Simplify CSS to avoid using the adjacent selector
* Add comment to explain why 'selected' is hardcoded in the editor
* Rename package 'index' to 'key'
* Chip componet and styling
* Tests
* Move coupon code for API requests to body - fixes issues with coupon codes containing special characters
* Implement chip component in cart page
* Revert "Move coupon code for API requests to body - fixes issues with coupon codes containing special characters"
This reverts commit ac5a72f55d51d939bb989f3936e28cf993af19a6.
* Update comment
* prevent overflow
* Add screen reader text for coupon name
* Adjust icon alignment and padding/hit box
* update string
* Checkout block: don't show message of missing shipping options if they are already set
* Use 'wc_get_shipping_method_count' to check if shipping methods are created
* Fix frontend error
* Check exists before calling a method on it
* Fix Configure Shipping Options button mispositioned in last Gutenberg release
* Tidied up source code for line item row and fixed image placeholder support
* Return null if not rendering
* Add is loading state and className to cart block
* Hide title if there are no items
* Add placeholder rows when there are not items and cart is loading
* Pass though isLoading to cart
* Set defaults for cart item rows
* Style the placeholder elements
* Move placeholderRows
* Remove getPriceNumber
* Move decodeEntities
* Split up utils
* Move coupon code for API requests to body - fixes issues with coupon codes containing special characters
* Use wc_format_coupon_code when applying/removing coupons via the cart endpoint
* Add tests
* calculate regular price for line item and return in API `line_subtotal`
* restore `line_subtotal` api field to previous behaviour
* correctly handle discounts on cart line items:
- return product `prices` in cart items endpoint
- calculate full price and discount on client using product
regular_price * quantity in cart
* add product prices to preview cart API data
* show product sale price discount in "save" badge:
- previously we were displaying any effective discount, e.g. from coupons which apply to whole cart
- now this badge will only display discount due to product on sale - much simpler
* rename sale badge class (discount => sale)
* clarify docs for line_subtotal - includes sale prices, not coupons
* clarify line_total docs
* add prices to schema (fix unit test)
* fix schema unit test - return `prices` as object, consistent with `totals`
* Further line total rewording
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* useStoreCartCoupons hook
* Apply coupon w/ basic error handling for the fetch
* Basic store specifically for cart data
* Working on error states
* Show error on coupon fail
* removeCoupon action
* Added extra endpoints for more efficient cart queries
* Apply/remove coupons working
* Track applying/removing state
* StoreCartCoupon typedef
* Use coupon code on index
* Remove custom controls definition
* Adjust storecartcoupons mapper and remove ref
* Move cartData defaults and remove ref
* Call API directly, avoid schema lookup
* Improved selectors
* StoreCart typedef
* Split up cart state data and add more typedefs
* Add API tests for apply/remove coupon
* Jest tests
* Move default cart data to constant
* Comment indentation
* Add product name and quantity to cart shipping rates endpoint
* Make text accessible
* Add styling
* Create Packages component
* Add preview shipping rates to editor
* Add onChange default value
* Order props
* Use CSS instead of JS to render commas between package elements
* Change quantity type to number instead of integer
* install typescript and add typedef support
* add typedefs for Cart things
* improve typescript config
- adds more base config
- add our aliases
* fix error caught by typescript!
* Tweak typescript configuration
* Add missing `@woocommerce/settings` alias to ts config
* Add alias for type-defs
* add cart settings
* address typos
* update how settings should work
* get settings from woo and pass them to frontend
* reapply condition
* fix issue with attributes not presisting
* abstract shipping control
* rename constants
* update props in frontend
* fix bug with attributes not presisting
* conditionally display prices
* use country to decide to show prices
* disable shipping if shipping is not enabled
* enable coupons by default
* Add support for image for product categories block.
* Resolve feedback and style images, w/ thumbnails
* Toggle visibility of option based on list style
* Remove image size variable
* hasImage false by default
* reset styles
Co-authored-by: strarsis <strarsis@gmail.com>
* Add autocomplete support for textinput
* Add autocomplete fields to forms
* Prefix default ids
* Hack for autocomplete on custom select components
* Restore labels and avoid reset of state
* State field autocomplete
* Fix calculator autocomplete
* Simplify existance of hidden field
* move label on autofill preview in chrome
* Put back state clearance
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* hook up cart items to API data in front end (first cut)
* correctly decode entities in product attributes in cart:
+ support unnamed attributes
* correctly render markup in cart line item descriptions:
- description api field is html, so use dangerouslySetInnerHTML
* fix PropTypes - cartItems, not items
* hook up cart totals area to API data +
+ move editor preview totals data to resource-previews (to match API)
* tweak/tidy todo comments for cart front end
* use shorter summary field for cart line item blurb
* render empty cart inner blocks on front end when shopper cart is empty
* ensure empty cart doesn't show while cart contents is loading
* decode entities in attribute names when rendering cart items
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* factor out cart data to a custom hook + exit earlier while loading
* wrap preview/sample cart variation data for translation
* use RawHTML component for rendering cart line item summary +
+ linter whitespace tweak
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
* Implement last modified header for the products endpoint.
* Invalidation handling
* Freshness
* indenting correction
* Remove freshness and resolve feedback for last modified handling
* Remove getCollectionTimestamp
* Move logic to resolver
* Handle state during INVALIDATE_RESOLUTION_FOR_STORE
* Improved placeholders of translatable string
* Improved one more string
* Include wordpress element package
* Implement __experimentalCreateInterpolateElement for translations
* Dump fragments
Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
* Create ShippingCalculatorAddress block
* Make 'change address' button to open/close the address form
* Create ShippingCalculator component
* Use CountryInput and CountyInput instead of TextInputs
* Fix city value not being set
* Fix shipping rate not appearing when there was only one option
* Unify postalCode and postCode to postcode
* Rename 'county' to 'state'
* Add reset styles for popular themes
* Increase cart-frontend.js max size
* Split CountryInput and Select
* Create County Input
* Show text input when there are no county options
* Reset county value when changing country
* Fix keyboard navigation
* Hide checkmark
* Add reset styles for several popular themes
* Add country prop to ShippingCountyInput
* Create ShippingMethodsControl component
* Hook up shipping methods to API
* Add support for several packages
* Add tests to useShippingRates
* Fix shipping_rates property name
* Only show the products list if there are several packages
* Use <FormattedMonetaryAmount> to display shipping rate prices
* Make 'country' optional in CartShippingRates
* Make CartShippingRate API return currency info
* Minor improvements
* Fix shipping fields hidden in editor
* Fix missing currency in Checkout shipping rates selector
* Add links to issues in @todo comments
* Improve ShippingRatesControl useEffect
* Remove unnecessary tab
* Remove unnecessary id in RadioControl
* API: Add error when country is invalid
* Debounce shipping rates API requests
* 'Country key' -> 'Country code'
* Don't display radio input when there is only one option
* Add message when there are no results
* Minor enhacements
* Remove unnecessary Fragment
* Simplify RadioControlOption export
* Refactor 'renderOptions' and split it into several components
* Prevent Card sidebar from taking too much width
* Move country request check outside of the loop
* Fix failing test
* introduce feature flags
* move config to webpack-helper
* add flag to deploy command
* remove package default
* add cross-env
* add gating to frontendConfig and coreConfig
* exclude entries from being built on stable mode
* add feature gating to PHP
* add flag to start command
* add flags to travis
* add endpoints
* add better defaults for php
* move code to Bootstrap.php
* no need to spread single object
* ignore blocks.ini
* type check feature flag
* remove blocks.ini
* sanitize flag
* remove flag from npm start
* format condition
* keep spaces for package-lock.json
* check for env before going to block ini
* add env vars to travis
* whitelist env var
* add new icons and remove old ones
* add docs
* add notes and remove gridicons
* update to folderStarred
* typos
* reorder imports
* update prop name to srcElement
* validate element
* fix bad import
* lowecase folderStarred
* add propTypes
* initial experiment for fetch error handling
* throw error from api response error (this allows for catching it in the stream)
* Add ERROR action type
* Controls: resolve with an error response object rather than throw exception
* remove try catch from resolver; just yield correct object based on presence of any errors
* Make the use collection hook return an error.
* Small tidy up in use-store-products
* Throw exception from Use Collection - useState is needed for the exception to work inside a hook (see comments)
* Show error code from API in error message
* Update assets/js/base/components/block-error-boundary/block-error.js
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* Update assets/js/base/components/block-error-boundary/style.scss
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* Remove comment
* Handle api error in boundry
* Use reject in promise
* Return error message by default which may be undefined (this is ok)
* Update mocks so tests pass again
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
* Add And/or labelling
* Revised design
* Update assets/js/blocks/active-filters/utils.js
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* Add prefix so name is not changed - fixes duplicate items
* Update BEM css classes
* Update styling to handle nested lists
* Remove extra padding within chips
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
* install & configure storybook (via magic npx script)
* fix indentation in storybook generated files
* eslint ignore generated storybook files (for now at least)
* unhide storybook folder, consistent with Gutenberg project
* demo story for one of our components (with no css/styles)
* hack in scss webpack config & add story for button:
- fixes scss imports breaking storybook build
- note scss / styling doesn't work yet
+ organise our component stories into folder
* git ignore storybook-static build folder
* pin dependencies for storybook
* piggy-back off main webpack config for storybook module.rules (for scss)
* use gutenberg (wp-components) styles in storybook
* use system font for storybook, consistent with wp-admin/gberg and reasonable default for components in front end
* add --ci flag to prevent storybook opening new browser tab…
- see also https://github.com/storybookjs/storybook/issues/6201
* rename default stories to Default (following Gutenberg pattern)
* add story for ErrorPlaceholder
* failing ProductPreview story (committing to PR as an example for discussion)
* storybook for components/icons
* fix aliased dependencies in components for storybook:
append our webpack aliases to storybook webpack config
* basic story for PriceSlider (looks right but interaction broken)
* fix PriceSlider user interaction:
- PriceSlider expects client to handle onChange and pass in new min/max
* add comment about priceslider max/min (todoish)
* remove default stories from storybook scaffolding
* organise stories by module (aka folder in codebase)
* package-lock update after rebase
* remove unnecessary ignores (default stories are gone)
* delete experimental/risky/broken stories:
- icons components are changing in woocommerce/woocommerce-blocks#1644
- we need to refactor/do more work to get ProductPreview working (settings globals)
* remove unnecessary import
* clarify PriceSlider component intended usage comment in story
* remove redundant wrapper divs from stories
* add common storybook addons (used by Gutenberg storybook)
* rebuild package.lock after rebase
* remove unnecessary wrapper div
* package fixes after rebase
* add configuration for storybook source loader
* add decorators for a11y and knobs plugins
* remove unnecessary react import & import useState from WP
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Add aria-label to All Products ratings
* Add specific screen reader text to some buttons
* Increase All Products regular price color constrast
* Remove invalid CSS declaration
* Make styleint-disable comment more specific
* Attributes Filter: make input non-focusable if we display the 'change filter' button
* Improve translator documentation
* Hide price slider from screen readers if price inputs are enabled
* Linting fixes
* Price slider: make it non-focusable if input fields are displayed
* All Products: announce how many products were found
* All Products: announce when a filter is removed
* Revert "All Products: announce when a filter is removed"
This reverts commit 2c861bf1b988155313ad44bafbcaf3f4f1549296.
* Pagination component: improve screen reader texts
* Filter submit button: improve screen reader texts
* Remove unnecessary text
* Improve comment
* Use %d for numeric values
* Add label and screenReaderLabel props to FilterSubmitButton component
* Audit atomic block labels
* Add summary, descrtiption, and short description to API and use for summary block
* Add summary to cart item api
* Respect short description
* Tweak label of summary block
* Revert product rating label
* One description vs 3
* Update sample content with more appropriate values, and match in cart items sample
* Move summary generation to class
* Tests
* Prevent extending `ProductSummary`
* Tweak $paragraph handling
* More accurate word counting
* add tear down for filter
* Avoid looping through attributes after defaults have been set.
* remove extra method I missed and fix when state updates happen
* don’t update state if we’re not in woo blocks
This prevents non woo blocks from being re-rendered unnecessarily with the state update.
* avoid re-renders and use class property instead
* Change default rows to 3
* Handle all products rows change via deprecation
* Prevent errors if object is undefined
* HOC to set default attribute values
* Separate default attributes from attribute definitions
* Filters to set defaults
* Fix deprecation so attributes are not reordered
* Move flters to index file and limit which blocks are affected
* Fix object assign
* Use typeof for undefined checks
* Move hoc to filter file so it has context
* Fix up comment
* Avoid mutating props
* Prevent multiple `attributes` by cloning props
* Force attributes to be saved to HTML in a specific order, and handle migration
* useEffect to set attributes and avoid prop mutation
* Switch to class component
* Style mobile qty selector
* Add dedicated column for image and remove duplicate elements
* Tweak column headers
* Refactor cart styles to use CSS grid, and use nesting for organisation
* adjust column widths
* Remove unused div
* Fix wrapping and flexbox styles
* Add decodeEntities to alt attribute
* Use % basis
* Tweak min widths
* Create initial CountryInput component
* Create ShippingCountryInput
* Create BillingCountryInput
* Make backgrounds white
* Correctly align options
* Add CSS resets for 20xy themes
* Fix wrong defaults in countries constants
* Make CountryInput respect 'prefers-reduced-motion'
* Reverse prefers-reduced-motion check
* Set max-width to CountryInput dropdown
* Use decodeEntities to print country names
* Avoid unnecessary JSON enconding and later parsing
* Make sure country name is also encoded when selected
* Fix countries default value
* correct typography styles for remove link (based on design)
* add trashcan icon from material icons, for removing cart items on mobile
* add & style trash icon for remove cart item on mobile
* a11y - use darker grey for trashcan icon button to improve contrast
* rename IconDelete -> IconTrash
* remove unnecessary div
* use <button> for remove action buttons + add link-button scss mixin
* fix editor styles for cart line items - total column should be right-aligned
* fix various visual issues with cart line items table in editor:
- rows should align hard left and right (first/last child no padding)
- totals should be align-bottom on small screen
- correct vertical padding on column headings
- re-add row border separator lines
* View switcher on cart block
* Dedicated component and styling
* Views and selected should be required
* Rename to ViewSwitcher
* Implement views via render prop
* Remove defaults for required props
* show discount on cart line items (no styling)
* style line item discount badge + use correct colors for prices
* show full price inline on mobile
* move all responsive tweaks for cart prices to explicit breakpoints
* add nowrap to FormattedMoneyAmount so prices don't ever wrap
* fix misaligned full price on mobile when prices are large (edge case):
- if price strings are long, the full price stacks above line total
- previous right-margin on full price showed prices misaligned
* allow client code to add class(es) to FormattedMonetaryAmount
* add nowrap so discount badge doesn't wrap
* remove unnecessary span from discount badge +
+ more explicit `display` style for different price column elements
* show product variation attributes in cart line item + styling:
+ adjust font sizes & colors to match design
* show product description in cart line items…
- this commit also adds descriptions to test cart-items data
- note API does not currently return description/excerpt
* add a class to product attributes to allow custom styling
* Add Cart totals to Cart block
* Accessibility improvements
* Load vendors styles separately
* Use same shipping placeholders for cart and checkout
* Refactor how we import @wordpress/components styles so only panel styles are imported
* Remove style-loader from vendors styles build process
* Add htmlFor attribute to TotalsCouponCodeInput
* Update totalItems shape to match API
* Fix wrong total items shape using numbers instead of strings
* Rename wc-blocks classes to wc-block
* Remove unnecessary parseInt()
* Add radix to parseInt()
* Rename totalRows to totalRowsConfig
* Move placeholder content out of the component
* Use Card component for cart's sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/1423)
* Use Card component for cart's sidebar
* Split RadioControl component
* No need to use Label in RadioControlOption
* Remove no longer valid @todo comment
* Use 'checked' prop instead of 'selected' in RadioControlOption
* Rename wc-blocks classes to wc-block
* Rename wc-blocks classes to wc-block (II)
* Make sure radio control ids are unique using withComponentId
* Load PanelBody and PanelRow from last version of @wordpress/components
* Create vendors-frontend.js file
* Load wordpress-component instead of @wordpress/components from <Button> component
* Only load 'withRestApiHydration' HOC
* Make vendors-frontend a dependency of cart-frontend script
* Revert "Only load 'withRestApiHydration' HOC"
This reverts commit 9f9b9759a98047b26e7d8f04189ffe78c1d5bb06.
* Fix fieldset background
* render block on front end, add `Shopping cart` heading (baby steps)
* fake data for editing full cart + show line count in header
* add note about core/html using `is-active` class for toggle state
* reinstate work-in-progress full cart component (lost in rebase)
* reinstate full cart from master
* component for full cart title & item count + margin tweaks:
- add margin between main cart & sidebar
- add margin after cart block
* add cart items sample data + factor sample product image to module
* use sample cart data for item count
* basic table of cart line items (no styling)
* prettification
* show images for cart line items + initial table styling
* cart quantity selector component (work in progress)
* use state for cart product quantity, allow incr/decr from UI (WIP)
* replace WIP custom quantity control with number edit (temporary)
* correctly format cart line item total price
* align cart item columns with headings + indent image on desktop
* tweak css for cart line item padding on mobile so it's more explicit
* show cart line item full price if discounted
* add placeholder for cart remove item link
* switch cart table to flex layout (was table)…
This will allow us to move things around for mobile/responsive layout.
* only show cart items table header on desktop
* more cart items styling - row borders, appropriate padding +
+ move image width to variable
+ fix class name plurality for row (item not items)
* use standard $gap instead of 1em for padding/margins
* responsive (mobile) layout for cart line items:
- shift line $ total to bottom right
- stack quantity selector in product info column
* remove extraneous cart table padding on mobile
* comment about unused styles for quantity selector component
* add follow up issue for todo
* remove inappropriate href
* render srcset & sizes for cart line item product image
* remove todo comment
* switch back to table markup for cart items (in progress):
- table is more semantic, associates headers with columns
* cart line items column widths - product column is larger (60%)
* reinstate table row borders
* bottom-align line item price on mobile
* cart contents heading should be H2 + prettify
* remove unused QuantitySelector code/styles, rename main class in line with BEM
* defaults for QuantitySelector props
* variable/property name tidies - match conventions/API
* fix bug: line total price is only bottom-align on small screen
* move QuantitySelector to root of components, intended to be generally useful
* use lineItem directly for cart, specify shape in PropTypes
* rename cart components to align with "line item" rather than "product"
* rejig class names to better align with new component names & BEM style
* show cart item image correct size:
- use single column for product image and info, with flex container
- specify image width (rem instead of px)
* fix safari issue - cart product images displaying vertically stretched
* shift product name left margin from image, to account for no-image case
* experiment: bump bundlewatch size limit for cart temporarily:
- our fake data inline image is heavy
- when we switch to real API we will no longer need it
* fix issue introduced when moving margin from image to details div:
- product details needs margin on left (not right)
* fix react props issues:
- explicitly destructure image props for srcSet (vs srcset)
- use API key field for line item key instead of id, fix duplicate test id
- CartLineItemsTable takes an array of lineItems (incorrect PropTypes)
* remove redundant divs + use conventional `null` (when no full price)
* override editor styles to ensure cart product image is correct size
* move cart items editor style override to editor.css
* add an explicit readable heading for cart heading to match visual layout
* Set default value to TextInput component
* Set TextInput label transition origin
* Set default onChange function prop to noop
* Fix wrong propType name
* Remove default onChange and set it required
* Rename checkout classes from 'wc-blocks-checkout' to 'wc-block-checkout'
* Rename form components classes from 'wc-blocks-checkout' to 'wc-block-checkout'
* Rename 'wc-components' class names to 'wc-block'
* Consistent currency data and formatting for product prices
* Consistent get_store_currency_properties usage
* Update tests with schema changes
* min_price and max_price to subunit format
* Product query of min and max prices using subunit
* Cart item totals
* Collection data schema object and currency data inclusion
* Handle subunits and new API in product prices
* Update price slider to format numbers using library and new API responses for subunits
* Product query of min and max prices using subunit
* Fix indents in readme
* Add todo for currency formatting
* Handle step for subunits, fixes min/max constraints
* Handle subunit conversion on display, using consistent currency object and wrapped NumberFormat component.
* Prettier ran
* Update usePriceConstraints tests so rounding doesn't make all values be 0
* Rename to minorUnitValue
* Move currencyToNumberFormat to index file
* siteCurrencySettings to constant rather than function
* remove cents term
* cents->minor unit
* typo in todo note
* Switch to FormattedMonetaryAmount
* Formatting
* wrong case
* initial commit at fields
* add radio control
* change input to be uncotrolled
* tweak styles
* populate block with boilerplate
* update aria in radio
* remove comment
* fix typo
* add missing colors
* put reminder to put Disabled back
* wrap text in i18n __
* reorder styles
* rename wc-components to wc-blocks
* use value instead of index for keys
* add no shipping placeholder
* change isEditor default to false
* fix problem with responsive
* Typo
* Save previous constraint while loading
* Add tests for formatPrice
* Small code refactor
* Refactor usePriceConstraints to DRY and add tests
* Add base-hooks to jest config