From 027b400c38d30a68c8c92e0a123bd008bf3251e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Tue, 14 Jan 2020 15:39:37 +0100 Subject: [PATCH] adding --- demo.js | 26 ++++++++++- demo.scss | 107 ++++++++++++++++++++++++++++++++++++++----- dist/css/demo.css | 2 +- dist/js/demo.js | 2 +- src/TinyConsent.riot | 96 +++++++++++++++++++++----------------- 5 files changed, 176 insertions(+), 57 deletions(-) diff --git a/demo.js b/demo.js index ac6d06c..c866e50 100644 --- a/demo.js +++ b/demo.js @@ -10,7 +10,10 @@ const data = { title: 'Matomo', name: 'matamo_', id: 'matamo', - content: '', + content: 'Cookie from Matamo for Website-Analytics. Creates statiscial Data how the User uses this Website', + provider: 'Tentakelfabrik.de', + duration: '1 Year', + privacy_policy: 'http://this', handleAgree: function() { console.log('agree'); }, @@ -18,9 +21,28 @@ const data = { console.log('reject'); } },{ + title: 'Tiny Consent', + id: 'tiny_consent', + name: 'tiny_consent', + content: 'Saves the Settings of Cookies from Tiny Consent', + provider: 'Owner of this Site', + duration: '1 Year', + essential: true + }, { + title: 'Wordpress', + id: 'wordpress', + name: 'wordpress_', + content: 'Wordpress is using Session Cookie to handle the Login', + provider: 'Owner of this Site', + duration: '1 Year', + essential: true + },{ + title: 'Wordpress - WooCommerce', id: 'wordpress', name: 'wordpress_', - content: 'Wordpress und WooCommerce nutzen Session, diese werden zum einen für den Login genutzt, aber auch für den Warenkorb.', + content: 'WooCommerce is a Shop-Plugin for Wordpress. Cookies will be used for the Cart', + provider: 'Owner of this Site', + duration: '1 Year', essential: true }] }; diff --git a/demo.scss b/demo.scss index 62e5485..6058745 100644 --- a/demo.scss +++ b/demo.scss @@ -5,15 +5,31 @@ */ .tiny-consent { - &__banner { - position: fixed; - left: 0; - bottom: 0; + position: fixed; + left: 0; + bottom: 0; + overflow: hidden; - width: 100%; - height: auto; + background: #171717; - margin: 1em; + width: 100%; + height: auto; + display: none; + + color: white; + + &__inner { + padding: 2em; + } + + &__header { + position: relative; + } + + &__close { + position: absolute; + top: 0; + right: 0; } &__cookies { @@ -21,15 +37,84 @@ padding: 0; } - &__content { + &__cookie { display: none; + position: relative; + margin-bottom: 1.5em; + + &-title { + display: inline-block; + margin-right: 10px; + font-weight: bold; + } + + &-content { + max-width: 80%; + + p { + line-height: 1.5; + } + } + + &-decision { + position: absolute; + right: 0; + bottom: 0; + text-align: right; + + .tiny-consent__button { + margin-left: 0.8em; + } + } + + &-footer { + ul { + list-style: none; + padding: 0; + margin: -0.8em 0 0.8em 0; + + li { + display: inline-block; + margin-right: 1em; + font-size: 80%; + + span { + display: inline-block; + margin-right: .5em; + font-weight: bold; + } + } + } + } } - &__cookie { - display: none; + .button { + background: black; + border: 2px solid white; + padding: .5em 1.8em; + color: white; + font-size: 0.9rem; + + &--active { + color: black; + background: white; + } + + &:hover { + cursor: pointer; + color: black; + background: white; + } + + &:disabled { + cursor: not-allowed; + background: #7d7d7d; + color: #cecece; + border-color: #cecece; + } } } .show { - display: block; + display: block !important; } \ No newline at end of file diff --git a/dist/css/demo.css b/dist/css/demo.css index ba36632..205c0bc 100644 --- a/dist/css/demo.css +++ b/dist/css/demo.css @@ -1 +1 @@ -.tiny-consent__banner{position:fixed;left:0;bottom:0;width:100%;height:auto;margin:1em}.tiny-consent__cookies{margin:0;padding:0}.tiny-consent__content,.tiny-consent__cookie{display:none}.show{display:block} \ No newline at end of file +.tiny-consent{position:fixed;left:0;bottom:0;overflow:hidden;background:#171717;width:100%;height:auto;display:none;color:#fff}.tiny-consent__inner{padding:2em}.tiny-consent__header{position:relative}.tiny-consent__close{position:absolute;top:0;right:0}.tiny-consent__cookies{margin:0;padding:0}.tiny-consent__cookie{display:none;position:relative;margin-bottom:1.5em}.tiny-consent__cookie-title{display:inline-block;margin-right:10px;font-weight:700}.tiny-consent__cookie-content{max-width:80%}.tiny-consent__cookie-content p{line-height:1.5}.tiny-consent__cookie-decision{position:absolute;right:0;bottom:0;text-align:right}.tiny-consent__cookie-decision .tiny-consent__button{margin-left:.8em}.tiny-consent__cookie-footer ul{list-style:none;padding:0;margin:-.8em 0 .8em}.tiny-consent__cookie-footer ul li{display:inline-block;margin-right:1em;font-size:80%}.tiny-consent__cookie-footer ul li span{display:inline-block;margin-right:.5em;font-weight:700}.tiny-consent .button{background:#000;border:2px solid #fff;padding:.5em 1.8em;color:#fff;font-size:.9rem}.tiny-consent .button--active{color:#000;background:#fff}.tiny-consent .button:hover{cursor:pointer;color:#000;background:#fff}.tiny-consent .button:disabled{cursor:not-allowed;background:#7d7d7d;color:#cecece;border-color:#cecece}.show{display:block!important} \ No newline at end of file diff --git a/dist/js/demo.js b/dist/js/demo.js index f4effd8..a0962e1 100644 --- a/dist/js/demo.js +++ b/dist/js/demo.js @@ -1 +1 @@ -!function(e){var t={};function n(o){if(t[o])return t[o].exports;var s=t[o]={i:o,l:!1,exports:{}};return e[o].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(o,s,function(t){return e[t]}.bind(null,s));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=1)}([function(e,t,n){var o,s;!function(r){if(void 0===(s="function"==typeof(o=r)?o.call(t,n,t,e):o)||(e.exports=s),!0,e.exports=r(),!!0){var i=window.Cookies,a=window.Cookies=r();a.noConflict=function(){return window.Cookies=i,a}}}((function(){function e(){for(var e=0,t={};e{const i="selectedIndex"in t;let a=i;for(;oe==t,_=e=>e,N=(e,t,n,o,s,r,i)=>{const a=r-s;if(a<1)return-1;for(;n-t>=a;){let a=t,u=s;for(;an{for(;n{let o=1,s=t;for(;o>>0;n{((e,t,n,o,s,r,i,a,u)=>{const c=[],l=e.length;let p=i,d=0;for(;d{const a=n+r,u=[];let c,l,p,d,h,f,m;e:for(c=0;c<=a;c++){if(c>50)return null;for(m=c-1,h=c?u[c-1]:[0,0],f=u[c]=[],l=-c;l<=c;l+=2){for(d=l===-c||l!==c&&h[m+l-1]=0;c--){for(;d>0&&p>0&&i(o[s+d-1],e[t+p-1]);)b[g--]=0,d--,p--;if(!c)break;m=c-1,h=c?u[c-1]:[0,0],l=d-p,l===-c||l!==c&&h[m+l-1]{let u=0,c=oi;)--u;c=a+o-u;const h=Array(c);let f=l[u];for(--n;f;){const{newi:e,oldi:t}=f;for(;n>e;)h[--c]=1,--n;for(;i>t;)h[--c]=-1,--i;h[--c]=0,--n,--i,f=f.prev}for(;n>=t;)h[--c]=1,--n;for(;i>=r;)h[--c]=-1,--i;return h})(n,o,s,r,i,a,u,c),e,t,n,o,i,a,l,d)},M=e=>(e.remove||w).call(e);function w(){const{parentNode:e}=this;e&&e.removeChild(this)}function I(e,t){return typeof e===t}function S(e){const t=e.ownerSVGElement;return!!t||null===t}function U(e){return!R(e.content)}function D(e){return I(e,"function")}function B(e){return!R(e)&&I(e,"object")}function R(e){return null==e}const P=Symbol("unmount"),L=Object.seal({nodes:[],mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:n,nodes:o,childrenMap:s}=this,r=e===P?null:this.evaluate(e),i=r?Array.from(r):[],a=n.parentNode,{newChildrenMap:u,batches:c,futureNodes:l}=function(e,t,n,o){const{condition:s,template:r,childrenMap:i,itemName:a,getKey:u,indexName:c,root:l,isTemplateTag:p}=o,d=new Map,h=[],f=[];return e.forEach((e,o)=>{const m=function(e,t){let{itemName:n,indexName:o,index:s,item:r}=t;e[n]=r,o&&(e[o]=s);return e}(Object.create(t),{itemName:a,indexName:c,index:o,item:e}),b=u?u(m):o,g=i.get(b);if(function(e,t){return!!e&&!1===Boolean(e(t))}(s,m))return;const v=g?g.template:r.clone(),y=g?v.el:l.cloneNode(),O=!g,E=p&&O?function(e){const t=e.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:t,children:Array.from(t.childNodes)}}(v):{};if(O?h.push(()=>v.mount(y,m,n,E)):h.push(()=>v.update(m,n)),p){const e=E.children||v.children;f.push(...e),e.forEach(e=>d.set(e,null))}else f.push(y);i.delete(b),d.set(b,{template:v,context:m,index:o})}),{newChildrenMap:d,batches:h,futureNodes:f}}(i,e,t,this);return((e,t,n,o)=>{o||(o={});const s=o.compare||x,r=o.node||_,i=null==o.before?null:r(o.before,0),a=t.length;let u=a,c=0,l=n.length,p=0;for(;c{for(;oe()),this.childrenMap=u,this.nodes=l,this},unmount(e,t){return this.update(P,t),this}});function Y(e,t){return(n,o)=>{if(o<0){const n=e.pop();if(n){const{template:e,context:o}=n;e.unmount(o,t,null)}}return n}}const K=Object.seal({mount(e,t){return this.update(e,t)},update(e,t){const n=!!this.evaluate(e),o=!this.value&&n,s=this.value&&!n,r=()=>{const n=this.node.cloneNode();this.placeholder.parentNode.insertBefore(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,e,t)};switch(!0){case o:r();break;case s:this.unmount(e);break;default:n&&this.template.update(e,t)}return this.value=n,this},unmount(e,t){return this.template.unmount(e,t,!0),this}});const F="undefined"==typeof Element?{}:Element.prototype,z=function(e){const t=new Map,n=n=>t.has(n)?t.get(n):t.set(n,e.call(this,n))&&t.get(n);return n.cache=t,n}(e=>F.hasOwnProperty(e));function V(e,t,n,o){let{name:s}=t;s?(!z(s)&&(function(e){return I(e,"boolean")}(n)||B(n)||D(n))&&(e[s]=n),e[function(e){return R(e)||!1===e||""===e||B(e)||D(e)?"removeAttribute":"setAttribute"}(n)](s,function(e,t){return!0===t?e:t}(s,n))):n?function(e,t){Object.entries(t).forEach(t=>{let[n,o]=t;return V(e,{name:n},o)})}(e,n):o&&function(e,t){Object.keys(t).forEach(t=>e.removeAttribute(t))}(e,o)}const X=/^on/;function H(e){return R(e)?"":e}const $=(e,t)=>{const n=e.childNodes[t];if(n.nodeType===Node.COMMENT_NODE){const t=document.createTextNode("");return e.replaceChild(t,n),t}return n};var G={0:V,1:function(e,t,n,o){let{name:s}=t;const r=s.replace(X,"");o&&e.removeEventListener(r,o),n&&e.addEventListener(r,n,!1)},2:function(e,t,n){e.data=H(n)},3:function(e,t,n){e.value=H(n)}};const J=Object.seal({mount(e){return this.value=this.evaluate(e),q(this,this.value),this},update(e){const t=this.evaluate(e);return this.value!==t&&(q(this,t),this.value=t),this},unmount(){return 1===this.type&&q(this,null),this}});function q(e,t){return G[e.type](e.node,e,t,e.value)}function W(e,t){return Object.assign({},J,{},t,{node:2===t.type?$(e,t.childNodeIndex):e})}function Z(e,t,n){if(!e||!e.length)return n;const o=e.map(e=>Object.assign({},e,{value:e.evaluate(t)}));return Object.assign(Object.create(n||null),function(e){return e.reduce((e,t)=>{const{value:n,type:o}=t;switch(!0){case!t.name&&0===o:return Object.assign({},e,{},n);case 3===o:e.value=t.value;break;default:e[(s=t.name,s.replace(/-(\w)/g,(e,t)=>t.toUpperCase()))]=t.value}var s;return e},{})}(o))}const Q=Object.seal({attributes:[],getTemplateScope(e,t){return Z(this.attributes,e,t)},mount(e,t){const n=!!e.slots&&e.slots.find(e=>{let{id:t}=e;return t===this.name}),{parentNode:o}=this.node;return this.template=n&&ae(n.html,n.bindings).createDOM(o),this.template&&(this.template.mount(this.node,this.getTemplateScope(e,t)),this.template.children=function e(t,n){void 0===n&&(n=[]);const o=t.firstChild;if(o)return t.parentNode.insertBefore(o,t),[o,...e(t)];return n}(this.node)),v(this.node),this},update(e,t){return this.template&&this.template.update(this.getTemplateScope(e,t)),this},unmount(e,t,n){return this.template&&this.template.unmount(this.getTemplateScope(e,t),null,n),this}});function ee(e){return e.reduce((e,t)=>{let{bindings:n}=t;return e.concat(n)},[])}const te=Object.seal({mount(e){return this.update(e)},update(e,t){const n=this.evaluate(e);return n===this.name?this.tag.update(e):(this.unmount(e,t,!0),this.name=n,this.tag=function(e,t,n){return void 0===t&&(t=[]),void 0===n&&(n=[]),e?e({slots:t,attributes:n}):ae(function(e){return e.reduce((e,t)=>e+t.html,"")}(t),[...ee(t),{expressions:n.map(e=>Object.assign({type:0},e))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,e)),this},unmount(e,t,n){return this.tag&&this.tag.unmount(n),this}});var ne={1:function(e,t){let{evaluate:n,template:o}=t;const s=e.parentNode,r=document.createTextNode("");return s.insertBefore(r,e),v(e),Object.assign({},K,{node:e,evaluate:n,placeholder:r,template:o.createDOM(e)})},2:function(e,t){let{expressions:n}=t;return Object.assign({},(o=n.map(t=>W(e,t)),["mount","update","unmount"].reduce((e,t)=>Object.assign({},e,{[t]:e=>o.map(n=>n[t](e))&&s}),{})));var o,s},0:function(e,t){let{evaluate:n,condition:o,itemName:s,indexName:r,getKey:i,template:a}=t;const u=document.createTextNode(""),c=e.parentNode,l=e.cloneNode();return c.insertBefore(u,e),v(e),Object.assign({},L,{childrenMap:new Map,node:e,root:l,condition:o,evaluate:n,isTemplateTag:U(l),template:a.createDOM(e),getKey:i,indexName:r,itemName:s,placeholder:u})},3:function(e,t){let{evaluate:n,getComponent:o,slots:s,attributes:r}=t;return Object.assign({},te,{node:e,evaluate:n,slots:s,attributes:r,getComponent:o})},4:function(e,t){let{name:n,attributes:o}=t;return Object.assign({},Q,{attributes:o,node:e,name:n})}};function oe(e,t){return e.map(e=>2===e.type?Object.assign({},e,{childNodeIndex:e.childNodeIndex+t}):e)}function se(e,t){return S(e)?function(e,t){return t.ownerDocument.importNode((new window.DOMParser).parseFromString(`${e}`,"application/xml").documentElement,!0)}(t,e):function(e,t){const n=U(t)?t:document.createElement("template");return n.innerHTML=e,n.content}(t,e)}function re(e,t){switch(!0){case S(e):!function e(t,n){t.firstChild&&(n.appendChild(t.firstChild),e(t,n))}(t,e);break;case U(e):e.parentNode.replaceChild(t,e);break;default:e.appendChild(t)}}const ie=Object.freeze({createDOM(e){return this.dom=this.dom||function(e,t){return t&&("string"==typeof t?se(e,t):t)}(e,this.html),this},mount(e,t,n,o){if(void 0===o&&(o={}),!e)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(t);const{fragment:s,children:r,avoidDOMInjection:i}=o,{parentNode:a}=r?r[0]:e,u=U(e),c=u?Math.max(Array.from(a.children).indexOf(e),0):null;return this.isTemplateTag=u,this.createDOM(e),this.dom&&(this.fragment=s||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?a:e,this.children=this.isTemplateTag?r||Array.from(this.fragment.childNodes):null,!i&&this.fragment&&re(e,this.fragment),this.bindings=this.bindingsData.map(e=>function(e,t,n){const{selector:o,type:s,redundantAttribute:r,expressions:i}=t,a=o?e.querySelector(o):e;r&&a.removeAttribute(r);const u=i||[];return(ne[s]||ne[2])(a,Object.assign({},t,{expressions:n&&!o?oe(u,n):u}))}(this.el,e,c)),this.bindings.forEach(e=>e.mount(t,n)),this},update(e,t){return this.bindings.forEach(n=>n.update(e,t)),this},unmount(e,t,n){if(this.el){switch(this.bindings.forEach(o=>o.unmount(e,t,n)),!0){case this.children&&null!==n:g(this.children);break;case!0===n:v(this.el);break;case null!==n:g(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function ae(e,t){return void 0===t&&(t=[]),Object.assign({},ie,{html:e,bindingsData:t})}function ue(e,t,n,o){return void 0===o&&(o={}),Object.defineProperty(e,t,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},o)),e}function ce(e,t,n){return Object.entries(t).forEach(t=>{let[o,s]=t;ue(e,o,s,n)}),e}function le(e,t){return Object.entries(t).forEach(t=>{let[n,o]=t;e[n]||(e[n]=o)}),e}function pe(e){return e.replace(/-(\w)/g,(e,t)=>t.toUpperCase())}function de(e){throw new Error(e)}function he(e){return e.reduce((e,t)=>{const{value:n,type:o}=t;switch(!0){case!t.name&&0===o:return Object.assign({},e,{},n);case 3===o:e.value=t.value;break;default:e[pe(t.name)]=t.value}return e},{})}function fe(e){return Array.isArray(e)?e:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&"number"==typeof e.length?Array.from(e):[e]}function me(e,t){return fe("string"==typeof e?(t||document).querySelectorAll(e):e)}const be=e=>1===e.length?e[0]:e;function ge(e,t,n){const o="object"==typeof t?t:{[t]:n},s=Object.keys(o);return fe(e).forEach(e=>{s.forEach(t=>e.setAttribute(t,o[t]))}),e}function ve(e,t){return function(e,t,n){const o="string"==typeof t?[t]:t;return be(fe(e).map(e=>be(o.map(t=>e[n](t)))))}(e,t,"getAttribute")}const ye=new Map,Oe=()=>Ee||(ge(Ee=me("style[riot]")[0]||document.createElement("style"),"type","text/css"),Ee.parentNode||document.head.appendChild(Ee),Ee);var Ee,Te={CSS_BY_NAME:ye,add(e,t){return ye.has(e)||(ye.set(e,t),this.inject()),this},inject(){return Oe().innerHTML=[...ye.values()].join("\n"),this},remove(e){return ye.has(e)&&(ye.delete(e),this.inject()),this}};function xe(e){return ve(e,"is")||e.tagName.toLowerCase()}const _e=Object.freeze({$(e){return me(e,this.root)[0]},$$(e){return me(e,this.root)}}),Ne=Object.freeze({[i]:m,[a]:m,[u]:m}),je=Object.freeze({shouldUpdate:m,onBeforeMount:m,onMounted:m,onBeforeUpdate:m,onUpdated:m,onBeforeUnmount:m,onUnmounted:m}),Ae=Object.assign({},Ne,{clone:m,createDOM:m});function ke(e){return[i,a,u].reduce((t,n)=>(t[n]=e(n),t),{})}function Ce(e){let{css:t,template:n,exports:s,name:r}=e;const i=n?function(e,t){return e(ae,O,y,e=>t[e]||o.get(e))}(n,s?function(e){void 0===e&&(e={});return Object.entries(b(e)).reduce((e,t)=>{let[n,o]=t;var s;return e[(s=n,s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Ce(o),e},{})}(s.components):{}):Ae;return e=>{let{slots:o,attributes:a,props:u}=e;if(s&&s[c])return function(e,t){let{slots:n,attributes:o,props:s,css:r,template:i}=t;i&&de("Pure components can not have html"),r&&de("Pure components do not have css");const a=le(e({slots:n,attributes:o,props:s}),Ne);return ke(e=>function(){return a[e](...arguments),a})}(s,{slots:o,attributes:a,props:u,css:t,template:n});const l=b(s)||{},p=Me({css:t,template:i,componentAPI:l,name:r})({slots:o,attributes:a,props:u});return{mount:(e,t,n)=>p.mount(e,n,t),update:(e,t)=>p.update(t,e),unmount:e=>p.unmount(e)}}}function Me(e){let{css:t,template:n,componentAPI:o,name:s}=e;return t&&s&&Te.add(s,t),function e(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),s=1;st(e)||e,e)}(ce(Object.create(e),{mount(t,r,a){return void 0===r&&(r={}),this[p]=function(e,t){void 0===t&&(t=[]);const n=t.map(t=>W(e,t)),o={};return Object.assign(o,Object.assign({expressions:n},ke(e=>t=>(n.forEach(n=>n[e](t)),o))))}(t,o).mount(a),ue(this,"props",Object.freeze(Object.assign({},i,{},he(this[p].expressions)))),this.state=we(this.state,r),this[d]=this.template.createDOM(t).clone(),t[s]=this,e.name&&function(e,t){xe(e)!==t&&ge(e,"is",t)}(t,e.name),ue(this,"root",t),ue(this,"slots",n),this.onBeforeMount(this.props,this.state),this[d].mount(t,this,a),this[l]=a,this.onMounted(this.props,this.state),this},update(e,t){void 0===e&&(e={}),t&&this[p].update(t);const n=he(this[p].expressions);if(!1!==this.shouldUpdate(n,this.props))return ue(this,"props",Object.freeze(Object.assign({},i,{},n))),this.state=we(this.state,e),this.onBeforeUpdate(this.props,this.state),this[d].update(this,this[l]),this.onUpdated(this.props,this.state),this},unmount(e){return this.onBeforeUnmount(this.props,this.state),this[p].unmount(),this[d].unmount(this,this[l],null===e?null:!e),this.onUnmounted(this.props,this.state),this}})),Object.keys(e).filter(t=>f(e[t])).forEach(e=>{a[e]=a[e].bind(a)}),a;var a}const{DOM_COMPONENT_INSTANCE_PROPERTY:Se,COMPONENTS_IMPLEMENTATION_MAP:Ue,PLUGINS_SET:De}=h;function Be(e,t){return void 0===t&&(t=[]),Object.assign({},function(e){return Array.from(e.attributes).reduce((e,t)=>(e[pe(t.name)]=t.value,e),{})}(e),{},b(t))}function Re(e,t){let{css:n,template:o,exports:s}=t;return Ue.has(e)&&de(`The component "${e}" was already registered`),Ue.set(e,Ce({name:e,css:n,template:o,exports:s})),Ue}function Pe(e,t,n){return me(e).map(e=>function(e,t,n){const s=n||xe(e);return o.has(s)||de(`The component named "${s}" was never registered`),o.get(s)({props:t}).mount(e)}(e,Be(e,t),n))}var Le=n(0),Ye=n.n(Le),Ke={css:null,exports:{state:{options:{messages:{open:"Open"}}},handleOpen(e){e.preventDefault(),window.dispatchEvent(new window.CustomEvent("tiny-consent-open"))}},template:function(e,t,n,o){return e('',[{redundantAttribute:"expr0",selector:"[expr0]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.messages.open].join("")}},{type:t.EVENT,name:"onclick",evaluate:function(e){return e.handleOpen}}]}])},name:"tiny-consent-button"};Re("tiny-consent",{css:null,exports:{state:{options:{cookie_name:"tiny_consent",messages:{session:"LALAL",content:"TTATA",yes:"Yes",no:"No",ok:"Ok",close:"Close"}},isOpen:!1,hasChanged:!1},getData(){let e=Ye.a.getJSON(this.state.options.cookie_name);return e||(e={}),e},getAgreeClasses(e){let t=["button","button--agree","tiny-consent__button"];return!0===this.getData()[e.id]&&t.push("button--active"),t.join(" ")},getRejectClasses(e){let t=["button","button--reject","tiny-consent__button"];return!1===this.getData()[e.id]&&t.push("button--active"),t.join(" ")},isOk(){let e=this.getData(),t=!0;return this.props.cookies.forEach(n=>{!0!==e[n.id]&&!0===n.essential&&(t=!1)}),t},onMounted(){window.addEventListener("tiny-consent-open",()=>{this.state.isOpen=!0,this.state.hasChanged=!1,this.update()})},onBeforeMount(){const e=this.getData();this.props.options&&(this.state.options=Object.assign(this.state.options,this.props.options)),this.props.cookies.sort((function(e,t){return!0!==e.essential})),0===Object.entries(e).length&&(this.state.hasChanged=!0,this.state.isOpen=!0),this.props.cookies.forEach((t,n)=>{!0===e[t.id]||!1===e[t.id]?(!0===e[t.id]&&t.handleAgree?t.handleAgree():!1===e[t.id]&&t.handleReject&&t.handleReject(),this.props.cookies[n].hasConsent=!0):(this.state.hasChanged=!0,this.state.isOpen=!0,this.props.cookies[n].hasConsent=!1)}),this.updateEssential()},onBeforeUpdate(){if(!0===this.state.hasChanged){let e=!0;this.props.cookies.forEach(t=>{!0!==t.hasConsent&&(e=!1)}),!0===e&&(this.state.isOpen=!1)}},updateEssential(){for(let e=this.props.cookies.length-1;e>=0;e--)if(console.log(this.props.cookies[e]),!0===this.state.hasChanged&&!1===this.props.cookies[e].hasConsent&&!0===this.props.cookies[e].essential||!1===this.state.hasChanged&&!0===this.props.cookies[e].essential){this.props.cookies[e].essentialLast=!0;break}},handleAgree(e,t,n){e.preventDefault();let o=this.getData();t.handleAgree&&t.handleAgree(),o[t.id]=!0,Ye.a.set(this.state.options.cookie_name,o),this.props.cookies[n].hasConsent=!0,this.update()},handleReject(e,t,n){e.preventDefault();let o=this.getData();t.handleReject&&t.handleReject(),o[t.id]=!1,Ye.a.set(this.state.options.cookie_name,o),this.props.cookies[n].hasConsent=!0,this.update()},handleOk(e){e.preventDefault();let t=this.getData();this.props.cookies.forEach((e,n)=>{!0===e.essential&&(t[e.id]=!0,this.props.cookies[n].hasConsent=!0)}),Ye.a.set(this.state.options.cookie_name,t),this.updateEssential(),this.update()},handleClose(e){e.preventDefault(),this.state.isOpen=!1,this.update()}},template:function(e,t,n,o){return e('',[{redundantAttribute:"expr1",selector:"[expr1]",expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return!0===e.state.isOpen?"tiny-consent__content show":"tiny-consent__content"}}]},{redundantAttribute:"expr2",selector:"[expr2]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.messages.content].join("")}}]},{type:n.EACH,getKey:null,condition:null,template:e('',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.state.hasChanged&&!0===e.cookie.hasConsent?"tiny-consent__cookie":"tiny-consent__cookie show"}}]},{redundantAttribute:"expr4",selector:"[expr4]",expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.content].join("")}}]},{type:n.IF,evaluate:function(e){return e.cookie.title},redundantAttribute:"expr5",selector:"[expr5]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.cookie.title," -"].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie.title"}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.name},redundantAttribute:"expr6",selector:"[expr6]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.cookie.name].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-name"}}]}])},{type:n.IF,evaluate:function(e){return!e.cookie.essential},redundantAttribute:"expr7",selector:"[expr7]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.messages.yes].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.getAgreeClasses(e.cookie)}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleAgree(t,e.cookie,e.index)}}}]}])},{type:n.IF,evaluate:function(e){return!e.cookie.essential},redundantAttribute:"expr8",selector:"[expr8]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.messages.no].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.getRejectClasses(e.cookie)}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleReject(t,e.cookie,e.index)}}}]}])},{type:n.IF,evaluate:function(e){return!0===e.cookie.essentialLast},redundantAttribute:"expr9",selector:"[expr9]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.messages.ok].join("")}},{type:t.ATTRIBUTE,name:"disabled",evaluate:function(e){return e.isOk()}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"button button--ok tiny-consent__button"}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleOk(t,e.cookies)}}}]}])}]),redundantAttribute:"expr3",selector:"[expr3]",itemName:"cookie",indexName:"index",evaluate:function(e){return e.props.cookies}},{type:n.IF,evaluate:function(e){return!1===e.state.hasChanged},redundantAttribute:"expr10",selector:"[expr10]",template:e('',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__close"}}]},{redundantAttribute:"expr11",selector:"[expr11]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.messages.close].join("")}},{type:t.EVENT,name:"onclick",evaluate:function(e){return e.handleClose}}]}])}])},name:"tiny-consent"}),Re("tiny-consent-button",Ke),Pe("tiny-consent",{cookies:[{title:"Matomo",name:"matamo_",id:"matamo",content:"",handleAgree:function(){console.log("agree")},handleReject:function(){console.log("reject")}},{id:"wordpress",name:"wordpress_",content:"Wordpress und WooCommerce nutzen Session, diese werden zum einen für den Login genutzt, aber auch für den Warenkorb.",essential:!0}]}),Pe("tiny-consent-button")},function(e,t){}]); \ No newline at end of file +!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=1)}([function(e,t,n){var o,r;!function(s){if(void 0===(r="function"==typeof(o=s)?o.call(t,n,t,e):o)||(e.exports=r),!0,e.exports=s(),!!0){var i=window.Cookies,a=window.Cookies=s();a.noConflict=function(){return window.Cookies=i,a}}}((function(){function e(){for(var e=0,t={};e{const i="selectedIndex"in t;let a=i;for(;oe==t,T=e=>e,N=(e,t,n,o,r,s,i)=>{const a=s-r;if(a<1)return-1;for(;n-t>=a;){let a=t,u=r;for(;an{for(;n{let o=1,r=t;for(;o>>0;n{((e,t,n,o,r,s,i,a,u)=>{const c=[],l=e.length;let p=i,d=0;for(;d{const a=n+s,u=[];let c,l,p,d,h,f,m;e:for(c=0;c<=a;c++){if(c>50)return null;for(m=c-1,h=c?u[c-1]:[0,0],f=u[c]=[],l=-c;l<=c;l+=2){for(d=l===-c||l!==c&&h[m+l-1]=0;c--){for(;d>0&&p>0&&i(o[r+d-1],e[t+p-1]);)b[v--]=0,d--,p--;if(!c)break;m=c-1,h=c?u[c-1]:[0,0],l=d-p,l===-c||l!==c&&h[m+l-1]{let u=0,c=oi;)--u;c=a+o-u;const h=Array(c);let f=l[u];for(--n;f;){const{newi:e,oldi:t}=f;for(;n>e;)h[--c]=1,--n;for(;i>t;)h[--c]=-1,--i;h[--c]=0,--n,--i,f=f.prev}for(;n>=t;)h[--c]=1,--n;for(;i>=s;)h[--c]=-1,--i;return h})(n,o,r,s,i,a,u,c),e,t,n,o,i,a,l,d)},w=e=>(e.remove||M).call(e);function M(){const{parentNode:e}=this;e&&e.removeChild(this)}function I(e,t){return typeof e===t}function S(e){const t=e.ownerSVGElement;return!!t||null===t}function U(e){return!P(e.content)}function D(e){return I(e,"function")}function B(e){return!P(e)&&I(e,"object")}function P(e){return null==e}const R=Symbol("unmount"),Y=Object.seal({nodes:[],mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:n,nodes:o,childrenMap:r}=this,s=e===R?null:this.evaluate(e),i=s?Array.from(s):[],a=n.parentNode,{newChildrenMap:u,batches:c,futureNodes:l}=function(e,t,n,o){const{condition:r,template:s,childrenMap:i,itemName:a,getKey:u,indexName:c,root:l,isTemplateTag:p}=o,d=new Map,h=[],f=[];return e.forEach((e,o)=>{const m=function(e,t){let{itemName:n,indexName:o,index:r,item:s}=t;e[n]=s,o&&(e[o]=r);return e}(Object.create(t),{itemName:a,indexName:c,index:o,item:e}),b=u?u(m):o,v=i.get(b);if(function(e,t){return!!e&&!1===Boolean(e(t))}(r,m))return;const x=v?v.template:s.clone(),g=v?x.el:l.cloneNode(),y=!v,O=p&&y?function(e){const t=e.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:t,children:Array.from(t.childNodes)}}(x):{};if(y?h.push(()=>x.mount(g,m,n,O)):h.push(()=>x.update(m,n)),p){const e=O.children||x.children;f.push(...e),e.forEach(e=>d.set(e,null))}else f.push(g);i.delete(b),d.set(b,{template:x,context:m,index:o})}),{newChildrenMap:d,batches:h,futureNodes:f}}(i,e,t,this);return((e,t,n,o)=>{o||(o={});const r=o.compare||E,s=o.node||T,i=null==o.before?null:s(o.before,0),a=t.length;let u=a,c=0,l=n.length,p=0;for(;c{for(;oe()),this.childrenMap=u,this.nodes=l,this},unmount(e,t){return this.update(R,t),this}});function L(e,t){return(n,o)=>{if(o<0){const n=e.pop();if(n){const{template:e,context:o}=n;e.unmount(o,t,null)}}return n}}const K=Object.seal({mount(e,t){return this.update(e,t)},update(e,t){const n=!!this.evaluate(e),o=!this.value&&n,r=this.value&&!n,s=()=>{const n=this.node.cloneNode();this.placeholder.parentNode.insertBefore(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,e,t)};switch(!0){case o:s();break;case r:this.unmount(e);break;default:n&&this.template.update(e,t)}return this.value=n,this},unmount(e,t){return this.template.unmount(e,t,!0),this}});const X="undefined"==typeof Element?{}:Element.prototype,F=function(e){const t=new Map,n=n=>t.has(n)?t.get(n):t.set(n,e.call(this,n))&&t.get(n);return n.cache=t,n}(e=>X.hasOwnProperty(e));function V(e,t,n,o){let{name:r}=t;r?(!F(r)&&(function(e){return I(e,"boolean")}(n)||B(n)||D(n))&&(e[r]=n),e[function(e){return P(e)||!1===e||""===e||B(e)||D(e)?"removeAttribute":"setAttribute"}(n)](r,function(e,t){return!0===t?e:t}(r,n))):n?function(e,t){Object.entries(t).forEach(t=>{let[n,o]=t;return V(e,{name:n},o)})}(e,n):o&&function(e,t){Object.keys(t).forEach(t=>e.removeAttribute(t))}(e,o)}const H=/^on/;function W(e){return P(e)?"":e}const $=(e,t)=>{const n=e.childNodes[t];if(n.nodeType===Node.COMMENT_NODE){const t=document.createTextNode("");return e.replaceChild(t,n),t}return n};var z={0:V,1:function(e,t,n,o){let{name:r}=t;const s=r.replace(H,"");o&&e.removeEventListener(s,o),n&&e.addEventListener(s,n,!1)},2:function(e,t,n){e.data=W(n)},3:function(e,t,n){e.value=W(n)}};const G=Object.seal({mount(e){return this.value=this.evaluate(e),J(this,this.value),this},update(e){const t=this.evaluate(e);return this.value!==t&&(J(this,t),this.value=t),this},unmount(){return 1===this.type&&J(this,null),this}});function J(e,t){return z[e.type](e.node,e,t,e.value)}function q(e,t){return Object.assign({},G,{},t,{node:2===t.type?$(e,t.childNodeIndex):e})}function Z(e,t,n){if(!e||!e.length)return n;const o=e.map(e=>Object.assign({},e,{value:e.evaluate(t)}));return Object.assign(Object.create(n||null),function(e){return e.reduce((e,t)=>{const{value:n,type:o}=t;switch(!0){case!t.name&&0===o:return Object.assign({},e,{},n);case 3===o:e.value=t.value;break;default:e[(r=t.name,r.replace(/-(\w)/g,(e,t)=>t.toUpperCase()))]=t.value}var r;return e},{})}(o))}const Q=Object.seal({attributes:[],getTemplateScope(e,t){return Z(this.attributes,e,t)},mount(e,t){const n=!!e.slots&&e.slots.find(e=>{let{id:t}=e;return t===this.name}),{parentNode:o}=this.node;return this.template=n&&ae(n.html,n.bindings).createDOM(o),this.template&&(this.template.mount(this.node,this.getTemplateScope(e,t)),this.template.children=function e(t,n){void 0===n&&(n=[]);const o=t.firstChild;if(o)return t.parentNode.insertBefore(o,t),[o,...e(t)];return n}(this.node)),x(this.node),this},update(e,t){return this.template&&this.template.update(this.getTemplateScope(e,t)),this},unmount(e,t,n){return this.template&&this.template.unmount(this.getTemplateScope(e,t),null,n),this}});function ee(e){return e.reduce((e,t)=>{let{bindings:n}=t;return e.concat(n)},[])}const te=Object.seal({mount(e){return this.update(e)},update(e,t){const n=this.evaluate(e);return n===this.name?this.tag.update(e):(this.unmount(e,t,!0),this.name=n,this.tag=function(e,t,n){return void 0===t&&(t=[]),void 0===n&&(n=[]),e?e({slots:t,attributes:n}):ae(function(e){return e.reduce((e,t)=>e+t.html,"")}(t),[...ee(t),{expressions:n.map(e=>Object.assign({type:0},e))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,e)),this},unmount(e,t,n){return this.tag&&this.tag.unmount(n),this}});var ne={1:function(e,t){let{evaluate:n,template:o}=t;const r=e.parentNode,s=document.createTextNode("");return r.insertBefore(s,e),x(e),Object.assign({},K,{node:e,evaluate:n,placeholder:s,template:o.createDOM(e)})},2:function(e,t){let{expressions:n}=t;return Object.assign({},(o=n.map(t=>q(e,t)),["mount","update","unmount"].reduce((e,t)=>Object.assign({},e,{[t]:e=>o.map(n=>n[t](e))&&r}),{})));var o,r},0:function(e,t){let{evaluate:n,condition:o,itemName:r,indexName:s,getKey:i,template:a}=t;const u=document.createTextNode(""),c=e.parentNode,l=e.cloneNode();return c.insertBefore(u,e),x(e),Object.assign({},Y,{childrenMap:new Map,node:e,root:l,condition:o,evaluate:n,isTemplateTag:U(l),template:a.createDOM(e),getKey:i,indexName:s,itemName:r,placeholder:u})},3:function(e,t){let{evaluate:n,getComponent:o,slots:r,attributes:s}=t;return Object.assign({},te,{node:e,evaluate:n,slots:r,attributes:s,getComponent:o})},4:function(e,t){let{name:n,attributes:o}=t;return Object.assign({},Q,{attributes:o,node:e,name:n})}};function oe(e,t){return e.map(e=>2===e.type?Object.assign({},e,{childNodeIndex:e.childNodeIndex+t}):e)}function re(e,t){return S(e)?function(e,t){return t.ownerDocument.importNode((new window.DOMParser).parseFromString(`${e}`,"application/xml").documentElement,!0)}(t,e):function(e,t){const n=U(t)?t:document.createElement("template");return n.innerHTML=e,n.content}(t,e)}function se(e,t){switch(!0){case S(e):!function e(t,n){t.firstChild&&(n.appendChild(t.firstChild),e(t,n))}(t,e);break;case U(e):e.parentNode.replaceChild(t,e);break;default:e.appendChild(t)}}const ie=Object.freeze({createDOM(e){return this.dom=this.dom||function(e,t){return t&&("string"==typeof t?re(e,t):t)}(e,this.html),this},mount(e,t,n,o){if(void 0===o&&(o={}),!e)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(t);const{fragment:r,children:s,avoidDOMInjection:i}=o,{parentNode:a}=s?s[0]:e,u=U(e),c=u?Math.max(Array.from(a.children).indexOf(e),0):null;return this.isTemplateTag=u,this.createDOM(e),this.dom&&(this.fragment=r||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?a:e,this.children=this.isTemplateTag?s||Array.from(this.fragment.childNodes):null,!i&&this.fragment&&se(e,this.fragment),this.bindings=this.bindingsData.map(e=>function(e,t,n){const{selector:o,type:r,redundantAttribute:s,expressions:i}=t,a=o?e.querySelector(o):e;s&&a.removeAttribute(s);const u=i||[];return(ne[r]||ne[2])(a,Object.assign({},t,{expressions:n&&!o?oe(u,n):u}))}(this.el,e,c)),this.bindings.forEach(e=>e.mount(t,n)),this},update(e,t){return this.bindings.forEach(n=>n.update(e,t)),this},unmount(e,t,n){if(this.el){switch(this.bindings.forEach(o=>o.unmount(e,t,n)),!0){case this.children&&null!==n:v(this.children);break;case!0===n:x(this.el);break;case null!==n:v(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function ae(e,t){return void 0===t&&(t=[]),Object.assign({},ie,{html:e,bindingsData:t})}function ue(e,t,n,o){return void 0===o&&(o={}),Object.defineProperty(e,t,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},o)),e}function ce(e,t,n){return Object.entries(t).forEach(t=>{let[o,r]=t;ue(e,o,r,n)}),e}function le(e,t){return Object.entries(t).forEach(t=>{let[n,o]=t;e[n]||(e[n]=o)}),e}function pe(e){return e.replace(/-(\w)/g,(e,t)=>t.toUpperCase())}function de(e){throw new Error(e)}function he(e){return e.reduce((e,t)=>{const{value:n,type:o}=t;switch(!0){case!t.name&&0===o:return Object.assign({},e,{},n);case 3===o:e.value=t.value;break;default:e[pe(t.name)]=t.value}return e},{})}function fe(e){return Array.isArray(e)?e:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&"number"==typeof e.length?Array.from(e):[e]}function me(e,t){return fe("string"==typeof e?(t||document).querySelectorAll(e):e)}const be=e=>1===e.length?e[0]:e;function ve(e,t,n){const o="object"==typeof t?t:{[t]:n},r=Object.keys(o);return fe(e).forEach(e=>{r.forEach(t=>e.setAttribute(t,o[t]))}),e}function xe(e,t){return function(e,t,n){const o="string"==typeof t?[t]:t;return be(fe(e).map(e=>be(o.map(t=>e[n](t)))))}(e,t,"getAttribute")}const ge=new Map,ye=()=>Oe||(ve(Oe=me("style[riot]")[0]||document.createElement("style"),"type","text/css"),Oe.parentNode||document.head.appendChild(Oe),Oe);var Oe,_e={CSS_BY_NAME:ge,add(e,t){return ge.has(e)||(ge.set(e,t),this.inject()),this},inject(){return ye().innerHTML=[...ge.values()].join("\n"),this},remove(e){return ge.has(e)&&(ge.delete(e),this.inject()),this}};function Ee(e){return xe(e,"is")||e.tagName.toLowerCase()}const Te=Object.freeze({$(e){return me(e,this.root)[0]},$$(e){return me(e,this.root)}}),Ne=Object.freeze({[i]:m,[a]:m,[u]:m}),ke=Object.freeze({shouldUpdate:m,onBeforeMount:m,onMounted:m,onBeforeUpdate:m,onUpdated:m,onBeforeUnmount:m,onUnmounted:m}),je=Object.assign({},Ne,{clone:m,createDOM:m});function Ae(e){return[i,a,u].reduce((t,n)=>(t[n]=e(n),t),{})}function Ce(e){let{css:t,template:n,exports:r,name:s}=e;const i=n?function(e,t){return e(ae,y,g,e=>t[e]||o.get(e))}(n,r?function(e){void 0===e&&(e={});return Object.entries(b(e)).reduce((e,t)=>{let[n,o]=t;var r;return e[(r=n,r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Ce(o),e},{})}(r.components):{}):je;return e=>{let{slots:o,attributes:a,props:u}=e;if(r&&r[c])return function(e,t){let{slots:n,attributes:o,props:r,css:s,template:i}=t;i&&de("Pure components can not have html"),s&&de("Pure components do not have css");const a=le(e({slots:n,attributes:o,props:r}),Ne);return Ae(e=>function(){return a[e](...arguments),a})}(r,{slots:o,attributes:a,props:u,css:t,template:n});const l=b(r)||{},p=we({css:t,template:i,componentAPI:l,name:s})({slots:o,attributes:a,props:u});return{mount:(e,t,n)=>p.mount(e,n,t),update:(e,t)=>p.update(t,e),unmount:e=>p.unmount(e)}}}function we(e){let{css:t,template:n,componentAPI:o,name:r}=e;return t&&r&&_e.add(r,t),function e(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;rt(e)||e,e)}(ce(Object.create(e),{mount(t,s,a){return void 0===s&&(s={}),this[p]=function(e,t){void 0===t&&(t=[]);const n=t.map(t=>q(e,t)),o={};return Object.assign(o,Object.assign({expressions:n},Ae(e=>t=>(n.forEach(n=>n[e](t)),o))))}(t,o).mount(a),ue(this,"props",Object.freeze(Object.assign({},i,{},he(this[p].expressions)))),this.state=Me(this.state,s),this[d]=this.template.createDOM(t).clone(),t[r]=this,e.name&&function(e,t){Ee(e)!==t&&ve(e,"is",t)}(t,e.name),ue(this,"root",t),ue(this,"slots",n),this.onBeforeMount(this.props,this.state),this[d].mount(t,this,a),this[l]=a,this.onMounted(this.props,this.state),this},update(e,t){void 0===e&&(e={}),t&&this[p].update(t);const n=he(this[p].expressions);if(!1!==this.shouldUpdate(n,this.props))return ue(this,"props",Object.freeze(Object.assign({},i,{},n))),this.state=Me(this.state,e),this.onBeforeUpdate(this.props,this.state),this[d].update(this,this[l]),this.onUpdated(this.props,this.state),this},unmount(e){return this.onBeforeUnmount(this.props,this.state),this[p].unmount(),this[d].unmount(this,this[l],null===e?null:!e),this.onUnmounted(this.props,this.state),this}})),Object.keys(e).filter(t=>f(e[t])).forEach(e=>{a[e]=a[e].bind(a)}),a;var a}const{DOM_COMPONENT_INSTANCE_PROPERTY:Se,COMPONENTS_IMPLEMENTATION_MAP:Ue,PLUGINS_SET:De}=h;function Be(e,t){return void 0===t&&(t=[]),Object.assign({},function(e){return Array.from(e.attributes).reduce((e,t)=>(e[pe(t.name)]=t.value,e),{})}(e),{},b(t))}function Pe(e,t){let{css:n,template:o,exports:r}=t;return Ue.has(e)&&de(`The component "${e}" was already registered`),Ue.set(e,Ce({name:e,css:n,template:o,exports:r})),Ue}function Re(e,t,n){return me(e).map(e=>function(e,t,n){const r=n||Ee(e);return o.has(r)||de(`The component named "${r}" was never registered`),o.get(r)({props:t}).mount(e)}(e,Be(e,t),n))}var Ye=n(0),Le=n.n(Ye),Ke={css:null,exports:{state:{options:{messages:{open:"Open"}}},handleOpen(e){e.preventDefault(),window.dispatchEvent(new window.CustomEvent("tiny-consent-open"))}},template:function(e,t,n,o){return e('',[{redundantAttribute:"expr0",selector:"[expr0]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.messages.open].join("")}},{type:t.EVENT,name:"onclick",evaluate:function(e){return e.handleOpen}}]}])},name:"tiny-consent-button"};Pe("tiny-consent",{css:null,exports:{state:{options:{cookie_name:"tiny_consent",text:{title:"Cookies",content:"We are using Cookies and display that was we use, also there are cookies you can accept or reject",button__agree:"Yes",button__reject:"No",button__ok:"Ok",button__close:"Close",footer__name:"Cookie Name",footer__provider:"Provider",footer__duration:"Cookie Duration"}},isOpen:!1,hasChanged:!1},getData(){let e=Le.a.getJSON(this.state.options.cookie_name);return e||(e={}),e},getAgreeClasses(e){let t=["button","button--agree","tiny-consent__button"];return!0===this.getData()[e.id]&&t.push("button--active"),t.join(" ")},getRejectClasses(e){let t=["button","button--reject","tiny-consent__button"];return!1===this.getData()[e.id]&&t.push("button--active"),t.join(" ")},isOk(){let e=this.getData(),t=!0;return this.props.cookies.forEach(n=>{!0!==e[n.id]&&!0===n.essential&&(t=!1)}),t},onMounted(){window.addEventListener("tiny-consent-open",()=>{this.state.isOpen=!0,this.state.hasChanged=!1,this.update()})},onBeforeMount(){const e=this.getData();this.props.options&&(this.state.options=Object.assign(this.state.options,this.props.options)),this.props.cookies.sort((function(e,t){return!0!==e.essential})),0===Object.entries(e).length&&(this.state.hasChanged=!0,this.state.isOpen=!0),this.props.cookies.forEach((t,n)=>{!0===e[t.id]||!1===e[t.id]?(!0===e[t.id]&&t.handleAgree?t.handleAgree():!1===e[t.id]&&t.handleReject&&t.handleReject(),this.props.cookies[n].hasConsent=!0):(this.state.hasChanged=!0,this.state.isOpen=!0,this.props.cookies[n].hasConsent=!1)}),this.updateEssential()},onBeforeUpdate(){if(!0===this.state.hasChanged){let e=!0;this.props.cookies.forEach(t=>{!0!==t.hasConsent&&(e=!1)}),!0===e&&(this.state.isOpen=!1)}},updateEssential(){for(let e=this.props.cookies.length-1;e>=0;e--)if(!0===this.state.hasChanged&&!1===this.props.cookies[e].hasConsent&&!0===this.props.cookies[e].essential||!1===this.state.hasChanged&&!0===this.props.cookies[e].essential){this.props.cookies[e].essentialLast=!0;break}},handleAgree(e,t,n){e.preventDefault();let o=this.getData();t.handleAgree&&t.handleAgree(),o[t.id]=!0,Le.a.set(this.state.options.cookie_name,o),this.props.cookies[n].hasConsent=!0,this.update()},handleReject(e,t,n){e.preventDefault();let o=this.getData();t.handleReject&&t.handleReject(),o[t.id]=!1,Le.a.set(this.state.options.cookie_name,o),this.props.cookies[n].hasConsent=!0,this.update()},handleOk(e){e.preventDefault();let t=this.getData();this.props.cookies.forEach((e,n)=>{!0===e.essential&&(t[e.id]=!0,this.props.cookies[n].hasConsent=!0)}),Le.a.set(this.state.options.cookie_name,t),this.updateEssential(),this.update()},handleClose(e){e.preventDefault(),this.state.isOpen=!1,this.update()}},template:function(e,t,n,o){return e('',[{redundantAttribute:"expr1",selector:"[expr1]",expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return!0===e.state.isOpen?"tiny-consent show":"tiny-consent"}}]},{redundantAttribute:"expr2",selector:"[expr2]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.title].join("")}}]},{redundantAttribute:"expr3",selector:"[expr3]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.content].join("")}}]},{redundantAttribute:"expr4",selector:"[expr4]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__close].join("")}},{type:t.EVENT,name:"onclick",evaluate:function(e){return e.handleClose}}]},{type:n.EACH,getKey:null,condition:null,template:e('',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.state.hasChanged&&!0===e.cookie.hasConsent?"tiny-consent__cookie":"tiny-consent__cookie show"}}]},{redundantAttribute:"expr6",selector:"[expr6]",expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.content].join("")}}]},{type:n.IF,evaluate:function(e){return e.cookie.title},redundantAttribute:"expr7",selector:"[expr7]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.cookie.title}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-title"}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.provider},redundantAttribute:"expr8",selector:"[expr8]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.provider].join("")}}]},{redundantAttribute:"expr9",selector:"[expr9]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__provider}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.name},redundantAttribute:"expr10",selector:"[expr10]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.name].join("")}}]},{redundantAttribute:"expr11",selector:"[expr11]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__name}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.duration},redundantAttribute:"expr12",selector:"[expr12]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.duration].join("")}}]},{redundantAttribute:"expr13",selector:"[expr13]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__duration}}]}])},{type:n.IF,evaluate:function(e){return!e.cookie.essential},redundantAttribute:"expr14",selector:"[expr14]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__agree].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.getAgreeClasses(e.cookie)}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleAgree(t,e.cookie,e.index)}}}]}])},{type:n.IF,evaluate:function(e){return!e.cookie.essential},redundantAttribute:"expr15",selector:"[expr15]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__reject].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.getRejectClasses(e.cookie)}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleReject(t,e.cookie,e.index)}}}]}])},{type:n.IF,evaluate:function(e){return!0===e.cookie.essentialLast},redundantAttribute:"expr16",selector:"[expr16]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__ok].join("")}},{type:t.ATTRIBUTE,name:"disabled",evaluate:function(e){return e.isOk()}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"button button--ok tiny-consent__button"}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleOk(t,e.cookies)}}}]}])}]),redundantAttribute:"expr5",selector:"[expr5]",itemName:"cookie",indexName:"index",evaluate:function(e){return e.props.cookies}}])},name:"tiny-consent"}),Pe("tiny-consent-button",Ke),Re("tiny-consent",{cookies:[{title:"Matomo",name:"matamo_",id:"matamo",content:"Cookie from Matamo for Website-Analytics. Creates statiscial Data how the User uses this Website",provider:"Tentakelfabrik.de",duration:"1 Year",privacy_policy:"http://this",handleAgree:function(){console.log("agree")},handleReject:function(){console.log("reject")}},{title:"Tiny Consent",id:"tiny_consent",name:"tiny_consent",content:"Saves the Settings of Cookies from Tiny Consent",provider:"Owner of this Site",duration:"1 Year",essential:!0},{title:"Wordpress",id:"wordpress",name:"wordpress_",content:"Wordpress is using Session Cookie to handle the Login",provider:"Owner of this Site",duration:"1 Year",essential:!0},{title:"Wordpress - WooCommerce",id:"wordpress",name:"wordpress_",content:"WooCommerce is a Shop-Plugin for Wordpress. Cookies will be used for the Cart",provider:"Owner of this Site",duration:"1 Year",essential:!0}]}),Re("tiny-consent-button")},function(e,t){}]); \ No newline at end of file diff --git a/src/TinyConsent.riot b/src/TinyConsent.riot index 09965b4..78152b8 100644 --- a/src/TinyConsent.riot +++ b/src/TinyConsent.riot @@ -1,41 +1,50 @@ -