import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// packages/ui/src/components/license/LicenseWatermark.tsx
/**
 * @fileoverview License Watermark Component
 * @description Displays watermark overlay when no valid license key is detected
 *
 * Watermark appears as:
 * - Fixed position button (middle-right of viewport)
 * - Console warnings in browser dev tools
 * - Automatically hidden when valid license key present
 *
 * @version 0.0.1
 * @since 0.0.1
 * @author AMBROISE PARK Consulting
 */
import { useEffect } from 'react';
import { checkLicense } from '@donotdev/core';
import { watermarkSvg } from './watermarkData';
/**
 * LicenseWatermark - Clickable button overlay for unlicensed applications
 *
 * Renders fixed button + console warnings when no valid license
 * Position: middle-right of viewport
 * Visibility: Always visible in unlicensed apps
 *
 * License configuration:
 * - Environment variable: VITE_DONOTDEV_LICENSE_KEY or NEXT_PUBLIC_DONOTDEV_LICENSE_KEY
 * - Runtime injection: globalThis.__DONOTDEV_LICENSE_KEY__ = 'your-key-here'
 *
 * @returns Watermark overlay or null if licensed
 *
 * @example
 * ```tsx
 * // Automatically injected by framework
 * <LicenseWatermark />
 * ```
 *
 * @version 0.0.1
 * @since 0.0.1
 * @author AMBROISE PARK Consulting
 */
export function LicenseWatermark() {
    const license = checkLicense();
    /** Production console.warn is intentional — alerts unlicensed deployments.
     *  This is a license enforcement mechanism, not a debug log. */
    useEffect(() => {
        if (!license.isValid) {
            // Console warnings
            console.warn('%c⚠️ DoNotDev Framework - Unlicensed', 'color: #ff6b6b; font-size: 16px; font-weight: bold;');
            console.warn('This application is using the DoNotDev Framework without a valid license key.\n' +
                'View pricing: https://donotdev.com/pricing\n' +
                'Purchase: https://donotdev.com/purchase\n\n' +
                'Configure your license:\n' +
                '  Vite: VITE_DONOTDEV_LICENSE_KEY=your-key-here\n' +
                '  Next.js: NEXT_PUBLIC_DONOTDEV_LICENSE_KEY=your-key-here\n' +
                'Or in code:\n' +
                '  globalThis.__DONOTDEV_LICENSE_KEY__ = "your-key-here";');
        }
    }, [license.isValid]);
    // Hide watermark if licensed
    if (license.isValid) {
        return null;
    }
    return (_jsxs("a", { href: "https://donotdev.com/pricing", target: "_blank", rel: "noopener noreferrer", style: {
            position: 'fixed',
            insetInlineEnd: '20px',
            top: '50%',
            transform: 'translateY(-50%)',
            zIndex: 9999,
            display: 'flex',
            alignItems: 'center',
            gap: '12px',
            padding: '12px 16px',
            backgroundColor: 'rgba(255, 255, 255, 0.95)',
            border: '2px solid rgba(242, 61, 41, 0.3)',
            borderRadius: '8px',
            boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
            textDecoration: 'none',
            transition: 'all 0.2s ease',
            cursor: 'pointer',
            opacity: 0.9,
        }, onMouseEnter: (e) => {
            e.currentTarget.style.opacity = '1';
            e.currentTarget.style.transform = 'translateY(-50%) scale(1.05)';
        }, onMouseLeave: (e) => {
            e.currentTarget.style.opacity = '0.9';
            e.currentTarget.style.transform = 'translateY(-50%) scale(1)';
        }, children: [_jsx("img", { src: watermarkSvg, alt: "DoNotDev Logo", style: {
                    width: '48px',
                    height: '48px',
                    flexShrink: 0,
                } }), _jsxs("div", { style: {
                    display: 'flex',
                    flexDirection: 'column',
                    gap: '2px',
                }, children: [_jsx("div", { style: {
                            fontFamily: 'system-ui, sans-serif',
                            fontSize: '13px',
                            fontWeight: '600',
                            color: '#27494a',
                            lineHeight: '1.2',
                        }, children: "DoNotDev" }), _jsx("div", { style: {
                            fontFamily: 'system-ui, sans-serif',
                            fontSize: '11px',
                            fontWeight: '500',
                            color: '#f23d29',
                            lineHeight: '1.2',
                        }, children: "Get License" })] })] }));
}
