-
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
Add Ons: Migrate use add on checkout link hook to data stores package #83489
Conversation
cc342ad
to
5b9d560
Compare
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~46 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 (~19 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. |
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.
Tests out as outlined. Nice refactor. Left one comment, which might merit an update (but I think fine for later too)
const useAddOnCheckoutLink = (): ( ( addOnSlug: string, quantity?: number ) => string ) => { | ||
const selectedSite = useSelector( getSelectedSite ); | ||
export const useAddOnCheckoutLink = (): ( ( | ||
siteDetails: SiteDetails | null, |
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 requiring the entire SiteDetails
structure might turn out to be restrictive in the end for enabling reuse e.g. if the site slug is fed here through a component or another hook that doesn't have the entire site details object? 🤔
Maybe (just thinking) this could be selectedSiteSlug: SiteDetails[ 'slug' ] | null
?
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.
Thanks for the quick review! Will mull this over shortly 🤔
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.
Just getting back to this now 🙂
I wonder if requiring the entire SiteDetails structure might turn out to be restrictive in the end for enabling reuse
Yep! I prefer your suggestion, since it's more explicit about what's actually necessary for the useAddOnCheckoutLink
hook and makes debugging a little clearer ( as well as what you've already mentioned about reuse )
Making the changes now. Thanks for the suggestion 🙏
Edit: Handled in 5853385
4773d1a
to
8ff5ed5
Compare
Add checkout functionality to spotlight plan Fix plans features main tests Fix type errors Refactor grid plans and default storage options
162c291
to
6dc0701
Compare
Related to https://github.com/Automattic/martech/issues/2023 and #83005 (comment)
This PR kicks off the migration of the add-ons data layer into an npm package. We're doing so to align with the 2023 plans pricing page refactor, which aims to migrate the plans-grid into a reusable package ( which will be shared in environments inside and outside Calypso )
Proposed Changes
data-stores
npm packageTesting Instructions
/add-ons
/start
/add-ons/{SITE_SLUG}
/plans
/start
/plans/{SITE_SLUG}
Pre-merge Checklist