{"version":3,"sources":["../webpack/bootstrap","app-react/app-bootstrap/constants.ts","service-worker-starter.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","getDefault","getModuleExports","object","property","prototype","hasOwnProperty","p","s","CGP_OBJECT_NAME","ALL_CONFIGS_KEY","PWA_PROMPT_EVENT","PWA_PROMPT_CALLBACK","PWA_INSTALLED_CALLBACK","window","console","info","isQAEnv","allConfigs","CONSTS","isPWAEnabled","orbit","extraProperties","pwaEnabled","getSwUrl","params","getSwParams","webPushSettings","config","SDK","WebPush","airshipSettings","testSettings","enabled","prodSettings","swBaseUrl","paramsQueryString","encodeURIComponent","JSON","stringify","paths","serviceWorkerBase","savePwaPrompt","addEventListener","e","preventDefault","registerServiceWorker","navigator","swUrl","serviceWorker","register","then","swRegistration","swState","getSwRegistrationState","installing","waiting","active","debug","target","state","catch","err","error"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,oBAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,qBAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,oBAAoBQ,EAAIF,EAGxBN,oBAAoBS,EAAIV,EAGxBC,oBAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,oBAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,oBAAoBkB,EAAI,SAAShB,GACX,qBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,E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SAAWJ,EAAeK,OAWvEH,CAAuBF,GACnCC,GACAA,EAAQV,iBAAiB,eAAe,SAACC,GACrC7B,QAAQ2C,MAAM,mCAAoCd,EAAEe,OAAOC,UAGnE7C,QAAQC,KAAK,gCAAiCoC,EAAgBC,MAEjEQ,OAAM,SAAUC,GACb/C,QAAQgD,MAAM,wCAAyCD,WAG/D/C,QAAQgD,MAAM,8DAmBtBjB,GACF,MAAOgB,GACL/C,QAAQgD,MAAM,wCAAyCD","file":"service-worker-starter.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 743);\n","export const CGP_OBJECT_NAME = 'CGP';\r\nexport const ALL_CONFIGS_KEY = '$allConfigs';\r\nexport const PWA_PROMPT_EVENT = \"pwaPromptEvent\";\r\nexport const PWA_PROMPT_CALLBACK = \"pwaPromptCallback\";\r\nexport const PWA_INSTALLED_CALLBACK = \"pwaInstalledCallback\";\r\nexport const PWA_ISCSTATUS_LOCAL_STORAGE_KEY = \"orbit-pwa-iscstatus\";\r\n","import * as CONSTS from './app-react/app-bootstrap/constants';\r\n\r\nwindow['orbitServiceWorkerStarter'] = () => {\r\n try {\r\n // CAUTION: this function is declared early but should be called after we have window.$allConfigs or if we run in QA mode!!!\r\n console.info('Executing Orbit service worker starter');\r\n\r\n const isQAEnv = window['isQAModeEnabled']? true : false;\r\n const allConfigs: any = window[CONSTS.ALL_CONFIGS_KEY] ? window[CONSTS.ALL_CONFIGS_KEY] : {};\r\n const isPWAEnabled = isQAEnv || allConfigs?.orbit?.extraProperties?.pwaEnabled? true : false;\r\n\r\n const getSwParams = function() {\r\n const params: any = {\r\n isQAEnv: isQAEnv,\r\n pwaEnabled: isPWAEnabled\r\n };\r\n\r\n const webPushSettings = allConfigs?.orbit?.config?.SDK?.WebPush;\r\n if (webPushSettings) {\r\n const airshipSettings = isQAEnv? \r\n webPushSettings?.testSettings :\r\n webPushSettings?.enabled? webPushSettings?.prodSettings : null;\r\n\r\n if (airshipSettings) {\r\n params.airshipSettings = airshipSettings;\r\n }\r\n }\r\n\r\n return params;\r\n }\r\n\r\n const getSwUrl = function() {\r\n const params = getSwParams();\r\n let swBaseUrl = \"/service-worker.js?\";\r\n const paramsQueryString = `params=${encodeURIComponent(JSON.stringify(params))}`;\r\n if (allConfigs?.orbit?.extraProperties?.paths?.serviceWorkerBase) {\r\n swBaseUrl = allConfigs.orbit.extraProperties.paths.serviceWorkerBase;\r\n return swBaseUrl + \"&\" + paramsQueryString;\r\n }\r\n return swBaseUrl + paramsQueryString;\r\n }\r\n\r\n const savePwaPrompt = function () {\r\n window.addEventListener('beforeinstallprompt', function(e) {\r\n console.info(\"PWA beforeinstallprompt handler called\");\r\n // Prevent Chrome 67 and earlier from automatically showing the prompt\r\n e.preventDefault();\r\n if (window[CONSTS.PWA_PROMPT_CALLBACK]) {\r\n // if we have a callback set, call it\r\n window[CONSTS.PWA_PROMPT_CALLBACK](e);\r\n } else {\r\n // stash the event so it can be triggered later\r\n window[CONSTS.PWA_PROMPT_EVENT] = e;\r\n }\r\n });\r\n \r\n window.addEventListener('appinstalled', function(e) {\r\n console.info(\"PWA appinstalled handler called\");\r\n if (window[CONSTS.PWA_INSTALLED_CALLBACK]) {\r\n // if we have a callback set, call it\r\n window[CONSTS.PWA_INSTALLED_CALLBACK](e);\r\n }\r\n });\r\n }\r\n \r\n const getSwRegistrationState = function(swRegistration: ServiceWorkerRegistration) {\r\n const state: ServiceWorker = swRegistration.installing || swRegistration.waiting || swRegistration.active;\r\n return state;\r\n }\r\n \r\n const registerServiceWorker = function () {\r\n if ('serviceWorker' in navigator) {\r\n \r\n const swUrl = getSwUrl();\r\n navigator.serviceWorker\r\n .register(swUrl)\r\n .then(function (swRegistration) {\r\n const swState = getSwRegistrationState(swRegistration);\r\n if (swState) {\r\n swState.addEventListener(\"statechange\", (e: any) => {\r\n console.debug('PWA Service Worker state changed', e.target.state );\r\n });\r\n }\r\n console.info('PWA Service Worker Registered', swRegistration, swState);\r\n })\r\n .catch(function (err) {\r\n console.error('PWA Service Worker failed to register', err);\r\n });\r\n } else {\r\n console.error('PWA issue - navigator.serviceWorker object does not exist!');\r\n }\r\n }\r\n\r\n ////\r\n //main code\r\n ////\r\n\r\n //1. set helper function to get service worker url\r\n window['getOrbitServiceWorkerUrl'] = function() {\r\n return getSwUrl();\r\n }\r\n \r\n //2. if pwa is enabled, run specific code\r\n console.info(`PWA isEnabled: ${isPWAEnabled}`);\r\n if (isPWAEnabled) {\r\n savePwaPrompt();\r\n }\r\n\r\n registerServiceWorker();\r\n } catch (err) {\r\n console.error('Error in Orbit service worker starter', err);\r\n }\r\n}\r\n"],"sourceRoot":""}