Repository navigation
Premium Analytics: add a Regions view to the Locations widget - #51312
Nikschavan merged 3 commits into
Conversation
dffdaa4 to
722984a
Compare
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Mu Wpcom plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Premium Analytics plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryCoverage changed in 1 file.
|
bc51d82 to
8f9aff2
Compare
There was a problem hiding this comment.
Pull request overview
This PR restores “Regions” parity in Premium Analytics’ Locations widget by adding a Regions view that spans all countries, improving map aggregation/tooltip behavior, and ensuring “View all” deep-links to the matching report tab. It also adjusts chart exports so consumers can build GeoChart tooltip columns.
Changes:
- Add a Regions mode to the Locations widget (UI control + data/map rendering + “View all” routing).
- Roll up region rows to country totals on the world map and add rich tooltips listing top regions per country.
- Export
GoogleDataTableColumnRoleTypeas a runtime value from@automattic/chartsand re-export through the Premium Analytics toolkit/externals; update Storybook mocks accordingly.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/plugins/wpcomsh/changelog/wooa7s-1922-locations-regions | Add wpcomsh changelog entry for Regions view. |
| projects/plugins/premium-analytics/changelog/wooa7s-1922-locations-regions | Add premium-analytics plugin changelog entry for Regions view. |
| projects/plugins/mu-wpcom-plugin/changelog/wooa7s-1922-locations-regions | Add mu-wpcom-plugin changelog entry for Regions view. |
| projects/plugins/jetpack/changelog/wooa7s-1922-locations-regions | Add Jetpack plugin changelog entry for Regions view. |
| projects/packages/premium-analytics/widgets/locations/widget.ts | Extend widget attribute union + add “Regions” option in View By list. |
| projects/packages/premium-analytics/widgets/locations/stories/locations-widget.stories.tsx | Add Regions mode Storybook story and update controls/docs text. |
| projects/packages/premium-analytics/widgets/locations/render.tsx | Implement Regions rendering: country rollups, tooltips, and correct report section linking. |
| projects/packages/premium-analytics/widgets/locations/package.json | Add formatter dependency used by tooltip formatting. |
| projects/packages/premium-analytics/widgets/locations/tests/locations.test.tsx | Add tests for report linking and Regions rollup/tooltip behavior; adjust mocks. |
| projects/packages/premium-analytics/packages/widgets-toolkit/src/stories/mocks/register-stats-mocks.ts | Return unscoped regions across all countries in Storybook mocks (endpoint parity). |
| projects/packages/premium-analytics/packages/widgets-toolkit/src/index.ts | Re-export GoogleDataTableColumnRoleType for widget consumers. |
| projects/packages/premium-analytics/packages/externals/src/index.ts | Re-export GoogleDataTableColumnRoleType via externals. |
| projects/packages/premium-analytics/changelog/wooa7s-1922-locations-regions | Add package changelog entry for Locations widget Regions parity. |
| projects/js-packages/charts/src/index.ts | Export GoogleDataTableColumnRoleType as a runtime value (not type-only). |
| projects/js-packages/charts/changelog/wooa7s-1922-locations-regions | Add charts changelog entry for the new value export. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Heads-up: this collides with #51267 (WOOA7S-1940 — a duplicate report of WOOA7S-1922), which adds the same Regions view and touches the same five files; whichever merges first conflicts the other. Since #51267 is a few days into review, one clean split would be: #51267 lands the core view, and this PR shrinks to its genuinely distinctive parts — the per-country region tooltip and the Two findings that would apply to the tooltip follow-up either way:
|
|
I went ahead a merged #51267. Sorry I didn't realized there was already an issue WOOA7S-1922 for this. |
8f9aff2 to
6db632e
Compare
chihsuan
left a comment
There was a problem hiding this comment.
Thanks for the update @Nikschavan Looks good to me! 👍
6f9cd5f to
9506324
Compare
The Locations widget offered Countries and Cities only, so regions were reachable just by drilling into one country. Current Jetpack Stats has a Regions tab, so v2 lost state-level traffic for sites that rely on it. Regions joins the View by dropdown and spans every country. Google GeoChart draws subdivisions only inside a single country's map, so region rows are summed onto their country on the world map, and each country carries its own regions in a tooltip. Fixes WOOA7S-1922
The widget test mocked the data hook empty, so neither the country rollup nor the tooltip builder ever ran.
Google gives its HTML tooltip no width, so the box shrink-to-fits against the room left beside the hovered feature. Opened near a map edge it broke even a short country name across lines, which the default SVG tooltip never did.
9506324 to
698e261
Compare
Fixes WOOA7S-1922
Proposed changes
#51267 added the Regions view while this branch was open, and it shipped the dropdown option, the map rollup, and the report link. This PR is now only the part that view still lacks. In Regions mode the map colours a country by the sum of its regions, but the tooltip named only that total, so nothing said which regions the colour stood for.
GoogleDataTableColumnRoleTypefrom@automattic/chartsas a value, not a type. A GeoChart tooltip column must name the enum member, so no consumer could declare one. It passes throughexternalsandwidgets-toolkitlike the other chart exports.Cities mode keeps the default tooltip, and the country drill-down is unchanged.
Related product discussion/links
Does this pull request change what data or activity we track or use?
No. The tooltip reads the region rows that Regions mode already fetches from
stats/location-views/region.Testing instructions
jp build plugins/premium-analytics --deps.pnpm run storybookinprojects/packages/premium-analytics, then open Packages → Premium Analytics → Widgets → Locations → RegionsMode.