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

Pricing Grid: Fixes billing timeframe for 2Y & 3Y plans #77823

Merged
merged 1 commit into from
Jun 16, 2023

Conversation

aneeshd16
Copy link
Contributor

Fixes Automattic/martech#1811

Proposed Changes

Note: Once the PR is approved, I'll add the String Freeze label to send the new text for translations.

  • Fixes the billing timeframe for 2Y and 3Y plans. The billing timeframe refers to the text below the price in the pricing grid.
  • Screenshots:

2Y plans:

Before After
image image

3Y plans:

Before After
image image

Testing Instructions

  • The unit tests should cover all possible cases.
  • On a site with a 2Y plan, go to /plans and confirm that the text matches the screenshot.
  • On a site with a 3Y plan, go to /plans and confirm that the text matches the screenshot.

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

@aneeshd16 aneeshd16 requested a review from a team as a code owner June 6, 2023 04:55
@aneeshd16 aneeshd16 requested a review from southp June 6, 2023 04:55
@matticbot matticbot added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jun 6, 2023
@matticbot
Copy link
Contributor

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

Async-loaded Components (~40 bytes removed 📉 [gzipped])

name                                                 parsed_size           gzip_size
async-load-calypso-my-sites-plan-features-2023-grid       -503 B  (-0.5%)      -40 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.

@aneeshd16 aneeshd16 self-assigned this Jun 6, 2023
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.

It looks like there's overlap between the changes here and the small PR that I created yesterday #77818.

I'm closing my PR in favor of these comprehensive updates

}
} else if ( rawPrice ) {
if ( PLAN_ANNUAL_PERIOD === billingPeriod ) {
return translate( 'per month, %(rawPrice)s billed annually, Excl. Taxes', {
Copy link
Contributor

@jeyip jeyip Jun 6, 2023

Choose a reason for hiding this comment

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

Non-blocking / Nit :

I'm noticing a distinct difference in language that we use to describe the time horizon of yearly plans

billed annually / billed every two years / billed every three years

vs.

for the first year / for the first two years / for the first three years

This seems fine to me, but I wanted to make sure that this variation is purposeful.

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 spot! It is purposeful as we want to make the distinction that the discounted price applies for the first year/term only, and then the full price of the plan would apply for subsequent terms.

);
} );

test( 'should show full-term discounted price when plan is 3-yearly', () => {
Copy link
Contributor

@jeyip jeyip Jun 6, 2023

Choose a reason for hiding this comment

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

Non-blocking / Nit:

Would you mind describing what full-term discounted means? I see it used throughout this part of the codebase and just assume it means a non-monthly discounted plan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! "full-term discounted price" refers to the price for the complete duration of the plan with any applicable discounts. The discount could either be a currency-specific discount or a discount due to the application of pro-rated credits. For example:
image

"280" is the "per month discounted price", and 3360 is the "full-term discounted price".

originalPrice: 200,
};

usePlanPricesDisplay.mockImplementation( jest.fn( () => planPrices ) );
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 / Nit:

Not necessary to do in this PR. I see we have a beforeEach, but how would we feel about an afterAll to to tear down mocks?

afterAll(() => {
  jest.clearAllMocks();
});

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.

Just wanted to say that I always appreciate updated specs in PRs 🎉 Code looks good to me. Testing now.

@@ -74,82 +73,69 @@ function usePerMonthDescription( {
},
} );
}
return null;
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 / Nit:

Is it worth writing a spec for this null case?

@jeyip
Copy link
Contributor

jeyip commented Jun 6, 2023

Testing

For the 3Y plan, I didn't know to to set up a triannual toggle. Instead, I manually rendered the text which looked reasonable.

Requirements

  • On a site with a 2Y plan, go to /plans and confirm that the text matches the screenshot.
  • On a site with a 3Y plan, go to /plans and confirm that the text matches the screenshot.

Browsers

  • Chrome

@aneeshd16 aneeshd16 added the [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging label Jun 7, 2023
@a8ci18n
Copy link

a8ci18n commented Jun 7, 2023

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/8028803

Thank you @aneeshd16 for including a screenshot in the description! This is really helpful for our translators.

@a8ci18n
Copy link

a8ci18n commented Jun 15, 2023

Translation for this Pull Request has now been finished.

@aneeshd16 aneeshd16 merged commit 96c907b into trunk Jun 16, 2023
@aneeshd16 aneeshd16 deleted the fix/billing-timeframe-2y-3y-plans branch June 16, 2023 03:33
@github-actions github-actions bot removed [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jun 16, 2023
@aneeshd16 aneeshd16 added the 2023 Pricing Page ⚡ Changes for pricing page optimisation 2023 label Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2023 Pricing Page ⚡ Changes for pricing page optimisation 2023
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants