(userId: string)
| 238 | * Check if user is on Team plan (direct or via organization) |
| 239 | */ |
| 240 | export async function isTeamPlan(userId: string): Promise<boolean> { |
| 241 | try { |
| 242 | if (!isBillingEnabled) { |
| 243 | return true |
| 244 | } |
| 245 | |
| 246 | const subscription = await getHighestPrioritySubscription(userId) |
| 247 | const isTeam = |
| 248 | subscription && (checkTeamPlan(subscription) || checkEnterprisePlan(subscription)) |
| 249 | |
| 250 | if (isTeam) { |
| 251 | logger.info('User has team-level plan', { userId, plan: subscription.plan }) |
| 252 | } |
| 253 | |
| 254 | return !!isTeam |
| 255 | } catch (error) { |
| 256 | logger.error('Error checking team plan status', { error, userId }) |
| 257 | return false |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Check if user is on Enterprise plan (direct or via organization) |
nothing calls this directly
no test coverage detected