UNPKG

@braze/web-sdk

Version:

Braze SDK for web sites and other JS platforms.

47 lines (46 loc) 1.79 kB
const yt = { pn: () => "serviceWorker" in navigator && "undefined" != typeof ServiceWorkerRegistration && "showNotification" in ServiceWorkerRegistration.prototype && "PushManager" in window, yn: () => "safari" in window && "pushNotification" in window.safari && "function" == typeof window.safari.pushNotification.permission && "function" == typeof window.safari.pushNotification.requestPermission, isPushSupported: () => yt.pn() || yt.yn(), isPushBlocked: () => { const o = yt.isPushSupported() && "Notification" in window && null != window.Notification && null != window.Notification.permission && "denied" === window.Notification.permission, i = yt.isPushSupported() && (!("Notification" in window) || null == window.Notification); return o || i; }, isPushPermissionGranted: () => yt.isPushSupported() && "Notification" in window && null != window.Notification && null != window.Notification.permission && "granted" === window.Notification.permission, Qi: () => yt.isPushBlocked() ? { Ui: !1, reason: "blocked" } : yt.isPushSupported() ? yt.isPushPermissionGranted() ? { Ui: !1, reason: "permissionGranted" } : { Ui: !0 } : { Ui: !1, reason: "unsupported" }, Vi: (o, i) => "blocked" === o ? `${i} containing a push prompt is not being shown because the user has already declined push permission prompt.` : "unsupported" === o ? `${i} containing a push prompt is not being shown because the browser doesn't support push notifications.` : `${i} containing a push prompt is not being shown because the user has already accepted the permission prompt.`, }; export default yt;