// Immer die Glas-Toasts verwenden (keine Fallbacks, kein toastr) export function showToast(payload = {}) { const { id, type, state, text, message, title, badge, domain, position, duration, close } = payload || {}; // type/state auf deine 4 Zustände mappen const map = { success:'done', ok:'done', forbidden:'forbidden', error:'failed', danger:'failed', info:'queued', warning:'queued' }; const stIn = String(state ?? type ?? 'done').toLowerCase(); const st = ['done','failed','forbidden','running','queued'].includes(stIn) ? stIn : (map[stIn] || 'queued'); if (!window.toastraGlass || typeof window.toastraGlass.show !== 'function') { // Optional: console.warn('toastraGlass fehlt'); return; } window.toastraGlass.show({ id: id || ('toast-' + Date.now()), // gleiche id => ersetzt in-place state: st, // steuert Badge/Icon/Farben badge: badge ?? title ?? null, // linke kleine Kapsel domain: domain ?? null, // kleine Überschrift rechts message: (message ?? text ?? ''), // Haupttext position: position ?? 'bottom-right', duration: typeof duration === 'number' ? duration : 6000, // Standard 6s close: close !== false, }); }