mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
* fix(payments): add API Starter annual product, simplify /pro page
- Added API Starter Annual product ID (pdt_0Nbu2lawHYE3dv2THgSEV)
- API card now supports annual toggle matching Pro card
- Removed Enterprise and API Business from /pro page (not self-serve)
- Added api_starter_annual to entitlements and seedProductPlans
- Rebuilt /pro bundle
Requires npx convex deploy + seedProductPlans after merge.
* fix(pro): restore Enterprise card, fix API to 1,000 requests/day
Enterprise card back with "Contact Sales" mailto (no Dodo link, no
price). API Starter feature list corrected from 10,000 to 1,000
requests/day.
* refactor(payments): single source of truth product catalog
Canonical catalog in convex/config/productCatalog.ts owns all product
IDs, prices, features, and marketing copy. Build script generates
src/config/products.generated.ts and pro-test/src/generated/tiers.json.
To update prices: edit catalog, run generator, rebuild /pro, deploy Convex + seed.
* test(catalog): add bidirectional reverse assertions
- every currentForCheckout catalog entry must appear in products.generated.ts
- every publicVisible tier group must appear in tiers.json
* fix(payments): restore .unique() for productPlans lookup
Accidentally changed to .first() when adding legacy fallback. Duplicates
should fail loudly, not silently pick one row.
* fix(catalog): restore billing-distinct displayNames (Pro Monthly, API Starter Monthly)
displayName is used by seedProductPlans → billing UI. Collapsing to
marketing names ("Pro") lost the monthly/annual distinction. Tests
expect "Pro Monthly". Marketing /pro page unaffected (generator uses
tier group names).
28 lines
808 B
TypeScript
28 lines
808 B
TypeScript
/**
|
|
* Plan-to-features resolution.
|
|
*
|
|
* Features are defined in the canonical product catalog
|
|
* (convex/config/productCatalog.ts). This module re-exports the type
|
|
* and lookup function for backward compatibility.
|
|
*/
|
|
|
|
import {
|
|
type PlanFeatures,
|
|
getEntitlementFeatures,
|
|
PRODUCT_CATALOG,
|
|
} from "../config/productCatalog";
|
|
|
|
export type { PlanFeatures };
|
|
|
|
/** Free tier defaults — used as fallback for unknown plan keys. */
|
|
export const FREE_FEATURES: PlanFeatures = PRODUCT_CATALOG.free!.features;
|
|
|
|
/**
|
|
* Returns the feature set for a given plan key.
|
|
* Throws on unrecognized keys so misconfigured products fail loudly
|
|
* instead of silently downgrading paid users to free tier.
|
|
*/
|
|
export function getFeaturesForPlan(planKey: string): PlanFeatures {
|
|
return getEntitlementFeatures(planKey);
|
|
}
|