@tilli-pro/cookieconsent-plugin 0.7.91 → 0.7.93
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 -1
- package/demos/demo.html +2 -2
- package/demos/demo.min.html +1 -1
- package/demos/demo.styles.dark.html +2 -2
- package/demos/demo.styles.dark.min.html +1 -1
- package/demos/demo.styles.nudge-website.dark.html +2 -2
- package/demos/demo.styles.nudge-website.dark.min.html +1 -1
- package/demos/demo.styles.nudge-website.light.html +2 -2
- package/demos/demo.styles.nudge-website.light.min.html +1 -1
- package/demos/demo.styles.nudge.dark.html +2 -2
- package/demos/demo.styles.nudge.dark.min.html +1 -1
- package/demos/demo.styles.nudge.light.html +2 -2
- package/demos/demo.styles.nudge.light.min.html +1 -1
- package/demos/demo.styles.tenant_con-edison.dark.html +2 -2
- package/demos/demo.styles.tenant_con-edison.dark.min.html +1 -1
- package/demos/demo.styles.tenant_con-edison.light.html +2 -2
- package/demos/demo.styles.tenant_con-edison.light.min.html +1 -1
- package/demos/demo.styles.tenant_freeman.dark.html +2 -2
- package/demos/demo.styles.tenant_freeman.dark.min.html +1 -1
- package/demos/demo.styles.tenant_freeman.light.html +2 -2
- package/demos/demo.styles.tenant_freeman.light.min.html +1 -1
- package/demos/demo.styles.tenant_frontier.dark.html +2 -2
- package/demos/demo.styles.tenant_frontier.dark.min.html +1 -1
- package/demos/demo.styles.tenant_frontier.light.html +2 -2
- package/demos/demo.styles.tenant_frontier.light.min.html +1 -1
- package/demos/demo.styles.tenant_oru.dark.html +2 -2
- package/demos/demo.styles.tenant_oru.dark.min.html +1 -1
- package/demos/demo.styles.tenant_oru.light.html +2 -2
- package/demos/demo.styles.tenant_oru.light.min.html +1 -1
- package/demos/demo.styles.tilli-pay.dark.html +2 -2
- package/demos/demo.styles.tilli-pay.dark.min.html +1 -1
- package/demos/demo.styles.tilli-pay.light.html +2 -2
- package/demos/demo.styles.tilli-pay.light.min.html +1 -1
- package/demos/demo.styles.tilli-website.dark.html +2 -2
- package/demos/demo.styles.tilli-website.dark.min.html +1 -1
- package/demos/demo.styles.tilli-website.light.html +2 -2
- package/demos/demo.styles.tilli-website.light.min.html +1 -1
- package/dist/config/gui-options/scripts/injectUTM.d.ts.map +1 -1
- package/dist/config/gui-options/scripts/injectUTM.js +8 -4
- package/dist/init.d.ts +1 -1
- package/dist/init.js +2 -2
- package/package.json +1 -1
- package/src/config/gui-options/scripts/injectUTM.ts +16 -9
- package/src/init.ts +2 -2
@@ -54,13 +54,18 @@ const A_TAG_IDS_TO_INJECT_UTM_PARAMETERS = [
|
|
54
54
|
"tilli-cc-privacy-policy-link-preferences",
|
55
55
|
];
|
56
56
|
|
57
|
-
export const injectUTMParametersIntoATags = (
|
57
|
+
export const injectUTMParametersIntoATags = (
|
58
|
+
maxAttempts = Infinity, // handle edge case where the a tags are not yet loaded (e.g., for the preferences modal)
|
59
|
+
attempt = 1,
|
60
|
+
) => {
|
58
61
|
const _preferences = {
|
59
62
|
...DEFAULT_UTM_PARAMETERS,
|
60
63
|
source: new URL(window.location.href).hostname, // use the hostname of the current page as the source
|
61
64
|
};
|
62
65
|
|
63
|
-
const
|
66
|
+
const ccMain = document.getElementById("cc-main");
|
67
|
+
const aTags = ccMain?.querySelectorAll("a") ?? [];
|
68
|
+
|
64
69
|
aTags.forEach((aTag) => {
|
65
70
|
if (A_TAG_IDS_TO_INJECT_UTM_PARAMETERS.includes(aTag.id)) {
|
66
71
|
const parameters = aTag.id.endsWith("-preferences")
|
@@ -80,7 +85,7 @@ export const injectUTMParametersIntoATags = (maxAttempts = 30, attempt = 1) => {
|
|
80
85
|
setTimeout(
|
81
86
|
() => injectUTMParametersIntoATags(maxAttempts, attempt + 1),
|
82
87
|
1_000,
|
83
|
-
);
|
88
|
+
);
|
84
89
|
};
|
85
90
|
|
86
91
|
/**
|
@@ -101,12 +106,14 @@ export const addUTMParameters = (
|
|
101
106
|
);
|
102
107
|
|
103
108
|
// add new parameters
|
104
|
-
Object.entries(parameters)
|
105
|
-
(
|
106
|
-
|
107
|
-
value
|
108
|
-
|
109
|
-
|
109
|
+
Object.entries(parameters)
|
110
|
+
.sort((a, b) => a[0].localeCompare(b[0])) // sort alphabetically by key (to ensure consistent order)
|
111
|
+
.forEach(
|
112
|
+
([key, value]) =>
|
113
|
+
!!value &&
|
114
|
+
value !== "unknown" &&
|
115
|
+
url.searchParams.set(`utm_${key}`, value),
|
116
|
+
);
|
110
117
|
|
111
118
|
return url;
|
112
119
|
};
|
package/src/init.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import "https://cdn.jsdelivr.net/gh/tilli-pro/cookieconsent@
|
1
|
+
import "https://cdn.jsdelivr.net/gh/tilli-pro/cookieconsent@bf2244f41a3ae21bfd7699cb77908c031b897d91/dist/cookieconsent.umd.js";
|
2
2
|
|
3
3
|
import type * as _CookieConsent from "@tilli-pro/cookieconsent";
|
4
4
|
import type { CookieConsentConfig } from "@tilli-pro/cookieconsent";
|
@@ -18,7 +18,7 @@ declare global {
|
|
18
18
|
}
|
19
19
|
}
|
20
20
|
|
21
|
-
const GIT_SHA = "
|
21
|
+
const GIT_SHA = "bf2244f41a3ae21bfd7699cb77908c031b897d91";
|
22
22
|
const GIT_REPO = "tilli-pro/cookieconsent";
|
23
23
|
const GIT_CDN_BASE_URL = "https://cdn.jsdelivr.net/gh";
|
24
24
|
const GIT_CDN_URL = `${GIT_CDN_BASE_URL}/${GIT_REPO}@${GIT_SHA}`;
|