Commit Graph

1196 Commits

Author SHA1 Message Date
Albert Juhé Lluveras a30615e2cb Hook up shipping methods to API (https://github.com/woocommerce/woocommerce-blocks/pull/1468)
* 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
2020-02-14 04:43:13 +01:00
Mike Jolley 5684d4ae8a Update testPathIgnorePatterns (https://github.com/woocommerce/woocommerce-blocks/pull/1731) 2020-02-13 12:53:15 -05:00
Albert Juhé Lluveras 8297530e95 Fix ESLint error when commiting bin/webpack-helpers.js (https://github.com/woocommerce/woocommerce-blocks/pull/1729) 2020-02-13 14:16:16 +01:00
Albert Juhé Lluveras bd8bd4f009 Load countries in settings only when a block requires them (https://github.com/woocommerce/woocommerce-blocks/pull/1726) 2020-02-13 13:52:04 +01:00
renovate[bot] 2320b8aa75 Update babel monorepo (https://github.com/woocommerce/woocommerce-blocks/pull/1724)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-12 08:01:30 -08:00
renovate[bot] 173a83e524 Pin dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/1722)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-12 07:55:38 -08:00
renovate[bot] 2e4e51b752 Update dependency commander to v4.1.1 (https://github.com/woocommerce/woocommerce-blocks/pull/1725)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-12 07:43:36 -08:00
Albert Juhé Lluveras 722599004a Change 'country' to 'country / region' label (https://github.com/woocommerce/woocommerce-blocks/pull/1721) 2020-02-11 18:33:41 +01:00
Mike Jolley 60d05aed19 Product search block e2e test (https://github.com/woocommerce/woocommerce-blocks/pull/1712)
* 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>
2020-02-11 12:23:23 -05:00
Darren Ethier a7cd7d6b22 Fix wp-cli container permissions issues for e2e docker test environment (https://github.com/woocommerce/woocommerce-blocks/pull/1716)
* 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>
2020-02-11 11:13:20 -05:00
Albert Juhé Lluveras 85291159ae Fix Reviews blocks loading @wordpress/element in the frontend (https://github.com/woocommerce/woocommerce-blocks/pull/1719) 2020-02-11 15:41:50 +01:00
Albert Juhé Lluveras b5638ce87c Update Attribute Filter strings to ease translation (https://github.com/woocommerce/woocommerce-blocks/pull/1718) 2020-02-11 15:41:42 +01:00
renovate[bot] 4076d2d444 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/1704)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-10 17:15:42 -05:00
renovate[bot] 43f56151cd Update wordpress monorepo (https://github.com/woocommerce/woocommerce-blocks/pull/1709)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-10 17:02:09 -05:00
renovate[bot] 1007aff626 Update dependency cross-env to v7 (https://github.com/woocommerce/woocommerce-blocks/pull/1710)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-10 16:47:41 -05:00
renovate[bot] 1e708d4ce7 Update dependency lint-staged to v10 (https://github.com/woocommerce/woocommerce-blocks/pull/1711)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-10 16:47:05 -05:00
renovate[bot] 0a6190c708 Update storybook monorepo to v5.3.12 (https://github.com/woocommerce/woocommerce-blocks/pull/1708)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-10 16:45:25 -05:00
renovate[bot] bfadae7bba Update dependency @babel/core to v7.8.4 (https://github.com/woocommerce/woocommerce-blocks/pull/1707)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-10 16:34:11 -05:00
renovate[bot] b5e9e1851c Pin dependency create-file-webpack to 1.0.2 (https://github.com/woocommerce/woocommerce-blocks/pull/1706)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-02-10 16:25:59 -05:00
Darren Ethier 66a8621187 use non-deprecated value for eslint on wcSettings global (and set to readonly) (https://github.com/woocommerce/woocommerce-blocks/pull/1713) 2020-02-10 08:54:57 -05:00
Seghir Nadir ce190a9c72 Add eslint to ensure correct usage of feature flag (https://github.com/woocommerce/woocommerce-blocks/pull/1696)
* 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
2020-02-10 14:24:15 +01:00
Seghir Nadir a39426495d Give Woo Icon special treatment by making it a component (https://github.com/woocommerce/woocommerce-blocks/pull/1702)
* fix broken woo icon

* treat woo icon in a special way

* fix propType typo
2020-02-10 14:24:02 +01:00
Darren Ethier 58867bc328 Check for instance of WooCommerce and WP_Error before initializing session and cart in `rest_authentication_errors` callback. (https://github.com/woocommerce/woocommerce-blocks/pull/1698)
* 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
2020-02-05 22:45:09 +01:00
Seghir Nadir ad08e0e10b default-to-experimental-when-no-flag-is-present (https://github.com/woocommerce/woocommerce-blocks/pull/1700) 2020-02-05 19:40:10 +01:00
Seghir Nadir 8e3ac17585 Introduce feature flags (https://github.com/woocommerce/woocommerce-blocks/pull/1631)
* 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
2020-01-31 21:04:37 +01:00
Seghir Nadir bfb2f33bfd add new icons and remove old ones (https://github.com/woocommerce/woocommerce-blocks/pull/1644)
* 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
2020-01-31 19:20:33 +01:00
Albert Juhé Lluveras 48c914ce4d Load core translations for PHP strings that don't have a translation (https://github.com/woocommerce/woocommerce-blocks/pull/1694)
* Load core translations for PHP strings too

* Fix accepted_args

* Make phpcs:ignore more precise
2020-01-31 15:28:18 +01:00
Mike Jolley ca8efd7c3e Add API fetch error handling (https://github.com/woocommerce/woocommerce-blocks/pull/1687)
* 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>
2020-01-31 13:01:34 +00:00
Mike Jolley 6e27805ca7 Re-organise docs and add WP update instructions (https://github.com/woocommerce/woocommerce-blocks/pull/1691)
* 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>
2020-01-31 12:48:11 +00:00
Mike Jolley b569f53083 Add and/or labelling to active filters block (https://github.com/woocommerce/woocommerce-blocks/pull/1630)
* 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>
2020-01-31 10:15:22 +00:00
Rua Haszard 7f44458418 Basic storybook implementation (https://github.com/woocommerce/woocommerce-blocks/pull/1636)
* 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>
2020-01-31 09:59:14 +13:00
renovate[bot] dd53b1779b Update wordpress monorepo (https://github.com/woocommerce/woocommerce-blocks/pull/1666)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-30 13:16:52 +01:00
renovate[bot] 2e78ff6187 Update dependency rimraf to v3.0.1 (https://github.com/woocommerce/woocommerce-blocks/pull/1664)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-30 12:07:06 +01:00
renovate[bot] 35c0d176df Update npm to v6.13.7 (https://github.com/woocommerce/woocommerce-blocks/pull/1665)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-30 11:58:28 +01:00
renovate[bot] 3f982ab71c Update dependency eslint-config-prettier to v6.10.0 (https://github.com/woocommerce/woocommerce-blocks/pull/1663)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-30 11:57:52 +01:00
renovate[bot] 3306726a35 Update dependency downshift to v4.0.8 (https://github.com/woocommerce/woocommerce-blocks/pull/1662)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-30 11:53:34 +01:00
renovate[bot] c13449d5e6 Pin dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/1661)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-30 11:53:22 +01:00
Albert Juhé Lluveras c8f297a700 All Products & filters accessibility improvements (https://github.com/woocommerce/woocommerce-blocks/pull/1656)
* 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
2020-01-30 11:04:39 +01:00
Albert Juhé Lluveras aa4bc302a5 Replace three dots with an ellipsis in Product Search placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/1672) 2020-01-30 10:28:17 +01:00
Mike Jolley 29600c501f Summary/description consistency update (https://github.com/woocommerce/woocommerce-blocks/pull/1639)
* 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
2020-01-29 10:59:33 +00:00
Mike Jolley b65b93e7e7 Rename the "Align Buttons" option for the All Products Block (https://github.com/woocommerce/woocommerce-blocks/pull/1659)
* Allow css to work for any element

* Rename option to specific last block rather than button
2020-01-29 10:28:40 +00:00
Mike Jolley e1538395be CSS naming convention docs (https://github.com/woocommerce/woocommerce-blocks/pull/1653)
* Move github specific MD files and config to .github directory.

* Create security.md file

* Add docs directory (and exclude from builds)

* Add code of conduct MD

* Move release docs to /docs directory

* Add css guidelines

* Feedback

* Modifier example

* Clarify package naming

* descendant...
2020-01-28 15:50:57 +00:00
Darren Ethier db14accc64 Update changelog script. (https://github.com/woocommerce/woocommerce-blocks/pull/1655)
This pull:

- removes zenhub option from package.json
- installs and implement `merge-config` package. This allows for usage of environment variables and command line variables along with `package.json` configuration for the changelog generation.
- implements new variable: `devNoteLabel` for indicating what label indicates the pull has (or requires) a devnote. Pull Requests with this label will have `[DN]` appended to the changelog entry.
- adds new variable: `changelogSrcType` for indicating what source to use for generating changelogs (can be `MILESTONE` or `ZENHUB_RELEASE`). Implemented detection of this in code, defaults to `MILESTONE`.
- Modify initial setup text so if user already has api key(s) setup, then we don't give instructions again. Also improve the output when keys aren't set to make it clear what needs done.
- Make the environment variable for Zenhub Api token consistent with Github token (`ZH_API_TOKEN` instead of `ZH_API_KEY`).
- Update package.json with changelog script variation for running it with zenhub release as the source.
- Update `RELEASE.md` docs to clarify changelog script options
- Add a `README.md` doc for the changelog script.
2020-01-28 08:47:26 -05:00
Darren Ethier 7c83133337 Update renovate to assign `type: dependencies` label for pulls (https://github.com/woocommerce/woocommerce-blocks/pull/1648)
* update renovate to assign `type: dependencies` label for pulls

* Fix invalid json from bad cut/paste

* Update renovate.json

Include skip-changelog label for renovate pulls.
2020-01-27 10:37:09 -05:00
Mike Jolley dcf5bfa67e Fix RTL price slider display issues (https://github.com/woocommerce/woocommerce-blocks/pull/1651)
* Fix slider image direction with RTL

* Fix track position under RTL
2020-01-27 15:16:19 +00:00
renovate[bot] ee83b0f86a Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/1649)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-27 13:07:57 +00:00
Albert Juhé Lluveras 7f048ec9c4 Product grid blocks: display rating stars in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/1650) 2020-01-27 13:56:32 +01:00
Mike Jolley 022cd10e08 remove issue label bot config
Closes woocommerce/woocommerce-blocks#1643
2020-01-27 12:02:18 +00:00
Darren Ethier af2178df55 Update CODEOWNERS
Assign code review to @woocommerce/merch-squad instead of @woocommerce/blocks
2020-01-27 06:41:45 -05:00
Darren Ethier d54340a90e Only populate default attributes on initial mount of block. (https://github.com/woocommerce/woocommerce-blocks/pull/1640)
* 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
2020-01-24 11:53:15 -05:00
Mike Jolley 00c700655f Add renovate config to avoid pinning `jetpack-autoloader` package (https://github.com/woocommerce/woocommerce-blocks/pull/1632)
* Switch jetpack-autoloader in package.json to use a range

* Update rangeStrategy for jetpack autoloader in renovate config

* Switch to bump range strategy
2020-01-24 16:50:06 +00:00
Albert Juhé Lluveras 2014e6f1e2 Reorganize dependencies in package.json (https://github.com/woocommerce/woocommerce-blocks/pull/1633)
* Reorganize dependencies in package.json

* Move '@wordpress' entries back to devDependencies
2020-01-24 13:00:11 +01:00
Albert Juhé Lluveras ab51bffaa0 All Products: fix 'Add to Cart' in IE11 (https://github.com/woocommerce/woocommerce-blocks/pull/1642)
* All Products: fix 'Add to Cart' in IE11

* Default Event to null
2020-01-23 19:32:48 +01:00
Mike Jolley 24d2600d43 Move default population to class function instead of using constructor (https://github.com/woocommerce/woocommerce-blocks/pull/1638) 2020-01-23 14:11:15 +00:00
Rua Haszard dd6afe0c70 remove tangential questions todo section (https://github.com/woocommerce/woocommerce-blocks/pull/1635) 2020-01-23 10:35:58 +13:00
Albert Juhé Lluveras 069b42dc39 Make 'Add order notes?' string localizable (https://github.com/woocommerce/woocommerce-blocks/pull/1629) 2020-01-22 21:35:29 +01:00
Rua Haszard e83819281c Document release process (https://github.com/woocommerce/woocommerce-blocks/pull/1614)
* draft release process!

* ensure info in CONTRIBUTING is in release doc, remove section & add link

* fix link to release doc

* tweaks / typos / formatting after re-read

* tweak mia/follow up section title to more standard @todo

* add getting started docs for repo/dev tooling (required for releasing!)

* add intro sentence + link to required node versions + fix some grammar errors, heading level

* tweaks based on Timmy feedback:
- link to a real changelog commit
- add git pull to unambiguously illustrate "get on tip of branch"
- recommend multiple testers
+ sanity check => confidence check

* mention jetpack-autoloader

* reinstate "updating specific file on WPORG" section

* flesh out "release to wporg" so tools are more transparent +
+ add steps for testing/validating WPORG release

* clarify major / minor / patch process differences +
+ roughly define versions
+ mention Zenhub (tbc)

* clarification: cherry picking is patch releases only +
+ clarify readme update outcome

* tweaks & typos after reading start=>finish

* clarify versions info + tidy links in WPORG validate section

* tweaks & typos from Aljullu feedback

* flesh out pre-release testing steps:
- test oldest supported WP
- test existing blocks content / validation errors
- ALL of the testing steps are recommended :)
2020-01-23 08:48:35 +13:00
Mike Jolley d1737e76c2 Change default rows for product grid blocks to 3 (https://github.com/woocommerce/woocommerce-blocks/pull/1613)
* 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
2020-01-22 16:58:25 +00:00
Mike Jolley d3003bd07a Fix price filter for products when stored prices do not match displayed prices (tax settings) (https://github.com/woocommerce/woocommerce-blocks/pull/1612)
* Tax handling for price filters

* Tidy clauses logic

* DRY

* Reduce queries for tax classes

* clearer adjust_price_filters_for_displayed_taxes conditonal

* Remove unused method

* Add safety check for or_queries

* exit earlier
2020-01-22 14:46:52 +00:00
renovate[bot] 4b9d10c591 Update dependency node-sass to v4.13.1 (https://github.com/woocommerce/woocommerce-blocks/pull/1623)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-22 11:19:48 +01:00
renovate[bot] 48b510646f Update dependency downshift to v4.0.7 (https://github.com/woocommerce/woocommerce-blocks/pull/1621)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-22 11:19:40 +01:00
renovate[bot] ebcc98f43a Update dependency eslint-plugin-jest to v23.6.0 (https://github.com/woocommerce/woocommerce-blocks/pull/1622)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-22 11:19:13 +01:00
renovate[bot] 88a9b686b9 Pin dependency @wordpress/html-entities to 2.5.0 (https://github.com/woocommerce/woocommerce-blocks/pull/1620)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-22 11:00:50 +01:00
Rua Haszard f34ac3c48c Update readme (on master) with 2.5.11 changelog 2020-01-21 09:30:12 +13:00
Mike Jolley 69a509f184 Improved cart styling for desktop and mobile (https://github.com/woocommerce/woocommerce-blocks/pull/1587)
* 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
2020-01-20 16:43:22 +00:00
Albert Juhé Lluveras e607ce2d1a Preserve query key order in All Products (https://github.com/woocommerce/woocommerce-blocks/pull/1611) 2020-01-20 13:04:13 +01:00
renovate[bot] ae3c3189d2 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/1607)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-20 12:48:57 +01:00
Mike Jolley 8b28a77f01 Consistent HTML entities in Store API (https://github.com/woocommerce/woocommerce-blocks/pull/1597)
* Wrap HTML responses with helper method

* Remove unused get_attribute_taxonomy_name method

* Create prepare_html_response method

* Decode product and attribute names

* Check is_scalar to leave objects alone
2020-01-19 19:19:59 -05:00
Seghir Nadir 7e81841e83 Fix issue in order by date (https://github.com/woocommerce/woocommerce-blocks/pull/1598)
* fix order by of date order in products
2020-01-20 00:00:43 +01:00
Rua Haszard d7be99b520 fix issue when user re-selects same attr when setting up filter block: (https://github.com/woocommerce/woocommerce-blocks/pull/1596)
- exit early if there's no selected attr passed in
2020-01-20 07:58:26 +13:00
Albert Juhé Lluveras 09f2c626f9 Make TextInput respect prefers-reduced-motion preference (https://github.com/woocommerce/woocommerce-blocks/pull/1588)
* Make TextInput respect prefers-reduced-motion preference

* Reverse prefers-reduced-motion check
2020-01-18 10:39:13 +01:00
Albert Juhé Lluveras cad3e72769 Create CountryInput component (https://github.com/woocommerce/woocommerce-blocks/pull/1585)
* 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
2020-01-17 17:58:08 +01:00
Rua Haszard eaa6b42d89 UI for removing cart items (not including hooking up to API) (https://github.com/woocommerce/woocommerce-blocks/pull/1579)
* 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
2020-01-17 13:46:56 +00:00
Seghir Nadir 4a8c57fbe1 Focus on Full Cart mode after inserting (https://github.com/woocommerce/woocommerce-blocks/pull/1582)
* focus on the cart main block
2020-01-17 13:23:33 +01:00
Mike Jolley 9842986cd8 Add `low_stock_remaining` field to cart items API (https://github.com/woocommerce/woocommerce-blocks/pull/1583)
* add low_stock_remaining field

* Update tests
2020-01-17 11:46:17 +00:00
Mike Jolley 253a0160f1 Validate store API schema in unit tests (https://github.com/woocommerce/woocommerce-blocks/pull/1553)
* Add schema validation helper

* Add tests for cart item schema

* Fix schema errors found by tests

* Add tests and fix validation for remaining store API endpoints

* Tweak response for nested diffs

* Array syntax

* Improved nesting and type validation for schema

* Implement and fix type checking across test suite

* Type validation fixes

* Fix null comparison

* Fix array handling

* Switch to number type and support in validation

* Test the tests

* Update tests to use objects which match schema, avoiding JSON encode/decode
2020-01-17 11:34:15 +00:00
Rua Haszard f3e4fc2bd4 fix react runtime js error when all products productLink=off: (https://github.com/woocommerce/woocommerce-blocks/pull/1593)
- renderedSalesAndImage is a js var holding react element;
- don't surround with (), converts to obj { renderedSalesAndImage: bla }
2020-01-17 09:50:48 +13:00
Rua Haszard eb2baf6a84 add product short description to cart/items api (https://github.com/woocommerce/woocommerce-blocks/pull/1552)
* add product short description to cart/items api

* leave short description as plain text + use default trim length (200)

* strip html and shortcodes from product short description

* limit cart line item short description to max 75 chars

* add normalize_whitespace to trim extra newlines in short description

* retrieve product description & truncate consistent with products API
2020-01-17 08:51:39 +13:00
Mike Jolley 0e752e9e0d Introduce view switcher component for the cart block (https://github.com/woocommerce/woocommerce-blocks/pull/1576)
* 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
2020-01-16 14:50:48 +00:00
Albert Juhé Lluveras 3f0368e63b Checkout: Fix city input field showing country value (II) (https://github.com/woocommerce/woocommerce-blocks/pull/1580) 2020-01-16 12:31:00 +01:00
renovate[bot] dfc963b545 Pin dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/1567)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-15 15:19:06 +00:00
Mike Jolley 86b8b7779c Add Quantity selector component for cart line items (https://github.com/woocommerce/woocommerce-blocks/pull/1558)
* Implement quantity selector component

* Improve default appearance

* Remove underline

* Add aria speak

* Improved keycode handling

* Add focus styles to buttons and inputs

* Increase constrast
2020-01-15 11:32:54 +00:00
renovate[bot] 8f73d68904 Update dependency css-loader to v3.4.2 (https://github.com/woocommerce/woocommerce-blocks/pull/1571)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-15 10:20:06 +01:00
renovate[bot] fa188ecc85 Update babel monorepo to v7.8.3 (https://github.com/woocommerce/woocommerce-blocks/pull/1568)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-15 10:19:51 +01:00
renovate[bot] 1f8e0ffcdf Update dependency autoprefixer to v9.7.4 (https://github.com/woocommerce/woocommerce-blocks/pull/1569)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-15 10:19:31 +01:00
renovate[bot] 095b992c75 Update dependency core-js to v3.6.4 (https://github.com/woocommerce/woocommerce-blocks/pull/1570)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-15 10:15:02 +01:00
renovate[bot] 5b13fc2b1a Update dependency downshift to v4.0.5 (https://github.com/woocommerce/woocommerce-blocks/pull/1572)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-15 10:12:04 +01:00
Rua Haszard 5c85ee23cf follow up fixes on cart low stock warning badge (https://github.com/woocommerce/woocommerce-blocks/pull/1564)
* rename low stock prop inside lineitem to avoid unnecessary renders

* remove unnecessary span in low stock warning badge
2020-01-15 12:54:32 +13:00
Rua Haszard 86dca691e5 show discount on cart line items & price styling (https://github.com/woocommerce/woocommerce-blocks/pull/1548)
* 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
2020-01-15 09:52:42 +13:00
Rua Haszard b9bfef0ba4 show low stock warning badge on cart line items (incl fake test data) (https://github.com/woocommerce/woocommerce-blocks/pull/1557) 2020-01-15 09:50:32 +13:00
Albert Juhé Lluveras 11a033d862 Make RadioControl id optional (https://github.com/woocommerce/woocommerce-blocks/pull/1563) 2020-01-14 21:21:29 +01:00
Albert Juhé Lluveras 1dfcb18a90 Make TextInput id optional (https://github.com/woocommerce/woocommerce-blocks/pull/1560) 2020-01-14 20:10:50 +01:00
Rua Haszard f23dee503f show product details in cart line items: attributes (variations), product short description (https://github.com/woocommerce/woocommerce-blocks/pull/1549)
* 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
2020-01-14 12:07:52 +13:00
Seghir Nadir 5c82b2d718 add fieldset and legend to FormStep component (https://github.com/woocommerce/woocommerce-blocks/pull/1400)
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2020-01-13 10:21:20 -05:00
Darren Ethier 22f423866e fix errors caused by demo payment methods (https://github.com/woocommerce/woocommerce-blocks/pull/1547) 2020-01-13 10:08:14 -05:00
Darren Ethier a50dab39fc Improve changelog script (https://github.com/woocommerce/woocommerce-blocks/pull/1543)
The changelog script now has the following:

- constructed more modularly for easier maintenance.
- removed coupling to blocks repository so it can be used in more contexts (potentially publishing as it's own package).
- switched to use github v4 api (graphql) to reduce number of requests (reducing the likelihood of hitting api limits)
- added support for zenhub releases instead of github milestones for what pulls to derive changelog from.
2020-01-13 10:06:32 -05:00
renovate[bot] 6540a751e0 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/1550)
Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
2020-01-13 13:28:28 +00:00
Albert Juhé Lluveras fa25989c0f Remove 'wc-vendors-frontend' registration (https://github.com/woocommerce/woocommerce-blocks/pull/1546) 2020-01-10 20:31:58 +01:00
Albert Juhé Lluveras 6c806bacac Remove vendors-frontend from Webpack config (https://github.com/woocommerce/woocommerce-blocks/pull/1544)
* Remove vendors-frontend from Webpack config

* Increase cart-frontend.js bundlewatch limit

* Remove 'wc-vendors-frontend' from Cart block dependencies
2020-01-10 20:21:14 +01:00
Mike Jolley 5926a56602 Add Empty Placeholder for the on-sale product block (https://github.com/woocommerce/woocommerce-blocks/pull/1519)
* Add EmptyResponsePlaceholder for on sale block

* Linting

* Address feedback
2020-01-10 14:40:15 +00:00