import { useState } from "react"; import { Button } from "@/src/components/ui/button"; import { Plus } from "lucide-react"; import { SpendAlertsTable } from "./SpendAlertsTable"; import { SpendAlertDialog } from "./SpendAlertDialog"; import { useHasOrganizationAccess } from "@/src/features/rbac/utils/checkOrganizationAccess"; import { useHasEntitlement } from "@/src/features/entitlements/hooks"; interface SpendAlertsSectionProps { orgId: string; } export function SpendAlertsSection({ orgId }: SpendAlertsSectionProps) { const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false); const [refetchTrigger, setRefetchTrigger] = useState(0); const hasAccess = useHasOrganizationAccess({ organizationId: orgId, scope: "langfuseCloudBilling:CRUD", }); const hasEntitlement = useHasEntitlement("cloud-spend-alerts"); if (!hasEntitlement) { return null; } if (!hasAccess) { return null; } return ( <>
Get notified when your organization's spending exceeds configured thresholds. Alerts may be delayed by up to 90 minutes.