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

Add-ons: Storage as a tiered-volume product [WIP] #75294

Open
wants to merge 11 commits into
base: trunk
Choose a base branch
from

Conversation

gmovr
Copy link
Contributor

@gmovr gmovr commented Apr 4, 2023

Related to #

Proposed Changes

  • Allows an add-on to have a quantity, both for the checkout URL with quantity meta, and for calculating display prices.
  • I will revisit this, and do some performance fixes where I can. I will also likely use the existing selectors for tiered-volume products, e.g. getPriceTierForUnits.
  • This is not the design. We will likely combine these together, and have a dropdown (so the add-on card will have state and re-render when the quantity of GB is selected. I also need to add the real icons. Mostly for testing and scoping out the needed work.

To do

  • Handle translations (when final copy is ready)
  • Icons
  • Design review
  • Performance, e.g. now the key for iteration over the add-ons list is the product slug, which now isn't unique.

Testing Instructions

  • Confirm that existing checkout links work
  • Confirm that the add-on links for 50 and 100 GB storage works.
  • To see the grid, you need to patch backend code: D103440-code, since these are not in prod.

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)?

@gmovr gmovr self-assigned this Apr 4, 2023
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

@gmovr gmovr changed the base branch from trunk to add/config-flags-storage-update April 4, 2023 17:28
@gmovr gmovr requested review from a team and worldomonation as code owners April 4, 2023 17:28
@gmovr gmovr requested review from a team April 4, 2023 17:28
@gmovr gmovr requested review from a team as code owners April 4, 2023 17:28
@gmovr gmovr requested a review from a team April 4, 2023 17:28
@gmovr gmovr requested a review from a team as a code owner April 4, 2023 17:28
@matticbot matticbot added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Apr 4, 2023
@gmovr gmovr changed the base branch from add/config-flags-storage-update to trunk April 4, 2023 17:29
@gmovr gmovr removed request for a team April 4, 2023 17:29
@gmovr gmovr removed request for a team and worldomonation April 4, 2023 17:29
@matticbot
Copy link
Contributor

This PR modifies the release build for happy-blocks

To test your changes on WordPress.com, run install-plugin.sh happy-blocks add/quantity-based-storage-addon on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-r7r-p2

@matticbot
Copy link
Contributor

This PR modifies the release build for editing-toolkit

To test your changes on WordPress.com, run install-plugin.sh editing-toolkit add/quantity-based-storage-addon on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-mMA-p2

@matticbot
Copy link
Contributor

matticbot commented Apr 4, 2023

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

App Entrypoints (~295 bytes removed 📉 [gzipped])

name                   parsed_size           gzip_size
entry-stepper               -796 B  (-0.0%)     -214 B  (-0.0%)
entry-main                  -796 B  (-0.1%)     -232 B  (-0.1%)
entry-login                 -481 B  (-0.0%)     -161 B  (-0.0%)
entry-domains-landing       -481 B  (-0.1%)     -164 B  (-0.1%)
entry-browsehappy           -481 B  (-0.5%)     -164 B  (-0.5%)
entry-subscriptions         -431 B  (-0.0%)     -152 B  (-0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~910 bytes removed 📉 [gzipped])

