From 0ed2e2d5d0cc69a3694acfbbc4bd512cb443211f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Mon, 27 May 2024 17:46:12 +0200 Subject: [PATCH] chore: :package: npm build --- dist/browser/cookie-cn.css | 181 +++++++++------------ dist/browser/cookie-cn.js | 2 +- dist/browser/typings/ts/export/global.d.ts | 2 +- dist/browser/typings/ts/index.d.ts | 5 + dist/esm/ts/export/global.js | 2 +- dist/esm/ts/index.js | 125 +++++++++----- dist/typings/ts/export/global.d.ts | 2 +- dist/typings/ts/index.d.ts | 5 + dist/umd/css/standard.css | 181 +++++++++------------ dist/umd/main.js | 133 ++++++++++----- dist/umd/main.js.map | 2 +- 11 files changed, 343 insertions(+), 297 deletions(-) diff --git a/dist/browser/cookie-cn.css b/dist/browser/cookie-cn.css index 8296272..65b6d6e 100644 --- a/dist/browser/cookie-cn.css +++ b/dist/browser/cookie-cn.css @@ -24,7 +24,7 @@ border: 0; margin: 0; appearance: none; - background: #b9b9b9; + background: #d6d6d6; color: #000; cursor: pointer; font-family: "Barlow", sans-serif; @@ -36,7 +36,7 @@ } #cn-wrapper button:hover, #cn-wrapper button:focus { - background: #a0a0a0; + background: #bdbdbd; /* prettier-ignore */ color: #000; } @@ -57,30 +57,26 @@ /* Button settings */ /* Title settings */ /* Text settings */ -/* Accept/Deny btn settings */ +/* Switch Buttons */ /* Cookies list settings */ -#cn-wrapper .cn-nav #cn-settings-banner, #cn-wrapper .cn-nav #cn-accept-banner, #cn-wrapper .cn-nav #cn-deny-banner, #cn-wrapper .cn-content .cn-modal-container .accept label, -#cn-wrapper .cn-content .cn-modal-container .deny label, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal { +#cn-wrapper .cn-nav #cn-settings-banner, #cn-wrapper .cn-nav #cn-accept-banner, #cn-wrapper .cn-nav #cn-deny-banner, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal { display: flex; height: 3rem; flex-direction: column; align-items: center; justify-content: center; padding: 0; - background-color: #b9b9b9; + background-color: #d6d6d6; color: #000; font-family: "Barlow", sans-serif; font-size: 16px; } -#cn-wrapper .cn-nav #cn-settings-banner:hover, #cn-wrapper .cn-nav #cn-accept-banner:hover, #cn-wrapper .cn-nav #cn-deny-banner:hover, #cn-wrapper .cn-content .cn-modal-container .accept label:hover, -#cn-wrapper .cn-content .cn-modal-container .deny label:hover, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:hover, #cn-wrapper .cn-nav #cn-settings-banner:focus, #cn-wrapper .cn-nav #cn-accept-banner:focus, #cn-wrapper .cn-nav #cn-deny-banner:focus, #cn-wrapper .cn-content .cn-modal-container .accept label:focus, -#cn-wrapper .cn-content .cn-modal-container .deny label:focus, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:focus { - background-color: #a0a0a0; +#cn-wrapper .cn-nav #cn-settings-banner:hover, #cn-wrapper .cn-nav #cn-accept-banner:hover, #cn-wrapper .cn-nav #cn-deny-banner:hover, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:hover, #cn-wrapper .cn-nav #cn-settings-banner:focus, #cn-wrapper .cn-nav #cn-accept-banner:focus, #cn-wrapper .cn-nav #cn-deny-banner:focus, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:focus { + background-color: #bdbdbd; /* prettier-ignore */ color: #000; } -#cn-wrapper .cn-nav #cn-settings-banner:focus, #cn-wrapper .cn-nav #cn-accept-banner:focus, #cn-wrapper .cn-nav #cn-deny-banner:focus, #cn-wrapper .cn-content .cn-modal-container .accept label:focus, -#cn-wrapper .cn-content .cn-modal-container .deny label:focus, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:focus { +#cn-wrapper .cn-nav #cn-settings-banner:focus, #cn-wrapper .cn-nav #cn-accept-banner:focus, #cn-wrapper .cn-nav #cn-deny-banner:focus, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:focus { /* prettier-ignore */ outline-color: #000; } @@ -91,7 +87,7 @@ top: 0; left: 0; width: 100vw; - height: 100vh; + height: 100dvh; background-color: rgba(0, 0, 0, 0.6); cursor: pointer; opacity: 0; @@ -112,7 +108,13 @@ } #cn-wrapper { + position: fixed; z-index: 1050; + top: 0; + left: 0; + width: 100vw; + height: 100dvh; + pointer-events: none; } #cn-wrapper #cn-cookie-btn { position: fixed; @@ -126,6 +128,7 @@ background-color: #fff; box-shadow: 0 0.1rem 1rem rgba(0, 0, 0, 0.35); cursor: pointer; + pointer-events: auto; } @media (min-width: 535px) { #cn-wrapper #cn-cookie-btn { @@ -156,15 +159,14 @@ fill: #dc9c52; } #cn-wrapper #cn-banner { - position: fixed; + position: absolute; z-index: 1050; top: 0; bottom: 0; left: 0; display: flex; width: 100vw; - height: fit-content; - max-height: 100vh; + max-height: 100dvh; flex-direction: column; align-items: center; justify-content: flex-end; @@ -194,9 +196,6 @@ border-top-right-radius: 0.5rem; } } -#cn-wrapper #cn-banner p:not(.cn-modal-title) { - font-size: 16px; -} #cn-wrapper #cn-banner > * { pointer-events: all; } @@ -206,10 +205,12 @@ bottom: calc(0.5rem + 60px); left: 0; width: 30rem; - height: fit-content; - max-height: 38rem; + max-height: 26rem; border-radius: 0.5rem; } + #cn-wrapper #cn-banner.cn-modal-page { + max-height: 38rem; + } } #cn-wrapper #cn-li-template { display: none; @@ -222,11 +223,64 @@ padding: 0.8rem; overflow-y: auto; } +@media (min-width: 535px) { + #cn-wrapper .cn-content { + flex-grow: 0; + } +} +#cn-wrapper .cn-content .cn-switch { + position: relative; + display: inline-block; + overflow: hidden; + width: 4.2rem; + height: 2.4rem; + box-sizing: content-box; + cursor: pointer; +} +#cn-wrapper .cn-content .cn-switch:focus, #cn-wrapper .cn-content .cn-switch:focus-visible { + border-width: 0.1rem; + border-style: solid; + border-color: #346abf; +} +#cn-wrapper .cn-content .cn-switch input { + display: none; +} +#cn-wrapper .cn-content .cn-switch input + span { + position: absolute; + border-radius: 2rem; + background: #99b4df; + inset: 0; +} +#cn-wrapper .cn-content .cn-switch input + span::before { + position: absolute; + top: 50%; + left: 0.21rem; + display: inline-block; + width: 1.8rem; + height: 1.8rem; + border-radius: 50%; + background: #fff; + content: ""; + transform: translateY(-50%); + transition: all 0.5s; +} +#cn-wrapper .cn-content .cn-switch input:indeterminate + span { + background: #b7b7b7; +} +#cn-wrapper .cn-content .cn-switch input:indeterminate + span::before { + left: 1.08rem; +} +#cn-wrapper .cn-content .cn-switch input:checked + span { + background: #346abf; +} +#cn-wrapper .cn-content .cn-switch input:checked + span::before { + left: 2.16rem; +} #cn-wrapper .cn-content .cn-banner-content { display: flex; min-height: 100%; flex-direction: column; - color: #b9b9b9; + color: #707070; font-family: "Barlow", sans-serif; font-size: 16px; } @@ -261,37 +315,13 @@ margin: 6px 0; text-align: justify; } -#cn-wrapper .cn-content .cn-modal-container .cn-modal-title { - color: #dc9c52; - font-family: "Satisfy", sans-serif; - font-size: 28px; - font-weight: bold; - text-align: center; -} -#cn-wrapper .cn-content .cn-modal-container .cn-modal-subtitle { - margin-bottom: 6px; - color: #b9b9b9; - color: #dc9c52; - font-family: "Barlow", sans-serif; - font-size: 16px; - text-align: center; -} -#cn-wrapper .cn-content .cn-modal-container .cn-modal-description { - display: flex; - flex-direction: column; - align-items: center; - color: #b9b9b9; - font-family: "Barlow", sans-serif; - font-size: 16px; - font-weight: normal; - line-height: initial; -} #cn-wrapper .cn-content .cn-modal-container .cn-modal-wrapper { position: relative; display: flex; overflow: auto; flex-direction: column; align-items: center; + /* stylelint-disable-next-line no-descending-specificity */ } #cn-wrapper .cn-content .cn-modal-container .cn-modal-wrapper ul { display: flex; @@ -302,7 +332,7 @@ } #cn-wrapper .cn-content .cn-modal-container .cn-modal-wrapper .cn-cookie-wrapper { display: flex; - flex-direction: column; + flex-direction: row; align-items: center; justify-content: space-between; padding: 20px; @@ -338,58 +368,11 @@ font-weight: bold; } #cn-wrapper .cn-content .cn-modal-container .cn-cookie-infos .cn-cookie-description { - color: #b9b9b9; + color: #707070; } #cn-wrapper .cn-content .cn-modal-container .cn-cookie-infos a { width: fit-content; } -#cn-wrapper .cn-content .cn-modal-container .cn-cookie-buttons { - display: flex; - width: 200px; - justify-content: space-around; - margin-top: 6px; -} -#cn-wrapper .cn-content .cn-modal-container .cn-cookie-buttons input { - display: none; -} -#cn-wrapper .cn-content .cn-modal-container .cn-cookie-buttons label { - display: block; - width: fit-content; - padding: 6px 20px; - color: #fff; - cursor: pointer; - transition: 0.3s; -} -#cn-wrapper .cn-content .cn-modal-container .cn-cookie-buttons div { - display: table; - margin: 0 0.5em; - text-align: center; -} -#cn-wrapper .cn-content .cn-modal-container .accept label, -#cn-wrapper .cn-content .cn-modal-container .deny label { - height: inherit; - background: #6d6d6d; -} -#cn-wrapper .cn-content .cn-modal-container .accept label:hover, -#cn-wrapper .cn-content .cn-modal-container .accept label:focus { - background-color: #175917; -} -#cn-wrapper .cn-content .cn-modal-container .accept .active { - background-color: #218221; -} -#cn-wrapper .cn-content .cn-modal-container .deny label:hover, -#cn-wrapper .cn-content .cn-modal-container .deny label:focus { - background-color: #712121; -} -#cn-wrapper .cn-content .cn-modal-container .deny .active { - background-color: #992c2c; -} -#cn-wrapper .cn-content .cn-modal-container .accept input:checked ~ label { - background-color: #218221; -} -#cn-wrapper .cn-content .cn-modal-container .deny input:checked ~ label { - background-color: #992c2c; -} #cn-wrapper .cn-nav { display: flex; overflow: hidden; @@ -430,12 +413,6 @@ border-top: initial; } } -@media (min-width: 535px) { - #cn-wrapper { - width: 100%; - height: 100%; - } -} .cn-open { overflow: hidden !important; diff --git a/dist/browser/cookie-cn.js b/dist/browser/cookie-cn.js index 65ca2eb..29578b8 100644 --- a/dist/browser/cookie-cn.js +++ b/dist/browser/cookie-cn.js @@ -1 +1 @@ -!function(){class e{constructor(e){this.browserCookieName="cn-init",this.cookieTimeLife=6,this.cookieExpirationName="_expiration",this.cookiePolicies={sameSite:o.lax,secure:""},this.config=e;let i=this.readCookiesExpirationDate();i||(i=new Date,i.setMonth(i.getMonth()+this.cookieTimeLife)),this.cookieExpirationDate=i;const n=document.createElement("div");n.classList.add("cn-modal-bg"),document.body.append(n),this.modalBg=n;const s=document.querySelector("div#cn-wrapper"),a=document.querySelector("button#cn-cookie-btn"),r=document.querySelector("button#cn-close-modal"),c=document.querySelectorAll(".cn-cookie-link"),l=document.querySelector("div#cn-banner"),d=document.querySelector("div.cn-banner-content"),h=document.querySelector("div.cn-modal-container"),u=document.querySelector("button#cn-accept-banner"),k=document.querySelector("button#cn-deny-banner"),C=document.querySelector("button#cn-settings-banner"),m=document.querySelector("ul#cn-modal-list"),p=document.querySelector("div.cn-modal-wrapper"),b=document.querySelector("div#cn-li-template");if(!s)throw new Error("Cannot find div#cn-wrapper");if(!a)throw new Error("Cannot find 'button#cn-cookie-btn' element");if(!r)throw new Error("Cannot find 'button#cn-close-modal' element");if(!l)throw new Error("Cannot find 'div#cn-banner' element");if(!d)throw new Error("Cannot find 'div.cn-banner-content' element");if(!h)throw new Error("Cannot find 'div.cn-modal-container' element");if(!u)throw new Error("Cannot find 'button#cn-accept-banner' element");if(!k)throw new Error("Cannot find 'button#cn-deny-banner' element");if(!C)throw new Error("Cannot find 'button.cn-settings-banner' element");if(!m)throw new Error("Cannot find 'ul#cn-modal-list' element");if(!p)throw new Error("Cannot find 'div.cn-modal-wrapper' element");if(!b)throw new Error("Cannot find 'div#cn-li-template' element");this.cookieShowModalBtn=a,this.cookieCloseModalBtn=r,this.cookieLinkShowCustomizeModalList=c,this.cookieContainer=s,this.bannerContainer=l,this.bannerContent=d,this.cookiesUnorderedList=m,this.modalWrapper=p,this.modalContainer=h,this.acceptAllBtn=u,this.denyAllBtn=k,this.customizeBtn=C,this.bannerDetailsAreExpanded=!1,this.template=b;const v=this.template.cloneNode(!0);this.template.remove(),this.template=v,this.restrictCloseModal=!0,this.addEventPrevent(this.modalBg,"click",this.closeCookieModal),this.addEventPrevent(this.cookieCloseModalBtn,"click",this.closeCookieModal),this.addEventPrevent(this.acceptAllBtn,"click",this.acceptAllCookies),this.addEventPrevent(this.denyAllBtn,"click",this.denyAllCookies),this.addEventPrevent(this.customizeBtn,"click",this.toggleCookieModalPages),this.addEventPrevent(this.cookieShowModalBtn,"click",this.toggleCookieModal),this.cookieLinkShowCustomizeModalList.forEach((e=>{this.addEventPrevent(e,"click",this.openCookieModalToCookiePage),this.addEventKbdValidate(e,this.openCookieModalToCookiePage)})),this.cookiesMatchesConfig()&&!this.cookiesOlderThan(new Date)||(this.resetBrowserCookie(),this.openCookieModalToBannerPage()),this.updateRestrictCloseModal(),Object.entries(this.getCookieStatusList()).forEach((([e,o])=>{o!==t.wait?this.config[e]&&(o!==t.true?null!=this.config[e].fallback&&this.config[e].fallback():this.config[e].script()):this.openCookieModalToBannerPage()}))}updateRestrictCloseModal(){this.restrictCloseModal=!!Object.values(this.getCookieStatusList()).includes(t.wait),this.restrictCloseModal?this.cookieCloseModalBtn.classList.add("d-none"):this.cookieCloseModalBtn.classList.remove("d-none"),this.restrictCloseModal?this.modalBg.classList.add("cn-modal-bg-active"):this.modalBg.classList.remove("cn-modal-bg-active")}readCookiesExpirationDate(){var e;const t=(null!==(e=this.getBrowserCookieValue())&&void 0!==e?e:"").split(",").find((e=>e.startsWith(this.cookieExpirationName)));if(!t)return null;try{const e=Number.parseInt(t.replace(`${this.cookieExpirationName}=`,""));return isNaN(e)?null:new Date(e)}catch(e){return null}}cookiesOlderThan(e){return this.cookieExpirationDate.getTime()this.acceptCookie(e))),this.closeCookieModal()}acceptCookie(e){var o,i,n,s;const a=this.getCookie(e);this.setCookieStatus(e,t.true,a),null===(i=null===(o=this.cookieContainer.querySelector(`#${e}-accept`))||void 0===o?void 0:o.classList)||void 0===i||i.add("active"),null===(s=null===(n=this.cookieContainer.querySelector(`#${e}-deny`))||void 0===n?void 0:n.classList)||void 0===s||s.remove("active")}denyAllCookies(){Object.keys(this.config).forEach((e=>this.denyCookie(e))),this.closeCookieModal()}denyCookie(e){var o,i,n,s;const a=this.getCookie(e);this.setCookieStatus(e,t.false,a),null===(i=null===(o=this.cookieContainer.querySelector(`#${e}-deny`))||void 0===o?void 0:o.classList)||void 0===i||i.add("active"),null===(s=null===(n=this.cookieContainer.querySelector(`#${e}-accept`))||void 0===n?void 0:n.classList)||void 0===s||s.remove("active")}denyAllWaitingCookies(){Object.entries(this.getCookieStatusList()).forEach((([e,o])=>{o!==t.wait||this.setBrowserCookieStatus(e,t.false)})),this.updateRestrictCloseModal()}getCookie(e){var t;const o=null===(t=Object.entries(this.config).find((t=>t[0]===e)))||void 0===t?void 0:t[1];if(void 0===o)throw new Error(`Cookie options ${e} not found in list`);return o}getCookieStatusList(){const e=this.getBrowserCookieValue(),t={};return void 0===e||e.split(",").filter((e=>!e.startsWith(this.cookieExpirationName))).forEach((e=>{const o=e.split("=");t[o[0]]=o[1]})),t}containsCookieStatus(e){const t=this.getCookieStatusList();return void 0!==Object.keys(t).find((t=>t===e))}setCookieStatus(e,o,i){console.log(`setcookie status ${e} ${o}`),o!==t.true?o!==t.false?this.setBrowserCookieStatus(e,t.wait):this.removeCookieStatus(e,i):this.addCookieStatus(e,i)}addCookieStatus(e,o){o.script&&o.script(),this.setBrowserCookieStatus(e,t.true)}removeCookieStatus(e,o){const i=document.getElementById(e);i&&i.remove(),o.fallback&&o.fallback(),this.setBrowserCookieStatus(e,t.false)}setBrowserCookieStatus(e,t){const o=this.getCookieStatusList();this.deleteBrowserCookie(),o[e]=t,this.saveBrowserCookie(o),this.updateRestrictCloseModal()}hasBrowserCookie(){return Boolean(this.getBrowserCookieValue())}getBrowserCookieValue(){const e=document.cookie.match(new RegExp("(?:^|; )"+this.browserCookieName.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}saveBrowserCookie(e){const t=new Date,o=Object.entries(e).map((([e,t])=>`${e}=${t}`));this.cookieExpirationDate=new Date(t.setMonth(t.getMonth()+this.cookieTimeLife)),o.push(`${this.cookieExpirationName}=${this.cookieExpirationDate.getTime()}`),document.cookie=`${this.browserCookieName}=${o.join(",")};path=/${location.hostname?`;domain=${location.hostname}`:""};expires=${this.cookieExpirationDate.toUTCString()};${this.getCookiePoliciesAsString()}`}deleteBrowserCookie(){this.hasBrowserCookie()&&(document.cookie=`${this.browserCookieName}=;path=/${location.hostname?`;domain=.${location.hostname}`:""};expires=Thu, 01 Jan 1970 00:00:01 GMT;`,document.cookie=`${this.browserCookieName}=;path=/${location.hostname?`;domain=${location.hostname}`:""};expires=Thu, 01 Jan 1970 00:00:01 GMT;`)}getCookiePoliciesAsString(){return Object.entries(this.cookiePolicies).map((([e,t])=>`${e}=${t}`)).join(";")}resetBrowserCookie(){const e={};Object.entries(this.config).forEach((([o])=>e[o]=t.wait)),this.saveBrowserCookie(e)}addEvent(e,t,o){return e.addEventListener(t,o.bind(this),!1)}addEventPrevent(e,t,o){return e.addEventListener(t,(e=>{e.preventDefault(),o.call(this,e)}),!1)}addEventKbdValidate(e,t){return this.addEvent(e,"keydown",(e=>{const o=e;" "!=o.key&&"Space"!=o.code&&32!=o.keyCode&&"Enter"!=o.key&&"Enter"!=o.code&&13!=o.keyCode||(t.call(this,o),e.preventDefault())}))}toggleCookieModal(){document.body.classList.contains("cn-open")?this.closeCookieModal():this.openCookieModalToBannerPage()}openCookieModalToBannerPage(){this.openCookieModalToCookiePage(),this.toggleCookieModalPages()}openCookieModalToCookiePage(){document.body.classList.add("cn-open"),this.resetCookieModal(),this.bannerContent.classList.add("d-none"),this.modalContainer.classList.remove("d-none"),this.modalWrapper.scrollTop=0,this.setupCookieModalList(),this.setTabIndex()}closeCookieModal(){if(this.updateRestrictCloseModal(),this.restrictCloseModal)throw new Error("You need to accept or refuse all cookies");document.body.classList.remove("cn-open"),this.unsetTabIndex(),this.setupCookieModalList()}setTabIndex(){document.documentElement.setAttribute("tabindex","-1"),setTimeout((()=>{const e='a[href], button, [role="button"], input, embed, object, iframe, textarea, select, details, [tabindex]:not([tabindex="-1"])';[...document.body.querySelectorAll(e)].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden"))).forEach((e=>{e.setAttribute("tabindex","-1"),e.classList.add("cn-disabled")})),[...this.cookieContainer.querySelectorAll(e)].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden")&&!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length))).forEach((e=>{e.setAttribute("tabindex","0"),e.classList.remove("cn-disabled")})),this.cookieShowModalBtn.setAttribute("tabindex","-1")}),500)}unsetTabIndex(){document.documentElement.setAttribute("tabindex","0"),setTimeout((()=>{document.body.querySelectorAll(".cn-disabled").forEach((e=>{e.setAttribute("tabindex","0"),e.classList.remove("cn-disabled")})),this.cookieShowModalBtn.setAttribute("tabindex","0")}),500)}resetCookieModal(){if(this.bannerContent.classList.remove("d-none"),this.modalContainer.classList.add("d-none"),!this.customizeBtn.dataset.openModal)throw new Error("Cannot find attribut data-open-modal");this.customizeBtn.innerHTML=this.customizeBtn.dataset.openModal}setupCookieModalList(){this.cookiesUnorderedList.innerHTML="",Object.entries(this.config).forEach((([e,o])=>{const i=document.createElement("li"),n=this.template.children.item(0);if(null===n)throw new Error("Cannot find child item");i.append(n.cloneNode(!0));const s=i.querySelector("span.cn-cookie-name"),a=i.querySelector("span.cn-cookie-description"),r=i.querySelector(".cn-cookie-link"),c=i.querySelector(".accept > input"),l=i.querySelector(".deny > input"),d=i.querySelector(".accept > label"),h=i.querySelector(".deny > label");s.textContent=o.name,a.textContent=o.description,r.textContent=o.labelLink,r.setAttribute("href",o.link),c.id=e+"-accept",c.name=e,c.dataset.name=e,d.htmlFor=e+"-accept",d.textContent=`${d.textContent} ${e}`,d.title=`${d.textContent} ${e}`,l.id=e+"-deny",l.name=e,l.dataset.name=e,h.htmlFor=e+"-deny",h.textContent=`${h.textContent} ${e}`,h.title=`${h.textContent} ${e}`;const u=()=>{d.classList.add("active"),h.classList.remove("active"),this.setCookieStatus(e,t.true,o)},k=()=>{d.classList.remove("active"),h.classList.add("active"),this.setCookieStatus(e,t.false,o)};this.addEvent(c,"click",u),this.addEventKbdValidate(d,u),this.addEvent(l,"click",k),this.addEventKbdValidate(h,k),this.cookiesUnorderedList.append(i),this.hasBrowserCookie()&&Object.entries(this.getCookieStatusList()).forEach((([o,i])=>{if(o===e)switch(d.classList.remove("active"),h.classList.remove("active"),i){case t.true:d.classList.add("active");break;case t.false:h.classList.add("active")}}))}))}toggleCookieModalPages(){this.bannerContent.classList.toggle("d-none"),this.modalContainer.classList.toggle("d-none"),this.modalContainer.classList.contains("d-none")||this.denyAllWaitingCookies(),this.setTabIndex(),this.setupCookieModalList(),this.togglePersonalizeBtn()}togglePersonalizeBtn(){const e=this.customizeBtn.dataset;this.modalWrapper.scrollTop=0,this.bannerContent.classList.contains("d-none")?(this.customizeBtn.innerHTML=e.openModal,this.customizeBtn.title=e.openModal):(this.customizeBtn.innerHTML=e.closeModal,this.customizeBtn.title=e.closeModal)}}var t,o;!function(e){e.true="true",e.false="false",e.wait="wait"}(t||(t={})),function(e){e.lax="lax",e.strict="strict",e.none="none"}(o||(o={}));const i=window.CookieNotice;e.noConflict=function(t=!1){return t&&window.CookieNotice===e&&(window.CookieNotice=i),e},window.CookieNotice=e.noConflict()}(); +!function(){class e{constructor(e){this.browserCookieName="cn-init",this.cookieTimeLife=6,this.cookieExpirationName="_expiration",this.cookiePolicies={sameSite:o.lax,secure:""},this.config=e;let i=this.readCookiesExpirationDate();i||(i=new Date,i.setMonth(i.getMonth()+this.cookieTimeLife)),this.cookieExpirationDate=i;const n=document.createElement("div");n.classList.add("cn-modal-bg"),document.body.append(n),this.modalBg=n;const s=document.querySelector("div#cn-wrapper"),a=document.querySelector("button#cn-cookie-btn"),r=document.querySelector("button#cn-close-modal"),c=document.querySelectorAll(".cn-cookie-link"),d=document.querySelector("div#cn-banner"),l=document.querySelector("div.cn-banner-content"),h=document.querySelector("div.cn-modal-container"),u=document.querySelector("button#cn-accept-banner"),k=document.querySelector("button#cn-deny-banner"),C=document.querySelector("button#cn-settings-banner"),m=document.querySelector("ul#cn-modal-list"),b=document.querySelector("div.cn-modal-wrapper"),p=document.querySelector("div#cn-li-template");if(!s)throw new Error("Cannot find div#cn-wrapper");if(!a)throw new Error("Cannot find 'button#cn-cookie-btn' element");if(!r)throw new Error("Cannot find 'button#cn-close-modal' element");if(!d)throw new Error("Cannot find 'div#cn-banner' element");if(!l)throw new Error("Cannot find 'div.cn-banner-content' element");if(!h)throw new Error("Cannot find 'div.cn-modal-container' element");if(!u)throw new Error("Cannot find 'button#cn-accept-banner' element");if(!k)throw new Error("Cannot find 'button#cn-deny-banner' element");if(!C)throw new Error("Cannot find 'button.cn-settings-banner' element");if(!m)throw new Error("Cannot find 'ul#cn-modal-list' element");if(!b)throw new Error("Cannot find 'div.cn-modal-wrapper' element");if(!p)throw new Error("Cannot find 'div#cn-li-template' element");this.cookieShowModalBtn=a,this.cookieCloseModalBtn=r,this.cookieLinkShowCustomizeModalList=c,this.cookieContainer=s,this.bannerContainer=d,this.bannerContent=l,this.cookiesUnorderedList=m,this.modalWrapper=b,this.modalContainer=h,this.acceptAllBtn=u,this.denyAllBtn=k,this.customizeBtn=C,this.bannerDetailsAreExpanded=!1,this.template=p;const g=this.template.cloneNode(!0);this.template.remove(),this.template=g,this.restrictCloseModal=!0,this.addEventPrevent(this.modalBg,"click",this.closeCookieModal),this.addEventPrevent(this.cookieCloseModalBtn,"click",this.closeCookieModal),this.addEventPrevent(this.acceptAllBtn,"click",this.acceptAllCookies),this.addEventPrevent(this.denyAllBtn,"click",this.denyAllCookies),this.addEventPrevent(this.customizeBtn,"click",this.switchToModalPageOrClose),this.addEventPrevent(this.cookieShowModalBtn,"click",this.toggleCookieModal),this.cookieLinkShowCustomizeModalList.forEach((e=>{this.addEventPrevent(e,"click",this.openCookieModalToCookiePage),this.addEventKbdValidate(e,this.openCookieModalToCookiePage)})),this.cookiesMatchesConfig()&&!this.cookiesOlderThan(new Date)||(this.resetBrowserCookie(),this.openCookieModalToBannerPage()),this.updateRestrictCloseModal(),Object.entries(this.getCookieStatusList()).forEach((([e,o])=>{o!==t.wait?this.config[e]&&(o!==t.true?null!=this.config[e].fallback&&this.config[e].fallback():this.config[e].script()):this.openCookieModalToBannerPage()}))}updateRestrictCloseModal(){this.restrictCloseModal=!!Object.values(this.getCookieStatusList()).includes(t.wait),this.restrictCloseModal?this.cookieCloseModalBtn.classList.add("d-none"):this.cookieCloseModalBtn.classList.remove("d-none"),this.restrictCloseModal?this.modalBg.classList.add("cn-modal-bg-active"):this.modalBg.classList.remove("cn-modal-bg-active")}readCookiesExpirationDate(){var e;const t=(null!==(e=this.getBrowserCookieValue())&&void 0!==e?e:"").split(",").find((e=>e.startsWith(this.cookieExpirationName)));if(!t)return null;try{const e=Number.parseInt(t.replace(`${this.cookieExpirationName}=`,""));return isNaN(e)?null:new Date(e)}catch(e){return null}}cookiesOlderThan(e){return this.cookieExpirationDate.getTime()this.acceptCookie(e))),this.closeCookieModal()}acceptCookie(e){const o=this.getCookie(e);this.setCookieStatus(e,t.true,o);const i=document.getElementById(`${e}-switch`);i.querySelector("input").checked=!0,i.ariaChecked="true"}denyAllCookies(){Object.keys(this.config).forEach((e=>this.denyCookie(e))),this.closeCookieModal()}denyCookie(e){const o=this.getCookie(e);this.setCookieStatus(e,t.false,o);const i=document.getElementById(`${e}-switch`);i.querySelector("input").checked=!1,i.ariaChecked="false"}denyAllWaitingCookies(){Object.entries(this.getCookieStatusList()).forEach((([e,o])=>{o!==t.wait||this.setBrowserCookieStatus(e,t.false)})),this.updateRestrictCloseModal()}getCookie(e){var t;const o=null===(t=Object.entries(this.config).find((t=>t[0]===e)))||void 0===t?void 0:t[1];if(void 0===o)throw new Error(`Cookie options ${e} not found in list`);return o}getCookieStatusList(){const e=this.getBrowserCookieValue(),t={};return void 0===e||e.split(",").filter((e=>!e.startsWith(this.cookieExpirationName))).forEach((e=>{const o=e.split("=");t[o[0]]=o[1]})),t}containsCookieStatus(e){const t=this.getCookieStatusList();return void 0!==Object.keys(t).find((t=>t===e))}setCookieStatus(e,o,i){o!==t.true?o!==t.false?this.setBrowserCookieStatus(e,t.wait):this.removeCookieStatus(e,i):this.addCookieStatus(e,i)}addCookieStatus(e,o){o.script&&o.script(),this.setBrowserCookieStatus(e,t.true)}removeCookieStatus(e,o){const i=document.getElementById(e);i&&i.remove(),o.fallback&&o.fallback(),this.setBrowserCookieStatus(e,t.false)}setBrowserCookieStatus(e,t){const o=this.getCookieStatusList();this.deleteBrowserCookie(),o[e]=t,this.saveBrowserCookie(o),this.updateRestrictCloseModal()}hasBrowserCookie(){return Boolean(this.getBrowserCookieValue())}getBrowserCookieValue(){const e=document.cookie.match(new RegExp("(?:^|; )"+this.browserCookieName.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}saveBrowserCookie(e){const t=new Date,o=Object.entries(e).map((([e,t])=>`${e}=${t}`));this.cookieExpirationDate=new Date(t.setMonth(t.getMonth()+this.cookieTimeLife)),o.push(`${this.cookieExpirationName}=${this.cookieExpirationDate.getTime()}`),document.cookie=`${this.browserCookieName}=${o.join(",")};path=/${location.hostname?`;domain=${location.hostname}`:""};expires=${this.cookieExpirationDate.toUTCString()};${this.getCookiePoliciesAsString()}`}deleteBrowserCookie(){this.hasBrowserCookie()&&(document.cookie=`${this.browserCookieName}=;path=/${location.hostname?`;domain=.${location.hostname}`:""};expires=Thu, 01 Jan 1970 00:00:01 GMT;`,document.cookie=`${this.browserCookieName}=;path=/${location.hostname?`;domain=${location.hostname}`:""};expires=Thu, 01 Jan 1970 00:00:01 GMT;`)}getCookiePoliciesAsString(){return Object.entries(this.cookiePolicies).map((([e,t])=>`${e}=${t}`)).join(";")}resetBrowserCookie(){const e={};Object.entries(this.config).forEach((([o])=>e[o]=t.wait)),this.saveBrowserCookie(e)}addEvent(e,t,o){return e.addEventListener(t,o.bind(this),!1)}addEventPrevent(e,t,o){return e.addEventListener(t,(e=>{e.preventDefault(),o.call(this,e)}),!1)}addEventKbdValidate(e,t){return this.addEvent(e,"keydown",(e=>{const o=e;" "!=o.key&&"Space"!=o.code&&32!=o.keyCode&&"Enter"!=o.key&&"Enter"!=o.code&&13!=o.keyCode||(t.call(this,o),e.preventDefault())}))}toggleCookieModal(){document.body.classList.contains("cn-open")?this.closeCookieModal():this.openCookieModalToBannerPage()}openCookieModalToBannerPage(){this.openCookieModalToCookiePage(),this.toggleCookieModalPages()}openCookieModalToCookiePage(){document.body.classList.add("cn-open"),this.resetCookieModal(),this.bannerContent.classList.add("d-none"),this.modalContainer.classList.remove("d-none"),this.bannerContainer.classList.add("cn-modal-page"),this.modalWrapper.scrollTop=0,this.setupCookieModalList(),this.setTabIndex()}closeCookieModal(){if(this.updateRestrictCloseModal(),this.restrictCloseModal)throw new Error("You need to accept or refuse all cookies");document.body.classList.remove("cn-open"),this.isOnBannerPage()||(this.bannerContent.classList.toggle("d-none"),this.modalContainer.classList.toggle("d-none"),this.bannerContainer.classList.remove("cn-modal-page")),this.unsetTabIndex(),this.setupCookieModalList()}setTabIndex(){document.documentElement.setAttribute("tabindex","-1"),setTimeout((()=>{const e='a[href], button, [role="button"], input, embed, object, iframe, textarea, select, details, [tabindex]:not([tabindex="-1"])';[...document.body.querySelectorAll(e)].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden")&&!this.cookieContainer.contains(e))).forEach((e=>{e.setAttribute("tabindex","-1"),e.classList.add("cn-disabled")})),[...this.cookieContainer.querySelectorAll(e)].filter((e=>!(e.hasAttribute("disabled")||e.getAttribute("aria-hidden")||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)||this.cookieContainer.contains(e)))).forEach((e=>{e.setAttribute("tabindex","0"),e.classList.remove("cn-disabled")})),this.cookieShowModalBtn.setAttribute("tabindex","-1")}),500)}unsetTabIndex(){document.documentElement.setAttribute("tabindex","0"),setTimeout((()=>{document.body.querySelectorAll(".cn-disabled").forEach((e=>{e.setAttribute("tabindex","0"),e.classList.remove("cn-disabled")})),this.cookieShowModalBtn.setAttribute("tabindex","0")}),500)}resetCookieModal(){if(this.bannerContent.classList.remove("d-none"),this.modalContainer.classList.add("d-none"),this.bannerContainer.classList.remove("cn-modal-page"),!this.customizeBtn.dataset.openModal)throw new Error("Cannot find attribut data-open-modal");this.customizeBtn.innerHTML=this.customizeBtn.dataset.openModal}setupCookieModalList(){this.cookiesUnorderedList.innerHTML="",Object.entries(this.config).forEach((([e,o])=>{const i=document.createElement("li"),n=this.template.children.item(0);if(null===n)throw new Error("Cannot find child item");i.append(n.cloneNode(!0));const s=i.querySelector("span.cn-cookie-name"),a=i.querySelector("span.cn-cookie-description"),r=i.querySelector(".cn-cookie-link"),c=i.querySelector(".cn-switch"),d=i.querySelector(".cn-switch > input");d.indeterminate=!0,d.checked=!1,s.textContent=o.name,a.id=`${e}-desc`,a.textContent=o.description,r.textContent=o.labelLink,r.setAttribute("href",o.link),c.id=`${e}-switch`,c.name=e,c.dataset.name=e,c.setAttribute("aria-labelledby",`${e}-desc`),c.setAttribute("aria-describedby",`${e}-desc`);const l=()=>{this.setCookieStatus(e,c.checked?t.true:t.false,o)};this.addEvent(c,"click",(()=>{l(),d.checked?c.ariaChecked="true":c.ariaChecked="false"})),this.addEventKbdValidate(c,(()=>{l(),d.checked=!d.checked,d.checked?c.ariaChecked="true":c.ariaChecked="false"})),this.cookiesUnorderedList.append(i),this.hasBrowserCookie()&&Object.entries(this.getCookieStatusList()).forEach((([o,i])=>{if(o===e)switch(i){case t.true:d.indeterminate=!1,d.checked=!0;break;case t.false:d.indeterminate=!1,d.checked=!1;break;case t.wait:d.indeterminate=!0,d.checked=!1}}))}))}switchToModalPageOrClose(){this.isOnBannerPage()?this.toggleCookieModalPages():this.closeCookieModal()}toggleCookieModalPages(){this.bannerContent.classList.toggle("d-none"),this.modalContainer.classList.toggle("d-none"),this.bannerContainer.classList.toggle("cn-modal-page"),this.isOnBannerPage()||(this.bannerContainer.classList.add("cn-modal-page"),this.denyAllWaitingCookies()),this.setTabIndex(),this.setupCookieModalList(),this.togglePersonalizeBtn()}togglePersonalizeBtn(){const e=this.customizeBtn.dataset;this.modalWrapper.scrollTop=0,this.bannerContent.classList.contains("d-none")?(this.customizeBtn.innerHTML=e.openModal,this.customizeBtn.title=e.openModal):(this.customizeBtn.innerHTML=e.closeModal,this.customizeBtn.title=e.closeModal)}isOnBannerPage(){return this.modalContainer.classList.contains("d-none")}}var t,o;!function(e){e.true="true",e.false="false",e.wait="wait"}(t||(t={})),function(e){e.lax="lax",e.strict="strict",e.none="none"}(o||(o={}));const i=window.CookieNotice;e.noConflict=function(t=!1){return t&&window.CookieNotice===e&&(window.CookieNotice=i),e},window.CookieNotice=e.noConflict()}(); diff --git a/dist/browser/typings/ts/export/global.d.ts b/dist/browser/typings/ts/export/global.d.ts index 37a5cd2..c61571c 100644 --- a/dist/browser/typings/ts/export/global.d.ts +++ b/dist/browser/typings/ts/export/global.d.ts @@ -1,5 +1,5 @@ -import CookieNotice from "./../index"; import "./../../scss/themes/standard.scss"; +import CookieNotice from "./../index"; declare global { interface Window { CookieNotice: typeof CookieNotice; diff --git a/dist/browser/typings/ts/index.d.ts b/dist/browser/typings/ts/index.d.ts index a9a9df9..9b3867e 100644 --- a/dist/browser/typings/ts/index.d.ts +++ b/dist/browser/typings/ts/index.d.ts @@ -200,6 +200,7 @@ export default class CookieNotice { * Set the cookies list in the modal */ setupCookieModalList(): void; + switchToModalPageOrClose(): void; /** * Toggle Cookie modal pages */ @@ -208,6 +209,10 @@ export default class CookieNotice { * Toggle customize btn */ togglePersonalizeBtn(): void; + /** + * Get the actual page: banner or modal (with cookie choices) + */ + isOnBannerPage(): boolean; } declare enum CookieStatus { true = "true", diff --git a/dist/esm/ts/export/global.js b/dist/esm/ts/export/global.js index fd1edcd..3b1753a 100644 --- a/dist/esm/ts/export/global.js +++ b/dist/esm/ts/export/global.js @@ -1,5 +1,5 @@ -import CookieNotice from "./../index"; import "./../../scss/themes/standard.scss"; +import CookieNotice from "./../index"; const // Map over CookieNotice in case of overwrite _CookieNotice = window.CookieNotice; CookieNotice.noConflict = function (deep = false) { diff --git a/dist/esm/ts/index.js b/dist/esm/ts/index.js index f1aa257..efb7aed 100644 --- a/dist/esm/ts/index.js +++ b/dist/esm/ts/index.js @@ -87,7 +87,7 @@ export default class CookieNotice { this.addEventPrevent(this.cookieCloseModalBtn, "click", this.closeCookieModal); this.addEventPrevent(this.acceptAllBtn, "click", this.acceptAllCookies); this.addEventPrevent(this.denyAllBtn, "click", this.denyAllCookies); - this.addEventPrevent(this.customizeBtn, "click", this.toggleCookieModalPages); + this.addEventPrevent(this.customizeBtn, "click", this.switchToModalPageOrClose); this.addEventPrevent(this.cookieShowModalBtn, "click", this.toggleCookieModal); this.cookieLinkShowCustomizeModalList.forEach((cookieLink) => { this.addEventPrevent(cookieLink, "click", this.openCookieModalToCookiePage); @@ -177,11 +177,12 @@ export default class CookieNotice { * Accept a specific cookie */ acceptCookie(cookieName) { - var _a, _b, _c, _d; const cookieOptions = this.getCookie(cookieName); this.setCookieStatus(cookieName, CookieStatus.true, cookieOptions); - (_b = (_a = this.cookieContainer.querySelector(`#${cookieName}-accept`)) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.add("active"); - (_d = (_c = this.cookieContainer.querySelector(`#${cookieName}-deny`)) === null || _c === void 0 ? void 0 : _c.classList) === null || _d === void 0 ? void 0 : _d.remove("active"); + const cnSwitch = document.getElementById(`${cookieName}-switch`); + const cnSwitchInput = cnSwitch.querySelector("input"); + cnSwitchInput.checked = true; + cnSwitch.ariaChecked = "true"; } /** * Deny a all cookies @@ -194,11 +195,12 @@ export default class CookieNotice { * Deny a specific cookie */ denyCookie(cookieName) { - var _a, _b, _c, _d; const cookieOptions = this.getCookie(cookieName); this.setCookieStatus(cookieName, CookieStatus.false, cookieOptions); - (_b = (_a = this.cookieContainer.querySelector(`#${cookieName}-deny`)) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.add("active"); - (_d = (_c = this.cookieContainer.querySelector(`#${cookieName}-accept`)) === null || _c === void 0 ? void 0 : _c.classList) === null || _d === void 0 ? void 0 : _d.remove("active"); + const cnSwitch = document.getElementById(`${cookieName}-switch`); + const cnSwitchInput = cnSwitch.querySelector("input"); + cnSwitchInput.checked = false; + cnSwitch.ariaChecked = "false"; } /** * Deny all waiting cookies @@ -262,7 +264,6 @@ export default class CookieNotice { * @param cookieOption */ setCookieStatus(cookieName, status, cookieOption) { - console.log(`setcookie status ${cookieName} ${status}`); if (status === CookieStatus.true) { this.addCookieStatus(cookieName, cookieOption); return; @@ -450,6 +451,7 @@ export default class CookieNotice { this.resetCookieModal(); this.bannerContent.classList.add("d-none"); this.modalContainer.classList.remove("d-none"); + this.bannerContainer.classList.add("cn-modal-page"); // Scroll to the top of the cookies list this.modalWrapper.scrollTop = 0; this.setupCookieModalList(); @@ -462,6 +464,12 @@ export default class CookieNotice { this.updateRestrictCloseModal(); if (!this.restrictCloseModal) { document.body.classList.remove("cn-open"); + if (!this.isOnBannerPage()) { + // * Make toggle page to banner on closing + this.bannerContent.classList.toggle("d-none"); + this.modalContainer.classList.toggle("d-none"); + this.bannerContainer.classList.remove("cn-modal-page"); + } this.unsetTabIndex(); this.setupCookieModalList(); } @@ -480,7 +488,8 @@ export default class CookieNotice { // * Only focusable elements [...document.body.querySelectorAll(focusableSelector)] .filter((el) => !el.hasAttribute("disabled") && - !el.getAttribute("aria-hidden")) + !el.getAttribute("aria-hidden") && + !this.cookieContainer.contains(el)) .forEach((el) => { el.setAttribute("tabindex", "-1"); el.classList.add("cn-disabled"); @@ -491,7 +500,8 @@ export default class CookieNotice { // * Only visible elements !!(el.offsetWidth || el.offsetHeight || - el.getClientRects().length)) + el.getClientRects().length) && + !this.cookieContainer.contains(el)) .forEach((el) => { el.setAttribute("tabindex", "0"); el.classList.remove("cn-disabled"); @@ -518,6 +528,7 @@ export default class CookieNotice { resetCookieModal() { this.bannerContent.classList.remove("d-none"); this.modalContainer.classList.add("d-none"); + this.bannerContainer.classList.remove("cn-modal-page"); if (!this.customizeBtn.dataset.openModal) { throw new Error("Cannot find attribut data-open-modal"); } @@ -538,39 +549,45 @@ export default class CookieNotice { const name = cookie.querySelector("span.cn-cookie-name"); const description = cookie.querySelector("span.cn-cookie-description"); const link = cookie.querySelector(".cn-cookie-link"); - const acceptInput = cookie.querySelector(".accept > input"); - const denyInput = cookie.querySelector(".deny > input"); - const acceptLabel = cookie.querySelector(".accept > label"); - const denyLabel = cookie.querySelector(".deny > label"); + const cnSwitch = cookie.querySelector(".cn-switch"); + const cnSwitchInput = cookie.querySelector(".cn-switch > input"); + // * Undertermined state + cnSwitchInput.indeterminate = true; + cnSwitchInput.checked = false; + // * Assign cookie aside content name.textContent = cookieConfig.name; + description.id = `${cookieName}-desc`; description.textContent = cookieConfig.description; link.textContent = cookieConfig.labelLink; link.setAttribute("href", cookieConfig.link); - acceptInput.id = cookieName + "-accept"; - acceptInput.name = cookieName; - acceptInput.dataset.name = cookieName; - acceptLabel.htmlFor = cookieName + "-accept"; - acceptLabel.textContent = `${acceptLabel.textContent} ${cookieName}`; - acceptLabel.title = `${acceptLabel.textContent} ${cookieName}`; - denyInput.id = cookieName + "-deny"; - denyInput.name = cookieName; - denyInput.dataset.name = cookieName; - denyLabel.htmlFor = cookieName + "-deny"; - denyLabel.textContent = `${denyLabel.textContent} ${cookieName}`; - denyLabel.title = `${denyLabel.textContent} ${cookieName}`; - const acceptFn = () => { - acceptLabel.classList.add("active"); - denyLabel.classList.remove("active"); - this.setCookieStatus(cookieName, CookieStatus.true, cookieConfig); - }, denyFn = () => { - acceptLabel.classList.remove("active"); - denyLabel.classList.add("active"); - this.setCookieStatus(cookieName, CookieStatus.false, cookieConfig); + // * Assign cookie controls + cnSwitch.id = `${cookieName}-switch`; + cnSwitch.name = cookieName; + cnSwitch.dataset.name = cookieName; + cnSwitch.setAttribute("aria-labelledby", `${cookieName}-desc`); + cnSwitch.setAttribute("aria-describedby", `${cookieName}-desc`); + const toggleCookie = () => { + this.setCookieStatus(cookieName, cnSwitch.checked ? CookieStatus.true : CookieStatus.false, cookieConfig); }; - this.addEvent(acceptInput, "click", acceptFn); - this.addEventKbdValidate(acceptLabel, acceptFn); - this.addEvent(denyInput, "click", denyFn); - this.addEventKbdValidate(denyLabel, denyFn); + this.addEvent(cnSwitch, "click", () => { + toggleCookie(); + if (cnSwitchInput.checked) { + cnSwitch.ariaChecked = "true"; + } + else { + cnSwitch.ariaChecked = "false"; + } + }); + this.addEventKbdValidate(cnSwitch, () => { + toggleCookie(); + cnSwitchInput.checked = !cnSwitchInput.checked; + if (cnSwitchInput.checked) { + cnSwitch.ariaChecked = "true"; + } + else { + cnSwitch.ariaChecked = "false"; + } + }); this.cookiesUnorderedList.append(cookie); if (!this.hasBrowserCookie()) { // * Ldcweb cookie is not set. @@ -579,27 +596,43 @@ export default class CookieNotice { // * Setup list status state Object.entries(this.getCookieStatusList()).forEach(([ckName, cookieStatus]) => { if (ckName === cookieName) { - acceptLabel.classList.remove("active"); - denyLabel.classList.remove("active"); switch (cookieStatus) { case CookieStatus.true: - acceptLabel.classList.add("active"); + cnSwitchInput.indeterminate = false; + cnSwitchInput.checked = true; break; case CookieStatus.false: - denyLabel.classList.add("active"); + cnSwitchInput.indeterminate = false; + cnSwitchInput.checked = false; + break; + case CookieStatus.wait: + cnSwitchInput.indeterminate = true; + cnSwitchInput.checked = false; break; } } }); }); } + switchToModalPageOrClose() { + // * Modification du comportement du bouton, même si ca n'a pas de sens. + // https://lab.s-web.fr/ldc-web/projets/ldc-web-cookie-notice/-/issues/9` + if (this.isOnBannerPage()) { + this.toggleCookieModalPages(); + return; + } + // * Pas de permutation en arrière + this.closeCookieModal(); + } /** * Toggle Cookie modal pages */ toggleCookieModalPages() { this.bannerContent.classList.toggle("d-none"); this.modalContainer.classList.toggle("d-none"); - if (!this.modalContainer.classList.contains("d-none")) { + this.bannerContainer.classList.toggle("cn-modal-page"); + if (!this.isOnBannerPage()) { + this.bannerContainer.classList.add("cn-modal-page"); this.denyAllWaitingCookies(); } this.setTabIndex(); @@ -623,6 +656,12 @@ export default class CookieNotice { this.customizeBtn.title = customizeBtnBannerDataset.closeModal; } } + /** + * Get the actual page: banner or modal (with cookie choices) + */ + isOnBannerPage() { + return this.modalContainer.classList.contains("d-none"); + } } var CookieStatus; (function (CookieStatus) { diff --git a/dist/typings/ts/export/global.d.ts b/dist/typings/ts/export/global.d.ts index 37a5cd2..c61571c 100644 --- a/dist/typings/ts/export/global.d.ts +++ b/dist/typings/ts/export/global.d.ts @@ -1,5 +1,5 @@ -import CookieNotice from "./../index"; import "./../../scss/themes/standard.scss"; +import CookieNotice from "./../index"; declare global { interface Window { CookieNotice: typeof CookieNotice; diff --git a/dist/typings/ts/index.d.ts b/dist/typings/ts/index.d.ts index a9a9df9..9b3867e 100644 --- a/dist/typings/ts/index.d.ts +++ b/dist/typings/ts/index.d.ts @@ -200,6 +200,7 @@ export default class CookieNotice { * Set the cookies list in the modal */ setupCookieModalList(): void; + switchToModalPageOrClose(): void; /** * Toggle Cookie modal pages */ @@ -208,6 +209,10 @@ export default class CookieNotice { * Toggle customize btn */ togglePersonalizeBtn(): void; + /** + * Get the actual page: banner or modal (with cookie choices) + */ + isOnBannerPage(): boolean; } declare enum CookieStatus { true = "true", diff --git a/dist/umd/css/standard.css b/dist/umd/css/standard.css index 8296272..65b6d6e 100644 --- a/dist/umd/css/standard.css +++ b/dist/umd/css/standard.css @@ -24,7 +24,7 @@ border: 0; margin: 0; appearance: none; - background: #b9b9b9; + background: #d6d6d6; color: #000; cursor: pointer; font-family: "Barlow", sans-serif; @@ -36,7 +36,7 @@ } #cn-wrapper button:hover, #cn-wrapper button:focus { - background: #a0a0a0; + background: #bdbdbd; /* prettier-ignore */ color: #000; } @@ -57,30 +57,26 @@ /* Button settings */ /* Title settings */ /* Text settings */ -/* Accept/Deny btn settings */ +/* Switch Buttons */ /* Cookies list settings */ -#cn-wrapper .cn-nav #cn-settings-banner, #cn-wrapper .cn-nav #cn-accept-banner, #cn-wrapper .cn-nav #cn-deny-banner, #cn-wrapper .cn-content .cn-modal-container .accept label, -#cn-wrapper .cn-content .cn-modal-container .deny label, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal { +#cn-wrapper .cn-nav #cn-settings-banner, #cn-wrapper .cn-nav #cn-accept-banner, #cn-wrapper .cn-nav #cn-deny-banner, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal { display: flex; height: 3rem; flex-direction: column; align-items: center; justify-content: center; padding: 0; - background-color: #b9b9b9; + background-color: #d6d6d6; color: #000; font-family: "Barlow", sans-serif; font-size: 16px; } -#cn-wrapper .cn-nav #cn-settings-banner:hover, #cn-wrapper .cn-nav #cn-accept-banner:hover, #cn-wrapper .cn-nav #cn-deny-banner:hover, #cn-wrapper .cn-content .cn-modal-container .accept label:hover, -#cn-wrapper .cn-content .cn-modal-container .deny label:hover, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:hover, #cn-wrapper .cn-nav #cn-settings-banner:focus, #cn-wrapper .cn-nav #cn-accept-banner:focus, #cn-wrapper .cn-nav #cn-deny-banner:focus, #cn-wrapper .cn-content .cn-modal-container .accept label:focus, -#cn-wrapper .cn-content .cn-modal-container .deny label:focus, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:focus { - background-color: #a0a0a0; +#cn-wrapper .cn-nav #cn-settings-banner:hover, #cn-wrapper .cn-nav #cn-accept-banner:hover, #cn-wrapper .cn-nav #cn-deny-banner:hover, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:hover, #cn-wrapper .cn-nav #cn-settings-banner:focus, #cn-wrapper .cn-nav #cn-accept-banner:focus, #cn-wrapper .cn-nav #cn-deny-banner:focus, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:focus { + background-color: #bdbdbd; /* prettier-ignore */ color: #000; } -#cn-wrapper .cn-nav #cn-settings-banner:focus, #cn-wrapper .cn-nav #cn-accept-banner:focus, #cn-wrapper .cn-nav #cn-deny-banner:focus, #cn-wrapper .cn-content .cn-modal-container .accept label:focus, -#cn-wrapper .cn-content .cn-modal-container .deny label:focus, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:focus { +#cn-wrapper .cn-nav #cn-settings-banner:focus, #cn-wrapper .cn-nav #cn-accept-banner:focus, #cn-wrapper .cn-nav #cn-deny-banner:focus, #cn-wrapper #cn-banner .cn-modal-top-line #cn-close-modal:focus { /* prettier-ignore */ outline-color: #000; } @@ -91,7 +87,7 @@ top: 0; left: 0; width: 100vw; - height: 100vh; + height: 100dvh; background-color: rgba(0, 0, 0, 0.6); cursor: pointer; opacity: 0; @@ -112,7 +108,13 @@ } #cn-wrapper { + position: fixed; z-index: 1050; + top: 0; + left: 0; + width: 100vw; + height: 100dvh; + pointer-events: none; } #cn-wrapper #cn-cookie-btn { position: fixed; @@ -126,6 +128,7 @@ background-color: #fff; box-shadow: 0 0.1rem 1rem rgba(0, 0, 0, 0.35); cursor: pointer; + pointer-events: auto; } @media (min-width: 535px) { #cn-wrapper #cn-cookie-btn { @@ -156,15 +159,14 @@ fill: #dc9c52; } #cn-wrapper #cn-banner { - position: fixed; + position: absolute; z-index: 1050; top: 0; bottom: 0; left: 0; display: flex; width: 100vw; - height: fit-content; - max-height: 100vh; + max-height: 100dvh; flex-direction: column; align-items: center; justify-content: flex-end; @@ -194,9 +196,6 @@ border-top-right-radius: 0.5rem; } } -#cn-wrapper #cn-banner p:not(.cn-modal-title) { - font-size: 16px; -} #cn-wrapper #cn-banner > * { pointer-events: all; } @@ -206,10 +205,12 @@ bottom: calc(0.5rem + 60px); left: 0; width: 30rem; - height: fit-content; - max-height: 38rem; + max-height: 26rem; border-radius: 0.5rem; } + #cn-wrapper #cn-banner.cn-modal-page { + max-height: 38rem; + } } #cn-wrapper #cn-li-template { display: none; @@ -222,11 +223,64 @@ padding: 0.8rem; overflow-y: auto; } +@media (min-width: 535px) { + #cn-wrapper .cn-content { + flex-grow: 0; + } +} +#cn-wrapper .cn-content .cn-switch { + position: relative; + display: inline-block; + overflow: hidden; + width: 4.2rem; + height: 2.4rem; + box-sizing: content-box; + cursor: pointer; +} +#cn-wrapper .cn-content .cn-switch:focus, #cn-wrapper .cn-content .cn-switch:focus-visible { + border-width: 0.1rem; + border-style: solid; + border-color: #346abf; +} +#cn-wrapper .cn-content .cn-switch input { + display: none; +} +#cn-wrapper .cn-content .cn-switch input + span { + position: absolute; + border-radius: 2rem; + background: #99b4df; + inset: 0; +} +#cn-wrapper .cn-content .cn-switch input + span::before { + position: absolute; + top: 50%; + left: 0.21rem; + display: inline-block; + width: 1.8rem; + height: 1.8rem; + border-radius: 50%; + background: #fff; + content: ""; + transform: translateY(-50%); + transition: all 0.5s; +} +#cn-wrapper .cn-content .cn-switch input:indeterminate + span { + background: #b7b7b7; +} +#cn-wrapper .cn-content .cn-switch input:indeterminate + span::before { + left: 1.08rem; +} +#cn-wrapper .cn-content .cn-switch input:checked + span { + background: #346abf; +} +#cn-wrapper .cn-content .cn-switch input:checked + span::before { + left: 2.16rem; +} #cn-wrapper .cn-content .cn-banner-content { display: flex; min-height: 100%; flex-direction: column; - color: #b9b9b9; + color: #707070; font-family: "Barlow", sans-serif; font-size: 16px; } @@ -261,37 +315,13 @@ margin: 6px 0; text-align: justify; } -#cn-wrapper .cn-content .cn-modal-container .cn-modal-title { - color: #dc9c52; - font-family: "Satisfy", sans-serif; - font-size: 28px; - font-weight: bold; - text-align: center; -} -#cn-wrapper .cn-content .cn-modal-container .cn-modal-subtitle { - margin-bottom: 6px; - color: #b9b9b9; - color: #dc9c52; - font-family: "Barlow", sans-serif; - font-size: 16px; - text-align: center; -} -#cn-wrapper .cn-content .cn-modal-container .cn-modal-description { - display: flex; - flex-direction: column; - align-items: center; - color: #b9b9b9; - font-family: "Barlow", sans-serif; - font-size: 16px; - font-weight: normal; - line-height: initial; -} #cn-wrapper .cn-content .cn-modal-container .cn-modal-wrapper { position: relative; display: flex; overflow: auto; flex-direction: column; align-items: center; + /* stylelint-disable-next-line no-descending-specificity */ } #cn-wrapper .cn-content .cn-modal-container .cn-modal-wrapper ul { display: flex; @@ -302,7 +332,7 @@ } #cn-wrapper .cn-content .cn-modal-container .cn-modal-wrapper .cn-cookie-wrapper { display: flex; - flex-direction: column; + flex-direction: row; align-items: center; justify-content: space-between; padding: 20px; @@ -338,58 +368,11 @@ font-weight: bold; } #cn-wrapper .cn-content .cn-modal-container .cn-cookie-infos .cn-cookie-description { - color: #b9b9b9; + color: #707070; } #cn-wrapper .cn-content .cn-modal-container .cn-cookie-infos a { width: fit-content; } -#cn-wrapper .cn-content .cn-modal-container .cn-cookie-buttons { - display: flex; - width: 200px; - justify-content: space-around; - margin-top: 6px; -} -#cn-wrapper .cn-content .cn-modal-container .cn-cookie-buttons input { - display: none; -} -#cn-wrapper .cn-content .cn-modal-container .cn-cookie-buttons label { - display: block; - width: fit-content; - padding: 6px 20px; - color: #fff; - cursor: pointer; - transition: 0.3s; -} -#cn-wrapper .cn-content .cn-modal-container .cn-cookie-buttons div { - display: table; - margin: 0 0.5em; - text-align: center; -} -#cn-wrapper .cn-content .cn-modal-container .accept label, -#cn-wrapper .cn-content .cn-modal-container .deny label { - height: inherit; - background: #6d6d6d; -} -#cn-wrapper .cn-content .cn-modal-container .accept label:hover, -#cn-wrapper .cn-content .cn-modal-container .accept label:focus { - background-color: #175917; -} -#cn-wrapper .cn-content .cn-modal-container .accept .active { - background-color: #218221; -} -#cn-wrapper .cn-content .cn-modal-container .deny label:hover, -#cn-wrapper .cn-content .cn-modal-container .deny label:focus { - background-color: #712121; -} -#cn-wrapper .cn-content .cn-modal-container .deny .active { - background-color: #992c2c; -} -#cn-wrapper .cn-content .cn-modal-container .accept input:checked ~ label { - background-color: #218221; -} -#cn-wrapper .cn-content .cn-modal-container .deny input:checked ~ label { - background-color: #992c2c; -} #cn-wrapper .cn-nav { display: flex; overflow: hidden; @@ -430,12 +413,6 @@ border-top: initial; } } -@media (min-width: 535px) { - #cn-wrapper { - width: 100%; - height: 100%; - } -} .cn-open { overflow: hidden !important; diff --git a/dist/umd/main.js b/dist/umd/main.js index e0b481f..3de73b5 100644 --- a/dist/umd/main.js +++ b/dist/umd/main.js @@ -147,7 +147,7 @@ var CookieNotice = /*#__PURE__*/function () { this.addEventPrevent(this.cookieCloseModalBtn, "click", this.closeCookieModal); this.addEventPrevent(this.acceptAllBtn, "click", this.acceptAllCookies); this.addEventPrevent(this.denyAllBtn, "click", this.denyAllCookies); - this.addEventPrevent(this.customizeBtn, "click", this.toggleCookieModalPages); + this.addEventPrevent(this.customizeBtn, "click", this.switchToModalPageOrClose); this.addEventPrevent(this.cookieShowModalBtn, "click", this.toggleCookieModal); this.cookieLinkShowCustomizeModalList.forEach(function (cookieLink) { _this.addEventPrevent(cookieLink, "click", _this.openCookieModalToCookiePage); @@ -266,11 +266,12 @@ var CookieNotice = /*#__PURE__*/function () { }, { key: "acceptCookie", value: function acceptCookie(cookieName) { - var _this$cookieContainer, _this$cookieContainer2; var cookieOptions = this.getCookie(cookieName); this.setCookieStatus(cookieName, CookieStatus.true, cookieOptions); - (_this$cookieContainer = this.cookieContainer.querySelector("#".concat(cookieName, "-accept"))) === null || _this$cookieContainer === void 0 || (_this$cookieContainer = _this$cookieContainer.classList) === null || _this$cookieContainer === void 0 || _this$cookieContainer.add("active"); - (_this$cookieContainer2 = this.cookieContainer.querySelector("#".concat(cookieName, "-deny"))) === null || _this$cookieContainer2 === void 0 || (_this$cookieContainer2 = _this$cookieContainer2.classList) === null || _this$cookieContainer2 === void 0 || _this$cookieContainer2.remove("active"); + var cnSwitch = document.getElementById("".concat(cookieName, "-switch")); + var cnSwitchInput = cnSwitch.querySelector("input"); + cnSwitchInput.checked = true; + cnSwitch.ariaChecked = "true"; } /** @@ -292,11 +293,12 @@ var CookieNotice = /*#__PURE__*/function () { }, { key: "denyCookie", value: function denyCookie(cookieName) { - var _this$cookieContainer3, _this$cookieContainer4; var cookieOptions = this.getCookie(cookieName); this.setCookieStatus(cookieName, CookieStatus.false, cookieOptions); - (_this$cookieContainer3 = this.cookieContainer.querySelector("#".concat(cookieName, "-deny"))) === null || _this$cookieContainer3 === void 0 || (_this$cookieContainer3 = _this$cookieContainer3.classList) === null || _this$cookieContainer3 === void 0 || _this$cookieContainer3.add("active"); - (_this$cookieContainer4 = this.cookieContainer.querySelector("#".concat(cookieName, "-accept"))) === null || _this$cookieContainer4 === void 0 || (_this$cookieContainer4 = _this$cookieContainer4.classList) === null || _this$cookieContainer4 === void 0 || _this$cookieContainer4.remove("active"); + var cnSwitch = document.getElementById("".concat(cookieName, "-switch")); + var cnSwitchInput = cnSwitch.querySelector("input"); + cnSwitchInput.checked = false; + cnSwitch.ariaChecked = "false"; } /** @@ -385,7 +387,6 @@ var CookieNotice = /*#__PURE__*/function () { }, { key: "setCookieStatus", value: function setCookieStatus(cookieName, status, cookieOption) { - console.log("setcookie status ".concat(cookieName, " ").concat(status)); if (status === CookieStatus.true) { this.addCookieStatus(cookieName, cookieOption); return; @@ -624,6 +625,7 @@ var CookieNotice = /*#__PURE__*/function () { this.resetCookieModal(); this.bannerContent.classList.add("d-none"); this.modalContainer.classList.remove("d-none"); + this.bannerContainer.classList.add("cn-modal-page"); // Scroll to the top of the cookies list this.modalWrapper.scrollTop = 0; @@ -640,6 +642,12 @@ var CookieNotice = /*#__PURE__*/function () { this.updateRestrictCloseModal(); if (!this.restrictCloseModal) { document.body.classList.remove("cn-open"); + if (!this.isOnBannerPage()) { + // * Make toggle page to banner on closing + this.bannerContent.classList.toggle("d-none"); + this.modalContainer.classList.toggle("d-none"); + this.bannerContainer.classList.remove("cn-modal-page"); + } this.unsetTabIndex(); this.setupCookieModalList(); } else { @@ -661,7 +669,7 @@ var CookieNotice = /*#__PURE__*/function () { // * Only focusable elements _toConsumableArray(document.body.querySelectorAll(focusableSelector)).filter(function (el) { - return !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden"); + return !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden") && !_this9.cookieContainer.contains(el); }).forEach(function (el) { el.setAttribute("tabindex", "-1"); el.classList.add("cn-disabled"); @@ -669,7 +677,7 @@ var CookieNotice = /*#__PURE__*/function () { _toConsumableArray(_this9.cookieContainer.querySelectorAll(focusableSelector)).filter(function (el) { return !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden") && // * Only visible elements - !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length); + !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length) && !_this9.cookieContainer.contains(el); }).forEach(function (el) { el.setAttribute("tabindex", "0"); el.classList.remove("cn-disabled"); @@ -703,6 +711,7 @@ var CookieNotice = /*#__PURE__*/function () { value: function resetCookieModal() { this.bannerContent.classList.remove("d-none"); this.modalContainer.classList.add("d-none"); + this.bannerContainer.classList.remove("cn-modal-page"); if (!this.customizeBtn.dataset.openModal) { throw new Error("Cannot find attribut data-open-modal"); } @@ -730,40 +739,46 @@ var CookieNotice = /*#__PURE__*/function () { var name = cookie.querySelector("span.cn-cookie-name"); var description = cookie.querySelector("span.cn-cookie-description"); var link = cookie.querySelector(".cn-cookie-link"); - var acceptInput = cookie.querySelector(".accept > input"); - var denyInput = cookie.querySelector(".deny > input"); - var acceptLabel = cookie.querySelector(".accept > label"); - var denyLabel = cookie.querySelector(".deny > label"); + var cnSwitch = cookie.querySelector(".cn-switch"); + var cnSwitchInput = cookie.querySelector(".cn-switch > input"); + + // * Undertermined state + cnSwitchInput.indeterminate = true; + cnSwitchInput.checked = false; + + // * Assign cookie aside content name.textContent = cookieConfig.name; + description.id = "".concat(cookieName, "-desc"); description.textContent = cookieConfig.description; link.textContent = cookieConfig.labelLink; link.setAttribute("href", cookieConfig.link); - acceptInput.id = cookieName + "-accept"; - acceptInput.name = cookieName; - acceptInput.dataset.name = cookieName; - acceptLabel.htmlFor = cookieName + "-accept"; - acceptLabel.textContent = "".concat(acceptLabel.textContent, " ").concat(cookieName); - acceptLabel.title = "".concat(acceptLabel.textContent, " ").concat(cookieName); - denyInput.id = cookieName + "-deny"; - denyInput.name = cookieName; - denyInput.dataset.name = cookieName; - denyLabel.htmlFor = cookieName + "-deny"; - denyLabel.textContent = "".concat(denyLabel.textContent, " ").concat(cookieName); - denyLabel.title = "".concat(denyLabel.textContent, " ").concat(cookieName); - var acceptFn = function acceptFn() { - acceptLabel.classList.add("active"); - denyLabel.classList.remove("active"); - _this11.setCookieStatus(cookieName, CookieStatus.true, cookieConfig); - }, - denyFn = function denyFn() { - acceptLabel.classList.remove("active"); - denyLabel.classList.add("active"); - _this11.setCookieStatus(cookieName, CookieStatus.false, cookieConfig); - }; - _this11.addEvent(acceptInput, "click", acceptFn); - _this11.addEventKbdValidate(acceptLabel, acceptFn); - _this11.addEvent(denyInput, "click", denyFn); - _this11.addEventKbdValidate(denyLabel, denyFn); + + // * Assign cookie controls + cnSwitch.id = "".concat(cookieName, "-switch"); + cnSwitch.name = cookieName; + cnSwitch.dataset.name = cookieName; + cnSwitch.setAttribute("aria-labelledby", "".concat(cookieName, "-desc")); + cnSwitch.setAttribute("aria-describedby", "".concat(cookieName, "-desc")); + var toggleCookie = function toggleCookie() { + _this11.setCookieStatus(cookieName, cnSwitch.checked ? CookieStatus.true : CookieStatus.false, cookieConfig); + }; + _this11.addEvent(cnSwitch, "click", function () { + toggleCookie(); + if (cnSwitchInput.checked) { + cnSwitch.ariaChecked = "true"; + } else { + cnSwitch.ariaChecked = "false"; + } + }); + _this11.addEventKbdValidate(cnSwitch, function () { + toggleCookie(); + cnSwitchInput.checked = !cnSwitchInput.checked; + if (cnSwitchInput.checked) { + cnSwitch.ariaChecked = "true"; + } else { + cnSwitch.ariaChecked = "false"; + } + }); _this11.cookiesUnorderedList.append(cookie); if (!_this11.hasBrowserCookie()) { // * Ldcweb cookie is not set. @@ -775,20 +790,37 @@ var CookieNotice = /*#__PURE__*/function () { ckName = _ref14[0], cookieStatus = _ref14[1]; if (ckName === cookieName) { - acceptLabel.classList.remove("active"); - denyLabel.classList.remove("active"); switch (cookieStatus) { case CookieStatus.true: - acceptLabel.classList.add("active"); + cnSwitchInput.indeterminate = false; + cnSwitchInput.checked = true; break; case CookieStatus.false: - denyLabel.classList.add("active"); + cnSwitchInput.indeterminate = false; + cnSwitchInput.checked = false; + break; + case CookieStatus.wait: + cnSwitchInput.indeterminate = true; + cnSwitchInput.checked = false; break; } } }); }); } + }, { + key: "switchToModalPageOrClose", + value: function switchToModalPageOrClose() { + // * Modification du comportement du bouton, même si ca n'a pas de sens. + // https://lab.s-web.fr/ldc-web/projets/ldc-web-cookie-notice/-/issues/9` + + if (this.isOnBannerPage()) { + this.toggleCookieModalPages(); + return; + } + // * Pas de permutation en arrière + this.closeCookieModal(); + } /** * Toggle Cookie modal pages @@ -798,7 +830,9 @@ var CookieNotice = /*#__PURE__*/function () { value: function toggleCookieModalPages() { this.bannerContent.classList.toggle("d-none"); this.modalContainer.classList.toggle("d-none"); - if (!this.modalContainer.classList.contains("d-none")) { + this.bannerContainer.classList.toggle("cn-modal-page"); + if (!this.isOnBannerPage()) { + this.bannerContainer.classList.add("cn-modal-page"); this.denyAllWaitingCookies(); } this.setTabIndex(); @@ -822,6 +856,15 @@ var CookieNotice = /*#__PURE__*/function () { this.customizeBtn.title = customizeBtnBannerDataset.closeModal; } } + + /** + * Get the actual page: banner or modal (with cookie choices) + */ + }, { + key: "isOnBannerPage", + value: function isOnBannerPage() { + return this.modalContainer.classList.contains("d-none"); + } }]); }(); diff --git a/dist/umd/main.js.map b/dist/umd/main.js.map index 9139bad..d9a998a 100644 --- a/dist/umd/main.js.map +++ b/dist/umd/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVA;AAAA,IAEqBA,YAAY;EAe7B;;EA0BA,SAAAA,aAAYC,MAAqC,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAH,YAAA;IAAAI,eAAA,4BAxC/B,SAAS;IAE7B;IAAAA,eAAA,y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A,GAAG;WACH;WACA;WACA,CAAC;;;;;WCPD,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;UElBA;UACA;UACA;UACA;UACA","sources":["webpack://CookieNotice/webpack/universalModuleDefinition","webpack://CookieNotice/./src/ts/index.ts","webpack://CookieNotice/webpack/bootstrap","webpack://CookieNotice/webpack/runtime/define property getters","webpack://CookieNotice/webpack/runtime/global","webpack://CookieNotice/webpack/runtime/hasOwnProperty shorthand","webpack://CookieNotice/webpack/runtime/make namespace object","webpack://CookieNotice/webpack/runtime/publicPath","webpack://CookieNotice/webpack/before-startup","webpack://CookieNotice/webpack/startup","webpack://CookieNotice/webpack/after-startup"],"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[\"CookieNotice\"] = factory();\n\telse\n\t\troot[\"CookieNotice\"] = factory();\n})(this, function() {\nreturn ","/** 4.1.1 */\n\nexport default class CookieNotice {\n browserCookieName = \"cn-init\";\n\n /** Cookie life time */\n cookieTimeLife = 6;\n\n /** The index on which store the expiration date */\n cookieExpirationName = \"_expiration\";\n\n /** Cookie policies for each functionality */\n cookiePolicies: CookiePolicy = {\n sameSite: CookiePolicySameSite.lax,\n secure: \"\",\n };\n\n /** Cookie expiration date as specified in the cookie itself */\n cookieExpirationDate: Date;\n\n config: Record;\n modalBg: HTMLDivElement;\n cookieContainer: HTMLDivElement;\n bannerContainer: HTMLDivElement;\n modalContainer: HTMLDivElement;\n\n cookieShowModalBtn: HTMLButtonElement;\n cookieCloseModalBtn: HTMLButtonElement;\n\n bannerContent: HTMLDivElement;\n acceptAllBtn: HTMLButtonElement;\n denyAllBtn: HTMLButtonElement;\n customizeBtn: HTMLButtonElement;\n cookiesUnorderedList: HTMLUListElement;\n cookieLinkShowCustomizeModalList: NodeListOf;\n modalWrapper: HTMLDivElement;\n template: HTMLDivElement;\n bannerDetailsAreExpanded: boolean;\n\n restrictCloseModal: boolean;\n\n static noConflict: (deep?: boolean) => typeof CookieNotice;\n\n constructor(config: Record) {\n // * Setup Config\n this.config = config;\n\n // * Setup cookie expiration date\n let cookieExpirationDate: Date|null = this.readCookiesExpirationDate();\n if (!cookieExpirationDate) {\n cookieExpirationDate = new Date();\n cookieExpirationDate.setMonth(cookieExpirationDate.getMonth() + this.cookieTimeLife);\n }\n this.cookieExpirationDate = cookieExpirationDate;\n\n // * Inject DOM modal BG\n const modalBg = document.createElement(\"div\");\n modalBg.classList.add(\"cn-modal-bg\");\n document.body.append(modalBg);\n this.modalBg = modalBg;\n\n // * Setup Dom Elements\n const cookieContainer = document.querySelector(\n \"div#cn-wrapper\"\n ) as HTMLDivElement | null,\n cookieShowModalBtn = document.querySelector(\n \"button#cn-cookie-btn\"\n ) as HTMLButtonElement | null,\n cookieCloseModalBtn = document.querySelector(\n \"button#cn-close-modal\"\n ) as HTMLButtonElement | null,\n cookieLinkShowCustomizeModalPageList = document.querySelectorAll(\n \".cn-cookie-link\"\n ) as NodeListOf,\n bannerContainer = document.querySelector(\n \"div#cn-banner\"\n ) as HTMLDivElement | null,\n bannerContent = document.querySelector(\n \"div.cn-banner-content\"\n ) as HTMLDivElement | null,\n modalContainer = document.querySelector(\n \"div.cn-modal-container\"\n ) as HTMLDivElement | null,\n acceptAllBtn = document.querySelector(\n \"button#cn-accept-banner\"\n ) as HTMLButtonElement | null,\n denyAllBtn = document.querySelector(\n \"button#cn-deny-banner\"\n ) as HTMLButtonElement | null,\n customizeBtn = document.querySelector(\n \"button#cn-settings-banner\"\n ) as HTMLButtonElement | null,\n cookiesUnorderedList = document.querySelector(\n \"ul#cn-modal-list\"\n ) as HTMLUListElement | null,\n modalWrapper = document.querySelector(\n \"div.cn-modal-wrapper\"\n ) as HTMLDivElement,\n template = document.querySelector(\n \"div#cn-li-template\"\n ) as HTMLDivElement | null;\n if (!cookieContainer) {\n throw new Error(\"Cannot find div#cn-wrapper\");\n }\n if (!cookieShowModalBtn) {\n throw new Error(\"Cannot find 'button#cn-cookie-btn' element\");\n }\n if (!cookieCloseModalBtn) {\n throw new Error(\"Cannot find 'button#cn-close-modal' element\");\n }\n if (!bannerContainer) {\n throw new Error(\"Cannot find 'div#cn-banner' element\");\n }\n if (!bannerContent) {\n throw new Error(\"Cannot find 'div.cn-banner-content' element\");\n }\n if (!modalContainer) {\n throw new Error(\"Cannot find 'div.cn-modal-container' element\");\n }\n if (!acceptAllBtn) {\n throw new Error(\"Cannot find 'button#cn-accept-banner' element\");\n }\n if (!denyAllBtn) {\n throw new Error(\"Cannot find 'button#cn-deny-banner' element\");\n }\n if (!customizeBtn) {\n throw new Error(\"Cannot find 'button.cn-settings-banner' element\");\n }\n if (!cookiesUnorderedList) {\n throw new Error(\"Cannot find 'ul#cn-modal-list' element\");\n }\n if (!modalWrapper) {\n throw new Error(\"Cannot find 'div.cn-modal-wrapper' element\");\n }\n if (!template) {\n throw new Error(\"Cannot find 'div#cn-li-template' element\");\n }\n\n this.cookieShowModalBtn = cookieShowModalBtn;\n this.cookieCloseModalBtn = cookieCloseModalBtn;\n this.cookieLinkShowCustomizeModalList =\n cookieLinkShowCustomizeModalPageList;\n this.cookieContainer = cookieContainer;\n this.bannerContainer = bannerContainer;\n this.bannerContent = bannerContent;\n this.cookiesUnorderedList = cookiesUnorderedList;\n this.modalWrapper = modalWrapper;\n this.modalContainer = modalContainer;\n this.acceptAllBtn = acceptAllBtn;\n this.denyAllBtn = denyAllBtn;\n this.customizeBtn = customizeBtn;\n\n this.bannerDetailsAreExpanded = false;\n this.template = template;\n const memoryTemplate = this.template.cloneNode(true) as HTMLDivElement;\n this.template.remove();\n this.template = memoryTemplate;\n\n this.restrictCloseModal = true;\n\n // * Setup Events\n this.addEventPrevent(this.modalBg, \"click\", this.closeCookieModal);\n this.addEventPrevent(\n this.cookieCloseModalBtn,\n \"click\",\n this.closeCookieModal\n );\n this.addEventPrevent(this.acceptAllBtn, \"click\", this.acceptAllCookies);\n this.addEventPrevent(this.denyAllBtn, \"click\", this.denyAllCookies);\n this.addEventPrevent(\n this.customizeBtn,\n \"click\",\n this.toggleCookieModalPages\n );\n this.addEventPrevent(\n this.cookieShowModalBtn,\n \"click\",\n this.toggleCookieModal\n );\n this.cookieLinkShowCustomizeModalList.forEach((cookieLink) => {\n this.addEventPrevent(\n cookieLink,\n \"click\",\n this.openCookieModalToCookiePage\n );\n this.addEventKbdValidate(cookieLink, this.openCookieModalToCookiePage);\n });\n\n // * Setup CN Cookie\n if (!this.cookiesMatchesConfig() || this.cookiesOlderThan(new Date())) {\n // * Setup Browser Cookie if none.\n this.resetBrowserCookie();\n this.openCookieModalToBannerPage();\n }\n\n this.updateRestrictCloseModal();\n\n // * Cookie should have been created from here.\n Object.entries(this.getCookieStatusList()).forEach(([cookieName, cookieStatus]) => {\n if (cookieStatus === CookieStatus.wait) {\n // * Open modal if any cookie config is not set.\n this.openCookieModalToBannerPage();\n return;\n }\n if (!this.config[cookieName]) {\n // * Ignore missing config\n return;\n }\n if (cookieStatus === CookieStatus.true) {\n // * Exec script part for accepted cookie.\n this.config[cookieName].script();\n return;\n }\n if (this.config[cookieName].fallback != null) {\n // * Exec fallback part for accepted cookie if provided.\n this.config[cookieName].fallback();\n }\n });\n }\n\n // COOKIES\n\n /**\n * Update restrict for closing cookie modal\n */\n updateRestrictCloseModal() {\n this.restrictCloseModal = (Object.values(this.getCookieStatusList()).includes(CookieStatus.wait)) ? true : false;\n (this.restrictCloseModal) ? this.cookieCloseModalBtn.classList.add(\"d-none\") : this.cookieCloseModalBtn.classList.remove(\"d-none\");\n (this.restrictCloseModal) ? this.modalBg.classList.add(\"cn-modal-bg-active\") : this.modalBg.classList.remove(\"cn-modal-bg-active\");\n }\n\n /**\n * Get cookies expiration date or null if not defined alread\n */\n readCookiesExpirationDate(): Date | null {\n const cookies = this.getBrowserCookieValue() ?? \"\",\n expirationDateString = cookies.split(\",\").find((cookieString) =>\n cookieString.startsWith(this.cookieExpirationName));\n if (!expirationDateString) {\n return null;\n }\n try {\n const epochExpiration = Number.parseInt(expirationDateString.replace(`${this.cookieExpirationName}=`, \"\"));\n if (isNaN(epochExpiration)) {\n return null;\n }\n return new Date(epochExpiration);\n } catch (e) {\n return null;\n }\n }\n\n /**\n * Check if the cookies date are older than a specified date\n\n * @param date The limit date for cookies\n */\n cookiesOlderThan(date: Date): boolean {\n return this.cookieExpirationDate.getTime() < date.getTime();\n }\n\n /**\n * Check if the actual cookie matches the config\n */\n cookiesMatchesConfig(): boolean {\n const cookies = this.getCookieStatusList();\n return Object.keys(cookies).length === Object.keys(this.config).length;\n }\n\n /**\n * Accept a all cookies\n */\n acceptAllCookies() {\n Object.keys(this.config).forEach((cookieName) => this.acceptCookie(cookieName));\n this.closeCookieModal();\n }\n\n /**\n * Accept a specific cookie\n */\n acceptCookie(cookieName: string) {\n const cookieOptions = this.getCookie(cookieName);\n this.setCookieStatus(cookieName, CookieStatus.true, cookieOptions);\n this.cookieContainer.querySelector(`#${cookieName}-accept`)?.classList?.add(\"active\");\n this.cookieContainer.querySelector(`#${cookieName}-deny`)?.classList?.remove(\"active\");\n }\n\n /**\n * Deny a all cookies\n */\n denyAllCookies() {\n Object.keys(this.config).forEach((cookieName) => this.denyCookie(cookieName));\n this.closeCookieModal();\n }\n\n /**\n * Deny a specific cookie\n */\n denyCookie(cookieName: string) {\n const cookieOptions = this.getCookie(cookieName);\n this.setCookieStatus(cookieName, CookieStatus.false, cookieOptions);\n this.cookieContainer.querySelector(`#${cookieName}-deny`)?.classList?.add(\"active\");\n this.cookieContainer.querySelector(`#${cookieName}-accept`)?.classList?.remove(\"active\");\n }\n\n /**\n * Deny all waiting cookies\n */\n denyAllWaitingCookies() {\n Object.entries(this.getCookieStatusList()).forEach(([cookieName, cookieStatus]) => {\n if (cookieStatus === CookieStatus.wait) {\n this.setBrowserCookieStatus(cookieName, CookieStatus.false);\n return;\n }\n });\n this.updateRestrictCloseModal();\n }\n\n /**\n * Get a specific cookie config\n */\n getCookie(cookieName: string): CookieOptions {\n const cookieOptions = Object.entries(this.config).find((entry) => entry[0] === cookieName)?.[1];\n if (cookieOptions === undefined) {\n throw new Error(`Cookie options ${cookieName} not found in list`);\n }\n return cookieOptions;\n }\n\n /**\n * Fetch the cookie status list\n *\n * @returns the cookie status list\n */\n getCookieStatusList(): CookieStatusList {\n const cookies = this.getBrowserCookieValue(),\n statusList: CookieStatusList = {};\n if (cookies === undefined) {\n return statusList;\n }\n /** specificCookieString contains youtube=true like */\n cookies.split(\",\")\n // * Ignore timestamp\n .filter((specificCookieString) => !specificCookieString.startsWith(this.cookieExpirationName))\n .forEach((specificCookieString) => {\n const values = specificCookieString.split(\"=\");\n statusList[values[0]] = values[1] as CookieStatus;\n });\n return statusList;\n }\n\n /**\n * Check has cookie status\n *\n * @param key\n * @param value\n */\n containsCookieStatus(key: string): boolean {\n const statusList: CookieStatusList = this.getCookieStatusList();\n return (\n Object.keys(statusList).find((cookieName) => cookieName === key) !==\n undefined\n );\n }\n\n /**\n * Set the cookie value\n *\n * @param cookieName\n * @param status\n * @param cookieOption\n */\n setCookieStatus(\n cookieName: string,\n status: CookieStatus,\n cookieOption: CookieOptions\n ) {\n console.log(`setcookie status ${cookieName} ${status}`);\n if (status === CookieStatus.true) {\n this.addCookieStatus(cookieName, cookieOption);\n return;\n }\n if (status === CookieStatus.false) {\n this.removeCookieStatus(cookieName, cookieOption);\n return;\n }\n this.setBrowserCookieStatus(cookieName, CookieStatus.wait);\n }\n\n /**\n * Add a specific cookie and\n * change his status to true\n *\n * @param cookieName\n * @param cookieOption\n */\n addCookieStatus(cookieName: string, cookieOption: CookieOptions) {\n if (cookieOption.script) {\n cookieOption.script();\n }\n this.setBrowserCookieStatus(cookieName, CookieStatus.true);\n }\n\n /**\n * Remove a specific cookie and\n * change his status to false\n *\n * @param cookieName\n * @param cookieOption\n */\n removeCookieStatus(cookieName: string, cookieOption: CookieOptions) {\n const cookieNameElement = document.getElementById(cookieName);\n if (cookieNameElement) {\n cookieNameElement.remove();\n }\n if (cookieOption.fallback) {\n cookieOption.fallback();\n }\n this.setBrowserCookieStatus(cookieName, CookieStatus.false);\n }\n\n /**\n * Change the status of a cookie\n *\n * @param cookieName\n * @param status\n */\n setBrowserCookieStatus(cookieName: string, status: CookieStatus) {\n const statusList: CookieStatusList = this.getCookieStatusList();\n // * Force refresh\n this.deleteBrowserCookie();\n statusList[cookieName] = status;\n this.saveBrowserCookie(statusList);\n this.updateRestrictCloseModal();\n }\n\n /**\n * Has CN cokie setup ?\n * @returns true if the cookie is setup\n */\n hasBrowserCookie(): boolean {\n return Boolean(this.getBrowserCookieValue());\n }\n\n /**\n * Get the Ldcweb cookie\n *\n * @returns A string like analytics=true,youtube=true or undefined\n */\n getBrowserCookieValue() {\n const matches = document.cookie.match(\n new RegExp(\n \"(?:^|; )\" +\n this.browserCookieName.replace(\n /([.$?*|{}()[\\]\\\\/+^])/g,\n \"\\\\$1\"\n ) +\n \"=([^;]*)\"\n )\n );\n return matches ? decodeURIComponent(matches[1]) : undefined;\n }\n\n /**\n * Save cookie content on web browser\n *\n * @param list\n */\n saveBrowserCookie(statusList: CookieStatusList) {\n const date = new Date(),\n content = Object.entries(statusList)\n .map(([cookieName, cookieStatus]) => {\n return `${cookieName}=${cookieStatus}`;\n });\n // * Update expiration date\n this.cookieExpirationDate = new Date(date.setMonth(date.getMonth() + this.cookieTimeLife));\n // * Append expiration date\n content.push(`${this.cookieExpirationName}=${this.cookieExpirationDate.getTime()}`);\n document.cookie = `${this.browserCookieName}=${content.join(\",\")};path=/${\n location.hostname ? `;domain=${location.hostname}` : \"\"\n };expires=${this.cookieExpirationDate.toUTCString()};${this.getCookiePoliciesAsString()}`;\n }\n\n /**\n * Set an older expire parameter to a specific cookie\n */\n deleteBrowserCookie() {\n if (this.hasBrowserCookie()) {\n // * Suppression du cookie et de sa version precedé d'un point\n document.cookie = `${this.browserCookieName}=;path=/${\n location.hostname ? `;domain=.${location.hostname}` : \"\"\n };expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\n document.cookie = `${this.browserCookieName}=;path=/${\n location.hostname ? `;domain=${location.hostname}` : \"\"\n };expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\n }\n }\n\n getCookiePoliciesAsString(): string {\n return Object.entries(this.cookiePolicies)\n .map(([policyName, policyValue]) => `${policyName}=${policyValue}`)\n .join(\";\");\n }\n\n /**\n * Reset Ldc Web CN cookie\n */\n resetBrowserCookie() {\n // * Create Cookie as It does not exists.\n const newCookieList: CookieStatusList = {};\n Object.entries(this.config).forEach(\n ([cookieName]) => (newCookieList[cookieName] = CookieStatus.wait)\n );\n this.saveBrowserCookie(newCookieList);\n }\n\n // LISTENERS\n\n /**\n * Add event on a specific element\n *\n * @param element\n * @param evnt\n * @param funct\n * @returns\n */\n addEvent(element: HTMLElement, evnt: string, funct: (e: Event) => void) {\n return element.addEventListener(evnt, funct.bind(this), false);\n }\n\n /**\n * Add event on a specific element and prevent default\n *\n * @param element\n * @param evnt\n * @param funct\n * @returns\n */\n addEventPrevent(\n element: HTMLElement,\n evnt: string,\n funct: (e: Event) => void\n ) {\n return element.addEventListener(\n evnt,\n (e) => {\n e.preventDefault();\n funct.call(this, e);\n },\n false\n );\n }\n\n /**\n * Add event on a specific element\n *\n * @param element\n * @param evnt\n * @param funct\n * @returns\n */\n addEventKbdValidate(element: HTMLElement, funct: (e: Event) => void) {\n return this.addEvent(element, \"keydown\", (e: Event) => {\n const kbdEvt = e as KeyboardEvent;\n if (\n kbdEvt.key == \" \" ||\n kbdEvt.code == \"Space\" ||\n kbdEvt.keyCode == 32 ||\n kbdEvt.key == \"Enter\" ||\n kbdEvt.code == \"Enter\" ||\n kbdEvt.keyCode == 13\n ) {\n funct.call(this, kbdEvt);\n e.preventDefault();\n }\n });\n }\n\n // COOKIE MODAL\n\n /**\n * Show or hide Cookie modal\n * @returns\n */\n toggleCookieModal() {\n if (!document.body.classList.contains(\"cn-open\")) {\n this.openCookieModalToBannerPage();\n return;\n }\n this.closeCookieModal();\n }\n\n /**\n * Open the cookies modal to the banner page\n */\n openCookieModalToBannerPage() {\n this.openCookieModalToCookiePage();\n this.toggleCookieModalPages();\n }\n\n /**\n * Open the cookies modal to the cookies page\n */\n openCookieModalToCookiePage() {\n document.body.classList.add(\"cn-open\");\n this.resetCookieModal();\n this.bannerContent.classList.add(\"d-none\");\n this.modalContainer.classList.remove(\"d-none\");\n\n // Scroll to the top of the cookies list\n this.modalWrapper.scrollTop = 0;\n this.setupCookieModalList();\n this.setTabIndex();\n }\n\n /**\n * Hide the cookies modal\n */\n closeCookieModal() {\n this.updateRestrictCloseModal();\n if (!this.restrictCloseModal) {\n document.body.classList.remove(\"cn-open\");\n this.unsetTabIndex();\n this.setupCookieModalList();\n } else {\n throw new Error(\"You need to accept or refuse all cookies\");\n }\n }\n\n /**\n * Setup tab indexes on visible elements\n */\n setTabIndex() {\n // * Prevent focus html tag\n document.documentElement.setAttribute(\"tabindex\", \"-1\");\n setTimeout(() => {\n const focusableSelector =\n \"a[href], button, [role=\\\"button\\\"], input, embed, object, iframe, textarea, select, details, [tabindex]:not([tabindex=\\\"-1\\\"])\";\n\n // * Only focusable elements\n [...document.body.querySelectorAll(focusableSelector)]\n .filter(\n (el) =>\n !el.hasAttribute(\"disabled\") &&\n !el.getAttribute(\"aria-hidden\")\n )\n .forEach((el) => {\n (el as HTMLElement).setAttribute(\"tabindex\", \"-1\");\n (el as HTMLElement).classList.add(\"cn-disabled\");\n });\n [...this.cookieContainer.querySelectorAll(focusableSelector)]\n .filter(\n (el) =>\n !el.hasAttribute(\"disabled\") &&\n !el.getAttribute(\"aria-hidden\") &&\n // * Only visible elements\n !!(\n (el as HTMLElement).offsetWidth ||\n (el as HTMLElement).offsetHeight ||\n el.getClientRects().length\n )\n )\n .forEach((el) => {\n (el as HTMLElement).setAttribute(\"tabindex\", \"0\");\n (el as HTMLElement).classList.remove(\"cn-disabled\");\n });\n this.cookieShowModalBtn.setAttribute(\"tabindex\", \"-1\");\n }, 500);\n }\n\n /**\n * Undo setup tab indexes on visible elements\n */\n unsetTabIndex() {\n document.documentElement.setAttribute(\"tabindex\", \"0\");\n setTimeout(() => {\n document.body.querySelectorAll(\".cn-disabled\").forEach((el) => {\n (el as HTMLElement).setAttribute(\"tabindex\", \"0\");\n (el as HTMLElement).classList.remove(\"cn-disabled\");\n });\n this.cookieShowModalBtn.setAttribute(\"tabindex\", \"0\");\n }, 500);\n }\n\n /**\n * Reset the modal view state\n */\n resetCookieModal() {\n this.bannerContent.classList.remove(\"d-none\");\n this.modalContainer.classList.add(\"d-none\");\n if (!this.customizeBtn.dataset.openModal) {\n throw new Error(\"Cannot find attribut data-open-modal\");\n }\n this.customizeBtn.innerHTML = this.customizeBtn.dataset.openModal;\n }\n\n /**\n * Set the cookies list in the modal\n */\n setupCookieModalList() {\n this.cookiesUnorderedList.innerHTML = \"\";\n Object.entries(this.config).forEach(([cookieName, cookieConfig]) => {\n const cookie = document.createElement(\"li\");\n const childItem = this.template.children.item(\n 0\n ) as HTMLDivElement | null;\n if (childItem === null) {\n throw new Error(\"Cannot find child item\");\n }\n cookie.append(childItem.cloneNode(true));\n const name = cookie.querySelector(\n \"span.cn-cookie-name\"\n ) as HTMLSpanElement;\n const description = cookie.querySelector(\n \"span.cn-cookie-description\"\n ) as HTMLSpanElement;\n const link = cookie.querySelector(\n \".cn-cookie-link\"\n ) as HTMLElement;\n const acceptInput = cookie.querySelector(\n \".accept > input\"\n ) as HTMLInputElement;\n const denyInput = cookie.querySelector(\n \".deny > input\"\n ) as HTMLInputElement;\n const acceptLabel = cookie.querySelector(\n \".accept > label\"\n ) as HTMLLabelElement;\n const denyLabel = cookie.querySelector(\n \".deny > label\"\n ) as HTMLLabelElement;\n\n name.textContent = cookieConfig.name;\n description.textContent = cookieConfig.description;\n link.textContent = cookieConfig.labelLink;\n link.setAttribute(\"href\", cookieConfig.link);\n acceptInput.id = cookieName + \"-accept\";\n acceptInput.name = cookieName;\n acceptInput.dataset.name = cookieName;\n acceptLabel.htmlFor = cookieName + \"-accept\";\n acceptLabel.textContent = `${acceptLabel.textContent} ${cookieName}`;\n acceptLabel.title = `${acceptLabel.textContent} ${cookieName}`;\n denyInput.id = cookieName + \"-deny\";\n denyInput.name = cookieName;\n denyInput.dataset.name = cookieName;\n denyLabel.htmlFor = cookieName + \"-deny\";\n denyLabel.textContent = `${denyLabel.textContent} ${cookieName}`;\n denyLabel.title = `${denyLabel.textContent} ${cookieName}`;\n\n const acceptFn = () => {\n acceptLabel.classList.add(\"active\");\n denyLabel.classList.remove(\"active\");\n this.setCookieStatus(\n cookieName,\n CookieStatus.true,\n cookieConfig\n );\n },\n denyFn = () => {\n acceptLabel.classList.remove(\"active\");\n denyLabel.classList.add(\"active\");\n this.setCookieStatus(\n cookieName,\n CookieStatus.false,\n cookieConfig\n );\n };\n this.addEvent(acceptInput, \"click\", acceptFn);\n this.addEventKbdValidate(acceptLabel, acceptFn);\n this.addEvent(denyInput, \"click\", denyFn);\n this.addEventKbdValidate(denyLabel, denyFn);\n\n this.cookiesUnorderedList.append(cookie);\n\n if (!this.hasBrowserCookie()) {\n // * Ldcweb cookie is not set.\n return;\n }\n // * Setup list status state\n Object.entries(this.getCookieStatusList()).forEach(\n ([ckName, cookieStatus]) => {\n if (ckName === cookieName) {\n acceptLabel.classList.remove(\"active\");\n denyLabel.classList.remove(\"active\");\n switch (cookieStatus) {\n case CookieStatus.true:\n acceptLabel.classList.add(\"active\");\n break;\n case CookieStatus.false:\n denyLabel.classList.add(\"active\");\n break;\n }\n }\n }\n );\n });\n }\n\n /**\n * Toggle Cookie modal pages\n */\n toggleCookieModalPages() {\n this.bannerContent.classList.toggle(\"d-none\");\n this.modalContainer.classList.toggle(\"d-none\");\n if (!this.modalContainer.classList.contains(\"d-none\")) {\n this.denyAllWaitingCookies();\n }\n this.setTabIndex();\n this.setupCookieModalList();\n this.togglePersonalizeBtn();\n }\n\n /**\n * Toggle customize btn\n */\n togglePersonalizeBtn() {\n const customizeBtnBannerDataset = this.customizeBtn.dataset;\n this.modalWrapper.scrollTop = 0;\n if (this.bannerContent.classList.contains(\"d-none\")) {\n this.customizeBtn.innerHTML =\n customizeBtnBannerDataset.openModal as string;\n this.customizeBtn.title = customizeBtnBannerDataset.openModal as string;\n } else {\n this.customizeBtn.innerHTML =\n customizeBtnBannerDataset.closeModal as string;\n this.customizeBtn.title = customizeBtnBannerDataset.closeModal as string;\n }\n }\n}\n\nenum CookieStatus {\n true = \"true\",\n false = \"false\",\n wait = \"wait\",\n}\n\ntype CookieStatusList = Record;\n\ntype CookiePolicy = {\n sameSite: CookiePolicySameSite;\n secure: string;\n};\n\nenum CookiePolicySameSite {\n lax = \"lax\",\n strict = \"strict\",\n none = \"none\",\n}\n\nexport type CookieOptions = {\n name: string;\n description: string;\n link: string;\n labelLink: string;\n cookies: string[];\n /**\n * Fonction qui sert à initialiser la fonctionnalité\n * conduisant à la génération du cookie\n * @return void\n */\n script: () => void;\n /**\n * Fonction qui sert à informer l'utilisateur\n * sur chaque élèment que le cookie\n * associé à la fonctionnalité\n * est désactivé et propose un lien sur\n * cookie notice pour l'activer\n * @return void\n */\n fallback: () => void | null;\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","","// startup\n// Load entry module and return exports\n__webpack_require__(\"./src/ts/index.ts\");\n// This entry module doesn't tell about it's top-level declarations so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/scss/themes/standard.scss\");\n",""],"names":["CookieNotice","config","_this","_classCallCheck","_defineProperty","sameSite","CookiePolicySameSite","lax","secure","cookieExpirationDate","readCookiesExpirationDate","Date","setMonth","getMonth","cookieTimeLife","modalBg","document","createElement","classList","add","body","append","cookieContainer","querySelector","cookieShowModalBtn","cookieCloseModalBtn","cookieLinkShowCustomizeModalPageList","querySelectorAll","bannerContainer","bannerContent","modalContainer","acceptAllBtn","denyAllBtn","customizeBtn","cookiesUnorderedList","modalWrapper","template","Error","cookieLinkShowCustomizeModalList","bannerDetailsAreExpanded","memoryTemplate","cloneNode","remove","restrictCloseModal","addEventPrevent","closeCookieModal","acceptAllCookies","denyAllCookies","toggleCookieModalPages","toggleCookieModal","forEach","cookieLink","openCookieModalToCookiePage","addEventKbdValidate","cookiesMatchesConfig","cookiesOlderThan","resetBrowserCookie","openCookieModalToBannerPage","updateRestrictCloseModal","Object","entries","getCookieStatusList","_ref","_ref2","_slicedToArray","cookieName","cookieStatus","CookieStatus","wait","true","script","fallback","_createClass","key","value","values","includes","_this$getBrowserCooki","_this2","cookies","getBrowserCookieValue","expirationDateString","split","find","cookieString","startsWith","cookieExpirationName","epochExpiration","Number","parseInt","replace","concat","isNaN","e","date","getTime","keys","length","_this3","acceptCookie","_this$cookieContainer","_this$cookieContainer2","cookieOptions","getCookie","setCookieStatus","_this4","denyCookie","_this$cookieContainer3","_this$cookieContainer4","false","denyAllWaitingCookies","_this5","_ref3","_ref4","setBrowserCookieStatus","_Object$entries$find","entry","undefined","_this6","statusList","filter","specificCookieString","containsCookieStatus","status","cookieOption","console","log","addCookieStatus","removeCookieStatus","cookieNameElement","getElementById","deleteBrowserCookie","saveBrowserCookie","hasBrowserCookie","Boolean","matches","cookie","match","RegExp","browserCookieName","decodeURIComponent","content","map","_ref5","_ref6","push","join","location","hostname","toUTCString","getCookiePoliciesAsString","cookiePolicies","_ref7","_ref8","policyName","policyValue","newCookieList","_ref9","_ref10","addEvent","element","evnt","funct","addEventListener","bind","_this7","preventDefault","call","_this8","kbdEvt","code","keyCode","contains","resetCookieModal","scrollTop","setupCookieModalList","setTabIndex","unsetTabIndex","_this9","documentElement","setAttribute","setTimeout","focusableSelector","_toConsumableArray","el","hasAttribute","getAttribute","offsetWidth","offsetHeight","getClientRects","_this10","dataset","openModal","innerHTML","_this11","_ref11","_ref12","cookieConfig","childItem","children","item","name","description","link","acceptInput","denyInput","acceptLabel","denyLabel","textContent","labelLink","id","htmlFor","title","acceptFn","denyFn","_ref13","_ref14","ckName","toggle","togglePersonalizeBtn","customizeBtnBannerDataset","closeModal","default"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"main.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVA;AAAA,IAEqBA,YAAY;EAe7B;;EA0BA,SAAAA,aAAYC,MAAqC,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAH,YAAA;IAAAI,eAAA,4BAxC/B,SAAS;IAE7B;IAAAA,eAAA,yBACiB,CAAC;IAElB;IAAAA,eAAA,+BACuB,aAAa;IAEpC;IAAAA,eAAA,yBAC+B;MAC3BC,QAAQ,EAAEC,oBAAoB,CAACC,GAAG;MAClCC,MAAM,EAAE;IACZ,CAAC;IA6BG;IACA,IAAI,CAACP,MAAM,GAAGA,MAAM;;IAEpB;IACA,IAAIQ,oBAA+B,GAAG,IAAI,CAACC,yBAAyB,CAAC,CAAC;IACtE,IAAI,CAACD,oBAAoB,EAAE;MACvBA,oBAAoB,GAAG,IAAIE,IAAI,CAAC,CAAC;MACjCF,oBAAoB,CAACG,QAAQ,CAACH,oBAAoB,CAACI,QAAQ,CAAC,CAAC,GAAG,IAAI,CAACC,cAAc,CAAC;IACxF;IACA,IAAI,CAACL,oBAAoB,GAAGA,oBAAoB;;IAEhD;IACA,IAAMM,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IAC7CF,OAA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J;;IAEA;AACJ;AACA;EAFI;IAAA/I,GAAA;IAAAC,KAAA,EAGA,SAAAsG,eAAA,EAA0B;MACtB,OAAO,IAAI,CAAClJ,cAAc,CAACZ,SAAS,CAACwJ,QAAQ,CAAC,QAAQ,CAAC;IAC3D;EAAC;AAAA;AA51B4B;AAAA,IA+1B5BvG,YAAY,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA,EAAZA,YAAY;AAAA,IAaZ7D,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA,EAApBA,oBAAoB;;;;;;;;;;;;;;;;UC92BzB;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,GAAG;WACH;WACA;WACA,CAAC;;;;;WCPD,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;UElBA;UACA;UACA;UACA;UACA","sources":["webpack://CookieNotice/webpack/universalModuleDefinition","webpack://CookieNotice/./src/ts/index.ts","webpack://CookieNotice/webpack/bootstrap","webpack://CookieNotice/webpack/runtime/define property getters","webpack://CookieNotice/webpack/runtime/global","webpack://CookieNotice/webpack/runtime/hasOwnProperty shorthand","webpack://CookieNotice/webpack/runtime/make namespace object","webpack://CookieNotice/webpack/runtime/publicPath","webpack://CookieNotice/webpack/before-startup","webpack://CookieNotice/webpack/startup","webpack://CookieNotice/webpack/after-startup"],"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[\"CookieNotice\"] = factory();\n\telse\n\t\troot[\"CookieNotice\"] = factory();\n})(this, function() {\nreturn ","/** 4.1.1 */\n\nexport default class CookieNotice {\n browserCookieName = \"cn-init\";\n\n /** Cookie life time */\n cookieTimeLife = 6;\n\n /** The index on which store the expiration date */\n cookieExpirationName = \"_expiration\";\n\n /** Cookie policies for each functionality */\n cookiePolicies: CookiePolicy = {\n sameSite: CookiePolicySameSite.lax,\n secure: \"\",\n };\n\n /** Cookie expiration date as specified in the cookie itself */\n cookieExpirationDate: Date;\n\n config: Record;\n modalBg: HTMLDivElement;\n cookieContainer: HTMLDivElement;\n bannerContainer: HTMLDivElement;\n modalContainer: HTMLDivElement;\n\n cookieShowModalBtn: HTMLButtonElement;\n cookieCloseModalBtn: HTMLButtonElement;\n\n bannerContent: HTMLDivElement;\n acceptAllBtn: HTMLButtonElement;\n denyAllBtn: HTMLButtonElement;\n customizeBtn: HTMLButtonElement;\n cookiesUnorderedList: HTMLUListElement;\n cookieLinkShowCustomizeModalList: NodeListOf;\n modalWrapper: HTMLDivElement;\n template: HTMLDivElement;\n bannerDetailsAreExpanded: boolean;\n\n restrictCloseModal: boolean;\n\n static noConflict: (deep?: boolean) => typeof CookieNotice;\n\n constructor(config: Record) {\n // * Setup Config\n this.config = config;\n\n // * Setup cookie expiration date\n let cookieExpirationDate: Date|null = this.readCookiesExpirationDate();\n if (!cookieExpirationDate) {\n cookieExpirationDate = new Date();\n cookieExpirationDate.setMonth(cookieExpirationDate.getMonth() + this.cookieTimeLife);\n }\n this.cookieExpirationDate = cookieExpirationDate;\n\n // * Inject DOM modal BG\n const modalBg = document.createElement(\"div\");\n modalBg.classList.add(\"cn-modal-bg\");\n document.body.append(modalBg);\n this.modalBg = modalBg;\n\n // * Setup Dom Elements\n const cookieContainer = document.querySelector(\n \"div#cn-wrapper\"\n ) as HTMLDivElement | null,\n cookieShowModalBtn = document.querySelector(\n \"button#cn-cookie-btn\"\n ) as HTMLButtonElement | null,\n cookieCloseModalBtn = document.querySelector(\n \"button#cn-close-modal\"\n ) as HTMLButtonElement | null,\n cookieLinkShowCustomizeModalPageList = document.querySelectorAll(\n \".cn-cookie-link\"\n ) as NodeListOf,\n bannerContainer = document.querySelector(\n \"div#cn-banner\"\n ) as HTMLDivElement | null,\n bannerContent = document.querySelector(\n \"div.cn-banner-content\"\n ) as HTMLDivElement | null,\n modalContainer = document.querySelector(\n \"div.cn-modal-container\"\n ) as HTMLDivElement | null,\n acceptAllBtn = document.querySelector(\n \"button#cn-accept-banner\"\n ) as HTMLButtonElement | null,\n denyAllBtn = document.querySelector(\n \"button#cn-deny-banner\"\n ) as HTMLButtonElement | null,\n customizeBtn = document.querySelector(\n \"button#cn-settings-banner\"\n ) as HTMLButtonElement | null,\n cookiesUnorderedList = document.querySelector(\n \"ul#cn-modal-list\"\n ) as HTMLUListElement | null,\n modalWrapper = document.querySelector(\n \"div.cn-modal-wrapper\"\n ) as HTMLDivElement,\n template = document.querySelector(\n \"div#cn-li-template\"\n ) as HTMLDivElement | null;\n if (!cookieContainer) {\n throw new Error(\"Cannot find div#cn-wrapper\");\n }\n if (!cookieShowModalBtn) {\n throw new Error(\"Cannot find 'button#cn-cookie-btn' element\");\n }\n if (!cookieCloseModalBtn) {\n throw new Error(\"Cannot find 'button#cn-close-modal' element\");\n }\n if (!bannerContainer) {\n throw new Error(\"Cannot find 'div#cn-banner' element\");\n }\n if (!bannerContent) {\n throw new Error(\"Cannot find 'div.cn-banner-content' element\");\n }\n if (!modalContainer) {\n throw new Error(\"Cannot find 'div.cn-modal-container' element\");\n }\n if (!acceptAllBtn) {\n throw new Error(\"Cannot find 'button#cn-accept-banner' element\");\n }\n if (!denyAllBtn) {\n throw new Error(\"Cannot find 'button#cn-deny-banner' element\");\n }\n if (!customizeBtn) {\n throw new Error(\"Cannot find 'button.cn-settings-banner' element\");\n }\n if (!cookiesUnorderedList) {\n throw new Error(\"Cannot find 'ul#cn-modal-list' element\");\n }\n if (!modalWrapper) {\n throw new Error(\"Cannot find 'div.cn-modal-wrapper' element\");\n }\n if (!template) {\n throw new Error(\"Cannot find 'div#cn-li-template' element\");\n }\n\n this.cookieShowModalBtn = cookieShowModalBtn;\n this.cookieCloseModalBtn = cookieCloseModalBtn;\n this.cookieLinkShowCustomizeModalList =\n cookieLinkShowCustomizeModalPageList;\n this.cookieContainer = cookieContainer;\n this.bannerContainer = bannerContainer;\n this.bannerContent = bannerContent;\n this.cookiesUnorderedList = cookiesUnorderedList;\n this.modalWrapper = modalWrapper;\n this.modalContainer = modalContainer;\n this.acceptAllBtn = acceptAllBtn;\n this.denyAllBtn = denyAllBtn;\n this.customizeBtn = customizeBtn;\n\n this.bannerDetailsAreExpanded = false;\n this.template = template;\n const memoryTemplate = this.template.cloneNode(true) as HTMLDivElement;\n this.template.remove();\n this.template = memoryTemplate;\n\n this.restrictCloseModal = true;\n\n // * Setup Events\n this.addEventPrevent(this.modalBg, \"click\", this.closeCookieModal);\n this.addEventPrevent(\n this.cookieCloseModalBtn,\n \"click\",\n this.closeCookieModal\n );\n this.addEventPrevent(this.acceptAllBtn, \"click\", this.acceptAllCookies);\n this.addEventPrevent(this.denyAllBtn, \"click\", this.denyAllCookies);\n this.addEventPrevent(\n this.customizeBtn,\n \"click\",\n this.switchToModalPageOrClose\n );\n this.addEventPrevent(\n this.cookieShowModalBtn,\n \"click\",\n this.toggleCookieModal\n );\n this.cookieLinkShowCustomizeModalList.forEach((cookieLink) => {\n this.addEventPrevent(\n cookieLink,\n \"click\",\n this.openCookieModalToCookiePage\n );\n this.addEventKbdValidate(cookieLink, this.openCookieModalToCookiePage);\n });\n\n // * Setup CN Cookie\n if (!this.cookiesMatchesConfig() || this.cookiesOlderThan(new Date())) {\n // * Setup Browser Cookie if none.\n this.resetBrowserCookie();\n this.openCookieModalToBannerPage();\n }\n\n this.updateRestrictCloseModal();\n\n // * Cookie should have been created from here.\n Object.entries(this.getCookieStatusList()).forEach(([cookieName, cookieStatus]) => {\n if (cookieStatus === CookieStatus.wait) {\n // * Open modal if any cookie config is not set.\n this.openCookieModalToBannerPage();\n return;\n }\n if (!this.config[cookieName]) {\n // * Ignore missing config\n return;\n }\n if (cookieStatus === CookieStatus.true) {\n // * Exec script part for accepted cookie.\n this.config[cookieName].script();\n return;\n }\n if (this.config[cookieName].fallback != null) {\n // * Exec fallback part for accepted cookie if provided.\n this.config[cookieName].fallback();\n }\n });\n }\n\n // COOKIES\n\n /**\n * Update restrict for closing cookie modal\n */\n updateRestrictCloseModal() {\n this.restrictCloseModal = (Object.values(this.getCookieStatusList()).includes(CookieStatus.wait)) ? true : false;\n (this.restrictCloseModal) ? this.cookieCloseModalBtn.classList.add(\"d-none\") : this.cookieCloseModalBtn.classList.remove(\"d-none\");\n (this.restrictCloseModal) ? this.modalBg.classList.add(\"cn-modal-bg-active\") : this.modalBg.classList.remove(\"cn-modal-bg-active\");\n }\n\n /**\n * Get cookies expiration date or null if not defined alread\n */\n readCookiesExpirationDate(): Date | null {\n const cookies = this.getBrowserCookieValue() ?? \"\",\n expirationDateString = cookies.split(\",\").find((cookieString) =>\n cookieString.startsWith(this.cookieExpirationName));\n if (!expirationDateString) {\n return null;\n }\n try {\n const epochExpiration = Number.parseInt(expirationDateString.replace(`${this.cookieExpirationName}=`, \"\"));\n if (isNaN(epochExpiration)) {\n return null;\n }\n return new Date(epochExpiration);\n } catch (e) {\n return null;\n }\n }\n\n /**\n * Check if the cookies date are older than a specified date\n\n * @param date The limit date for cookies\n */\n cookiesOlderThan(date: Date): boolean {\n return this.cookieExpirationDate.getTime() < date.getTime();\n }\n\n /**\n * Check if the actual cookie matches the config\n */\n cookiesMatchesConfig(): boolean {\n const cookies = this.getCookieStatusList();\n return Object.keys(cookies).length === Object.keys(this.config).length;\n }\n\n /**\n * Accept a all cookies\n */\n acceptAllCookies() {\n Object.keys(this.config).forEach((cookieName) => this.acceptCookie(cookieName));\n this.closeCookieModal();\n }\n\n /**\n * Accept a specific cookie\n */\n acceptCookie(cookieName: string) {\n const cookieOptions = this.getCookie(cookieName);\n this.setCookieStatus(cookieName, CookieStatus.true, cookieOptions);\n const cnSwitch = document.getElementById(`${cookieName}-switch`) as HTMLInputElement;\n const cnSwitchInput = cnSwitch!.querySelector(\"input\") as HTMLInputElement;\n cnSwitchInput!.checked = true;\n cnSwitch!.ariaChecked = \"true\";\n }\n\n /**\n * Deny a all cookies\n */\n denyAllCookies() {\n Object.keys(this.config).forEach((cookieName) => this.denyCookie(cookieName));\n this.closeCookieModal();\n }\n\n /**\n * Deny a specific cookie\n */\n denyCookie(cookieName: string) {\n const cookieOptions = this.getCookie(cookieName);\n this.setCookieStatus(cookieName, CookieStatus.false, cookieOptions);\n const cnSwitch = document.getElementById(`${cookieName}-switch`) as HTMLInputElement;\n const cnSwitchInput = cnSwitch!.querySelector(\"input\") as HTMLInputElement;\n cnSwitchInput!.checked = false;\n cnSwitch!.ariaChecked = \"false\";\n }\n\n /**\n * Deny all waiting cookies\n */\n denyAllWaitingCookies() {\n Object.entries(this.getCookieStatusList()).forEach(([cookieName, cookieStatus]) => {\n if (cookieStatus === CookieStatus.wait) {\n this.setBrowserCookieStatus(cookieName, CookieStatus.false);\n return;\n }\n });\n this.updateRestrictCloseModal();\n }\n\n /**\n * Get a specific cookie config\n */\n getCookie(cookieName: string): CookieOptions {\n const cookieOptions = Object.entries(this.config).find((entry) => entry[0] === cookieName)?.[1];\n if (cookieOptions === undefined) {\n throw new Error(`Cookie options ${cookieName} not found in list`);\n }\n return cookieOptions;\n }\n\n /**\n * Fetch the cookie status list\n *\n * @returns the cookie status list\n */\n getCookieStatusList(): CookieStatusList {\n const cookies = this.getBrowserCookieValue(),\n statusList: CookieStatusList = {};\n if (cookies === undefined) {\n return statusList;\n }\n /** specificCookieString contains youtube=true like */\n cookies.split(\",\")\n // * Ignore timestamp\n .filter((specificCookieString) => !specificCookieString.startsWith(this.cookieExpirationName))\n .forEach((specificCookieString) => {\n const values = specificCookieString.split(\"=\");\n statusList[values[0]] = values[1] as CookieStatus;\n });\n return statusList;\n }\n\n /**\n * Check has cookie status\n *\n * @param key\n * @param value\n */\n containsCookieStatus(key: string): boolean {\n const statusList: CookieStatusList = this.getCookieStatusList();\n return (\n Object.keys(statusList).find((cookieName) => cookieName === key) !==\n undefined\n );\n }\n\n /**\n * Set the cookie value\n *\n * @param cookieName\n * @param status\n * @param cookieOption\n */\n setCookieStatus(\n cookieName: string,\n status: CookieStatus,\n cookieOption: CookieOptions\n ) {\n if (status === CookieStatus.true) {\n this.addCookieStatus(cookieName, cookieOption);\n return;\n }\n if (status === CookieStatus.false) {\n this.removeCookieStatus(cookieName, cookieOption);\n return;\n }\n this.setBrowserCookieStatus(cookieName, CookieStatus.wait);\n }\n\n /**\n * Add a specific cookie and\n * change his status to true\n *\n * @param cookieName\n * @param cookieOption\n */\n addCookieStatus(cookieName: string, cookieOption: CookieOptions) {\n if (cookieOption.script) {\n cookieOption.script();\n }\n this.setBrowserCookieStatus(cookieName, CookieStatus.true);\n }\n\n /**\n * Remove a specific cookie and\n * change his status to false\n *\n * @param cookieName\n * @param cookieOption\n */\n removeCookieStatus(cookieName: string, cookieOption: CookieOptions) {\n const cookieNameElement = document.getElementById(cookieName);\n if (cookieNameElement) {\n cookieNameElement.remove();\n }\n if (cookieOption.fallback) {\n cookieOption.fallback();\n }\n this.setBrowserCookieStatus(cookieName, CookieStatus.false);\n }\n\n /**\n * Change the status of a cookie\n *\n * @param cookieName\n * @param status\n */\n setBrowserCookieStatus(cookieName: string, status: CookieStatus) {\n const statusList: CookieStatusList = this.getCookieStatusList();\n // * Force refresh\n this.deleteBrowserCookie();\n statusList[cookieName] = status;\n this.saveBrowserCookie(statusList);\n this.updateRestrictCloseModal();\n }\n\n /**\n * Has CN cokie setup ?\n * @returns true if the cookie is setup\n */\n hasBrowserCookie(): boolean {\n return Boolean(this.getBrowserCookieValue());\n }\n\n /**\n * Get the Ldcweb cookie\n *\n * @returns A string like analytics=true,youtube=true or undefined\n */\n getBrowserCookieValue() {\n const matches = document.cookie.match(\n new RegExp(\n \"(?:^|; )\" +\n this.browserCookieName.replace(\n /([.$?*|{}()[\\]\\\\/+^])/g,\n \"\\\\$1\"\n ) +\n \"=([^;]*)\"\n )\n );\n return matches ? decodeURIComponent(matches[1]) : undefined;\n }\n\n /**\n * Save cookie content on web browser\n *\n * @param list\n */\n saveBrowserCookie(statusList: CookieStatusList) {\n const date = new Date(),\n content = Object.entries(statusList)\n .map(([cookieName, cookieStatus]) => {\n return `${cookieName}=${cookieStatus}`;\n });\n // * Update expiration date\n this.cookieExpirationDate = new Date(date.setMonth(date.getMonth() + this.cookieTimeLife));\n // * Append expiration date\n content.push(`${this.cookieExpirationName}=${this.cookieExpirationDate.getTime()}`);\n document.cookie = `${this.browserCookieName}=${content.join(\",\")};path=/${\n location.hostname ? `;domain=${location.hostname}` : \"\"\n };expires=${this.cookieExpirationDate.toUTCString()};${this.getCookiePoliciesAsString()}`;\n }\n\n /**\n * Set an older expire parameter to a specific cookie\n */\n deleteBrowserCookie() {\n if (this.hasBrowserCookie()) {\n // * Suppression du cookie et de sa version precedé d'un point\n document.cookie = `${this.browserCookieName}=;path=/${\n location.hostname ? `;domain=.${location.hostname}` : \"\"\n };expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\n document.cookie = `${this.browserCookieName}=;path=/${\n location.hostname ? `;domain=${location.hostname}` : \"\"\n };expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\n }\n }\n\n getCookiePoliciesAsString(): string {\n return Object.entries(this.cookiePolicies)\n .map(([policyName, policyValue]) => `${policyName}=${policyValue}`)\n .join(\";\");\n }\n\n /**\n * Reset Ldc Web CN cookie\n */\n resetBrowserCookie() {\n // * Create Cookie as It does not exists.\n const newCookieList: CookieStatusList = {};\n Object.entries(this.config).forEach(\n ([cookieName]) => (newCookieList[cookieName] = CookieStatus.wait)\n );\n this.saveBrowserCookie(newCookieList);\n }\n\n // LISTENERS\n\n /**\n * Add event on a specific element\n *\n * @param element\n * @param evnt\n * @param funct\n * @returns\n */\n addEvent(element: HTMLElement, evnt: string, funct: (e: Event) => void) {\n return element.addEventListener(evnt, funct.bind(this), false);\n }\n\n /**\n * Add event on a specific element and prevent default\n *\n * @param element\n * @param evnt\n * @param funct\n * @returns\n */\n addEventPrevent(\n element: HTMLElement,\n evnt: string,\n funct: (e: Event) => void\n ) {\n return element.addEventListener(\n evnt,\n (e) => {\n e.preventDefault();\n funct.call(this, e);\n },\n false\n );\n }\n\n /**\n * Add event on a specific element\n *\n * @param element\n * @param evnt\n * @param funct\n * @returns\n */\n addEventKbdValidate(element: HTMLElement, funct: (e: Event) => void) {\n return this.addEvent(element, \"keydown\", (e: Event) => {\n const kbdEvt = e as KeyboardEvent;\n if (\n kbdEvt.key == \" \" ||\n kbdEvt.code == \"Space\" ||\n kbdEvt.keyCode == 32 ||\n kbdEvt.key == \"Enter\" ||\n kbdEvt.code == \"Enter\" ||\n kbdEvt.keyCode == 13\n ) {\n funct.call(this, kbdEvt);\n e.preventDefault();\n }\n });\n }\n\n // COOKIE MODAL\n\n /**\n * Show or hide Cookie modal\n * @returns\n */\n toggleCookieModal() {\n if (!document.body.classList.contains(\"cn-open\")) {\n this.openCookieModalToBannerPage();\n return;\n }\n this.closeCookieModal();\n }\n\n /**\n * Open the cookies modal to the banner page\n */\n openCookieModalToBannerPage() {\n this.openCookieModalToCookiePage();\n this.toggleCookieModalPages();\n }\n\n /**\n * Open the cookies modal to the cookies page\n */\n openCookieModalToCookiePage() {\n document.body.classList.add(\"cn-open\");\n this.resetCookieModal();\n this.bannerContent.classList.add(\"d-none\");\n this.modalContainer.classList.remove(\"d-none\");\n this.bannerContainer.classList.add(\"cn-modal-page\");\n\n // Scroll to the top of the cookies list\n this.modalWrapper.scrollTop = 0;\n this.setupCookieModalList();\n this.setTabIndex();\n }\n\n /**\n * Hide the cookies modal\n */\n closeCookieModal() {\n this.updateRestrictCloseModal();\n if (!this.restrictCloseModal) {\n document.body.classList.remove(\"cn-open\");\n if (!this.isOnBannerPage()) {\n // * Make toggle page to banner on closing\n this.bannerContent.classList.toggle(\"d-none\");\n this.modalContainer.classList.toggle(\"d-none\");\n this.bannerContainer.classList.remove(\"cn-modal-page\");\n }\n this.unsetTabIndex();\n this.setupCookieModalList();\n } else {\n throw new Error(\"You need to accept or refuse all cookies\");\n }\n }\n\n /**\n * Setup tab indexes on visible elements\n */\n setTabIndex() {\n // * Prevent focus html tag\n document.documentElement.setAttribute(\"tabindex\", \"-1\");\n setTimeout(() => {\n const focusableSelector =\n \"a[href], button, [role=\\\"button\\\"], input, embed, object, iframe, textarea, select, details, [tabindex]:not([tabindex=\\\"-1\\\"])\";\n\n // * Only focusable elements\n [...document.body.querySelectorAll(focusableSelector)]\n .filter(\n (el) =>\n !el.hasAttribute(\"disabled\") &&\n !el.getAttribute(\"aria-hidden\") &&\n !this.cookieContainer.contains(el)\n )\n .forEach((el) => {\n (el as HTMLElement).setAttribute(\"tabindex\", \"-1\");\n (el as HTMLElement).classList.add(\"cn-disabled\");\n });\n [...this.cookieContainer.querySelectorAll(focusableSelector)]\n .filter(\n (el) =>\n !el.hasAttribute(\"disabled\") &&\n !el.getAttribute(\"aria-hidden\") &&\n // * Only visible elements\n !!(\n (el as HTMLElement).offsetWidth ||\n (el as HTMLElement).offsetHeight ||\n el.getClientRects().length\n ) &&\n !this.cookieContainer.contains(el)\n )\n .forEach((el) => {\n (el as HTMLElement).setAttribute(\"tabindex\", \"0\");\n (el as HTMLElement).classList.remove(\"cn-disabled\");\n });\n this.cookieShowModalBtn.setAttribute(\"tabindex\", \"-1\");\n }, 500);\n }\n\n /**\n * Undo setup tab indexes on visible elements\n */\n unsetTabIndex() {\n document.documentElement.setAttribute(\"tabindex\", \"0\");\n setTimeout(() => {\n document.body.querySelectorAll(\".cn-disabled\").forEach((el) => {\n (el as HTMLElement).setAttribute(\"tabindex\", \"0\");\n (el as HTMLElement).classList.remove(\"cn-disabled\");\n });\n this.cookieShowModalBtn.setAttribute(\"tabindex\", \"0\");\n }, 500);\n }\n\n /**\n * Reset the modal view state\n */\n resetCookieModal() {\n this.bannerContent.classList.remove(\"d-none\");\n this.modalContainer.classList.add(\"d-none\");\n this.bannerContainer.classList.remove(\"cn-modal-page\");\n if (!this.customizeBtn.dataset.openModal) {\n throw new Error(\"Cannot find attribut data-open-modal\");\n }\n this.customizeBtn.innerHTML = this.customizeBtn.dataset.openModal;\n }\n\n /**\n * Set the cookies list in the modal\n */\n setupCookieModalList() {\n this.cookiesUnorderedList.innerHTML = \"\";\n Object.entries(this.config).forEach(([cookieName, cookieConfig]) => {\n const cookie = document.createElement(\"li\");\n const childItem = this.template.children.item(\n 0\n ) as HTMLDivElement | null;\n if (childItem === null) {\n throw new Error(\"Cannot find child item\");\n }\n cookie.append(childItem.cloneNode(true));\n const name = cookie.querySelector(\n \"span.cn-cookie-name\"\n ) as HTMLSpanElement;\n const description = cookie.querySelector(\n \"span.cn-cookie-description\"\n ) as HTMLSpanElement;\n const link = cookie.querySelector(\n \".cn-cookie-link\"\n ) as HTMLElement;\n const cnSwitch = cookie.querySelector(\n \".cn-switch\"\n ) as HTMLInputElement;\n const cnSwitchInput = cookie.querySelector(\n \".cn-switch > input\"\n ) as HTMLInputElement;\n\n // * Undertermined state\n cnSwitchInput.indeterminate = true;\n cnSwitchInput.checked = false;\n\n // * Assign cookie aside content\n name.textContent = cookieConfig.name;\n description.id = `${cookieName}-desc`;\n description.textContent = cookieConfig.description;\n link.textContent = cookieConfig.labelLink;\n link.setAttribute(\"href\", cookieConfig.link);\n\n // * Assign cookie controls\n cnSwitch.id = `${cookieName}-switch`;\n cnSwitch.name = cookieName;\n cnSwitch.dataset.name = cookieName;\n cnSwitch.setAttribute(\"aria-labelledby\", `${cookieName}-desc`);\n cnSwitch.setAttribute(\"aria-describedby\", `${cookieName}-desc`);\n\n const toggleCookie = () => {\n this.setCookieStatus(\n cookieName,\n cnSwitch.checked ? CookieStatus.true : CookieStatus.false,\n cookieConfig\n );\n };\n this.addEvent(cnSwitch, \"click\", () => {\n toggleCookie();\n if (cnSwitchInput.checked) {\n cnSwitch.ariaChecked = \"true\";\n } else {\n cnSwitch.ariaChecked = \"false\";\n }\n });\n this.addEventKbdValidate(cnSwitch, () => {\n toggleCookie();\n cnSwitchInput.checked = !cnSwitchInput.checked;\n if (cnSwitchInput.checked) {\n cnSwitch.ariaChecked = \"true\";\n } else {\n cnSwitch.ariaChecked = \"false\";\n }\n });\n\n this.cookiesUnorderedList.append(cookie);\n\n if (!this.hasBrowserCookie()) {\n // * Ldcweb cookie is not set.\n return;\n }\n // * Setup list status state\n Object.entries(this.getCookieStatusList()).forEach(\n ([ckName, cookieStatus]) => {\n if (ckName === cookieName) {\n switch (cookieStatus) {\n case CookieStatus.true:\n cnSwitchInput.indeterminate = false;\n cnSwitchInput.checked = true;\n break;\n case CookieStatus.false:\n cnSwitchInput.indeterminate = false;\n cnSwitchInput.checked = false;\n break;\n case CookieStatus.wait:\n cnSwitchInput.indeterminate = true;\n cnSwitchInput.checked = false;\n break;\n }\n }\n }\n );\n });\n }\n\n switchToModalPageOrClose(): void {\n // * Modification du comportement du bouton, même si ca n'a pas de sens.\n // https://lab.s-web.fr/ldc-web/projets/ldc-web-cookie-notice/-/issues/9`\n\n if (this.isOnBannerPage()) {\n this.toggleCookieModalPages();\n return;\n }\n // * Pas de permutation en arrière\n this.closeCookieModal();\n }\n\n /**\n * Toggle Cookie modal pages\n */\n toggleCookieModalPages() {\n this.bannerContent.classList.toggle(\"d-none\");\n this.modalContainer.classList.toggle(\"d-none\");\n this.bannerContainer.classList.toggle(\"cn-modal-page\");\n if (!this.isOnBannerPage()) {\n this.bannerContainer.classList.add(\"cn-modal-page\");\n this.denyAllWaitingCookies();\n }\n this.setTabIndex();\n this.setupCookieModalList();\n this.togglePersonalizeBtn();\n }\n\n /**\n * Toggle customize btn\n */\n togglePersonalizeBtn() {\n const customizeBtnBannerDataset = this.customizeBtn.dataset;\n this.modalWrapper.scrollTop = 0;\n if (this.bannerContent.classList.contains(\"d-none\")) {\n this.customizeBtn.innerHTML =\n customizeBtnBannerDataset.openModal as string;\n this.customizeBtn.title = customizeBtnBannerDataset.openModal as string;\n } else {\n this.customizeBtn.innerHTML =\n customizeBtnBannerDataset.closeModal as string;\n this.customizeBtn.title = customizeBtnBannerDataset.closeModal as string;\n }\n }\n\n /**\n * Get the actual page: banner or modal (with cookie choices)\n */\n isOnBannerPage(): boolean {\n return this.modalContainer.classList.contains(\"d-none\");\n }\n}\n\nenum CookieStatus {\n true = \"true\",\n false = \"false\",\n wait = \"wait\",\n}\n\ntype CookieStatusList = Record;\n\ntype CookiePolicy = {\n sameSite: CookiePolicySameSite;\n secure: string;\n};\n\nenum CookiePolicySameSite {\n lax = \"lax\",\n strict = \"strict\",\n none = \"none\",\n}\n\nexport type CookieOptions = {\n name: string;\n description: string;\n link: string;\n labelLink: string;\n cookies: string[];\n /**\n * Fonction qui sert à initialiser la fonctionnalité\n * conduisant à la génération du cookie\n * @return void\n */\n script: () => void;\n /**\n * Fonction qui sert à informer l'utilisateur\n * sur chaque élèment que le cookie\n * associé à la fonctionnalité\n * est désactivé et propose un lien sur\n * cookie notice pour l'activer\n * @return void\n */\n fallback: () => void | null;\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","","// startup\n// Load entry module and return exports\n__webpack_require__(\"./src/ts/index.ts\");\n// This entry module doesn't tell about it's top-level declarations so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/scss/themes/standard.scss\");\n",""],"names":["CookieNotice","config","_this","_classCallCheck","_defineProperty","sameSite","CookiePolicySameSite","lax","secure","cookieExpirationDate","readCookiesExpirationDate","Date","setMonth","getMonth","cookieTimeLife","modalBg","document","createElement","classList","add","body","append","cookieContainer","querySelector","cookieShowModalBtn","cookieCloseModalBtn","cookieLinkShowCustomizeModalPageList","querySelectorAll","bannerContainer","bannerContent","modalContainer","acceptAllBtn","denyAllBtn","customizeBtn","cookiesUnorderedList","modalWrapper","template","Error","cookieLinkShowCustomizeModalList","bannerDetailsAreExpanded","memoryTemplate","cloneNode","remove","restrictCloseModal","addEventPrevent","closeCookieModal","acceptAllCookies","denyAllCookies","switchToModalPageOrClose","toggleCookieModal","forEach","cookieLink","openCookieModalToCookiePage","addEventKbdValidate","cookiesMatchesConfig","cookiesOlderThan","resetBrowserCookie","openCookieModalToBannerPage","updateRestrictCloseModal","Object","entries","getCookieStatusList","_ref","_ref2","_slicedToArray","cookieName","cookieStatus","CookieStatus","wait","true","script","fallback","_createClass","key","value","values","includes","_this$getBrowserCooki","_this2","cookies","getBrowserCookieValue","expirationDateString","split","find","cookieString","startsWith","cookieExpirationName","epochExpiration","Number","parseInt","replace","concat","isNaN","e","date","getTime","keys","length","_this3","acceptCookie","cookieOptions","getCookie","setCookieStatus","cnSwitch","getElementById","cnSwitchInput","checked","ariaChecked","_this4","denyCookie","false","denyAllWaitingCookies","_this5","_ref3","_ref4","setBrowserCookieStatus","_Object$entries$find","entry","undefined","_this6","statusList","filter","specificCookieString","containsCookieStatus","status","cookieOption","addCookieStatus","removeCookieStatus","cookieNameElement","deleteBrowserCookie","saveBrowserCookie","hasBrowserCookie","Boolean","matches","cookie","match","RegExp","browserCookieName","decodeURIComponent","content","map","_ref5","_ref6","push","join","location","hostname","toUTCString","getCookiePoliciesAsString","cookiePolicies","_ref7","_ref8","policyName","policyValue","newCookieList","_ref9","_ref10","addEvent","element","evnt","funct","addEventListener","bind","_this7","preventDefault","call","_this8","kbdEvt","code","keyCode","contains","toggleCookieModalPages","resetCookieModal","scrollTop","setupCookieModalList","setTabIndex","isOnBannerPage","toggle","unsetTabIndex","_this9","documentElement","setAttribute","setTimeout","focusableSelector","_toConsumableArray","el","hasAttribute","getAttribute","offsetWidth","offsetHeight","getClientRects","_this10","dataset","openModal","innerHTML","_this11","_ref11","_ref12","cookieConfig","childItem","children","item","name","description","link","indeterminate","textContent","id","labelLink","toggleCookie","_ref13","_ref14","ckName","togglePersonalizeBtn","customizeBtnBannerDataset","title","closeModal","default"],"sourceRoot":""} \ No newline at end of file