1importScripts("/assets/desktop/precache-manifest.76eba1b42e935c5dad60dc29643e1848.js", "https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js"); 2 3/* eslint-disable no-restricted-globals */ 4if (workbox) { 5 // precaching strategy, if assets are in cache, serve them, without waiting for service worker to install 6 workbox.skipWaiting(); 7 8 // sync service-workers if opened in simulatenous tabs 9 workbox.clientsClaim(); 10 11 const serveOfflinePage = (event) => { 12 const url = new URL(event.request.url); 13 const hostname = url.hostname; 14 15 const BRAND_FILENAME_MAP = { 16 belvilla: '/offline-bv.html', 17 preprod: '/offline-g6.html', 18 oyo: '/offline.html', 19 danland: '/offline-dl.html', 20 motel6: '/offline-g6.html', 21 studio6: '/offline-g6.html', 22 checkin:'/offline-checkin.html' 23 } 24 25 for (const key in BRAND_FILENAME_MAP) { 26 if (hostname.includes(key)) { 27 return caches.match(BRAND_FILENAME_MAP[key]); 28 } 29 } 30 31 // default fallback: '/offline page' 32 return caches.match('/offline.html'); 33 }; 34 35 workbox.routing.registerRoute(/(.+)\?utm_source=homescreen$/, async ({ event }) => { 36 try { 37 return await workbox.strategies.networkOnly().handle({ event }); 38 } catch (error) { 39 return serveOfflinePage(event); 40 } 41 }); 42 43 workbox.routing.registerRoute(/\/$/, async ({ event }) => { 44 try { 45 return await workbox.strategies.networkOnly().handle({ event }); 46 } catch (error) { 47 return serveOfflinePage(event); 48 } 49 }); 50 51 // precaching the assets 52 // eslint-disable-next-line 53 workbox.precaching.precacheAndRoute( 54 // eslint-disable-next-line no-underscore-dangle 55 (self.__precacheManifest || []).filter(e => { 56 if ( 57 e && 58 e.url && 59 e.url.match && 60 e.url.match(/((login|home|detail|listing)(.+).(js|css)|(offline-dl.html|offline-bv.html|offline.html|offline-g6.html|manifest.json))/) 61 ) { 62 return true; 63 } 64 return false; 65 }), 66 { 67 directoryIndex: null, 68 cleanUrls: false 69 } 70 ); 71 72 // cache seo api call 73 workbox.routing.registerRoute( 74 /api\/pwa\/getSeoContent(.*)/, 75 workbox.strategies.staleWhileRevalidate({ 76 cacheName: 'api-cache', 77 plugins: [ 78 new workbox.expiration.Plugin({ 79 maxEntries: 5, 80 maxAgeSeconds: 18000 // 5 Hours 81 }) 82 ] 83 }) 84 ); 85 86 // cache font files 87 workbox.routing.registerRoute( 88 /\.(?:woff|woff2|ttf)$/, 89 workbox.strategies.cacheFirst({ 90 cacheName: 'font-cache', 91 plugins: [ 92 new workbox.expiration.Plugin({ 93 maxEntries: 10, 94 maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days 95 purgeOnQuotaError: true 96 }), 97 // this enables caching 3rd party response. Beware : if incorrect resource is cached, it won't be updated till it expires 98 new workbox.cacheableResponse.Plugin({ 99 statuses: [0, 200] 100 }) 101 ] 102 }) 103 ); 104} else { 105 console.log(`Boo! Workbox didn't load ð¬`); 106} 107importScripts('https://cdn.moengage.com/webpush/releases/serviceworker_cdn.min.latest.js'); 108
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.