WOOA7S-1502: Port Stats Shares widget#50148
Draft
kangzj wants to merge 2 commits into
Draft
Conversation
Add the registered jpa/shares widget: a leaderboard listing each connected social account (icon + name) with its follower count, sourced from the useStatsPublicize data hook. The Publicize endpoint has no date range or comparison period, so the widget renders current counts and the max attribute trims the row count client-side (max = 0 shows all).
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
Contributor
|
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! |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes WOOA7S-1502
Proposed changes
Ports the Jetpack Stats Shares (Publicize) module into a registered Premium Analytics widget (
jpa/shares).widgets/shares/workspace package:package.json,widget.json,widget.ts,render.tsx,shares.module.css, and a Storybook story.LeaderboardChartwhere each row is a connected social account (icon + name via the toolkitLeaderboardLabel) with its follower count.useStatsPublicizedata hook. The Publicize endpoint is non-time-series (built onuseStatsQuery) and has no date range or comparison period, so the widget always shows current follower counts; themaxattribute trims the row count client-side (max = 0shows all).WidgetLoadingOverlayonly when loading with no rows yet,emptyStateTextfor the empty state,--wpds-*tokens in the CSS Module, and the picker-preview aspect-ratio block.No changes to
packages/data,packages/widgets-toolkit, or@automattic/charts. The Storybook root (projects/packages/premium-analytics/widgets) was already registered inprojects.js, so that file is unchanged. Because the sharedregisterReportMockshelper does not cover the Publicize endpoint, the story registers a small story-scopedapiFetchmiddleware to serve it — keeping the entire diff insidewidgets/shares/rather than modifying the shared toolkit mocks.Related product discussion/links
Does this pull request change what data or activity we track or use?
No. It surfaces existing Jetpack Stats Publicize data through a new dashboard widget.
Testing instructions
Live-dashboard verification pending — handled centrally; Storybook + audit + eslint pass locally.
pnpm --dir projects/js-packages/storybook run storybook:dev→ open Packages / Premium Analytics / Widgets / Shares and confirm theDefault,WithComparison, andWidgetDashboardWithWidgetstories render a populated leaderboard (WithComparisonshows the same counts with no deltas, as documented)./widget-audit sharesclean,eslintclean, andjetpack build packages/premium-analyticssucceeds (widget bundles andjpa/sharesappears in the generated widget registry).