Commit Graph

839 Commits

Author SHA1 Message Date
Darren Ethier c85078366d Fix bugs in useCollection hook (https://github.com/woocommerce/woocommerce-blocks/pull/1103)
* export new hooks

* fix bug with isLoading result on useCollection
2019-10-30 09:57:39 +00:00
Darren Ethier 7e3f5e8ab9 Add useCollection and useCollectionHeader hooks (closes: woocommerce/woocommerce-blocks#1096) (https://github.com/woocommerce/woocommerce-blocks/pull/1099)
* add use-collection hook and tests

* Add use-collection-header hook

* update use-store-products hook to implement useCollection and useCollection header under the hood
2019-10-29 08:01:13 -04:00
Mike Jolley b029837889 BlocksWpQuery wrapper for WP_Query (https://github.com/woocommerce/woocommerce-blocks/pull/1086)
* Introduce filter hook `woocommerce_blocks_product_grid_hash_args`

This filter allows to extend the hash arguments depending on the context
(e.g. a specific language with WPML).

* BlocksWpQuery class to wrap WP Query

* Use BlocksWpQuery

* Use query_vars for hash and add inline docs
2019-10-28 14:08:00 +00:00
Mike Jolley f851a6ef9b All Products with Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1032)
* Inital block creation

* Update labels

* Columns, rows, sample data json

* Output data from API

* thumbnail_html

* Split into smaller components of grid

* Price handling

* Image handling

* Remove !

* frontend

* Work on cart api

* Cart error handling and product type conditions

* innerblock progress

* Implement layoutConfig as set from innerblocks shape.

Note:

- this is just a poc
- where things are configured likely needs changed
- will still need to work out how this gets persisted for the frontend and how things get displayed there (but likely will work fairly similar in terms of mapping to components).

* use correct prop name

* Working edit button

* Clean up block controls and edit view

* Add link with innerblocks

* update link description

* correctly handle components with inner blocks as children

* Re-organise atomic components and blocks into own directories

* Unique keys for components

* Fix default layout when inserting block for first time

* Working layoutconfig save

* Save attributes

* Move sale badge to image component

* Add disabled to render preview and blocks

* icons

* Editor view styling

* Update withComponetId to stop component ID incrementing too many times

Co-Authored-By: Darren Ethier <darren@roughsmootheng.in>

* Improve key generation

* done/cancel buttons on edit

* Create withProducts HOC for All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/994)

* Create withProducts HOC for All Products block

* Add order select and pagination to All Products block

* Go to first page when changing order

* Add HOC test

* Make sure block is updated whem columns/rows change in the editor

* Fix 'SALE' badge positioning

* Remove unnecessary key

* Honor 'perPage' value when generating placeholders

* Make placeholder sizes match rendered block item

* Several CSS improvements

* Remove unused CSS properties

* Move getProducts to hocs utils

* Remove All Products sample-data.json

* Fix order select wrong margin in the editor

* Refactor how loading image gets its size

* Clear products when loadProducts start

* Enhance pagination logic

* Fix placeholder width

* Fix regular_price check

* Set product link max-width

* Implement querystrings for the All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/997)

* Implement querystrings for the All Products block

* Create withWindow HOC

* Add with-window tests

* Use renderFrontend util in All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/1003)

* Add with-window tests

* Use renderFrontend util in All Products block

