Episodes stats: surface 402 from podcast stats endpoint as a Premium-required state#48703
Episodes stats: surface 402 from podcast stats endpoint as a Premium-required state#48703robertbpugh wants to merge 1 commit into
Conversation
…required state.
`useEpisodeStatsQuery` now returns `{ data, premiumRequired }`. A 402 response
from `/wpcom/v2/sites/<id>/podcast-stats/episode-totals` flips the flag,
clears `data`, and stops further chunk requests for that key. Other errors
propagate as before.
The Episodes-tab gate (PODS-145) hides the UI on a non-Premium snapshot, so
this 402 path is defense-in-depth for stale snapshots and grandfather races.
The visible upsell card lives in PODS-145.
Linear: PODS-146 (client half).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
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 🤖 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. 🤷 |
Fixes PODS-146 (client half).
Proposed changes
useEpisodeStatsQuerynow returns{ data, premiumRequired }. A 402 from the wpcom episode stats endpoint flipspremiumRequiredtotrue, clearsdata, and stops further chunk requests for that key. Other errors propagate as before.Related product discussion/links
premiumRequiredand render the shared upsell card).Scope note for the reviewer
PODS-145 hides the Episodes tab on a non-Premium snapshot, so the hook usually never fires. This 402 path is defense-in-depth for stale snapshots and grandfather races, and no UI consumer wires the flag in this PR. PODS-145 owns that.
Does this pull request change what data or activity we track or use?
No.
Testing instructions
podcasting-grandfatheredsticker, open the podcast episode dashboard./wpcom/v2/sites/<id>/podcast-stats/episode-totalsreturns 402 withcode: podcast_premium_required.