woocommerce/plugins/woocommerce-blocks/assets/js/data
Darren Ethier af99c16931 Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768)
* add typescript support

* Add type declarations for Cart and CartResponse interfaces

* make sure we’re resolving .ts files as well as .js files on imports

* add more types

* type the cart data store

* Apply suggestions from code review (implement .tsx in configs)

Co-authored-by: Jon Surrell <jon.surrell@automattic.com>

* remove global fetchMock declaration and directly import where used.

* rename type

* remove named action types and just infer by returning action creator values as const

* use interface instead of type

* rename

* renames

* create CartAction type as union of action creator returned types and implement in reducer

* remove unused imports

* refresh package-lock after rebase

* Add base TS config that projects will inherit from

* Add tsconfig for assets/js/data project

* Ignore TS error on cart store registration

We will address this in cooldown when we have time to investigate further

* Add tsc to build step to catch TypeScript errors

* add a separate command for tsc and tweak build command to use

* restore checkJs and allowJs values in config and remove ts check from build command

* Add ts:check-all command

* Add TypeScript checking workflows

* Change triggers for TypeScript workflow

* Use npm ci instead of npm install

* Remove ts:check-all from TypeScript workflow

* Remove TS Check GitHub workflow

* Remove type-defs dir from TS include, and remove ts:check-all script

We no longer need the ts:check-all script because ts:check will do this for us, the old ts:check did nothing and did not work.

* fix coupon loading issues

* include .ts files only from type-defs folder

Co-authored-by: Jon Surrell <jon.surrell@automattic.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2021-02-23 20:36:24 -05:00
..
cart Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768) 2021-02-23 20:36:24 -05:00
collections Add missing experimental functions to the feature flags page (https://github.com/woocommerce/woocommerce-blocks/pull/3522) 2020-12-09 15:10:57 +01:00
query-state Reorder dependencies (https://github.com/woocommerce/woocommerce-blocks/pull/2774) 2020-06-26 13:01:35 +01:00
schema re-enable @wordpress/valid-sprintf eslint rule and fix violations (https://github.com/woocommerce/woocommerce-blocks/pull/3201) 2020-09-26 16:05:00 -04:00
utils Update NPM dependencies and script dependency handling (https://github.com/woocommerce/woocommerce-blocks/pull/1337) 2019-12-10 12:17:46 -05:00
README.md All Products with Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1032) 2019-10-28 09:53:09 -04:00
constants.js Update NPM dependencies and script dependency handling (https://github.com/woocommerce/woocommerce-blocks/pull/1337) 2019-12-10 12:17:46 -05:00
default-states.ts Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768) 2021-02-23 20:36:24 -05:00
index.js Create Context Provider for Notices w/ Notices API (https://github.com/woocommerce/woocommerce-blocks/pull/1843) 2020-03-03 10:26:02 +00:00
shared-controls.ts Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768) 2021-02-23 20:36:24 -05:00
tsconfig.json Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768) 2021-02-23 20:36:24 -05:00
types.ts Add TypeScript support and convert cart data store to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/3768) 2021-02-23 20:36:24 -05:00

README.md

This folder contains all the data stores registered with wp.data for use by various blocks. Store keys are exported as constants on the wc.wcBlocksData export (external registered as @woocommerce/block-data and enqueued via handle wc-blocks-data-store). For any block using the store, make sure you import the store key rather than using the reference directly to ensure dependencies are automatically extracted correctly.

It is assumed there is some familiarity already with interacting with the wp.data api. You can read more about that here.

The following stores are registered:

store description store key
schema Used for accessing routes. Has more internal usage. SCHEMA_STORE_KEY
collections Holds collections of data indexed by namespace, model name and query string COLLECTIONS_STORE_KEY
query-state Holds arbitrary values indexed by context and key. Typically used for tracking state of query objects for a given context QUERY_STATE_STORE_KEY