-
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 statTypeToPlan to map stat types to plan in stats upsells #97159
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~98 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. |
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 |
// Clicks is a paid stats feature that requires the personal plan | ||
expect( statTypeToPlan( STAT_TYPE_CLICKS ) ).toEqual( PLAN_PERSONAL ); | ||
// 7 Days is a free plan feature, this should not be gated but test we default to personal when the stat type doesn't make sense to query | ||
expect( statTypeToPlan( STATS_FEATURE_DATE_CONTROL_LAST_7_DAYS ) ).toEqual( PLAN_PERSONAL ); |
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.
👍🏽
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.
LGTM!
Tests
# | Plan | Site | Scenario | v3 flag | Expected result | Test result |
---|---|---|---|---|---|---|
1 | Free | initsogarfree.* | Premium feature (e.g., search terms) | Yes | Should see premium upsell | ✅ |
2 | Free | initsogarfree.* | Premium feature (e.g., search terms) | No | Should see premium upsell | ✅ |
3 | Free | initsogarfree.* | Personal feature (e.g., clicks) | Yes | Should see personal upsell | ✅ |
4 | Free | initsogarfree.* | Personal feature (e.g., clicks) | No | Should see premium upsell | ✅ |
5 | Personal | initsogarpersonal.* | Premium feature (e.g., search terms) | Yes | Should see premium upsell | ✅ |
6 | Personal | initsogarpersonal.* | Premium feature (e.g., search terms) | No | Should see premium upsell | ✅ |
- v3 flag enabled: passing
?flags=stats/paid-wpcom-v3
to the request. - v3 flag disabled: passing
?flags=-stats/paid-wpcom-v3
to the request. Mimics the current production behavior.
Unit test
yarn run test-client client/my-sites/stats/test/stat-type-to-plan.ts
PASS client/my-sites/stats/test/stat-type-to-plan.ts
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 3.448 s
Ran all test suites matching /client\/my-sites\/stats\/test\/stat-type-to-plan.ts/i.
Related to #
Proposed Changes
stats/paid-wpcom-v3
is enabled we want to upsell to the premium or personal plan depending on the stat. These stats will be split between STATS_PAID and STATS_COMMERCIAL site features with Add new paid stats site features: STATS_FREE, STATS_COMMERCIAL #97041.Testing Instructions
Personal site looking at search terms (commercial feature) should see premium upsell with and without the flag:
Free site looking at search terms should see premium upsell with and without the flag:
Free site looking at clicks should se personal upsell with the flag, premium upsell without the flag:
Unit tests:
Main change adds the premium link when looking at a premium feature
But upsells to personal when looking at a personal feature