PageSourceSearch

https://www.maturefacile.com/webPushWorker.js

js maturefacile.com collected 2026-10-07 21:36:15 UTC 9,192 bytes, 1 lines download raw bytes

1"use strict";const webPushConfig={loggerEnabled:!0},DB_NAME="messageDb",DB_VERSION=6,DB_STORE_NAME="messageStore",MESSAGE_ID=1;let isPushOpening=!1;function setAppBadgeCounter(e){return"setAppBadge"in navigator?e?navigator.setAppBadge(e).then(()=>{webPushConfig.loggerEnabled&&console.log("Set app badge count",e)}).catch(e=>{webPushConfig.loggerEnabled&&console.log("Set app badge count error",e)}):navigator.clearAppBadge().then(()=>{webPushConfig.loggerEnabled&&console.log("Clear app badge count")}).catch(e=>{webPushConfig.loggerEnabled&&console.log("Clear app badge count error",e)}):Promise.resolve()}function updateNotificationsAppBadgeCounter(){return self.registration.getNotifications().then(e=>setAppBadgeCounter(e?e.length:0)).catch(e=>(webPushConfig.loggerEnabled&&console.log("Get notifications error",e),setAppBadgeCounter()))}function track(e,o,n,t){webPushConfig.loggerEnabled&&console.log(`Track worker subscribe ${e}`);let s=`/api/v1/crm/webPush/track?registrationId=${o}&track=${e}`;n&&(s+=`&emlTrack=${n}`),t&&(s+=`&uniqMessageId=${t}`),fetch(s).then(e=>{200===e.status||400===e.status?e.json().then(o=>{400===e.status||o.error?webPushConfig.loggerEnabled&&console.log("Error while track",o):webPushConfig.loggerEnabled&&console.log("Tracked",o)}):webPushConfig.loggerEnabled&&console.log(`Bad response status ${e.status}`)})}function trackClose(e,o){const n=o.emlTrack||"",t=o.uniqMessageId||"";if(!n)return!1;fetch(`/api/v1/crm/webPush/trackClose?registrationId=${e}&emlTrack=${n}&uniqmessageId=${t}`).then(e=>{200===e.status||400===e.status?e.json().then(o=>{400===e.status||o.error?webPushConfig.loggerEnabled&&console.log("Error while track close",o):webPushConfig.loggerEnabled&&console.log("Close Tracked",o)}):webPushConfig.loggerEnabled&&console.log(`Bad response status ${e.status}`)})}function prepareMessageForBrowser(e){return e.icon||(e.icon="data:image/jpeg;base64,/9j/4AA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7rlw7A/QIa7T4baloHjbwJp+ma2lndXljiJoJiN+Uxtde/K4yR7ir9h4Knh+J974vvb5LpHi22se0hoiRtx6YCgjPfceK+bpVFhk6UtGr/ADeyPra1KWKlGtDVS5V6JO7v8zsHqF6lc1C5rhiewyF+tFDdaK2IEWpkNQZ96kQ0mhllDWV4z0BPE/h2fR3vZ7MSkHzIvY9CO49q0lNSK1ZpuMlKO6CUYzi4y2Z4NqHwQ8RRMTY6nptyg6by8bH8MEfrWPd/CTxpbRvK9naNHGpZn
1F2gAA6nkivpZWpXCSRtHIAyMCGUjgg9q7Y5riFvZ/I8uWSYWW118z5MsvCOq3t1Fa2lxpM08rbY401OBmY+gAfNdFB8HPG0hw9tZQ+73IP/AKDmvW/DXwx8M6B4j/tu0+1SSoSYIpZAUhJ4yOMnGeMk/nzXblvetq2azvalt5r/AIJzYfI4ON610/J/8A8L0X4H6oJ0k1TXLa3VSDi1Vnb8CduD7817bCght44Q7uI0C7nOWbAxknuakZqiZq4K2IqYhrnex62GwdHCp+zW4jmoXNOY1E5qYo3Y09aKT8aK0EH4UoOKSikBKrU/c2Plxn3qAHFPVqlxHcST7WfuSBfoBUDR3+f+Ph6tBqcGqHEdyl5Wof8APxJ+dORL8f8ALw34gVc3UhalyDuMjNyPvsrfhTy3HNNLUxmq1EVxWamH6UHmk4q0SH4UUUUALSelFFAC0CiigAyaXcaKKAF3GkyaKKAEOaSiigAooooAWiiigD//2Q=="),e.tag||(e.tag="common"),-1!==navigator.userAgent.indexOf("Firefox")&&(e.tag=`${e.tag}_ff`),e}function showMessage(e,o){o&&!e&&track("message_not_found",o);const n=prepareMessageForBrowser(e||{title:"See what's new!",body:"Stay tuned with the recent activities. Find out what's new!"});return self.registration.showNotification(n.title,{body:n.body,icon:n.icon,image:n.image,requireInteraction:n.requireInteraction,actions:n.actions,tag:n.tag,data:n}).then(updateNotificationsAppBadgeCounter)}function openDb(){return new Promise((e,o)=>{const n=indexedDB.open(DB_NAME,6);n.onerror=e=>{o(e)},n.onsuccess=()=>{e(n.result)},n.onupgradeneeded=()=>{const e=n.result;e.objectStoreNames.contains(DB_STORE_NAME)&&e.deleteObjectStore(DB_STORE_NAME);e.createObjectStore(DB_STORE_NAME,{keyPath:"id"}).createIndex("id","id",{unique:!0})}})}function setMessage(e){return openDb().then(o=>new Promise((n,t)=>{e.id=1;const s=o.transaction(DB_STORE_NAME,"readwrite").objectStore(DB_STORE_NAME).put(e);s.onerror=e=>{t(e)},s.onsuccess=()=>{n(s.result)}})).catch(e=>{webPushConfig.loggerEnabled&&console.log("Cant set message",e)})}function getMessage(){return openDb().then(e=>new Promise((o,n)=>{const t=e.transaction(DB_STORE_NAME,"readonly").objectStore(DB_STORE_NAME).index("id").get(1);t.onsuccess=()=>{void 0!==t.result?o(t.result):n("Message not found in db")}}))}function getSubscriptionId(e){if(e.subscriptionId)return e.subscriptionId;const o=e.endpoint.split("/");return o[o.length-1]}function handleNotificationClose(e){const o=e.notification.data;return self.registration.pushManager.getSubscription().then(e=>{const n=getSubscriptionId(e);if(o)return webPushConfig.loggerEnabled&&console.log("Track message close from event",o),void trackClose(n,o);getMessage().then(e=>{webPushConfig.loggerEnabled&&console.log("Track message close from Storage",e),trackClose(n,e)})}).catch(e=>{webPushConfig.loggerEnabled&&console.log("Message close error",e)})}function handleNotificationClick(e){return Promise.resolve(e.notification.data).then(e=>{e?clients.openWindow(e.url||"/").finally(()=>{isPushOpening=!1}):getMessage().then(e=>{webPushConfig.loggerEnabled&&console.log("Message from db",e),clients.openWindow(e.url||"/").finally(()=>{isPushOpening=!1})}).catch(e=>{webPushConfig.loggerEnabled&&console.log("Message error",e),clients.openWindow("/").finally(()=>{isPushOpening=!1})})})}self.addEventListener("install",e=>{webPushConfig.loggerEnabled&&console.log("install"),e.waitUntil(self.skipWaiting())}),self.addEventListener("activate",e=>{webPushConfig.loggerEnabled&&console.log("activate"),e.waitUntil(self.clients.claim())}),self.addEventListener("push",e=>{webPushConfig.loggerEnabled&&console.log("push delivery",e);const o=e.data&&e.data.json();e.waitUntil(self.registration.pushManager.getSubscription().then(e=>new Promise(o=>{setTimeout(()=>{o(e)},3e3)})).then(e=>{const n=getSubscriptionId(e);return o?(track("delivery",n,o.emlTrack,o.uniqMessageId),setMessage(o).then(()=>showMessage(o))):fetch(`/api/v1/crm/webPush/message?registrationId=${n}&sleep=0`).then(e=>self.registration.getNotifications().then(o=>{if(o&&o.length>0)for(let e=0;e<o.length;e++)o[e].close();return 200!==e.status?(webPushConfig.loggerEnabled&&console.log("Bad response",e.status),showMessage(null,n)):e.json().then(e=>{if(e.error)return webPushConfig.loggerEnabled&&console.log("Error while get message",e.error),showMessage(null,n);const{message:o}=e;return webPushConfig.loggerEnabled&&console.log("Message",o),setMessage(o).then(()=>showMessage(o)).catch(()=>showMessage(o))}).catch(e=>(webPushConfig.loggerEnabled&&console.log("Fetch message error",e),showMessage(null,n)))})).catch(e=>(webPushConfig.loggerEnabled&&console.log("Fetch message error",e),showMessage(null,n)))}).catch(e=>(webPushConfig.loggerEnabled&&console.log("Cant get subscription",e),showMessage())))}),self.addEventListener("notificationclose",e=>{isPushOpening?isPushOpening=!1:(webPushConfig.loggerEnabled&&console.log("push closed",e),e.notification.close(),e.waitUntil(Promise.all([handleNotificationClose(e),updateNotificationsAppBadgeCounter()])))}),self.addEventListener("notificationclick",e=>{isPushOpening=!0,webPushConfig.loggerEnabled&&console.log("push click",e),e.notification.close(),e.waitUntil(Promise.all([handleNotificationClick(e),updateNotificationsAppBadgeCounter()]))});

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.