(plan: string, metadata?: any)
| 62 | * Returns limit in bytes |
| 63 | */ |
| 64 | export function getStorageLimitForPlan(plan: string, metadata?: any): number { |
| 65 | const limits = getStorageLimits() |
| 66 | |
| 67 | if (isEnterprise(plan)) { |
| 68 | if (metadata?.storageLimitGB) { |
| 69 | return gbToBytes(Number.parseInt(metadata.storageLimitGB)) |
| 70 | } |
| 71 | return limits.enterpriseDefault |
| 72 | } |
| 73 | |
| 74 | const effectivePlan = getPlanTypeForLimits(plan) |
| 75 | const limitByPlan: Record<'free' | 'pro' | 'team', number> = { |
| 76 | free: limits.free, |
| 77 | pro: limits.pro, |
| 78 | team: limits.team, |
| 79 | } |
| 80 | return limitByPlan[effectivePlan as 'free' | 'pro' | 'team'] ?? limits.free |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Get storage limit for a user based on their subscription. Returns limit in |
nothing calls this directly
no test coverage detected