fix(envvar): clear separation between server-side and client-side billing envvar (#988)

This commit is contained in:
Vikhyath Mondreti
2025-08-15 16:41:02 -07:00
committed by GitHub
parent 2e027dd77d
commit 4d4aefa346
4 changed files with 11 additions and 6 deletions

View File

@@ -8,10 +8,12 @@ import {
UserCircle,
Users,
} from 'lucide-react'
import { isBillingEnabled } from '@/lib/environment'
import { getEnv, isTruthy } from '@/lib/env'
import { cn } from '@/lib/utils'
import { useSubscriptionStore } from '@/stores/subscription/store'
const isBillingEnabled = isTruthy(getEnv('NEXT_PUBLIC_BILLING_ENABLED'))
interface SettingsNavigationProps {
activeSection: string
onSectionChange: (

View File

@@ -3,7 +3,7 @@
import { useEffect, useRef, useState } from 'react'
import { X } from 'lucide-react'
import { Button, Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui'
import { isBillingEnabled } from '@/lib/environment'
import { getEnv, isTruthy } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger'
import { cn } from '@/lib/utils'
import {
@@ -22,6 +22,8 @@ import { useGeneralStore } from '@/stores/settings/general/store'
const logger = createLogger('SettingsModal')
const isBillingEnabled = isTruthy(getEnv('NEXT_PUBLIC_BILLING_ENABLED'))
interface SettingsModalProps {
open: boolean
onOpenChange: (open: boolean) => void

View File

@@ -5,7 +5,7 @@ import { HelpCircle, LibraryBig, ScrollText, Search, Settings, Shapes } from 'lu
import { useParams, usePathname, useRouter } from 'next/navigation'
import { Button, ScrollArea, Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui'
import { useSession } from '@/lib/auth-client'
import { isBillingEnabled } from '@/lib/environment'
import { getEnv, isTruthy } from '@/lib/env'
import { createLogger } from '@/lib/logs/console/logger'
import { generateWorkspaceName } from '@/lib/naming'
import { cn } from '@/lib/utils'
@@ -38,6 +38,8 @@ const logger = createLogger('Sidebar')
const SIDEBAR_GAP = 12 // 12px gap between components - easily editable
const isBillingEnabled = isTruthy(getEnv('NEXT_PUBLIC_BILLING_ENABLED'))
/**
* Optimized auto-scroll hook for smooth drag operations
* Extracted outside component for better performance

View File

@@ -1,7 +1,7 @@
/**
* Environment utility functions for consistent environment detection across the application
*/
import { env, getEnv, isTruthy } from './env'
import { env, isTruthy } from './env'
/**
* Is the application running in production mode
@@ -26,8 +26,7 @@ export const isHosted = env.NEXT_PUBLIC_APP_URL === 'https://www.sim.ai'
/**
* Is billing enforcement enabled
*/
export const isBillingEnabled =
isTruthy(getEnv('NEXT_PUBLIC_BILLING_ENABLED')) || isTruthy(env.BILLING_ENABLED)
export const isBillingEnabled = isTruthy(env.BILLING_ENABLED)
/**
* Get cost multiplier based on environment