-
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
Refactor Jetpack and WPCom plan types #52836
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~103 bytes removed 📉 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~6 bytes removed 📉 [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 (~120 bytes removed 📉 [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. |
@@ -470,7 +465,6 @@ export function itemToSelectorProduct( | |||
// Using the same slug for any duration helps prevent unnecessary DOM updates | |||
iconSlug: ( yearlyProductSlug || productSlug ) + iconAppend, | |||
displayName: getForCurrentCROIteration( item.getTitle ), | |||
buttonLabel: getForCurrentCROIteration( item.getButtonLabel ), |
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.
getButtonLabel
is not used anywhere anymore.
@@ -1,7 +1,8 @@ | |||
export const TERM_MONTHLY = 'TERM_MONTHLY'; | |||
export const TERM_ANNUALLY = 'TERM_ANNUALLY'; | |||
export const TERM_BIENNIALLY = 'TERM_BIENNIALLY'; | |||
export const TERMS_LIST = [ TERM_MONTHLY, TERM_ANNUALLY, TERM_BIENNIALLY ]; | |||
|
|||
export const TERMS_LIST = <const>[ TERM_MONTHLY, TERM_ANNUALLY, TERM_BIENNIALLY ]; |
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 will allow us to have values as types, instead of string
.
@@ -192,13 +191,11 @@ const WPComGetBiennialBillingTimeframe = () => i18n.translate( '/month, billed e | |||
const getAnnualTimeframe = () => ( { | |||
term: TERM_ANNUALLY, | |||
getBillingTimeFrame: () => translate( 'per year' ), | |||
getSignupBillingTimeFrame: () => translate( 'per year' ), |
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.
Not used anywhere.
@@ -1113,32 +1099,27 @@ export const PLANS_LIST = { | |||
'The features most needed by WordPress sites' + | |||
' — perfectly packaged and optimized for everyone.' | |||
), | |||
getPlanCompareFeatures: () => [ |
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.
getPlanCompareFeatures
and getSignupFeatures
are not used by Jetpack plans. We're moving the features defined in there to getHiddenFeatures
.
] ), | ||
getPlanCardFeatures: () => [ FEATURE_BACKUP_DAILY_V2, FEATURE_SCAN_V2, FEATURE_ANTISPAM_V2 ], | ||
getSignupFeatures: ( currentPlan ) => { | ||
const showPersonalPlan = |
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.
Resolves to false for Jetpack plans.
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.
Everything seems to look and behave as in production for simple site and Jetpack site. No errors in console. Able to purchase products/plans without issues or errors. From what I could follow, code changes look good.
LGTM 👍
Changes proposed in this Pull Request
This PR restructures the plan types defined in the
calypso-products
package, and updates the codebase accordingly.Implementation notes
packages/calypso-products/src/types.ts
. Mainly extracted theWPComPlan
andJetpackPlan
interface from the more genericPlan
.getAudience
are called as such.getPlanCompareFeatures
,getShortDescription
,getDescription
,getBlogSignupFeatures
,getPortfolioSignupFeatures
.JetpackPurchasableItem
toJetpackPurchasableItemSlug
for clarity.ProductTranslations
toJetpackProduct
for clarity.JetpackPlanCardFeature
deprecated type by thestring
type.TYPES_LIST
inpackages/calypso-products/src/constants/types.ts
WPCOM_PRODUCTS
andWPCOM_PLANS
inpackages/calypso-products/src/constants/wpcom.ts
packages/calypso-products/src/plans-list.js
according to the aforementioned updates.Testing instructions