(userId: string)
| 209 | * `'free'` when there is no usable paid subscription. |
| 210 | */ |
| 211 | export async function getInvitePlanCategoryForUser(userId: string): Promise<PlanCategory> { |
| 212 | try { |
| 213 | const sub = await getHighestPrioritySubscription(userId) |
| 214 | if (!sub || !hasUsableSubscriptionStatus(sub.status)) return 'free' |
| 215 | return getPlanType(sub.plan) |
| 216 | } catch (error) { |
| 217 | logger.error('Failed to resolve subscription for invite policy', { userId, error }) |
| 218 | return 'free' |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | export async function getWorkspaceCreationPolicy({ |
| 223 | userId, |
no test coverage detected