import { Alert, AlertTitle, Typography, Button, Box, CircularProgress, type SxProps } from '@mui/material'; import { ErrorOutline, Refresh } from '@mui/icons-material'; import { useLocaleContext } from '@arcblock/ux/lib/Locale/context'; import { useState } from 'react'; interface DynamicPricingUnavailableProps { error?: string; onRetry?: () => void | Promise; showRetry?: boolean; sx?: SxProps; } export default function DynamicPricingUnavailable({ error = undefined, onRetry = undefined, showRetry = true, sx = undefined, }: DynamicPricingUnavailableProps) { const { t } = useLocaleContext(); const [retrying, setRetrying] = useState(false); // Log technical errors to console, but don't display them to users if (error) { console.error('[Dynamic Pricing Error]', error); } const handleRetry = async () => { if (!onRetry || retrying) return; setRetrying(true); try { await onRetry(); } finally { setRetrying(false); } }; return ( } sx={{ borderRadius: 2, '& .MuiAlert-message': { width: '100%', }, ...sx, }}> {t('payment.dynamicPricing.unavailable.title')} {t('payment.dynamicPricing.unavailable.message')} {showRetry && onRetry && ( )} ); }