Files
worldmonitor/pro-test
Elie Habib 64edfffdfc fix(checkout): implement checkout.redirect_requested — the Dodo handler we were missing (#3346)
* fix(checkout): implement checkout.redirect_requested — the Dodo handler we were missing (revert #3298)

Buyers got stuck on /pro after successful Dodo payment because NEITHER
pro-test nor dashboard checkout services handled `checkout.redirect_requested`
— the event Dodo's SDK fires under `manualRedirect: true` carrying the
URL the MERCHANT must navigate to. We were only listening for
`checkout.status`, so navigation never happened for Safari users (saw
the orphaned about:blank tab).

PR #3298 chased the wrong theory (flipped /pro to `manualRedirect: false`,
hoping the SDK would auto-navigate). Dodo docs explicitly say that mode
disables BOTH `checkout.status` AND `checkout.redirect_requested`
("only when manualRedirect is enabled"), and the SDK's internal redirect
is where Safari breaks.

Fix:
- Revert /pro to `manualRedirect: true`
- Add `checkout.redirect_requested` handler in BOTH /pro and dashboard:
  `window.location.href = event.data.message.redirect_to`
- Align `status` read to docs-documented `event.data.message.status` only
  (drop legacy top-level `.status` guess)
- `checkout.link_expired` logged to Sentry (follow-up if volume warrants UX)
- Rebuilt public/pro/ bundle on Node 22 (new hash: index-CiMZEtgt.js)

Docs: https://docs.dodopayments.com/developer-resources/overlay-checkout

## Test plan

- [ ] Vercel preview: complete Dodo test-mode checkout on /pro with 4242
      card. Verify console shows `[checkout] dodo event checkout.status
      {status: "succeeded"}` followed by `checkout.redirect_requested`,
      and the tab navigates to worldmonitor.app/?wm_checkout=success&...
      WITHOUT an about:blank second tab.
- [ ] Vercel preview: same flow with a 3DS-required test card.
- [ ] Vercel preview: dashboard in-app upgrade click → overlay → success
      → same-origin navigation lands on worldmonitor.app with Dodo's
      appended ?payment_id=...&status=succeeded&...
- [ ] Post-deploy: Sentry breadcrumbs show full event sequence on every
      success; no new "stuck after paying" user reports in 24h.

## Rollback

Single `git revert` + bundle rebuild. Fallback state is PR #3298's
broken-for-Safari `manualRedirect: false`.

* chore(ci): retrigger Vercel preview build — initial push skipped via ignore-step
2026-04-23 20:15:46 +04:00
..

GHBanner

Run and deploy your AI Studio app

This contains everything you need to run your app locally.

View your app in AI Studio: https://ai.studio/apps/ef577c64-7776-42d3-bb38-3f0a627564c3

Run Locally

Prerequisites: Node.js

  1. Install dependencies: npm install
  2. Set the GEMINI_API_KEY in .env.local to your Gemini API key
  3. Run the app: npm run dev