Files
property-management-network/lib/stripe/plans.ts
T
Leon SerfatyandClaude Opus 4.8 c9968531e4 Consolidate audit-fixes branch: webhooks, integrations, and deploy hardening
Batch commit of the pending working tree on security/audit-fixes-2026-07.
Major areas:
- Outbound webhooks / Zapier: schema + signed delivery with retries, public
  v1 API (REST-hook subscribe/unsubscribe), settings UI, cron drain.
- Deploy hardening: email via SMTP2GO (Resend fully removed), verified DB TLS
  (DATABASE_SSL=require + DATABASE_CA), storage fails loud in production when
  Spaces is unconfigured instead of silently using ephemeral disk.
- Integrations & features (concurrent work): accounting (QuickBooks/Xero),
  e-signature (DocuSign/Dropbox Sign), PayPal, geocoding/maps, onboarding,
  expanded legal pages.
- DB migrations 0006–0009.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 13:42:34 -04:00

78 lines
2.3 KiB
TypeScript

import type { Plan, PlanLimits } from "@/types"
export const PLAN_LIMITS: Record<Plan, PlanLimits> = {
starter: {
maxProperties: 1,
maxTenants: 3,
maxAiCalls: 0,
maxStorageMB: 100,
hasTeamAccess: false,
hasWhiteLabel: false,
},
pro: {
maxProperties: 10,
maxTenants: Infinity,
maxAiCalls: 50,
maxStorageMB: 5120,
hasTeamAccess: false,
hasWhiteLabel: false,
},
landlord: {
maxProperties: Infinity,
maxTenants: Infinity,
maxAiCalls: 200,
maxStorageMB: 25600,
hasTeamAccess: true,
hasWhiteLabel: true,
},
lifetime: {
maxProperties: Infinity,
maxTenants: Infinity,
maxAiCalls: 200,
maxStorageMB: 25600,
hasTeamAccess: true,
hasWhiteLabel: true,
},
}
// Single source of truth for DISPLAYED prices (USD). Client-safe (plain numbers,
// no env). Billing always charges the Stripe Price ID, so a mismatch here only
// affects what the marketing/billing UI shows — keep these in sync with the
// amounts configured on the Stripe Prices referenced below.
export const PLAN_AMOUNTS = { starter: 0, pro: 29, landlord: 59, lifetime: 199 } as const
// Plan metadata (client-safe — no env, no price IDs). The actual Stripe price
// is resolved at runtime by lib/stripe/prices.ts using stable lookup keys, so
// the same code works in test and live with ONLY an API-key swap.
export const PLAN_PRICES: Record<string, { plan: Plan; amount: number; interval: string }> = {
pro: { plan: "pro", amount: PLAN_AMOUNTS.pro, interval: "month" },
landlord: { plan: "landlord", amount: PLAN_AMOUNTS.landlord, interval: "month" },
lifetime: { plan: "lifetime", amount: PLAN_AMOUNTS.lifetime, interval: "one_time" },
}
// Annual billing is always offered; the yearly price is resolved (and
// auto-provisioned if missing) at checkout time by lib/stripe/prices.ts.
export function annualEnabled(): boolean {
return true
}
export function checkLimit(
plan: Plan,
resource: keyof PlanLimits,
currentCount: number
): boolean {
const limit = PLAN_LIMITS[plan][resource]
if (typeof limit === "boolean") return limit
return currentCount < (limit as number)
}
export function getPlanLabel(plan: Plan): string {
const labels: Record<Plan, string> = {
starter: "Starter",
pro: "Pro",
landlord: "Landlord",
lifetime: "Lifetime",
}
return labels[plan]
}