{"version":3,"file":"SystemNotificationMaker.min.js","sources":["Notification/SystemNotificationMaker.js"],"sourcesContent":["\"use strict\";\r\n$(function () {\r\n const notificationClosedKey = \"ActiveNotificationClosed\";\r\n const notificationDataKey = \"NotificationData\";\r\n if (sessionStorage.getItem(notificationClosedKey) === \"true\") {\r\n return;\r\n }\r\n let notificationData = sessionStorage.getItem(notificationDataKey);\r\n if (notificationData) {\r\n let notificationInfo = JSON.parse(notificationData);\r\n displayNotification(notificationInfo);\r\n return;\r\n }\r\n $.ajax({\r\n url: getNotificationUrl,\r\n type: \"GET\",\r\n async: true,\r\n success: function (response) {\r\n if (response == null) {\r\n return;\r\n }\r\n if (response) {\r\n let notificationInfo = {\r\n id: response.Id,\r\n buttonText: response.ButtonText,\r\n cookieName: \"system-notification-\" + response.UpdatedStamp,\r\n text: response.LocalizedMessage,\r\n themeClass: \"light\",\r\n title: response.Title,\r\n daysUntilExpiry: response.daysUntilExpiry,\r\n position: \"top\",\r\n };\r\n displayNotification(notificationInfo);\r\n sessionStorage.setItem(notificationDataKey, JSON.stringify(notificationInfo));\r\n }\r\n },\r\n });\r\n});\r\nfunction displayNotification(notificationInfo) {\r\n let systemNotificationMaker = new SystemNotificationMaker({\r\n id: notificationInfo.id,\r\n buttonText: notificationInfo.buttonText,\r\n cookieName: notificationInfo.cookieName,\r\n text: notificationInfo.text,\r\n themeClass: notificationInfo.themeClass,\r\n title: notificationInfo.title,\r\n position: notificationInfo.position,\r\n daysUntilExpiry: notificationInfo.daysUntilExpiry\r\n });\r\n if (!systemNotificationMaker.isNotificationChecked) {\r\n systemNotificationMaker.appendToBody();\r\n $('#' + systemNotificationMaker.eventPopupIds.popupId).slideToggle();\r\n }\r\n}\r\nclass SystemNotificationMaker {\r\n constructor(option) {\r\n this.option = option;\r\n this.init();\r\n }\r\n init() {\r\n this.eventPopupIds = {\r\n popupId: `system-notification-popup-container-${this.option.id}`,\r\n buttonId: `system-notification-button-${this.option.id}`\r\n };\r\n this.isNotificationChecked = CookieLibrary.getCookie(this.option.cookieName) != null;\r\n }\r\n getHtml() {\r\n if (this.isNotificationChecked)\r\n return null;\r\n return `
\r\n
\r\n

${this.option.title}

\r\n

${this.option.text}

\r\n
\r\n
\r\n \r\n
\r\n
`;\r\n }\r\n getBindingConfig() {\r\n return this.eventPopupIds;\r\n }\r\n appendToBody() {\r\n const htmlContent = this.getHtml();\r\n if (htmlContent) {\r\n $(function () {\r\n $(\"body\").append(htmlContent);\r\n this.setButtonEvents();\r\n }.bind(this));\r\n }\r\n }\r\n setButtonEvents() {\r\n const $popup = $(\"#\" + this.eventPopupIds.popupId);\r\n $(\"#\" + this.eventPopupIds.buttonId).on(\"click\", () => this.buttonClick());\r\n $popup.find(\".btn-close\").on(\"click\", () => $popup.hide());\r\n }\r\n buttonClick() {\r\n CookieLibrary.setCookie(this.option.cookieName, `${this.option.cookieName} was checked`, this.option.daysUntilExpiry);\r\n $(\"#\" + this.eventPopupIds.popupId).hide();\r\n sessionStorage.removeItem(\"NotificationData\");\r\n sessionStorage.setItem(\"ActiveNotificationClosed\", \"true\");\r\n }\r\n}\r\n//# sourceMappingURL=SystemNotificationMaker.js.map"],"names":["displayNotification","notificationInfo","systemNotificationMaker","SystemNotificationMaker","id","buttonText","cookieName","text","themeClass","title","position","daysUntilExpiry","isNotificationChecked","appendToBody","$","eventPopupIds","popupId","slideToggle","notificationData","notificationDataKey","sessionStorage","getItem","JSON","parse","ajax","url","getNotificationUrl","type","async","success","response","Id","ButtonText","UpdatedStamp","LocalizedMessage","Title","setItem","stringify","constructor","option","this","init","buttonId","CookieLibrary","getCookie","getHtml","getBindingConfig","htmlContent","append","setButtonEvents","bind","$popup","on","buttonClick","find","hide","setCookie","removeItem"],"mappings":"AAsCA,SAASA,oBAAoBC,GACrBC,EAA0B,IAAIC,wBAAwB,CACtDC,GAAIH,EAAiBG,GACrBC,WAAYJ,EAAiBI,WAC7BC,WAAYL,EAAiBK,WAC7BC,KAAMN,EAAiBM,KACvBC,WAAYP,EAA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