woocommerce/plugins/woocommerce-admin/packages/data
Fernando 29e2dbffc9 Migrated "import" store to "wp.data" (https://github.com/woocommerce/woocommerce-admin/pull/4982)
* Migrated the "import" store to "wp.data"

This commit migrates the "import" store to "wp.data"

# Conflicts:
#	client/analytics/settings/historical-data/layout.js
#	packages/data/src/index.js

# Conflicts:
#	packages/data/src/index.js

# Conflicts:
#	packages/data/src/index.js

* Added error handling

This commit adds error handling to the apiFetch

* Fixred reducer.js

* Added reducer.js tests

* Removed "endpoint" references

* Tests fixed

* Removed old import store files and wc-api-spec import references

This commit removes old import store files and "wc-api-spec" import references

# Conflicts:
#	client/wc-api/wc-api-spec.js

# Conflicts:
#	client/wc-api/wc-api-spec.js

* Added interval to invalidate resolution of getImportStatus

* Fixed timestamp

* Store dependency removed

* Fixed reimport functionality

# Conflicts:
#	client/analytics/settings/historical-data/index.js

* Refactored layout.js

* Refactored clearCache method

* inProgress check refactored

* Using activeImport from store

# Conflicts:
#	client/analytics/settings/historical-data/index.js

* Fixed console warning

# Conflicts:
#	client/analytics/settings/historical-data/index.js

* Migration done!

# Conflicts:
#	client/analytics/settings/historical-data/index.js

* Fixed hasImportFinished

* Test fixed

* Removed "setImportFinished" from actions.js and index.js

* Added style to disabled button

* Fixed incorrect "Finalizing"  status

* Fixed tests

* Fixed notes update on importation start

* Removed local constants

* Removed css for disabled button

* Typo corrected

* Fixed param for getImportError method

Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
2020-09-01 10:21:31 -03:00
..
src Migrated "import" store to "wp.data" (https://github.com/woocommerce/woocommerce-admin/pull/4982) 2020-09-01 10:21:31 -03:00
.npmrc wp.data Settings refactor 2020-03-25 16:20:17 +13:00
CHANGELOG.md Prepare to publish packages (https://github.com/woocommerce/woocommerce-admin/pull/4908) 2020-08-04 15:10:36 +12:00
README.md wp.data Settings refactor 2020-03-25 16:20:17 +13:00
package.json Update babel monorepo (https://github.com/woocommerce/woocommerce-admin/pull/4925) 2020-08-10 21:37:47 +12:00

README.md

Data

WooCommerce Admin data store and utilities.

Installation

Install the module

npm install @woocommerce/data --save

This package assumes that your code will run in an ES2015+ environment. If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using core-js or @babel/polyfill will add support for these methods. Learn more about it in Babel docs.

Usage

import { SETTINGS_STORE_NAME } from '@woocommerce/data';
import { useSelect } from '@wordpress/data';

function MySettings() {
	const settings = useSelect( select => {
		return select( SETTINGS_STORE_NAME ).getSettings();
	} );
	return (
		<ul>
			{ settings.map( setting => (
				<li>{ setting.name }</li>
			) ) }
		</ul>
	);
}

// Rendered in the application:
//
//  <MySettings />