Commit Graph

11 Commits

Author SHA1 Message Date
Moon 620ff93e5a
Additional changes for the core profiler plugins page (#38616)
* Add install-and-activate-plugins-async action to onboarding

* Add label and learn_more_link types

* Use label and learn_more_link

* Fix type

* Add changelog

* Add changelog

* Add install_priority -- this will be used in the core profiler

* Sort selected plugins by install_priority for installation

* Remove unused imports

* dev: refactor installAndActivatePlugins to xstate

* ts fixes

* Sort plugins by install_priority

* Make sure WooCommerce Shipping is always visible

* Update free extension list content

* Updated WC payment description
* Updated logo images

* Visual changes on the plugin page

* Change CTA font size from 13px to 14px
* Change spacing between the chebox and logo to 24px
* Change heading font-weight to 500

* Fix css lint error

* Fix gray-900 variable name

* Hide learn more link on mobile view

* Add back learn more link that was removed from rebase

* Send pluginsAvailable to pluginInstallermachine

* Use is_activated to determine plugin availability and install status

* Update packages/js/data/src/onboarding/types.ts

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Update plugins/woocommerce/src/Internal/Admin/RemoteFreeExtensions/DefaultFreeExtensions.php

Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>

* Add back recordTracksPluginsLearnMoreLinkClicked

* Use install-and-activate-plugins-async when timer is up

* Record plugin and link with learn more linked clicked event

* Fix failign tests

* Add comment for install_priority

---------

Co-authored-by: rjchow <me@rjchow.com>
Co-authored-by: Ilyas Foo <foo.ilyas@gmail.com>
2023-06-13 15:03:03 -07:00
RJ 1b1f86066f
dev: refactor core profiler pages (#38606)
* dev: refactor core-profiler - modularise each page

- wrapped each page's pre, post, and main states into their top level states for tidiness
- tagged them with id so that we can easily jump to them when doing routing
- generalised component finder code such that it recursively traverses the state meta object until it finds a component key
- fixed css label to use top level state key

* moved initializing into introOptIn so it's not a special case by itself
2023-06-07 11:39:38 +08:00
Sam Seay b076a7b521
Fix linter issues and update Syncpack (#38523) 2023-05-31 11:45:10 +12:00
RJ ab18828e84
add: core profiler business info page (#38412)
* add: core profiler business info page
2023-05-30 15:05:38 +08:00
Moon 6946ef384a
Core Profiler - Add extensions page (#38405)
* Initial design impl. without the full functionality

* Delete unused icons

* Add is_installed and plugins_page_skipped

* Add plugin-card component to render an installable plugin

* Implement plugins page

* Add loaders for plugins

* Add changelog

* Remove unused type

* Add changelog

* Remove unnecessary return statement

* Add obw/core-profiler

* Replace extensions with plugins

* Temp -- use window.location.href for Woo Home redirection

* Minor: code refactor

* Refactor isntallAndActivatedPlugins

* Skip plugins page when there is no available plugin

* Apply mobile styles

* Update plugins/woocommerce-admin/client/core-profiler/components/plugin-card/plugin-card.scss

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>

* Update plugins/woocommerce-admin/client/core-profiler/components/plugin-card/plugin-card.scss

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>

* Update plugins/woocommerce-admin/client/core-profiler/style.scss

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>

* Bold errored plugin name

* Fix checkbox alignment

* Update changelog

* Fix object type for formatToParts function

* Fix lint issues

* Fix CSS lint issues

* Fallback to en-US when locale is not available

* Fix error with siteLocale

---------

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
2023-05-29 07:45:30 -07:00
Chi-Hsuan Huang 4547922f3f
Add core profiler user profile page (#38328) 2023-05-22 11:21:16 +08:00
RJ 00952e8b95
add: core profiler fetch extensions (#38270)
add: fetch extensions and countries from API for core profiler

- prefetch it once in the machine init so that it's instant when used later
- fetch it again in preExtensions state and store it to context
- added prefetch for getCountries as well
2023-05-18 10:50:59 +08:00
RJ 38dc82b4b1
dev: add core profiler state machine tests (#38154)
dev: added tests for core profiler state machine

- added tests to demonstrate model based testing with @xstate/test
2023-05-16 08:56:39 +08:00
Moon 0bf6859383
Add Business Location page to the core profiler (#38019)
* Add core profiler - welcome to woo page

* Update checkbox styles

* Add tracks

* Update default tracking value

* Update copies

* using invoked promise instead of useState

- take advantage of xstate's built ins for side effects instead of  useEffect/hooks
- discovered that error result wasn't really handled in original useEffect
- use text labels instead of inline functions so that we can decouple the implementation from the machine model
- todo: can move the invoked function out elsewhere and also tests if needed (not necessary here because it's a simple call)

* add: core profiler scaffolding using xstate

* Add navigation and progress-bar components

* fix css lint error

* Update plugins/woocommerce-admin/client/core-profiler/components/navigation/woologo.tsx

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>

* Update plugins/woocommerce-admin/client/core-profiler/components/progress-bar/progress-bar.tsx

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>

* Update plugins/woocommerce-admin/client/core-profiler/components/navigation/navigation.tsx

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>

* Remove var from __ function

* Use woocommerce prefix for classnames

* Fix css lint error

* Fix broken tests

* Add business location page

* Remove unwanted changes from rebase

* Remove unwanted changes from rebase

* Redirect to Woo Home on exit

* Add tracks

* Fix js lint error

* Add loader page

* Support meta value from nested states

* Use navigateTo

* Add tests for getCountryStateOptions

* Use Country type from navigation package

* Rename useStages to getLoaderStageMeta

* Add changelog

* Move progress from 20 to 80

* Fix xstate warning

* Fix broken pnpm lock

* Fix eslint errors

* Update plugins/woocommerce-admin/client/core-profiler/services/country.ts

Co-authored-by: RJ <27843274+rjchow@users.noreply.github.com>

* Update plugins/woocommerce-admin/client/core-profiler/index.tsx

Co-authored-by: RJ <27843274+rjchow@users.noreply.github.com>

* Save country to option

* Fix jslint error

* Update plugins/woocommerce-admin/client/core-profiler/services/country.ts

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>

* Update plugins/woocommerce-admin/client/core-profiler/style.scss

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>

* Fix eslint error

* Use decodeEntities directly

* Update comment for artificial 3 seconds wait

* Disable Go to my store button when country is empty

* Style for mobile devices

* Style updates for the country dropdown

* Fix js lint error

* Update country dropdown border color

* Style the loader

* Fix css lint

---------

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Co-authored-by: rjchow <me@rjchow.com>
Co-authored-by: RJ <27843274+rjchow@users.noreply.github.com>
2023-05-15 04:56:47 +08:00
Chi-Hsuan Huang ea58ae339a
Add core profiler "Welcome to Woo!" page (#37952)
* Add core profiler - welcome to woo page

* Add changelog

* Update checkbox styles

* Update copies

* Add test

* Add enable prop to window.wcTracks type

* Add tracks

* Add explat changelog

* Fix import

* Update default tracking value

* Update copies

* Fix test

* using invoked promise instead of useState

- take advantage of xstate's built ins for side effects instead of  useEffect/hooks
- discovered that error result wasn't really handled in original useEffect
- use text labels instead of inline functions so that we can decouple the implementation from the machine model
- todo: can move the invoked function out elsewhere and also tests if needed (not necessary here because it's a simple call)

* use actions.choose instead of branching inside action 

- https://stately.ai/docs/xstate/transitions-and-choices/guarded-actions#the-choose-action
- makes it so that the machine model is serializeable
- todo: in the distant future i wonder if it might be tidier to have tracks be its own actor that just receives the same events that this machine does, that way it's just standalone instead of mixing up tracks with the implementation

* use dispatch instead of useDispatch

- decouples the implementation of the handler from the react component
- makes the handler testable on its own if needed
- makes the state machine testable without relying on external dependencies

* decoupled remaining function calls

* Fix lint error

* Fix style lint

* address xstate console warnings

- .withConfig() is a function call that returns a new object every invocation so we need to wrap it in useMemo to keep it stable

* Add optInDataSharing is false test

* Fix lint

---------

Co-authored-by: rjchow <me@rjchow.com>
2023-05-03 15:54:28 +08:00
RJ f0109e89ac
add: new core profiler scaffolding in xstate (#37628)
* add: core profiler scaffolding using xstate

* address review feedback and questions

* changed path to use setup-wizard

* default new core-profiler feature flag to false
2023-04-24 10:08:24 +08:00