@consent.software/catalog 1.4.4 → 1.5.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/dist_bundle/bundle.js +47 -40
- package/dist_bundle/bundle.js.map +3 -3
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/consentsoftware-cookieconsent.d.ts +2 -1
- package/dist_ts_web/elements/consentsoftware-cookieconsent.js +59 -33
- package/dist_watch/bundle.js +58 -32
- package/dist_watch/bundle.js.map +2 -2
- package/package.json +2 -2
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/consentsoftware-cookieconsent.ts +66 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consent.software/catalog",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.",
|
|
6
6
|
"exports": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Lossless GmbH",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@consent.software/interfaces": "^1.0.
|
|
13
|
+
"@consent.software/interfaces": "^1.0.14",
|
|
14
14
|
"@consent.software/webclient": "^1.1.0",
|
|
15
15
|
"@push.rocks/smartdelay": "^3.0.5",
|
|
16
16
|
"lit": "^3.2.1"
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@consent.software/catalog',
|
|
6
|
-
version: '1.
|
|
6
|
+
version: '1.5.0',
|
|
7
7
|
description: 'A library of web components designed to integrate robust consent management capabilities into web applications, ensuring compliance with privacy regulations.'
|
|
8
8
|
}
|
|
@@ -73,11 +73,16 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
73
73
|
align-items: center;
|
|
74
74
|
justify-content: center;
|
|
75
75
|
z-index: 1000; /* standard z-index for fixed elements */
|
|
76
|
-
background: rgba(
|
|
76
|
+
background: rgba(255, 255, 255, 0);
|
|
77
77
|
backdrop-filter: blur(0px);
|
|
78
78
|
transition: all 0.2s;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
.pageOverlay.shake {
|
|
82
|
+
background: rgba(0, 0, 0, 0.5) !important;
|
|
83
|
+
backdrop-filter: blur(20px) !important;
|
|
84
|
+
}
|
|
85
|
+
|
|
81
86
|
.modalBox {
|
|
82
87
|
display: block;
|
|
83
88
|
color: var(--text-color);
|
|
@@ -91,16 +96,29 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
91
96
|
min-width: calc(100vw / 3);
|
|
92
97
|
box-sizing: border-box;
|
|
93
98
|
overflow: hidden;
|
|
94
|
-
/*
|
|
95
|
-
* We start with margin-bottom as negative to hide the banner.
|
|
96
|
-
* The animation occurs when we toggle the gotIt/show attributes.
|
|
97
|
-
*/
|
|
98
99
|
will-change: transform; /* ensure efficient rendering */
|
|
99
100
|
transition: all 0.3s;
|
|
100
101
|
transform: scale(0.95);
|
|
101
102
|
opacity: 0;
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
.modalBox.shake {
|
|
106
|
+
animation: shake 150ms 2 linear;
|
|
107
|
+
box-shadow: 0px 0px 15px rgba(255, 255, 255, 0.6);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@keyframes shake {
|
|
111
|
+
0% {
|
|
112
|
+
transform: translate(3px, 0);
|
|
113
|
+
}
|
|
114
|
+
50% {
|
|
115
|
+
transform: translate(-3px, 0);
|
|
116
|
+
}
|
|
117
|
+
100% {
|
|
118
|
+
transform: translate(0, 0);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
104
122
|
/*
|
|
105
123
|
* Toggle display based on [show] attribute
|
|
106
124
|
* (so if show=false, the banner doesn't show at all).
|
|
@@ -112,18 +130,6 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
112
130
|
display: block;
|
|
113
131
|
}
|
|
114
132
|
|
|
115
|
-
/*
|
|
116
|
-
* Animate margin-bottom when [gotIt] toggles.
|
|
117
|
-
* If gotIt=true, push the banner down off-screen.
|
|
118
|
-
* If gotIt=false, pull the banner into view.
|
|
119
|
-
*/
|
|
120
|
-
:host([gotIt='true']) {
|
|
121
|
-
background: blue;
|
|
122
|
-
}
|
|
123
|
-
:host([gotIt='false']) {
|
|
124
|
-
background: red;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
133
|
.content {
|
|
128
134
|
margin: auto;
|
|
129
135
|
}
|
|
@@ -184,13 +190,12 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
184
190
|
|
|
185
191
|
constructor() {
|
|
186
192
|
super();
|
|
187
|
-
this.setAttribute('gotIt', 'true');
|
|
188
193
|
this.setAttribute('show', 'false');
|
|
189
194
|
}
|
|
190
195
|
|
|
191
196
|
public render(): TemplateResult {
|
|
192
197
|
return html`
|
|
193
|
-
<div class="pageOverlay">
|
|
198
|
+
<div class="pageOverlay" @click=${this.pageOverlayClick}>
|
|
194
199
|
<div class="modalBox">
|
|
195
200
|
<div class="content">
|
|
196
201
|
<consentsoftware-header></consentsoftware-header>
|
|
@@ -205,27 +210,29 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
205
210
|
<!-- <div class="button-container">
|
|
206
211
|
<div
|
|
207
212
|
class="consent-button"
|
|
208
|
-
@click=${(event: MouseEvent) =>
|
|
213
|
+
@click=${(event: MouseEvent) =>
|
|
214
|
+
this.handleConsentButtonClick(event, ['functional'])}
|
|
209
215
|
>
|
|
210
216
|
Functional cookies
|
|
211
217
|
</div>
|
|
212
218
|
<div
|
|
213
219
|
class="consent-button"
|
|
214
|
-
@click=${(event: MouseEvent) =>
|
|
220
|
+
@click=${(event: MouseEvent) =>
|
|
221
|
+
this.handleConsentButtonClick(event, ['functional', 'analytics'])}
|
|
215
222
|
>
|
|
216
223
|
Analytics cookies
|
|
217
224
|
</div>
|
|
218
225
|
<div
|
|
219
226
|
class="consent-button"
|
|
220
227
|
@click=${(event: MouseEvent) =>
|
|
221
|
-
this.
|
|
228
|
+
this.handleConsentButtonClick(event, ['functional', 'analytics', 'marketing'])}
|
|
222
229
|
>
|
|
223
230
|
Marketing cookies
|
|
224
231
|
</div>
|
|
225
232
|
<div
|
|
226
233
|
class="consent-button"
|
|
227
234
|
@click=${(event: MouseEvent) =>
|
|
228
|
-
this.
|
|
235
|
+
this.handleConsentButtonClick(event, ['functional', 'analytics', 'marketing', 'all'])}
|
|
229
236
|
>
|
|
230
237
|
All cookies
|
|
231
238
|
</div>
|
|
@@ -234,20 +241,22 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
234
241
|
<div class="button-container">
|
|
235
242
|
<div
|
|
236
243
|
class="consent-button"
|
|
237
|
-
@click=${(event: MouseEvent) =>
|
|
244
|
+
@click=${(event: MouseEvent) =>
|
|
245
|
+
this.handleConsentButtonClick(event, ['functional'])}
|
|
238
246
|
>
|
|
239
247
|
Deny
|
|
240
248
|
</div>
|
|
241
249
|
<div
|
|
242
250
|
class="consent-button"
|
|
243
|
-
@click=${(event: MouseEvent) =>
|
|
251
|
+
@click=${(event: MouseEvent) =>
|
|
252
|
+
this.handleConsentButtonClick(event, ['functional', 'analytics'])}
|
|
244
253
|
>
|
|
245
254
|
Accept selection
|
|
246
255
|
</div>
|
|
247
256
|
<div
|
|
248
257
|
class="consent-button"
|
|
249
258
|
@click=${(event: MouseEvent) =>
|
|
250
|
-
this.
|
|
259
|
+
this.handleConsentButtonClick(event, ['functional', 'analytics', 'marketing'])}
|
|
251
260
|
>
|
|
252
261
|
Accept all cookies
|
|
253
262
|
</div>
|
|
@@ -255,6 +264,7 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
255
264
|
<div class="info-container">
|
|
256
265
|
consent management powered by
|
|
257
266
|
<a href="https://consent.software">consent.software</a>
|
|
267
|
+
(Open Source)
|
|
258
268
|
</div>
|
|
259
269
|
</div>
|
|
260
270
|
</div>
|
|
@@ -272,13 +282,12 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
272
282
|
const cookieLevel = await this.csWebclientInstance.getCookieLevels();
|
|
273
283
|
if (!cookieLevel) {
|
|
274
284
|
this.setAttribute('show', 'true');
|
|
275
|
-
this.setAttribute('gotIt', 'false');
|
|
276
285
|
requestAnimationFrame(async () => {
|
|
277
286
|
await this.updated();
|
|
278
287
|
const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
|
|
279
288
|
if (pageOverlay) {
|
|
280
|
-
pageOverlay.style.background = 'rgba(
|
|
281
|
-
pageOverlay.style.backdropFilter = 'blur(
|
|
289
|
+
pageOverlay.style.background = 'rgba(255,255,255, 0.1)';
|
|
290
|
+
pageOverlay.style.backdropFilter = 'blur(0px)';
|
|
282
291
|
}
|
|
283
292
|
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
|
|
284
293
|
if (modalBox) {
|
|
@@ -288,7 +297,6 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
288
297
|
});
|
|
289
298
|
} else {
|
|
290
299
|
this.setAttribute('show', 'false');
|
|
291
|
-
this.setAttribute('gotIt', 'true');
|
|
292
300
|
}
|
|
293
301
|
}
|
|
294
302
|
|
|
@@ -313,16 +321,42 @@ export class ConsentsoftwareCookieconsent extends LitElement {
|
|
|
313
321
|
/**
|
|
314
322
|
* Sets the user’s chosen cookie level(s) and hides the banner.
|
|
315
323
|
*/
|
|
316
|
-
private async
|
|
324
|
+
private async handleConsentButtonClick(
|
|
325
|
+
event: MouseEvent,
|
|
326
|
+
levelsArg: csInterfaces.TCookieLevel[]
|
|
327
|
+
) {
|
|
317
328
|
console.log(`Set level to ${levelsArg}`);
|
|
329
|
+
const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
|
|
330
|
+
if (pageOverlay) {
|
|
331
|
+
pageOverlay.style.background = 'rgba(255,255,255, 0)';
|
|
332
|
+
pageOverlay.style.backdropFilter = 'blur(0px)';
|
|
333
|
+
}
|
|
334
|
+
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
|
|
335
|
+
if (modalBox) {
|
|
336
|
+
modalBox.style.transform = `scale(0.95)`;
|
|
337
|
+
modalBox.style.opacity = '0';
|
|
338
|
+
}
|
|
318
339
|
await this.csWebclientInstance.setCookieLevels(levelsArg);
|
|
319
|
-
this.setAttribute('gotIt', 'true');
|
|
320
340
|
await delayFor(300);
|
|
321
341
|
this.setAttribute('show', 'false');
|
|
322
342
|
// After user selection, re-check for any required scripts to run
|
|
323
343
|
this.updated();
|
|
324
344
|
}
|
|
325
345
|
|
|
346
|
+
private async pageOverlayClick(e: MouseEvent) {
|
|
347
|
+
if (e.target === e.currentTarget) {
|
|
348
|
+
const pageOverlay: HTMLDivElement = this.shadowRoot?.querySelector('.pageOverlay');
|
|
349
|
+
const modalBox: HTMLDivElement = this.shadowRoot?.querySelector('.modalBox');
|
|
350
|
+
if (pageOverlay && modalBox) {
|
|
351
|
+
pageOverlay.classList.add('shake');
|
|
352
|
+
modalBox.classList.add('shake');
|
|
353
|
+
await delayFor(300);
|
|
354
|
+
pageOverlay.classList.remove('shake');
|
|
355
|
+
modalBox.classList.remove('shake');
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
326
360
|
/**
|
|
327
361
|
* Dynamically switches the theme between light/dark,
|
|
328
362
|
* respecting `prefers-color-scheme` by default.
|