Files
supabase/apps/studio/hooks/misc/useUpgradePrompt.tsx
Charis 180ce515f6 style: require @ imports and sort imports for studio/hooks (#44444)
* **Chores**
* Updated internal module import paths across hook files to use
standardized path aliases for improved code consistency and
maintainability.
2026-04-01 11:48:02 -04:00

21 lines
767 B
TypeScript

import { useEffect, useState } from 'react'
import { useCheckEntitlements } from './useCheckEntitlements'
import { maybeShowUpgradePromptIfNotEntitled } from '@/components/interfaces/Settings/Logs/Logs.utils'
export const useUpgradePrompt = (from: string) => {
const [showUpgradePrompt, setShowUpgradePrompt] = useState(false)
const { getEntitlementNumericValue } = useCheckEntitlements('log.retention_days')
const entitledToAuditLogDays = getEntitlementNumericValue()
const shouldShowUpgradePrompt = maybeShowUpgradePromptIfNotEntitled(from, entitledToAuditLogDays)
useEffect(() => {
if (shouldShowUpgradePrompt) {
setShowUpgradePrompt(true)
}
}, [from])
return { showUpgradePrompt, setShowUpgradePrompt, shouldShowUpgradePrompt }
}