/*! For license information please see pushengage-web-sdk.js.LICENSE.txt */ (()=>{"use strict";var e={637:(e,t,r)=>{r.r(t),r.d(t,{default:()=>c,detectIncognito:()=>l});var n={d:(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},o={};n.d(o,{A:()=>u,k:()=>s});var i=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},a=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultSubscriptionManagementWidgetSetting=t.skipQueryParamsInWorkerPathSiteIds=t.brandName=t.quieterUIPermissionImage=t.env=t.workerMessengerCommand=t.database=t.defaultMinStorageDuration=t.poweredByReferralUrl=t.pushEngageHomePageUrl=t.defaultNotificationTitle=t.defaultNotificationTag=t.loadingIcon=t.bellPlusIcon=t.bellCheckIcon=t.bellCircleIcon=t.bellRingIcon=t.bellBadgeIcon=t.bellSettingIcon=t.closeIcon=t.bellIcon=t.defaultServiceWorkerSetting=t.widgetOptInType=t.optInTypes=t.storageName=void 0,t.storageName="PushEngageSDK",t.optInTypes={bell:3,floatingBar:2,largeSafari:6,largeSafariWithSegments:8,safari:1,singleStep:4,sleekOptInBox:9},t.widgetOptInType=127,t.defaultServiceWorkerSetting={scope:!0,workerStatus:!0,worker:"service-worker.js"},t.bellIcon='\n\n\n',t.closeIcon='\n\n',t.bellSettingIcon='',t.bellBadgeIcon='',t.bellRingIcon='',t.bellCircleIcon='',t.bellCheckIcon='',t.bellPlusIcon='',t.loadingIcon='',t.defaultNotificationTag="welcome_notification",t.defaultNotificationTitle="Click to see updates",t.pushEngageHomePageUrl="https://www.pushengage.com/",t.poweredByReferralUrl="".concat(t.pushEngageHomePageUrl,"?utm_medium=referral&utm_campaign=powered_by&utm_source=pushengage_sdk"),t.defaultMinStorageDuration=7,t.database={name:"PushEngageSDK",stores:[{name:"ids",keyPath:"id"},{name:"failedViewedNotificationTags",keyPath:"id"},{name:"failedClickedNotificationTags",keyPath:"id"}],version:1},t.workerMessengerCommand={ampSubscriptionState:"amp-web-push-subscription-state",ampSubscribe:"amp-web-push-subscribe",ampUnsubscribe:"amp-web-push-unsubscribe"},t.env={__CDN_SERVER_HOST__:"https://clientcdn.pushengage.com",__SERVER_HOST__:"https://web-sdk.pushengage.com",__SAFARI_WEB_PUSH_PACKAGE_URL__:"https://safari.pushengage.com",__SUBSCRIBER_API_ENDPOINT__:"https://clients-api.pushengage.com/p/v1",__ANALYTICS_API_ENDPOINT__:"https://noti-analytics.pushengage.com/p/v1",__LOG_API_ENDPOINT__:"https://notify.pushengage.com/v1",__DOMAIN_NAME__:"pushengage.com",__OPT_IN_ANALYTICS_API_ENDPOINT__:"https://oeqepmcz7a.execute-api.us-east-1.amazonaws.com/beta/streams/optin/records",__SDK_VERSION__:"3.0.43",__WORKER_VERSION__:"3.0.43",__TABOOLA_API_ENDPOINT__:"https://api.taboola.com/1.2",__TABOOLA_API_KEY__:"a460a30141a022c6dc01526bba996da108798fd0",__TRIGGER_API_ENDPOINT__:"https://m4xrk918t5.execute-api.us-east-1.amazonaws.com/beta/streams/production_triggers/records",__STATIC_STORAGE_ENDPOINT__:"https://assetscdn.pushengage.com"},t.quieterUIPermissionImage={firefox:"".concat(t.env.__STATIC_STORAGE_ENDPOINT__,"/react-dashboard/design/reminder-firefox.png"),chrome:"".concat(t.env.__STATIC_STORAGE_ENDPOINT__,"/react-dashboard/design/reminder-chrome.png")},t.brandName="PushEngage",t.skipQueryParamsInWorkerPathSiteIds=[60413],t.defaultSubscriptionManagementWidgetSetting={enabled:!1,title:"Push Notification Settings",modal_background_color:"#ffffff",modal_text_color:"#0d0d0d",allow_text:"Show Notifications",on_switch_color:"#4642E5",off_switch_color:"#BFBFBF",trigger_button:{enabled:!0,size:"default",position_x:"right",position_y:"bottom",offset_top:100,offset_bottom:100,icon_background_color:"#ffffff",icon_color:"#4642E5",icon_type:"default",z_index:2147483640,rules:{enabled:!1,exclude_countries:[],exclude_devices:[],exclude:{},include_countries:[],include_devices:[],include:{}}},segment_preference:{enabled:!1,subscribed_title:"Subscribed Segments",exclude_subscribed_segments:[],show_all_subscribed_segment:!1,title:"Recommended Segments",segments:[],checkbox_background_color:"#ACB7C8",checkbox_tick_color:"#475FDE",default_segment_selection:!0},unsubscribe_options:{enabled:!1,confirm_message:"Are you sure? You will miss out on all our updates!",ok_text:"Yes",cancel_text:"No",ok_button_background_color:"#475FDE",ok_button_text_color:"#ffffff",cancel_button_background_color:"#ffffff",cancel_button_text_color:"#677489"},personal_notification_options:{enabled:!1,label:"Allow Personalized Notifications"}}},225:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]1)return u.default.warn("Please include our SDK only once on your page for optimal performance as the web push SDK is included more than once."),u.default.warn("The SDK initialization is exiting to prevent errors caused by double initialization, which has occurred ".concat(e," times.")),[2];t=window.PushEngage,r=window._peq,i=(0,s.getSDKInitOptions)(t,r),h=[{check:function(){return!i},message:"Please provide app init options as they are missing.",logType:"error"},{check:function(){return!(null==i?void 0:i.appId)},message:"Please provide a valid appId.",logType:"error"},{check:function(){return!(0,a.isPushNotificationSupported)()},message:"Your browser does not support push notifications.",logType:"warn"},{check:function(){return n(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,(0,c.isPrivateBrowser)()];case 1:return[2,e.sent()]}}))}))},message:"Your browser is in private mode. Push subscription will not work in private mode.",logType:"warn"}],g=0,v=h,w.label=1;case 1:return g-1&&e.splice(r,1),e},t.isObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.get=function(e,t,r){for(var n=e,o=0,i=Array.isArray(t)?t:t.split(".");ot?e.slice(-t):e},t.replaceLastNumberFromIpToZero=function(e,t){if(!e||!t)return t;var r=t.includes(".")?".":":",n=t.split(r);return n[n.length-1]="0",n.join(r)},t.debounce=function(e,t){var r=null;return function(){for(var n=[],o=0;o{Object.defineProperty(t,"__esModule",{value:!0}),t.getChromiumStatus=t.getBrowserInfo=t.detectDeviceType=t.isPrivateBrowser=t.detectBrowser=t.isBrowser=void 0;var n=r(637);t.isBrowser=function(){return"undefined"!=typeof window&&void 0!==window.document},t.detectBrowser=function(e){var t,r,n,o,i,a,s,u,c,l,d;void 0===e&&(e=navigator.userAgent);var f="Unknown",p="";return/Firefox\/\d/.test(e)?(f="Firefox",p=(null===(t=e.match(/Firefox\/(\d+)/))||void 0===t?void 0:t[1])||""):/OPR\/\d/.test(e)?(f="Opera",p=(null===(r=e.match(/OPR\/(\d+)/))||void 0===r?void 0:r[1])||""):/Edg\/\d/.test(e)?(f="Edge",p=(null===(n=e.match(/Edg\/(\d+)/))||void 0===n?void 0:n[1])||""):/Edge\/\d/.test(e)?(f="Edge",p=(null===(o=e.match(/Edge\/(\d+)/))||void 0===o?void 0:o[1])||""):/EdgA\/\d/.test(e)?(f="Edge",p=(null===(i=e.match(/EdgA\/(\d+)/))||void 0===i?void 0:i[1])||""):/UCBrowser\//.test(e)?(f="Ucbrowser",p=(null===(a=e.match(/UCBrowser\/(\d+)/))||void 0===a?void 0:a[1])||""):/SamsungBrowser\//.test(e)?(f="Samsung",p=(null===(s=e.match(/SamsungBrowser\/(\d+)/))||void 0===s?void 0:s[1])||""):/YaBrowser\//.test(e)?(f="Yandex",p=(null===(u=e.match(/YaBrowser\/(\d+)/))||void 0===u?void 0:u[1])||""):/Chrome\//.test(e)?(f="Chrome",p=(null===(c=e.match(/Chrome\/(\d+)/))||void 0===c?void 0:c[1])||""):/Version\//.test(e)?(f="Safari",p=(null===(l=e.match(/Version\/(\d+)/))||void 0===l?void 0:l[1])||""):/MSIE|Trident/.test(e)&&(f="IE",p=(null===(d=e.match(/(?:MSIE |rv:)(\d+)/))||void 0===d?void 0:d[1])||""),p=p.replace(/[^\d.]/g,"").split(".")[0],{name:f,version:Number(p)}},t.isPrivateBrowser=function(){return new Promise((function(e){(0,n.detectIncognito)().then((function(t){e(t.isPrivate)})).catch((function(t){console.debug(t),e(!1)}))}))},t.detectDeviceType=function(e){return void 0===e&&(e=navigator.userAgent),/Mobi/.test(e)?"mobile":"desktop"},t.getBrowserInfo=function(){var e=(0,t.detectBrowser)();return{name:e.name,version:e.version,availableScreen:"".concat(screen.availWidth,"*").concat(screen.availHeight),device:(0,t.detectDeviceType)(),host:location.host,href:location.href,language:navigator.language,pixelDepth:screen.pixelDepth,referrer:document.referrer,screen:"".concat(screen.width,"*").concat(screen.height),userAgent:navigator.userAgent}},t.getChromiumStatus=function(){var e=Boolean(window.chrome),t=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);return e&&t?{isChromium:!0,version:Number(t[2])}:{isChromium:!1,version:0}}},914:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.logDebug=void 0,t.logDebug=function(e){console.debug("PushEngage:",e)}},405:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=c||d.includes(p.status)?[3,8]:[4,u(g)];case 4:return o.sent(),[3,7];case 5:if(v=o.sent(),h>=c){if("TypeError"===v.name&&"Failed to fetch"===v.message&&!navigator.onLine)throw new s.default({message:"Browser is offline. Request not sent.",name:s.default.ERROR_NAME.OfflineError,details:{fetchOptions:f,requestUrl:e}});throw new s.default({message:v.message,name:v.name||s.default.ERROR_NAME.HttpRequestError,details:{fetchOptions:f,requestUrl:e}})}return[4,u(g)];case 6:return o.sent(),[3,7];case 7:return h++,[3,1];case 8:if(!p)throw new s.default({message:"Request failed and no response was received.",name:s.default.ERROR_NAME.HttpRequestError,details:{fetchOptions:f,requestUrl:e}});return[2,p]}}))}))}},607:function(e,t,r){var n=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o{Object.defineProperty(t,"__esModule",{value:!0}),t.getSubdomainFromUrl=t.detectSiteType=t.detectProtocol=t.isLocalhost=t.getQueryParamsFromUrl=t.addQueryParamsToUrl=t.safeDecodeURIComponent=t.getValueFromUrlByKey=t.getUrlObject=void 0,t.getUrlObject=function(e){var t,r=function(e){if("function"!=typeof e||"URL"!==e.name)return!1;var t;try{t=new e("http://example.com")}catch(e){return!1}return"search"in t&&"searchParams"in t&&"origin"in t&&"host"in t};if(r(URL))try{return new URL(e)}catch(e){return null}else try{var n=document.createElement("iframe");document.body.appendChild(n);var o=null===(t=n.contentWindow)||void 0===t?void 0:t.URL;return document.body.removeChild(n),r(o)?new o(e):null}catch(e){return null}},t.getValueFromUrlByKey=function(e,r){try{var n=(0,t.getUrlObject)(r);if(!n)return;return new URLSearchParams(n.search).get(e)||void 0}catch(e){return}},t.safeDecodeURIComponent=function(e,t){void 0===t&&(t=0);for(var r=String(e).split(/(%(?:d0|d1)%.{2})/),n="",o=0,i=r.length;o=3?n[0]:null}catch(e){return null}}},704:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isPushNotificationSupported=t.handlePushEvent=void 0;var o=n(r(607)),i=r(471),a=r(920);t.handlePushEvent=function(){for(var e=[],t=0;t0){var s=a[0],u=a[1];if("init"===s&&"object"==typeof u){r=u;break}}}if(r){if((0,o.isUndefined)(window.dialog_box)||(r.isSubscriptionOnSubDomain=!0),!r.isLegacySDK)return r;if(!Array.isArray(t))return r;var c=!1;for(i=0;i0&&(s=a[0],u=a[1],"init"===s&&(c=!0,("string"==typeof u||Array.isArray(u))&&(r.segment=u)),"config"===s&&"object"==typeof u)){var l={};(0,o.isUndefined)(u.worker)||(l.path=u.worker),(0,o.isUndefined)(u.scope)||(l.scope=u.scope),(0,o.isUndefined)(u.workerStatus)||(l.status=u.workerStatus),(0,o.isEmptyObject)(l)||(r.serviceWorker=l)}return c?r:n(n({},r),{disabledDefaultPrompt:!0})}}},t.isHostPushEngageSubDomain=function(e){return"".concat(e,".").concat(i.env.__DOMAIN_NAME__)===location.host},t.getColorTheme=function(e){var t=e.replace("#","");return(.299*parseInt(t.substring(0,2),16)+.587*parseInt(t.substring(2,4),16)+.114*parseInt(t.substring(4,6),16))/255>.5?"light":"dark"},t.removeSubscriberIdFromTag=function(e){if(!e.includes("-"))return e;var t=e.lastIndexOf("-");return e.substring(0,t)},t.sleep=function(e){return new Promise((function(t){return setTimeout(t,e)}))}},471:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isTokenRefresh=t.getNotificationPermission=t.isUserGestureRequiredForPermissionPrompt=t.isSupportQuieterUI=t.isPushNotificationSupported=t.supportsVapidPush=t.safariWebPushSupported=t.hasSupportForPushApiInSafari=void 0;var n=r(920),o=r(241),i=r(14);t.hasSupportForPushApiInSafari=function(){return"Safari"===(0,n.detectBrowser)().name&&"serviceWorker"in navigator&&"Notification"in window&&"PushManager"in window},t.safariWebPushSupported=function(){var e=(0,n.detectBrowser)(),t=e.name,r=e.version;return"Safari"===t&&r>=11&&"Notification"in window&&"safari"in window&&"pushNotification"in window.safari},t.supportsVapidPush=function(){var e=(0,n.detectBrowser)(),t=e.name,r=e.version,a=(0,n.detectDeviceType)(),s=(0,o.detectSiteType)();return!("Ucbrowser"===t||"Firefox"===t&&(48===r||49===r)||"Opera"===t&&41===r||"Yandex"===t&&"mobile"===a)&&(!!("http"===s&&"Firefox"===t&&r>=50)||"Notification"in window&&"PushManager"in window&&"undefined"!=typeof PushSubscriptionOptions&&(0,i.hasOwn)(PushSubscriptionOptions.prototype,"applicationServerKey"))},t.isPushNotificationSupported=function(){return(0,t.supportsVapidPush)()||(0,t.safariWebPushSupported)()},t.isSupportQuieterUI=function(){var e=(0,n.detectBrowser)(),t=e.name,r=e.version,o=(0,n.detectDeviceType)(),i=(0,n.getChromiumStatus)();return i.isChromium&&i.version>=80||"desktop"===o&&"Firefox"===t&&r>=72},t.isUserGestureRequiredForPermissionPrompt=function(){var e=(0,n.detectBrowser)(),t=e.name,r=e.version;return"Firefox"===t&&r>=72||"Safari"===t||"Yandex"===t},t.getNotificationPermission=function(e){var r=e.safariWebPushId,o=(0,n.detectBrowser)().name;return r&&"Safari"===o&&window.safari&&!(0,t.hasSupportForPushApiInSafari)()?window.safari.pushNotification.permission(r).permission:Notification.permission},t.isTokenRefresh=function(e){var r=e.safariWebPushId;return"granted"===(0,t.getNotificationPermission)({safariWebPushId:r})}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(225)})(); //# sourceMappingURL=pushengage-web-sdk.js.map