{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///alerts.js","webpack:///webpack/bootstrap cd985bea95b94b50751c","webpack:///./src/index.js","webpack:///./package.json","webpack:///./~/push.js/serviceWorker.js","webpack:///./src/controller.js","webpack:///./src/service.js","webpack:///./src/constants.js","webpack:///./src/alert.js","webpack:///./~/push.js/push.js","webpack:///./src/storage.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","VERSION","undefined","_package","_package2","_controller","_controller2","Voonto","ready","then","version","name","description","main","scripts","test","start","build","authors","license","devDependencies","babel-core","babel-loader","babel-polyfill","babel-preset-es2015","chai","chalk","html-webpack-plugin","json-loader","mocha","mocha-loader","mocha-phantomjs","webpack","webpack-shell-plugin","dependencies","push.js","isFunction","toString","runFunctionString","funcStr","trim","length","eval","func","self","addEventListener","event","client","source","onnotificationclose","notification","data","onClose","postMessage","JSON","stringify","action","onnotificationclick","link","origin","href","onClick","substring","indexOf","close","waitUntil","clients","matchAll","type","clientList","full_url","i","url","focus","openWindow","_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","key","protoProps","staticProps","prototype","_service","_service2","_alert","_alert2","_push","_push2","_storage","_storage2","_constants","_Voonto","$","RSVP","Controller","_this","activated","alerts","firstClick","confirmTemplate","html","on","bellButtonClick","bind","addClass","removeClass","forEach","alert","getId","ALERTS_ACTIVE_CLASS","attachEvents","isPushActivated","isAlertsActivated","addConfirmTemplate","addAlertsDeactivatedTemplate","isPushDefault","requestPermission","set","activateButtonClick","ignoreButtonClick","deactivateButtonClick","is","hide","text","markAsView","alert1","alert2","date1","Date","date","date2","trigger","haveLocalStorage","get","Permission","GRANTED","DEFAULT","_this2","Promise","resolve","reject","request","addNewsContainerTemplate","setTimeout","CHECK_DELAY","json","showAlerts","sort","compareAlerts","catch","reason","Error","_this3","item","push","isExpired","show","updateAlertNumber","buildAlerts","jsonResponse","urgente","uuid","title","titular","fechaPublicacion","body","icon","x16","x32","delay","requireInteraction","Service","ajax","dataType","done","hasOwnProperty","fail","jqXHR","textStatus","ACTIVATE_BUTTON","ALERTS_BUTTON","ALERTS_PARENT","ALERTS_CONTAINER","ALERTS_NUMBER","DEACTIVATE_BUTTON","IGNORE_BUTTON","PERMISSION_DENIED","SERVICE_URL","getInstance","lookup","WAS_SHOWN_REASON","moment","locale","Alert","config","shown","viewed","extend","onShow","alertsShown","window","location","relativeTime","fromNow","template","isNew","alertsViewed","updatePanel","wasShown","create","prepend","getNewTemplate","__WEBPACK_AMD_DEFINE_RESULT__","global","document","w","d","Push","isUndefined","isString","currentId","incompatibilityErrorMessage","notifications","closeNotification","errored","cancel","external","msIsSiteMode","msSiteModeClearIconOverlay","removeNotification","addNotification","dict","success","prepareNotification","options","wrapper","timeout","createCallback","lastWorkerPath","serviceWorker","Notification","tag","silent","e","navigator","register","registration","localData","assign","showNotification","vibrate","getNotifications","active","parse","Number","isInteger","webkitNotifications","createNotification","mozNotification","msSiteModeSetIconOverlay","msSiteModeActivate","onError","DENIED","Permissions","onGranted","onDenied","existing","isSupported","callback","result","checkPermission","has","permission","permissionLevel","promiseCallback","count","__lastWorkerPath","clear","Storage","localStorage"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,OAAAD,IAEAD,EAAA,OAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAq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,GAAOjC,KAAKC,UAAUvD,OVgxCpCuF,IAAK,MACLvF,MAAO,SU7wCCuF,GACT,MAAIwM,GAAQlJ,mBACHvF,KAAKgN,MAAM0B,aAAazM,IAAQjC,KAAKC,eAGvC,SVixCDwO,IAGTpT,GAAQkB,QUhxCMkS","file":"alerts.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Alerts\"] = factory();\n\telse\n\t\troot[\"Alerts\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Alerts\"] = factory();\n\telse\n\t\troot[\"Alerts\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \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/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tmodule.exports = __webpack_require__(1);\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.VERSION = undefined;\n\t\n\tvar _package = __webpack_require__(2);\n\t\n\tvar _package2 = _interopRequireDefault(_package);\n\t\n\t__webpack_require__(3);\n\t\n\tvar _controller = __webpack_require__(4);\n\t\n\tvar _controller2 = _interopRequireDefault(_controller);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tVoonto.ready.then(function () /*app*/{\n\t new _controller2.default();\n\t});\n\t\n\tvar VERSION = exports.VERSION = _package2.default.version;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\n\tmodule.exports = {\n\t\t\"name\": \"alerts\",\n\t\t\"version\": \"1.0.6\",\n\t\t\"description\": \"\",\n\t\t\"main\": \"src/index.js\",\n\t\t\"scripts\": {\n\t\t\t\"test\": \"./node_modules/.bin/webpack && ./node_modules/.bin/mocha-phantomjs dist/spec/index.html --reporter xunit --file test-results.xml\",\n\t\t\t\"start\": \"webpack-dev-server\",\n\t\t\t\"build\": \"./node_modules/.bin/webpack\"\n\t\t},\n\t\t\"authors\": [\n\t\t\t\"Iván Pérez \",\n\t\t\t\"Ernesto V. \"\n\t\t],\n\t\t\"license\": \"SEE LICENSE IN LICENSE.md\",\n\t\t\"devDependencies\": {\n\t\t\t\"babel-core\": \"^6.17.0\",\n\t\t\t\"babel-loader\": \"^6.2.5\",\n\t\t\t\"babel-polyfill\": \"^6.16.0\",\n\t\t\t\"babel-preset-es2015\": \"^6.16.0\",\n\t\t\t\"chai\": \"^3.5.0\",\n\t\t\t\"chalk\": \"^1.1.3\",\n\t\t\t\"html-webpack-plugin\": \"^2.24.1\",\n\t\t\t\"json-loader\": \"^0.5.4\",\n\t\t\t\"mocha\": \"^3.1.0\",\n\t\t\t\"mocha-loader\": \"^1.0.0\",\n\t\t\t\"mocha-phantomjs\": \"^4.1.0\",\n\t\t\t\"webpack\": \"^1.13.3\",\n\t\t\t\"webpack-shell-plugin\": \"^0.4.3\"\n\t\t},\n\t\t\"dependencies\": {\n\t\t\t\"push.js\": \"0.0.13\"\n\t\t}\n\t};\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n\tvar isFunction = function (obj) { return obj && {}.toString.call(obj) === '[object Function]'; },\n\t\n\trunFunctionString = function(funcStr) {\n\t if (funcStr.trim().length > 0) {\n\t eval('var func = ' + funcStr);\n\t if (isFunction(func))\n\t func();\n\t }\n\t};\n\t\n\tself.addEventListener('message', function(event) {\n\t self.client = event.source;\n\t});\n\t\n\tself.onnotificationclose = function (event) {\n\t runFunctionString(event.notification.data.onClose);\n\t\n\t /* Tell Push to execute close callback */\n\t self.client.postMessage(JSON.stringify({\n\t id: event.notification.data.id,\n\t action: 'close'\n\t }));\n\t};\n\t\n\tself.onnotificationclick = function (event) {\n\t var link, origin, href;\n\t\n\t runFunctionString(event.notification.data.onClick);\n\t\n\t if (typeof event.notification.data.link !== 'undefined' && event.notification.data.link !== null) {\n\t origin = event.notification.data.origin;\n\t link = event.notification.data.link;\n\t href = origin.substring(0, origin.indexOf('/', 8)) + '/';\n\t\n\t event.notification.close();\n\t\n\t // This looks to see if the current is already open and focuses if it is\n\t event.waitUntil(clients.matchAll({\n\t type: \"window\"\n\t }).then(function (clientList) {\n\t var client, full_url;\n\t\n\t for (var i = 0; i < clientList.length; i++) {\n\t client = clientList[i];\n\t full_url = href + link;\n\t\n\t if (full_url[full_url.length - 1] !== '/' && client.url[client.url.length - 1] == '/')\n\t full_url += '/';\n\t\n\t if ((client.url == full_url) && ('focus' in client))\n\t return client.focus();\n\t }\n\t\n\t if (clients.openWindow)\n\t return clients.openWindow('/' + link);\n\t }));\n\t }\n\t};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _service = __webpack_require__(5);\n\t\n\tvar _service2 = _interopRequireDefault(_service);\n\t\n\tvar _alert = __webpack_require__(7);\n\t\n\tvar _alert2 = _interopRequireDefault(_alert);\n\t\n\tvar _push = __webpack_require__(8);\n\t\n\tvar _push2 = _interopRequireDefault(_push);\n\t\n\tvar _storage = __webpack_require__(9);\n\t\n\tvar _storage2 = _interopRequireDefault(_storage);\n\t\n\tvar _constants = __webpack_require__(6);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar _Voonto = Voonto,\n\t $ = _Voonto.$,\n\t RSVP = _Voonto.RSVP;\n\t\n\tvar Controller = function () {\n\t function Controller() {\n\t var _this = this;\n\t\n\t _classCallCheck(this, Controller);\n\t\n\t this.activated = false;\n\t this.alerts = [];\n\t this.firstClick = false; // NOTE: flag to control the firstClick\n\t this.confirmTemplate = $(_constants.ALERTS_PARENT).html();\n\t\n\t $(_constants.ALERTS_BUTTON).on('click', this.bellButtonClick.bind(this));\n\t $(_constants.ALERTS_PARENT).on('hide.bs.collapse', function (event) {\n\t $(event.target).addClass('hide');\n\t }).on('hidden.bs.collapse', function (event) {\n\t $(event.target).removeClass('hide');\n\t _this.alerts.forEach(function (alert) {\n\t $('#' + alert.getId() + ' a').removeClass(_constants.ALERTS_ACTIVE_CLASS);\n\t });\n\t });\n\t this.attachEvents();\n\t\n\t if (!this.isPushActivated()) {\n\t this.addAlertsDeactivatedTemplate();\n\t } else if (!this.isAlertsActivated()) {\n\t this.addConfirmTemplate();\n\t }\n\t\n\t if (this.isPushDefault() || this.isPushActivated() && this.isAlertsActivated()) {\n\t this.requestPermission();\n\t }\n\t }\n\t\n\t _createClass(Controller, [{\n\t key: 'activateButtonClick',\n\t value: function activateButtonClick() {\n\t _storage2.default.set('alertsActive', 1);\n\t this.activated = true;\n\t this.requestPermission();\n\t }\n\t }, {\n\t key: 'addAlertsDeactivatedTemplate',\n\t value: function addAlertsDeactivatedTemplate() {\n\t $(_constants.ALERTS_PARENT).html('\\n
\\n Si quieres que funcionen las alertas debes activarlas en tu navegador.\\n
\\n ');\n\t }\n\t }, {\n\t key: 'addConfirmTemplate',\n\t value: function addConfirmTemplate() {\n\t $(_constants.ALERTS_PARENT).html(this.confirmTemplate);\n\t this.attachEvents();\n\t }\n\t }, {\n\t key: 'addNewsContainerTemplate',\n\t value: function addNewsContainerTemplate() {\n\t $('[data-target=\"' + _constants.ALERTS_PARENT + '\"]').html('\\n \\n 0\\n ');\n\t $(_constants.ALERTS_PARENT).html('\\n \\n ');\n\t this.attachEvents();\n\t }\n\t }, {\n\t key: 'attachEvents',\n\t value: function attachEvents() {\n\t $(_constants.ACTIVATE_BUTTON).on('click', this.activateButtonClick.bind(this));\n\t $(_constants.IGNORE_BUTTON).on('click', this.ignoreButtonClick.bind(this));\n\t $(_constants.DEACTIVATE_BUTTON).on('click', this.deactivateButtonClick.bind(this));\n\t }\n\t }, {\n\t key: 'bellButtonClick',\n\t value: function bellButtonClick() {\n\t if (this.isAlertsActivated()) {\n\t if ($(_constants.ALERTS_CONTAINER).is(':not(:visible)')) {\n\t $(_constants.ALERTS_NUMBER).hide().text('');\n\t\n\t if (!this.firstClick) {\n\t this.alerts.forEach(function (alert) {\n\t alert.markAsView();\n\t });\n\t }\n\t this.firstClick = true;\n\t }\n\t }\n\t }\n\t }, {\n\t key: 'compareAlerts',\n\t value: function compareAlerts(alert1, alert2) {\n\t var date1 = new Date(alert1.date);\n\t var date2 = new Date(alert2.date);\n\t return date1 - date2;\n\t }\n\t }, {\n\t key: 'deactivateButtonClick',\n\t value: function deactivateButtonClick() {\n\t _storage2.default.set('alertsActive', 0);\n\t this.activated = false;\n\t this.addConfirmTemplate();\n\t }\n\t }, {\n\t key: 'ignoreButtonClick',\n\t value: function ignoreButtonClick() {\n\t $(_constants.ALERTS_BUTTON).trigger('click');\n\t }\n\t }, {\n\t key: 'isAlertsActivated',\n\t value: function isAlertsActivated() {\n\t return _storage2.default.haveLocalStorage() && _storage2.default.get('alertsActive') === 1 || this.activated === true;\n\t }\n\t }, {\n\t key: 'isPushActivated',\n\t value: function isPushActivated() {\n\t return _push2.default.Permission.GRANTED === _push2.default.Permission.get();\n\t }\n\t }, {\n\t key: 'isPushDefault',\n\t value: function isPushDefault() {\n\t return _push2.default.Permission.DEFAULT === _push2.default.Permission.get();\n\t }\n\t }, {\n\t key: 'requestPermission',\n\t value: function requestPermission() {\n\t var _this2 = this;\n\t\n\t return new RSVP.Promise(function (resolve, reject) {\n\t _push2.default.Permission.request(resolve, function () {\n\t reject(_constants.PERMISSION_DENIED);\n\t });\n\t }).then(function () {\n\t _this2.addNewsContainerTemplate();\n\t return new RSVP.Promise(function (resolve) {\n\t setTimeout(resolve, _constants.CHECK_DELAY);\n\t });\n\t }).then(function () {\n\t return _service2.default.get();\n\t }).then(function (json) {\n\t _this2.showAlerts(json.alerts.sort(_this2.compareAlerts));\n\t }).catch(function (reason) {\n\t if (reason !== _constants.PERMISSION_DENIED) {\n\t throw new Error(reason);\n\t } else {\n\t _this2.addAlertsDeactivatedTemplate();\n\t }\n\t });\n\t }\n\t }, {\n\t key: 'showAlerts',\n\t value: function showAlerts(alerts) {\n\t var _this3 = this;\n\t\n\t alerts.forEach(function (item) {\n\t var alert = new _alert2.default(item);\n\t _this3.alerts.push(alert);\n\t if (!alert.isExpired()) {\n\t alert.show().then(function () {\n\t _this3.updateAlertNumber();\n\t }).catch(function (reason) {\n\t if (reason === _constants.WAS_SHOWN_REASON) {\n\t _this3.updateAlertNumber();\n\t } else {\n\t throw reason;\n\t }\n\t });\n\t }\n\t });\n\t }\n\t }, {\n\t key: 'updateAlertNumber',\n\t value: function updateAlertNumber() {\n\t // Update the number of notifications\n\t if ($('.' + _constants.ALERTS_ACTIVE_CLASS, _constants.ALERTS_CONTAINER).length) {\n\t $(_constants.ALERTS_NUMBER).removeClass('hide').show().text($('.' + _constants.ALERTS_ACTIVE_CLASS, _constants.ALERTS_CONTAINER).length);\n\t }\n\t this.firstClick = false;\n\t }\n\t }]);\n\t\n\t return Controller;\n\t}();\n\t\n\texports.default = Controller;\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _constants = __webpack_require__(6);\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar _Voonto = Voonto,\n\t $ = _Voonto.$,\n\t RSVP = _Voonto.RSVP;\n\t\n\tvar Service = function () {\n\t function Service() {\n\t _classCallCheck(this, Service);\n\t }\n\t\n\t _createClass(Service, null, [{\n\t key: 'get',\n\t value: function get() {\n\t return new RSVP.Promise(function (resolve, reject) {\n\t $.ajax({\n\t url: _constants.SERVICE_URL,\n\t dataType: 'json'\n\t }).done(function (json) {\n\t if (typeof json.hasOwnProperty !== 'function' || !json.hasOwnProperty('urgente')) {\n\t // NOTE: Alerts with incorrect JSON format\n\t reject('No alerts');\n\t }\n\t\n\t resolve(buildAlerts(json));\n\t }).fail(function (jqXHR, textStatus) {\n\t // NOTE: Problem with ajax call\n\t reject('SERVICE: ' + textStatus);\n\t });\n\t });\n\t }\n\t }]);\n\t\n\t return Service;\n\t}();\n\t\n\texports.default = Service;\n\t\n\t/* private */\n\t\n\tfunction buildAlerts(jsonResponse) {\n\t var json = {\n\t alerts: []\n\t };\n\t\n\t jsonResponse.urgente.forEach(function (alert) {\n\t json.alerts.push({\n\t id: alert.uuid,\n\t title: alert.titular,\n\t link: alert.href,\n\t date: alert.fechaPublicacion,\n\t body: alert.body || '',\n\t icon: {\n\t x16: alert.icon && alert.icon.x16 ? alert.icon.x16 : '',\n\t x32: alert.icon && alert.icon.x32 ? alert.icon.x32 : ''\n\t },\n\t delay: alert.delay || 0,\n\t requireInteraction: alert.requireInteraction || false\n\t });\n\t });\n\t\n\t return json;\n\t}\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\tvar ACTIVATE_BUTTON = exports.ACTIVATE_BUTTON = '#alerts .voc-alerts-content .voc-button-white-red';\n\tvar ALERTS_BUTTON = exports.ALERTS_BUTTON = '[data-voc-alerts] [data-target=\"#alerts\"]';\n\tvar ALERTS_PARENT = exports.ALERTS_PARENT = '#alerts';\n\tvar ALERTS_CONTAINER = exports.ALERTS_CONTAINER = '#alerts .voc-alerts-news ul';\n\tvar ALERTS_ACTIVE_CLASS = exports.ALERTS_ACTIVE_CLASS = 'active';\n\tvar ALERTS_NUMBER = exports.ALERTS_NUMBER = '[data-voc-alerts] [data-target=\"#alerts\"] .voc-alert-number';\n\tvar CHECK_DELAY = exports.CHECK_DELAY = 1000;\n\tvar DEACTIVATE_BUTTON = exports.DEACTIVATE_BUTTON = '#alerts .voc-alerts-deactivate';\n\tvar IGNORE_BUTTON = exports.IGNORE_BUTTON = '#alerts .voc-alerts-ignore';\n\tvar PERMISSION_DENIED = exports.PERMISSION_DENIED = 'PERMISSION_DENIED';\n\tvar SERVICE_URL = exports.SERVICE_URL = Voonto.getInstance().lookup('vocento.config.alerts.serviceUrl');\n\tvar WAS_SHOWN_REASON = exports.WAS_SHOWN_REASON = 'ALERT_WAS_SHOWN';\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _push = __webpack_require__(8);\n\t\n\tvar _push2 = _interopRequireDefault(_push);\n\t\n\tvar _storage = __webpack_require__(9);\n\t\n\tvar _storage2 = _interopRequireDefault(_storage);\n\t\n\tvar _constants = __webpack_require__(6);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar _Voonto = Voonto,\n\t $ = _Voonto.$,\n\t RSVP = _Voonto.RSVP,\n\t moment = _Voonto.moment;\n\t\n\t\n\tmoment.locale('es');\n\t\n\tvar Alert = function () {\n\t function Alert(config) {\n\t var _this = this;\n\t\n\t _classCallCheck(this, Alert);\n\t\n\t this.config = config;\n\t this.shown = false;\n\t this.viewed = false;\n\t\n\t this.config = $.extend(config, {\n\t onShow: function onShow() {\n\t if (_storage2.default.haveLocalStorage()) {\n\t var alertsShown = _storage2.default.get('alertsShown');\n\t alertsShown[_this.config.id] = _this.config.date;\n\t _storage2.default.set('alertsShown', alertsShown);\n\t }\n\t _this.shown = true;\n\t }\n\t });\n\t\n\t if (config.link) {\n\t this.config = $.extend(config, {\n\t onClick: function onClick() {\n\t return window.location = _this.config.link;\n\t }\n\t });\n\t }\n\t }\n\t\n\t _createClass(Alert, [{\n\t key: 'getId',\n\t value: function getId() {\n\t return this.config.id;\n\t }\n\t\n\t /**\n\t * Build the notification template\n\t */\n\t\n\t }, {\n\t key: 'getNewTemplate',\n\t value: function getNewTemplate() {\n\t var relativeTime = moment(this.config.date).fromNow();\n\t var title = this.config.title;\n\t var link = this.config.link || '#';\n\t\n\t var template = $('\\n
  • \\n ' + relativeTime + '\\n \\n ' + title + '\\n \\n
  • \\n ');\n\t\n\t if (this.isNew()) {\n\t $('a', template).addClass(_constants.ALERTS_ACTIVE_CLASS);\n\t }\n\t\n\t return template;\n\t }\n\t\n\t /**\n\t * Return if the alert is expired\n\t */\n\t\n\t }, {\n\t key: 'isExpired',\n\t value: function isExpired() {\n\t //return moment().subtract(EXPIRATION_PERIOD, 'hours') > moment(this.config.date)\n\t return false;\n\t }\n\t }, {\n\t key: 'isNew',\n\t value: function isNew() {\n\t if (_storage2.default.haveLocalStorage() && _storage2.default.get('alertsViewed')) {\n\t var alertsViewed = _storage2.default.get('alertsViewed');\n\t this.viewed = alertsViewed[this.config.id] ? true : false;\n\t }\n\t\n\t return !this.viewed;\n\t }\n\t }, {\n\t key: 'markAsView',\n\t value: function markAsView() {\n\t if (!this.viewed) {\n\t if (_storage2.default.haveLocalStorage()) {\n\t var alertsViewed = _storage2.default.get('alertsViewed');\n\t alertsViewed[this.config.id] = this.config.date;\n\t _storage2.default.set('alertsViewed', alertsViewed);\n\t }\n\t this.viewed = true;\n\t }\n\t }\n\t }, {\n\t key: 'show',\n\t value: function show() {\n\t var _this2 = this;\n\t\n\t return new RSVP.Promise(function (resolve) {\n\t if (!_this2.isNew()) {\n\t resolve();\n\t } else {\n\t setTimeout(resolve, _this2.config.delay || 0);\n\t }\n\t }).then(function () {\n\t _this2.updatePanel();\n\t\n\t // Check if the Notification Was Shown(NWS) previously\n\t if (_this2.wasShown()) {\n\t return Promise.reject(_constants.WAS_SHOWN_REASON);\n\t }\n\t\n\t return _push2.default.create(_this2.config.title, _this2.config);\n\t });\n\t }\n\t\n\t /**\n\t * Update the notifications on header notifications panel\n\t */\n\t\n\t }, {\n\t key: 'updatePanel',\n\t value: function updatePanel() {\n\t // Insert the new notification to panel\n\t $(_constants.ALERTS_CONTAINER).prepend(this.getNewTemplate());\n\t }\n\t\n\t /**\n\t * The alert was shown\n\t */\n\t\n\t }, {\n\t key: 'wasShown',\n\t value: function wasShown() {\n\t if (_storage2.default.haveLocalStorage() && _storage2.default.get('alertsShown')) {\n\t var alertsShown = _storage2.default.get('alertsShown');\n\t this.shown = alertsShown[this.config.id] ? true : false;\n\t }\n\t\n\t return this.shown;\n\t }\n\t }]);\n\t\n\t return Alert;\n\t}();\n\t\n\texports.default = Alert;\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_RESULT__;/**\n\t * Push\n\t * =======\n\t * A compact, cross-browser solution for the JavaScript Notifications API\n\t *\n\t * Credits\n\t * -------\n\t * Tsvetan Tsvetkov (ttsvetko)\n\t * Alex Gibson (alexgibson)\n\t *\n\t * License\n\t * -------\n\t *\n\t * The MIT License (MIT)\n\t *\n\t * Copyright (c) 2015-2017 Tyler Nickerson\n\t *\n\t * Permission is hereby granted, free of charge, to any person obtaining a copy\n\t * of this software and associated documentation files (the \"Software\"), to deal\n\t * in the Software without restriction, including without limitation the rights\n\t * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\t * copies of the Software, and to permit persons to whom the Software is\n\t * furnished to do so, subject to the following conditions:\n\t *\n\t * The above copyright notice and this permission notice shall be included in\n\t * all copies or substantial portions of the Software.\n\t *\n\t * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\t * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\t * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\t * THE SOFTWARE.\n\t *\n\t * @preserve\n\t */\n\t\n\t(function (global, factory) {\n\t\n\t 'use strict';\n\t\n\t /* Use AMD */\n\t if (true) {\n\t !(__WEBPACK_AMD_DEFINE_RESULT__ = function () {\n\t return new (factory(global, global.document))();\n\t }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t }\n\t /* Use CommonJS */\n\t else if (typeof module !== 'undefined' && module.exports) {\n\t module.exports = new (factory(global, global.document))();\n\t }\n\t /* Use Browser */\n\t else {\n\t global.Push = new (factory(global, global.document))();\n\t }\n\t\n\t})(typeof window !== 'undefined' ? window : this, function (w, d) {\n\t\n\t var Push = function () {\n\t\n\t /**********************\n\t Local Variables\n\t /**********************/\n\t\n\t var\n\t self = this,\n\t isUndefined = function (obj) { return obj === undefined; },\n\t isString = function (obj) { return typeof obj === 'string' },\n\t isFunction = function (obj) { return obj && {}.toString.call(obj) === '[object Function]'; },\n\t\n\t /* ID to use for new notifications */\n\t currentId = 0,\n\t\n\t /* Message to show if there is no suport to Push Notifications */\n\t incompatibilityErrorMessage = 'PushError: push.js is incompatible with browser.',\n\t\n\t /* Map of open notifications */\n\t notifications = {},\n\t\n\t /* Testing variable for the last service worker path used */\n\t lastWorkerPath = null,\n\t\n\t /**********************\n\t Helper Functions\n\t /**********************/\n\t\n\t /**\n\t * Closes a notification\n\t * @param {Notification} notification\n\t * @return {Boolean} boolean denoting whether the operation was successful\n\t */\n\t closeNotification = function (id) {\n\t var errored = false,\n\t notification = notifications[id];\n\t\n\t if (typeof notification !== 'undefined') {\n\t /* Safari 6+, Chrome 23+ */\n\t if (notification.close) {\n\t notification.close();\n\t /* Legacy webkit browsers */\n\t } else if (notification.cancel) {\n\t notification.cancel();\n\t /* IE9+ */\n\t } else if (w.external && w.external.msIsSiteMode) {\n\t w.external.msSiteModeClearIconOverlay();\n\t } else {\n\t errored = true;\n\t throw new Error('Unable to close notification: unknown interface');\n\t }\n\t\n\t if (!errored) {\n\t return removeNotification(id);\n\t }\n\t }\n\t\n\t return false;\n\t },\n\t\n\t /**\n\t * Adds a notification to the global dictionary of notifications\n\t * @param {Notification} notification\n\t * @return {Integer} Dictionary key of the notification\n\t */\n\t addNotification = function (notification) {\n\t var id = currentId;\n\t notifications[id] = notification;\n\t currentId++;\n\t return id;\n\t },\n\t\n\t /**\n\t * Removes a notification with the given ID\n\t * @param {Integer} id - Dictionary key/ID of the notification to remove\n\t * @return {Boolean} boolean denoting success\n\t */\n\t removeNotification = function (id) {\n\t var dict = {},\n\t success = false,\n\t key;\n\t\n\t for (key in notifications) {\n\t if (notifications.hasOwnProperty(key)) {\n\t if (key != id) {\n\t dict[key] = notifications[key];\n\t } else {\n\t // We're successful if we omit the given ID from the new array\n\t success = true;\n\t }\n\t }\n\t }\n\t // Overwrite the current notifications dictionary with the filtered one\n\t notifications = dict;\n\t return success;\n\t },\n\t\n\t prepareNotification = function (id, options) {\n\t var wrapper;\n\t\n\t /* Wrapper used to get/close notification later on */\n\t wrapper = {\n\t get: function () {\n\t return notifications[id];\n\t },\n\t\n\t close: function () {\n\t closeNotification(id);\n\t }\n\t };\n\t\n\t /* Autoclose timeout */\n\t if (options.timeout) {\n\t setTimeout(function () {\n\t wrapper.close();\n\t }, options.timeout);\n\t }\n\t\n\t return wrapper;\n\t },\n\t\n\t /**\n\t * Callback function for the 'create' method\n\t * @return {void}\n\t */\n\t createCallback = function (title, options, resolve) {\n\t var notification,\n\t onClose;\n\t\n\t /* Set empty settings if none are specified */\n\t options = options || {};\n\t\n\t /* Set the last service worker path for testing */\n\t self.lastWorkerPath = options.serviceWorker || 'serviceWorker.js';\n\t\n\t /* onClose event handler */\n\t onClose = function (id) {\n\t /* A bit redundant, but covers the cases when close() isn't explicitly called */\n\t removeNotification(id);\n\t if (isFunction(options.onClose)) {\n\t options.onClose.call(this, notification);\n\t }\n\t };\n\t\n\t /* Safari 6+, Firefox 22+, Chrome 22+, Opera 25+ */\n\t if (w.Notification) {\n\t try {\n\t notification = new w.Notification(\n\t title,\n\t {\n\t icon: (isString(options.icon) || isUndefined(options.icon)) ? options.icon : options.icon.x32,\n\t body: options.body,\n\t tag: options.tag,\n\t requireInteraction: options.requireInteraction,\n\t silent: options.silent\n\t }\n\t );\n\t } catch (e) {\n\t if (w.navigator) {\n\t /* Register ServiceWorker using lastWorkerPath */\n\t w.navigator.serviceWorker.register(self.lastWorkerPath);\n\t w.navigator.serviceWorker.ready.then(function(registration) {\n\t var localData = {\n\t id: currentId,\n\t link: options.link,\n\t origin: document.location.href,\n\t onClick: (isFunction(options.onClick)) ? options.onClick.toString() : '',\n\t onClose: (isFunction(options.onClose)) ? options.onClose.toString() : ''\n\t };\n\t\n\t if (typeof options.data !== 'undefined' && options.data !== null)\n\t localData = Object.assign(localData, options.data);\n\t\n\t /* Show the notification */\n\t registration.showNotification(\n\t title,\n\t {\n\t icon: options.icon,\n\t body: options.body,\n\t vibrate: options.vibrate,\n\t tag: options.tag,\n\t data: localData,\n\t requireInteraction: options.requireInteraction\n\t }\n\t ).then(function() {\n\t var id;\n\t\n\t /* Find the most recent notification and add it to the global array */\n\t registration.getNotifications().then(function(notifications) {\n\t id = addNotification(notifications[notifications.length - 1]);\n\t\n\t /* Send an empty message so the ServiceWorker knows who the client is */\n\t registration.active.postMessage('');\n\t\n\t /* Listen for close requests from the ServiceWorker */\n\t navigator.serviceWorker.addEventListener('message', function (event) {\n\t var data = JSON.parse(event.data);\n\t\n\t if (data.action === 'close' && Number.isInteger(data.id))\n\t removeNotification(data.id);\n\t });\n\t\n\t resolve(prepareNotification(id, options));\n\t });\n\t });\n\t });\n\t }\n\t }\n\t\n\t /* Legacy webkit browsers */\n\t } else if (w.webkitNotifications) {\n\t\n\t notification = w.webkitNotifications.createNotification(\n\t options.icon,\n\t title,\n\t options.body\n\t );\n\t\n\t notification.show();\n\t\n\t /* Firefox Mobile */\n\t } else if (navigator.mozNotification) {\n\t\n\t notification = navigator.mozNotification.createNotification(\n\t title,\n\t options.body,\n\t options.icon\n\t );\n\t\n\t notification.show();\n\t\n\t /* IE9+ */\n\t } else if (w.external && w.external.msIsSiteMode()) {\n\t\n\t //Clear any previous notifications\n\t w.external.msSiteModeClearIconOverlay();\n\t w.external.msSiteModeSetIconOverlay(\n\t ((isString(options.icon) || isUndefined(options.icon))\n\t ? options.icon\n\t : options.icon.x16), title\n\t );\n\t w.external.msSiteModeActivate();\n\t\n\t notification = {};\n\t } else {\n\t throw new Error('Unable to create notification: unknown interface');\n\t }\n\t\n\t if (typeof(notification) !== 'undefined') {\n\t var id = addNotification(notification),\n\t wrapper = prepareNotification(id, options);\n\t\n\t /* Notification callbacks */\n\t if (isFunction(options.onShow))\n\t notification.addEventListener('show', options.onShow);\n\t\n\t if (isFunction(options.onError))\n\t notification.addEventListener('error', options.onError);\n\t\n\t if (isFunction(options.onClick))\n\t notification.addEventListener('click', options.onClick);\n\t\n\t notification.addEventListener('close', function() {\n\t onClose(id);\n\t });\n\t\n\t notification.addEventListener('cancel', function() {\n\t onClose(id);\n\t });\n\t\n\t /* Return the wrapper so the user can call close() */\n\t resolve(wrapper);\n\t }\n\t\n\t resolve({}); // By default, pass an empty wrapper\n\t },\n\t\n\t /**\n\t * Permission types\n\t * @enum {String}\n\t */\n\t Permission = {\n\t DEFAULT: 'default',\n\t GRANTED: 'granted',\n\t DENIED: 'denied'\n\t },\n\t\n\t Permissions = [Permission.GRANTED, Permission.DEFAULT, Permission.DENIED];\n\t\n\t /* Allow enums to be accessible from Push object */\n\t self.Permission = Permission;\n\t\n\t /*****************\n\t Permissions\n\t /*****************/\n\t\n\t /**\n\t * Requests permission for desktop notifications\n\t * @param {Function} callback - Function to execute once permission is granted\n\t * @return {void}\n\t */\n\t self.Permission.request = function (onGranted, onDenied) {\n\t var existing = self.Permission.get();\n\t\n\t /* Return if Push not supported */\n\t if (!self.isSupported) {\n\t throw new Error(incompatibilityErrorMessage);\n\t }\n\t\n\t /* Default callback */\n\t callback = function (result) {\n\t switch (result) {\n\t\n\t case self.Permission.GRANTED:\n\t if (onGranted) onGranted();\n\t break;\n\t\n\t case self.Permission.DENIED:\n\t if (onDenied) onDenied();\n\t break;\n\t\n\t }\n\t\n\t };\n\t\n\t /* Permissions already set */\n\t if (existing !== self.Permission.DEFAULT) {\n\t callback(existing);\n\t }\n\t /* Safari 6+, Chrome 23+ */\n\t else if (w.Notification && w.Notification.requestPermission) {\n\t Notification.requestPermission(callback);\n\t }\n\t /* Legacy webkit browsers */\n\t else if (w.webkitNotifications && w.webkitNotifications.checkPermission) {\n\t w.webkitNotifications.requestPermission(callback);\n\t } else {\n\t throw new Error(incompatibilityErrorMessage);\n\t }\n\t };\n\t\n\t /**\n\t * Returns whether Push has been granted permission to run\n\t * @return {Boolean}\n\t */\n\t self.Permission.has = function () {\n\t return Permission.get() === Permission.GRANTED;\n\t };\n\t\n\t /**\n\t * Gets the permission level\n\t * @return {Permission} The permission level\n\t */\n\t self.Permission.get = function () {\n\t\n\t var permission;\n\t\n\t /* Return if Push not supported */\n\t if (!self.isSupported) { throw new Error(incompatibilityErrorMessage); }\n\t\n\t /* Safari 6+, Chrome 23+ */\n\t if (w.Notification && w.Notification.permissionLevel) {\n\t permission = w.Notification.permissionLevel;\n\t\n\t /* Legacy webkit browsers */\n\t } else if (w.webkitNotifications && w.webkitNotifications.checkPermission) {\n\t permission = Permissions[w.webkitNotifications.checkPermission()];\n\t\n\t /* Firefox 23+ */\n\t } else if (w.Notification && w.Notification.permission) {\n\t permission = w.Notification.permission;\n\t\n\t /* Firefox Mobile */\n\t } else if (navigator.mozNotification) {\n\t permission = Permission.GRANTED;\n\t\n\t /* IE9+ */\n\t } else if (w.external && w.external.msIsSiteMode() !== undefined) {\n\t permission = w.external.msIsSiteMode() ? Permission.GRANTED : Permission.DEFAULT;\n\t } else {\n\t throw new Error(incompatibilityErrorMessage);\n\t }\n\t\n\t return permission;\n\t\n\t };\n\t\n\t /*********************\n\t Other Functions\n\t /*********************/\n\t\n\t /**\n\t * Detects whether the user's browser supports notifications\n\t * @return {Boolean}\n\t */\n\t self.isSupported = (function () {\n\t\n\t var isSupported = false;\n\t\n\t try {\n\t\n\t isSupported =\n\t\n\t /* Safari, Chrome */\n\t !!(w.Notification ||\n\t\n\t /* Chrome & ff-html5notifications plugin */\n\t w.webkitNotifications ||\n\t\n\t /* Firefox Mobile */\n\t navigator.mozNotification ||\n\t\n\t /* IE9+ */\n\t (w.external && w.external.msIsSiteMode() !== undefined));\n\t\n\t } catch (e) {}\n\t\n\t return isSupported;\n\t\n\t })();\n\t\n\t /**\n\t * Creates and displays a new notification\n\t * @param {Array} options\n\t * @return {Promise}\n\t */\n\t self.create = function (title, options) {\n\t var promiseCallback;\n\t\n\t /* Fail if the browser is not supported */\n\t if (!self.isSupported) {\n\t throw new Error(incompatibilityErrorMessage);\n\t }\n\t\n\t /* Fail if no or an invalid title is provided */\n\t if (!isString(title)) {\n\t throw new Error('PushError: Title of notification must be a string');\n\t }\n\t\n\t /* Request permission if it isn't granted */\n\t if (!self.Permission.has()) {\n\t promiseCallback = function(resolve, reject) {\n\t self.Permission.request(function() {\n\t try {\n\t createCallback(title, options, resolve);\n\t } catch (e) {\n\t reject(e);\n\t }\n\t }, function() {\n\t reject(\"Permission request declined\");\n\t });\n\t };\n\t } else {\n\t promiseCallback = function(resolve, reject) {\n\t try {\n\t createCallback(title, options, resolve);\n\t } catch (e) {\n\t reject(e);\n\t }\n\t };\n\t }\n\t\n\t return new Promise(promiseCallback);\n\t };\n\t\n\t /**\n\t * Returns the notification count\n\t * @return {Integer} The notification count\n\t */\n\t self.count = function () {\n\t var count = 0,\n\t key;\n\t\n\t for (key in notifications)\n\t count++;\n\t\n\t return count;\n\t },\n\t\n\t /**\n\t * Internal function that returns the path of the last service worker used\n\t * For testing purposes only\n\t * @return {String} The service worker path\n\t */\n\t self.__lastWorkerPath = function () {\n\t return self.lastWorkerPath;\n\t },\n\t\n\t /**\n\t * Closes a notification with the given tag\n\t * @param {String} tag - Tag of the notification to close\n\t * @return {Boolean} boolean denoting success\n\t */\n\t self.close = function (tag) {\n\t var key;\n\t for (key in notifications) {\n\t notification = notifications[key];\n\t /* Run only if the tags match */\n\t if (notification.tag === tag) {\n\t /* Call the notification's close() method */\n\t return closeNotification(key);\n\t }\n\t }\n\t };\n\t\n\t /**\n\t * Clears all notifications\n\t * @return {void}\n\t */\n\t self.clear = function () {\n\t var success = true;\n\t\n\t for (key in notifications)\n\t success = success && closeNotification(key);\n\t\n\t return success;\n\t };\n\t };\n\t\n\t return Push;\n\t\n\t});\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar Storage = function () {\n\t function Storage() {\n\t _classCallCheck(this, Storage);\n\t }\n\t\n\t _createClass(Storage, null, [{\n\t key: 'haveLocalStorage',\n\t value: function haveLocalStorage() {\n\t return window['localStorage'] !== undefined;\n\t }\n\t }, {\n\t key: 'set',\n\t value: function set(key, value) {\n\t if (Storage.haveLocalStorage()) {\n\t localStorage[key] = JSON.stringify(value);\n\t }\n\t }\n\t }, {\n\t key: 'get',\n\t value: function get(key) {\n\t if (Storage.haveLocalStorage()) {\n\t return JSON.parse(localStorage[key] || JSON.stringify({}));\n\t }\n\t\n\t return null;\n\t }\n\t }]);\n\t\n\t return Storage;\n\t}();\n\t\n\texports.default = Storage;\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// alerts.js"," \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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap cd985bea95b94b50751c","import pkg from '../package.json';\nimport '../node_modules/push.js/serviceWorker';\nimport Controller from './controller';\n\nVoonto.ready.then((/*app*/) => {\n new Controller();\n});\n\nexport const VERSION = pkg.version;\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","module.exports = {\n\t\"name\": \"alerts\",\n\t\"version\": \"1.0.6\",\n\t\"description\": \"\",\n\t\"main\": \"src/index.js\",\n\t\"scripts\": {\n\t\t\"test\": \"./node_modules/.bin/webpack && ./node_modules/.bin/mocha-phantomjs dist/spec/index.html --reporter xunit --file test-results.xml\",\n\t\t\"start\": \"webpack-dev-server\",\n\t\t\"build\": \"./node_modules/.bin/webpack\"\n\t},\n\t\"authors\": [\n\t\t\"Iván Pérez \",\n\t\t\"Ernesto V. \"\n\t],\n\t\"license\": \"SEE LICENSE IN LICENSE.md\",\n\t\"devDependencies\": {\n\t\t\"babel-core\": \"^6.17.0\",\n\t\t\"babel-loader\": \"^6.2.5\",\n\t\t\"babel-polyfill\": \"^6.16.0\",\n\t\t\"babel-preset-es2015\": \"^6.16.0\",\n\t\t\"chai\": \"^3.5.0\",\n\t\t\"chalk\": \"^1.1.3\",\n\t\t\"html-webpack-plugin\": \"^2.24.1\",\n\t\t\"json-loader\": \"^0.5.4\",\n\t\t\"mocha\": \"^3.1.0\",\n\t\t\"mocha-loader\": \"^1.0.0\",\n\t\t\"mocha-phantomjs\": \"^4.1.0\",\n\t\t\"webpack\": \"^1.13.3\",\n\t\t\"webpack-shell-plugin\": \"^0.4.3\"\n\t},\n\t\"dependencies\": {\n\t\t\"push.js\": \"0.0.13\"\n\t}\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./package.json\n// module id = 2\n// module chunks = 0","var isFunction = function (obj) { return obj && {}.toString.call(obj) === '[object Function]'; },\n\nrunFunctionString = function(funcStr) {\n if (funcStr.trim().length > 0) {\n eval('var func = ' + funcStr);\n if (isFunction(func))\n func();\n }\n};\n\nself.addEventListener('message', function(event) {\n self.client = event.source;\n});\n\nself.onnotificationclose = function (event) {\n runFunctionString(event.notification.data.onClose);\n\n /* Tell Push to execute close callback */\n self.client.postMessage(JSON.stringify({\n id: event.notification.data.id,\n action: 'close'\n }));\n};\n\nself.onnotificationclick = function (event) {\n var link, origin, href;\n\n runFunctionString(event.notification.data.onClick);\n\n if (typeof event.notification.data.link !== 'undefined' && event.notification.data.link !== null) {\n origin = event.notification.data.origin;\n link = event.notification.data.link;\n href = origin.substring(0, origin.indexOf('/', 8)) + '/';\n\n event.notification.close();\n\n // This looks to see if the current is already open and focuses if it is\n event.waitUntil(clients.matchAll({\n type: \"window\"\n }).then(function (clientList) {\n var client, full_url;\n\n for (var i = 0; i < clientList.length; i++) {\n client = clientList[i];\n full_url = href + link;\n\n if (full_url[full_url.length - 1] !== '/' && client.url[client.url.length - 1] == '/')\n full_url += '/';\n\n if ((client.url == full_url) && ('focus' in client))\n return client.focus();\n }\n\n if (clients.openWindow)\n return clients.openWindow('/' + link);\n }));\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/push.js/serviceWorker.js\n// module id = 3\n// module chunks = 0","import Service from './service';\nimport Alert from './alert';\nimport Push from 'push.js';\nimport Storage from './storage';\nimport {\n ACTIVATE_BUTTON,\n ALERTS_BUTTON,\n ALERTS_CONTAINER,\n ALERTS_ACTIVE_CLASS,\n ALERTS_NUMBER,\n ALERTS_PARENT,\n CHECK_DELAY,\n DEACTIVATE_BUTTON,\n IGNORE_BUTTON,\n PERMISSION_DENIED,\n WAS_SHOWN_REASON\n} from './constants';\n\nconst {$, RSVP} = Voonto;\n\nclass Controller {\n\n constructor() {\n this.activated = false;\n this.alerts = [];\n this.firstClick = false; // NOTE: flag to control the firstClick\n this.confirmTemplate = $(ALERTS_PARENT).html();\n\n $(ALERTS_BUTTON).on('click', this.bellButtonClick.bind(this));\n $(ALERTS_PARENT)\n .on('hide.bs.collapse', (event) => {\n $(event.target).addClass('hide');\n })\n .on('hidden.bs.collapse', (event) => {\n $(event.target).removeClass('hide');\n this.alerts.forEach((alert) => {\n $(`#${alert.getId()} a`).removeClass(ALERTS_ACTIVE_CLASS);\n });\n });\n this.attachEvents();\n\n if (!this.isPushActivated()) {\n this.addAlertsDeactivatedTemplate();\n } else if (!this.isAlertsActivated()) {\n this.addConfirmTemplate();\n }\n\n if (this.isPushDefault() || (this.isPushActivated() && this.isAlertsActivated())) {\n this.requestPermission();\n }\n }\n\n activateButtonClick() {\n Storage.set('alertsActive', 1);\n this.activated = true;\n this.requestPermission();\n }\n\n addAlertsDeactivatedTemplate() {\n $(ALERTS_PARENT).html(`\n
    \n Si quieres que funcionen las alertas debes activarlas en tu navegador.\n
    \n `);\n }\n\n addConfirmTemplate() {\n $(ALERTS_PARENT).html(this.confirmTemplate);\n this.attachEvents();\n }\n\n addNewsContainerTemplate() {\n $(`[data-target=\"${ALERTS_PARENT}\"]`).html(`\n \n 0\n `);\n $(ALERTS_PARENT).html(`\n \n `);\n this.attachEvents();\n }\n\n attachEvents() {\n $(ACTIVATE_BUTTON) .on('click', this.activateButtonClick.bind(this));\n $(IGNORE_BUTTON) .on('click', this.ignoreButtonClick.bind(this));\n $(DEACTIVATE_BUTTON).on('click', this.deactivateButtonClick.bind(this));\n }\n\n bellButtonClick() {\n if (this.isAlertsActivated()) {\n if ($(ALERTS_CONTAINER).is(':not(:visible)')) {\n $(ALERTS_NUMBER).hide().text('');\n\n if (!this.firstClick) {\n this.alerts.forEach((alert) => {\n alert.markAsView();\n });\n }\n this.firstClick = true;\n }\n }\n }\n\n compareAlerts(alert1, alert2) {\n var date1 = new Date(alert1.date);\n var date2 = new Date(alert2.date);\n return date1 - date2;\n }\n\n deactivateButtonClick() {\n Storage.set('alertsActive', 0);\n this.activated = false;\n this.addConfirmTemplate();\n }\n\n ignoreButtonClick() {\n $(ALERTS_BUTTON).trigger('click');\n }\n\n isAlertsActivated() {\n return (Storage.haveLocalStorage() && Storage.get('alertsActive') === 1) || this.activated === true;\n }\n\n isPushActivated() {\n return Push.Permission.GRANTED === Push.Permission.get();\n }\n\n isPushDefault() {\n return Push.Permission.DEFAULT === Push.Permission.get();\n }\n\n requestPermission() {\n return new RSVP.Promise(function(resolve, reject) {\n Push.Permission.request(resolve, function() {\n reject(PERMISSION_DENIED);\n });\n })\n .then(() => {\n this.addNewsContainerTemplate();\n return new RSVP.Promise((resolve) => {\n setTimeout(resolve, CHECK_DELAY);\n });\n })\n .then(() => {\n return Service.get();\n })\n .then((json) => {\n this.showAlerts(json.alerts.sort(this.compareAlerts));\n })\n .catch((reason) => {\n if (reason !== PERMISSION_DENIED) {\n throw new Error(reason);\n } else {\n this.addAlertsDeactivatedTemplate();\n }\n });\n }\n\n showAlerts(alerts) {\n alerts.forEach((item) => {\n var alert = new Alert(item);\n this.alerts.push(alert);\n if (!alert.isExpired()) {\n alert.show()\n .then(() => {\n this.updateAlertNumber();\n })\n .catch((reason) => {\n if (reason === WAS_SHOWN_REASON) {\n this.updateAlertNumber();\n } else {\n throw reason;\n }\n });\n }\n });\n }\n\n updateAlertNumber() {\n // Update the number of notifications\n if ($(`.${ALERTS_ACTIVE_CLASS}`, ALERTS_CONTAINER).length) {\n $(ALERTS_NUMBER).removeClass('hide').show().text($(`.${ALERTS_ACTIVE_CLASS}`, ALERTS_CONTAINER).length);\n }\n this.firstClick = false;\n }\n}\n\nexport default Controller;\n\n\n\n// WEBPACK FOOTER //\n// ./src/controller.js","import {SERVICE_URL} from './constants';\n\nconst {$, RSVP} = Voonto;\n\nclass Service {\n static get() {\n return new RSVP.Promise((resolve, reject) => {\n $.ajax({\n url: SERVICE_URL,\n dataType: 'json'\n })\n .done((json) => {\n if (typeof json.hasOwnProperty !== 'function' || !json.hasOwnProperty('urgente')) {\n // NOTE: Alerts with incorrect JSON format\n reject('No alerts');\n }\n\n resolve(buildAlerts(json));\n })\n .fail((jqXHR, textStatus) => {\n // NOTE: Problem with ajax call\n reject(`SERVICE: ${textStatus}`);\n });\n });\n }\n}\n\nexport default Service;\n\n/* private */\n\nfunction buildAlerts(jsonResponse) {\n var json = {\n alerts: []\n };\n\n jsonResponse.urgente.forEach((alert) => {\n json.alerts.push({\n id: alert.uuid,\n title: alert.titular,\n link: alert.href,\n date: alert.fechaPublicacion,\n body: alert.body || '',\n icon: {\n x16: alert.icon && alert.icon.x16 ? alert.icon.x16 : '',\n x32: alert.icon && alert.icon.x32 ? alert.icon.x32 : '',\n },\n delay: alert.delay || 0,\n requireInteraction: alert.requireInteraction || false\n });\n });\n\n return json;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/service.js","export const ACTIVATE_BUTTON = '#alerts .voc-alerts-content .voc-button-white-red';\nexport const ALERTS_BUTTON = '[data-voc-alerts] [data-target=\"#alerts\"]';\nexport const ALERTS_PARENT = '#alerts';\nexport const ALERTS_CONTAINER = '#alerts .voc-alerts-news ul';\nexport const ALERTS_ACTIVE_CLASS = 'active';\nexport const ALERTS_NUMBER = '[data-voc-alerts] [data-target=\"#alerts\"] .voc-alert-number';\nexport const CHECK_DELAY = 1000;\nexport const DEACTIVATE_BUTTON = '#alerts .voc-alerts-deactivate';\nexport const IGNORE_BUTTON = '#alerts .voc-alerts-ignore';\nexport const PERMISSION_DENIED = 'PERMISSION_DENIED';\nexport const SERVICE_URL = Voonto.getInstance().lookup('vocento.config.alerts.serviceUrl');\nexport const WAS_SHOWN_REASON = 'ALERT_WAS_SHOWN';\n\n\n\n// WEBPACK FOOTER //\n// ./src/constants.js","import Push from 'push.js';\nimport Storage from './storage';\nimport {\n ALERTS_CONTAINER,\n ALERTS_ACTIVE_CLASS,\n WAS_SHOWN_REASON\n} from './constants';\n\nconst {$, RSVP, moment} = Voonto;\n\nmoment.locale('es');\n\nclass Alert {\n constructor(config) {\n this.config = config;\n this.shown = false;\n this.viewed = false;\n\n this.config = $.extend(config, {\n onShow: () => {\n if (Storage.haveLocalStorage()) {\n var alertsShown = Storage.get('alertsShown');\n alertsShown[this.config.id] = this.config.date;\n Storage.set('alertsShown', alertsShown);\n }\n this.shown = true;\n }\n });\n\n if (config.link) {\n this.config = $.extend(config, {\n onClick: () => window.location = this.config.link\n });\n }\n }\n\n getId() {\n return this.config.id;\n }\n\n /**\n * Build the notification template\n */\n getNewTemplate() {\n var relativeTime = moment(this.config.date).fromNow();\n var title = this.config.title;\n var link = this.config.link || '#';\n\n var template = $(`\n
  • \n ${relativeTime}\n \n ${title}\n \n
  • \n `);\n\n if (this.isNew()) {\n $('a', template).addClass(ALERTS_ACTIVE_CLASS);\n }\n\n return template;\n }\n\n /**\n * Return if the alert is expired\n */\n isExpired() {\n //return moment().subtract(EXPIRATION_PERIOD, 'hours') > moment(this.config.date)\n return false;\n }\n\n isNew() {\n if (Storage.haveLocalStorage() && Storage.get('alertsViewed')) {\n var alertsViewed = Storage.get('alertsViewed');\n this.viewed = alertsViewed[this.config.id] ? true : false;\n }\n\n return !this.viewed;\n }\n\n markAsView() {\n if (!this.viewed) {\n if (Storage.haveLocalStorage()) {\n var alertsViewed = Storage.get('alertsViewed');\n alertsViewed[this.config.id] = this.config.date;\n Storage.set('alertsViewed', alertsViewed);\n }\n this.viewed = true;\n }\n }\n\n show() {\n return new RSVP.Promise((resolve) => {\n if (!this.isNew()) {\n resolve();\n } else {\n setTimeout(resolve, this.config.delay || 0);\n }\n })\n .then(() => {\n this.updatePanel();\n\n // Check if the Notification Was Shown(NWS) previously\n if (this.wasShown()) {\n return Promise.reject(WAS_SHOWN_REASON);\n }\n\n return Push.create(this.config.title, this.config);\n });\n }\n\n /**\n * Update the notifications on header notifications panel\n */\n updatePanel() {\n // Insert the new notification to panel\n $(ALERTS_CONTAINER).prepend(this.getNewTemplate());\n }\n\n /**\n * The alert was shown\n */\n wasShown() {\n if (Storage.haveLocalStorage() && Storage.get('alertsShown')) {\n var alertsShown = Storage.get('alertsShown');\n this.shown = alertsShown[this.config.id] ? true : false;\n }\n\n return this.shown;\n }\n\n\n}\n\nexport default Alert;\n\n\n\n// WEBPACK FOOTER //\n// ./src/alert.js","/**\n * Push\n * =======\n * A compact, cross-browser solution for the JavaScript Notifications API\n *\n * Credits\n * -------\n * Tsvetan Tsvetkov (ttsvetko)\n * Alex Gibson (alexgibson)\n *\n * License\n * -------\n *\n * The MIT License (MIT)\n *\n * Copyright (c) 2015-2017 Tyler Nickerson\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * @preserve\n */\n\n(function (global, factory) {\n\n 'use strict';\n\n /* Use AMD */\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return new (factory(global, global.document))();\n });\n }\n /* Use CommonJS */\n else if (typeof module !== 'undefined' && module.exports) {\n module.exports = new (factory(global, global.document))();\n }\n /* Use Browser */\n else {\n global.Push = new (factory(global, global.document))();\n }\n\n})(typeof window !== 'undefined' ? window : this, function (w, d) {\n\n var Push = function () {\n\n /**********************\n Local Variables\n /**********************/\n\n var\n self = this,\n isUndefined = function (obj) { return obj === undefined; },\n isString = function (obj) { return typeof obj === 'string' },\n isFunction = function (obj) { return obj && {}.toString.call(obj) === '[object Function]'; },\n\n /* ID to use for new notifications */\n currentId = 0,\n\n /* Message to show if there is no suport to Push Notifications */\n incompatibilityErrorMessage = 'PushError: push.js is incompatible with browser.',\n\n /* Map of open notifications */\n notifications = {},\n\n /* Testing variable for the last service worker path used */\n lastWorkerPath = null,\n\n /**********************\n Helper Functions\n /**********************/\n\n /**\n * Closes a notification\n * @param {Notification} notification\n * @return {Boolean} boolean denoting whether the operation was successful\n */\n closeNotification = function (id) {\n var errored = false,\n notification = notifications[id];\n\n if (typeof notification !== 'undefined') {\n /* Safari 6+, Chrome 23+ */\n if (notification.close) {\n notification.close();\n /* Legacy webkit browsers */\n } else if (notification.cancel) {\n notification.cancel();\n /* IE9+ */\n } else if (w.external && w.external.msIsSiteMode) {\n w.external.msSiteModeClearIconOverlay();\n } else {\n errored = true;\n throw new Error('Unable to close notification: unknown interface');\n }\n\n if (!errored) {\n return removeNotification(id);\n }\n }\n\n return false;\n },\n\n /**\n * Adds a notification to the global dictionary of notifications\n * @param {Notification} notification\n * @return {Integer} Dictionary key of the notification\n */\n addNotification = function (notification) {\n var id = currentId;\n notifications[id] = notification;\n currentId++;\n return id;\n },\n\n /**\n * Removes a notification with the given ID\n * @param {Integer} id - Dictionary key/ID of the notification to remove\n * @return {Boolean} boolean denoting success\n */\n removeNotification = function (id) {\n var dict = {},\n success = false,\n key;\n\n for (key in notifications) {\n if (notifications.hasOwnProperty(key)) {\n if (key != id) {\n dict[key] = notifications[key];\n } else {\n // We're successful if we omit the given ID from the new array\n success = true;\n }\n }\n }\n // Overwrite the current notifications dictionary with the filtered one\n notifications = dict;\n return success;\n },\n\n prepareNotification = function (id, options) {\n var wrapper;\n\n /* Wrapper used to get/close notification later on */\n wrapper = {\n get: function () {\n return notifications[id];\n },\n\n close: function () {\n closeNotification(id);\n }\n };\n\n /* Autoclose timeout */\n if (options.timeout) {\n setTimeout(function () {\n wrapper.close();\n }, options.timeout);\n }\n\n return wrapper;\n },\n\n /**\n * Callback function for the 'create' method\n * @return {void}\n */\n createCallback = function (title, options, resolve) {\n var notification,\n onClose;\n\n /* Set empty settings if none are specified */\n options = options || {};\n\n /* Set the last service worker path for testing */\n self.lastWorkerPath = options.serviceWorker || 'serviceWorker.js';\n\n /* onClose event handler */\n onClose = function (id) {\n /* A bit redundant, but covers the cases when close() isn't explicitly called */\n removeNotification(id);\n if (isFunction(options.onClose)) {\n options.onClose.call(this, notification);\n }\n };\n\n /* Safari 6+, Firefox 22+, Chrome 22+, Opera 25+ */\n if (w.Notification) {\n try {\n notification = new w.Notification(\n title,\n {\n icon: (isString(options.icon) || isUndefined(options.icon)) ? options.icon : options.icon.x32,\n body: options.body,\n tag: options.tag,\n requireInteraction: options.requireInteraction,\n silent: options.silent\n }\n );\n } catch (e) {\n if (w.navigator) {\n /* Register ServiceWorker using lastWorkerPath */\n w.navigator.serviceWorker.register(self.lastWorkerPath);\n w.navigator.serviceWorker.ready.then(function(registration) {\n var localData = {\n id: currentId,\n link: options.link,\n origin: document.location.href,\n onClick: (isFunction(options.onClick)) ? options.onClick.toString() : '',\n onClose: (isFunction(options.onClose)) ? options.onClose.toString() : ''\n };\n\n if (typeof options.data !== 'undefined' && options.data !== null)\n localData = Object.assign(localData, options.data);\n\n /* Show the notification */\n registration.showNotification(\n title,\n {\n icon: options.icon,\n body: options.body,\n vibrate: options.vibrate,\n tag: options.tag,\n data: localData,\n requireInteraction: options.requireInteraction\n }\n ).then(function() {\n var id;\n\n /* Find the most recent notification and add it to the global array */\n registration.getNotifications().then(function(notifications) {\n id = addNotification(notifications[notifications.length - 1]);\n\n /* Send an empty message so the ServiceWorker knows who the client is */\n registration.active.postMessage('');\n\n /* Listen for close requests from the ServiceWorker */\n navigator.serviceWorker.addEventListener('message', function (event) {\n var data = JSON.parse(event.data);\n\n if (data.action === 'close' && Number.isInteger(data.id))\n removeNotification(data.id);\n });\n\n resolve(prepareNotification(id, options));\n });\n });\n });\n }\n }\n\n /* Legacy webkit browsers */\n } else if (w.webkitNotifications) {\n\n notification = w.webkitNotifications.createNotification(\n options.icon,\n title,\n options.body\n );\n\n notification.show();\n\n /* Firefox Mobile */\n } else if (navigator.mozNotification) {\n\n notification = navigator.mozNotification.createNotification(\n title,\n options.body,\n options.icon\n );\n\n notification.show();\n\n /* IE9+ */\n } else if (w.external && w.external.msIsSiteMode()) {\n\n //Clear any previous notifications\n w.external.msSiteModeClearIconOverlay();\n w.external.msSiteModeSetIconOverlay(\n ((isString(options.icon) || isUndefined(options.icon))\n ? options.icon\n : options.icon.x16), title\n );\n w.external.msSiteModeActivate();\n\n notification = {};\n } else {\n throw new Error('Unable to create notification: unknown interface');\n }\n\n if (typeof(notification) !== 'undefined') {\n var id = addNotification(notification),\n wrapper = prepareNotification(id, options);\n\n /* Notification callbacks */\n if (isFunction(options.onShow))\n notification.addEventListener('show', options.onShow);\n\n if (isFunction(options.onError))\n notification.addEventListener('error', options.onError);\n\n if (isFunction(options.onClick))\n notification.addEventListener('click', options.onClick);\n\n notification.addEventListener('close', function() {\n onClose(id);\n });\n\n notification.addEventListener('cancel', function() {\n onClose(id);\n });\n\n /* Return the wrapper so the user can call close() */\n resolve(wrapper);\n }\n\n resolve({}); // By default, pass an empty wrapper\n },\n\n /**\n * Permission types\n * @enum {String}\n */\n Permission = {\n DEFAULT: 'default',\n GRANTED: 'granted',\n DENIED: 'denied'\n },\n\n Permissions = [Permission.GRANTED, Permission.DEFAULT, Permission.DENIED];\n\n /* Allow enums to be accessible from Push object */\n self.Permission = Permission;\n\n /*****************\n Permissions\n /*****************/\n\n /**\n * Requests permission for desktop notifications\n * @param {Function} callback - Function to execute once permission is granted\n * @return {void}\n */\n self.Permission.request = function (onGranted, onDenied) {\n var existing = self.Permission.get();\n\n /* Return if Push not supported */\n if (!self.isSupported) {\n throw new Error(incompatibilityErrorMessage);\n }\n\n /* Default callback */\n callback = function (result) {\n switch (result) {\n\n case self.Permission.GRANTED:\n if (onGranted) onGranted();\n break;\n\n case self.Permission.DENIED:\n if (onDenied) onDenied();\n break;\n\n }\n\n };\n\n /* Permissions already set */\n if (existing !== self.Permission.DEFAULT) {\n callback(existing);\n }\n /* Safari 6+, Chrome 23+ */\n else if (w.Notification && w.Notification.requestPermission) {\n Notification.requestPermission(callback);\n }\n /* Legacy webkit browsers */\n else if (w.webkitNotifications && w.webkitNotifications.checkPermission) {\n w.webkitNotifications.requestPermission(callback);\n } else {\n throw new Error(incompatibilityErrorMessage);\n }\n };\n\n /**\n * Returns whether Push has been granted permission to run\n * @return {Boolean}\n */\n self.Permission.has = function () {\n return Permission.get() === Permission.GRANTED;\n };\n\n /**\n * Gets the permission level\n * @return {Permission} The permission level\n */\n self.Permission.get = function () {\n\n var permission;\n\n /* Return if Push not supported */\n if (!self.isSupported) { throw new Error(incompatibilityErrorMessage); }\n\n /* Safari 6+, Chrome 23+ */\n if (w.Notification && w.Notification.permissionLevel) {\n permission = w.Notification.permissionLevel;\n\n /* Legacy webkit browsers */\n } else if (w.webkitNotifications && w.webkitNotifications.checkPermission) {\n permission = Permissions[w.webkitNotifications.checkPermission()];\n\n /* Firefox 23+ */\n } else if (w.Notification && w.Notification.permission) {\n permission = w.Notification.permission;\n\n /* Firefox Mobile */\n } else if (navigator.mozNotification) {\n permission = Permission.GRANTED;\n\n /* IE9+ */\n } else if (w.external && w.external.msIsSiteMode() !== undefined) {\n permission = w.external.msIsSiteMode() ? Permission.GRANTED : Permission.DEFAULT;\n } else {\n throw new Error(incompatibilityErrorMessage);\n }\n\n return permission;\n\n };\n\n /*********************\n Other Functions\n /*********************/\n\n /**\n * Detects whether the user's browser supports notifications\n * @return {Boolean}\n */\n self.isSupported = (function () {\n\n var isSupported = false;\n\n try {\n\n isSupported =\n\n /* Safari, Chrome */\n !!(w.Notification ||\n\n /* Chrome & ff-html5notifications plugin */\n w.webkitNotifications ||\n\n /* Firefox Mobile */\n navigator.mozNotification ||\n\n /* IE9+ */\n (w.external && w.external.msIsSiteMode() !== undefined));\n\n } catch (e) {}\n\n return isSupported;\n\n })();\n\n /**\n * Creates and displays a new notification\n * @param {Array} options\n * @return {Promise}\n */\n self.create = function (title, options) {\n var promiseCallback;\n\n /* Fail if the browser is not supported */\n if (!self.isSupported) {\n throw new Error(incompatibilityErrorMessage);\n }\n\n /* Fail if no or an invalid title is provided */\n if (!isString(title)) {\n throw new Error('PushError: Title of notification must be a string');\n }\n\n /* Request permission if it isn't granted */\n if (!self.Permission.has()) {\n promiseCallback = function(resolve, reject) {\n self.Permission.request(function() {\n try {\n createCallback(title, options, resolve);\n } catch (e) {\n reject(e);\n }\n }, function() {\n reject(\"Permission request declined\");\n });\n };\n } else {\n promiseCallback = function(resolve, reject) {\n try {\n createCallback(title, options, resolve);\n } catch (e) {\n reject(e);\n }\n };\n }\n\n return new Promise(promiseCallback);\n };\n\n /**\n * Returns the notification count\n * @return {Integer} The notification count\n */\n self.count = function () {\n var count = 0,\n key;\n\n for (key in notifications)\n count++;\n\n return count;\n },\n\n /**\n * Internal function that returns the path of the last service worker used\n * For testing purposes only\n * @return {String} The service worker path\n */\n self.__lastWorkerPath = function () {\n return self.lastWorkerPath;\n },\n\n /**\n * Closes a notification with the given tag\n * @param {String} tag - Tag of the notification to close\n * @return {Boolean} boolean denoting success\n */\n self.close = function (tag) {\n var key;\n for (key in notifications) {\n notification = notifications[key];\n /* Run only if the tags match */\n if (notification.tag === tag) {\n /* Call the notification's close() method */\n return closeNotification(key);\n }\n }\n };\n\n /**\n * Clears all notifications\n * @return {void}\n */\n self.clear = function () {\n var success = true;\n\n for (key in notifications)\n success = success && closeNotification(key);\n\n return success;\n };\n };\n\n return Push;\n\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/push.js/push.js\n// module id = 8\n// module chunks = 0 1","class Storage {\n static haveLocalStorage() {\n return window['localStorage'] !== undefined;\n }\n\n static set(key, value) {\n if (Storage.haveLocalStorage()) {\n localStorage[key] = JSON.stringify(value);\n }\n }\n\n static get(key) {\n if (Storage.haveLocalStorage()) {\n return JSON.parse(localStorage[key] || JSON.stringify({}));\n }\n\n return null;\n }\n}\n\nexport default Storage;\n\n\n\n// WEBPACK FOOTER //\n// ./src/storage.js"],"sourceRoot":""}