Skip to content

PA - VideoPress: let the package own the Top videos widget - #52909

Merged
retrofox merged 41 commits into
trunkfrom
update/pa-extensibility-videopress-top-videos
Oct 2, 2026
Merged

retrofox merged 41 commits into
trunkfrom
update/pa-extensibility-videopress-top-videos

Conversation

@retrofox

@retrofox retrofox commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes WOOA7S-2223

Proposed changes

Step 4 of the VideoPress consumer stack (WOOA7S-2221), after #52885.

The Top videos widget of the Traffic section leaves Premium Analytics and becomes a widget of packages/videopress, the way the Ads widgets became widgets of packages/ads in #52635.

The package that knows what a VideoPress video is now owns the widget that lists them.

The widget

packages/videopress/widgets/top-videos/ is the former widgets/videopress/ of Premium Analytics, built here by wp-build as jetpack-videopress/widgets/top-videos/render and …/widget.

It imports everything from @automattic/jetpack-premium-analytics-sdk, which #52885 made possible, and nothing from the dashboard's internal packages.

It renders the SDK's Leaderboard (#52965), so it carries no chart wiring and no layout CSS of its own.

The type is videopress/top-videos, with jpa/videopress declared as its former name, so a persisted layout that still says jpa/videopress renders the new type (#52874).

The registrant

Analytics_Dashboard in packages/videopress/src/ has the shape of its Ads namesake.

init() hooks two things: the widget registration on jetpack_premium_analytics_register_widget_types at 20, and a seed on jetpack_premium_analytics_dashboard_default_layout at 10 that appends the Traffic instance where the dashboard used to seed it, uuid and order included.

The registration waits for a widget contract between 1.2.0 and 2; the seed does not wait, because the dashboard's own policy drops an instance whose type never registers (#52866).

Initializer::active_initialization() calls init(), so the widget follows Status::is_active(): the VideoPress module of the Jetpack plugin, or the standalone plugin.

On the WordPress.com platform, init() returns early, and jetpack-mu-wpcom calls the registrants for the videopress plan feature on Simple and Atomic, from the copy that the Jetpack plugin bundles.

The package adds no hook of its own. The tests feed a fixture manifest through the dashboard's jetpack_premium_analytics_registrable_widget_types filter, with or without a local build.

The SDK gains the CSV download

#52969 gave Top videos a "Download CSV" footer action while this branch was in review. The moved widget keeps it through one new SDK export, ExporterCsvDownloadButton. The button now also takes the linked report by id, report="videos", so the consumer never holds the dashboard's exporter; the dashboard's own widgets keep passing exporter. WIDGET_API_VERSION moves to 1.3.0 and the registrant waits for it.

The CSV parity suite of Premium Analytics loses its Videos case: the widget is not in the package to compare. The VideoPress render suite covers the footer action instead.

What Premium Analytics loses

The widget folder, the Traffic seed, the jpa/videopress entry of VIDEOPRESS_WIDGET_TYPES, the two toolkit helpers, and the two test-group imports. videopress-availability.php stays: the Videos report and the detail route still gate on it.

Tests

The widget's pure tests move with it, as widgets/top-videos/test/.

Its render suite is rewritten for the consumer side.

The old one drove the widget through the dashboard's internal packages (the data query client, the report mocks), which consumers can't import.

The new one replaces the SDK module and checks what the widget owns: the rows, the request status, the error copy, and the footer link.

The story does not move, for the same reason. A harness that renders the real SDK for consumers is part of the SDK audit (WOOA7S-2228).

Premium Analytics gains a direct suite for useStatsVideoPlays: the widget suite that exercised the hook left the package.

The registrants have PHP tests in both packages.

Dependencies

packages/videopress requires nothing new at runtime: the registration action only fires when the dashboard is loaded.

Premium Analytics is a require-dev and a test-only dependency, for tests and phan; jetpack-mu-wpcom lists VideoPress the same way. The plugin locks record that.

Related product discussion/links

Linear: WOOA7S-2221 for the stack, WOOA7S-2223 for this step. Umbrella #52867.

Does this pull request change what data or activity we track or use?

No.

Testing instructions

jetpack build packages/videopress
jetpack build packages/premium-analytics

On a Jetpack site with the VideoPress module active and the dashboard enabled:

  1. GET /wp-json/wpcom/v2/widget-modules lists videopress/top-videos with `"former_names":
Screenshot 2026-10-01 at 10 08 15 AM

This allows crossing without losing a widget instance with a name that no longer exists.

["jpa/videopress"] and a render_module under jetpack-videopress/, and no longer lists jpa/videopress.

  1. The Traffic section, on its default layout, shows Top videos after Clicks, as before.
Screenshot 2026-10-01 at 10 15 50 AM
  1. A persisted Traffic layout that still holds a jpa/videopress instance renders it as Top videos; it is not a "no longer available" tile.

You need to customize the dashboard beforehand to test this PR and have an old instance of the VideoPress widget there. You can inspect the persistent data in the Application tab of your browser.

Screenshot 2026-10-01 at 10 17 47 AM
  1. Deactivate the VideoPress module: Top videos leaves the default layout and the widget picker.
Screen.Recording.2026-10-01.at.10.20.30.AM.mov

On the PHP side:

jetpack test php packages/videopress
jetpack test php packages/premium-analytics
jetpack test php packages/jetpack-mu-wpcom
jetpack test js packages/videopress

the default-layout policy asks the widget registry once it can answer
phan cannot see past the finally
…ity-videopress-layout-validation

# Conflicts:
#	projects/packages/premium-analytics/docs/dashboard-widgets.md
a renamed type keeps the layouts saved under its old name; contract 1.1.0
a Widget_Type object as type dropped the whole sections route on PHP 8
…ity-videopress-former-names

# Conflicts:
#	projects/packages/premium-analytics/docs/dashboard-sections.md
#	projects/packages/premium-analytics/src/dashboard-layout.php
#	projects/packages/premium-analytics/tests/php/Dashboard_Layout_Test.php
build the broken instances by hand for phan; cover the non-instance branch and the sanitizer
the video plays hook too, provisional; widget contract 1.2.0; the facade must be fully declared
type videopress/top-videos, former jpa/videopress; the Traffic seed moves too
jetpack-mu-wpcom calls the VideoPress registrants on Simple and Atomic
@retrofox retrofox added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress labels Sep 29, 2026
@retrofox retrofox self-assigned this Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the update/pa-extensibility-videopress-top-videos branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/pa-extensibility-videopress-top-videos
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/pa-extensibility-videopress-top-videos

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [mu wpcom Feature] Premium Analytics [Package] Jetpack mu wpcom WordPress.com Features [Package] Premium Analytics [Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Premium Analytics [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Plugin] Wpcomsh [Tests] Includes Tests Docs labels Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

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:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Videopress 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.


Mu Wpcom plugin:

  • Next scheduled release: WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

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.

a keyed list reached the client as an object; the client renames stored layouts only
…pdate/pa-extensibility-videopress-sdk-exports
with describeError and the row limit; the video plays hook stays provisional
…date/pa-extensibility-videopress-top-videos

# Conflicts:
#	projects/js-packages/premium-analytics-sdk/changelog/update-pa-extensibility-videopress-sdk-exports
#	projects/js-packages/premium-analytics-sdk/src/index.d.ts
#	projects/packages/premium-analytics/changelog/update-pa-extensibility-videopress-sdk-exports
#	projects/packages/premium-analytics/docs/dashboard-widgets.md
#	projects/packages/premium-analytics/packages/sdk/src/index.ts
#	projects/packages/premium-analytics/packages/widgets-toolkit/src/components/leaderboard/leaderboard.module.scss
#	projects/packages/premium-analytics/widgets/videopress/__tests__/videopress.test.tsx
#	projects/packages/premium-analytics/widgets/videopress/style.module.css
#	projects/packages/videopress/widgets/top-videos/render.tsx
#	projects/packages/videopress/widgets/top-videos/style.module.css
they moved to the VideoPress package with the widget
covers the rows, the status, the error copy and the footer link
the widget suite that exercised it left the package
the Leaderboard caps its rows; a consumer sizes its own request
the SDK no longer exposes the dashboard's row limit
Base automatically changed from update/pa-extensibility-videopress-sdk-exports to trunk October 1, 2026 07:05
@retrofox
retrofox marked this pull request as ready for review October 1, 2026 09:22
@retrofox
retrofox requested review from a team as code owners October 1, 2026 09:22
@retrofox retrofox added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Oct 1, 2026

@louwie17 louwie17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @retrofox, this tested well on a local Docker site and the move itself looks good! Saved layouts that still hold jpa/videopress keep rendering as Top videos, and it leaves the default layout and the picker when VideoPress is off.

I did leave two inline comments, the main one is around the new jetpack_videopress_analytics_dashboard_widget_manifest filter, which I don't think we should introduce just for the tests. The other is a small nit around a docblock, which can be a quick fix before merging.

Let me know what you think.

Comment thread projects/packages/videopress/src/class-analytics-dashboard.php Outdated
Comment thread projects/packages/premium-analytics/src/widget-type-support.php
drops the package's own hook; the availability docblock stops naming the widget
louwie17
louwie17 previously approved these changes Oct 1, 2026

@louwie17 louwie17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the feedback @retrofox, dropping the filter and feeding the fixture through the existing one is much cleaner, and thanks for updating the docblock as well. I re-tested this on a local Docker site and it all still works well, code looks good!

One note, the WordPress.com Tests check timed out on the latest commit, so that probably needs a re-run before merging.

LGTM 🚀

the button takes the linked report by id, contract 1.3.0; the parity test drops the moved widget
@retrofox
retrofox merged commit ba3b32a into trunk Oct 2, 2026
229 of 231 checks passed
@retrofox
retrofox deleted the update/pa-extensibility-videopress-top-videos branch October 2, 2026 09:23
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Review This PR is ready for review. labels Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs Enhancement Changes to an existing feature — removing, adding, or changing parts of it [JS Package] Premium Analytics Sdk [mu wpcom Feature] Premium Analytics [mu wpcom Feature] Wpcom Admin Menu [mu wpcom Feature] Wpcom Videopress [Package] Jetpack mu wpcom WordPress.com Features [Package] Premium Analytics [Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Premium Analytics [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Plugin] Wpcomsh RNA [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants