(userId: string)
| 614 | * - User has a Max plan (credits >= 25000) or enterprise plan |
| 615 | */ |
| 616 | export 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 |
no test coverage detected