Commit Graph

96 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
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 6a8124ffd0 Remove unnecessary locale update call. (https://github.com/woocommerce/woocommerce-admin/pull/3362)
Let the @wordpress/date module handle it.
2019-12-06 11:38:07 +13:00
Joshua T Flowers 2fccd709c0 Onboarding: Update global currency settings on address change (https://github.com/woocommerce/woocommerce-admin/pull/3324)
* Update currency data to match currency format used in wcSettings

* Revert currency ranges to sprintf

* Allow currency to be changed after the class has been initialized

* Update currency settings when store address is changed

* Get default prices formats from positioning

* Set currency defaults if not set

* Handle PR feedback

* Add translator comment to 'more than' revenue option
2019-12-04 07:32:13 +08: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
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
Justin Shreve 03c3251a2a Onboarding - Add tracks queue and fix busted tracks events/add missing event (https://github.com/woocommerce/woocommerce-admin/pull/3220)
* Fix busted tracks events and add missing continue setup event

* Move appearance check to next page load to avoid the event not firing

* Add a tracks queue to delay event recording & log embed page views (https://github.com/woocommerce/woocommerce-admin/pull/3250)

* Add a tracks queue to delay event recording

* Add emebedded page view tracking, and queue the tax skip event
2019-11-15 08:32:02 -05:00
Joshua T Flowers 000d666096 Add tax filtering to orders data (https://github.com/woocommerce/woocommerce-admin/pull/3197)
* Add tax rates filter to orders report

* Add tax rate filters to orders data store

* Add tax rate query filters to order stats data store

* Add tax rate orders link to taxes table
2019-11-13 11:22:06 +08:00
Albert Juhé Lluveras f392b5588d Replace 'stringifyQuery' with 'addQueryArgs' (https://github.com/woocommerce/woocommerce-admin/pull/2655) 2019-07-16 10:56:24 +02:00
Paul Sealock e32b5560c0 Advanced Filters: Add Tracks events 2019-06-28 12:34:41 +12:00
Timmy Crawford 54ff76e178 Tracks: Fix double wcadmin_ prefix. (https://github.com/woocommerce/woocommerce-admin/pull/2532)
* Tracks: Fix double wcadmin_ prefix.

* Update comment

* underscore dangit
2019-06-27 15:56:39 -07:00
Timmy Crawford e2cd150071 Activity Panels: Add track event when panels are opened. 2019-06-24 16:49:52 -07:00
Jeff Stieler 8fad6e7dd7 Allow paragraph tags in admin notes. 2019-05-29 16:28:37 -06:00
Jeff Stieler a70a3deaa8 Allow links in admin notice content. 2019-05-22 08:20:53 -06:00
Joshua T Flowers b1dd517eb6 Add single customer filter and hook up customer link (https://github.com/woocommerce/woocommerce-admin/pull/1798)
* Add a single customer filter to the customers report

* Hook up activity panel orders customer link to customer report

* Use customer name for label instead of username
2019-03-18 10:39:54 +08:00
Joshua T Flowers 4e9f787b13 Update tracking to use wcTracks method (https://github.com/woocommerce/woocommerce-admin/pull/1718)
* Remove tracking script from client assets

* Check for wcTracks function and record event if it exists

* Rely on tracking enabled check in core
2019-03-04 12:08:13 +08:00
Timmy Crawford 00965ba5b3 Remove Swaggerhub method. (https://github.com/woocommerce/woocommerce-admin/pull/1707) 2019-02-27 19:14:54 -08:00
Joshua T Flowers b7379def1b Format todo comments to match WC Core format (https://github.com/woocommerce/woocommerce-admin/pull/1474)
* Format todo comments to match WC Core format

* Remove variations todo comment
2019-02-06 14:41:53 +08:00
Joshua T Flowers 2c1f8c17c7 Fix incorrect label async request paths (https://github.com/woocommerce/woocommerce-admin/pull/1447) 2019-02-04 10:50:22 +08: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
Albert Juhé Lluveras 95c21e0cc3 Move 'getLabels' functions into lib/async-requests (https://github.com/woocommerce/woocommerce-admin/pull/1379)
* Move labels loading logic into a lib

* Avoid making API calls when displaying Order labels

* Move lib/labels into lib/async-requests

* Rename 'getCustomerLabel' to 'getCustomerLabels'
2019-01-24 10:35:27 +01:00
Justin Shreve 01b96ebea5 Hook up performance indicators to the REST API 2019-01-18 08:19:19 -05:00
Jeff Stieler 4fabbee20f numberFormat(): add test for new non-number precision value logic. 2019-01-17 16:28:00 -07:00
Jeff Stieler 2ad5922f1f Simplify precision preservation logic in numberFormat().
Props @Aljullu.
2019-01-17 16:25:44 -07:00
Jeff Stieler 858ec82e8c Rework numberFormat() to maintain decimal precision by default. 2019-01-16 18:41:15 -07:00
Jeff Stieler 78e1be139f Refactor numberFormat() to use the store settings for precision, decimal separator, and thousand separator. 2019-01-16 17:32:12 -07:00
Kelly Dwan 2a9cb6509b Build: Move components to packages dir (https://github.com/woocommerce/woocommerce-admin/pull/804)
* Move components to packages folder

* Update documentation generator to handle packages/components and client/components

* Update component locations

* Update CSS build process

* Remove react-dates css, this is already included by gutenberg

* Fix CSS style - single quotes

* Fix incorrect imports

* Update package-lock with new dependencies

* Update component locations for devdocs

* Fix location of tests
2018-11-15 13:16:23 -05:00
Jonathan Belcher c102e78523 Creates a helper function to get selected chart (https://github.com/woocommerce/woocommerce-admin/pull/794)
* Creates a helper function to get selected chart

* remove console log

* Make sure charts is never empty

* Clarify docs
2018-11-07 12:19:59 -05:00
Kelly Dwan 8af82f3dee Build: Move `lib/csv` to packages (https://github.com/woocommerce/woocommerce-admin/pull/756)
* Move CSV to packages

* Update CSV imports

* Add some basic usage documentation

* Add csv lib to the enqueued assets

* Change name to `csv-export`

* Update webpack build process to allow for package names with dashes

* Fix capitalization

* Update readme with docs extracted from jsdoc

* Fix merge conflict commit 😣

* Check that generateCSVFileName is called with correct params
2018-11-06 16:53:22 -05:00
Paul Sealock 50e635e716 Add Variations autocompleter 2018-11-05 17:43:59 -05: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
Albert Juhé Lluveras 70e7e14e7a Persist time queries when clicking on breadcrumbs links (https://github.com/woocommerce/woocommerce-admin/pull/759)
* Make breadcrumbs links persist date queries

* Add tests to getTimeRelatedQuery() when query parameter not set

* Add comment explanation about navUtils self-import
2018-11-02 22:38:16 +01:00
Kelly Dwan c29043a3bc Switch to using `@wordpress/viewport` for responsive screen layouts (https://github.com/woocommerce/woocommerce-admin/pull/761)
* Switch to Gutenberg viewport package

* Switch CSS breakpoints to core-supported values

* Fix double-calendar logic
2018-11-02 15:20:11 -04: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 6b72b004ac refactoring x-axis ticks (https://github.com/woocommerce/woocommerce-admin/pull/685)
* conflict resolution

* updated weekly interval formats

* updated week format to include day
2018-10-30 09:54:49 -07:00
Albert Juhé Lluveras 0caed9a28a Create QUERY_DEFAULTS object with default values for queries (https://github.com/woocommerce/woocommerce-admin/pull/686) 2018-10-26 10:19:39 +02:00
Robert Elliott 54ffd1bd0a Merge pull request woocommerce/woocommerce-admin#638 from woocommerce/add/charts-full-year
Chart: updated intervals to use the full year
2018-10-25 12:23:32 +02:00
Albert Juhé Lluveras 1c819740f4 Persist date params in Products table link (https://github.com/woocommerce/woocommerce-admin/pull/671) 2018-10-25 12:07:30 +02:00
Robert Elliott e21a6022e7 updated lib/date iintervals to use the full year incl. centruy, 2018-10-25 11:12:27 +02:00
Albert Juhé Lluveras 7be34b3f37 Move Download table logic inside the TableCard component (https://github.com/woocommerce/woocommerce-admin/pull/652)
* Move Download table logic inside the TableCard component

* Make title lowercase inside generateCSVFileName

* Update JSDoc comment
2018-10-24 09:48:20 +02:00
Paul Sealock 240599c095 Persist date related parameters on report navigation 2018-10-24 12:16:35 +13:00
Timmy Crawford f8d70506a1 Update/track usage logic (https://github.com/woocommerce/woocommerce-admin/pull/561)
* Tracks: Don't track if Jetpack is not present or in dev env.

* Check for JETPACK__VERSION instead.

* Fix linting errors

* Yoda conditions use you must
2018-10-22 08:56:02 -07:00
Allen Snook 9638b063a0 Add unit test for sanitize html 2018-10-19 14:21:54 -07:00
Allen Snook b8a83bf1e1 Allow selected tags through to the note content 2018-10-19 14:21:54 -07:00
Albert Juhé Lluveras 3982ebc32e Create appendTimestamp() utils function (https://github.com/woocommerce/woocommerce-admin/pull/542)
* appendTimestamp() utils function

* Make appendTimestamp() to throw and error if timeOfDay is not a valid value
2018-10-17 18:01:58 +02:00
Albert Juhé Lluveras 36c37afe49 Hide day from X axis when the time period is too long (https://github.com/woocommerce/woocommerce-admin/pull/525)
* Refactor getXTicks

* Hide day from X axis when the time period is too long

* Fix X axis labels misaligned in charts

* Align axis ticks to the first day of the month when not displaying the day number

* Store threshold in a variable

* Add missing JSDoc

* Fix charts hanging when the number of days selected was exactly 180

* Improve function naming

* Fix dayTicksThreshold mismatch between date format and chart layout
2018-10-17 15:44:43 +02:00
Albert Juhé Lluveras 9623898acd Add Orders table (https://github.com/woocommerce/woocommerce-admin/pull/493)
* Create Orders table

* Remove getOrderIds selector

* Create an OrdersReportTable component

* Alphabetically order extracted props

* Fix JS error for missing coupon properties

* Add TODO comment for missing customer type

* Add calculation for net revenue

* Align all table cells but identifier to the right

* Remove temporary text

* Improve cell link inline CSS

* Count several purchases of the same product as items sold

* Add TODO message to coupon link

* Add Download to Orders table

* Don't use camelCase for table column keys

* Cleanup

* Make products and coupons columns non-sortable

* Create renderList method to simplify products/coupons list creation

* Display correct currency for each order

* RTL table fixes

* Fix: products and coupons columns showing 'false' in CSV download

* Minor fixes

* Rename 'isIdentifier' with 'isLeftAligned' in table columns

* Remove toggleStatus method
2018-10-11 10:30:51 +02:00
Justin Shreve 5a6749b15c Make tabular data independent of chart interval (https://github.com/woocommerce/woocommerce-admin/pull/483)
* Make Tabular data independent of Chart Interval

* Make table and summary numbers placeholders independent of chart
2018-10-10 09:57:16 -04:00