* 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
There were some links in README.md that were broken:
* `Contributing`: I linked it to `docs`, which has a summary of links to the `contributors` folder.
* `About the npm scripts`: I'm not sure where it was linking in the past, so I removed it (but happy to add it back if needed).
* `Publishing a release`: fixed the link to `docs/releases/readme.md`.
* 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
* add docker files
* get tests to work
* remove irrelevant files
* add woocommerce as a dep
* remove eslintignore for tests
* undo travis chages till another PR
* remove local utils and call them directly from woocommerce
* remove travis db
* Block snapshot
* Test than the block can be inserted and interacted with
* Add snapshop
* Update snapshot
* rebase on master
* add a build script for just doing npm build on e2e tests
* just run build for e2e test job
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* add docker files
* get tests to work
* remove irrelevant files
* change userAgent to chrome
* add woocommerce as a dep
* add jest to eslint
* remove eslintignore for tests
* undo travis chages till another PR
* remove local utils and call them directly from woocommerce
* update deps
* add setup files to run tests
* export default wp link
* wait for select before selecting
* remove travis db
* ignore e2e tests in unit testing
* add tests
* add docker commands
* always run composer
* Make it possible to import directly from '@woocommerce/e2e-tests/utils'
* remove installing woocommerce via composer.
* add more docker npm scripts
* add custom docker config for wp-cli
* add changes to docker-composer.yml
Includes reading environment variables from `.env`
* revert customizations to .travis.yml
* move main docker file for the wordpress container to bin
* fix travis config
* rename wp install for travis builds back to original name
* use a version of docker-compose that travis supports
* add minor change to try and force travis test run
* fix incorrect command
* copy composer lock from master
* only run phpcs on /src directory
* give time for host to spin up for e2e tests
* increase sleep for waiting on container
* make sure plugin is built before running tests
* sigh fix improper command usage
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Albert Juhé Lluveras <aljullu@gmail.com>
* introduce feature flags
* move config to webpack-helper
* remove package default
* add gating to frontendConfig and coreConfig
* add feature gating to PHP
* add flag to start command
* move code to Bootstrap.php
* remove flag from npm start
* add eslint rule
* add strict equal only rule
* update messages to use tokens
* update strictBinary to whitelistedFlag and add all tests
* update to correct messageId key
* add more tests
* highlight wrong flag
* check for instance of WooCommerce before initializing session and cart
* fix invalid filter usage and include WP_Error check
* check for existence of instance method rather than WC instance itself
* 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>
* Move coding guideline and release docs to subdirectories
* Strip down contributing md to link to new docs
* Create main readme file to act as TOC
* Getting started and testing docs from contributing.md
* WP update testing checklist and docs for woocommerce/woocommerce-blocks#1285
* Update docs/contributors/smoke-testing.md
Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>
* link to svn doc
* Link to docs from readme
* Resolve feedback
* More consistent $ usage
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