{"version":3,"sources":["webpack:///./LeLab.Gcv.Web/src/atomic/organism/o-alert/o-alert.chunk.js","webpack:///./LeLab.Gcv.Web/src/atomic/organism/o-alert/o-alert.scss"],"names":["require","$","cookie","cookieName","initialize","closedAlerts","getClosedAlertIds","each","$alert","alertId","attr","$closeButton","find","indexOf","slideDown","click","closest","data","addClosedIdToCookie","slideUp","alertsCookie","read","ids","split","results","i","length","id","trim","push","closedIds","create","join","timers","document","querySelectorAll","forEach","timer","end","Date","dataset","endDate","replace","timerInterval","setInterval","countDown","timeNow","clearInterval","classList","add","calculateTimeDifference","endTime","startTime","timeSpan","getTime","days","Math","floor","hours","minutes","seconds","querySelector","innerHTML"],"mappings":";;;;;;;;AAAA,mBAAAA,CAAQ,GAAR;;AAEA,IAAIC,IAAI,mBAAAD,CAAQ,CAAR,CAAR;AACA,IAAIE,SAAS,mBAAAF,CAAQ,EAAR,CAAb;;AAEA,IAAIG,aAAa,cAAjB;;AAEAC;;AAEA,SAASA,UAAT,GAAsB;AAClB,QAAIC,eAAeC,mBAAnB;;AAEAL,MAAE,2BAAF,EAA+BM,IAA/B,CAAoC,YAAY;AAC5C,YAAIC,SAASP,EAAE,IAAF,CAAb;AAAA,YACIQ,UAAUD,OAAOE,IAAP,CAAY,eAAZ,CADd;AAAA,YAEIC,eAAeH,OAAOI,IAAP,CAAY,iBAAZ,CAFnB;;AAIA,YAAIP,aAAaQ,OAAb,CAAqBJ,OAArB,IAAgC,CAApC,EAAuC;AACnCD,mBAAOM,SAAP;AACH;;AAEDH,qBAAaI,KAAb,CAAmB,YAAY;AAC3B,gBAAIN,UAAUR,EAAE,IAAF,EAAQe,OAAR,CAAgB,iBAAhB,EAAmCC,IAAnC,CAAwC,UAAxC,CAAd;AACAC,gCAAoBT,OAApB;;AAEAD,mBAAOW,OAAP;AACH,SALD;AAMH,KAfD;AAgBH;;AAED,SAASb,iBAAT,GAA6B;AACzB,QAAIc,eAAelB,OAAOmB,IAAP,CAAYlB,UAAZ,CAAnB;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E,OAAV,EAAnC;;AAEA,YAAMC,OAAOC,KAAKC,KAAL,CAAWJ,YAAY,OAAO,EAAP,GAAY,EAAZ,GAAiB,EAA7B,CAAX,CAAb;AACA,YAAMK,QAAQF,KAAKC,KAAL,CAAYJ,YAAY,OAAO,EAAP,GAAY,EAAZ,GAAiB,EAA7B,CAAD,IAAsC,OAAO,EAAP,GAAY,EAAlD,CAAX,CAAd;AACA,YAAMM,UAAUH,KAAKC,KAAL,CAAYJ,YAAY,OAAO,EAAP,GAAY,EAAxB,CAAD,IAAiC,OAAO,EAAxC,CAAX,CAAhB;AACA,YAAMO,UAAUJ,KAAKC,KAAL,CAAYJ,YAAY,OAAO,EAAnB,CAAD,GAA2B,IAAtC,CAAhB;;AAEAhB,cAAMwB,aAAN,CAAoB,0BAApB,EAAgDC,SAAhD,GAA4DP,OAAO,CAAP,GAAWA,IAAX,GAAkB,MAAMA,IAApF;AACAlB,cAAMwB,aAAN,CAAoB,2BAApB,EAAiDC,SAAjD,GAA6DJ,QAAQ,CAAR,GAAYA,KAAZ,GAAoB,MAAMA,KAAvF;AACArB,cAAMwB,aAAN,CAAoB,6BAApB,EAAmDC,SAAnD,GAA+DH,UAAU,CAAV,GAAcA,OAAd,GAAwB,MAAMA,OAA7F;AACAtB,cAAMwB,aAAN,CAAoB,6BAApB,EAAmDC,SAAnD,GAA+DF,UAAU,CAAV,GAAcA,OAAd,GAAwB,MAAMA,OAA7F;AAEH;AACJ,CAlCD,E;;;;;;;AC1DA,yC","file":"o-alert.js","sourcesContent":["require(\"./o-alert.scss\");\r\n\r\nvar $ = require(\"jquery\");\r\nvar cookie = require('utils/cookies-utils');\r\n\r\nvar cookieName = \"__lab_alerts\";\r\n\r\ninitialize();\r\n\r\nfunction initialize() {\r\n var closedAlerts = getClosedAlertIds();\r\n\r\n $('[data-controller=\"alert\"]').each(function () {\r\n var $alert = $(this),\r\n alertId = $alert.attr(\"data-alert-id\"),\r\n $closeButton = $alert.find('.o-alert__close');\r\n\r\n if (closedAlerts.indexOf(alertId) < 0) {\r\n $alert.slideDown();\r\n }\r\n\r\n $closeButton.click(function () {\r\n var alertId = $(this).closest(\"[data-alert-id]\").data(\"alert-id\");\r\n addClosedIdToCookie(alertId);\r\n\r\n $alert.slideUp();\r\n });\r\n });\r\n}\r\n\r\nfunction getClosedAlertIds() {\r\n var alertsCookie = cookie.read(cookieName);\r\n if (!alertsCookie) return [];\r\n\r\n var ids = alertsCookie.split(\",\");\r\n var results = [];\r\n\r\n for (var i = 0; i < ids.length; i++) {\r\n var id = ids[i].trim();\r\n if (id) {\r\n results.push(id);\r\n }\r\n }\r\n\r\n return results;\r\n}\r\n\r\nfunction addClosedIdToCookie(id) {\r\n var closedIds = getClosedAlertIds();\r\n closedIds.push(id);\r\n\r\n cookie.create(cookieName, closedIds.join(\",\"));\r\n}\r\n\r\n// Promotion Countdown\r\n\r\nlet timers = document.querySelectorAll(\".js-promo-countdown\");\r\n\r\ntimers.forEach((timer) => {\r\n // const start = new Date(timer.dataset.startDate.replace(/\\s/, \"T\"));\r\n const end = new Date(timer.dataset.endDate.replace(/\\s/, \"T\"));\r\n\r\n //start timer countdown\r\n var timerInterval = setInterval(countDown, 1000);\r\n\r\n function countDown() {\r\n var timeNow = new Date();\r\n\r\n if (timeNow >= end) {\r\n clearInterval(timerInterval);\r\n timer.classList.add(\"productPromoCountdown--disabled\");\r\n\r\n $(timer).slideUp();\r\n } else {\r\n calculateTimeDifference(end, timeNow);\r\n }\r\n }\r\n\r\n function calculateTimeDifference(endTime, startTime) {\r\n var timeSpan = endTime.getTime() - startTime.getTime();\r\n\r\n const days = Math.floor(timeSpan / (1000 * 60 * 60 * 24));\r\n const hours = Math.floor((timeSpan % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));\r\n const minutes = Math.floor((timeSpan % (1000 * 60 * 60)) / (1000 * 60));\r\n const seconds = Math.floor((timeSpan % (1000 * 60)) / 1000);\r\n\r\n timer.querySelector(\".js-promo-countdown-days\").innerHTML = days > 9 ? days : \"0\" + days;\r\n timer.querySelector(\".js-promo-countdown-hours\").innerHTML = hours > 9 ? hours : \"0\" + hours;\r\n timer.querySelector(\".js-promo-countdown-minutes\").innerHTML = minutes > 9 ? minutes : \"0\" + minutes;\r\n timer.querySelector(\".js-promo-countdown-seconds\").innerHTML = seconds > 9 ? seconds : \"0\" + seconds;\r\n\r\n }\r\n});\r\n\r\n\n\n\n// WEBPACK FOOTER //\n// ./LeLab.Gcv.Web/src/atomic/organism/o-alert/o-alert.chunk.js","// removed by extract-text-webpack-plugin\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./LeLab.Gcv.Web/src/atomic/organism/o-alert/o-alert.scss\n// module id = 515\n// module chunks = 91"],"sourceRoot":""}