/** * One-line toasts over the design system's Toast: `toast( 'Saved.' )`. * * Use the `danger` tone for a one-click action that failed and is already * undone on screen (a switch, a reorder, a sync). A failure the merchant has * to fix (a form field, a rejected key, a load error) is shown where it * happened instead. */ import { useCallback, type ReactNode } from 'react'; import { useToast as useDsToast } from '../ds'; export { ToastProvider } from '../ds'; export type ToastTone = 'default' | 'danger'; export function useToast(): ( message: ReactNode, tone?: ToastTone ) => void { const { toast } = useDsToast(); return useCallback( ( message: ReactNode, tone: ToastTone = 'default' ) => toast( { message, tone } ), [ toast ] ); }