// Service Worker SAR — C6 Web Push // Recebe push events e exibe notificação nativa. Clique abre a URL do payload. self.addEventListener('push', (event) => { const data = event.data?.json() ?? {}; event.waitUntil( self.registration.showNotification(data.title ?? 'SAR', { body: data.body ?? '', icon: '/sar-icon.png', badge: '/sar-icon.png', data: data.url ? { url: data.url } : undefined, }), ); }); self.addEventListener('notificationclick', (event) => { event.notification.close(); const url = event.notification.data?.url; if (url) { event.waitUntil(clients.openWindow(url)); } });