MCPcopy
hub / github.com/simstudioai/sim / hasWorkspaceInboxGraceAccess

Function hasWorkspaceInboxGraceAccess

apps/sim/lib/billing/core/subscription.ts:587–608  ·  view source on GitHub ↗
(workspaceId: string)

Source from the content-addressed store, hash-verified

585 * ambiguity: never tear down on uncertainty.
586 */
587export async function hasWorkspaceInboxGraceAccess(workspaceId: string): Promise<boolean> {
588 try {
589 if (isInboxEnabled) return true
590 if (!isBillingEnabled) return true
591
592 const { getWorkspaceWithOwner } = await import('@/lib/workspaces/permissions/utils')
593 const ws = await getWorkspaceWithOwner(workspaceId, { includeArchived: true })
594 if (!ws) return true
595
596 if (ws.organizationId) {
597 const { getOrganizationSubscription } = await import('@/lib/billing/core/billing')
598 const orgSub = await getOrganizationSubscription(ws.organizationId)
599 return !!orgSub && isInboxEntitledPlan(orgSub.plan)
600 }
601
602 const billedSub = await getHighestPrioritySubscription(ws.billedAccountUserId)
603 return !!billedSub && isInboxEntitledPlan(billedSub.plan)
604 } catch (error) {
605 logger.error('Error checking workspace inbox grace access', { error, workspaceId })
606 return true
607 }
608}
609
610/**
611 * Check if user has access to live sync (every 5 minutes) for KB connectors

Callers 1

route.tsFile · 0.90

Calls 5

getWorkspaceWithOwnerFunction · 0.85
isInboxEntitledPlanFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected