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

Function hasLiveSyncAccess

apps/sim/lib/billing/core/subscription.ts:616–632  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

614 * - User has a Max plan (credits >= 25000) or enterprise plan
615 */
616export async function hasLiveSyncAccess(userId: string): Promise<boolean> {
617 try {
618 if (!isHosted) {
619 return true
620 }
621 const [sub, billingStatus] = await Promise.all([
622 getHighestPrioritySubscription(userId),
623 getEffectiveBillingStatus(userId),
624 ])
625 if (!sub) return false
626 if (!hasUsableSubscriptionAccess(sub.status, billingStatus.billingBlocked)) return false
627 return getPlanTierCredits(sub.plan) >= 25000 || checkEnterprisePlan(sub)
628 } catch (error) {
629 logger.error('Error checking live sync access', { error, userId })
630 return false
631 }
632}
633
634/**
635 * Send welcome email for Pro and Team plan subscriptions

Callers 2

route.tsFile · 0.90
route.tsFile · 0.90

Calls 6

getPlanTierCreditsFunction · 0.90
checkEnterprisePlanFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected