// System notifications for when the tab is buried — the bridge to real // desktop usage until the Tauri overlay exists. Click = engagement, // which the caller records as a clicked_through outcome. export function notifyPermission(): NotificationPermission | "unsupported" { return "Notification" in window ? Notification.permission : "unsupported"; } /** Must be called from a user gesture (settings toggle). */ export async function requestNotifyPermission(): Promise { if (!("Notification" in window)) return false; return (await Notification.requestPermission()) === "granted"; } export function osNotify(body: string, onClick: () => void): void { if (!("Notification" in window) || Notification.permission !== "granted") return; const n = new Notification("Puck", { body, silent: true }); n.onclick = () => { window.focus(); onClick(); n.close(); }; }