mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
* **Chores** * Updated internal module import paths across hook files to use standardized path aliases for improved code consistency and maintainability.
21 lines
767 B
TypeScript
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 }
|
|
}
|