Commit Graph

10 Commits

Author SHA1 Message Date
Mike Jolley 2d506f9f57 Fix/you do not need lodash (https://github.com/woocommerce/woocommerce-blocks/pull/9161)
* Remove lodash `without` usage

* isNumber

* Remove lodash `difference`

* Replace lodash isEmpty with type guard

* Replace isObject with type guard

* remove lodash noop

* Replace lodash clamp

* replace lodash uniqueId

* Remove uniqueId import

* Add eslint rule to restrict lodash import

* Replace lodash range

* Replace lodash has() function

Replace lodash has

* replace omitby

* Replace lodash isEqual with fastDeepEqual

* Replace kebabCase with change-case package

* Replace lodash camelCase

Replace lodash mapKeys with function

Move mapkeys to utility

Create camelCaseKeys which replaces usage of mapKeys

* Replace lodash debounce with custom utiity

* replace lodash keyby

* Replace lodash pick with native function

* Replace lodash cloneDeep with klona

* Replace snake case keys package with change case

* Replace sortBy with fast sort package

* replace isEmpty with type guard

* Replace pickBy usage in validation reducer

* Replace groupBy usage in search list control

* Replace flatten, uniqBy usage in getProducts()

* Remove setWith and clone from updateState

* Replace custom useThrottle with useThrottledCallback from use-debounce package

* onSelectRate can use-debounce

* Fix missing flatten

* Update assets/js/data/cart/test/push-changes.ts

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
2023-04-28 11:29:45 +01:00
Saad Tarhi c586b1a5f3 Revert (https://github.com/woocommerce/woocommerce-blocks/pull/6166) (https://github.com/woocommerce/woocommerce-blocks/pull/6253)
Revert "Prevent Featured Product block from breaking when product is out of stock + hidden
from catalog (https://github.com/woocommerce/woocommerce-blocks/pull/6166)"

This reverts commit 92387e2
2022-04-14 10:31:01 +00:00
Alex Florisca 0c7c2db6c0 Update @woocmmerce/eslint-plugin to 2.0.0 (https://github.com/woocommerce/woocommerce-blocks/pull/6203)
* Update @woocmmerce/eslint-plugin to 2.0.0

* Fixed some eslint errors

* Fix syntax errors

* Fix most linting errors

* Feedback changes

* Fix one more eslint issue
2022-04-08 14:47:19 +01:00
Alba Rincón 92387e2912 Prevent `Featured Product` block from breaking when product is out of stock + hidden from catalog (https://github.com/woocommerce/woocommerce-blocks/pull/6166)
* Prevent accessing the first element of the `parentProduct` array if empty

* Include all products regardless of their `stock_status`

By default, the `/wc/store/v1/products` endpoint does not return products with
`outofstock` stock status. We want the users to be able to select any product
regardless of its stock status, we need to explicitly request them using the
`stock_status` query param.

* Use the optional chaining operator

Co-authored-by: Tomasz Tunik <tomasztunik@gmail.com>
2022-03-31 15:24:10 +02:00
Mike Jolley a58b2d0ac4 Store API: Introduce API Versioning System (https://github.com/woocommerce/woocommerce-blocks/pull/5911)
* Fix missing dependency

* Min version exceeds required 5.6

* Move exceptions

* Move schemas under V1 namespace

* Move routes to v1

* Move RouteException

* Route versioning

* Update route and schema identifiers/init

* Rework route init to support multiple versions and multiple schema

* Tests for cart routes

* Cart coupons tests

* Batch

* extensions

* Update docs

* Update remaining tests

* woocommerce_store_api_route_version was unused

* Revert unrelated change

* Fix phpcs

* Update src/StoreApi/docs/guiding-principles.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update src/StoreApi/docs/cart-items.md

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Update src/StoreApi/RoutesController.php

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>

* Note about v1 unversioned endpoints

* Remove unused get_route_version

* 409 comment in tests

* Remove copy pasted comments

* Update all usage to v1

* Correct namespace

* More v1 namespaces

* More missing v1

* fix mocks

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
2022-02-23 12:00:45 +00:00
Mike Jolley f0fb1af7d3 Fix handpicked product selections when a store has over 100 products. (https://github.com/woocommerce/woocommerce-blocks/pull/4534)
* Convert withSearchedProducts to typescript

* isLargeCatalog query needs no limit

* Pass tests
2021-08-06 14:25:12 +01:00
Mike Jolley dbbb99d55e Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059)
* BLOCK SETTINGS: Remove unused constants/settings

* AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks

* Move checkout and cart block settings to checkout and cart blocktypes

* Move isShippingCalculatorEnabled to cart block

* Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting

* Move displayCartPricesIncludingTax to blocktypes, and implement getSetting

* Move block settings to core settings and blocktypes

* Fix namespace usage

* Move review settings

* move tag settings

* Keep productCount in core data

* Move min and default height

* Improve storePages code

* Move attributes to attribute filter block type

* Move $word_count_type outside of settings array

* Remove unneeded setting in preview data (shippingCostRequiresAddress)

* Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings

* DEFAULT_COLUMNS and ROWS to settings

* Move product columns/rows to block types

* Add grid settings to AllProducts block

* Correct default rows

* correct min rows default

* Move hasDarkEditorStyleSupport

* Move hideOutOfStockItems to block type settings

* Move build settings to inline script dependency

* Pass data through asset api and move restApiRoutes

* Export all core settings as constants

* Remove WORD_COUNT_TYPE from core settings

* Move some other core settings to assets

* Update constants

* Make settings use TypeScript

* Update CURRENT_USER_IS_ADMIN usage

* WORD_COUNT_TYPE

* REST_API_ROUTES

* REVIEW_RATINGS_ENABLED and SHOW_AVATARS

* Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants

* Remove MIN_HEIGHT

* Remove DEFAULT_HEIGHT

* PLACEHOLDER_IMG_SRC

* LIMIT_TAGS

* HAS_PRODUCTS

* HOME_URL

* HAS_TAGS

* COUPONS_ENABLED

* SHIPPING_ENABLED

* TAXES_ENABLED

* DISPLAY_ITEMIZED_TAXES

* SHIPPING_COST_REQUIRES_ADDRESS

* SHIPPING_STATES and SHIPPING_COUNTRIES

* STORE_PAGES

* ALLOWED_COUNTRIES

* ALLOWED_STATES

* SHIPPING_METHODS_EXIST

* PAYMENT_GATEWAY_SORT_ORDER

* CHECKOUT_SHOW_LOGIN_REMINDER

* CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP

* ATTRIBUTES

* DISPLAY_CART_PRICES_INCLUDING_TAX

* DISPLAY_CART_PRICES_INCLUDING_TAX

* update build for TS files

* fix build dir

* Move blocks build config params

* Move placeholderImgSrc to core settings

* Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration

* Move wordCountType to abstract block

* Remove WORD_COUNT_TYPE in favour of getSetting

* Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline

* Add wcBlocksConfig

* fix tests

* Remove unused $asset_data_registry

* remove console.log

* Move build settings to abstract block

* Trigger build again

* Move hydration back to regular hocs for compatibility with trunk (merge conflict)

* Removed wcSharedHocsConfig

* esc home url

* Update search fixture

* Update search snap

* 40000 timeout

* hasProducts -> productCount

* Product Count is part of blocks config

* update mocks

* Use version comparison to determine if batching is enabled

* Change isWpVersion

* scrollTo button
2021-04-22 12:37:27 +01:00
Darren Ethier f9d05163f9 Add "you don't need lodash/underscore" eslint rule (https://github.com/woocommerce/woocommerce-blocks/pull/3634)
* add you don’t need lodash eslint plugin

* handle lodash.omit eslint errors

- storybook and webpack config implementations were just ignored.
- shared/validation/index.js was converted to use ES6 destructuring to eliminate usage.

* remove lodash assign usage

* convert lodash isNan to Number.isNan

* ignore lodash.flatten lint error for now

* remove usage of lodash.isNil

* add exclusions for lodash rules in main eslintrc file rather than per file.
2021-01-05 08:58:18 -05:00
Darren Ethier 9115160c2f Enable and fix all jsdoc rule violations (https://github.com/woocommerce/woocommerce-blocks/pull/3168)
* add param jsdocs to satisfy jsdoc require-param rule

* Fix jsdoc-checktypes rule violations

* fix jsdoc/require-param-type rule violations

* fix jsdoc/check-param-names violations

* fix jsdoc/require-property-description rule violations

* fix rule violations for jsdoc/valid-types rule

* fix rule violations for jsdoc/require-property rule

* fix jsdoc/no-undefined-types rule violations

* fix jsdoc/check-types rule violations

* fix jsdoc/require-returns-description rule violation

* enable jsdoc/require-returns-type rule

* fix jsdoc/newline-after-description rule violations
2020-09-20 19:54:08 -04:00
Rua Haszard 5c7447f434 Rename js/components to js/editor-components (https://github.com/woocommerce/woocommerce-blocks/pull/3069)
* mass-rename js/components => js/editor-components & update webpack

* mass-change import '@woocommerce/editor-components' +
+ jsprettier quotes fix

* more mass-rename @woocommerce/editor-components

* fix up references to js/editor-components in various places:
- docs/readmes
- jest config
- typescritp config

* fix story path to match new folder/alias 'editor-components'

* fix jest tests: use new alias for editor-components

* include renamed `editor-components` in editor stylesheet cache group
2020-09-02 10:21:46 +02:00