woocommerce/plugins/woocommerce-admin/client/analytics/settings
Joshua T Flowers 847b59246d Add transient notices (https://github.com/woocommerce/woocommerce-admin/pull/1423)
* Add initial transient notices component

* Animate notices to slide in and out

* Add notices to wc-api

* Map notices from wc-api to transient notices

* Add success message on settings save

* Add save notices to Settings page

* Remove all margin and padding from notice box when empty

* Add role alert to transient notices

* Add prefers reduced motion media query for transient animation

* Remove initial test notice

* Remove notices from wc-api

* Add wc-admin store for transient notices

* Pull transient notices from newly implemented store

* Use speak instead of role alert for accessibility

* Only show success message after request is complete

* Destructure state in componentDidUpdate

* Add store notice tests and fixtures

* Add box shadow to transient notice

* Move transient notices to bottom left

* Fix indentation
2019-02-13 19:44:58 +08:00
..
README.md Add settings page with excluded order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1364) 2019-01-31 09:04:11 +08:00
config.js Format todo comments to match WC Core format (https://github.com/woocommerce/woocommerce-admin/pull/1474) 2019-02-06 14:41:53 +08:00
index.js Add transient notices (https://github.com/woocommerce/woocommerce-admin/pull/1423) 2019-02-13 19:44:58 +08:00
index.scss Add settings page with excluded order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1364) 2019-01-31 09:04:11 +08:00
setting.js Add settings page with excluded order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1364) 2019-01-31 09:04:11 +08:00
setting.scss Add settings page with excluded order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1364) 2019-01-31 09:04:11 +08:00

README.md

Settings

The settings used to modify the way data is retreived or displayed in WooCommerce reports.

Extending Settings

Settings can be added, removed, or modified outside oc wc-admin by hooking into woocommerce_admin_analytics_settings. For example:

addFilter( 'woocommerce_admin_analytics_settings', 'wc-example/my-setting', settings => {
	return [
		...settings,
		{
            name: 'custom_setting',
            label: __( 'Custom setting:', 'wc-admin' ),
            inputType: 'text',
            helpText: __( 'Help text to describe what the setting does.' ),
            initialValue: 'Initial value used',
            defaultValue: 'Default value',
		},
	];
} );

Each settings has the following properties:

  • name (string): The slug of the setting to be updated.
  • label (string): The label used to describe and displayed next to the setting.
  • inputType (enum: text|checkbox|checkboxGroup): The type of input to use.
  • helpText (string): Text displayed beneath the setting.
  • options (array): Array of options used for inputs with selectable options.
  • initialValue (string|array): Initial value used when rendering the setting.
  • defaultValue (string|array): Value used when resetting to default settings.