@tilli-pro/cookieconsent-plugin 0.1.9 → 0.1.11
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/.cache/tsbuildinfo.json +1 -0
- package/dist/_consts.d.ts +7 -0
- package/dist/_consts.d.ts.map +1 -0
- package/dist/_consts.js +6 -0
- package/dist/assets/cookie.d.ts +4 -0
- package/dist/assets/cookie.d.ts.map +1 -0
- package/dist/assets/cookie.js +11 -0
- package/dist/assets/index.d.ts +7 -0
- package/dist/assets/index.d.ts.map +1 -0
- package/dist/assets/index.js +4 -0
- package/dist/assets/logo.d.ts +4 -0
- package/dist/assets/logo.d.ts.map +1 -0
- package/dist/assets/logo.js +21 -0
- package/dist/config/categories/index.d.ts +43 -0
- package/dist/config/categories/index.d.ts.map +1 -0
- package/dist/config/categories/index.js +49 -0
- package/dist/config/categories/labels.d.ts +14 -0
- package/dist/config/categories/labels.d.ts.map +1 -0
- package/dist/config/categories/labels.js +18 -0
- package/dist/config/cookies/_utils.d.ts +25 -0
- package/dist/config/cookies/_utils.d.ts.map +1 -0
- package/dist/config/cookies/_utils.js +30 -0
- package/dist/config/cookies/_utils.server.d.ts +8 -0
- package/dist/config/cookies/_utils.server.d.ts.map +1 -0
- package/dist/config/cookies/_utils.server.js +8 -0
- package/dist/config/cookies/analytics/datadog.d.ts +22 -0
- package/dist/config/cookies/analytics/datadog.d.ts.map +1 -0
- package/dist/config/cookies/analytics/datadog.js +28 -0
- package/dist/config/cookies/common-translations.d.ts +29 -0
- package/dist/config/cookies/common-translations.d.ts.map +1 -0
- package/dist/config/cookies/common-translations.js +27 -0
- package/dist/config/cookies/functional/brf/v2.d.ts +22 -0
- package/dist/config/cookies/functional/brf/v2.d.ts.map +1 -0
- package/dist/config/cookies/functional/brf/v2.js +28 -0
- package/dist/config/cookies/index.d.ts +15 -0
- package/dist/config/cookies/index.d.ts.map +1 -0
- package/dist/config/cookies/index.js +19 -0
- package/dist/config/cookies/necessary/brf/v2-auth.d.ts +27 -0
- package/dist/config/cookies/necessary/brf/v2-auth.d.ts.map +1 -0
- package/dist/config/cookies/necessary/brf/v2-auth.js +39 -0
- package/dist/config/cookies/necessary/next-auth.d.ts +47 -0
- package/dist/config/cookies/necessary/next-auth.d.ts.map +1 -0
- package/dist/config/cookies/necessary/next-auth.js +83 -0
- package/dist/config/cookies/types.d.ts +37 -0
- package/dist/config/cookies/types.d.ts.map +1 -0
- package/dist/config/cookies/types.js +0 -0
- package/dist/config/gui-options/html-components/ManageCookiePrefsButton.d.ts +18 -0
- package/dist/config/gui-options/html-components/ManageCookiePrefsButton.d.ts.map +1 -0
- package/dist/config/gui-options/html-components/ManageCookiePrefsButton.js +116 -0
- package/dist/config/gui-options/html-components/TilliXCallout.d.ts +20 -0
- package/dist/config/gui-options/html-components/TilliXCallout.d.ts.map +1 -0
- package/dist/config/gui-options/html-components/TilliXCallout.js +28 -0
- package/dist/config/gui-options/html-components/assets/CookieIcon.d.ts +3 -0
- package/dist/config/gui-options/html-components/assets/CookieIcon.d.ts.map +1 -0
- package/dist/config/gui-options/html-components/assets/CookieIcon.js +10 -0
- package/dist/config/gui-options/index.d.ts +18 -0
- package/dist/config/gui-options/index.d.ts.map +1 -0
- package/dist/config/gui-options/index.js +16 -0
- package/dist/config/gui-options/scripts/cookiePrefsButtonDragObserver.d.ts +20 -0
- package/dist/config/gui-options/scripts/cookiePrefsButtonDragObserver.d.ts.map +1 -0
- package/dist/config/gui-options/scripts/cookiePrefsButtonDragObserver.js +143 -0
- package/dist/config/gui-options/scripts/forceDisableReactRemoveScroll.d.ts +17 -0
- package/dist/config/gui-options/scripts/forceDisableReactRemoveScroll.d.ts.map +1 -0
- package/dist/config/gui-options/scripts/forceDisableReactRemoveScroll.js +97 -0
- package/dist/config/gui-options/scripts/injectManageCookiePrefsButton.d.ts +5 -0
- package/dist/config/gui-options/scripts/injectManageCookiePrefsButton.d.ts.map +1 -0
- package/dist/config/gui-options/scripts/injectManageCookiePrefsButton.js +31 -0
- package/dist/config/index.d.ts +227 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +13 -0
- package/dist/config/translations/de/index.d.ts +35 -0
- package/dist/config/translations/de/index.d.ts.map +1 -0
- package/dist/config/translations/de/index.js +85 -0
- package/dist/config/translations/en/index.d.ts +35 -0
- package/dist/config/translations/en/index.d.ts.map +1 -0
- package/dist/config/translations/en/index.js +85 -0
- package/dist/config/translations/es/index.d.ts +35 -0
- package/dist/config/translations/es/index.d.ts.map +1 -0
- package/dist/config/translations/es/index.js +85 -0
- package/dist/config/translations/fr/index.d.ts +35 -0
- package/dist/config/translations/fr/index.d.ts.map +1 -0
- package/dist/config/translations/fr/index.js +85 -0
- package/dist/config/translations/index.d.ts +164 -0
- package/dist/config/translations/index.d.ts.map +1 -0
- package/dist/config/translations/index.js +12 -0
- package/dist/config/translations/it/index.d.ts +35 -0
- package/dist/config/translations/it/index.d.ts.map +1 -0
- package/dist/config/translations/it/index.js +85 -0
- package/dist/config/translations/types.d.ts +3 -0
- package/dist/config/translations/types.d.ts.map +1 -0
- package/dist/config/translations/types.js +0 -0
- package/dist/react-components/CookieConsentInit.client.d.ts +2 -0
- package/dist/react-components/CookieConsentInit.client.d.ts.map +1 -0
- package/dist/react-components/CookieConsentInit.client.js +27 -0
- package/dist/react-components/CookieConsentInit.server.d.ts +8 -0
- package/dist/react-components/CookieConsentInit.server.d.ts.map +1 -0
- package/dist/react-components/CookieConsentInit.server.js +11 -0
- package/dist/react-components/_utils.d.ts +10 -0
- package/dist/react-components/_utils.d.ts.map +1 -0
- package/dist/react-components/_utils.js +31 -0
- package/dist/react-components/styles/tenants/freeman.css +63 -0
- package/dist/react-components/styles/tenants/frontier.css +71 -0
- package/package.json +5 -3
@@ -0,0 +1,28 @@
|
|
1
|
+
"use client";
|
2
|
+
import assets from "../../../assets";
|
3
|
+
const translations = {
|
4
|
+
de: {
|
5
|
+
poweredByTilliX: "unterstützt von tilliX",
|
6
|
+
},
|
7
|
+
en: {
|
8
|
+
poweredByTilliX: "powered by tilliX",
|
9
|
+
},
|
10
|
+
es: {
|
11
|
+
poweredByTilliX: "impulsado por tilliX",
|
12
|
+
},
|
13
|
+
fr: {
|
14
|
+
poweredByTilliX: "propulsé par tilliX",
|
15
|
+
},
|
16
|
+
it: {
|
17
|
+
poweredByTilliX: "alimentato da tilliX",
|
18
|
+
},
|
19
|
+
};
|
20
|
+
export default (lang = "en", inPrefs) => `
|
21
|
+
<!-- "powered by tilliX" callout -->
|
22
|
+
<div style="${!inPrefs ? "margin-left: auto; " : ""}margin-top: auto; margin-bottom: auto">
|
23
|
+
<abbr title="${translations[lang].poweredByTilliX}" style="${inPrefs ? "margin-right: 1em" : "margin-left: 1.3rem"}; display: flex; align-items: center">
|
24
|
+
<a href="https://tilli.pro" target="_blank" style="display: inline-block; background-image: none">
|
25
|
+
<img src="data:image/svg+xml;charset=utf8,${encodeURIComponent(assets.logo)}" alt="tilli" style="height: 1em; width: auto; min-height: 1em; min-width: 1em; vertical-align: middle" />
|
26
|
+
</a>
|
27
|
+
</abbr>
|
28
|
+
</div>`;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CookieIcon.d.ts","sourceRoot":"","sources":["../../../../../src/config/gui-options/html-components/assets/CookieIcon.ts"],"names":[],"mappings":"oCAKa,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,+DAI3B,MAAM;AALT,wBAUS"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use client";
|
2
|
+
import assets from "../../../../assets";
|
3
|
+
export default (centered /* 😉 */, scale = 0.6667, // -> 0.6667 ((100 * n)%)
|
4
|
+
topOffset = 0, // -> -0.25 (em)
|
5
|
+
rightOffset = 0) => `
|
6
|
+
<span style="display: inline-block; vertical-align: middle; transform: scale(${scale}); transform-origin: top left; margin-right: ${((centered ? -0.5 : -0.25) + rightOffset).toFixed(4)}em; height: 1em${topOffset ? `; margin-top: ${topOffset.toFixed(4)}em` : ""};">
|
7
|
+
${assets.cookie}
|
8
|
+
<!-- invisible "🍪" icon (used for copy-paste/a11y purposes) -->
|
9
|
+
<span style="max-width: 0; max-height: 0; opacity: 0; position: absolute">🍪</span>
|
10
|
+
</span>`;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/** IMPORTANT NOTES FOR GDPR COMPLIANCE:
|
2
|
+
* > the "Accept" and "Reject" buttons should be equally weighted in terms of size, color, and font. This means that the buttons should be equally accessible and prominent– `equalWeightButtons` must be `true`. */
|
3
|
+
declare const _default: {
|
4
|
+
consentModal: {
|
5
|
+
layout: "box";
|
6
|
+
position: "bottom left";
|
7
|
+
equalWeightButtons: true;
|
8
|
+
flipButtons: false;
|
9
|
+
};
|
10
|
+
preferencesModal: {
|
11
|
+
layout: "box";
|
12
|
+
position: "right";
|
13
|
+
equalWeightButtons: true;
|
14
|
+
flipButtons: false;
|
15
|
+
};
|
16
|
+
};
|
17
|
+
export default _default;
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/gui-options/index.ts"],"names":[],"mappings":"AAEA;oNACoN;;;;;;;;;;;;;;;AAEpN,wBAauB"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/** IMPORTANT NOTES FOR GDPR COMPLIANCE:
|
2
|
+
* > the "Accept" and "Reject" buttons should be equally weighted in terms of size, color, and font. This means that the buttons should be equally accessible and prominent– `equalWeightButtons` must be `true`. */
|
3
|
+
export default {
|
4
|
+
consentModal: {
|
5
|
+
layout: "box",
|
6
|
+
position: "bottom left",
|
7
|
+
equalWeightButtons: true, // IMPORTANT: MUST BE `true` TO BE GDPR-COMPLIANT
|
8
|
+
flipButtons: false,
|
9
|
+
},
|
10
|
+
preferencesModal: {
|
11
|
+
layout: "box",
|
12
|
+
position: "right", // not in use since we use "box" (aka a modal)– if we use "bar" (aka a drawer), this will be used
|
13
|
+
equalWeightButtons: true, // IMPORTANT: MUST BE `true` TO BE GDPR-COMPLIANT
|
14
|
+
flipButtons: false,
|
15
|
+
},
|
16
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* attach a MutationObserver the **first time** the user hovers over–
|
3
|
+
* enabling a limited "drag up" functionality for the floating button.
|
4
|
+
* > this is a purposeful UX enhancement to allow users to move the button
|
5
|
+
* out of the way in case it’s blocking content/functionality underneath.
|
6
|
+
*
|
7
|
+
* @usage simply attach this function to the `onmouseover` event of the floating button.
|
8
|
+
* @see {@link ./injectManageCookiePrefsButton.tsx HTMLDivElement["onmouseover"]} for the full implementation.
|
9
|
+
*/
|
10
|
+
declare const _default: <IsTouch extends boolean = false>() => HTMLDivElement[IsTouch extends true ? "ontouchstart" : "onmouseover"];
|
11
|
+
export default _default;
|
12
|
+
export type HTMLDivElementWithDragObserver = HTMLDivElement & {
|
13
|
+
_startX?: number | null;
|
14
|
+
_startY?: number | null;
|
15
|
+
};
|
16
|
+
/** determine whether the user "tapped" or "dragged" (open prefs if "tapped") */
|
17
|
+
export declare const ontouchend: HTMLDivElementWithDragObserver["ontouchend"];
|
18
|
+
/** store the touch start coordinates */
|
19
|
+
export declare const ontouchstart: HTMLDivElementWithDragObserver["ontouchstart"];
|
20
|
+
//# sourceMappingURL=cookiePrefsButtonDragObserver.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"cookiePrefsButtonDragObserver.d.ts","sourceRoot":"","sources":["../../../../src/config/gui-options/scripts/cookiePrefsButtonDragObserver.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;yBAuHG,OAAO,SAAS,OAAO,eAAe,cAAc,CAAC,OAAO,SAAS,IAAI,GAC3E,cAAc,GACd,aAAa,CAAC;AAxHlB,wBAwHoB;AAEpB,MAAM,MAAM,8BAA8B,GAAG,cAAc,GAAG;IAC5D,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,UAAU,EA0BlB,8BAA8B,CAAC,YAAY,CAAC,CAAC;AAElD,wCAAwC;AACxC,eAAO,MAAM,YAAY,EAOpB,8BAA8B,CAAC,cAAc,CAAC,CAAC"}
|
@@ -0,0 +1,143 @@
|
|
1
|
+
"use client";
|
2
|
+
import { showPreferences } from "@tilli-pro/cookieconsent";
|
3
|
+
import { buttonId } from "../html-components/ManageCookiePrefsButton";
|
4
|
+
/**
|
5
|
+
* attach a MutationObserver the **first time** the user hovers over–
|
6
|
+
* enabling a limited "drag up" functionality for the floating button.
|
7
|
+
* > this is a purposeful UX enhancement to allow users to move the button
|
8
|
+
* out of the way in case it’s blocking content/functionality underneath.
|
9
|
+
*
|
10
|
+
* @usage simply attach this function to the `onmouseover` event of the floating button.
|
11
|
+
* @see {@link ./injectManageCookiePrefsButton.tsx HTMLDivElement["onmouseover"]} for the full implementation.
|
12
|
+
*/
|
13
|
+
export default (function (e) {
|
14
|
+
/** we store a data-attribute (`hasTilliCookiePrefsDragObserverInit`) to avoid reattaching
|
15
|
+
* the logic on multiple hovers -- this ensures the script is only initiated once. */
|
16
|
+
if (this.dataset.hasTilliCookiePrefsDragObserverInit === "true")
|
17
|
+
return;
|
18
|
+
this.dataset.hasTilliCookiePrefsDragObserverInit = "true";
|
19
|
+
let isDragging = false;
|
20
|
+
let startY = 0;
|
21
|
+
let initialBottomPx = 0;
|
22
|
+
let hasListeners = false; // track whether we've attached the events yet
|
23
|
+
/** we'll dynamically calculate these values on the first drag */
|
24
|
+
let lowestBottomPx = 0;
|
25
|
+
let highestBottomPx = 0;
|
26
|
+
// DRAG LOGIC
|
27
|
+
function onMouseDown(e) {
|
28
|
+
if (e.button !== 0)
|
29
|
+
return; // only drag on left-click
|
30
|
+
e.preventDefault();
|
31
|
+
isDragging = true;
|
32
|
+
startY = e.clientY;
|
33
|
+
/** on each new drag, read the button’s *current* bottom */
|
34
|
+
const buttonStyle = window.getComputedStyle(this);
|
35
|
+
initialBottomPx = parseFloat(buttonStyle.bottom) || 16;
|
36
|
+
}
|
37
|
+
function onMouseMove(e) {
|
38
|
+
if (!isDragging)
|
39
|
+
return;
|
40
|
+
/** positive delta => pointer moving down => button goes up */
|
41
|
+
const dragDelta = startY - e.clientY;
|
42
|
+
let newBottomPx = initialBottomPx + dragDelta;
|
43
|
+
/** clamp between lowestBottomPx and highestBottomPx */
|
44
|
+
if (newBottomPx < lowestBottomPx)
|
45
|
+
newBottomPx = lowestBottomPx;
|
46
|
+
if (newBottomPx > highestBottomPx)
|
47
|
+
newBottomPx = highestBottomPx;
|
48
|
+
this.style.bottom = `${newBottomPx}px`;
|
49
|
+
}
|
50
|
+
function onMouseUp() {
|
51
|
+
isDragging = false;
|
52
|
+
}
|
53
|
+
// [mobile (touch) support]
|
54
|
+
// - we also want to allow dragging on touch devices
|
55
|
+
// - we're using the same logic as mouse dragging, but with touch events
|
56
|
+
function onTouchStart(e) {
|
57
|
+
if (e.touches?.length !== 1)
|
58
|
+
return; // only drag with one finger
|
59
|
+
e.preventDefault();
|
60
|
+
isDragging = true;
|
61
|
+
startY = e.touches[0]?.clientY ?? startY;
|
62
|
+
const buttonStyle = window.getComputedStyle(this);
|
63
|
+
initialBottomPx = parseFloat(buttonStyle.bottom) || 16;
|
64
|
+
}
|
65
|
+
function onTouchMove(e) {
|
66
|
+
if (!isDragging)
|
67
|
+
return;
|
68
|
+
if (!e.touches?.[0])
|
69
|
+
return;
|
70
|
+
const dragDelta = startY - e.touches[0].clientY;
|
71
|
+
let newBottomPx = initialBottomPx + dragDelta;
|
72
|
+
if (newBottomPx < lowestBottomPx)
|
73
|
+
newBottomPx = lowestBottomPx;
|
74
|
+
if (newBottomPx > highestBottomPx)
|
75
|
+
newBottomPx = highestBottomPx;
|
76
|
+
this.style.bottom = `${newBottomPx}px`;
|
77
|
+
}
|
78
|
+
function onTouchEnd() {
|
79
|
+
isDragging = false;
|
80
|
+
}
|
81
|
+
function attachDragEvents(buttonEl) {
|
82
|
+
if (hasListeners)
|
83
|
+
return; // only attach once
|
84
|
+
hasListeners = true;
|
85
|
+
/** determine max drag distance (based on button height) */
|
86
|
+
const buttonStyle = window.getComputedStyle(buttonEl);
|
87
|
+
const originalBottomPx = parseFloat(buttonStyle.bottom) || 16; // fallback to ~1rem
|
88
|
+
const buttonHeightPx = parseFloat(buttonStyle.height) || 32; // fallback to ~2rem
|
89
|
+
const maxDragPx = buttonHeightPx * 1.1; // added 10% extra to be safe
|
90
|
+
/** the user can drag from the original position (lowestBottomPx) up by that computed distance (highestBottomPx). */
|
91
|
+
lowestBottomPx = originalBottomPx;
|
92
|
+
highestBottomPx = originalBottomPx + maxDragPx;
|
93
|
+
/** attach the mouse events for dragging */
|
94
|
+
buttonEl.addEventListener("mousedown", onMouseDown.bind(buttonEl));
|
95
|
+
document.addEventListener("mousemove", onMouseMove.bind(buttonEl));
|
96
|
+
document.addEventListener("mouseup", onMouseUp);
|
97
|
+
// [mobile (touch) support]
|
98
|
+
buttonEl.addEventListener("touchstart", onTouchStart.bind(buttonEl));
|
99
|
+
document.addEventListener("touchmove", onTouchMove.bind(buttonEl));
|
100
|
+
document.addEventListener("touchend", onTouchEnd);
|
101
|
+
}
|
102
|
+
// MUTATION OBSERVER – for if the button is removed/re-added
|
103
|
+
const observer = new MutationObserver(() => {
|
104
|
+
const button = document.getElementById(buttonId);
|
105
|
+
if (!button) {
|
106
|
+
hasListeners = false; // if button was removed, reset flags
|
107
|
+
isDragging = false;
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
attachDragEvents(button);
|
111
|
+
});
|
112
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
113
|
+
/** if the button is already present, attach drag events immediately */
|
114
|
+
const button = document.getElementById(buttonId);
|
115
|
+
if (button)
|
116
|
+
attachDragEvents(button);
|
117
|
+
});
|
118
|
+
/** determine whether the user "tapped" or "dragged" (open prefs if "tapped") */
|
119
|
+
export const ontouchend = function ontouchend(e) {
|
120
|
+
const touch = e.changedTouches[0];
|
121
|
+
const { clientX: endX, clientY: endY } = touch ?? {};
|
122
|
+
if (!endX || !endY)
|
123
|
+
return;
|
124
|
+
/** retrieve stored start coordinates */
|
125
|
+
const startX = this._startX ?? endX;
|
126
|
+
const startY = this._startY ?? endY;
|
127
|
+
/** threshold for "same spot" */
|
128
|
+
const threshold = 10; // maximum allowable movement (in pixels)
|
129
|
+
/** make sure the user ended their touch in *relatively* the "same spot" as they started */
|
130
|
+
if (Math.abs(endX - startX) <= threshold &&
|
131
|
+
Math.abs(endY - startY) <= threshold)
|
132
|
+
/** user ended the touch near where it started, open preferences */
|
133
|
+
showPreferences(); /** prefer over `data-cc="show-preferencesModal"` -- @see https://cookieconsent.orestbida.com/reference/api-reference.html#showpreferences */
|
134
|
+
/** reset coordinates to avoid future issues */
|
135
|
+
this._startX = null;
|
136
|
+
this._startY = null;
|
137
|
+
};
|
138
|
+
/** store the touch start coordinates */
|
139
|
+
export const ontouchstart = function ontouchstart(e) {
|
140
|
+
const touch = e.touches[0];
|
141
|
+
this._startX = touch?.clientX;
|
142
|
+
this._startY = touch?.clientY;
|
143
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* force the "React Remove Scroll" wheel listener to be passive or not.
|
3
|
+
*
|
4
|
+
* @param isPassive - Set `true` to make it `{ passive: true }`,
|
5
|
+
* `false` for `{ passive: false }`.
|
6
|
+
*/
|
7
|
+
export declare function forceDisableReactRemoveScroll(isPassive: boolean, debug?: boolean): void;
|
8
|
+
/**
|
9
|
+
* inject event listeners for CookieConsent's modal show/hide events,
|
10
|
+
* toggling the "React Remove Scroll" listener's passive state.
|
11
|
+
*
|
12
|
+
* listens for:
|
13
|
+
* - "cc:onModalShow": If "preferencesModal", we set passive = true.
|
14
|
+
* - "cc:onModalHide": If "preferencesModal", we set passive = false.
|
15
|
+
*/
|
16
|
+
export declare function injectReactRemoveScrollToggle(): void;
|
17
|
+
//# sourceMappingURL=forceDisableReactRemoveScroll.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"forceDisableReactRemoveScroll.d.ts","sourceRoot":"","sources":["../../../../src/config/gui-options/scripts/forceDisableReactRemoveScroll.ts"],"names":[],"mappings":"AAmFA;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,OAAO,EAClB,KAAK,UAAQ,QA8Bd;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAoBpD"}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
"use client";
|
2
|
+
// IMPORTANT: this is a fix to force-disable the "React Remove Scroll" wheel listener -- this handles the edge case where there's a shadcn (radix-ui) dialog open underneath the cookie banner's "manage preferences" dialog, which prevents the user from scrolling within the manage prefs dialog.
|
3
|
+
/** IMPORTANT: this is what we'll be looking for in the listener's source code -- @see https://github.com/theKashey/react-remove-scroll/blob/master/src/SideEffect.tsx#L107-L145 */
|
4
|
+
const DISTINCTIVE_SUBSTRINGS = ["shards", "noIsolation"];
|
5
|
+
const eventListenersMap = new WeakMap();
|
6
|
+
let isPatched = false; // ensure patching happens only ONCE.
|
7
|
+
/** 🦧 monkey(orangutan)-patch `addEventListener` and `removeEventListener` to track listeners. */
|
8
|
+
function patchEventListeners() {
|
9
|
+
if (isPatched)
|
10
|
+
return; // prevent multiple patches
|
11
|
+
isPatched = true;
|
12
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
13
|
+
const originalAddEventListener = EventTarget.prototype.addEventListener;
|
14
|
+
EventTarget.prototype.addEventListener = function (type, listener, options) {
|
15
|
+
let records = eventListenersMap.get(this);
|
16
|
+
if (!records) {
|
17
|
+
records = [];
|
18
|
+
eventListenersMap.set(this, records);
|
19
|
+
}
|
20
|
+
records.push({ type, listener, options });
|
21
|
+
originalAddEventListener.call(this, type, listener, options);
|
22
|
+
};
|
23
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
24
|
+
const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
|
25
|
+
EventTarget.prototype.removeEventListener = function (type, listener, options) {
|
26
|
+
const records = eventListenersMap.get(this);
|
27
|
+
if (records) {
|
28
|
+
const index = records.findIndex((r) => r.type === type && r.listener === listener && r.options === options);
|
29
|
+
if (index !== -1) {
|
30
|
+
records.splice(index, 1);
|
31
|
+
if (records.length === 0)
|
32
|
+
eventListenersMap.delete(this);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
originalRemoveEventListener.call(this, type, listener, options);
|
36
|
+
};
|
37
|
+
}
|
38
|
+
/** attempt to find the "React Remove Scroll" wheel listeners by searching for unique strings in its source code */
|
39
|
+
const findReactRemoveScrollListeners = () =>
|
40
|
+
/** find all matching listeners that have ALL required substrings */
|
41
|
+
(eventListenersMap.get(document) ?? []).filter((record) => {
|
42
|
+
if (record.type === "wheel" ||
|
43
|
+
record.type === "touchmove" ||
|
44
|
+
record.type === "touchstart" ||
|
45
|
+
record.type === "pointerdown" ||
|
46
|
+
record.type === "click") {
|
47
|
+
const fnStr = record.listener.toString();
|
48
|
+
return DISTINCTIVE_SUBSTRINGS.every((sub) => fnStr.includes(sub));
|
49
|
+
}
|
50
|
+
return false;
|
51
|
+
});
|
52
|
+
/**
|
53
|
+
* force the "React Remove Scroll" wheel listener to be passive or not.
|
54
|
+
*
|
55
|
+
* @param isPassive - Set `true` to make it `{ passive: true }`,
|
56
|
+
* `false` for `{ passive: false }`.
|
57
|
+
*/
|
58
|
+
export function forceDisableReactRemoveScroll(isPassive, debug = false) {
|
59
|
+
const targets = findReactRemoveScrollListeners();
|
60
|
+
if (!targets || targets.length === 0) {
|
61
|
+
if (debug)
|
62
|
+
console.debug('No matching "React Remove Scroll" listener found.');
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
/** remove the existing listener */
|
66
|
+
for (const target of targets) {
|
67
|
+
document.removeEventListener(target.type, target.listener, target.options);
|
68
|
+
/** re-add with the new passive value */
|
69
|
+
document.addEventListener(target.type, target.listener, {
|
70
|
+
...(typeof target.options === "boolean" ? {} : target.options),
|
71
|
+
passive: isPassive,
|
72
|
+
});
|
73
|
+
if (debug)
|
74
|
+
console.debug(`"React Remove Scroll" ${target.type} listener set to passive: ${isPassive} (aka, we've ${isPassive ? "bypassed" : "re-enabled"} it)`);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* inject event listeners for CookieConsent's modal show/hide events,
|
79
|
+
* toggling the "React Remove Scroll" listener's passive state.
|
80
|
+
*
|
81
|
+
* listens for:
|
82
|
+
* - "cc:onModalShow": If "preferencesModal", we set passive = true.
|
83
|
+
* - "cc:onModalHide": If "preferencesModal", we set passive = false.
|
84
|
+
*/
|
85
|
+
export function injectReactRemoveScrollToggle() {
|
86
|
+
patchEventListeners(); // ensure patching happens only once
|
87
|
+
window.addEventListener("cc:onModalShow", (event) => {
|
88
|
+
const { detail } = event ?? {};
|
89
|
+
if (detail?.modalName === "preferencesModal")
|
90
|
+
forceDisableReactRemoveScroll(true); // force passive
|
91
|
+
});
|
92
|
+
window.addEventListener("cc:onModalHide", (event) => {
|
93
|
+
const { detail } = event ?? {};
|
94
|
+
if (detail?.modalName === "preferencesModal")
|
95
|
+
forceDisableReactRemoveScroll(false); // force non-passive
|
96
|
+
});
|
97
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/** injects the floating cookie consent "manage preferences" icon button into the DOM */
|
2
|
+
declare const inject: () => HTMLDivElement;
|
3
|
+
declare const _default: () => ReturnType<typeof inject>;
|
4
|
+
export default _default;
|
5
|
+
//# sourceMappingURL=injectManageCookiePrefsButton.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"injectManageCookiePrefsButton.d.ts","sourceRoot":"","sources":["../../../../src/config/gui-options/scripts/injectManageCookiePrefsButton.ts"],"names":[],"mappings":"AAaA,wFAAwF;AACxF,QAAA,MAAM,MAAM,QAAO,cAkBlB,CAAC;8BACiB,UAAU,CAAC,OAAO,MAAM,CAAC;AAA5C,wBAgBI"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use client";
|
2
|
+
import { showPreferences } from "@tilli-pro/cookieconsent";
|
3
|
+
import ManageCookiePrefsButton, { containerId, } from "../html-components/ManageCookiePrefsButton";
|
4
|
+
import cookiePrefsButtonDragObserver, { ontouchend, ontouchstart, } from "./cookiePrefsButtonDragObserver";
|
5
|
+
/** injects the floating cookie consent "manage preferences" icon button into the DOM */
|
6
|
+
const inject = () => {
|
7
|
+
const container = document.body.appendChild(Object.assign(document.createElement("div"), {
|
8
|
+
id: containerId,
|
9
|
+
innerHTML: ManageCookiePrefsButton( /* TODO: __LANGUAGE__ */),
|
10
|
+
onclick: showPreferences /** prefer over `data-cc="show-preferencesModal"` -- @see https://cookieconsent.orestbida.com/reference/api-reference.html#showpreferences */,
|
11
|
+
onmouseover: cookiePrefsButtonDragObserver,
|
12
|
+
// [mobile (touch) support]
|
13
|
+
ontouchend,
|
14
|
+
ontouchstart,
|
15
|
+
}));
|
16
|
+
/** load drag observer upon DOM injection (unfortunate fix to prevent the need for 2x "ontouchstart" events) */
|
17
|
+
cookiePrefsButtonDragObserver.call(container);
|
18
|
+
return container;
|
19
|
+
};
|
20
|
+
export default () => ((container) => {
|
21
|
+
/** observe the DOM (to handle the case where the injected manage prefs button somehow gets removed) */
|
22
|
+
new MutationObserver(() => {
|
23
|
+
const alreadyInjected = !!document.getElementById(containerId) ||
|
24
|
+
document.body.contains(container);
|
25
|
+
if (alreadyInjected)
|
26
|
+
return;
|
27
|
+
/** if the container is no longer in <body>, re-inject */
|
28
|
+
container = inject();
|
29
|
+
}).observe(document.body, { childList: true, subtree: true });
|
30
|
+
return container;
|
31
|
+
})(document.getElementById(containerId) ?? inject());
|
@@ -0,0 +1,227 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
revision: number;
|
3
|
+
guiOptions: {
|
4
|
+
consentModal: {
|
5
|
+
layout: "box";
|
6
|
+
position: "bottom left";
|
7
|
+
equalWeightButtons: true;
|
8
|
+
flipButtons: false;
|
9
|
+
};
|
10
|
+
preferencesModal: {
|
11
|
+
layout: "box";
|
12
|
+
position: "right";
|
13
|
+
equalWeightButtons: true;
|
14
|
+
flipButtons: false;
|
15
|
+
};
|
16
|
+
};
|
17
|
+
categories: {
|
18
|
+
necessary: {
|
19
|
+
enabled: true;
|
20
|
+
readOnly: true;
|
21
|
+
services: {
|
22
|
+
tilliX: {
|
23
|
+
label: string;
|
24
|
+
cookies: import("./cookies/types").CookieTableItem[];
|
25
|
+
};
|
26
|
+
};
|
27
|
+
};
|
28
|
+
functional: {
|
29
|
+
services: {
|
30
|
+
tilliX: {
|
31
|
+
label: string;
|
32
|
+
cookies: import("./cookies/types").CookieTableItem[];
|
33
|
+
};
|
34
|
+
};
|
35
|
+
autoClear: {
|
36
|
+
cookies: {
|
37
|
+
name: RegExp;
|
38
|
+
}[];
|
39
|
+
};
|
40
|
+
};
|
41
|
+
analytics: {
|
42
|
+
services: {
|
43
|
+
datadog: {
|
44
|
+
label: string;
|
45
|
+
cookies: import("./cookies/types").CookieTableItem[];
|
46
|
+
};
|
47
|
+
};
|
48
|
+
autoClear: {
|
49
|
+
cookies: {
|
50
|
+
name: RegExp;
|
51
|
+
}[];
|
52
|
+
};
|
53
|
+
};
|
54
|
+
};
|
55
|
+
language: {
|
56
|
+
default: string;
|
57
|
+
autoDetect: "browser";
|
58
|
+
translations: {
|
59
|
+
de: {
|
60
|
+
consentModal: {
|
61
|
+
title: string;
|
62
|
+
description: string;
|
63
|
+
acceptAllBtn: string;
|
64
|
+
acceptNecessaryBtn: string;
|
65
|
+
showPreferencesBtn: string;
|
66
|
+
revisionMessage: string;
|
67
|
+
footer: string;
|
68
|
+
};
|
69
|
+
preferencesModal: {
|
70
|
+
title: string;
|
71
|
+
acceptAllBtn: string;
|
72
|
+
acceptNecessaryBtn: string;
|
73
|
+
savePreferencesBtn: string;
|
74
|
+
closeIconLabel: string;
|
75
|
+
sections: ({
|
76
|
+
title: string;
|
77
|
+
description: string;
|
78
|
+
linkedCategory?: undefined;
|
79
|
+
cookieTable?: undefined;
|
80
|
+
} | {
|
81
|
+
title: string;
|
82
|
+
description: string;
|
83
|
+
linkedCategory: string;
|
84
|
+
cookieTable: {
|
85
|
+
headers: import("./cookies/types").CookieTableHeaders;
|
86
|
+
body: import("./cookies/types").CookieTableItem[];
|
87
|
+
};
|
88
|
+
})[];
|
89
|
+
};
|
90
|
+
};
|
91
|
+
en: {
|
92
|
+
consentModal: {
|
93
|
+
title: string;
|
94
|
+
description: string;
|
95
|
+
acceptAllBtn: string;
|
96
|
+
acceptNecessaryBtn: string;
|
97
|
+
showPreferencesBtn: string;
|
98
|
+
revisionMessage: string;
|
99
|
+
footer: string;
|
100
|
+
};
|
101
|
+
preferencesModal: {
|
102
|
+
title: string;
|
103
|
+
acceptAllBtn: string;
|
104
|
+
acceptNecessaryBtn: string;
|
105
|
+
savePreferencesBtn: string;
|
106
|
+
closeIconLabel: string;
|
107
|
+
sections: ({
|
108
|
+
title: string;
|
109
|
+
description: string;
|
110
|
+
linkedCategory?: undefined;
|
111
|
+
cookieTable?: undefined;
|
112
|
+
} | {
|
113
|
+
title: string;
|
114
|
+
description: string;
|
115
|
+
linkedCategory: string;
|
116
|
+
cookieTable: {
|
117
|
+
headers: import("./cookies/types").CookieTableHeaders;
|
118
|
+
body: import("./cookies/types").CookieTableItem[];
|
119
|
+
};
|
120
|
+
})[];
|
121
|
+
};
|
122
|
+
};
|
123
|
+
es: {
|
124
|
+
consentModal: {
|
125
|
+
title: string;
|
126
|
+
description: string;
|
127
|
+
acceptAllBtn: string;
|
128
|
+
acceptNecessaryBtn: string;
|
129
|
+
showPreferencesBtn: string;
|
130
|
+
revisionMessage: string;
|
131
|
+
footer: string;
|
132
|
+
};
|
133
|
+
preferencesModal: {
|
134
|
+
title: string;
|
135
|
+
acceptAllBtn: string;
|
136
|
+
acceptNecessaryBtn: string;
|
137
|
+
savePreferencesBtn: string;
|
138
|
+
closeIconLabel: string;
|
139
|
+
sections: ({
|
140
|
+
title: string;
|
141
|
+
description: string;
|
142
|
+
linkedCategory?: undefined;
|
143
|
+
cookieTable?: undefined;
|
144
|
+
} | {
|
145
|
+
title: string;
|
146
|
+
description: string;
|
147
|
+
linkedCategory: string;
|
148
|
+
cookieTable: {
|
149
|
+
headers: import("./cookies/types").CookieTableHeaders;
|
150
|
+
body: import("./cookies/types").CookieTableItem[];
|
151
|
+
};
|
152
|
+
})[];
|
153
|
+
};
|
154
|
+
};
|
155
|
+
fr: {
|
156
|
+
consentModal: {
|
157
|
+
title: string;
|
158
|
+
description: string;
|
159
|
+
acceptAllBtn: string;
|
160
|
+
acceptNecessaryBtn: string;
|
161
|
+
showPreferencesBtn: string;
|
162
|
+
revisionMessage: string;
|
163
|
+
footer: string;
|
164
|
+
};
|
165
|
+
preferencesModal: {
|
166
|
+
title: string;
|
167
|
+
acceptAllBtn: string;
|
168
|
+
acceptNecessaryBtn: string;
|
169
|
+
savePreferencesBtn: string;
|
170
|
+
closeIconLabel: string;
|
171
|
+
sections: ({
|
172
|
+
title: string;
|
173
|
+
description: string;
|
174
|
+
linkedCategory?: undefined;
|
175
|
+
cookieTable?: undefined;
|
176
|
+
} | {
|
177
|
+
title: string;
|
178
|
+
description: string;
|
179
|
+
linkedCategory: string;
|
180
|
+
cookieTable: {
|
181
|
+
headers: import("./cookies/types").CookieTableHeaders;
|
182
|
+
body: import("./cookies/types").CookieTableItem[];
|
183
|
+
};
|
184
|
+
})[];
|
185
|
+
};
|
186
|
+
};
|
187
|
+
it: {
|
188
|
+
consentModal: {
|
189
|
+
title: string;
|
190
|
+
description: string;
|
191
|
+
acceptAllBtn: string;
|
192
|
+
acceptNecessaryBtn: string;
|
193
|
+
showPreferencesBtn: string;
|
194
|
+
revisionMessage: string;
|
195
|
+
footer: string;
|
196
|
+
};
|
197
|
+
preferencesModal: {
|
198
|
+
title: string;
|
199
|
+
acceptAllBtn: string;
|
200
|
+
acceptNecessaryBtn: string;
|
201
|
+
savePreferencesBtn: string;
|
202
|
+
closeIconLabel: string;
|
203
|
+
sections: ({
|
204
|
+
title: string;
|
205
|
+
description: string;
|
206
|
+
linkedCategory?: undefined;
|
207
|
+
cookieTable?: undefined;
|
208
|
+
} | {
|
209
|
+
title: string;
|
210
|
+
description: string;
|
211
|
+
linkedCategory: string;
|
212
|
+
cookieTable: {
|
213
|
+
headers: import("./cookies/types").CookieTableHeaders;
|
214
|
+
body: import("./cookies/types").CookieTableItem[];
|
215
|
+
};
|
216
|
+
})[];
|
217
|
+
};
|
218
|
+
};
|
219
|
+
};
|
220
|
+
};
|
221
|
+
cookie: {
|
222
|
+
name: string;
|
223
|
+
};
|
224
|
+
hideFromBots: boolean;
|
225
|
+
};
|
226
|
+
export default _default;
|
227
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,wBAOgC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { env } from "~/_env";
|
2
|
+
import { COOKIE_PREFERENCES_COOKIE_NAME, REVISION } from "../_consts";
|
3
|
+
import categories from "./categories";
|
4
|
+
import guiOptions from "./gui-options";
|
5
|
+
import translations from "./translations";
|
6
|
+
export default {
|
7
|
+
revision: REVISION,
|
8
|
+
guiOptions,
|
9
|
+
categories,
|
10
|
+
language: { default: "en", autoDetect: "browser", translations },
|
11
|
+
cookie: { name: COOKIE_PREFERENCES_COOKIE_NAME },
|
12
|
+
hideFromBots: env.NODE_ENV === "production", // disabled in local dev to enable ui-testing (via Playwright)
|
13
|
+
};
|