(userId: string)
| 262 | * Check if user is on Enterprise plan (direct or via organization) |
| 263 | */ |
| 264 | export async function isEnterprisePlan(userId: string): Promise<boolean> { |
| 265 | try { |
| 266 | if (!isBillingEnabled) { |
| 267 | return true |
| 268 | } |
| 269 | |
| 270 | const subscription = await getHighestPrioritySubscription(userId) |
| 271 | const isEnterprise = subscription && checkEnterprisePlan(subscription) |
| 272 | |
| 273 | if (isEnterprise) { |
| 274 | logger.info('User has enterprise plan', { userId, plan: subscription.plan }) |
| 275 | } |
| 276 | |
| 277 | return !!isEnterprise |
| 278 | } catch (error) { |
| 279 | logger.error('Error checking enterprise plan status', { error, userId }) |
| 280 | return false |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * Check if user is an admin or owner of an enterprise organization |
nothing calls this directly
no test coverage detected