// Background handler for FCM web push. Keep the config in sync with // window.KC_FIREBASE in index.html (a service worker can't read window). // Fill in apiKey / appId from the Firebase console before enabling push. importScripts('https://www.gstatic.com/firebasejs/10.13.2/firebase-app-compat.js'); importScripts('https://www.gstatic.com/firebasejs/10.13.2/firebase-messaging-compat.js'); firebase.initializeApp({ apiKey: 'REPLACE_ME', projectId: 'konfi-castle-app', messagingSenderId: '307226979593', appId: 'REPLACE_ME', }); firebase.messaging().onBackgroundMessage(function (payload) { const n = payload.notification || {}; self.registration.showNotification(n.title || 'KC-App', { body: n.body || '', icon: '/icons/Icon-192.png', data: payload.data || {}, }); });