Commit Graph

113 Commits

Author SHA1 Message Date
Sam Seay a2c4a6a306 A/B test creating a business features step for free extensions (https://github.com/woocommerce/woocommerce-admin/pull/5786)
This fixes woocommerce/woocommerce-admin#5287 

Major changes:

1. The `<Form>` component (which is a published component) gets a new optional prop (so its backward compatible), called `onChangeCallback`. This is called when any form value changes, allowing the controlling component to act on individual form changes. This was needed to utilise `<Form>` to revalidate and check if the user could access the next tab. This should not impact existing usages of the `<Form>`, but it could be good to test this.

2. Introduces a new flow for choosing business extensions that was specified in woocommerce/woocommerce-admin#5287 issue description. Please check the issue for reviewing the designs. The simplest way to implement this, ended up being keeping the existing flow intact and where necessary copy pasting code from those components into the new flow. This new flow is only shown if your segmentation matches the following: `Stores that selected the US as the country and Other or Food & Drinks as the industry
2021-01-07 11:08:57 +13:00
Jeff Stieler c8c544f70c Support custom product attributes in advanced filter (https://github.com/woocommerce/woocommerce-admin/pull/5848)
* Add product attributes autocomplete for Search control.

* Support single selection in Search component.

* Fix SelectControl input after selection in single mode.

* Remove label from Search component's inner SelectControl.

Placeholder is the behavior we want to avoid label and selection collision.

* Match Search component selected prop to SelectControl.

It's passed through anyhow.

* Rework attribute filter to use new endpoints for custom terms.

* Hook up custom attribute filter to report queries.

* Fix errant space in filter name.

* Fix SelectControl active status when control is disabled.

* Fix SelectControl "has tags" logic for non-multiple use cases.

* Fix attribute filter screen reader text.

* Update changelogs.

* Move custom attribute test to it's own function.

* Remove SelectControl input disabling.

This was supposed to improve keyboard behavior for non-multiple controls, but it was questionable.

* Fix backspace in attribute term field.
2020-12-17 09:59:01 -05:00
Fernando dc02c47499 Home Screen - Small refactor to tasks extensibility (https://github.com/woocommerce/woocommerce-admin/pull/5833)
* Added unregister extended task

This commit adds a method to unregister extended task when the plugin is deactivated

* Refactored task lists handling

This commit refactors the task lists handling

* Added default task type

This commit adds a default task type

* Fixed method comment

* Moved method to group objects to lib

This commit moves method to group objects to `lib`

* Refactored getUngroupedTasks method

Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
2020-12-10 23:29:45 -03:00
Jeff Stieler 264aa8dee4 Add Variations Report (https://github.com/woocommerce/woocommerce-admin/pull/5167)
* Add initial Variations Report to analytics feature.

* Restrict query to variations when not specifying any product IDs.

* Add route to get variations without specifying a parent.

* Move variations table component to variations report directory.

* Add missing LIMIT clause to variations report query.

* Remove broken features from Variations table.

* Add Variations report controller to CSV emailer.

* Add initial Variation Stats endpoint, based on Product Stats.

* Hook Variations Report components up to new stats endpoint.

* Hook attribute filter up to variations report queries.

* Remove variation title filter usage.

See: https://github.com/woocommerce/woocommerce-admin/pull/5100

* Use filtered separator in variation name formatting.

* Add "single variation" to variations report, fix autocompleter API request.

* Fix segmentation by variation.

* Add comparison to variations report.

* Always include manually specified variations in report results.

* Fix variations report table comparison mode.

The ReportTable component expects the `filter` query param.

* Fixing styling of compare button without table search component.

* Add variation filter to Orders report.

* Link orders count to orders report filtered by variation.

* Orders report: include variation attributes in product names.

* Further style tweaks for variations report download button.

* Add variations filter to order stats query.

* Clean up "category includes" login in REST controllers.

Prep for "category excludes" in the Variations report.

* Support category exclusion in report filters.

* Fix filter param used by the variation report table component.

* Add category filter to variations report.

* Fix initial selected ReportTable rows when using non-default compareParam.

* Add a new autocompleter for variable products.

* Add products filter to variations report.

* Fix tests.

* Handle variation IDs that are no longer found.

* Add documentation.

* Use getSetting() instead of directly accessing window properties in client code.

* Fix ordering Variations by SKU.
2020-09-25 09:57:48 -04:00
Paul Sealock 3c6483e842 Remove wc api 🎉 (https://github.com/woocommerce/woocommerce-admin/pull/5075)
* remove wc-api selects and constansts

* remove extendedItems dependence on wc-api

* remove wc-api

* PR feedback
2020-09-04 09:45:40 +12:00
Jeff Stieler 650ecac14a Add "Product Attribute" advanced report filter. (https://github.com/woocommerce/woocommerce-admin/pull/5038)
* Simplify variation name logic.

* Remove errant commas from variation autocomplete options.

* Add single variation filter to products report.

* Include more variations in search results.

Also trim the response fields down.

* Add initial AttributeFilter component.

Only selected of attribute names for now.

* Add attribute term selection control.

* Position attribute filter inputs side by side.

* Add loading indicator to attribute term control.

* Clear term when attribute value changes, and handle backspaces.

* Generate screen reader text.

* Translate filter labels, add field separator.

* Improve grammar in screen reader text.

* Fix lint errors.
2020-08-27 08:11:12 -04:00
Sam Seay c884f96bf9 Add WooCommerce Mobile App Banner Ad for Android and iOS (https://github.com/woocommerce/woocommerce-admin/pull/5037)
Fixes woocommerce/woocommerce-admin#4654 

The feature calls for a mobile app ad banner to be displayed to users on mobile devices.

Based on the discussion in woocommerce/woocommerce-admin#4654 this implements the following:

1. [an iOS Smart App Banner](https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html). This banner is a meta tag that is generated in PHP. It will only display on iOS devices. One note about this: **This tag is not directly trackable like the implemented Android banner. If we would like to track its success then I believe [these instructions are relevant](https://stackoverflow.com/questions/12906502/is-it-possible-to-track-click-throughs-from-iphone-smart-banner/20422334woocommerce/woocommerce-admin#20422334)**. 

2. A mobile app banner ad that **only displays on Android** and only displays at the `738px` breakpoint specified in the issue. To only display this banner ad on Android, we use basic checking of the user agent string. I weighed this up against other approaches and for this kind of niche use case a simple UA string check is (imho) still the best way to do this.

3. The banner ad makes use of user preferences to retain a per user setting that determines if that user has dismissed the Android banner. We don't/can't do anything like this for the iOS Smart App Banner (but in theory we shouldn't need to).
2020-08-27 13:46:53 +12:00
Daniel Bitzer d8098d6fd7 Adds `@woocommerce/tracks` package (https://github.com/woocommerce/woocommerce-admin/pull/5017)
* Add @woocommerce/tracks package.json

* Add @woocommerce/tracks .npmrc

* Move lib/tracks.js in to tracks package

* Add tracks package debug dependency

* Add readme for tracks package

* Add changelog for tracks package

* Add info about debugging and opt-ins to tracks package readme

* Load tracks package script

* Add tracks package to packages readme

* Add tracks package to webpack config

* Add tracks package external to starter-pack

* Replace lib/tracks uses with @woocommerce/tracks

* Update package-lock.json
2020-08-20 14:29:52 +09:30
Paul Sealock 8afad405d4 Remove unused lib/date (https://github.com/woocommerce/woocommerce-admin/pull/4987) 2020-08-18 09:53:13 +12: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
Bec Scott b511469dc8 Automatically add free local shipping zone on completing the profiler (https://github.com/woocommerce/woocommerce-admin/pull/4857)
* Set up profile completed action

* Stub out the steps

* Only run if Jetpack is installed and connected

* Return if WCS isn't active

* Return unless physical is selected as a product type

* Return if there are existing shipping zones

* Shipping labels are enabled when WCS is installed

* Set up free local shipping

* Comment for the profiler complete action

* By default there is no international/catch-all shipping method set up

* Add review shipping settings note

* Record tracks event

* Fix logic

* Add unit test around setting up free local shipping

* Rename some functions

* Use countries service to get all countries

* Drop duplicated possibly_add_note()

* Check the old value when determining if the profiler has completed

* Fall back to country code if country name doesn't exist

* Use admin_url fn to build up URL

Co-authored-by: Rebecca Scott <me@becdetat.com>
2020-08-11 14:39:25 +10: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
Paul Sealock 03db742cdd Currency package: make naming clearer (https://github.com/woocommerce/woocommerce-admin/pull/4560) 2020-06-18 11:33:40 +12: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
Daniel Bitzer c6371c32db Fix in app purchase back link for recommend marketing extensions card (https://github.com/woocommerce/woocommerce-admin/pull/4301)
* Add getInAppPurchaseUrl lib function

* Implement getInAppPurchaseUrl for marketing tab

* Include the directory with the wccom-site param

* use getInAppPurchaseUrl helper function in onboarding CartModal component

* Fix 'addQueryArgs' is defined but never used

* Fix Missing JSDoc @return description

* Make connectNonce setting a global setting rather than a marketing once

Co-authored-by: Jason Conroy <jason@findingsimple.com>
2020-05-20 15:03:58 +09:30
Paul Sealock f45fecfbed Advanced Filters: fix currency initialization (https://github.com/woocommerce/woocommerce-admin/pull/4356)
* Advanced Filters: fix currency initialization

* fix readme

* get formatCurrency method
2020-05-19 14:38:02 +12:00
Joshua T Flowers 35616d5f22 Enable tracking on the fly during onboarding (https://github.com/woocommerce/woocommerce-admin/pull/4368)
* Enable the tracking scripts from client-side on opt-in

* Add more info to tracks debug

* Disable tracks if opted out
2020-05-18 13:35:50 -06:00
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