PageSourceSearch

https://www.tataaig.com/firebase-messaging-sw.js

js tataaig.com collected 2026-09-24 09:44:19 UTC 2,135 bytes, 67 lines download raw bytes

1importScripts('https://www.gstatic.com/firebasejs/8.2.3/firebase-app.js');
2importScripts('https://www.gstatic.com/firebasejs/8.2.3/firebase-messaging.js');
3importScripts('serviceWorkerEnv.js');
4importScripts('https://cdn.moengage.com/release/dc_3/serviceworker_cdn.min.latest.js');
5
6const firebaseConfig = {
7  apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
8  authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
9  projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
10  storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,
11  messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_SENDER_ID,
12  appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID
13};
14
15firebase.initializeApp(firebaseConfig);
16
17const messaging = firebase.messaging();
18
19messaging.onBackgroundMessage(function (payload) {
20  const { body, title, url, icon, ctaTitle, ctaIcon, ...otherProps } = payload.data;
21  let options = {
22    body,
23    title,
24    icon,
25    data: { url }
26  };
27  if (ctaTitle) {
28    const actions = [{ action: 'actionClick', title: ctaTitle, icon: ctaIcon }];
29    options.actions = actions;
30  }
31
32  self.registration.showNotification(title, { ...options, ...otherProps });
33});
34
35self.addEventListener('notificationclick', function (event) {
36  const notificationData = event?.notification?.data;
37  const url = notificationData.url ? notificationData?.url : 'https://tataaig.com';
38  let urlToOpen = new URL(url, self.location.origin).href;
39  event.notification.close();
40  const promiseChain = clients
41    .matchAll({
42      type: 'window',
43      includeUncontrolled: true
44    })
45    .then((windowClients) => {
46      let matchingClient = null;
47
48      for (let i = 0; i < windowClients.length; i++) {
49        const windowClient = windowClients[i];
50        if (windowClient.url === urlToOpen) {
51          matchingClient = windowClient;
52          break;
53        }
54      }
55
56      if (matchingClient) {
57        return matchingClient.focus();
58      }
59      if (event.action === 'actionClick') {
60        return clients.openWindow(urlToOpen);
61      } else {
62        return clients.openWindow(urlToOpen);
63      }
64    });
65
66  event.waitUntil(promiseChain);
67});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.