Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize Woo Express and free trial themes screen #78570

Merged
merged 9 commits into from
Jun 28, 2023

Conversation

ilyasfoo
Copy link
Contributor

Related to Automattic/wc-calypso-bridge#1181

Proposed Changes

Implement theme page customizations for Woo Express free trial sites.

image

  • Add a hidden theme filter mechanism to append filters that do not show up in UI or URL
  • Add woo-on-plans hidden filter for WooCommerce themes
  • Hide theme categories from theme filters UI
  • Update WooCommerce themes to show the congratulations page after activating
  • Update Woo Express and free trial selectors to optimistically use site state data while plan data is loaded

Testing Instructions

  • If D114232-code is not yet merged, you'll need to sandbox it and point public-api.wordpress.com to your sandbox
  • In a free trial or Woo Express site, go to Appearance > Themes
  • Observe that only WooCommerce themes appear
  • Observe that the categories filter is not shown
  • Observe that the banner copy is Upgrade to a plan to upload your own themes!
  • Click on the banner CTA, it should navigate you to the plans page
  • Go back to Appearance > Themes and activate a theme different to your current theme
  • Observe that you're redirected to the Congratulations screen

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

@ilyasfoo ilyasfoo requested a review from a team as a code owner June 23, 2023 09:54
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 23, 2023
@github-actions
Copy link

github-actions bot commented Jun 23, 2023

@matticbot
Copy link
Contributor

matticbot commented Jun 23, 2023

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~2036 bytes added 📈 [gzipped])

name                             parsed_size           gzip_size
themes                               +1069 B  (+0.1%)     +294 B  (+0.1%)
settings-performance                 +1040 B  (+0.2%)     +190 B  (+0.1%)
write-flow                           +1014 B  (+0.1%)     +188 B  (+0.1%)
videopress-flow                      +1014 B  (+0.1%)     +188 B  (+0.1%)
settings-writing                     +1014 B  (+0.2%)     +206 B  (+0.1%)
settings-security                    +1014 B  (+0.3%)     +206 B  (+0.2%)
posts-custom                         +1014 B  (+0.2%)     +188 B  (+0.1%)
posts                                +1014 B  (+0.2%)     +188 B  (+0.1%)
media                                +1014 B  (+0.1%)     +206 B  (+0.1%)
marketing                            +1014 B  (+0.2%)     +212 B  (+0.1%)
link-in-bio-tld-flow                 +1014 B  (+0.1%)     +188 B  (+0.1%)
free-flow                            +1014 B  (+0.1%)     +188 B  (+0.1%)
earn                                 +1014 B  (+0.2%)     +207 B  (+0.2%)
build-flow                           +1014 B  (+0.1%)     +188 B  (+0.1%)
activity                             +1014 B  (+0.2%)     +190 B  (+0.1%)
theme                                 +929 B  (+0.1%)     +189 B  (+0.1%)
plugins                               +734 B  (+0.0%)     +195 B  (+0.0%)
jetpack-cloud-plugin-management       +734 B  (+0.1%)     +195 B  (+0.1%)
hosting                               +734 B  (+0.1%)     +144 B  (+0.1%)
settings                              +721 B  (+0.1%)     +166 B  (+0.1%)
domains                               +713 B  (+0.0%)     +150 B  (+0.0%)
checkout                              -354 B  (-0.0%)      -69 B  (-0.0%)
pattern-assembler-step                 -85 B  (-0.0%)      -37 B  (-0.0%)
marketplace                            -85 B  (-0.0%)      -15 B  (-0.0%)
import-flow                            -85 B  (-0.0%)      -37 B  (-0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~1911 bytes added 📈 [gzipped])

