Skip to content

Conversation

@moon0326
Copy link
Contributor

@moon0326 moon0326 commented Jun 6, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #38436 .

This PR addresses changes listed in the issue, except for the Jetpack redirection and InstallAndActivatePlugins refactor. I'll handle Jetpack redirection in a separate issue, as it requires a bit of context switching. @rjchow is working on refactoring InstallAndActivatePlugins in #38577. For the reference, my previous attempt at refactoring is 94e548c

How to test the changes in this Pull Request:

For the label and description, please refer to Figma design Y5pUYSJPsGEud1vknUZhi8-fi-300-14366 or use the screenshot:
image

Make sure to turn off Show Suggestions from WooCommerce -> Settings -> Advanced -> WooCommerce.com to show the local version of the suggestions.

  1. Go to the Plugins page
  2. Confirm the plugins have the correct label and description.
  3. Confirm the plugins have a `learn more link
  4. Select some plugins and click Continue
  5. Confirm the plugins get installed in order of install_priority
  6. Confirm the change requests from the label and description

For now, I've set install_priority value by plugin size.

Plugin Priority Size
Tiktok for Business 1 54 KB
Pinterest for WooCommerce 2 985 KB
WooCommerce Shipping 3 1.6 MB
WooCommerce Tax 4 1.6 MB
WooCommerce Payments 5 5 MB
Google Listing and Ads 6 7.2MB
Mailpoet 7 7.4MB
Jetpack 8 25.7MB

@moon0326 moon0326 requested review from a team, ilyasfoo and rjchow June 6, 2023 01:10
@github-actions github-actions bot added focus: react admin [team:Ghidorah] package: @woocommerce/data issues related to @woocommerce/data plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Jun 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

Hi @adrianduffell, @woocommerce/ghidorah

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

Hi @ilyasfoo, @rjchow, @woocommerce/ghidorah

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

Test Results Summary

Commit SHA: f852515

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 51s
E2E Tests1950010020516m 41s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@moon0326 moon0326 force-pushed the update/38436-additional-changes-for-plugins-page branch from 9deb1b4 to e1138d1 Compare June 6, 2023 03:32
@github-actions github-actions bot added focus: e2e tests Issues related to e2e tests package: @woocommerce/onboarding issues related to @woocommerce/onboarding labels Jun 6, 2023
@moon0326 moon0326 force-pushed the update/38436-additional-changes-for-plugins-page branch 3 times, most recently from 53d73f3 to 9deb1b4 Compare June 6, 2023 04:06
@github-actions github-actions bot removed focus: e2e tests Issues related to e2e tests package: @woocommerce/onboarding issues related to @woocommerce/onboarding labels Jun 6, 2023
Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what I'm doing wrong, but I wasn't able to get to the plugins page in core profiler. After business_info step, I get redirected straight to loading screen 🤔

@moon0326
Copy link
Contributor Author

moon0326 commented Jun 6, 2023

I'm not sure what I'm doing wrong, but I wasn't able to get to the plugins page in core profiler. After business_info step, I get redirected straight to loading screen 🤔

My apologies 🙏 We need to turn off Show Suggestions to use the updated extension list.

I've updated the test instructions.

Make sure to turn off `Show Suggestions` from
WooCommerce -> Settings -> Advanced -> WooCommerce.com 
to show the local version of the suggestions.

@moon0326 moon0326 force-pushed the update/38436-additional-changes-for-plugins-page branch from 1f8da1f to 26c26d6 Compare June 7, 2023 00:27
Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, @moon0326! I wasn't able to review the code properly since I think there's some unrelated commits in the PR, perhaps I'll defer reviewing them after RJ's PR is merged.

I'll review the UI and functionality first:

  1. It seems the extension is displayed as Installed even though it's deactivated. Is this intended?
  2. In smaller screens, Learn more should be hidden (screenshot)
  3. I think it's also good to arrange the extensions as displayed in Figma, cc @verofasulo if you intend the extensions arrangement should follow design, or could it be random?
  4. Probably not related to this PR in particular, I observed some plugins were installed but not activated. I selected multiple plugins (Jetpack, MailPoet, GLA, Pinterest, TikTok, Shipping) and only some plugins were activated (Pinterest, TikTok). The action scheduler job woocommerce_plugins_install_callback was complete. There was some PHP warnings in debug.log related to Pinterest, no fatal errors.

@moon0326
Copy link
Contributor Author

moon0326 commented Jun 7, 2023

Thank you for the review!

It seems the extension is displayed as Installed even though it's deactivated. Is this intended?

I think so, but let's check with @verofasulo

In smaller screens, Learn more should be hidden

Updated in cb255e7

I think it's also good to arrange the extensions as displayed in Figma, cc @verofasulo if you intend the extensions arrangement should follow design, or could it be random?

According to Y5pUYSJPsGEud1vknUZhi8-fi-1698-36088 I think the order is correct.

Do you see different order by any chance?

Screen Shot 2023-06-07 at 12 19 17 PM

Probably not related to this PR in particular, I observed some plugins were installed but not activated. I selected multiple plugins (Jetpack, MailPoet, GLA, Pinterest, TikTok, Shipping) and only some plugins were activated (Pinterest, TikTok). The action scheduler job woocommerce_plugins_install_callback was complete. There was some PHP warnings in debug.log related to Pinterest, no fatal errors.

I'll double check on that. You're correct on this. I've copied the refactored version of InstallAndActivatePlugins from RJ's PR, which doesn't use InstallAndActivatePluginsAsync. I'll review RJ's PR today so that he can merge it, allowing me to rebase and update the code in this PR to use installAndActivatePlugins.

@verofasulo
Copy link

if you intend the extensions arrangement should follow design, or could it be random?

@ilyasfoo Yes, please, let's follow the order in the designs 🙂 The marketing team has reviewed it and wants to showcase the extensions in that particular order.

@verofasulo
Copy link

It seems the extension is displayed as Installed even though it's deactivated. Is this intended?
I think so, but let's check with @verofasulo

@moon0326 I'm not sure what we're referring to 🙂 Could you please clarify? Thanks!

@ilyasfoo
Copy link
Contributor

ilyasfoo commented Jun 8, 2023

@moon0326 I'm not sure what we're referring to 🙂 Could you please clarify? Thanks!

Hey, @verofasulo! Moon was referring to the extensions having Installed label when it's installed, but not activated. In my opinion, I think we have to label it Installed only when it's both installed & activated. If the plugin is inactive, the user may not know how to activate it, thus it could become broken UX down the line.

image

Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Y5pUYSJPsGEud1vknUZhi8-fi-1698-36088 I think the order is correct.

Do you see different order by any chance?

My bad, I may have referred to an outdated design. Sorry! Thanks for addressing the learn more change. Functionality wise this is looking good! I'll try to review them as soon as RJ's PR is merged and rebased

@verofasulo
Copy link

Moon was referring to the extensions having Installed label when it's installed, but not activated. In my opinion, I think we have to label it Installed only when it's both installed & activated. If the plugin is inactive, the user may not know how to activate it, thus it could become broken UX down the line.

@ilyasfoo, good point! I didn't think about this specific scenario but it makes sense. Let's show the label only if the extension is active 🙂 Thank you 🙏

@rjchow rjchow requested review from a team and adrianduffell and removed request for rjchow June 9, 2023 07:19
@moon0326 moon0326 force-pushed the update/38436-additional-changes-for-plugins-page branch from cb255e7 to 6bc1133 Compare June 11, 2023 02:05
@moon0326
Copy link
Contributor Author

Thanks @verofasulo and @ilyasfoo ❤️

@ilyasfoo // I've rebased the latest main, which has RJ's changes.

Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting the same issue with @rjchow here, where plugins list is inconsistent. I think I may have found the way to reproduce it:

  1. Go through the profiler until the plugins step.
  2. In another tab or CLI, delete the option woocommerce_default_country or replace with empty string.
  3. Refresh the plugins list.
  4. Observe the plugin list is not complete.

I'm also getting this error when pressing Continue in the plugins page after the rebase:

Uncaught TypeError: Cannot read properties of undefined (reading 'find')
    at installAndActivatePlugins.ts:198:43
    at Array.sort (<anonymous>)
    at pluginsInstallationQueue (installAndActivatePlugins.ts:197:41)
    at utils.js:417:1
    at Array.reduce (<anonymous>)
    at updateContext (utils.js:399:1)
    at handleAction (actions.js:584:41)
    at processBlock (actions.js:625:1)
    at Array.map (<anonymous>)
    at resolveActions (actions.js:650:32)

Also from my previous review, the plugin is still labelled as Installed when deactivated.

@moon0326
Copy link
Contributor Author

moon0326 commented Jun 12, 2023

I'm getting the same issue with @rjchow #38577 (comment), where plugins list is inconsistent. I think I may have found the way to reproduce it:

Thank you for the link. I totally missed the ping from the PR. @rjchow Are you still able to reproduce the issue? I've tried calling the endpoint multiple times and it all came back the same for me.

In another tab or CLI, delete the option woocommerce_default_country or replace with empty string.

As far as I know, woocommerce_default_country always has a value. The plugin list is incomplete because some plugins are only available for certain countries. I think the behavior is expected when woocommerce_default_country value is missing.

I'm also getting this error when pressing Continue in the plugins page after the rebase:

@ilyasfoo Fixed in fcb6b67

Also from my previous review, the plugin is still labelled as Installed when deactivated.

Fixed in e09db7e

@rjchow
Copy link
Contributor

rjchow commented Jun 12, 2023

I'm getting the same issue with @rjchow #38577 (comment), where plugins list is inconsistent. I think I may have found the way to reproduce it:

Thank you for the link. I totally missed the ping from the PR. @rjchow Are you still able to reproduce the issue? I've tried calling the endpoint multiple times and it all came back the same for me.

In another tab or CLI, delete the option woocommerce_default_country or replace with empty string.

As far as I know, woocommerce_default_country always has a value. The plugin list is incomplete because some plugins are only available for certain countries. I think the behavior is expected when woocommerce_default_country value is missing.

If that's the case I suspect what's going on is that the getFreeExtensions() dispatch is happening before the persistBusinessInfo
call completes

I can look into it when I'm back from AFK tomorrow

Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing them, @moon0326! I confirmed that plugins are considered Installed only when it's activated.

Probably not related to this PR in particular, I observed some plugins were installed but not activated. I selected multiple plugins (Jetpack, MailPoet, GLA, Pinterest, TikTok, Shipping) and only some plugins were activated (Pinterest, TikTok). The action scheduler job woocommerce_plugins_install_callback was complete. There was some PHP warnings in debug.log related to Pinterest, no fatal errors.

I'm still having the above issue, it seems only 2 out of 5 plugins installed get activated. Not sure why, the scheduled action is completed. I don't mind to have this addressed in a follow-up if you feel like it though.

Not sure if this is expected, but it seems we're using the old APIs, /wp-json/wc-admin/plugins/install?_locale=user and /wp-json/wc-admin/plugins/activate?_locale=user? 🤔

image

Some minor comments:

throw new Error();
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'll be good to document the async behaviour, i.e.: how it works and how it's handled in the frontend. Not sure if this is the best place, but I digress. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can document it in both frontend and backend. I'll add them 👍

},
PLUGINS_LEARN_MORE_LINK_CLICKED: {
actions: [
'recordTracksPluginsLearnMoreLinkClicked',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems recordTracksPluginsLearnMoreLinkClicked isn't defined anywhere? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 I think I missed it from the last rebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 31f8600

*
* @return array
*/
public static function with_core_profiler_fields( array $plugins ) {
Copy link
Contributor

@ilyasfoo ilyasfoo Jun 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should comment about how how install_priority is handled here such as the ordering since I think maintainers going to need to know what to assign when adding new extensions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I'll copy the table from this PR to the comment.

assignPluginsInstallationQueue: assign( {
pluginsInstallationQueue: ( ctx ) => {
return ctx.selectedPlugins;
return ctx.selectedPlugins.slice().sort( ( a, b ) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love it if there's a comment on the sorting that is done here, i.e: ascending or descending

Moon and others added 2 commits June 12, 2023 22:30
@moon0326
Copy link
Contributor Author

moon0326 commented Jun 13, 2023

I'm still having the above issue, it seems only 2 out of 5 plugins installed get activated. Not sure why, the scheduled action is completed. I don't mind to have this addressed in a follow-up if you feel like it though.

You're correct. I did not change the endpoint after the last rebase 🤦 I'll handle it first thing tomorrow morning.

Updated in 5fb6863

@moon0326
Copy link
Contributor Author

@ilyasfoo I've addressed missing recordTracksPluginsLearnMoreLinkClicked and activation issues.

Could we address the documentation changes in a follow-up PR?

Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilyasfoo I've addressed missing recordTracksPluginsLearnMoreLinkClicked and activation issues.

Thanks! Tests well.

Could we address the documentation changes in a follow-up PR?

Sounds good! 🚢

{ action }: { action: unknown }
) => {
const { step } = action as { step: string };
recordEvent( `storeprofiler_${ step }_learn_more_link_clicked` );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to track which extension "Learn more" was clicked on? cc @verofasulo if you have input 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should. I'll add it 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 175deec

@moon0326 moon0326 merged commit 620ff93 into trunk Jun 13, 2023
@moon0326 moon0326 deleted the update/38436-additional-changes-for-plugins-page branch June 13, 2023 22:03
@github-actions github-actions bot added this to the 7.9.0 milestone Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: @woocommerce/data issues related to @woocommerce/data plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core Profiler - additional changes for the plugins page

5 participants