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

Plans (grid): Reflect storage add-on selection on intro offer price and billing desc #95428

Merged
merged 7 commits into from
Oct 22, 2024

Conversation

chriskmnds
Copy link
Contributor

@chriskmnds chriskmnds commented Oct 16, 2024

Fixes #95342

Proposed Changes

  • Enables storage selection in the plans grid to be reflected on the intro offer prices.

I'll skip a long description as I've run out of time. Read #95342 as this precisely addresses the issue

Why are these changes being made?

Fix #95342

Testing Instructions

Main:

  • Switch to INR currency (or other currency that gives first-year discount)
  • Go to /plans/:site and /start/plans (or /setup/onboarding/plans)
  • Confirm prices and billing descriptions are rendered correctly with the intro & cross-out pricing
  • Go to Business or Commerce plans in the grid and select a storage add-on upgrade
  • Confirm the pricing is updated to reflect the additional cost (as done for non discounted currencies)
  • Repeat with USD/EUR and confirm the same

Other:

These changes also affect intro-offers displayed elsewhere.

  • Confirm the upgrade-plan for the migration flow renders the intro pricing correctly cc @merkushin

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

@chriskmnds chriskmnds self-assigned this Oct 16, 2024
...SITE_PLANS[ PLAN_BUSINESS ],
pricing: {
...SITE_PLANS[ PLAN_BUSINESS ].pricing,
costOverrides: [ { overrideCode: COST_OVERRIDE_REASONS.RECENT_PLAN_PRORATION } ],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea why this test worked previously. This is needed for the condition to pass, but curious if I'm missing something. @aneeshd16 would you mind confirming?

Copy link
Contributor

Choose a reason for hiding this comment

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

This was previously defined in the mock here:

@chriskmnds chriskmnds marked this pull request as ready for review October 17, 2024 15:09
@chriskmnds chriskmnds requested a review from a team as a code owner October 17, 2024 15:09
@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 Oct 17, 2024
@chriskmnds chriskmnds force-pushed the update/plans-intro-pricing-with-storage-selection branch from feaacc5 to 4db4997 Compare October 17, 2024 15:12
@chriskmnds chriskmnds changed the title Plans (grid): Include storage add-on selection on introductory price Plans (grid): Reflect storage add-on selection on intro offer price and billing desc Oct 17, 2024
@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • odyssey-stats
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/plans-intro-pricing-with-storage-selection on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented Oct 17, 2024

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

Sections (~1292 bytes added 📈 [gzipped])

name                     parsed_size           gzip_size
hosting                       +713 B  (+0.0%)     +150 B  (+0.0%)
import-hosted-site-flow       +707 B  (+0.1%)     +102 B  (+0.0%)
theme                         +653 B  (+0.1%)     +138 B  (+0.1%)
stats                         +653 B  (+0.1%)     +123 B  (+0.0%)
site-purchases                +653 B  (+0.0%)     +113 B  (+0.0%)
purchases                     +653 B  (+0.0%)     +113 B  (+0.0%)
posts-custom                  +653 B  (+0.1%)     +155 B  (+0.1%)
posts                         +653 B  (+0.1%)     +155 B  (+0.1%)
migrate                       +653 B  (+0.2%)     +119 B  (+0.1%)
domains                       +653 B  (+0.0%)     +113 B  (+0.0%)
checkout                      +653 B  (+0.0%)     +140 B  (+0.0%)
update-design-flow            +611 B  (+0.1%)      +76 B  (+0.0%)
plugins                       +611 B  (+0.0%)      +67 B  (+0.0%)
plans                         +611 B  (+0.0%)      +68 B  (+0.0%)
link-in-bio-tld-flow          +611 B  (+0.0%)      +61 B  (+0.0%)
jetpack-app                   +611 B  (+0.1%)      +66 B  (+0.0%)
themes                        +231 B  (+0.0%)      +52 B  (+0.0%)
staging-site                  +231 B  (+0.0%)      +53 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 (~327 bytes added 📈 [gzipped])

name                                             parsed_size           gzip_size
async-load-design-blocks                              +653 B  (+0.0%)     +153 B  (+0.0%)
async-load-signup-steps-plans-theme-preselected       +611 B  (+0.2%)      +66 B  (+0.1%)
async-load-signup-steps-plans                         +611 B  (+0.2%)      +66 B  (+0.1%)
async-load-signup-steps-theme-selection               +231 B  (+0.1%)      +52 B  (+0.0%)
async-load-calypso-my-sites-checkout-modal            +231 B  (+0.0%)      +53 B  (+0.0%)
async-load-calypso-blocks-editor-checkout-modal       +231 B  (+0.0%)      +55 B  (+0.0%)

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.

@jeyip
Copy link
Contributor

jeyip commented Oct 21, 2024

Testing

Requirements

All prices were tested in INR / USD / EUR. Note that there are no first year currency discounts for USD and EUR, so cross-out pricing was not tested in those instances:

/plans/:site

  • Confirm prices and billing descriptions are rendered correctly with the intro & cross-out pricing
  • Go to Business or Commerce plans in the grid and select a storage add-on upgrade. Confirm the pricing is updated to reflect the additional cost ( as done for non discounted currencies )
  • Smoke test multi-year plan pricing

/start/plans

  • Confirm prices and billing descriptions are rendered correctly with the intro & cross-out pricing
  • Go to Business or Commerce plans in the grid and select a storage add-on upgrade. Confirm the pricing is updated to reflect the additional cost (as done for non discounted currencies)
  • Smoke test multi-year plan pricing

/setup/onboarding/plans

  • Confirm prices and billing descriptions are rendered correctly with the intro & cross-out pricing
  • Go to Business or Commerce plans in the grid and select a storage add-on upgrade. Confirm the pricing is updated to reflect the additional cost (as done for non discounted currencies)
  • Smoke test multi-year plan pricing

Browsers

  • Chrome

Notes

Happy to make issues if we want to tackle these.

Could use spacing between the comparison grid billing description and CTAs

Screenshot 2024-10-21 at 11 31 04 AM

Selected billing term in dropdown selector has a misaligned checkmark

Screenshot 2024-10-21 at 11 49 55 AM

Storage add-on dropdown has selectable items that aren't left justified

Screenshot 2024-10-21 at 11 51 26 AM

introOffer: {
...introOffer,
rawPrice: {
monthly: 12.5 + STORAGE_ADD_ONS_MOCK[ 0 ].prices.monthlyPrice,
Copy link
Contributor

@jeyip jeyip Oct 21, 2024

Choose a reason for hiding this comment

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

Non-blocking / Nitpick :

I believe that we can retrieve the rawPrice intro offer prices from the introOffer object https://github.com/Automattic/wp-calypso/pull/95428/files#diff-a46b47c6eea7443bc49db0374dd5b54d5a14a95c388dd9cca9481ce161ba6fcfR76-R77

@@ -224,7 +232,7 @@ export default function usePlanBillingDescription( {
'then %(rawPrice)s billed annually, excl. taxes',
{
args: {
introOfferFormattedPrice: introOffer.formattedPrice,
introOfferFormattedPrice: introOfferFullTermText,
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking / Nitpick:

I noticed that you marked the introOffer.formattedPrice field as deprecated.

I did a cursory search and didn't see other usages of introOffer.formattedPrice ( it was fast so not 100% certain ), so we might be able to remove the formattedPrice field entirely. Not important for this PR, but wondering what your thoughts are @chriskmnds

@@ -112,6 +113,7 @@ const usePricingMetaForGridPlans = ( {
originalPrice: Plans.PlanPricing[ 'originalPrice' ];
discountedPrice: Plans.PlanPricing[ 'discountedPrice' ];
currencyCode: Plans.PlanPricing[ 'currencyCode' ];
introOffer: Plans.PlanPricing[ 'introOffer' ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking / Nitpick:

It might be worth clearly differentiating between discountPrice and introOffer, whether it be an inline comment here or elsewhere. I'm assuming that intro offers are also discounted prices, but for new customers only?

Copy link
Contributor

Choose a reason for hiding this comment

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

Intro offers are a separate entity with it's own set of rules and configuration. Here's some more info :)
PCYsg-Wr4-p2

Copy link
Contributor

@jeyip jeyip left a comment

Choose a reason for hiding this comment

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

The approach makes sense to me. For others following along, we:

  • Update pricing meta to account for storage add-ons in intro offer pricing
  • Update the header price component, which references the pricing meta
  • Update billing description hook, which references the pricing meta

Left non-blocking comments, but otherwise LGTM. @chriskmnds let me know if you'd like me to create any issues for the comments -- happy to take care of that. 🚢

@jeyip jeyip added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Oct 21, 2024
@jeyip
Copy link
Contributor

jeyip commented Oct 21, 2024

@merkushin you're mentioned in Christos's PR description.

Confirm the upgrade-plan for the migration flow renders the intro pricing correctly cc @merkushin

Would you mind confirming the above? Everything else looks good to go. 🙂

@aneeshd16
Copy link
Contributor

Fixed the price display on the import upgrade screen via c733a4d.

Before
image

After
image

@jeyip jeyip merged commit 18e9da9 into trunk Oct 22, 2024
11 checks passed
@jeyip jeyip deleted the update/plans-intro-pricing-with-storage-selection branch October 22, 2024 17:05
@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 Oct 22, 2024
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.

/start/plans in INR: Storage addon does not show updated prices
4 participants