woocommerce/plugins/woocommerce-blocks/assets/js/data/query-state
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
..
test Reorder dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/2774) 2020-06-26 13:01:35 +01:00
README.md Add notices docs (https://github.com/woocommerce/woocommerce-blocks/pull/2502) 2020-05-19 07:40:48 -04:00
action-types.js All Products with Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1032) 2019-10-28 09:53:09 -04:00
actions.js All Products with Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1032) 2019-10-28 09:53:09 -04:00
constants.js Store API: Introduce API Versioning System (https://github.com/woocommerce/woocommerce-blocks/pull/5911) 2022-02-23 12:00:45 +00:00
index.js All Products with Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1032) 2019-10-28 09:53:09 -04:00
reducers.js don’t mutate default state constant. (https://github.com/woocommerce/woocommerce-blocks/pull/1245) 2019-11-22 15:18:45 -05:00
selectors.js Update dependencies order (https://github.com/woocommerce/woocommerce-blocks/pull/1146) 2019-11-08 17:30:11 +01:00
utils.js All Products with Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1032) 2019-10-28 09:53:09 -04:00

README.md

Query State Store.

To utilize this store you will import the QUERY_STATE_STORE_KEY in any module referencing it. Assuming @woocommerce/block-data is registered as an external pointing to wc.wcBlocksData you can import the key via:

import { QUERY_STATE_STORE_KEY } from '@woocommerce/block-data';

Actions

The following actions are used for dispatching data to this store state.

Note:: New values will always overwrite any existing entry in the store.

setQueryValue( context, queryKey, value )

This will set a single query-state value for a given context.

Argument Type Description
context string The context for the query state being stored (eg. might be a block name so you can keep query-state specific per block)
queryKey string The reference for the value being stored.
value mixed The actual value being stored for the query-state.

setValueForQueryContext( context, value )

This will set the query-state for a given context. Typically this is used to set/replace the entire query-state for a given context rather than the individual keys for the context via setQueryValue.

Argument Type Description
context string The context for the query state being stored (eg. might be a block name so you can keep query-state specific per block)
value Object An object of key/value pairs for the query state being attached to the context.