* Rename properties and components from 'order' to 'sort' (https://github.com/woocommerce/woocommerce-blocks/pull/1012)

* Rename properties and components from 'order' to 'sort'

* Rename onOrderChange to onSortChange

* Remove unnecessary stylint-disable-line (https://github.com/woocommerce/woocommerce-blocks/pull/1016)

* Create withBrowserLocation and withBrowserHistory HOC (https://github.com/woocommerce/woocommerce-blocks/pull/1022)

* Create withBrowserWindowProp HOC

* Remove unnecessary expect's

* Always pass window prop to propMap if it exists

* Scroll to top when switching pages in All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/1011)

* Scroll to top when switching pages in All Pages block

* Improve keyboard navigation in the All Products block

* Create withScrollToTop HOC

* Fix variable name typo

* Update paths with aliases

* Avoid first and last page being included in pagination 'pagesToDisplay' (https://github.com/woocommerce/woocommerce-blocks/pull/1015)

* Update lock

* constants

* linting

* Clean up styling

* Prettier

* Block options for title/image

* Prettier

* Remove shared content controls

* Update atomic block descriptions

* Summary block

* Prettier

* Impoved template edit appearance and added inline tips

* Apply prettier

* Reset and cancel buttons

* Improved keys

* Tweak tip placement

* Remove incorrect comments

* Remove disabled ofr non interactive elements

* Fragment not needed

* Update assets/js/atomic/components/product-list/title/index.js

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

* Move componentId hoc

* Comment

* Implement onImageLoaded

* Pagination: disable first/last page if they are active (https://github.com/woocommerce/woocommerce-blocks/pull/1041)

* Update assets/js/atomic/components/product-list/rating/index.js

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

* Sale badges refactoring

Adds sale badges blocks and improves how the default blocks are defined.

* revert changes in withComponentId

* fix flexbox alignment

* Create withQueryStringValues HOC and use it in ProductGrid component (https://github.com/woocommerce/woocommerce-blocks/pull/1040)

* Create withQueryStringValues HOC and use it in ProductGrid component

* Add tests

* Add comment explaining urlParameterSuffix

* Don't destructure props if only used once

* Move dependencies check outside the HOC

* Update test description

* Remove HOCs no longer used

* Update assets/js/atomic/blocks/product-list/image/index.js

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

* Update assets/js/atomic/components/product-list/sale-badge/index.js

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

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

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

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

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

* Feedback

* Grid to List

* Improved badge handling

* update package-lock after merge from master

* Add wp.data store for schema and lists. (https://github.com/woocommerce/woocommerce-blocks/pull/1008)

* install @wordpress/data-controls and deepFreeze

* add schema store

* add query-state store

* add collections store

* add bundle entry point (and export store keys and constants)

* add master README.md for new stores

* add bundle configuration and register asset php side

* Add missing param name

Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>

* code style fixes

* remove unnecessary period from test description

* Simplify conditional

* reorder imports (code style)

* reorder imports and codestyle

* refactor using lodash for state utils

* reorder imports

* reorder imports

* reorder dependencies

* reorder dependnecies an remove duplication block

* remove errant tab

* reorder dependencies

* Modify collections store to add headers to the store state. (https://github.com/woocommerce/woocommerce-blocks/pull/1073)

* add control for getting unparsed response from apiFetch

* Modify action so it recieves a response object.

* modify reducer to handle response object

* improve selectors to make headers accessible

- modifys existing `getCollection` to retrieve items from state.
- adds `getCollectionHeader` selector

* update resolvers to handle full response from request

- also adds resolver for `getCollectionHeader`

* update docs for changes

* Improve spacing in doc

Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>

* Fix spacing in inline docs

Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>

* change `getFromState` to receive an object instead of arguments list.

* Prepare All Products block to accept extension inner blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1047)

* Simplify BLOCK_MAP

* Prepare All Products block to accept extension inner blocks

* Change filter name

* Update filter name

* Add check that block exists in BLOCK_MAP

* Create REVERSED_BLOCK_MAP instead of searching blocks each time

* Change how child blocks are registered for All Products block

* Refactor All Products block so reverse map isn't needed

* Remove getDefaultBlocks

* Make sure getRegisteredInnerBlocks always returns an object and add checks to registerInnerBlock

* Add missing blockName arg

* Add inline docs to block registry

* Move 'blockName' prop to context

* Typos

* Improve registerInnerBlock error messages and create a validation function

* Refactor context

* Rename validateOption to assertOption

* refactor where new context lives and add alias for base-context

* fix doc block

* remove todo block (there’s an issue for it)

* rename context

* Update assets/js/atomic/components/product-list/sale-badge/index.js

Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>

* HeadingToolbar comment

* Tweak bool comparison

* Improve how default layouts are set so all blocks can be removed and the no-content message is correct

* Sale centering

* Fix default template

* Product example switch to preview

* Update preview schema and image data to match latest schema

* Add @woocommerce/atomic-components alias

* Alias for previews to prevent need for relative paths

* Drop `align` for sale block

Align disrupts other blocks in unexpected and unavoidable ways. Drop support so the sale block is a block level item.

* Rename atomic components and blocks (and create ProductLayoutContext) (https://github.com/woocommerce/woocommerce-blocks/pull/1089)

* rename atomic blocks and components to be more generic (drop list)

* create new context for productlayout and implement provider

* Rename ProductSalesBadge to ProductSaleBadge

* Add php5.3 restriction for All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/1090)

* enable legacy builds and add handling for AllProducts to be wp5.3 only

* fix legacy builds

* Prevent filemtime notice

* Implement new data stores with All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/1067)

* add new hooks and tests and alias for hooks

* various fixes for stores after implementation tests

* implement new stores for ProductList component

* add doc blocks for useStoreProducts hooks

* fix typo in property on returned object
2019-10-28 09:53:09 -04:00
Darren Ethier dee8dcb296 ensure function is not re-created unnecessarily. (https://github.com/woocommerce/woocommerce-blocks/pull/1093) 2019-10-28 08:44:25 -04:00
Mike Jolley 6319de52e9 Build maintainence (https://github.com/woocommerce/woocommerce-blocks/pull/1092)
* Ignore node_modules when watching to reduce CPU load

https://github.com/webpack/webpack/issues/1706

* Remove prepack - we no longer push to NPM
2019-10-28 11:00:04 +00:00
renovate[bot] 2a72092dd4 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/1091) 2019-10-28 10:31:57 +00:00
Darren Ethier 73f5355b28 fix function passed through as prop is a class property (https://github.com/woocommerce/woocommerce-blocks/pull/1088) 2019-10-25 12:57:04 +01:00
Mike Jolley 9d79403db2 REST API - Store API - Product filtering data, products endpoint, and cart refinements (https://github.com/woocommerce/woocommerce-blocks/pull/1055)
* Cart add endpoint and schema

* Empty card DELETE method

* Merge into single controller

* Revise verb usage

* PUT/update requests

* Move under rest api namespace

* Basic test coverage

* Invalid tests with status check

* Variation handling

* Update src/RestApi/StoreApi/Schemas/CartItemSchema.php

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

* Remove key arg for delete endpoint

* code comment for creation

* rename param to product_id

* Renaming methods from _item to _cart_item

* Prepare storeAPI products endpoint for public use

* Price filter headers

* Attribute counts

* Add Rating filter

* Rating counts

* Fix counts

* Moved utilities

* API docs

* Use correct response for cart item

* Attributes filtering

* Stats

* Products/Stats unit tests

* Rename stats to collection data

* Remove `embed` from schema

* Add since $VID:$ tags

* Improve operator logic and add isset checks

* Force cart schema to be readonly
2019-10-25 10:43:52 +01:00
Darren Ethier a6c150a11c Add WP 5.3 preview for Feature Product Block (https://github.com/woocommerce/woocommerce-blocks/pull/1034)
* fix space in setting retrieval

* allow for previews via `withProduct`

* add example property to block registration

* add preview handling

* fix typo

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

* Added product preview JSON

* Add example.js file for preview content

* Update HOC to handle preview.

* Move preview check
2019-10-24 14:55:44 +01:00
Mike Jolley 00ab1d1913 Add responsive product grid styles (https://github.com/woocommerce/woocommerce-blocks/pull/1066)
* Add responsive grid styles

* Tweak 2 column padding.

* Use mixin
2019-10-24 14:39:50 +01:00
Mike Jolley 18c8c96172 Fix homeUrl variable (https://github.com/woocommerce/woocommerce-blocks/pull/1065) 2019-10-23 11:51:10 +01:00
renovate[bot] 9ad48205b4 Update dependency react-test-renderer to v16.11.0 (https://github.com/woocommerce/woocommerce-blocks/pull/1074) 2019-10-23 10:19:08 +02:00
renovate[bot] 3d22e01e63 Update dependency lint-staged to v9.4.2 (https://github.com/woocommerce/woocommerce-blocks/pull/1072) 2019-10-23 10:19:01 +02:00
renovate[bot] d36b881b9c Update dependency eslint-plugin-jest to v22.20.0 (https://github.com/woocommerce/woocommerce-blocks/pull/1071) 2019-10-23 10:18:43 +02:00
renovate[bot] 5d70a4499d Update dependency core-js to v3.3.3 (https://github.com/woocommerce/woocommerce-blocks/pull/1070) 2019-10-23 10:18:18 +02:00
renovate[bot] 835dc648e9 Update Node.js to v10.17.0 (https://github.com/woocommerce/woocommerce-blocks/pull/1069) 2019-10-23 10:17:36 +02:00
Albert Juhé Lluveras 15b330d36e Add previews for Reviews blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1059)
* Add previews for Reviews blocks

* Use double negation instead of Boolean

* Refactor withReviews to use class properties

* Fix tests

* Make example data translatable
2019-10-22 16:13:14 +02:00
Darren Ethier 2fde552e3f Refresh package-lock.json due to node lts version bump (https://github.com/woocommerce/woocommerce-blocks/pull/1058)
* refresh package-lock

* update travis config

* doh, typo

* try a rebuild for all
2019-10-21 16:26:53 +01:00
Mike Jolley b0b5cc51a3 Introduce a Cart API on top of the REST API (https://github.com/woocommerce/woocommerce-blocks/pull/1046)
* Cart add endpoint and schema

* Empty card DELETE method

* Merge into single controller

* Revise verb usage

* PUT/update requests

* Move under rest api namespace

* Basic test coverage

* Invalid tests with status check

* Variation handling

* Update src/RestApi/StoreApi/Schemas/CartItemSchema.php

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

* Remove key arg for delete endpoint

* code comment for creation

* rename param to product_id

* Renaming methods from _item to _cart_item
2019-10-21 12:11:52 +01:00
renovate[bot] b1e2dfa0b0 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/1057) 2019-10-21 10:11:28 +02:00
Mike Jolley 5f4949ac6b Add empty content messages (https://github.com/woocommerce/woocommerce-blocks/pull/717)
* Return empty result if no products are found

* Add empty response handler

* Update to latest PR

* Pass render prop
2019-10-16 14:13:10 +01:00
Mike Jolley e227dff18e Use Server Side Rendering for Product Category List block (https://github.com/woocommerce/woocommerce-blocks/pull/1024)
* Convert product list to SSR block

* Remove PRODUCT_CATEGORIES from block data

* onclick event handling

* Empty placeholder

* code style

* depth css class

* hasCount handling

* Deprecation handling of old saved markup

* Code style

* Legacy attribute mapping
2019-10-16 13:02:43 +01:00
Frankie Jarrett 7906937c9a Allow devs to get non-cached product grid results (https://github.com/woocommerce/woocommerce-blocks/pull/1052) 2019-10-16 07:42:14 -04:00
Albert Juhé Lluveras 5c5876580a Update NPM package docs after deprecation (https://github.com/woocommerce/woocommerce-blocks/pull/1045) 2019-10-16 11:12:24 +02:00
renovate[bot] b95203aad9 Update dependency @babel/core to v7.6.4 (https://github.com/woocommerce/woocommerce-blocks/pull/1049) 2019-10-16 11:11:16 +02:00
renovate[bot] da0cf36f66 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/1042) 2019-10-16 10:44:33 +02:00
renovate[bot] 5f303cfe6f Update dependency autoprefixer to v9.6.5 (https://github.com/woocommerce/woocommerce-blocks/pull/1051) 2019-10-16 10:41:55 +02:00
renovate[bot] 99a3660e29 Update dependency @octokit/rest to v16.33.1 (https://github.com/woocommerce/woocommerce-blocks/pull/1050) 2019-10-16 10:41:33 +02:00
renovate[bot] b4325feeb3 Pin dependency compare-versions to 3.5.1 (https://github.com/woocommerce/woocommerce-blocks/pull/1048) 2019-10-16 10:41:15 +02:00
Darren Ethier 007039c5b9 Expose wp_version on settings api and provide a js version compare function (https://github.com/woocommerce/woocommerce-blocks/pull/1033)
* install compare-versions and export on `@woocommerce/settings` external

* expose `wp_version` on wcSettings

* export a compareWithWpVersion function for easier version checking

* improve semver coercing for wp version check

also add tests

* fix for code standards around imports

* switch to camelcase for version option
2019-10-11 11:29:27 -04:00
renovate[bot] 452e963840 Update dependency eslint-config-prettier to v6.4.0 (https://github.com/woocommerce/woocommerce-blocks/pull/1039) 2019-10-09 10:33:10 +02:00
renovate[bot] 6300e48766 Update dependency cross-env to v6.0.3 (https://github.com/woocommerce/woocommerce-blocks/pull/1038) 2019-10-09 10:32:05 +02:00
renovate[bot] 152977d66c Update dependency autoprefixer to v9.6.4 (https://github.com/woocommerce/woocommerce-blocks/pull/1037) 2019-10-09 10:31:40 +02:00
renovate[bot] d1bc3fff2d Update dependency @octokit/rest to v16.33.0 (https://github.com/woocommerce/woocommerce-blocks/pull/1036) 2019-10-09 10:30:54 +02:00
renovate[bot] 3f62090f93 Update dependency @babel/core to v7.6.3 (https://github.com/woocommerce/woocommerce-blocks/pull/1035) 2019-10-09 10:30:16 +02:00
Mike Jolley 226967599c Refactor permission checks for authors (https://github.com/woocommerce/woocommerce-blocks/pull/1006) 2019-10-07 11:20:56 +01:00
renovate[bot] 15d74ecd31 Lock file maintenance (https://github.com/woocommerce/woocommerce-blocks/pull/1023)
* Lock file maintenance

* Enable composer in renovate
2019-10-07 11:05:35 +01:00
Albert Juhé Lluveras 725b447944 Fix ProductAttributeControl not reacting to clicks (https://github.com/woocommerce/woocommerce-blocks/pull/1021) 2019-10-06 15:37:48 +02:00
Darren Ethier f3bd3e6a09 Introduce legacy build system and new aliases (https://github.com/woocommerce/woocommerce-blocks/pull/1018)
* install directory-named-webpack-plugin

* create new plugin for fallback legacy imports

* implement webpack configuration for fallback legacy imports and legacy builds

Note: legacy builds are currently disabled, we can enable by just commenting out when we need them.

* removed unused webpack plugin experimented with in earlier iteration

* prettier fixes

* add legacy folder with readme for explanation

* add some info on legacy builds to `CONTRIBUTING.md`

* refactor imports to use new aliases

* fix link in doc

* update jest test config for new aliases

* use native string.startsWith instead of custom function

* reformat file for spacing/code style

* add slash to alias

* clean up webpack config and make things more dry

* update indent style for json files to be tab not spaces

- adjusts editorconfig rules
- reformat jest.config.json

* simplify conditional
2019-10-06 08:36:15 -04:00
Darren Ethier 85bcbbebd4 Load back-compat wcSettings global for old `@woocommerce/settings` package (https://github.com/woocommerce/woocommerce-blocks/pull/1017) 2019-10-04 07:40:48 -04:00
Albert Juhé Lluveras 576af53250 Create CODEOWNERS file (https://github.com/woocommerce/woocommerce-blocks/pull/1013)
* Create CODEOWNERS file

* Add CODEOWNERS to the list of excluded files
2019-10-02 19:08:05 +02:00
renovate[bot] 96a902fa81 Update dependency cross-env to v6.0.2 (https://github.com/woocommerce/woocommerce-blocks/pull/1009) 2019-10-02 15:52:10 +02:00
renovate[bot] d8760bcdd6 Update dependency eslint to v6.5.1 (https://github.com/woocommerce/woocommerce-blocks/pull/1010) 2019-10-02 15:51:15 +02:00
Albert Juhé Lluveras 99416e945e Update Products on Sale and Products Tag icons (https://github.com/woocommerce/woocommerce-blocks/pull/987)
* Update Products on Sale and Products Tag icons

* Update on sale icon
2019-10-01 10:20:52 +01:00
Mike Jolley d244a60935 Update docblock for remove_core_blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1004) 2019-10-01 10:20:18 +01:00
Darren Ethier 3aafd4ec35 remove unnecessary logic (https://github.com/woocommerce/woocommerce-blocks/pull/999) 2019-09-28 14:50:28 -04:00
Darren Ethier 8e6944d1e2 no need to check Woo Core version for back-compat (https://github.com/woocommerce/woocommerce-blocks/pull/1000) 2019-09-28 14:50:03 -04:00
Albert Juhé Lluveras 01412e6af0 Update ProductControl to use HOCs (https://github.com/woocommerce/woocommerce-blocks/pull/974)
* Update ProductControl to use HOCs

* Only show variations in certain ProductControls

* Cleanup

* Refactor withSingleSelected selected prop logic

* Fix selected values not being respected

* Fix wrong propTypes notation

* Set parent: 0 in getProducts util func

* Use static properties in withProductVariations

* Move messages outside of the functional component

* Check that variations is an array

* Fix debounced search

* Fix broken tests

* Rename withSingleSelected to withTransformSingleSelectToMultipleSelect
2019-09-25 16:22:36 +02:00
renovate[bot] c86114d2cb Update dependency cross-env to v6 (https://github.com/woocommerce/woocommerce-blocks/pull/993) 2019-09-25 12:27:11 +02:00