-
Notifications
You must be signed in to change notification settings - Fork 2k
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: Make storage selection calculations in plan prices optional #96520
Plans: Make storage selection calculations in plan prices optional #96520
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first approach that came to mind. Totally possible that there might be a more neat / tidy solution. I'll give it more thought tomorrow.
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~867 bytes added 📈 [gzipped])
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 (~317 bytes added 📈 [gzipped])
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. Generated by performance advisor bot at iscalypsofastyet.com. |
packages/data-stores/src/plans/hooks/use-pricing-meta-for-grid-plans.ts
Outdated
Show resolved
Hide resolved
packages/data-stores/src/plans/hooks/use-pricing-meta-for-grid-plans.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jeyip. Do we also need to pass this along from usePlanBillingDescription
? It makes a call to Plans.usePricingMetaForGridPlans
and passes storageAddOns
through (so they are definitely accounted for).
I think we'd just need to add the prop to plans-grid-context and grab from usePlanBillingDescription
.
Hey @chriskmnds just leaving a message here to say I didn't miss your comments. Will get to them tomorrow 😎 |
9ece3ab
to
14945ae
Compare
It's getting near the end of my day. I started reviewing the comment, but will continue tomorrow. Thanks for the patience! |
c8e0442
to
d196100
Compare
Addressing merge conflicts and CR comments now :D |
86db0e8
to
a182e23
Compare
4e4bd2f
to
9598f54
Compare
@chriskmnds would love your input on 57e2f8a. There's one change that's definitely worth discussing, and it's around the ContextAlthough we disable storage add-on calculations in this PR, I believe it makes sense to re-enable storage add-on calculations when term savings are not shown. With #96631, this includes re-enabling storage add-on calculations when there are discounts or special offers in the plans grid. To do so, I leverage the The tricky part is that we handle Reiterated more linearly:
Hoping that makes sense, but happy to clarify further if needed. Possible SolutionsI've pushed one possible solution in 57e2f8a, where, instead of Another alternative might be to prop drill the Lemme know your thoughts 🙂 |
const availablePlanSlugs = usePlansFromTypes( { | ||
planTypes: usePlanTypesWithIntent( { | ||
intent: 'default', | ||
selectedPlan, | ||
siteId, | ||
hiddenPlans, | ||
isSubdomainNotGenerated, | ||
} ), | ||
term, | ||
intent, | ||
} ); | ||
const planSlugsForAllDisplayedIntervals = availablePlanSlugs.flatMap( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does make the hook a lot more complicated, also indirectly linked to how we generate plan slugs in useGridPlans
, which might be hard to keep aligned going forward.
I wonder if we relax the criteria a bit (of reflecting or not reflecting storage selection) might help? e.g. let's show it
by default, and not show it if the experiment.isEligibleForTermSavings
is set. Simple. So we disconnect it from needing access to useEligibilityForTermSavingsPriceDisplay
, which does a lot more than that. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although, not sure if that might help after we conclude the experiment and we run into this problem again 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm so yeah, I think what you have here might be the way forward. Happy to give it some more thought later and get back to you.
p.s. we'd need to use the actual intent
passed through here (without a default value), and also export usePlansFromTypes
to import normally (not from the src
folder). if we stick with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we relax the criteria a bit (of reflecting or not reflecting storage selection) might help? e.g. let's show it
by default, and not show it if the experiment.isEligibleForTermSavings is set. Simple. So we disconnect it from needing access to useEligibilityForTermSavingsPriceDisplay, which does a lot more than that. WDYT?
Although, not sure if that might help after we conclude the experiment and we run into this problem again 🤔
The more I look at the code and weigh the complexity we introduce with the functionality we gain, the more I'm considering this 👍 But yes, like you say, if the experiment concludes successfully we'd have to revisit this discussion
p.s. we'd need to use the actual intent passed through here (without a default value), and also export usePlansFromTypes to import normally (not from the src folder). if we stick with this.
On it
Happy to give it some more thought later and get back to you.
Sounds great -- would love your thoughts as we move forward 🙂
displayedIntervals: UrlFriendlyTermType[]; | ||
storageAddOns: ( AddOns.AddOnMeta | null )[] | null; | ||
coupon?: string; | ||
siteId?: number | null; | ||
isInSignup?: boolean; | ||
} ) => { | ||
const longerPlanTermDefaultExperiment = useLongerPlanTermDefaultExperiment(); | ||
const planSlugs = gridPlans.map( ( { planSlug } ) => planSlug ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p.s. NIT - if we bring back the original (prior to these changes), would it make sense to pass planSlugs
instead? So do the mapping at consuming end perhaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good question. I'll think this over 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go back to the original, I prefer planSlugs
. It more concisely describes what's needed for the hook, and it generalizes the interface more.
Good thinking @jeyip . I replied in a couple of comments, so we can have discussion there instead quoting each other here :-) |
Starting to revisit this PR. Planning to merge later today for two reasons:
|
This reverts commit 29abd6f.
…omparison Grid props
82f95b3
to
acd3c2d
Compare
TestingRequirementsFor each of the flows listed below:
Flows:
Browsers
|
Related to https://github.com/Automattic/martech/issues/3403 and #96357 (review)
Proposed Changes
calypso_plans_page_emphasize_longer_plan_savings
experiment with a newreflectStorageSelectionInPlanPrices
flagreflectStorageSelectionInPlanPrices
to context to reference throughoutplans-grid-next
. Iffalse
, prevent storage add-on calculations in features grid + comparison grid plan pricing.Why are these changes being made?
Testing Instructions
Pre-merge Checklist