feat(web): show pricing in the visitor's local currency

RI
4h ago
+449-31

Summary

  • New worker route /currency.json returns the visitor's country (Cloudflare geo), the matching currency and daily ECB exchange rates (frankfurter.dev, cached 6h).
  • Pricing page prices are converted client-side: plan cards (incl. monthly/yearly toggle and enterprise MAU slider), yearly totals, compare-plans table, credit rates, EAS comparison table and the price calculator modal.
  • "Display prices in" picker at the bottom of the pricing page; manual choice is saved in localStorage, "Based on your location" resets it.
  • When converted, a note under the plans says prices are estimates and billing is in USD.
  • Server-rendered HTML and JSON-LD stay in USD (SEO unchanged). Premium Support stays in EUR since it's billed in EUR.
  • 30 currencies supported; unsupported countries or a failed lookup fall back to USD.

Test plan

  • Browser test with mocked /currency.json (FR → EUR): auto-detect, monthly/yearly toggle, switch to JPY, persistence after reload, USD, back to auto; calculator modal converts; no page errors
  • After deploy: verify /currency.json returns real country + rates and the page converts without mocks

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • New Features
    • Added localized currency selection on the pricing page, with automatic regional detection and manual switching.
    • Pricing, credits, plans, and calculator amounts update to reflect the selected currency.
    • Added currency labels and guidance explaining that converted prices are estimates and billing remains in USD.
    • Currency options without available exchange rates are unavailable for selection; prices remain in USD when rates cannot be loaded.
  • Improvements
    • Annual, monthly, Enterprise, and credit prices now display clearer values and formatting.
    • Updated English pricing messages and translation context for currency-related content.