/** * WooNooW Addon TypeScript Definitions * * Type definitions for addon developers using the WooNooW API * * @package WooNooW * @version 1.0.0 */ import type { ComponentType } from 'react'; declare global { interface Window { /** * WooNooW API exposed to addon developers */ WooNooW: { React: typeof import('react'); ReactDOM: typeof import('react-dom/client'); hooks: { useQuery: any; useMutation: any; useQueryClient: any; useModules: () => { isEnabled: (moduleId: string) => boolean; modules: string[]; }; useModuleSettings: (moduleId: string) => { settings: Record; isLoading: boolean; updateSettings: { mutate: (settings: Record) => void; isPending: boolean; }; saveSetting: (key: string, value: any) => void; }; }; components: { Button: ComponentType; Input: ComponentType; Label: ComponentType; Textarea: ComponentType; Switch: ComponentType; Select: ComponentType; SelectContent: ComponentType; SelectItem: ComponentType; SelectTrigger: ComponentType; SelectValue: ComponentType; Checkbox: ComponentType; Badge: ComponentType; Card: ComponentType; CardContent: ComponentType; CardDescription: ComponentType; CardFooter: ComponentType; CardHeader: ComponentType; CardTitle: ComponentType; SettingsLayout: ComponentType<{ title: string; description?: string; isLoading?: boolean; children: React.ReactNode; }>; SettingsCard: ComponentType<{ title: string; description?: string; children: React.ReactNode; }>; SettingsSection: ComponentType; SchemaForm: ComponentType<{ schema: FormSchema; initialValues?: Record; onSubmit: (values: Record) => void | Promise; isSubmitting?: boolean; submitLabel?: string; errors?: Record; }>; SchemaField: ComponentType; }; icons: { Settings: ComponentType; Save: ComponentType; Trash2: ComponentType; Edit: ComponentType; Plus: ComponentType; X: ComponentType; Check: ComponentType; AlertCircle: ComponentType; Info: ComponentType; Loader2: ComponentType; ChevronDown: ComponentType; ChevronUp: ComponentType; ChevronLeft: ComponentType; ChevronRight: ComponentType; }; utils: { api: { get: (endpoint: string) => Promise; post: (endpoint: string, data?: any) => Promise; put: (endpoint: string, data?: any) => Promise; delete: (endpoint: string) => Promise; }; toast: { success: (message: string) => void; error: (message: string) => void; info: (message: string) => void; warning: (message: string) => void; }; __: (text: string, domain?: string) => string; }; }; } } /** * Form Schema Types */ export type FieldType = 'text' | 'textarea' | 'email' | 'url' | 'number' | 'toggle' | 'checkbox' | 'select'; export interface FieldSchema { type: FieldType; label: string; description?: string; placeholder?: string; required?: boolean; default?: any; options?: Record; min?: number; max?: number; } export type FormSchema = Record; /** * Module Registration */ export interface ModuleRegistration { id: string; name: string; description: string; version: string; author: string; category: 'marketing' | 'customers' | 'products' | 'shipping' | 'payments' | 'analytics' | 'other'; icon: string; features: string[]; has_settings?: boolean; settings_component?: string; spa_bundle?: string; } /** * Settings Schema Registration */ export interface SettingsSchemaRegistration { [moduleId: string]: FormSchema; } export {};