()
| 27 | * plan-helpers.ts which maps them to their original dollar amounts. |
| 28 | */ |
| 29 | export function getPlans(): BillingPlan[] { |
| 30 | const plans: BillingPlan[] = [ |
| 31 | { |
| 32 | name: 'free', |
| 33 | priceId: env.STRIPE_FREE_PRICE_ID || '', |
| 34 | limits: { cost: getFreeTierLimit() }, |
| 35 | }, |
| 36 | ] |
| 37 | |
| 38 | const proPriceMap: Record<number, { monthly: string; annual: string }> = { |
| 39 | 25: { |
| 40 | monthly: env.STRIPE_PRICE_TIER_25_MO || '', |
| 41 | annual: env.STRIPE_PRICE_TIER_25_YR || '', |
| 42 | }, |
| 43 | 100: { |
| 44 | monthly: env.STRIPE_PRICE_TIER_100_MO || '', |
| 45 | annual: env.STRIPE_PRICE_TIER_100_YR || '', |
| 46 | }, |
| 47 | } |
| 48 | |
| 49 | const teamPriceMap: Record<number, { monthly: string; annual: string }> = { |
| 50 | 25: { |
| 51 | monthly: env.STRIPE_PRICE_TEAM_25_MO || '', |
| 52 | annual: env.STRIPE_PRICE_TEAM_25_YR || '', |
| 53 | }, |
| 54 | 100: { |
| 55 | monthly: env.STRIPE_PRICE_TEAM_100_MO || '', |
| 56 | annual: env.STRIPE_PRICE_TEAM_100_YR || '', |
| 57 | }, |
| 58 | } |
| 59 | |
| 60 | for (const tier of CREDIT_TIERS) { |
| 61 | const proPrices = proPriceMap[tier.dollars] |
| 62 | const teamPrices = teamPriceMap[tier.dollars] |
| 63 | |
| 64 | const creditValueDollars = tier.credits / CREDIT_MULTIPLIER |
| 65 | |
| 66 | if (proPrices?.monthly) { |
| 67 | plans.push({ |
| 68 | name: `pro_${tier.credits}`, |
| 69 | priceId: proPrices.monthly, |
| 70 | annualDiscountPriceId: proPrices.annual || undefined, |
| 71 | limits: { cost: creditValueDollars }, |
| 72 | }) |
| 73 | } |
| 74 | |
| 75 | if (teamPrices?.monthly) { |
| 76 | plans.push({ |
| 77 | name: `team_${tier.credits}`, |
| 78 | priceId: teamPrices.monthly, |
| 79 | annualDiscountPriceId: teamPrices.annual || undefined, |
| 80 | limits: { cost: creditValueDollars }, |
| 81 | }) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | plans.push({ |
| 86 | name: 'enterprise', |
no test coverage detected