[PM-39387] fix: Auto-sync premium status after returning from Stripe checkout#21518
Conversation
…checkout The one-time PremiumStatusChanged push is missed while the client is in the background during an external Stripe checkout, so premium status does not reflect after the user completes payment. Track a memory-scoped, account-scoped pending flag when checkout launches and consume it to trigger a full sync when the client regains focus (desktop windowIsFocused) or reinitializes (browser popup), recovering the missed push.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the new Code Review DetailsNo blocking findings. Notable strengths verified during review:
|
…remium-status-after-completing-stripe-checkouts
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #21518 +/- ##
==========================================
+ Coverage 49.32% 49.53% +0.20%
==========================================
Files 4096 4099 +3
Lines 128872 128928 +56
Branches 19780 19786 +6
==========================================
+ Hits 63564 63861 +297
+ Misses 60597 60350 -247
- Partials 4711 4717 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…pgrade dialog story
…remium-status-after-completing-stripe-checkouts
…remium-status-after-completing-stripe-checkouts
|



🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-39387
📔 Objective
Premium status was not reflected in the client after a user completed payment in an external Stripe checkout flow. The server sends a one-time
PremiumStatusChangedpush, but the client misses it while it is in the background during checkout — so the user's premium entitlements don't appear until a later full sync.This PR recovers the missed push by syncing when the client returns from checkout:
PremiumCheckoutPendingService(abstraction +DefaultPremiumCheckoutPendingService) backed by a memory-scoped, account-scoped state flag (clearOn: ["logout"]).PremiumUpgradeDialogComponentmarks checkout as pending when it launches the external Stripe checkout URI.windowIsFocusedand browser popup consumes it on init, triggeringfullSync(true)to pull the updated premium status.jslib-services.module.ts(Angular clients) andservice-container.ts(CLI).