Premium Analytics: add CSV downloads to full reports - #50547
Conversation
# Conflicts: # projects/packages/premium-analytics/widgets/orders-over-time/render.tsx
|
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. 🤷 |
ae39893 to
1218ba2
Compare
1218ba2 to
1e6c24d
Compare
There was a problem hiding this comment.
Pull request overview
Adds CSV download support to the Premium Analytics full “Posts & Pages” report page, reusing the existing CSV export feature gate and the shared row-serialization download action.
Changes:
- Adds a solid “Download” page-header action that exports the currently loaded rows (Posts & Pages or Archives tab) as CSV with Title/Views/URL columns.
- Extends the posts report records hook to expose
isFetching/isErrorso the page can hide exports during refetch/error states. - Adds route-level tests for the page action and a changelog entry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| projects/packages/premium-analytics/routes/reports/posts/page.tsx | Builds CSV columns/rows from active tab records and renders a header Download action gated by feature flag + query state. |
| projects/packages/premium-analytics/routes/reports/posts/page.test.tsx | New tests asserting the header action renders and is gated appropriately. |
| projects/packages/premium-analytics/routes/reports/posts/config/use-report-records.ts | Exposes isFetching and isError for both tabs’ records to support export gating. |
| projects/packages/premium-analytics/changelog/add-report-page-csv-downloads | Adds a user-facing changelog entry for the new report-page CSV downloads. |
1e6c24d to
e5d58d1
Compare
…downloads # Conflicts: # projects/packages/premium-analytics/packages/widgets-toolkit/src/components/download-csv/__tests__/csv-download-button.test.tsx # projects/packages/premium-analytics/packages/widgets-toolkit/src/components/download-csv/csv-download-button.module.scss # projects/packages/premium-analytics/packages/widgets-toolkit/src/components/download-csv/csv-download-button.tsx # projects/packages/premium-analytics/packages/widgets-toolkit/src/helpers/build-csv.ts
Proposed changes
Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
jp build packages/premium-analytics --deps.add_filter( 'jetpack_premium_analytics_csv_exports_enabled', '__return_true' );in a local test plugin.top-posts-<from>_<to>.csvfile containing Title, Views, and URL columns for every table row.archives-<from>_<to>.csvfile containing the active tab's rows.