const DEFAULT_GRACE_DAYS = 7; /** * Plan limits only apply with `BILLING_ENFORCEMENT=on`. Anything else (unset * included) treats everyone as Pro, so the module can ship before the existing * professors are moved to a plan. */ export function isBillingEnforced(env: Record = process.env): boolean { return env.BILLING_ENFORCEMENT?.trim().toLowerCase() === 'on'; } /** Days a lapsed Pro keeps working after its last paid period. */ export function getGraceDays(env: Record = process.env): number { const value = Number(env.BILLING_GRACE_DAYS); return Number.isInteger(value) && value >= 0 ? value : DEFAULT_GRACE_DAYS; }