import type { NavigateFunction } from 'react-router-dom'; export interface NoticeActionContext { navigate: NavigateFunction; } type NoticeActionHandler = (ctx: NoticeActionContext) => void | Promise; const actions = new Map(); export function registerNoticeAction(id: string, handler: NoticeActionHandler): void { actions.set(id, handler); } export function runNoticeAction(id: string, ctx: NoticeActionContext): void { const handler = actions.get(id); if (!handler) { console.error(`[systemNotices] unknown action CTA id: "${id}". Register it via registerNoticeAction().`); return; } void handler(ctx); }