Premium Analytics: update widget packages and promote in-body controls to widget attributes - #50271
Conversation
routes and widgets metadata now declare stable 0.2.0 instead of next snapshots
fg->foreground, bg->background; replace removed base and invalid names
lint token list must match the renamed design token groups
temporary wiring until a new next snapshot is published
geoGranularity field (relevance high) replaces the inline SelectControl
WidgetAttributeField casts, exported attribute types, single typed param tags
platformDimension field (relevance high) replaces the inline SelectControl
the content class was removed from the css with the inline select
single typed tag with field docs on the type; widget-audit rule extended
There's now an indirect dep, sigh.
admin-ui 2.5.0, dataviews 17.1.0, icons ^15, theme/ui 0.17.0 from the bundled renovate group
…mension attribute The UTM dimension is now a widget attribute with elements and relevance: 'high', so the widget host renders the control (same pattern as Locations and Top Platforms). Drops the in-body SelectControl, local state, and setAttributes wiring; renames the attribute from utmParam to utmDimension (the data-layer useStatsUtm arg keeps its endpoint-oriented name). Co-authored-by: Cursor <cursoragent@cursor.com>
The widget root already provides the column flex layout and, via its container-type, acts as containing block for the absolutely positioned loading overlay — same layout approach as Top Platforms. The chart takes the remaining space through a .leaderboard class instead. Co-authored-by: Cursor <cursoragent@cursor.com>
… metric attribute The open/click rate switch is now a `metric` widget attribute with elements and relevance: 'high', so the widget host renders the control (same pattern as Locations, Top Platforms, and UTM Insights). This makes the whole custom header workaround unnecessary: the widget moves from full-bleed back to framed presentation, dropping the hand-rolled title row, the in-body SelectControl with its local state, and the header/select CSS. Co-authored-by: Cursor <cursoragent@cursor.com>
…nce granularity attribute The bucket-size switch is now a `granularity` widget attribute with elements and relevance: 'high', so the widget host renders the control (same pattern as the other converted widgets). An `auto` option replaces the previous local-state null: it keeps following the dashboard range until the user picks an explicit granularity, which then persists per widget instance. Drops the SelectControl in the MetricTabsChart controls slot and its local state. Co-authored-by: Cursor <cursoragent@cursor.com>
…granularity attribute The bucket-size switch is now a `granularity` widget attribute with elements and relevance: 'high', so the widget host renders the control (same pattern as subscribers-chart). An `auto` option replaces the previous local-state null override. Drops the SelectControl in the MetricTabsChart controls slot. Co-authored-by: Cursor <cursoragent@cursor.com>
…h-relevance attributes Replace attribute type 'string' with 'text' in locations, top-platforms, utm-insights, and emails so the WidgetAttributeField cast matches FieldTypeName. Co-authored-by: Cursor <cursoragent@cursor.com>
…dget.json Add the missing presentation field to 29 WooCommerce and commerce widget manifests so the widget host renders the standard card chrome. Co-authored-by: Cursor <cursoragent@cursor.com>
…e imports Remove unused @wordpress/components, @wordpress/ui, date-fns, and react entries left over from refactors; add missing @wordpress/element where hooks import it. Scans each widget's non-story source files, not stories. Co-authored-by: Cursor <cursoragent@cursor.com>
Align with the widget contract so injected attributes reach WidgetRoot, matching the other Stats widgets even though this widget does not use reportParams. Co-authored-by: Cursor <cursoragent@cursor.com>
…ributes Fixes the WidgetRoot attributes pass for TypeScript: host attributes may include reportParams even though this widget ignores the date range. Co-authored-by: Cursor <cursoragent@cursor.com>
wp-build 0.19.1-next, widget-* 0.3.1-next replace the local gutenberg links
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
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 🤖 🔴 Action required: Please include detailed testing steps, explaining how to test your change, like so: 🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so: Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
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. 🤷 |
PA uses theme 0.17 token names ahead of the repo; the rename ships with the bundled renovate group
…tics-widget-packages
restore brace-expansion for minimatch; changelog now describes -next pins
remove dropped onGridSettingsChange, exempt icons from token lint, fix comma
Host owns identity; drop custom in-widget title, keep year stepper as body chrome.
Stylelint disables rules with null, not false; the invalid false value aborted the pre-commit linter on any CSS commit.
…tics-widget-packages
…ve-trunk # Conflicts: # pnpm-lock.yaml # projects/packages/premium-analytics/package.json # projects/packages/premium-analytics/packages/widgets-toolkit/src/components/chart-empty-state/stories/chart-empty-state.stories.tsx # projects/packages/premium-analytics/widgets/all-time-stats/package.json # projects/packages/premium-analytics/widgets/annual-highlights/package.json # projects/packages/premium-analytics/widgets/authors/package.json # projects/packages/premium-analytics/widgets/average-items-per-order/package.json # projects/packages/premium-analytics/widgets/average-order-value/package.json # projects/packages/premium-analytics/widgets/bookings-by-device/package.json # projects/packages/premium-analytics/widgets/bookings-by-status/package.json # projects/packages/premium-analytics/widgets/bookings-over-time/package.json # projects/packages/premium-analytics/widgets/bookings-revenue-by-customer-type/package.json # projects/packages/premium-analytics/widgets/clicks/package.json # projects/packages/premium-analytics/widgets/conversion-rate/package.json # projects/packages/premium-analytics/widgets/coupon-usage-over-time/package.json # projects/packages/premium-analytics/widgets/devices/package.json # projects/packages/premium-analytics/widgets/emails/package.json # projects/packages/premium-analytics/widgets/file-downloads/package.json # projects/packages/premium-analytics/widgets/gross-sales-over-time/package.json # projects/packages/premium-analytics/widgets/hello-world/package.json # projects/packages/premium-analytics/widgets/latest-post/package.json # projects/packages/premium-analytics/widgets/locations/package.json # projects/packages/premium-analytics/widgets/most-popular-day/package.json # projects/packages/premium-analytics/widgets/most-popular-time/package.json # projects/packages/premium-analytics/widgets/net-sales-over-time/package.json # projects/packages/premium-analytics/widgets/new-vs-returning-customer/package.json # projects/packages/premium-analytics/widgets/orders-fulfillment/package.json # projects/packages/premium-analytics/widgets/orders-over-time/package.json # projects/packages/premium-analytics/widgets/payment-status/package.json # projects/packages/premium-analytics/widgets/posting-activity/package.json # projects/packages/premium-analytics/widgets/react-query-dev-tool/package.json # projects/packages/premium-analytics/widgets/revenue-by-customer-type/package.json # projects/packages/premium-analytics/widgets/sales-by-coupon-usage/package.json # projects/packages/premium-analytics/widgets/sales-by-coupon/package.json # projects/packages/premium-analytics/widgets/sales-by-device/package.json # projects/packages/premium-analytics/widgets/sales-by-utm-campaign/package.json # projects/packages/premium-analytics/widgets/sales-by-utm-channel/package.json # projects/packages/premium-analytics/widgets/sales-by-utm-source/package.json # projects/packages/premium-analytics/widgets/search-terms/package.json # projects/packages/premium-analytics/widgets/sessions-by-device/package.json # projects/packages/premium-analytics/widgets/store-conversion-rate-bookings/package.json # projects/packages/premium-analytics/widgets/subscribers-chart/package.json # projects/packages/premium-analytics/widgets/subscribers-list/package.json # projects/packages/premium-analytics/widgets/top-performing-bookings/package.json # projects/packages/premium-analytics/widgets/top-performing-products/package.json # projects/packages/premium-analytics/widgets/top-platforms/package.json # projects/packages/premium-analytics/widgets/top-posts/package.json # projects/packages/premium-analytics/widgets/total-returns/package.json # projects/packages/premium-analytics/widgets/total-sales-over-time/package.json # projects/packages/premium-analytics/widgets/traffic-chart/package.json # projects/packages/premium-analytics/widgets/utm-insights/package.json # projects/packages/premium-analytics/widgets/videos/package.json # projects/packages/premium-analytics/widgets/visitors-by-location/package.json # projects/packages/premium-analytics/widgets/visitors-over-time/package.json
trunk theme 0.17 validates PA tokens; fix store-performance fg->foreground (matches #50277)
…tics-widget-packages
…tics-widget-packages
Thanks, Chi |
Closes WOOA7S-1667
What
Updates Premium Analytics to the current
@wordpress/widget-primitives/@wordpress/widget-dashboard/@wordpress/builddevelopment snapshots and migrates the widgets to the attribute model those versions introduce:In-body selectors are replaced with high-relevance widget attributes rendered by the widget host
geoGranularity)platformDimension)utmDimension)metric)granularity).Commerce widgets declare
presentation: framedinwidget.json.Widget attribute shapes are typed and exported once from
widget.tsRender components compose host fields (
ReportParamsFieldAttributes) instead of re-declaring them, and the widget-audit rule covers the new conventions.Package pins
widget-primitives/widget-dashboard0.3.1-next.v.202607070741.0andbuild0.19.1-next.v.202607070741.0in the package root; unit manifests (routes and widgets) keep declaring the0.2.0stable floor.Bundled deps needed by the new stack
Scoped to this package:
admin-ui2.5.0,dataviews17.1.0,icons^15,theme/ui0.17.0, plus the design-token migration to the renamed@wordpress/theme0.17 groups (fg→foreground,bg→background). PA's tokens are ahead of the repo-wide token list, so a scoped override in the shared stylelint base config exemptsprojects/packages/premium-analytics/**from theplugin-wpds/no-unknown-ds-tokensrule;tools/js-toolskeeps its@wordpress/themeon the repo's stable0.15.1, so every other project lints unchanged.Carries the
@wordpress/dataviews/wppnpmfile rework from the renovate group branch, whichdataviews17 requires.Why
The widget features this migration relies on (high-relevance attributes with DataViews-compatible types, framed presentation, render-attribute composition) exist today only in Gutenberg trunk.
They are published as development snapshots (
-next.v.<timestamp>), so the team can build on them now instead of waiting for the next stable release cycle.The versioning strategy is deliberate:
Now:
Pin the published snapshots, exact versions, scoped to
premium-analyticsonly.Installs are reproducible from npm for every developer and CI.
While on snapshots
Newer trunk features are adopted by publishing a fresh development release and bumping the three pins together (same timestamp, so their transitive
-nextdependencies resolve to a single tree).Exit: automatic.
Once stable releases ship with these changes (
widget-*≥ 0.3.1,build≥ 0.19.1), the Bundled @wordpress/* monorepo renovate group proposes them, since a stable release always supersedes a prerelease pin.Renovate never downgrades the pins to older stables and never moves other projects onto the snapshots.
Other consumers of
@wordpress/build(backup, forms, jetpack-mu-wpcom, newsletter, podcast, publicize, scan, seo, videopress, wp-build-polyfills) are unaffected: each project pins its own version and keeps building with it.How
Every in-body
SelectControlreplaced by an attribute is declared inwidget.tswithrelevance: 'high'and a DataViews-compatibletexttype, so the host renders the control and persists the value.render.tsxcomponents defaultattributesand pass them through<WidgetRoot>, composing the widget's own attribute type withPartial<ReportParamsFieldAttributes>.The dependency bumps mirror the pending Bundled @wordpress/* monorepo renovate group, applied only within
premium-analyticsso this package can move ahead of the repo-wide update.Mid-branch commits temporarily linked a local Gutenberg checkout; the final commit replaces those links with the published snapshots and regenerates the lockfile, so the diff only ever ships registry versions.
Testing
Open the Premium Analytics dashboard in wp-admin and confirm it loads without console or PHP errors.
Locations, Top platforms, UTM Insights, Emails, Subscribers chart, and Traffic chart: the old in-body selectors are gone; the equivalent controls now appear as widget attributes on the widget host, and switching them updates the widget data.
Screen.Recording.2026-07-07.at.10.50.00.AM.mov
Date range and comparison state still reach the widgets (Subscribers list reflects the picker).
Storybook — the widget stories render with the dashboard controls:
cd projects/js-packages/storybookVerifying that each project keeps its own package versions
The snapshot pins are scoped to
premium-analytics; every other consumer of@wordpress/buildkeeps building with its own pinned version. Three checks, from declared to executed.Declared — what each project pins in git:
Installed — the copy pnpm materialized in each project's
node_modules:node -p "require('./projects/packages/forms/node_modules/@wordpress/build/package.json').version"node -p "require('./projects/packages/premium-analytics/node_modules/@wordpress/build/package.json').version"node -p "require('./projects/packages/premium-analytics/node_modules/@wordpress/widget-primitives/package.json').version"The
+a51d59513build metadata identifies the Gutenberg trunk commit the snapshots were published from — the three pinned packages come from the same commit.Executed —
pnpm execresolves the binary from the current project'snode_modules, so each build runs its own pinned copy:The lockfile is validated with a frozen install in CI, so these resolutions cannot drift silently.
Follow-ups
widget-primitives/widget-dashboard/buildto stable pins via the Bundled @wordpress/* monorepo renovate PR once stables ship with these changes.no-unknown-ds-tokensexemption forpremium-analytics(and bumptools/js-toolsback to@wordpress/theme0.17) once the repo-wide token renames land, so PA's tokens are validated again.