Commit Graph

135 Commits

Author SHA1 Message Date
Paul Sealock 74e8d7622e Items dataStore: Migrate from wc-api (https://github.com/woocommerce/woocommerce-admin/pull/5009)
* Create wp.data folder

* order panel

* fix isUnboundedRequest with Categories

* products report

* products table

* indicators and leaderboards

* orders and stock panels

* utils

* tests

* save

* updateStock

* remove wc-api items

* updateItems -> setItems
2020-08-21 11:37:41 +12:00
Sam Seay 2f1d65847c Remove usage of __experimentalResolveSelect (https://github.com/woocommerce/woocommerce-admin/pull/4949)
This uses a generator action and hooks to reimplement the CTA as a more
simple and logicless component, with most of the logic now in the
HOC component.
2020-08-20 16:02:01 +12:00
Sam Seay 4e06df996a Add the jest-environment tag to known tags for jsdoc to avoid lint errors. (https://github.com/woocommerce/woocommerce-admin/pull/5002) 2020-08-20 14:15:08 +12:00
Jeff Stieler c16da34c30 Migrate export data store to wp.data (https://github.com/woocommerce/woocommerce-admin/pull/4958)
* Add export ID to success response and fix typos in endpoint schema.

* Initial export data store.

Allows for starting export, but not checking progress.

* Use new export data store in analytics report tables.

* Remove defunct report export wc-api files.

* Apply review feedback from another wp.data PR.

* Use getResourceName() util for more DRYness.

* Fix linter error.

* Add response status code to fetchWithHeaders control.

* Use HTTP status rather than response body to determine success.

* Fix tests.

* Remove unused import from actions.
2020-08-18 09:04:58 -04:00
Joshua T Flowers df89bb7aac Fix note data actions and consolidate query constants (https://github.com/woocommerce/woocommerce-admin/pull/4990) 2020-08-18 14:45:42 +03:00
Paul Sealock 23846221e6 jsDoc: Fix errors (https://github.com/woocommerce/woocommerce-admin/pull/4985)
* jsDoc errors, round 1

* round 2

* round 3

* voila

* root0 -> props
2020-08-18 09:36:24 +12:00
Jeff Stieler 96e3ed4730 Fix typo in reports store action creators. (https://github.com/woocommerce/woocommerce-admin/pull/4992) 2020-08-17 13:52:33 -04:00
Joshua T Flowers 1d339174f8 Migrate reports data store to wp data (https://github.com/woocommerce/woocommerce-admin/pull/4966)
* Move controls to data package root

* Add reports data store in wp data

* Move report utils to data package

* Update error state and actions to match existing methods

* Update references to reports data store

* Add error setters

* Fix control registration path

* Add reports reducer tests

* Remove remaining report wc-api references

* Handle PR feedback

* reference packgage, not lib/date

Co-authored-by: Paul Sealock <psealock@gmail.com>
2020-08-14 14:19:04 +03:00
Joshua T Flowers 483055dd75 Migrate notes data store to wp data (https://github.com/woocommerce/woocommerce-admin/pull/4943)
* Add initial notes data store using wp data

* Cache individual note queries

* Update notes undo endpoint to batch update endpoint

* Allow batch updates of notes

* Add requesting state

* Update components to use new note store

* Remove old notes store from wc-api

* Get note IDs from json and validate data in REST API

* Add an updating state to each note

* Throw errors in actions so they can be caught by client

* Add store reducer tests

* Handle PR feedback

* Fix failing tests

* Don't set inbox panel visibility while batch updating

* Move woocommerce block to external dependencies
2020-08-13 16:23:38 +03:00
Paul Sealock c145783e0a Fix dependency declarations (https://github.com/woocommerce/woocommerce-admin/pull/4972)
* renmove WC comment block

* client routes

* more fixes

* moar search

* getting there

* by hand now

* david beating goliath

* mission accomplished

* client filepath

* save

* got it

* remove script

* fixes

* deal with package internal dep

* remove webpack alias

* fix webpack relative paths

* remove commented rule

* remove extra line

* remove unused modules entry
2020-08-13 14:05:22 +12:00
Paul Sealock 8d5718fdb8 Reviews: Create wp.data dataStore (https://github.com/woocommerce/woocommerce-admin/pull/4941)
* scaffold out reviews store

* hook up dataStore

* get controls working

* getReviews working

* get count working

* get errors working

* indicators working

* reducer tests

* reviews

* Remove wc-api

* cleanup

* better way to fetch with headers

* add comment with issue

* better resolver
2020-08-11 12:16:27 +12:00
renovate[bot] 56dec569b5 Update babel monorepo (https://github.com/woocommerce/woocommerce-admin/pull/4925)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-08-10 21:37:47 +12:00
Paul Sealock 8b80c83b09 Prepare to publish packages (https://github.com/woocommerce/woocommerce-admin/pull/4908)
* get changelogs ready

* bump versions in package.json

* reset stable tag
2020-08-04 15:10:36 +12:00
Jeff Stieler 33e59dfe3d Polyfill core-data saveUser() on WP 5.3.x. (https://github.com/woocommerce/woocommerce-admin/pull/4869) 2020-07-29 10:20:36 -04:00
Darren Ethier dc5304823b Add @woocommerce/eslint-plugin (https://github.com/woocommerce/woocommerce-admin/pull/4714)
* add new woocommerce/eslint-plugin

* implement eslint-plugin (switch scripts to use wp-scripts etc)

* various linting fixes

* more lint fixes

* improve fix script

* more eslint fixes

* more eslint fixes

* temporary convert rules to warnings until they are all handled

* linting fixes

* update package-lock.json

* remove duplicates

* remove unnecessary `@wordpress/dependency-group` rule config

* add docs and adjust rules

* prettier fix

* fix merge artifact

* convert more rules to warnings

* change order to reflect importance

* install babel-preset-default

* remove unnecessary configuration for babel

* fix dependency group rule and test

* fix test

* handle collapsible whitespace

* add react testing library eslint plugin

* linter errors

* Add back in prettierrc

* package-lock update

* js lint fix with --fix

* disable whitespace in translation

* package-lock update

* make eslint actual dependency, not peer dependency

* pin eslint to v7

* I don't know why, but its working

* fix lint js

Co-authored-by: Paul Sealock <psealock@gmail.com>
2020-07-28 14:32:58 +12:00
Joshua T Flowers fe4fcf2467 Add the experimental resolver to WCA data package (https://github.com/woocommerce/woocommerce-admin/pull/4862)
* Add the experimental resolver to WCA data package

* Add note about function origin and deprecation
2020-07-27 17:07:39 -07:00
renovate[bot] bad969456c Update babel monorepo to v7.10.5 (https://github.com/woocommerce/woocommerce-admin/pull/4809)
* Update babel monorepo to v7.10.5

* Update babel monorepo to v7.10.5

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Rebecca Scott <me@becdetat.com>
2020-07-17 12:29:37 +10:00
Fernando a7a59583c9 Added skip profiler functionality (https://github.com/woocommerce/woocommerce-admin/pull/4721)
* Added skip profiler functionality

This commit adds the skip profiler functionality, leaving the Home screen `Store details` as incomplete.

# Conflicts:
#	client/task-list/tasks.js

* Unit tests repaiared

* Added OBW page

This commit makes the necessary changes to add an OBW page

# Conflicts:
#	client/profile-wizard/index.js

* Event name changed

This commit renames the event name we were recording since it was wrong.

* Redirection modified

This commit modifies the way we do redirection

# Conflicts:
#	client/profile-wizard/index.js

* Removed `profiler` feature flag

* Removed `profiler` feature flag

This commit removes the `profiler` feature flag

* Added error handling for `updateProfileItems`

This commit adds error handling for the method `updateProfileItems`

* Update client/profile-wizard/index.js

Co-authored-by: Matt Sherman <matt.sherman@automattic.com>

* Removed "throw" from "then"

* Update client/dashboard/index.js

Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>

* Update client/profile-wizard/index.js

Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>

* Modified redirection URL

This commit modifies the redirection URL.

# Conflicts:
#	client/task-list/tasks.js

# Conflicts:
#	client/profile-wizard/index.js

* Removed the variable "lastStep" and the related logic.

* Removed change of state for variable "skipped"

* Added error trowing to onboarding actions

This commit adds error trowing to onboarding actions

* Removed response handling for `updateProfileItems`

* Added default value for "profileItems" in Homescreen and Dashboard

* Removed `step` from OnboardingProfile and test

This commit removes the `step` from OnboardingProfile.php and from tests

Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Matt Sherman <matt.sherman@automattic.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2020-07-16 12:17:10 -03:00
renovate[bot] 1ac65a6548 Update babel monorepo to v7.10.4 (https://github.com/woocommerce/woocommerce-admin/pull/4677)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-07-08 15:16:10 +12:00
Joshua T Flowers 8e5291e231 Refactor task tax to use promise chain (https://github.com/woocommerce/woocommerce-admin/pull/4683)
* Show success screen based on conditions instead of step

* Use promise chain to handle updating tax settings

* Fix up error handling for failed setting updates

* Skip store location step if complete address exists

* Fix up pending/requesting state logic

* Allow opt in to TOS on tax task

* Don't complete task from completeStep

* Add caption styling to TOS text
2020-07-01 15:19:15 +03:00
Paul Sealock ee360d14b3 UserPrefs store: Introduce optimistic update (https://github.com/woocommerce/woocommerce-admin/pull/4637)
* optimistically save woo meta

* dashboard

* save only once
2020-06-23 09:25:01 +12:00
Jeff Stieler dd54268ad7 Master -> main. (https://github.com/woocommerce/woocommerce-admin/pull/4618) 2020-06-17 13:39:41 -04:00
renovate[bot] 6ad560bf15 Update babel monorepo (https://github.com/woocommerce/woocommerce-admin/pull/4446)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-06-12 15:44:33 -07:00
Joshua T Flowers 046f6c8bd4 Create action for installing and activate plugins (https://github.com/woocommerce/woocommerce-admin/pull/4473)
* Add installAndActivatePlugins method to plugin store

* Use new install/actiate method in Plugins component

* Refactor benefits page to use await

* Refactor business details page to use new install method

* Replace Plugins component in Jetpack CTA

* Format and throw errors in plugin data store

* Add generic response handling function

* Add default error messages to plugin API
2020-06-12 09:38:33 +03:00
Paul Sealock 41eeb4f9f9 Options: Add data store (https://github.com/woocommerce/woocommerce-admin/pull/4144) 2020-06-11 11:49:27 +12:00
Jeff Stieler 8a2750c973 Migrate user store to wp.data (https://github.com/woocommerce/woocommerce-admin/pull/4505)
* Initial user preferences custom hook (wc meta).

* Organize dependencies.

* Specify dependencies in useSelect() call.

* Remove specifying preference keys.

There's currently no performance benefit to be had.

* Add HoC for hydrating current user data.

* Add user prefs update method.

* Export user prefs hook and HoC in data package.

* Handle error condition when updating user preferences.

* Use closure to get user ID for prefs update.

* Refactor analytics dashboard to use new user hook.

* Refactor ReportTable component to use new user hook.

* Move prop access to top of function component.

* Add todo for potential manual resolution logic.

* Refactor DashboardCharts component to use new user preferences hook.

* Move code out of functional component where possible.

* Fix chart interval query property.

* Refactor Leaderboards component to use new user preferences hook.

* Move code out of functional component where possible.

* Refactor Inbox panel to use user prefs hook.

@todo - updating last read isn't working.

* Use user prefs hook in StatsOverview component.

* Export user preferences store name.

* Use new store for unread inbox indicator.

* Hydrate current user data higher up in the app.

* Update "last read" timestamp in inbox panel.

* Fix StatsOverview test.

* Remove unused dispatch method from StorePerformance component.

* Remove now defunct user methods from wc-api spec.

* Add tests for isRequesting.

* JSON decode WC meta on updated user object.

* Test user prefs retrieval and save.

* Remove todo comment.

* Use user prefs hook in Jetpack install CTA on homepage.
2020-06-10 11:46:46 -05:00
Joshua T Flowers 2c9b19521a Fix error handling for plugins on server error (https://github.com/woocommerce/woocommerce-admin/pull/4462)
* Handle server errors in plugin components

* Show generic server error message for plugin install if no plugin errors exist

* Fix plugin error tests
2020-06-01 13:39:58 +03:00
Joshua T Flowers d14fd4dbe1 Migrate onboarding data store to wp data (https://github.com/woocommerce/woocommerce-admin/pull/4433)
* Migrate onboarding from wc-api to wp-data store

* Add tests for onboarding reducer

* Update references to onboarding data store

* Update tests for replacing profileItems

* Add onboarding hydration for profile items

* Prevent store from being registered twice

* Add requesting state to onboarding store

* Prevent duplicate registration on all wp data stores

* Update more components to use new wp data onboarding store

* Add tests for onboarding requesting state

* Update isRequesting to use isOnboardingRequesting
2020-05-28 11:51:40 +03:00
Joshua T Flowers 53dde217f6 Handle multiple plugin installs in a single request (https://github.com/woocommerce/woocommerce-admin/pull/4411)
* Allow plugins API to install multiple plugins at once

* Update wpdata to handle installing multiple plugins and errors

* Remove client-side error message switch

* Update plugin tests for multiple plugins param

* Update plugins API to WP standards

* Add error for non-allowed plugins instead of silently failing

* Allow error handling for individual plugins

* Fix up js tests for new API response

* Add installed plugin to response on successful install
2020-05-27 10:28:13 +03:00
Joshua T Flowers 65145bf92c Add Jetpack connection to plugin benefits step (https://github.com/woocommerce/woocommerce-admin/pull/4374)
* Allow updateActivePlugins to add new plugins instead of replace

* Add autoConnect prop to Jetpack Connect component

* Add connect component to plugin benefits screen

* Add onError and missing prop types for Connect

* Update redirect URL after Jetpack connection

* Add tests for added active plugins

* Skip install if plugin error exists

* Update active and installed plugins to use replace flag

* Update tests to handle replace flag

* Refactor plugin install flow pending state
2020-05-19 12:47:25 +12:00
renovate[bot] c5815a3dc6 Update babel monorepo to v7.9.6 (https://github.com/woocommerce/woocommerce-admin/pull/4295)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-05-13 10:54:33 +12:00
Paul Sealock 28c85668fb Plugins: Move API out of Onboarding (https://github.com/woocommerce/woocommerce-admin/pull/4093)
* Plugins DataStore: decouple from onboarding (https://github.com/woocommerce/woocommerce-admin/pull/4048)

* Plugins DataStore: Add client side store

* change active_plugins to public static function

* don't change shape of allowed plugins
2020-04-20 14:04:13 +12:00
Paul Sealock c500d3fa98 Plugins DataStore: decouple from onboarding (https://github.com/woocommerce/woocommerce-admin/pull/4048)
* Plugins DataStore: Add client side store
2020-04-17 11:58:36 +12:00
renovate[bot] a49d2489dc Update babel monorepo (https://github.com/woocommerce/woocommerce-admin/pull/3985)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-03-25 16:39:13 +13:00
Darren Ethier 783f613815 wp.data Settings refactor
add data store for settings using wp.data

add use-select-with-refresh example

replace fresh-data usage with new settings data store for settings page

Add data package

move to packages

Fix isDirty after save

Add isBusy to primary button when saving

update Readme

remove comment

readme to use useSelect

Revert "update Readme"

This reverts commit 7402fd49b8f384fde5878e0bee0616f0a87bb4f6.

Data Layer: Settings page to use Settings store (https://github.com/woocommerce/woocommerce-admin/pull/3430)

* Data Layer: Settings store as source of truth for settings page

This reverts commit 7402fd49b8f384fde5878e0bee0616f0a87bb4f6.

* fixup

* save on reset

* non mutable constants

* add set/getSettings

* save using setSettings

* separate HOC

* cleanup

* remove settingsToData

* withHydration

* remove withSettings HOC

* renmove useSettins for now

* withSettingsHydration updates

* Revert "withSettingsHydration updates"

This reverts commit f2adf108fbe19b574978fea5925a1a18e7ed3007.

* rename withSettingsHydration

* redo withSettingsHydration simplification

* restore

* useSettings

* render using useSettings

* handleInputChange working

* get setIsDirty working

* saving works

* reset and cleanup

* cleanup

* use snake case on hook files

* use clearIsDirty

* Avoid mutation on setting update

* remove @todo

* persiting -> isPersisting

* better reducer ternaries

* add wcSettings as arg to withSettingsHydration

reset package-lock

Settings: split out mutable wcAdminSettings (https://github.com/woocommerce/woocommerce-admin/pull/3675)

Settings: handle async settings groups (https://github.com/woocommerce/woocommerce-admin/pull/3707)
2020-03-25 16:20:17 +13:00