{"version":3,"names":["Notification","config","prototype","init","self","this","$","on","container","parents","handleNotificationClose","hide","pageVariables","IsFunctionalActive","cookieName","attr","cookieDuration","uniqueId","cookie","getCookie","cookieValue","split","indexOf","push","setCookieRequest","name","value","join","days","path","domain","window","location","hostname","secure","sameSite","setCookie","request","expires","date","Date","setTime","getTime","toUTCString","document","cookieArr","i","length","cookiePair","trim","decodeURIComponent","ready"],"sources":["assets/feature/pagecontent/notificationBanner/js/_notificationBanner.js"],"sourcesContent":["var Notification = (function () {\r\n var config = {\r\n notificationContainer: \".notif-wrapper\",\r\n notificationClose: \".notif-close-icon\",\r\n cookieNameAttribute: \"data-cookie-name\",\r\n cookieDurationAttribute: \"data-cookie-duration\",\r\n uniqueIdAttribute: \"data-unique-id\",\r\n };\r\n\r\n //constructor\r\n function Notification() { }\r\n\r\n Notification.prototype.init = function () {\r\n var self = this;\r\n\r\n //notification close event\r\n $(config.notificationClose).on(\"click\", function () {\r\n var container = $(this).parents(config.notificationContainer);\r\n self.handleNotificationClose(container);\r\n });\r\n };\r\n\r\n Notification.prototype.handleNotificationClose = function (container) {\r\n var self = this;\r\n\r\n //hide notification\r\n container.hide();\r\n if (pageVariables.IsFunctionalActive != \"True\") {\r\n return;\r\n }\r\n var cookieName = container.attr(config.cookieNameAttribute);\r\n var cookieDuration = container.attr(config.cookieDurationAttribute);\r\n var uniqueId = container.attr(config.uniqueIdAttribute);\r\n\r\n //get cookie\r\n var cookie = self.getCookie(cookieName);\r\n var cookieValue = [];\r\n if (cookie) {\r\n cookieValue = cookie.split(\",\");\r\n }\r\n\r\n //set cookie value if uniqueId is not present\r\n if (uniqueId && cookieValue.indexOf(uniqueId) === -1) {\r\n cookieValue.push(uniqueId);\r\n }\r\n\r\n //set cookie\r\n var cookieValueString = cookieValue.join(\",\");\r\n var currentDomain = window.location.hostname;\r\n var setCookieRequest = {\r\n name: cookieName,\r\n value: cookieValueString,\r\n days: cookieDuration,\r\n path: \"/\",\r\n domain: currentDomain,\r\n secure: true,\r\n sameSite: \"strict\",\r\n };\r\n self.setCookie(setCookieRequest);\r\n };\r\n\r\n Notification.prototype.setCookie = function (request) {\r\n var expires = \"\";\r\n if (request.days) {\r\n var date = new Date();\r\n date.setTime(date.getTime() + request.days * 24 * 60 * 60 * 1000);\r\n expires = \"; expires=\" + date.toUTCString();\r\n }\r\n var cookie =\r\n request.name +\r\n \"=\" +\r\n (request.value || \"\") +\r\n expires +\r\n \"; path=\" +\r\n (request.path || \"/\");\r\n\r\n if (request.domain) {\r\n cookie += \"; domain=\" + request.domain;\r\n }\r\n if (request.secure) {\r\n cookie += \"; secure\";\r\n }\r\n if (request.sameSite) {\r\n cookie += \"; samesite=\" + request.sameSite;\r\n }\r\n\r\n document.cookie = cookie;\r\n };\r\n\r\n Notification.prototype.getCookie = function (name) {\r\n var cookieArr = document.cookie.split(\";\");\r\n\r\n for (var i = 0; i < cookieArr.length; i++) {\r\n var cookiePair = cookieArr[i].split(\"=\");\r\n\r\n // Removing whitespace at the beginning of the cookie name and compare it with the given string\r\n if (name == cookiePair[0].trim()) {\r\n // Decode the cookie value and return\r\n return decodeURIComponent(cookiePair[1]);\r\n }\r\n }\r\n\r\n // Return null if not found\r\n return null;\r\n };\r\n\r\n return Notification;\r\n})();\r\n\r\n$(document).ready(function () {\r\n if ($(\".notif-wrapper\").length === 0) {\r\n return;\r\n }\r\n var notification = new Notification();\r\n notification.init();\r\n});\r\n"],"mappings":"AAAA,IAAIA,aAAe,WACf,IAAIC,EACuB,iBADvBA,EAEmB,oBAFnBA,EAGqB,mBAHrBA,EAIyB,uBAJzBA,EAKmB,iBAIvB,SAASD,IAAiB,CAgG1B,OA9FAA,EAAaE,UAAUC,KAAO,WAC1B,IAAIC,EAAOC,KAGXC,EAAEL,GAA0BM,GAAG,SAAS,WACpC,IAAIC,EAAYF,EAAED,MAAMI,QAAQR,GAChCG,EAAKM,wBAAwBF,EACjC,GACJ,EAEAR,EAAaE,UAAUQ,wBAA0B,SAAUF,GAKvD,GADAA,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