name                                                     parsed_size           gzip_size
async-load-design-blocks                                     +1014 B  (+0.1%)     +188 B  (+0.0%)
async-load-calypso-reader-sidebar                            +1014 B  (+1.4%)     +191 B  (+1.0%)
async-load-calypso-post-editor-editor-media-modal            +1014 B  (+0.1%)     +206 B  (+0.1%)
async-load-calypso-my-sites-stats-summary                    +1014 B  (+2.1%)     +209 B  (+1.5%)
async-load-calypso-my-sites-stats-stats-subscribers          +1014 B  (+1.0%)     +187 B  (+0.5%)
async-load-calypso-my-sites-stats-stats-insights             +1014 B  (+1.4%)     +219 B  (+1.0%)
async-load-calypso-my-sites-current-site-notice              +1014 B  (+3.0%)     +169 B  (+1.7%)
async-load-calypso-components-web-preview-component          +1014 B  (+0.2%)     +188 B  (+0.1%)
async-load-calypso-blocks-jitm-templates-sidebar-banner      +1014 B  (+4.7%)     +180 B  (+2.8%)
async-load-calypso-blocks-jitm-templates-notice              +1014 B  (+4.7%)     +180 B  (+2.8%)
async-load-calypso-blocks-jitm-templates-default             +1014 B  (+4.7%)     +182 B  (+2.8%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

const wooExpressPlans = [
PLAN_WOOEXPRESS_MEDIUM,
PLAN_WOOEXPRESS_SMALL,
PLAN_WOOEXPRESS_MEDIUM_MONTHLY,
PLAN_WOOEXPRESS_SMALL_MONTHLY,
];

if ( ! currentPlan ) {
const productSlug = currentPlan?.productSlug || site?.plan?.product_slug;
Copy link
Contributor Author

@ilyasfoo ilyasfoo Jun 23, 2023

Choose a reason for hiding this comment

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

It seems site data also has the current plan slug. This is necessary for better UX since site data is already available when the themes screen is loaded. Otherwise, we'll have the upsell component flicker in-and-out and the themes list not loading properly since hidden filter is added after its first load.

@ilyasfoo ilyasfoo requested review from a team, moon0326 and adrianduffell and removed request for a team June 23, 2023 10:28
Copy link
Member

@chihsuan chihsuan 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! Looks good and tested well. 👍

client/my-sites/themes/theme-showcase.jsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@JessBoctor JessBoctor left a comment

Choose a reason for hiding this comment

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

I did a functional review. There was only one thing that didn't work as expected:

[x] Observe that only WooCommerce themes appear

[] Observe that the categories filter is not shown - For me, the categories still appeared but I was not shown any results when I clicked on them. This made things feel a little bit broken:

Screenshot 2023-06-27 at 13 58 45

[x] Observe that the banner copy is Upgrade to a plan to upload your own themes!
[x] Click on the banner CTA, it should navigate you to the plans page
[x] Go back to Appearance > Themes and activate a theme different to your current theme
[x] Observe that you're redirected to the Congratulations screen

Environment:

  • D114232 Patch on sandbox
  • Checked out add/1181-wooexpress-custom-theme
  • Sandboxed WordPress.com, public-api.wordpress.com, and Calypso
  • new WooExpress trial site from woocommerce.com/start
  • Browser: Chrome Version 114.0.5735.133
  • macOS: 13.4 Ventura

Copy link
Contributor

@moon0326 moon0326 left a comment

Choose a reason for hiding this comment

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

Nice work on this!

LGTM and tested well for me 👍 🚀

@ilyasfoo
Copy link
Contributor Author

Hi, @JessBoctor! Thanks for the review!

[] Observe that the categories filter is not shown - For me, the categories still appeared but I was not shown any results when I clicked on them. This made things feel a little bit broken:

Sorry this wasn't clear in the instructions. The categories in this context are these:

image

@ilyasfoo ilyasfoo force-pushed the add/1181-wooexpress-custom-theme branch from 4314366 to f0f2ac1 Compare June 28, 2023 09:56
@ilyasfoo ilyasfoo merged commit be324ec into trunk Jun 28, 2023
@ilyasfoo ilyasfoo deleted the add/1181-wooexpress-custom-theme branch June 28, 2023 10:52
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 28, 2023
ilyasfoo added a commit that referenced this pull request Jun 28, 2023
ilyasfoo added a commit that referenced this pull request Jul 3, 2023
* Tweak Woo Express and free trial selector to use site for faster performance

* Force theme upsell banner for free trial sites, hide theme categories for Woo Express and free trial sites

* Add hidden theme filters to force woo-on-plans filter

* Redirect woo-on-plan themes to congrats page on theme activation

* Customize upsell nudge arrangement for Woo Express and free trial

* Add back current plan to selectors as a backup

* Update client/my-sites/themes/theme-showcase.jsx

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

* Fix hiddenFilters inserting empty array into join breaking other filters

* Hardcode store filter instead since 5 WooCommerce only themes is too small to choose from

---------

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
ilyasfoo added a commit that referenced this pull request Jul 7, 2023
)

* Customize Woo Express and free trial themes screen (#78570)

* Tweak Woo Express and free trial selector to use site for faster performance

* Force theme upsell banner for free trial sites, hide theme categories for Woo Express and free trial sites

* Add hidden theme filters to force woo-on-plans filter

* Redirect woo-on-plan themes to congrats page on theme activation

* Customize upsell nudge arrangement for Woo Express and free trial

* Add back current plan to selectors as a backup

* Update client/my-sites/themes/theme-showcase.jsx

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

* Fix hiddenFilters inserting empty array into join breaking other filters

* Hardcode store filter instead since 5 WooCommerce only themes is too small to choose from

---------

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

* Remove premium tier for Woo Express or free trial sites

---------

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants