/****************************************************************************** * Copyright (c) 2026 Contributors to the Eclipse Foundation. * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * https://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *****************************************************************************/ import { FC, useState } from 'react'; import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Typography, CircularProgress, Alert } from '@mui/material'; import type { Tier } from '../../../extension-registry-types'; import { handleError } from "../../../utils"; interface DeleteTierDialogProps { open: boolean; tier?: Tier; onClose: () => void; onConfirm: () => Promise; } export const DeleteTierDialog: FC = ({ open, tier, onClose, onConfirm }) => { const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleConfirm = async () => { try { setError(null); setLoading(true); await onConfirm(); onClose(); } catch (err: any) { setError(handleError(err)); } finally { setLoading(false); } }; return ( Delete Tier {error && {error}} Are you sure you want to delete the tier {tier?.name}? This action cannot be undone. If this tier is assigned to customers, they will be affected. ); };