Files
worldmonitor/api/_product-fallback-prices.js
Elie Habib 5bff9a17b0 feat(catalog): live Dodo prices with Redis cache + static fallback (#2653)
* feat(catalog): fetch prices from Dodo API with Redis cache, static fallback

/pro page fetches live prices from /api/product-catalog. Endpoint
hits Dodo Products API, caches in Redis (1h TTL). PricingSection
shows static fallback while fetching, then swaps to live prices.
DELETE with RELAY_SHARED_SECRET purges cache.

* fix(catalog): parallel Dodo fetches + fallback prices for partial failures

P1: If one Dodo product fetch fails, the tier now uses a fallback price
from FALLBACK_PRICES instead of rendering $undefined.

P2: Replaced serial for-loop with Promise.allSettled so all 6 Dodo
fetches run in parallel (5s max instead of 30s worst case).

* fix(catalog): generate fallback prices from catalog, add freshness test

FALLBACK_PRICES in the edge endpoint is now auto-generated by
generate-product-config.mjs (api/_product-fallback-prices.js) instead
of hardcoded. Freshness test verifies all self-serve products have
fallback entries. No more manual price duplication.

* fix(catalog): add cachedUntil to response matching jsdoc contract
2026-04-03 23:25:08 +04:00

12 lines
492 B
JavaScript

// AUTO-GENERATED from convex/config/productCatalog.ts
// Do not edit manually. Run: npx tsx scripts/generate-product-config.mjs
// @ts-check
/** Fallback prices (cents) when Dodo API is unreachable for individual products. */
export const FALLBACK_PRICES = {
'pdt_0Nbtt71uObulf7fGXhQup': 3999, // Pro Monthly
'pdt_0NbttMIfjLWC10jHQWYgJ': 39999, // Pro Annual
'pdt_0NbttVmG1SERrxhygbbUq': 5999, // API Starter Monthly
'pdt_0Nbu2lawHYE3dv2THgSEV': 49000, // API Starter Annual
};