name                               parsed_size           gzip_size
add-ons                               +33164 B  (+7.8%)    +8780 B  (+6.3%)
settings                               -1169 B  (-0.1%)      -17 B  (-0.0%)
jetpack-cloud-plugin-management         +579 B  (+0.1%)     +172 B  (+0.1%)
jetpack-cloud-partner-portal            +579 B  (+0.1%)      +94 B  (+0.1%)
jetpack-cloud-features-comparison       +579 B  (+0.1%)      +94 B  (+0.0%)
jetpack-cloud-agency-dashboard          +579 B  (+0.1%)     +172 B  (+0.1%)
checkout                                +579 B  (+0.0%)      +94 B  (+0.0%)
jetpack-connect                         +486 B  (+0.0%)     -149 B  (-0.0%)
plans                                   +383 B  (+0.0%)     -230 B  (-0.1%)
jetpack-cloud-pricing                   +383 B  (+0.0%)     -222 B  (-0.1%)
site-purchases                          +319 B  (+0.0%)     +131 B  (+0.0%)
purchases                               +319 B  (+0.0%)     +135 B  (+0.0%)
settings-performance                    -234 B  (-0.0%)      +67 B  (+0.0%)
settings-security                       -232 B  (-0.0%)      +58 B  (+0.0%)
plugins                                 -232 B  (-0.0%)      +55 B  (+0.0%)
hosting                                 -232 B  (-0.0%)      +57 B  (+0.0%)
settings-reading                        +141 B  (+0.0%)     -284 B  (-0.2%)
email                                   -129 B  (-0.0%)      +66 B  (+0.0%)
earn                                    -129 B  (-0.0%)      +70 B  (+0.0%)
settings-discussion                     +128 B  (+0.0%)     -260 B  (-0.2%)
people                                  +105 B  (+0.0%)      +90 B  (+0.0%)
newsletter-flow                          +88 B  (+0.0%)      +70 B  (+0.0%)
write-flow                               +80 B  (+0.0%)      +16 B  (+0.0%)
videopress-flow                          +80 B  (+0.0%)      +16 B  (+0.0%)
update-design-flow                       +80 B  (+0.0%)      +16 B  (+0.0%)
signup                                   +80 B  (+0.0%)      +16 B  (+0.0%)
link-in-bio-tld-flow                     +80 B  (+0.0%)      +16 B  (+0.0%)
link-in-bio-flow                         +80 B  (+0.0%)      +16 B  (+0.0%)
home                                     +80 B  (+0.0%)      +16 B  (+0.0%)
free-flow                                +80 B  (+0.0%)      +16 B  (+0.0%)
build-flow                               +80 B  (+0.0%)      +16 B  (+0.0%)
accept-invite                            +80 B  (+0.0%)      +16 B  (+0.0%)
site-setup-flow                          -26 B  (-0.0%)      -25 B  (-0.0%)
site-blocks                              -26 B  (-0.0%)      +81 B  (+0.0%)
security                                 -26 B  (-0.0%)      +81 B  (+0.0%)
privacy                                  -26 B  (-0.0%)      +81 B  (+0.0%)
plugin-bundle-flow                       -26 B  (-0.0%)      -26 B  (-0.1%)
notification-settings                    -26 B  (-0.0%)      +81 B  (+0.0%)
media                                    -26 B  (-0.0%)      -98 B  (-0.0%)
me                                       -26 B  (-0.0%)      +81 B  (+0.0%)
help                                     -26 B  (-0.0%)      +81 B  (+0.0%)
happychat                                -26 B  (-0.0%)      +81 B  (+0.0%)
account-close                            -26 B  (-0.0%)      +81 B  (+0.0%)
account                                  -26 B  (-0.0%)      +81 B  (+0.0%)
devdocs                                  +23 B  (+0.0%)      +11 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 (~561 bytes removed 📉 [gzipped])

name                                                            parsed_size            gzip_size
async-load-signup-steps-add-ons                                    +33102 B  (+13.3%)    +8553 B  (+10.5%)
async-load-masterbar-cart-masterbar-cart-wrapper                     +579 B   (+0.6%)      +94 B   (+0.3%)
async-load-calypso-my-sites-checkout-modal                           +579 B   (+0.1%)      +94 B   (+0.0%)
async-load-calypso-blocks-editor-checkout-modal                      +579 B   (+0.1%)      +94 B   (+0.0%)
async-load-design-blocks                                             -234 B   (-0.0%)      +67 B   (+0.0%)
async-load-signup-steps-woocommerce-install-step-business-info       -150 B   (-0.1%)     -479 B   (-0.5%)
async-load-calypso-blocks-inline-help-popover                         +50 B   (+0.0%)      +22 B   (+0.0%)
async-load-signup-steps-woocommerce-install-step-store-address        -26 B   (-0.0%)     -142 B   (-0.2%)
async-load-design-wordpress-components-gallery                        +18 B   (+0.0%)     +114 B   (+0.1%)

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.

Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

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

I know this is a WIP but I had a drive-by suggestion.

const selectedSite = useSelector( getSelectedSite );

return ( addOnSlug: string, quantity?: number ): string => {
const checkoutLinkFormat = `/checkout/${ selectedSite?.slug }/${ addOnSlug }`;
Copy link
Member

Choose a reason for hiding this comment

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

If selectedSite does not exist, this will create a URL like /checkout/undefined/product. Do you think we should do something different in that case? Maybe just /checkout/product (which should work well by showing a site picker first).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I added a check for this now, and it will return the site picker if no selectedSite is provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE [Status] Needs Rebase [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants