/****************************************************************************** * 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, Alert, CircularProgress, Box } from '@mui/material'; import WarningIcon from '@mui/icons-material/Warning'; import type { Customer } from "../../../extension-registry-types"; import { handleError } from "../../../utils"; interface DeleteCustomerDialogProps { open: boolean; customer?: Customer; onClose: () => void; onConfirm: () => Promise; } export const DeleteCustomerDialog: FC = ({ open, customer, 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)); setLoading(false); } }; if (!customer) return null; return ( Delete Customer {error && {error}} Are you sure you want to delete the customer {customer.name}? {customer.tier?.name && ( This customer is currently using the {customer.tier?.name} tier. )} This action cannot be undone. All associated usage statistics will also be deleted. ); };