Commit Graph

31 Commits

Author SHA1 Message Date
Paul Sealock cb4ba39e30 Dynamic Currency with Context API (https://github.com/woocommerce/woocommerce-admin/pull/4027)
* Make currency setting dynamic with context API

* reference Currency

* what is 'this'

* remove comment

* All report tables

* Customers report

* activity panel

* leaderboard test

* business details

* store details

* single source of truth

* shipping rates

* remove currency-format.js

* tidy up

* make Currency a factory function

* factory revenue table

* tables

* Chart y-axis labels

* customers table

* cleanup

* business details

* shipping

* number-format

* stock and downloads tables

* changelog

* cleanup

* SQL example: update to dynamic currencies (https://github.com/woocommerce/woocommerce-admin/pull/4033)
2020-04-03 10:54:38 +13:00
Jeff Stieler f8bc173cfb Only query requested stat totals in reports. (https://github.com/woocommerce/woocommerce-admin/pull/4009)
* Pass specified totals/intervals fields parameter to the Order Stats Query.

* Only request stats used in render for report summaries and charts.

Implement Orders as an example.

* Specify stats fields for all report requests.

* Add 'fields' parameter handling to all stats endpoint controllers.

* Reduce stats fields requested by dashboard charts.
2020-03-31 09:08:40 -06: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
Darren Ethier 33c5b41e3f Align WooCommerce javascript code standards/linting/styles with WordPress core. (https://github.com/woocommerce/woocommerce-admin/pull/3674)
* align code styles with the same configuration as Woo-Blocks

* initial pass of reformat-files

* applies manual fixes to various new linting errors surfaced by the configuration change.

* Fix state mutation in image-upload

* remove unused pre-commit-hook.js

* requestAnimationFrame -> window.requestAnimationFrame

* wc-api eslint changes

* eslint fixes on client/lib and client/settings

* client/header eslint changes

* fixes for client/dashboard part 1

* fixes client/dashboard part 2 of 2

* client/analytics part 1

* client/analytics continued

* client/analytics, last batch

* rename __mock__ directory

* pass in useEffect, useState from React component or function

* remove '+' from sprintf string argument

* use ref instead of findDOMNode

* reformat and repaply package.json changes

* install deps before running linter in Travis

* useGetCountryStateAutofill

* counryStateAutofill

* countryStateAutofill

Co-authored-by: Paul Sealock <psealock@gmail.com>
2020-02-14 15:23:21 +13:00
Jeff Stieler 9469663379 Decouple date package from `wcSettings`. (https://github.com/woocommerce/woocommerce-admin/pull/3278)
* Decouple date package from wcSettings.

* Update missed documentation and example.

* Expect simpler prop values for date filter.

* Remove unused props from primary/secondary dates.

* Avoid introducing moment dependency for type checking.

* Handle null moment/date values in DateRangeFilterPicker.

* Fix missing ISO date format.

* Fix moment instance detection.
2019-11-26 14:39:40 -05:00
David Levin 52cb35f4de Correcting and clarifying analytics terms and calculations (https://github.com/woocommerce/woocommerce-admin/pull/3104)
* Relabel Net Revenue to Net Sales, revert previous refund work on Gross revenue and rename to total sales. Update the orer of all the things

* Add gross sales calculation to revenue stats endpoint.

* Restore coupon_total when updating order stats.

* Wire up gross sales to revenue report.

* Fix revenue report refunds calculation when there are no refunds.

* update net sales labels and cases in order, product and category tables

* Subtract refunded shipping and taxes from gross sales.

* pluses to minuses to fix the gross revenue and refund totals when refunding

* Add gross_sales to revenue stats orderby enum.

* Change refund labels to Returns

* Remove usage of defunct coupon_total column.

* Store refunded amount in stats table.

* Rename "gross_total" column to "total_sales".

* Net total for refund orders can be used instead of a new column.

* Rename gross_revenue to total_sales.

* Coalesce coupons total in order stats query.

SUM()ing all nulls gives null, not zero.

* Use segmentation selections to backfill missing data.

Fo when report columns and segmentation columns don't match.

* Remove errant gross_sales from expected interval test data.

* Fix gross sales tests for revenue/stats.

* Move missing segment fills back to their original locations.

* Fix remaining tests failing because of gross sales.

* Fix db upgrade function rename of gross_total column.

* Fix linter errors.
2019-11-22 10:06:14 -05:00
Jeff Stieler 17514872ad Decouple currency and numbers packages from `wcSettings`. (https://github.com/woocommerce/woocommerce-admin/pull/3277)
* Remove wcSettings dependency from currency and number packages.

Either take a configuration object in function calls or in a new class constructor.

* Use new Currency class and number format methods in client/.

Compose with store settings to keep the same API.

* Don't reintroduce lodash dependency to currency package.

* Add changelog entries to currency and number packages.

* Update docs, example, and changelog for AdvancedFilters component.

* Use precision-less formatValue() for integer report values.

* Make Currency instance immutable.
2019-11-21 16:51:52 -05:00
Ron Rennick f78c143f3b Move in-house rest endpoints to private namespace (https://github.com/woocommerce/woocommerce-admin/pull/3204)
* move in-house rest endpoints to private namespace

* PHPCS sniff fixes
2019-11-12 14:15:55 -04:00
Paul Sealock 7f898194b4 Tracks: add events to chart and table 2019-07-03 11:42:06 +12:00
Paul Sealock 34aa71cfbb Dashboard Charts: simplify data 2019-05-21 08:09:49 +12:00
Paul Sealock b29b232a46 pass in filters 2019-03-25 13:03:53 +13:00
Jeff Stieler bfe5a75e98 Update text domain. (https://github.com/woocommerce/woocommerce-admin/pull/1795)
* Translation call text domain change from “wc-admin” to “woocommerce-admin”.

* Fix .pot file generation.

* Fix errantly closed array item in /revenue/stats controller.

* Rename plugin zip, main file, and repo name to "woocommerce-admin".
2019-03-13 11:14:02 -06:00
Paul Sealock fd019c4c35 Chart: don't switch to comparison mode directly 2019-03-12 12:03:58 +13:00
Albert Juhé Lluveras a8ee12e1f9 Fix empty chart and summary numbers when searching in the Categories report (https://github.com/woocommerce/woocommerce-admin/pull/1698) 2019-02-27 17:28:18 +01:00
Albert Juhé Lluveras 4e4f04b8d8 Display chart and summary numbers placeholder when loading search terms (https://github.com/woocommerce/woocommerce-admin/pull/1694) 2019-02-27 15:43:34 +01:00
Albert Juhé Lluveras b61dff32f9 Sort tabular data when selecting a Summary Number (https://github.com/woocommerce/woocommerce-admin/pull/1564)
* Sort tabular data when selecting a Summary Number

* Fix 'orderby' param in orders endpoint
2019-02-15 11:54:41 +01:00
Albert Juhé Lluveras b3e028bc81 Show empty chart and summary numbers when search returns no results (https://github.com/woocommerce/woocommerce-admin/pull/1491)
* Show empty chart and summary numbers when search returns no results

* Add changelog message

* Preserve chart mode in empty searches

* Add tests

* Fix CSS Lint error

* Make sure the legend updates when there is no data and it's not requesting

* Rename 'emptySearch' to 'emptySearchResults'

* Fix tests
2019-02-07 10:57:47 +01:00
Justin Shreve 53a6e49874 Finish cleaning up client/store. (https://github.com/woocommerce/woocommerce-admin/pull/1403) 2019-01-30 02:22:10 -05:00
Timmy Crawford 10c6016d4c Update usage of lib/number to @woocommerce/number (https://github.com/woocommerce/woocommerce-admin/pull/1400)
* Remove usage of lib/number

* Remove formatNumber usage when currency is used.

* Add wc-number as a dependency of wc-currency.

* Add locutus as a dev dependency.

* Add number to test helper.
2019-01-29 08:48:46 -08:00
Paul Sealock c7b705fb08 SummaryNumbers: close on click for mobile 2019-01-22 11:31:37 +13:00
Justin Shreve 01b96ebea5 Hook up performance indicators to the REST API 2019-01-18 08:19:19 -05:00
Joshua T Flowers 7cdbbf87e8 Update all wc-admin endpoints to v4 (https://github.com/woocommerce/woocommerce-admin/pull/1298)
* Update all wc-admin endpoints to v4

* Add namespace for products and customers controllers

* Include product quantity in orders data store

* Add coupons to extended data in the orders data store

* Format order statuses response from database

* Hook up orders table to orders endpoint

* Add namespace to data endpoint controller

* Add namespaces to remaining extended controllers

* Use NAMESPACE var in place of wc/v4

* Update product links in orders table to products reports

* Add coupons rest controller override

* Format coupon code in response

Co-Authored-By: joshuatf <joshuatf@gmail.com>
2019-01-18 10:52:58 +08:00
Albert Juhé Lluveras 5c8cfbc03f Report components docs (https://github.com/woocommerce/woocommerce-admin/pull/1140)
* Extend docs to report components

* Improve inline documentation in some files

* Update doc files

* Undo unnecessary doc changes

* Remove unnecessary line breaks in sidebar

* Rename 'Client components' to 'Analytics components'

* Minor docs fixes

* Rename toc contents to toc sections

* Update endpoint props doc to add an example and more information

* Fix outdated comment

* Fix merge error
2018-12-22 12:46:10 +01:00
Jeff Stieler 98478653e4 Attempt to include report stats type in resource name prefix rather than identifier. 2018-12-07 16:39:42 -07:00
Albert Juhé Lluveras a393ba543b Fix ReportNumber sometimes receiving NaN values (https://github.com/woocommerce/woocommerce-admin/pull/1026)
* Fix ReportNumber sometimes receiving NaN values

* Remove unnecessary utils function

* Destructure summaryData
2018-12-07 15:13:02 -06:00
Kelly Dwan d27cb26ef7 Build: Move `lib/nav-utils` and `lib/history` to `@woocommerce/navigation` (https://github.com/woocommerce/woocommerce-admin/pull/763)
* Move nav-utils and history to new package

* Update config to build and use new navigation package

* Update all imports to use new navigation package

* Remove unnecessary README

* Update nav-utils path
2018-11-05 16:02:04 -05:00
Kelly Dwan f62537fc17 Try: Add Lerna to split out utility packages (https://github.com/woocommerce/woocommerce-admin/pull/678)
* Add lerna & GB package-building script

* Move currency library to lerna module

* Update lerna config

* Add publish commands

* Add currency as an faux-external module

* Add separate command to build just core files

* Update dependency path

* Update build script to build all packages into `dist`

* Add packages to the jest test setup

* Move date library to packages

* Update imports to use @woocommerce/date

* Output wcSettings definition before any scripts are output

Fixes issues where wc-dates lib relies on settings object

* Add the build step into travis

* Update jest config to dynamically get package paths

* Update package postcss config to match wc-admin’s main config

* Add combined watch scripts for package+app, add a `clean` command to clean up old build files

* Ignore PHPCS error (leave todo message to fix)

* Concat files with a space, fix issue where all files join in one continuous string and fail the check
2018-10-30 14:57:48 -04:00
David Levin f74ae15b91 Update the order of orders report summary numbers (https://github.com/woocommerce/woocommerce-admin/pull/547)
* Update the order of orders report summary numbers

* Teamwork makes the dreamwork.
2018-10-18 13:45:36 -07:00
Paul Sealock cf358f50fc Reports: create queries for data requests in one place 2018-10-18 12:02:31 +13:00
Jonathan Belcher f6353591e3 Adds report error component (https://github.com/woocommerce/woocommerce-admin/pull/543)
* Adds report error component

* Add ReportError to chart and summary

* Review fixes
2018-10-17 14:56:50 -04:00
Jonathan Belcher 386933a182 Refactors out summary and graph (https://github.com/woocommerce/woocommerce-admin/pull/517)
* Refactors out summary and chart
2018-10-16 12:07:43 -04:00