@modernconsent/widget 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -0
- package/dist/consent.js +413 -0
- package/dist/consent.js.map +1 -0
- package/package.json +6 -12
- package/dist/index.d.ts +0 -39
- package/dist/index.js +0 -761
- package/dist/index.js.map +0 -1
- package/dist/mc-widget.js +0 -413
- package/dist/mc-widget.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# @modernconsent/widget
|
|
2
|
+
|
|
3
|
+
Standalone Web Component consent banner and preferences panel. Includes the full [ModernConsent](https://github.com/kschnekenburger/modern-consent) core — just drop a `<script>` tag and you're done.
|
|
4
|
+
|
|
5
|
+
- **~30 KB** standalone bundle (~8 KB gzip)
|
|
6
|
+
- **Shadow DOM** — styles never leak, never broken by your CSS
|
|
7
|
+
- **i18n** built-in (fr/en) with slot overrides
|
|
8
|
+
- **Themeable** via CSS custom properties
|
|
9
|
+
- **ES2017** target — works in Chrome 63+, Firefox 58+, Safari 11.1+
|
|
10
|
+
- **adoptedStyleSheets** with automatic `<style>` fallback for older browsers
|
|
11
|
+
|
|
12
|
+
## Install (CDN)
|
|
13
|
+
|
|
14
|
+
```html
|
|
15
|
+
<!-- 1. Config + vendors (before the script) -->
|
|
16
|
+
<script>
|
|
17
|
+
window.mcLayer = window.mcLayer || [];
|
|
18
|
+
window.modernConsent = function () {
|
|
19
|
+
window.mcLayer.push(arguments);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
window.modernConsent('config', {
|
|
23
|
+
cookieName: 'my_consent',
|
|
24
|
+
consentMode: true,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
window.modernConsent('vendor', {
|
|
28
|
+
name: 'google-analytics',
|
|
29
|
+
config: { measurementId: 'G-XXXXXXXXXX' },
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<!-- 2. Load the standalone bundle -->
|
|
34
|
+
<script src="https://unpkg.com/@modernconsent/widget/dist/consent.js" defer></script>
|
|
35
|
+
|
|
36
|
+
<!-- 3. Place the widget -->
|
|
37
|
+
<mc-consent-widget lang="fr" style="--mc-primary: #2563eb;"> </mc-consent-widget>
|
|
38
|
+
|
|
39
|
+
<!-- 4. Re-open preferences -->
|
|
40
|
+
<a href="javascript:void(0)" onclick="window.modernConsent.openPanel()"> Cookie settings </a>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> Also available on jsDelivr: `https://cdn.jsdelivr.net/npm/@modernconsent/widget/dist/consent.js`
|
|
44
|
+
|
|
45
|
+
## Slots
|
|
46
|
+
|
|
47
|
+
Customize the banner text via named slots. If omitted, built-in i18n defaults are used.
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<!-- With custom text -->
|
|
51
|
+
<mc-consent-widget lang="fr">
|
|
52
|
+
<span slot="title">We respect your privacy</span>
|
|
53
|
+
<span slot="body">This site uses cookies to improve your experience.</span>
|
|
54
|
+
</mc-consent-widget>
|
|
55
|
+
|
|
56
|
+
<!-- With defaults (uses built-in fr/en text) -->
|
|
57
|
+
<mc-consent-widget lang="fr"></mc-consent-widget>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| Slot | Default (fr) | Default (en) |
|
|
61
|
+
| ------- | -------------------------------- | ------------------------- |
|
|
62
|
+
| `title` | Nous respectons votre vie privée | We respect your privacy |
|
|
63
|
+
| `body` | Ce site utilise des cookies... | This site uses cookies... |
|
|
64
|
+
|
|
65
|
+
## Theming
|
|
66
|
+
|
|
67
|
+
Set CSS custom properties on `<mc-consent-widget>` or any ancestor — they pierce the Shadow DOM:
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<mc-consent-widget lang="fr" style="--mc-primary: #2563eb; --mc-radius: 16px;"></mc-consent-widget>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
| Variable | Default | Description |
|
|
74
|
+
| -------------------- | ---------------- | ---------------------------- |
|
|
75
|
+
| `--mc-primary` | `#111827` | Primary button background |
|
|
76
|
+
| `--mc-primary-hover` | auto | Primary hover (auto-derived) |
|
|
77
|
+
| `--mc-primary-text` | `#fff` | Primary button text |
|
|
78
|
+
| `--mc-radius` | `12px` | Modal border radius |
|
|
79
|
+
| `--mc-font` | `system-ui, ...` | Font family |
|
|
80
|
+
|
|
81
|
+
## Display Modes
|
|
82
|
+
|
|
83
|
+
### Vendor mode (default)
|
|
84
|
+
|
|
85
|
+
Individual toggle per vendor, grouped by category:
|
|
86
|
+
|
|
87
|
+
```javascript
|
|
88
|
+
window.modernConsent('config', { displayMode: 'vendor' });
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Purpose mode
|
|
92
|
+
|
|
93
|
+
Toggle per category/purpose (Didomi-style):
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
window.modernConsent('config', {
|
|
97
|
+
displayMode: 'purpose',
|
|
98
|
+
functionalPurpose: true, // mandatory "Site operation" block
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Languages
|
|
103
|
+
|
|
104
|
+
Set via the `lang` attribute. Ships with `fr` and `en`:
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<mc-consent-widget lang="en"></mc-consent-widget>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Browser Support
|
|
111
|
+
|
|
112
|
+
| Browser | Minimum version |
|
|
113
|
+
| ------- | --------------- |
|
|
114
|
+
| Chrome | 63+ |
|
|
115
|
+
| Firefox | 58+ |
|
|
116
|
+
| Safari | 11.1+ |
|
|
117
|
+
| Edge | 79+ |
|
|
118
|
+
|
|
119
|
+
> Safari < 16.4 uses a `<style>` fallback instead of `adoptedStyleSheets`. No visual difference.
|
|
120
|
+
|
|
121
|
+
## Related Packages
|
|
122
|
+
|
|
123
|
+
| Package | Description |
|
|
124
|
+
| -------------------------------------------------------------------------------- | ---------------------------------------- |
|
|
125
|
+
| [`@modernconsent/core`](https://www.npmjs.com/package/@modernconsent/core) | Consent engine (included in this bundle) |
|
|
126
|
+
| [`@modernconsent/vendors`](https://www.npmjs.com/package/@modernconsent/vendors) | 24 built-in vendor modules |
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT
|
package/dist/consent.js
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
"use strict";var ModernConsent=(()=>{var E=Object.defineProperty,pe=Object.defineProperties,ue=Object.getOwnPropertyDescriptor,fe=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols;var Z=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var P=(n,e,t)=>e in n?E(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,b=(n,e)=>{for(var t in e||(e={}))Z.call(e,t)&&P(n,t,e[t]);if(X)for(var t of X(e))me.call(e,t)&&P(n,t,e[t]);return n},D=(n,e)=>pe(n,fe(e));var ve=(n,e)=>{for(var t in e)E(n,t,{get:e[t],enumerable:!0})},ye=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ge(e))!Z.call(n,o)&&o!==t&&E(n,o,{get:()=>e[o],enumerable:!(s=ue(e,o))||s.enumerable});return n};var be=n=>ye(E({},"__esModule",{value:!0}),n);var p=(n,e,t)=>P(n,typeof e!="symbol"?e+"":e,t);var Ee={};ve(Ee,{McConsentWidget:()=>$});var w=class{constructor(e){p(this,"value");p(this,"subscribers",new Set);this.value=e}get(){return this.value}set(e){this.value!==e&&(this.value=e,this.notify())}update(e){this.set(e(this.value))}subscribe(e){return this.subscribers.add(e),e(this.value),()=>this.subscribers.delete(e)}notify(){this.subscribers.forEach(e=>e(this.value))}};function he(){let n=new Uint8Array(16);crypto.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;let e=Array.from(n,t=>t.toString(16).padStart(2,"0")).join("");return[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,20),e.slice(20)].join("-")}var M=()=>typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():he();var we="mc_consent_state";function Ce(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var xe=n=>{if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp(`(?:^|; )${Ce(n)}=([^;]*)`));return e?decodeURIComponent(e[1]):null},Se=(n,e,t={})=>{if(typeof document=="undefined")return;let{days:s=365,path:o="/",domain:r,sameSite:i="Lax",secure:a=!1}=t,d=new Date;d.setDate(d.getDate()+s);let g=`${n}=${encodeURIComponent(e)};expires=${d.toUTCString()};path=${o};SameSite=${i}`;if(r){let l=typeof window!="undefined"?window.location.hostname:"";l&&!l.endsWith(r.replace(/^\./,""))&&console.warn(`[modern-consent] cookieDomain "${r}" does not match current hostname "${l}". The cookie will be silently rejected by the browser. Remove cookieDomain for local development.`),g+=`;domain=${r}`}(a||i==="None")&&(g+=";Secure"),document.cookie=g},f=new w({}),m=new w(!1),y=new w([]),u=new w(!1),I=()=>u.set(!0),_=[],ee=n=>{let e=(n==null?void 0:n.cookieName)||we,t=n==null?void 0:n.cookieDomain,s=n==null?void 0:n.consentVersion,o={consent:{},answered:!1};if(typeof window!="undefined"){let r=xe(e);if(r)try{o=JSON.parse(r)}catch(i){console.error("[modern-consent] Error parsing consent cookie",i)}}if(f.set(o.consent||{}),m.set(o.answered||!1),o.answered&&s&&o.version!==s&&(m.set(!1),u.set(!0)),typeof window!="undefined"){_.forEach(i=>i()),_=[];let r=()=>{let i={consent:f.get(),answered:m.get(),timestamp:Date.now(),version:s,consentId:M()};Se(e,JSON.stringify(i),{domain:t,secure:window.location.protocol==="https:"})};_.push(f.subscribe(r)),_.push(m.subscribe(r))}};var A=[];function te(n){return A.push(n),()=>{let e=A.indexOf(n);e!==-1&&A.splice(e,1)}}function T(n){for(let e=A.length-1;e>=0;e--){let t=A[e](n);if(t)return t}}var O=new Map,k=new Map,z=new Map;function F(n){var r;let e=k.get(n);if(!(e!=null&&e.artifacts))return;let t=z.get(n),s=typeof e.artifacts=="function"?e.artifacts(t):e.artifacts,o=(r=window._modernConsentConfig)==null?void 0:r.cookieDomain;s.forEach(i=>{document.cookie=`${i}=; max-age=0; path=/`,o&&(document.cookie=`${i}=; max-age=0; path=/; domain=${o}`)})}function H(n){let{id:e,category:t,loader:s,config:o={}}=n;O.has(e)||(O.set(e,s),s().then(r=>{let i=r.default||r;if(k.set(e,i),o!==void 0&&z.set(e,o),i!=null&&i.setup)try{i.setup(o)}catch(a){console.error(`[modern-consent] setup() failed for "${e}":`,a)}i!=null&&i.link&&i.link.length>0&&i.link.forEach(a=>{var g;if(a.condition&&!a.condition({vendorConfig:o,consentConfig:window._modernConsentConfig}))return;let d=T(a.vendor);d?H({id:a.vendor,category:t,config:(g=a.config)!=null?g:{},loader:d}):console.warn(`[modern-consent] Dependency "${a.vendor}" not found for "${e}"`)}),y.update(a=>a.some(d=>d.id===e)?a:[...a,{id:e,name:i.name,description:i.description,category:i.category,purposeLabel:i.purposeLabel,purposeDescription:i.purposeDescription,loaded:!1,requireConsent:i.requireConsent}]),Ae(e)}).catch(r=>{console.error(`[modern-consent] Failed to load vendor "${e}":`,r)}))}function Ae(n){let e=k.get(n);if(e&&!e.requireConsent){L(n);return}let t=f.get();m.get()&&t[n]===void 0&&u.set(!0),t[n]&&L(n)}async function L(n){var r,i;if(typeof window=="undefined")return;let e=k.get(n);if(!e){let a=O.get(n);if(a){let d=await a();e=d.default||d,e&&k.set(n,e)}}if(!e)return;let t=((r=window._modernConsentConfig)==null?void 0:r.consentOnly)===!0,o=y.get().find(a=>a.id===n);!t&&e.init&&o&&!o.loaded&&(e.init(z.get(n)),y.update(a=>a.map(d=>d.id===n?D(b({},d),{loaded:!0}):d)),(i=e.event)==null||i.forEach(a=>{if(a.name==="onAccept")try{a.callback()}catch(d){}})),!t&&e.domSelector&&e.render&&setTimeout(()=>{document.querySelectorAll(e.domSelector).forEach(a=>{let d=a;d.dataset.loaded!=="true"&&(e!=null&&e.render)&&(d.innerHTML=e.render(d.dataset),d.dataset.loaded="true",d.classList.remove("mc-placeholder-pending"))})},50)}var q=class{constructor(){p(this,"listeners",new Map)}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>{var s;return(s=this.listeners.get(e))==null?void 0:s.delete(t)}}off(e,t){var s;(s=this.listeners.get(e))==null||s.delete(t)}emit(e,t){var s;(s=this.listeners.get(e))==null||s.forEach(o=>{try{o(t)}catch(r){}})}},h=new q;function U(n){var t;if(typeof window=="undefined")return;let e={event:"consent_update",consent_state:n};window.consentLayer=window.consentLayer||[],window.consentLayer.push(e),(t=window._modernConsentConfig)!=null&&t.pushDataLayer&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push(e))}function j(n){var e;h.emit("consent:saved",{consentId:M(),timestamp:Date.now(),version:typeof window!="undefined"?(e=window._modernConsentConfig)==null?void 0:e.consentVersion:void 0,consent:n})}function V(n,e){var o,r,i;let t=(r=(o=y.get().find(a=>a.id===n))==null?void 0:o.loaded)!=null?r:!1;f.update(a=>D(b({},a),{[n]:e})),m.set(!0),h.emit("consent:update",{vendor:n,status:e?"granted":"denied"});let s=f.get();if(U(s),j(s),e){L(n);return}t&&(F(n),!(typeof window!="undefined"&&((i=window._modernConsentConfig)==null?void 0:i.consentOnly)===!0)&&typeof window!="undefined"&&window.location.reload())}function N(){let n=y.get(),e={};n.forEach(t=>{e[t.id]=!0,L(t.id)}),f.set(e),m.set(!0),u.set(!1),n.forEach(t=>{h.emit("consent:update",{vendor:t.id,status:"granted"})}),U(e),j(e)}function K(){var o;let n=y.get(),e={},t=!1;n.forEach(r=>{e[r.id]=!1,F(r.id),r.loaded&&(t=!0)}),f.set(e),m.set(!0),u.set(!1),n.forEach(r=>{h.emit("consent:update",{vendor:r.id,status:"denied"})}),U(e),j(e);let s=typeof window!="undefined"&&((o=window._modernConsentConfig)==null?void 0:o.consentOnly)===!0;t&&!s&&typeof window!="undefined"&&window.location.reload()}var ne=["config","vendor"];function oe(n){let{name:e,label:t,description:s="",category:o="other",config:r={},requireConsent:i=!0,setup:a,init:d,artifacts:g}=n,l;if(d!=null?d:a)l=async()=>({name:t!=null?t:e,description:s,category:o,requireConsent:i,setup:a,init:d,artifacts:g});else{let v=T(e);if(!v){console.warn(`[modern-consent] Unknown vendor "${e}". Provide an init() function to define a custom vendor.`);return}l=v}H({id:e,category:o,config:r,loader:l})}function se(){if(typeof window=="undefined")return;let n=window,e=Array.isArray(n.mcLayer)?[...n.mcLayer]:[];n._modernConsentConfig={},te(s=>async()=>{var a,d;let o=(a=n._modernConsentConfig)==null?void 0:a.cdnBase;if(!o)throw new Error(`[modern-consent] Vendor "${s}" not found. Configure cdnBase to enable CDN loading, or provide an inline init().`);let i=await import(`${o.replace(/\/$/,"")}/${s}.js`);return(d=i.default)!=null?d:i}),e.forEach(s=>{let[o,r]=s;if(!ne.includes(o)){console.warn(`[modern-consent] "${o}" is not a valid command`);return}if(o==="config"){n._modernConsentConfig=b(b({},n._modernConsentConfig),r);return}oe(r)}),ee(n._modernConsentConfig);let t=(...s)=>{let[o,r]=s;if(!ne.includes(o)){console.warn(`[modern-consent] "${o}" is not a valid command`);return}o==="vendor"?oe(r):o==="config"&&(n._modernConsentConfig=b(b({},n._modernConsentConfig),r)),Array.isArray(n.mcLayer)||(n.mcLayer=[]),n.mcLayer.push(s)};n.modernConsent=Object.assign(t,{openPanel:()=>u.set(!0),getConsent:()=>f.get(),on:h.on.bind(h)})}typeof window!="undefined"&&se();var ie={fr:{bannerTitle:"Nous respectons votre vie priv\xE9e",bannerBody:"Ce site utilise des cookies pour am\xE9liorer votre exp\xE9rience, mesurer l\u2019audience et personnaliser les contenus. Votre choix sera conserv\xE9 et modifiable \xE0 tout moment.",bannerAcceptAll:"Tout accepter",bannerDenyAll:"Continuer sans accepter",bannerCustomize:"Personnaliser",detailsTitle:"Personnaliser vos pr\xE9f\xE9rences",detailsSubtitle:"Vous pouvez activer ou d\xE9sactiver chaque service individuellement.",detailsBack:"Retour",detailsAcceptAll:"Tout accepter",detailsDenyAll:"Tout refuser",serviceAccept:"Accepter",serviceDeny:"Refuser",statusAllowed:"Autoris\xE9",statusDenied:"Refus\xE9",statusPending:"En attente",statusAlwaysActive:"Obligatoire",categoryPending:"Services en attente",close:"Fermer",purposeAccept:"Accepter",purposeDeny:"Refuser",purposeStatusAllowed:"Accept\xE9e",purposeStatusDenied:"Refus\xE9e",purposeStatusPending:"En attente",functionalTitle:"Fonctionnement du site",functionalDescription:"Ces cookies et traceurs sont indispensables au fonctionnement du site, pour fournir nos services et nous assurer de leur bon fonctionnement, pour des raisons de s\xE9curit\xE9 et pour s'assurer du suivi de vos pr\xE9f\xE9rences."},en:{bannerTitle:"We respect your privacy",bannerBody:"This site uses cookies to improve your experience, measure audience and personalize content. Your choice will be saved and can be changed at any time.",bannerAcceptAll:"Accept all",bannerDenyAll:"Continue without accepting",bannerCustomize:"Customize",detailsTitle:"Customize your preferences",detailsSubtitle:"You can enable or disable each service individually.",detailsBack:"Back",detailsAcceptAll:"Accept all",detailsDenyAll:"Deny all",serviceAccept:"Accept",serviceDeny:"Deny",statusAllowed:"Allowed",statusDenied:"Denied",statusPending:"Pending",statusAlwaysActive:"Always active",categoryPending:"Pending services",close:"Close",purposeAccept:"Accept",purposeDeny:"Deny",purposeStatusAllowed:"Accepted",purposeStatusDenied:"Denied",purposeStatusPending:"Pending",functionalTitle:"Site operation",functionalDescription:"These cookies and trackers are essential for the site to function, to provide our services, ensure security, and remember your preferences."}};function re(n,e,t){var s,o,r;return n?typeof n=="string"?n:(r=(o=(s=n[e])!=null?s:n.fr)!=null?o:Object.values(n)[0])!=null?r:t:t}function c(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var ae=`
|
|
2
|
+
:host {
|
|
3
|
+
--_primary: var(--mc-primary, #111827);
|
|
4
|
+
--_primary-hover: var(--mc-primary-hover, color-mix(in srgb, var(--_primary) 85%, black));
|
|
5
|
+
--_primary-text: var(--mc-primary-text, #fff);
|
|
6
|
+
--_radius: var(--mc-radius, 12px);
|
|
7
|
+
--_font: var(--mc-font, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
|
|
8
|
+
|
|
9
|
+
position: fixed;
|
|
10
|
+
inset: 0;
|
|
11
|
+
z-index: 99999;
|
|
12
|
+
font-family: var(--_font);
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host([open]) {
|
|
18
|
+
pointer-events: auto;
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
23
|
+
|
|
24
|
+
.backdrop {
|
|
25
|
+
position: fixed;
|
|
26
|
+
inset: 0;
|
|
27
|
+
background: rgba(0, 0, 0, 0.4);
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
animation: mc-fade-in 0.2s ease;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@keyframes mc-fade-in {
|
|
35
|
+
from { opacity: 0; }
|
|
36
|
+
to { opacity: 1; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@keyframes mc-slide-up {
|
|
40
|
+
from { opacity: 0; transform: translateY(12px); }
|
|
41
|
+
to { opacity: 1; transform: translateY(0); }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.modal {
|
|
45
|
+
background: #ffffff;
|
|
46
|
+
border-radius: var(--_radius);
|
|
47
|
+
max-width: 640px;
|
|
48
|
+
width: calc(100% - 32px);
|
|
49
|
+
max-height: 90vh;
|
|
50
|
+
box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
animation: mc-slide-up 0.25s ease;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.header {
|
|
58
|
+
padding: 20px 24px 16px;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: flex-start;
|
|
61
|
+
justify-content: space-between;
|
|
62
|
+
gap: 12px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.title {
|
|
66
|
+
font-size: 17px;
|
|
67
|
+
font-weight: 700;
|
|
68
|
+
margin: 0;
|
|
69
|
+
color: #111827;
|
|
70
|
+
letter-spacing: -0.01em;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.subtitle {
|
|
74
|
+
font-size: 13px;
|
|
75
|
+
color: #6b7280;
|
|
76
|
+
margin: 6px 0 0;
|
|
77
|
+
line-height: 1.5;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.close-btn {
|
|
81
|
+
flex-shrink: 0;
|
|
82
|
+
border: none;
|
|
83
|
+
background: #f3f4f6;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
font-size: 16px;
|
|
86
|
+
line-height: 1;
|
|
87
|
+
padding: 6px 8px;
|
|
88
|
+
color: #6b7280;
|
|
89
|
+
border-radius: 8px;
|
|
90
|
+
transition: background 0.15s;
|
|
91
|
+
}
|
|
92
|
+
.close-btn:hover { background: #e5e7eb; }
|
|
93
|
+
|
|
94
|
+
.body {
|
|
95
|
+
padding: 0 24px 16px;
|
|
96
|
+
overflow: auto;
|
|
97
|
+
font-size: 13px;
|
|
98
|
+
color: #4b5563;
|
|
99
|
+
line-height: 1.6;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.divider {
|
|
103
|
+
height: 1px;
|
|
104
|
+
background: #e5e7eb;
|
|
105
|
+
margin: 0 24px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.footer {
|
|
109
|
+
padding: 16px 24px;
|
|
110
|
+
border-top: 1px solid #f3f4f6;
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-wrap: wrap;
|
|
113
|
+
gap: 8px;
|
|
114
|
+
justify-content: flex-end;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* \u2500\u2500\u2500 Buttons \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
118
|
+
|
|
119
|
+
.btn {
|
|
120
|
+
appearance: none;
|
|
121
|
+
border-radius: 999px;
|
|
122
|
+
padding: 9px 18px;
|
|
123
|
+
font-size: 13px;
|
|
124
|
+
font-weight: 500;
|
|
125
|
+
border: 1px solid transparent;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
transition: all 0.15s ease;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
letter-spacing: 0.01em;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.btn:active { transform: translateY(1px); }
|
|
133
|
+
|
|
134
|
+
.btn-primary {
|
|
135
|
+
background: var(--_primary);
|
|
136
|
+
color: var(--_primary-text);
|
|
137
|
+
border-color: var(--_primary);
|
|
138
|
+
}
|
|
139
|
+
.btn-primary:hover {
|
|
140
|
+
background: var(--_primary-hover);
|
|
141
|
+
border-color: var(--_primary-hover);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.btn-outline {
|
|
145
|
+
background: #ffffff;
|
|
146
|
+
border-color: #e5e7eb;
|
|
147
|
+
color: #374151;
|
|
148
|
+
}
|
|
149
|
+
.btn-outline:hover { background: #f9fafb; border-color: #d1d5db; }
|
|
150
|
+
|
|
151
|
+
.btn-allowed-active {
|
|
152
|
+
background: #059669;
|
|
153
|
+
border-color: #059669;
|
|
154
|
+
color: #fff;
|
|
155
|
+
}
|
|
156
|
+
.btn-allowed-active:hover { background: #047857; border-color: #047857; }
|
|
157
|
+
|
|
158
|
+
.btn-denied-active {
|
|
159
|
+
background: #dc2626;
|
|
160
|
+
border-color: #dc2626;
|
|
161
|
+
color: #fff;
|
|
162
|
+
}
|
|
163
|
+
.btn-denied-active:hover { background: #b91c1c; border-color: #b91c1c; }
|
|
164
|
+
|
|
165
|
+
.btn-ghost {
|
|
166
|
+
background: transparent;
|
|
167
|
+
color: #6b7280;
|
|
168
|
+
}
|
|
169
|
+
.btn-ghost:hover { background: #f9fafb; }
|
|
170
|
+
|
|
171
|
+
/* \u2500\u2500\u2500 Categories & Services \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
172
|
+
|
|
173
|
+
.categories {
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
gap: 12px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.category {
|
|
180
|
+
border-radius: calc(var(--_radius) - 2px);
|
|
181
|
+
border: 1px solid #f3f4f6;
|
|
182
|
+
background: #fafafa;
|
|
183
|
+
padding: 14px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.category-header {
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
justify-content: space-between;
|
|
190
|
+
margin-bottom: 8px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.category-title {
|
|
194
|
+
font-size: 13px;
|
|
195
|
+
font-weight: 600;
|
|
196
|
+
color: #111827;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.services-list {
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
gap: 6px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.service {
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
justify-content: space-between;
|
|
209
|
+
gap: 12px;
|
|
210
|
+
padding: 8px 0 6px;
|
|
211
|
+
border-top: 1px solid #f3f4f6;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.service-main { flex: 1; }
|
|
215
|
+
|
|
216
|
+
.service-name {
|
|
217
|
+
font-size: 13px;
|
|
218
|
+
font-weight: 500;
|
|
219
|
+
color: #111827;
|
|
220
|
+
margin-bottom: 2px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.service-description { font-size: 12px; color: #6b7280; line-height: 1.4; }
|
|
224
|
+
|
|
225
|
+
.service-status { font-size: 11px; margin-top: 4px; font-weight: 500; }
|
|
226
|
+
.service-status.allowed { color: #059669; }
|
|
227
|
+
.service-status.denied { color: #dc2626; }
|
|
228
|
+
.service-status.pending { color: #d97706; }
|
|
229
|
+
|
|
230
|
+
.service-actions { display: flex; gap: 4px; flex-shrink: 0; }
|
|
231
|
+
|
|
232
|
+
.chip {
|
|
233
|
+
font-size: 11px;
|
|
234
|
+
padding: 3px 10px;
|
|
235
|
+
border-radius: 999px;
|
|
236
|
+
border: 1px solid #e5e7eb;
|
|
237
|
+
color: #6b7280;
|
|
238
|
+
white-space: nowrap;
|
|
239
|
+
font-weight: 500;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.chip-active {
|
|
243
|
+
background: #ecfdf5;
|
|
244
|
+
border-color: #a7f3d0;
|
|
245
|
+
color: #059669;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* \u2500\u2500\u2500 Purpose mode \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
249
|
+
|
|
250
|
+
.category-info {
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
gap: 8px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.category-status {
|
|
257
|
+
font-size: 11px;
|
|
258
|
+
font-weight: 500;
|
|
259
|
+
}
|
|
260
|
+
.category-status.allowed { color: #059669; }
|
|
261
|
+
.category-status.denied { color: #dc2626; }
|
|
262
|
+
.category-status.pending { color: #d97706; }
|
|
263
|
+
|
|
264
|
+
.purpose-description {
|
|
265
|
+
font-size: 12px;
|
|
266
|
+
color: #6b7280;
|
|
267
|
+
margin: 0 0 8px;
|
|
268
|
+
line-height: 1.5;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.purpose-service-info {
|
|
272
|
+
padding: 4px 0;
|
|
273
|
+
border-top: none;
|
|
274
|
+
}
|
|
275
|
+
.purpose-service-info .service-name {
|
|
276
|
+
font-size: 12px;
|
|
277
|
+
color: #4b5563;
|
|
278
|
+
font-weight: 400;
|
|
279
|
+
}
|
|
280
|
+
.purpose-service-info .service-description {
|
|
281
|
+
font-size: 11px;
|
|
282
|
+
color: #9ca3af;
|
|
283
|
+
}
|
|
284
|
+
`,R=null,ke=typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in Document.prototype&&"replaceSync"in CSSStyleSheet.prototype;function Le(){return R||(R=new CSSStyleSheet,R.replaceSync(ae)),R}function $e(n){if(n.querySelector("style[data-mc]"))return;let e=document.createElement("style");e.setAttribute("data-mc",""),e.textContent=ae,n.prepend(e)}var $=class extends HTMLElement{constructor(){super();p(this,"shadow");p(this,"mode","banner");p(this,"_unsubscribers",[]);p(this,"_renderScheduled",!1);p(this,"_previouslyFocused",null);p(this,"_keydownHandler",null);p(this,"services",[]);p(this,"consent",{});p(this,"answered",!1);p(this,"panelOpen",!1);p(this,"onAcceptAll",()=>N());p(this,"onDenyAll",()=>K());p(this,"onCustomize",()=>{this.mode="details",this.scheduleRender()});p(this,"onBackToBanner",()=>{this.mode="banner",this.scheduleRender()});this.shadow=this.attachShadow({mode:"open"})}get labels(){var s,o;let t=(s=this.getAttribute("lang"))!=null?s:"fr";return(o=ie[t])!=null?o:ie.fr}scheduleRender(){this._renderScheduled||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.render()}))}connectedCallback(){ke?this.shadow.adoptedStyleSheets=[Le()]:$e(this.shadow),this._unsubscribers.push(f.subscribe(t=>{this.consent=t,this.scheduleRender()}),m.subscribe(t=>{this.answered=t,this.scheduleRender()}),y.subscribe(t=>{this.services=t,this.ensurePanelOpenIfNeeded(),this.scheduleRender()}),u.subscribe(t=>{let s=this.panelOpen;this.panelOpen=t,t&&!s&&this.answered&&(this.mode="details"),this.scheduleRender()}))}disconnectedCallback(){this._unsubscribers.forEach(t=>t()),this._unsubscribers=[],this.teardownFocusTrap(!1)}attributeChangedCallback(){this.scheduleRender()}ensurePanelOpenIfNeeded(){this.getPendingServices().length>0&&!this.answered&&!this.panelOpen&&I()}getPendingServices(){return this.services.filter(t=>t.requireConsent&&this.consent[t.id]===void 0)}shouldShowPopup(){return this.panelOpen&&this.services.length>0}setupFocusTrap(){let t=this.shadow.querySelector(".modal");if(!t)return;let s=[...t.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')];s.length&&(this._previouslyFocused||(this._previouslyFocused=document.activeElement),requestAnimationFrame(()=>{var o;return(o=s[0])==null?void 0:o.focus()}),this._keydownHandler=o=>{if(o.key==="Escape"){o.preventDefault(),u.set(!1);return}if(o.key!=="Tab")return;let r=this.shadow.activeElement,i=s[0],a=s[s.length-1];o.shiftKey&&r===i?(o.preventDefault(),a.focus()):!o.shiftKey&&r===a&&(o.preventDefault(),i.focus())},document.addEventListener("keydown",this._keydownHandler))}teardownFocusTrap(t=!0){this._keydownHandler&&(document.removeEventListener("keydown",this._keydownHandler),this._keydownHandler=null),t&&this._previouslyFocused&&"focus"in this._previouslyFocused&&(this._previouslyFocused.focus(),this._previouslyFocused=null)}render(){var s,o;if(!this.shouldShowPopup()){this.teardownFocusTrap(!0),this.shadow.innerHTML="",this.removeAttribute("open");return}this.setAttribute("open",""),this.teardownFocusTrap(!1),this.mode==="banner"?this.renderBanner():((o=typeof window!="undefined"?(s=window._modernConsentConfig)==null?void 0:s.displayMode:void 0)!=null?o:"vendor")==="purpose"?this.renderPurposeDetails():this.renderDetails(),this.setupFocusTrap()}onSetConsentForService(t,s){V(t,s),this.getPendingServices().filter(o=>o.id!==t).length===0&&u.set(!1)}onSetConsentForCategory(t,s){this.services.filter(r=>r.category===t&&r.requireConsent).forEach(r=>V(r.id,s)),this.getPendingServices().length===0&&u.set(!1)}getCategoryStatus(t){let s=t.filter(i=>i.requireConsent);return s.length===0||s.every(i=>this.consent[i.id])?"allowed":s.every(i=>!this.consent[i.id])?"denied":"pending"}groupServicesByCategory(){let t={};return this.services.forEach(s=>{let o=s.category||"Autres";t[o]||(t[o]=[]),t[o].push(s)}),t}renderFunctionalBlock(){var o;if(!(typeof window!="undefined"&&((o=window._modernConsentConfig)==null?void 0:o.functionalPurpose)===!0))return"";let s=this.labels;return`
|
|
285
|
+
<section class="category">
|
|
286
|
+
<div class="category-header">
|
|
287
|
+
<div class="category-info">
|
|
288
|
+
<span class="category-title">${c(s.functionalTitle)}</span>
|
|
289
|
+
</div>
|
|
290
|
+
<span class="chip chip-active">${c(s.statusAlwaysActive)}</span>
|
|
291
|
+
</div>
|
|
292
|
+
<div class="purpose-description">${c(s.functionalDescription)}</div>
|
|
293
|
+
</section>
|
|
294
|
+
`}renderBanner(){let t=this.labels;this.shadow.innerHTML=`
|
|
295
|
+
<div class="backdrop" role="dialog" aria-modal="true" aria-labelledby="mc-title">
|
|
296
|
+
<div class="modal">
|
|
297
|
+
<div class="header">
|
|
298
|
+
<div>
|
|
299
|
+
<h2 class="title" id="mc-title"><slot name="title">${c(t.bannerTitle)}</slot></h2>
|
|
300
|
+
</div>
|
|
301
|
+
<button class="close-btn" type="button" aria-label="${c(t.close)}" id="mc-close-btn">\u2715</button>
|
|
302
|
+
</div>
|
|
303
|
+
<div class="body">
|
|
304
|
+
<slot name="body">${c(t.bannerBody)}</slot>
|
|
305
|
+
</div>
|
|
306
|
+
<div class="footer">
|
|
307
|
+
<button class="btn btn-ghost" type="button" id="mc-deny-all-btn">${c(t.bannerDenyAll)}</button>
|
|
308
|
+
<button class="btn btn-outline" type="button" id="mc-customize-btn">${c(t.bannerCustomize)}</button>
|
|
309
|
+
<button class="btn btn-primary" type="button" id="mc-accept-all-btn">${c(t.bannerAcceptAll)}</button>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
`,this.shadow.getElementById("mc-accept-all-btn").addEventListener("click",this.onAcceptAll),this.shadow.getElementById("mc-deny-all-btn").addEventListener("click",this.onDenyAll),this.shadow.getElementById("mc-customize-btn").addEventListener("click",this.onCustomize),this.shadow.getElementById("mc-close-btn").addEventListener("click",()=>u.set(!1))}renderDetails(){let t=this.labels,s=this.renderFunctionalBlock(),o=this.groupServicesByCategory(),r=Object.keys(o).sort().map(i=>{let a=o[i],d=a.some(l=>l.requireConsent&&this.consent[l.id]===void 0),g=a.map(l=>{if(!l.requireConsent)return`
|
|
314
|
+
<div class="service">
|
|
315
|
+
<div class="service-main">
|
|
316
|
+
<div class="service-name">${c(l.name)}</div>
|
|
317
|
+
<div class="service-description">${c(l.description)}</div>
|
|
318
|
+
</div>
|
|
319
|
+
<span class="chip chip-active">${c(t.statusAlwaysActive)}</span>
|
|
320
|
+
</div>
|
|
321
|
+
`;let v=this.consent[l.id],B=v?t.statusAllowed:v?t.statusPending:t.statusDenied,C=v?"allowed":v?"pending":"denied";return`
|
|
322
|
+
<div class="service">
|
|
323
|
+
<div class="service-main">
|
|
324
|
+
<div class="service-name">${c(l.name)}</div>
|
|
325
|
+
<div class="service-description">${c(l.description)}</div>
|
|
326
|
+
<div class="service-status ${C}">${c(B)}</div>
|
|
327
|
+
</div>
|
|
328
|
+
<div class="service-actions">
|
|
329
|
+
<button class="btn btn-outline ${C==="allowed"?"btn-allowed-active":""}" type="button" data-action="allow" data-id="${c(l.id)}">
|
|
330
|
+
${c(t.serviceAccept)}
|
|
331
|
+
</button>
|
|
332
|
+
<button class="btn btn-outline ${C==="denied"?"btn-denied-active":""}" type="button" data-action="deny" data-id="${c(l.id)}">
|
|
333
|
+
${c(t.serviceDeny)}
|
|
334
|
+
</button>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
`}).join("");return`
|
|
338
|
+
<section class="category">
|
|
339
|
+
<div class="category-header">
|
|
340
|
+
<div class="category-title">${c(i)}</div>
|
|
341
|
+
${d?`<span class="chip">${c(t.categoryPending)}</span>`:""}
|
|
342
|
+
</div>
|
|
343
|
+
<div class="services-list">${g}</div>
|
|
344
|
+
</section>
|
|
345
|
+
`}).join("");this.shadow.innerHTML=`
|
|
346
|
+
<div class="backdrop" role="dialog" aria-modal="true" aria-labelledby="mc-details-title">
|
|
347
|
+
<div class="modal">
|
|
348
|
+
<div class="header">
|
|
349
|
+
<div>
|
|
350
|
+
<h2 class="title" id="mc-details-title">${c(t.detailsTitle)}</h2>
|
|
351
|
+
<p class="subtitle">${c(t.detailsSubtitle)}</p>
|
|
352
|
+
</div>
|
|
353
|
+
<button class="close-btn" type="button" aria-label="${c(t.close)}" id="mc-close-btn">\u2715</button>
|
|
354
|
+
</div>
|
|
355
|
+
<div class="body">
|
|
356
|
+
<div class="categories">${s}${r}</div>
|
|
357
|
+
</div>
|
|
358
|
+
<div class="footer">
|
|
359
|
+
<button class="btn btn-ghost" type="button" id="mc-back-btn">${c(t.detailsBack)}</button>
|
|
360
|
+
<button class="btn btn-outline" type="button" id="mc-deny-all-btn">${c(t.detailsDenyAll)}</button>
|
|
361
|
+
<button class="btn btn-primary" type="button" id="mc-accept-all-btn">${c(t.detailsAcceptAll)}</button>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
`,this.shadow.getElementById("mc-accept-all-btn").addEventListener("click",this.onAcceptAll),this.shadow.getElementById("mc-deny-all-btn").addEventListener("click",this.onDenyAll),this.shadow.getElementById("mc-back-btn").addEventListener("click",this.onBackToBanner),this.shadow.getElementById("mc-close-btn").addEventListener("click",()=>u.set(!1)),this.shadow.querySelectorAll("[data-action]").forEach(i=>{i.addEventListener("click",()=>{this.onSetConsentForService(i.dataset.id,i.dataset.action==="allow")})})}renderPurposeDetails(){var d,g;let t=this.labels,s=(d=this.getAttribute("lang"))!=null?d:"fr",o=this.renderFunctionalBlock(),r=this.groupServicesByCategory(),i=typeof window!="undefined"?(g=window._modernConsentConfig)==null?void 0:g.purposes:void 0,a=Object.keys(r).sort().map(l=>{var W,J,G,Q;let v=r[l],B=v.every(S=>!S.requireConsent),C=this.getCategoryStatus(v),x=v.find(S=>S.purposeLabel),ce=re(x==null?void 0:x.purposeLabel,s,(J=(W=i==null?void 0:i[l])==null?void 0:W.label)!=null?J:l),Y=re(x==null?void 0:x.purposeDescription,s,(Q=(G=i==null?void 0:i[l])==null?void 0:G.description)!=null?Q:""),de=B?`<span class="chip chip-active">${c(t.statusAlwaysActive)}</span>`:`
|
|
366
|
+
<div class="service-actions">
|
|
367
|
+
<button class="btn btn-outline ${C==="allowed"?"btn-allowed-active":""}" type="button" data-category="${c(l)}" data-cat-action="allow">
|
|
368
|
+
${c(t.purposeAccept)}
|
|
369
|
+
</button>
|
|
370
|
+
<button class="btn btn-outline ${C==="denied"?"btn-denied-active":""}" type="button" data-category="${c(l)}" data-cat-action="deny">
|
|
371
|
+
${c(t.purposeDeny)}
|
|
372
|
+
</button>
|
|
373
|
+
</div>
|
|
374
|
+
`,le=v.map(S=>`
|
|
375
|
+
<div class="service purpose-service-info">
|
|
376
|
+
<div class="service-main">
|
|
377
|
+
<div class="service-name">${c(S.name)}</div>
|
|
378
|
+
<div class="service-description">${c(S.description)}</div>
|
|
379
|
+
</div>
|
|
380
|
+
</div>
|
|
381
|
+
`).join("");return`
|
|
382
|
+
<section class="category">
|
|
383
|
+
<div class="category-header">
|
|
384
|
+
<div class="category-info">
|
|
385
|
+
<span class="category-title">${c(ce)}</span>
|
|
386
|
+
</div>
|
|
387
|
+
${de}
|
|
388
|
+
</div>
|
|
389
|
+
${Y?`<div class="purpose-description">${c(Y)}</div>`:""}
|
|
390
|
+
<div class="services-list">${le}</div>
|
|
391
|
+
</section>
|
|
392
|
+
`}).join("");this.shadow.innerHTML=`
|
|
393
|
+
<div class="backdrop" role="dialog" aria-modal="true" aria-labelledby="mc-details-title">
|
|
394
|
+
<div class="modal">
|
|
395
|
+
<div class="header">
|
|
396
|
+
<div>
|
|
397
|
+
<h2 class="title" id="mc-details-title">${c(t.detailsTitle)}</h2>
|
|
398
|
+
<p class="subtitle">${c(t.detailsSubtitle)}</p>
|
|
399
|
+
</div>
|
|
400
|
+
<button class="close-btn" type="button" aria-label="${c(t.close)}" id="mc-close-btn">\u2715</button>
|
|
401
|
+
</div>
|
|
402
|
+
<div class="body">
|
|
403
|
+
<div class="categories">${o}${a}</div>
|
|
404
|
+
</div>
|
|
405
|
+
<div class="footer">
|
|
406
|
+
<button class="btn btn-ghost" type="button" id="mc-back-btn">${c(t.detailsBack)}</button>
|
|
407
|
+
<button class="btn btn-outline" type="button" id="mc-deny-all-btn">${c(t.detailsDenyAll)}</button>
|
|
408
|
+
<button class="btn btn-primary" type="button" id="mc-accept-all-btn">${c(t.detailsAcceptAll)}</button>
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
</div>
|
|
412
|
+
`,this.shadow.getElementById("mc-accept-all-btn").addEventListener("click",this.onAcceptAll),this.shadow.getElementById("mc-deny-all-btn").addEventListener("click",this.onDenyAll),this.shadow.getElementById("mc-back-btn").addEventListener("click",this.onBackToBanner),this.shadow.getElementById("mc-close-btn").addEventListener("click",()=>u.set(!1)),this.shadow.querySelectorAll("[data-cat-action]").forEach(l=>{l.addEventListener("click",()=>{this.onSetConsentForCategory(l.dataset.category,l.dataset.catAction==="allow")})})}};p($,"observedAttributes",["lang"]);typeof window!="undefined"&&!customElements.get("mc-consent-widget")&&customElements.define("mc-consent-widget",$);return be(Ee);})();
|
|
413
|
+
//# sourceMappingURL=consent.js.map
|