import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from 'ui' import { UpgradePlanButton } from '@/components/ui/UpgradePlanButton' import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization' interface PurgeCDNCacheDialogProps { visible: boolean title: string description: string status: string isPurging: boolean onConfirm: () => void onClose: () => void } export const PurgeCDNCacheDialog = ({ visible, title, status, description, isPurging, onConfirm, onClose, }: PurgeCDNCacheDialogProps) => { const { data: organization } = useSelectedOrganizationQuery() const isFreePlan = organization?.plan.id === 'free' return ( { if (!open && isPurging) return onClose() }} > // Avoid triggering the overlay click event.stopPropagation() } dialogOverlayProps={{ onClick: () => { if (isPurging) return onClose() }, }} > {title} {/* No Admonition (that has an alert role) here as we're already in an alertdialog */}
{isFreePlan ? (

Purging the CDN cache requires the Pro plan or higher.

) : ( <>

{description + ' '} Invalidation can take up to 60 seconds to propagate across all CDN edge nodes worldwide.

Purging the CDN cache does not affect browser caches. Users may see the cached version until their browser cache expires.

)}
Cancel {isFreePlan ? ( ) : ( Purge CDN cache )}
{status}
) }