* Find the minimum tier that passes the gate (for upgrade messaging).
(gate: GateCheck)
| 61 | * Find the minimum tier that passes the gate (for upgrade messaging). |
| 62 | */ |
| 63 | function minimumTierFor(gate: GateCheck): Tier { |
| 64 | const order: Tier[] = ['free', 'pro', 'enterprise'] |
| 65 | for (const tier of order) { |
| 66 | if (passesGate(TIER_CONFIGS[tier], gate)) return tier |
| 67 | } |
| 68 | return 'enterprise' |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Create middleware that enforces a tier gate. |
no test coverage detected