(workspaceId: string)
| 499 | * - the billed user has an individual enterprise subscription (personal workspace). |
| 500 | */ |
| 501 | export async function isWorkspaceOnEnterprisePlan(workspaceId: string): Promise<boolean> { |
| 502 | try { |
| 503 | if (!isBillingEnabled) return true |
| 504 | if (isAccessControlEnabled && !isHosted) return true |
| 505 | |
| 506 | const { getWorkspaceWithOwner } = await import('@/lib/workspaces/permissions/utils') |
| 507 | const ws = await getWorkspaceWithOwner(workspaceId, { includeArchived: true }) |
| 508 | if (!ws) return false |
| 509 | |
| 510 | if (ws.organizationId) { |
| 511 | return isOrganizationOnEnterprisePlan(ws.organizationId) |
| 512 | } |
| 513 | |
| 514 | const billedSub = await getHighestPrioritySubscription(ws.billedAccountUserId) |
| 515 | return !!billedSub && checkEnterprisePlan(billedSub) |
| 516 | } catch (error) { |
| 517 | logger.error('Error checking workspace enterprise plan status', { error, workspaceId }) |
| 518 | return false |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | const MAX_PLAN_CREDITS = 25000 |
| 523 |
no test coverage detected