Commit Graph

278 Commits

Author SHA1 Message Date
Darren Ethier 57fdb8fe9c Implement PHP DI container and refactor. Also implements new Asset data interface for extendable settings passed to js. (https://github.com/woocommerce/woocommerce-blocks/pull/956)
* Add dependency injection container for blocks

* Add new Pacakge and Bootstrap classes.

- Bootstrap for bootstrapping the plugin.
- Package will replace `src/Package` and added as a dependency for any classes needing package info.

* Introduce AssetsDataRegistry for managing asset data

* refactor existing classes to use new DIC and Asset Data Registry

- this is the bare minimum needed to make this pull viable.
- further refactors will be done in more atomic smaller pulls for easier review.

* add new settings handling and export `@woocommerce/settings` as an alias to wc.wcSettings

- the export is exposed php side on the `wc-settings` handle.

* Remove unnecessary concatenation

* Fix typos and improve doc blocks

* fix php linting issue

* Use better escaping function.

* improve jsdoc spacing

* improve test assertion

* use fully qualified class names in bootstrap

* improve comment block to account for dynamic version string replace on build

* handle exceptions a bit differently

* correct dependency reference in webpack config

* remove blank lines

* fix doc block comment alignment

* Various doc/grammar/spacing fixes from code review.

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* improve naming, documentation and logic of filter callbacks

While this is intended for sanitization/validation, the callback ultimately provides flexibility for filtering the value before returning or setting in state so `filter` is a better name for this.
2019-09-23 14:07:13 -04:00
Albert Juhé Lluveras ddd272867e Create renderFrontend utils function (https://github.com/woocommerce/woocommerce-blocks/pull/954)
* Create renderFrontend utils function

* Avoid unnecessary variable assignment
2019-09-09 15:25:22 +02:00
Albert Juhé Lluveras 7d29cdf570 Fix product categories list displaying [Object] instead of count (https://github.com/woocommerce/woocommerce-blocks/pull/950)
* Fix product list display [Object] instead of count

* Make it easier to style product-categories
2019-09-09 15:25:12 +02:00
Albert Juhé Lluveras 26a387d35f Rename ApiErrorPlaceholder to ErrorPlaceholder (https://github.com/woocommerce/woocommerce-blocks/pull/955) 2019-09-09 14:04:54 +02:00
Albert Juhé Lluveras 85df274523 Reformat files with new tabwidth (https://github.com/woocommerce/woocommerce-blocks/pull/953)
* Reformat files with new tabwidth

* Review featured product background position so it doesn't break
2019-09-09 12:52:48 +02:00
Albert Juhé Lluveras 616293deb0 Fix review block icons not having foreground color (https://github.com/woocommerce/woocommerce-blocks/pull/952) 2019-09-09 12:47:33 +02:00
Darren Ethier e4ff6eb606 Fix increment bug in withComponentId (https://github.com/woocommerce/woocommerce-blocks/pull/951)
* fix bug with component and add test coverage

* code style spacing on doc block

* fix prettier config
2019-09-07 08:04:34 -04:00
Albert Juhé Lluveras d4cfd644b8 Remove colors from icons displayed in the shortcuts inserter (https://github.com/woocommerce/woocommerce-blocks/pull/949)
* Remove colors from inserter icons

* Prettier
2019-09-06 18:03:41 +02:00
Albert Juhé Lluveras 6ab7834f59 Install prettier and reformat files (https://github.com/woocommerce/woocommerce-blocks/pull/945)
* Install prettier

* Reformat all files

* Add prettier to precommit hook

* Update prettier settings to match Gutenberg code standards

* Reformat files with new settings

* Improve legibility in some line breaks
2019-09-05 17:09:31 +02:00
Albert Juhé Lluveras dc232e87d6 Add withCategories and withAttributes HOCs (https://github.com/woocommerce/woocommerce-blocks/pull/935)
* Add withCategories HOC and show API errors in Product Category Control

* Create withAttributes HOC and display errors in Product Attribute Control

* Refactor formatError so it handles JS errors and API errors

* Rename 'onSelectAttribute' with 'onExpandAttribute'

* Add and update tests

* Fix error in product attributes endpoint

* Refactor ProductCategoryControl into a functional component

* Refactor ProductAttributeControl into a functional component

* Refactor formatError to use a 'message' and 'type' properties

* Replace enzyme with TestRenderer

* Fix formatErrors doctype format

* Rename 'frontend' error type to 'general'
2019-09-04 18:07:00 +02:00
Albert Juhé Lluveras 4489b50774 Add Product Search Icon (https://github.com/woocommerce/woocommerce-blocks/pull/944) 2019-09-04 15:18:07 +02:00
Albert Juhé Lluveras 04c9933030 RTL fixes (https://github.com/woocommerce/woocommerce-blocks/pull/938)
* Install webpack-rtl-plugin

* Rotate arrow buttons on RTL sites

* Minify in safe mode
2019-09-03 19:55:20 +02:00
Albert Juhé Lluveras 73f8f15bb3 Create Pagination and ProductOrderSelect components (https://github.com/woocommerce/woocommerce-blocks/pull/926)
* Create ProductOrderSelect component

* Create Pagination component

* Add description to props

* Use BEM class name

* Use < > instead of ← →

* Update product order select options to match Shop core page

* Refactor pagination so it behaves like core pagination

* Update snapshots
2019-09-03 16:41:05 +02:00
Albert Juhé Lluveras 3829707bf9 Add error states to all components/blocks which use HOCs (https://github.com/woocommerce/woocommerce-blocks/pull/928)
* Show errors in Products Control component

* Export error formatting logic into a util
2019-08-30 11:36:06 +02:00
Albert Juhé Lluveras 05ef21861d Fix color of All Reviews block icon (https://github.com/woocommerce/woocommerce-blocks/pull/919)
* Fix color of All Reviews block icon

* Fix lint notice
2019-08-28 11:29:43 +02:00
Mike Jolley ea0ce0e915 Fix wcSettings conflicts with wc-admin (https://github.com/woocommerce/woocommerce-blocks/pull/916)
* Add inline settings script later than init

* Rename to shared-settings for clarity - other extensions filter these

* Implement block settings

* tweak used hooks

* update comment

* Shared settings should be dependency

* Make Webpack output shared and block settings (https://github.com/woocommerce/woocommerce-blocks/pull/918)
2019-08-27 16:25:32 +01:00
Albert Juhé Lluveras 67cfa47b30 Fix order by and load more buttons not hidden in frontend review blocks (https://github.com/woocommerce/woocommerce-blocks/pull/914) 2019-08-27 15:56:07 +02:00
Albert Juhé Lluveras d1db64362a Cleanup withComponentId from base components (https://github.com/woocommerce/woocommerce-blocks/pull/907) 2019-08-27 12:24:50 +02:00
Albert Juhé Lluveras a6bf6d7fc0 Update review block icons (https://github.com/woocommerce/woocommerce-blocks/pull/913) 2019-08-27 12:01:35 +02:00
Albert Juhé Lluveras 20e3052d1c Show API errors in reviews editor block (https://github.com/woocommerce/woocommerce-blocks/pull/909)
* Show API errors in reviews editor block

* Update tests
2019-08-27 11:38:41 +02:00
Albert Juhé Lluveras ce30a9f1ff Reviews blocks: Fix warnings with components state (https://github.com/woocommerce/woocommerce-blocks/pull/908) 2019-08-27 11:38:28 +02:00
Albert Juhé Lluveras e19cd56c7f Remove RawHTML used for notice translations (https://github.com/woocommerce/woocommerce-blocks/pull/889)
* Remove RawHTML used for notice translations

* Revert "Remove RawHTML used for notice translations"

This reverts commit e28e082c2eefd8c29e982ee34ac27f99267171c3.

* Escape translation strings before using them

* Add translator notices
2019-08-26 12:11:50 +02:00
Albert Juhé Lluveras 4a1171364d Create OrderSelect and Label components (https://github.com/woocommerce/woocommerce-blocks/pull/905)
* Create Label and OrderSelect components

* Update review list item so it uses 'classnames'

* Split review order select styles from generic component

* Update snapshots

* Refactor Label so we don't need to check Symbol

* Add description to Label and OrderSelect components

* Use prop-types instead of prop-types-elementtype

* Simplify Label propTypes

* Update package-lock
2019-08-23 18:35:34 +02:00
Albert Juhé Lluveras 9d8d083363 All Reviews block (https://github.com/woocommerce/woocommerce-blocks/pull/902)
* Make all reviews block share the same frontend script

* Create 'All Reviews' block

* Create All Reviews no reviews placeholder

* Create EditorContainerBlock and move some shared logic there

* Update icon

* Address PR feedback
2019-08-23 16:48:48 +02:00
Darren Ethier 72f0ed470f Refactor: Introduce `wc-block-settings` bundle serving as `@woocommerce/settings` external. (https://github.com/woocommerce/woocommerce-blocks/pull/903)
* export new @woocommerce/settings external on `wc.blockSettings` global

- This handles reading data from the dom and assigning it to the global used in all packages dependent on `@woocommerce/settings` which is registered as an external pointing to the global.
- ensures that server data is only loaded on a route if needed.

* switch all direct imports of constants to use new `@woocommerce/settings` external

* enqueu new `wc-block-settings` script and attach inline data to it.

* fix test configuration and adjust test to use new external

* fix bad merge resolution after rebase

* switch constants import to `@woocommerce/settings` external after rebase

* reorder imports for convention

* improve method name
2019-08-22 16:56:47 -04:00
Albert Juhé Lluveras 46934d2946 Create withReviews base HOC (https://github.com/woocommerce/woocommerce-blocks/pull/877)
* Create withReviews base HOC

* Add tests

* Make Reviews by Category use withReviews HOC

* Move componentDidUpdate and debounce dependency to decouple HOC from components

* Spaces

* Rename 'delayMethod' to 'delayFunction'

* Refactor withReviews HOC

* Update tests

* Minor fixes

* Undo fix being handled in woocommerce/woocommerce-blocks#884

* Remove hardcoded from withReviews

* Update delay comment

* Use callbacks instead of announceUpdates prop

* Move props check to a 'shouldReplaceReviews' method

* Fix productId propType

* Move per_page and offset args to 'getArgs'

* Update withReviews displayName

* Fix tests

* Add callback propsTypes

* Use is-shallow-equal
2019-08-22 13:36:20 +02:00
Darren Ethier 0b9559e2db Install @babel/plugin-proposal-class-properties. (https://github.com/woocommerce/woocommerce-blocks/pull/856)
* add @babel/plugin-proposal-class-properties plugin

* refactor ProductByCategoryBlock to use class properties
2019-08-21 09:05:17 -04:00
Albert Juhé Lluveras df9840a108 Review blocks: fix attribute notices not appearing (https://github.com/woocommerce/woocommerce-blocks/pull/888)
* Review blocks: fix attribute notices not appearing

* Classes and CSS cleanup
2019-08-21 12:48:22 +02:00
Albert Juhé Lluveras 9250d31227 Fix error appearing on Reviews by Product when there were no reviews (https://github.com/woocommerce/woocommerce-blocks/pull/884)
* Fix error appearing on Reviews by Product when there were no reviews

* Revert "Fix error appearing on Reviews by Product when there were no reviews"

This reverts commit 73e95b39aa9a318888d08bb51faeff8bb51259d7.

* Move withProduct() HOC to editor-block.js

* Revert "Move withProduct() HOC to editor-block.js"

This reverts commit ae9515792d4870cc5cf1d92a2d6acc91198b5f62.

* Move renderNoReviews back to edit.js

* Move no reviews placeholder to its own component

* Remove usage of 'RawHTML'

* Fix propTypes

* Remove unnecessary escapeHTML
2019-08-21 09:48:22 +02:00
Mike Jolley 3a9c5ba1cd Reviews by category block (https://github.com/woocommerce/woocommerce-blocks/pull/804)
* Create Reviews by Product block

* Honor Content settings

* Fix wrong className

* Load new wc-packages file

* Add reviews-by-product JS files to webpack config

* Cleanup

* Remove error messages

* Add Reviews by Product icon

* Update sort options

* Allow additional CSS classes attribute

* Refactor block styles

* Fix wrong default for reviews_orderby

* Don't enforce CSS chunks

* Add reviews count to Reviews by Product controls (https://github.com/woocommerce/woocommerce-blocks/pull/671)

* Add label to Reviews by Product controls count (https://github.com/woocommerce/woocommerce-blocks/pull/677)

* Add reviews count to Reviews by Product controls

* Add label to Reviews by Product controls count

* Add label to Reviews by Product controls count

* Update components package

* Review ordering and placeholders (https://github.com/woocommerce/woocommerce-blocks/pull/688)

* Add support for comment_count ordering and add to productcontrol

* Add a placeholder if rating count is 0

* Update assets/js/components/utils/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/reviews-by-product/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* grammar

* Fix some linting errors and warnings (https://github.com/woocommerce/woocommerce-blocks/pull/693)

* Create Reviews by Product block placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/691)

* Create Reviews by Product block placeholder

* Reviews by Product: load and render reviews with JS (https://github.com/woocommerce/woocommerce-blocks/pull/696)

* Reviews by Product: load and render reviews with JS

* Add dangerouslySetInnerHTML explanatory comment

* Fix wrong dependency source

* Debounce getReviews call when creating the Reviews by Product block

* Rename 'Reviewer Picture' with 'Avatar' (https://github.com/woocommerce/woocommerce-blocks/pull/702)

* Lint errors

* Replace stringify query with addQueryArgs (https://github.com/woocommerce/woocommerce-blocks/pull/707)

* Add reviews endpoint (https://github.com/woocommerce/woocommerce-blocks/pull/705)

* Prevent state updates on unmounted components (https://github.com/woocommerce/woocommerce-blocks/pull/715)

* Add Order by and Load more controls in Reviews by Product frontend (https://github.com/woocommerce/woocommerce-blocks/pull/716)

* Export IconReviewsByProduct (https://github.com/woocommerce/woocommerce-blocks/pull/721)

* Fix Reviews by Product layout in IE11 (https://github.com/woocommerce/woocommerce-blocks/pull/723)

* Set minimum to per page input field (https://github.com/woocommerce/woocommerce-blocks/pull/731)

* Hide avatars in Reviews by Products if 'show_avatars' settings is false (https://github.com/woocommerce/woocommerce-blocks/pull/730)

* Blocks API - Reviews endpoint with rating sort and category filtering (https://github.com/woocommerce/woocommerce-blocks/pull/726)

* Move file to correct location

* We are only using the reviews endpoint not revioews/id

* Remove sensistive data and make endpoint public

* Allow guest access to approved reviews

* Add support for rating sorting

* category filtering

* update arg name

* fix category query

* Reviews by Product: add placeholders when loading reviews (https://github.com/woocommerce/woocommerce-blocks/pull/732)

* Add placeholder animation (https://github.com/woocommerce/woocommerce-blocks/pull/733)

* Hook up Reviews by Product 'Order by' with endpoint (https://github.com/woocommerce/woocommerce-blocks/pull/736)

* Hook up Reviews by Product 'Order by' with endpoint

* Use onChange instead of onBlur in select control

* Reviews by Product: Hide ratings if they are disabled in settings (https://github.com/woocommerce/woocommerce-blocks/pull/740)

* Hide ratings in Reviews by Product if disabled in settings

* Hide order by select if ratings are disabled

* Reviews by Product cleanup (https://github.com/woocommerce/woocommerce-blocks/pull/773)

* Fix wrong method name

* Reduce the number of dependencies used in Reviews by Product (https://github.com/woocommerce/woocommerce-blocks/pull/774)

* Reduce the number of dependencies used in Reviews by Product

* Use 'withComponentId' HOC

* Remove debounce

* Fix wrong proptype

* Get rid of JS warning

* Load render from react-dom

* Add formatted_date_created item schema (https://github.com/woocommerce/woocommerce-blocks/pull/788)

* Inital block setup

* Fix import of WithComponentID

* Render the category reviews

* Add new settings to Reviews by Product block (https://github.com/woocommerce/woocommerce-blocks/pull/787)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Reviews by Product: prevent importing all HOCs and import only withComponentId (https://github.com/woocommerce/woocommerce-blocks/pull/811)

* Reviews by product: Update review styling and content (https://github.com/woocommerce/woocommerce-blocks/pull/806)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Review design/layout

* verified icons

* Read more component

* remove comment

* expanded -> isExpanded

* Localise and change default elipses

* Simplify ReadMore

* Support children rather than passing content

* remove outside

* remove list style

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* merge set state

* Add missing parameter doc in renderReview (https://github.com/woocommerce/woocommerce-blocks/pull/820)

* Fix Reviews by Product order by select not honoring default setting (https://github.com/woocommerce/woocommerce-blocks/pull/818)

* Read more component - change how clamped content is shown (https://github.com/woocommerce/woocommerce-blocks/pull/821)

* Pass review as components

* Build summary from content and track both

* Toggle display after inital load

* remove unused variable

* remove componentDidUpdate

* Simplify clampLines

* Put back componentDidUpdate, but store final summary in state

* clampEnabled

* Call clampLines from componentDidMount (https://github.com/woocommerce/woocommerce-blocks/pull/826)

* truncate html tests

* implement trimHTML and pass test

* Feedback

* test short content

* Use withProduct HOC in ReviewsByProductEditor (https://github.com/woocommerce/woocommerce-blocks/pull/828)

* Use withProduct HOC

* Convert ReviewsByProductEditor to a functional component

* Add loading and error states

* Prevent loading screen appearing when changing products

* Reviews: only save wrapper element to post (https://github.com/woocommerce/woocommerce-blocks/pull/830)

* Update based on product reviews

* Cleanup after master merge

* Implement content hiding and placeholder states for reviews blocks

* Output product names and adjust css

* Review permalink

* Remove old read-more component which was moved

* showProductName is already part of passed attributes

* CSS tweaks for missing elements

* Move dir

* Move product reviews block

* Move shared uitils

* update paths

* frontend paths

* Update paths

* shared attributes

* switch to constants

* Shared review block code

* Replace constants

* Fix hidden content bug

* star alignment
2019-08-19 15:13:07 +01:00
Albert Juhé Lluveras a6a131f8fd Move wc_product_block_data variables to constants file (https://github.com/woocommerce/woocommerce-blocks/pull/870) 2019-08-17 11:14:11 +02:00
Albert Juhé Lluveras fb842d2596 Update Reviews styles so it looks the same in the editor and the frontend (https://github.com/woocommerce/woocommerce-blocks/pull/871) 2019-08-16 16:12:06 +01:00
Albert Juhé Lluveras ad38f9d327 Create Reviews by Product block (https://github.com/woocommerce/woocommerce-blocks/pull/658)
* Create Reviews by Product block

* Honor Content settings

* Fix wrong className

* Load new wc-packages file

* Add reviews-by-product JS files to webpack config

* Cleanup

* Remove error messages

* Add Reviews by Product icon

* Update sort options

* Allow additional CSS classes attribute

* Refactor block styles

* Fix wrong default for reviews_orderby

* Don't enforce CSS chunks

* Add reviews count to Reviews by Product controls (https://github.com/woocommerce/woocommerce-blocks/pull/671)

* Add label to Reviews by Product controls count (https://github.com/woocommerce/woocommerce-blocks/pull/677)

* Add reviews count to Reviews by Product controls

* Add label to Reviews by Product controls count

* Add label to Reviews by Product controls count

* Update components package

* Review ordering and placeholders (https://github.com/woocommerce/woocommerce-blocks/pull/688)

* Add support for comment_count ordering and add to productcontrol

* Add a placeholder if rating count is 0

* Update assets/js/components/utils/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/reviews-by-product/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* grammar

* Fix some linting errors and warnings (https://github.com/woocommerce/woocommerce-blocks/pull/693)

* Create Reviews by Product block placeholder (https://github.com/woocommerce/woocommerce-blocks/pull/691)

* Create Reviews by Product block placeholder

* Reviews by Product: load and render reviews with JS (https://github.com/woocommerce/woocommerce-blocks/pull/696)

* Reviews by Product: load and render reviews with JS

* Add dangerouslySetInnerHTML explanatory comment

* Fix wrong dependency source

* Debounce getReviews call when creating the Reviews by Product block

* Rename 'Reviewer Picture' with 'Avatar' (https://github.com/woocommerce/woocommerce-blocks/pull/702)

* Lint errors

* Replace stringify query with addQueryArgs (https://github.com/woocommerce/woocommerce-blocks/pull/707)

* Add reviews endpoint (https://github.com/woocommerce/woocommerce-blocks/pull/705)

* Prevent state updates on unmounted components (https://github.com/woocommerce/woocommerce-blocks/pull/715)

* Add Order by and Load more controls in Reviews by Product frontend (https://github.com/woocommerce/woocommerce-blocks/pull/716)

* Export IconReviewsByProduct (https://github.com/woocommerce/woocommerce-blocks/pull/721)

* Fix Reviews by Product layout in IE11 (https://github.com/woocommerce/woocommerce-blocks/pull/723)

* Set minimum to per page input field (https://github.com/woocommerce/woocommerce-blocks/pull/731)

* Hide avatars in Reviews by Products if 'show_avatars' settings is false (https://github.com/woocommerce/woocommerce-blocks/pull/730)

* Blocks API - Reviews endpoint with rating sort and category filtering (https://github.com/woocommerce/woocommerce-blocks/pull/726)

* Move file to correct location

* We are only using the reviews endpoint not revioews/id

* Remove sensistive data and make endpoint public

* Allow guest access to approved reviews

* Add support for rating sorting

* category filtering

* update arg name

* fix category query

* Reviews by Product: add placeholders when loading reviews (https://github.com/woocommerce/woocommerce-blocks/pull/732)

* Add placeholder animation (https://github.com/woocommerce/woocommerce-blocks/pull/733)

* Hook up Reviews by Product 'Order by' with endpoint (https://github.com/woocommerce/woocommerce-blocks/pull/736)

* Hook up Reviews by Product 'Order by' with endpoint

* Use onChange instead of onBlur in select control

* Reviews by Product: Hide ratings if they are disabled in settings (https://github.com/woocommerce/woocommerce-blocks/pull/740)

* Hide ratings in Reviews by Product if disabled in settings

* Hide order by select if ratings are disabled

* Reviews by Product cleanup (https://github.com/woocommerce/woocommerce-blocks/pull/773)

* Fix wrong method name

* Reduce the number of dependencies used in Reviews by Product (https://github.com/woocommerce/woocommerce-blocks/pull/774)

* Reduce the number of dependencies used in Reviews by Product

* Use 'withComponentId' HOC

* Remove debounce

* Fix wrong proptype

* Get rid of JS warning

* Load render from react-dom

* Add formatted_date_created item schema (https://github.com/woocommerce/woocommerce-blocks/pull/788)

* Fix import of WithComponentID

* Add new settings to Reviews by Product block (https://github.com/woocommerce/woocommerce-blocks/pull/787)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Reviews by Product: prevent importing all HOCs and import only withComponentId (https://github.com/woocommerce/woocommerce-blocks/pull/811)

* Reviews by product: Update review styling and content (https://github.com/woocommerce/woocommerce-blocks/pull/806)

* Add new settings to Reviews by Product block

* Remove helpText and add notices

* Use RangeControl for numeric settings

* Prevent fetching new reviews if all were already fetched

* Enable product image in reviews

* Remove unnecessary catch

* Refactor getReviews

* Move getReviews back to block's code

* Cleanup

* Fix wrong order in editor

* Hide 'Load More Reviews' if showLoadMore is false

* Move getReviews to utils.js

* Add @woocommerce/navigation to package.json

* Make notices non-dismissable

* Review design/layout

* verified icons

* Read more component

* remove comment

* expanded -> isExpanded

* Localise and change default elipses

* Simplify ReadMore

* Support children rather than passing content

* remove outside

* remove list style

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/components/read-more/index.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* merge set state

* Add missing parameter doc in renderReview (https://github.com/woocommerce/woocommerce-blocks/pull/820)

* Fix Reviews by Product order by select not honoring default setting (https://github.com/woocommerce/woocommerce-blocks/pull/818)

* Read more component - change how clamped content is shown (https://github.com/woocommerce/woocommerce-blocks/pull/821)

* Pass review as components

* Build summary from content and track both

* Toggle display after inital load

* remove unused variable

* remove componentDidUpdate

* Simplify clampLines

* Put back componentDidUpdate, but store final summary in state

* clampEnabled

* Call clampLines from componentDidMount (https://github.com/woocommerce/woocommerce-blocks/pull/826)

* truncate html tests

* implement trimHTML and pass test

* Feedback

* test short content

* Use withProduct HOC in ReviewsByProductEditor (https://github.com/woocommerce/woocommerce-blocks/pull/828)

* Use withProduct HOC

* Convert ReviewsByProductEditor to a functional component

* Add loading and error states

* Prevent loading screen appearing when changing products

* Reviews: only save wrapper element to post (https://github.com/woocommerce/woocommerce-blocks/pull/830)

* Fix bundlesize config not picking frontend files (https://github.com/woocommerce/woocommerce-blocks/pull/840)

* Reviews by Product: split 'block.js' into smaller chunks (https://github.com/woocommerce/woocommerce-blocks/pull/841)

* Split 'block.js' into smaller chunks

* Move frontend blocks to their specific folder

* Order imports

* Typo

* Add frontend components proptypes

* Fix indentation

* Call 'this.getDefaultArgs' directly inside 'getReviews'

* Move access to wc_product_block_data to the top of the file

* Rename 'frontend' folder to 'base'

* Rename base components and move styles to their folder

* Fix Reviews by Product using rating count instead of review count (https://github.com/woocommerce/woocommerce-blocks/pull/860)

* Improve Reviews by Product accessibility (https://github.com/woocommerce/woocommerce-blocks/pull/861)

* Improve Reviews by Product accessibility

* Make 'onClick' prop not required in <LoadMoreButton>

* Wrap Reviews by Product editor block with <Disabled>

* Reviews: fix reviews without rating not appearing when sorting by rating (https://github.com/woocommerce/woocommerce-blocks/pull/863)
2019-08-15 16:55:57 +02:00
Mike Jolley aa65f19a46 Remove screen-reader-text css rules (https://github.com/woocommerce/woocommerce-blocks/pull/849) 2019-08-15 13:19:09 +01:00
Mike Jolley 1ed14cdc01 Introduce withCategory HOC for featured category block (https://github.com/woocommerce/woocommerce-blocks/pull/846)
* Introduce withCategory hoc

* Refactor featured category to use new hoc

* Update docblocks
2019-08-15 10:36:24 +01:00
Mike Jolley 5f5797dc3d Add global data helpers (https://github.com/woocommerce/woocommerce-blocks/pull/848)
* Extract global settings to assets/js/data

* add alias

* Fix alias

* Rename to settings
2019-08-13 15:43:48 +01:00
Claudio Sanches dddadb895f Fix duplicated translatable string (https://github.com/woocommerce/woocommerce-blocks/pull/843)
* Fix duplicated translatable string

* Fixed more duplicated strings in descriptions

* Merge similar strings
2019-08-13 11:29:00 +01:00
Mike Jolley 84a464fc62 Allow hidden products in handpicked products block (https://github.com/woocommerce/woocommerce-blocks/pull/803)
* Allow hidden products in handpicked block

* Simplify set_visibility_query_args
2019-08-12 12:54:51 +01:00
Albert Juhé Lluveras a36608d9dc Make react-test-renderer name consistent (https://github.com/woocommerce/woocommerce-blocks/pull/836) 2019-08-12 13:41:18 +02:00
Albert Juhé Lluveras e7180dfc7b Product Categories: prevent importing all HOCs and import only withComponentId (https://github.com/woocommerce/woocommerce-blocks/pull/834) 2019-08-12 10:44:51 +01:00
Albert Juhé Lluveras e5f73b05e8 Add eslint JSDoc checks (https://github.com/woocommerce/woocommerce-blocks/pull/819)
* Add eslint JSDoc checks

* Use @wordpress/eslint-plugin for ESLint config

* Rename 'augments' with 'extends'

* Remove '@wordpress/eslint-plugin' from package.json
2019-08-09 18:18:46 +02:00
Albert Juhé Lluveras 708fb72288 Disable HTML editing on Featured Category (https://github.com/woocommerce/woocommerce-blocks/pull/816) 2019-08-08 17:09:41 +02:00
Albert Juhé Lluveras 6e91656677 Featured Product: hide background opacity control if there is no image (https://github.com/woocommerce/woocommerce-blocks/pull/813)
* Featured Product: hide background opacity control if there is no image

* Add explanation for FocalPointPicker check
2019-08-08 17:09:32 +02:00
Albert Juhé Lluveras 6f88bb85a2 Add tests to utils/products.js (https://github.com/woocommerce/woocommerce-blocks/pull/817)
* Add tests to utils/products.js

* Make getImageSrcFromProduct return an empty string instead of 0 when there are no images
2019-08-08 14:48:34 +01:00
Albert Juhé Lluveras 3097bb0901 Create a constants.js file with the NAMESPACE value (https://github.com/woocommerce/woocommerce-blocks/pull/799)
* Create a constants.js file with the  NAMESPACE value

* Created 'ENDPOINTS' constant instead of 'NAMESPACE'

* Use NAMESPACE in constants.js
2019-08-07 16:47:01 +02:00
Darren Ethier 2d5b06f07a Introduce withSearchedProducts higher order component and refactor ProductsControl Component (https://github.com/woocommerce/woocommerce-blocks/pull/791)
* add new withSearchedProducts hoc

includes tests

* convert to functional component and wrap with new hoc

* remove dependency between tests

* Fix typo with PropTypes bool

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* remove unnecessary specific import

* fix bug introduced on refactor for selected prop recalc

* fix tests that were testing the wrong expectation

- also improved mocks a bit so they are a bit more realistic for the purpose of the test coverage.

* remove unnecessary Fragment

* tweak propType definitions and remove defaults

- this keeps argument expectations in sync with wrapped component and reduces chance of unexpected behaviour if `SearchListControl` logic changes.

* remove lodash.find dependency.
2019-08-06 11:34:13 -04:00
Mike Jolley 918f822128 Disable HTML editing on dynamic blocks (https://github.com/woocommerce/woocommerce-blocks/pull/801)
* Disable HTML editing on dynamic blocks

* Tabindex case
2019-08-06 15:10:01 +01:00
Mike Jolley 6a6d280eb0 Add product search block (https://github.com/woocommerce/woocommerce-blocks/pull/697)
* basic scaffold

* Progress

* Fix saving

* Move data to form

* Update assets/js/blocks/product-search/editor.scss

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* Update assets/js/blocks/product-search/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>

* hex case

* Use a span element

* Move render method

* CSS

* Update buttons

* Fix navigation buttons

* remove webkit appearance styles for buttons

* Swap rich to plain text component

* Improved attribute handling

* Update assets/js/blocks/product-search/block.js

Co-Authored-By: Albert Juhé Lluveras <contact@albertjuhe.com>
2019-08-05 11:25:57 +01:00
Albert Juhé Lluveras 8a187db5d9 Move withComponentId to hocs directory (https://github.com/woocommerce/woocommerce-blocks/pull/797) 2019-08-05 10:37:16 +01:00
Albert Juhé Lluveras 2504bffdfa Create `withProduct` HOC (https://github.com/woocommerce/woocommerce-blocks/pull/779)
* Reset 'loaded' state in Featured Product and Category blocks

* Minor code improvements

* Remove state from ApiErrorPlaceholder

* Move getProduct to a HOC

* Undo changes in Featured Category

* Update proptypes

* Move error messages to <ApiErrorPlaceholder>

* Reorder props

* Move lifecycle methods to HOC

* Make <FeaturedProduct> component presentational

* Move withProduct to js/hocs

* Create NAMESPACE constant in utils

* Create getProduct util function

* Set 'error' and 'product' state to null instead of 'false' when they have no value

* Prevent getImageSrcFromProduct and getImageIdFromProduct returning an error when 'product' is not an object

* Add HOC tests

* Use 'toBe' and 'toBeNull' jest expect methods instead of 'toEqual' when possible

* Export HOCs from index

* Move mock implementation to beforeEach
2019-08-02 13:56:53 +02:00