* TP-22003|Kunal| incident 12018 fix , add customer interaction fix * TP-22003|Kunal| FCM integration * TP-22003|Kunal| added mkcert vite plugin dev dependency * TP-22003|Kunal| added fcmtoken in verfiyV2 api * TP-22003|Kunal|added onMessage function to app.tsx * TP-22003|Kunal| FCM integration working * TP-22003|Kunal| FCM NOTIFICATIONS FULL INTEGRATION _/\_ * TP-22003| copy firebase-sw to dist, timestamp in index.html for firebase-sw, buildTime hydration to replace __BUILD_TIME__ | Herik * TP-22003| copy firebase sw in build | Herik * TP-22003| path changed for firebase-sw | Herik * TP-22003| removed timestamp from firebase-sw index.html | Herik * TP-22003| imporScripts fix | Herik * TP-22003|Kunal| added self.importScripts in firebase-messaging-sw.js and console logs in getFCMToken * TP-22003| log fcmVapidKey, currentToken in firebase.ts | Herik * TP-22003| compat scripts | Herik * TP-22003|Kunal| console logs for getFCMtoken * TP-22003| Check for imporScripts function type | Herik * TP-22003|Kunal| console logs for getFCMtoken * TP-22003|Kunal| console logs for getFCMtoken * TP-22003|Kunal| added firebase scripts in index.html * TP-22003|Kunal| change firebase config in firebase-messaging-sw.js * TP-22003|Kunal| added fcm token in session exchange api * TP-22003|Kunal| added notification permission checks * TP-22003|Kunal| added notification permission screen * TP-22003|Kunal| added text constants on PermissionsScreen.tsx * TP-22003|Kunal| fcm notificaiton blocker overlay * TP-22003|Kunal| removed console logs Co-authored-by: Herik Modi <herik.modi@navi.com>
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
if ('function' === typeof importScripts) {
|
|
// eslint-disable-next-line no-undef
|
|
importScripts('https://www.gstatic.com/firebasejs/8.2.0/firebase-app.js');
|
|
// eslint-disable-next-line no-undef
|
|
importScripts('https://www.gstatic.com/firebasejs/8.2.0/firebase-messaging.js');
|
|
// eslint-disable-next-line no-undef
|
|
|
|
const firebaseConfig = {
|
|
apiKey: '<FCM_apiKey>',
|
|
authDomain: '<FCM_authDomain>',
|
|
databaseURL: '<FCM_databaseURL>',
|
|
projectId: '<FCM_projectId>',
|
|
storageBucket: '<FCM_storageBucket>',
|
|
messagingSenderId: '<FCM_messagingSenderId>',
|
|
appId: '<FCM_appId>',
|
|
measurementId: '<FCM_measurementId>'
|
|
};
|
|
|
|
// eslint-disable-next-line no-undef
|
|
firebase.initializeApp(firebaseConfig);
|
|
|
|
const COLLECTIONS_PORTAL_BROADCAST_CHANNEL = 'COLLECTIONS_PORTAL_BROADCAST_CHANNEL';
|
|
const bc = new BroadcastChannel(COLLECTIONS_PORTAL_BROADCAST_CHANNEL);
|
|
|
|
// Retrieve firebase messaging
|
|
// eslint-disable-next-line no-undef
|
|
const messaging = firebase.messaging();
|
|
|
|
messaging.onBackgroundMessage(function (response) {
|
|
if (response?.data?.payload) {
|
|
bc.postMessage(response.data.payload);
|
|
}
|
|
});
|
|
}
|
|
// Initialize the Firebase app in the service worker by passing the generated config
|