-
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
Stats: Show upgrade notices for commercial sites with PWYW plans #92040
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
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 (~113 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. 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.
It works well for self hosted, Atomic and simple sites. Minor suggestions inlined, no blockers.
if ( showUpgradeNoticeOnOdyssey || showUpgradeNoticeForJetpackNotAtomic ) { | ||
if ( isCommercial && hasPWYWPlanOnly ) { | ||
return true; | ||
} | ||
} |
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 understand this might be written intentionally in two conditions but for the sake of simplicity, could we merge them to one?
@@ -130,4 +103,39 @@ const ALL_STATS_NOTICES: StatsNoticeType[] = [ | |||
}, | |||
]; | |||
|
|||
function shouldShowCommercialSiteUpgradeNotice( { |
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.
Can we please not change the pattern here just to be consistent?
Not related to the PR: I'm thinking maybe we could put those notices back to their own files, where the notice component are defined. It'll be better to satisfy the open/close principal. Thought?
// Get listing of all plans that support stats in some way and qualify as "paid" plans. | ||
const plansSupportingStats = sitePurchases?.filter( | ||
( product ) => | ||
productHasStats( camelOrSnakeSlug( product ), true ) && product.expiryStatus !== 'expired' |
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.
Side note: We currently only have two features for Stats, stats-paid and stats-free
, and we probably want to introduce another one stats-commercial
which includes support for all advanced features and commercial use.
Moved to function for easier logging.
Add test specific to commerical sites with PWYW plans.
3b18f9b
to
b4e4aa9
Compare
Related to #81361.
Proposed Changes
Show the commercial upgrade notice on any site flagged as
isCommercial
that has a PWYW plan. Previously we didn't show the notice to these sites.Why are these changes being made?
The PWYW plans are meant for non-commercial sites. It's possible to purchase one if the site has not been classified or if the site's classification changes over time. We want to make sure we surface notices to upgrade to the correct license if we find a mismatch of classification & license type.
Testing Instructions
Pre-merge Checklist