import { toast as sonnerToast, type ExternalToast } from 'sonner' /** * Toast notification utility wrapper for ResolutionFlow * Built on Sonner with theme integration and consistent styling * * @example * // Success notification * toast.success('Tree saved successfully!') * * @example * // Error notification * toast.error('Failed to save tree') * * @example * // Promise with loading states * toast.promise( * api.saveTree(data), * { * loading: 'Saving tree...', * success: 'Tree saved!', * error: 'Failed to save tree' * } * ) */ export const toast = { /** * Display a success toast notification */ success: (message: string, options?: ExternalToast) => sonnerToast.success(message, options), /** * Display an error toast notification */ error: (message: string, options?: ExternalToast) => sonnerToast.error(message, options), /** * Display an info toast notification */ info: (message: string, options?: ExternalToast) => sonnerToast.info(message, options), /** * Display a warning toast notification */ warning: (message: string, options?: ExternalToast) => sonnerToast.warning(message, options), /** * Display a promise toast with loading/success/error states * @example * toast.promise( * saveData(), * { * loading: 'Saving...', * success: 'Saved successfully', * error: 'Failed to save' * } * ) */ promise: ( promise: Promise, messages: { loading: string success: string | ((data: T) => string) error: string | ((error: Error) => string) } ) => sonnerToast.promise(promise, messages), }