{"version":3,"file":"useNotification.hook.cjs","sources":["../../../src/hooks/use-notification/useNotification.hook.tsx"],"sourcesContent":["import { useCallback } from 'react'\r\nimport { toast } from 'sonner'\r\n\r\nimport { Toast } from '@components/feedback/toast'\r\nimport { TOAST_CHANNELS } from '@components/feedback/toast/constants'\r\nimport type {\r\n    ShowNotificationOptions,\r\n    UseNotificationReturn,\r\n} from '@hooks/use-notification/types/useNotification.types.ts'\r\nimport type { ToastId } from '@hooks/use-toast/types/useToast.types.ts'\r\n\r\nexport const useNotification = (): UseNotificationReturn => {\r\n    const show = useCallback(({\r\n        variant = 'info',\r\n        title,\r\n        description,\r\n        icon,\r\n        children,\r\n        duration = 0,\r\n    }: ShowNotificationOptions): ToastId => toast.custom(\r\n        (id) => (\r\n            <Toast\r\n                variant={variant}\r\n                icon={icon}\r\n                title={title}\r\n                description={description}\r\n                onClose={() => toast.dismiss(id)}\r\n            >\r\n                {children}\r\n            </Toast>\r\n        ),\r\n        {\r\n            duration: duration === 0 ? Infinity : duration,\r\n            toasterId: TOAST_CHANNELS.notifications,\r\n        },\r\n    ), [])\r\n\r\n    const dismiss = useCallback((id: ToastId): void => {\r\n        toast.dismiss(id)\r\n    }, [])\r\n\r\n    return { show, dismiss }\r\n}\r\n"],"names":["useNotification","show","useCallback","variant","title","description","icon","children","duration","toast","id","jsx","Toast","TOAST_CHANNELS","dismiss"],"mappings":"8gBAWaA,EAAkB,IAA6B,CACxD,MAAMC,EAAOC,EAAAA,YAAY,CAAC,CACtB,QAAAC,EAAU,OACV,MAAAC,EACA,YAAAC,EACA,KAAAC,EACA,SAAAC,EACA,SAAAC,EAAW,CAAA,IACyBC,EAAAA,MAAM,OACzCC,GACGC,EAAAA,IAACC,EAAA,CACG,QAAAT,EACA,KAAAG,EACA,MAAAF,EACA,YAAAC,EACA,QAAS,IAAMI,EAAAA,MAAM,QAAQC,CAAE,EAE9B,SAAAH,CAAA,CAAA,EAGT,CACI,SAAUC,IAAa,EAAI,IAAWA,EACtC,UAAWK,EAAAA,eAAe,aAAA,CAC9B,EACD,EAAE,EAECC,EAAUZ,cAAaQ,GAAsB,CAC/CD,EAAAA,MAAM,QAAQC,CAAE,CACpB,EAAG,CAAA,CAAE,EAEL,MAAO,CAAE,KAAAT,EAAM,QAAAa,CAAA,CACnB"}