Skip to content

PA - VideoPress: expose the Leaderboard component through the SDK - #52885

Merged
retrofox merged 4 commits into
trunkfrom
update/pa-extensibility-videopress-sdk-exports
Oct 1, 2026
Merged

retrofox merged 4 commits into
trunkfrom
update/pa-extensibility-videopress-sdk-exports

Conversation

@retrofox

@retrofox retrofox commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes WOOA7S-2222

Proposed changes

Step 3 of the VideoPress consumer stack (WOOA7S-2221), after #52874 and #52965.

@automattic/jetpack-premium-analytics-sdk exports what the three Ads widgets import and nothing else.

The Top videos widget cannot leave the package until the SDK carries what it renders with. After #52965 that is one component, not a construction kit.

What the SDK gains

Leaderboard, with its types LeaderboardProps, LeaderboardRowInput, LeaderboardStatus and LeaderboardDrillDown: ranked rows and a request status in; the chart with its states, comparison and drill-down out.

describeError(), the dashboard's mapping from a failed request to the widget's error state: no Retry on an access-denied failure, Retry otherwise.

useStatsVideoPlays, provisional like the WordAds hooks: the Videos report reads it too and stays in the package until reports are registrable. It leaves the SDK when VideoPress owns its data (WOOA7S-2234).

The packages/sdk facade re-exports them, and src/index.d.ts of the js-package declares them, loosely typed like the rest of the contract for now.

getVideoKey() and getVideoLabel() stay out: nothing but the widget uses them, so they move with it in step 4.

WIDGET_ROW_LIMIT stays out too. Leaderboard caps the rows it shows, and a consumer sizes its own request.

The contract

WIDGET_API_VERSION moves to 1.2.0: a consumer can rely on something new; nothing built against 1.x breaks. The docs now list what each minor added.

The conformance check

packages/sdk/src/conformance.ts already failed the typecheck when the facade missed a declared value.

It now fails the other way too: when the facade exports a value the declaration file doesn't include, since a consumer can't import it.

Related product discussion/links

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

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

No.

Testing instructions

jetpack build packages/premium-analytics
pnpm --filter @automattic/jetpack-premium-analytics run typecheck
pnpm --filter @automattic/jetpack-premium-analytics-sdk run typecheck

On a connected site with the dashboard built, GET /wp-json/wpcom/v2/widget-modules still lists the Ads widgets, and the Ads section renders as before: the facade only gained exports.

In the browser console on the dashboard page...

import( '@automattic/jetpack-premium-analytics-sdk' ).then( m => console.log( Object.keys( m ) ) )

...lists Leaderboard, describeError and useStatsVideoPlays next to the existing names.

image

To see the conformance check work, remove Leaderboard from src/index.d.ts of the js-package and run the package typecheck: it fails on isDeclared naming the missing export. Restore it.

@retrofox retrofox added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress labels Sep 28, 2026
@retrofox retrofox self-assigned this Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 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), and enable the update/pa-extensibility-videopress-sdk-exports branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/pa-extensibility-videopress-sdk-exports

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

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!

@jp-launch-control

jp-launch-control Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/premium-analytics/packages/sdk/src/conformance.ts 0/2 (0.00%) 0.00% 1 ❤️‍🩹

Full summary · PHP report · JS report

@retrofox
retrofox added this pull request to stack #52919 September 29, 2026 11:06
Base automatically changed from update/pa-extensibility-videopress-former-names to trunk September 30, 2026 06:35
@retrofox
retrofox force-pushed the update/pa-extensibility-videopress-sdk-exports branch from 8c74142 to 700bbec Compare September 30, 2026 06:37
the video plays hook too, provisional; widget contract 1.2.0; the facade must be fully declared
with describeError and the row limit; the video plays hook stays provisional
@retrofox retrofox changed the title PA - VideoPress: expose the leaderboard primitives through the SDK PA - VideoPress: expose the Leaderboard component through the SDK Sep 30, 2026
@retrofox retrofox added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Sep 30, 2026
@retrofox
retrofox marked this pull request as ready for review September 30, 2026 16:11
@retrofox
retrofox requested a review from a team as a code owner September 30, 2026 16:11
the Leaderboard caps its rows; a consumer sizes its own request

@Nikschavan Nikschavan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you, the changes look good.

@retrofox
retrofox merged commit 5e2a2b5 into trunk Oct 1, 2026
86 checks passed
@retrofox
retrofox deleted the update/pa-extensibility-videopress-sdk-exports branch October 1, 2026 07:05
@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants