Premium Analytics: port the Average order value widget#49578
Conversation
|
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! |
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. 🤷 |
5bb6dd9 to
7ff7f71
Compare
911c952 to
06031fb
Compare
7ff7f71 to
22e10a7
Compare
a98ad6b to
5b0fb75
Compare
d1eb44f to
ef63280
Compare
Port the Average order value widget from next-woocommerce-analytics (woocommerce/woocommerce-analytics@develop) into the Premium Analytics customizable dashboard (WOOA7S-1461). Same composition shape as the average-items-per-order port: report data via @jetpack-premium-analytics/data (useReportOrders), rendering via the widgets-toolkit (WidgetRoot + OrderMetricWidget, average_order_value metric), and the Range editor via the fields package's ReportParamsField as an externalized script module. Adds the icons and widgets-toolkit link: entries and the widgets/** lint relaxations this widget needs.
ef63280 to
ac1f2ed
Compare
|
Rebased on Changed
Verification
Screen.Recording.2026-07-02.at.5.32.45.PM.mov |
Fixes: WOOA7S-1461
Proposed changes
jpa/average-order-valuewidget and renders the shared order metric widget insideWidgetRootusing dashboard-level report params.WidgetRootso order-report failures can surface through the dashboard error UI.DefaultandWithComparisonStorybook stories plus a dashboard-hostedWidgetDashboardWithWidgetstory for the widget.Finishing changes (conform to the widget contract)
comparative-line-chartwrapper to importLineChartfrom the public@automattic/chartsexport (the export exists on trunk), so the shared toolkit file is now unchanged vs trunk and this widget is fully independent.render.tsxnow types props withWidgetRenderProps<T>from@wordpress/widget-primitives, composing the widget's own attribute type withPartial<ReportParamsFieldAttributes>, and defaultsattributes = {}.widget.tsdeclares the empty attribute shape asRecord<never, never>.package.json: dropped the unused@wordpress/ui, added@wordpress/widget-primitives.js-packages/storybookchangelog entry (that project has no code changes; the changelog check passes without it).Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
pnpm --filter @automattic/jetpack-premium-analytics typecheckpnpm --filter @automattic/jetpack-premium-analytics buildprojects/js-packages/storybook, run Storybook (pnpm exec storybook dev -c ./storybook) and open the Packages / Premium Analytics / Widgets / AverageOrderValue stories.Defaultshows the metric value,WithComparisonshows the value plus the comparative line chart, andWidgetDashboardWithWidgetrenders the widget in the host dashboard card.