'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// packages/ui/src/components/common/FeatureDisabled.tsx
/**
 * @fileoverview FeatureDisabled Component
 * @description Reusable component for displaying feature unavailable/disabled states
 *
 * This component provides a consistent UI for when features are not available,
 * whether due to missing packages, disabled configuration, or other reasons.
 *
 * @version 0.0.1
 * @since 0.0.1
 * @author AMBROISE PARK Consulting
 */
import { AlertCircle, RefreshCw, Mail, Cookie } from 'lucide-react';
import { Card, Button, BUTTON_VARIANT, Stack } from '@donotdev/components';
import { useTranslation } from '@donotdev/core';
/**
 * FeatureDisabled - Component for displaying feature unavailable states
 *
 * Provides a consistent UI pattern for when features are disabled or unavailable.
 * Includes options for review cookies, contact support, and retry actions.
 *
 * @example
 * ```tsx
 * <FeatureDisabled
 * featureName="Billing"
 * description="Stripe billing is not configured"
 * showContactSupport={true}
 * showRetry={true}
 * onRetry={() => window.location.reload()}
 * />
 * ```
 *
 * @param props - FeatureDisabled component props
 * @returns React component
 *
 * @version 0.0.1
 * @since 0.0.1
 * @author AMBROISE PARK Consulting
 */
function FeatureDisabled({ featureName, title, description, showReviewCookies = false, showContactSupport = true, showRetry = false, supportEmail = 'support@example.com', onRetry, onReviewCookies, customActions, className = '', }) {
    const { t } = useTranslation('ui');
    const defaultDescription = description ||
        t('featureDisabled.description', '{featureName} is not available. This may be due to missing configuration or disabled features.', { featureName });
    const handleReviewCookies = () => {
        if (onReviewCookies) {
            onReviewCookies();
        }
        else {
            // Default: try to open cookie consent if available
            const event = new CustomEvent('openCookieConsent');
            window.dispatchEvent(event);
        }
    };
    const handleContactSupport = () => {
        window.location.href = `mailto:${supportEmail}?subject=${encodeURIComponent(`Feature Unavailable: ${featureName}`)}&body=${encodeURIComponent(`I'm experiencing an issue with ${featureName} not being available.`)}`;
    };
    return (_jsxs(Card, { className: className, title: _jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(AlertCircle, { className: "dndev-size-md", style: { color: 'var(--destructive)' } }), title || featureName] }), subtitle: defaultDescription, children: [' ', _jsxs("div", { style: { display: 'grid', gap: 'var(--gap-md)' }, children: [(showReviewCookies ||
                        showContactSupport ||
                        showRetry ||
                        customActions) && (_jsxs(Stack, { direction: "row", wrap: "wrap", gap: "tight", children: [showReviewCookies && (_jsx(Button, { variant: BUTTON_VARIANT.OUTLINE, onClick: handleReviewCookies, icon: Cookie, children: t('featureDisabled.reviewCookies', 'Review Cookies') })), showContactSupport && (_jsx(Button, { variant: BUTTON_VARIANT.OUTLINE, onClick: handleContactSupport, icon: Mail, children: t('featureDisabled.contactSupport', 'Contact Support') })), showRetry && (_jsx(Button, { variant: BUTTON_VARIANT.OUTLINE, onClick: onRetry, icon: RefreshCw, children: t('featureDisabled.retry', 'Retry') })), customActions] })), _jsx("p", { style: {
                            fontSize: 'var(--font-size-sm)',
                            color: 'var(--muted-foreground)',
                        }, children: t('featureDisabled.helpText', 'If you believe this is an error, please contact support or try refreshing the page.') })] })] }));
}
export default FeatureDisabled;
