@tilli-pro/cookieconsent-plugin 0.6.0 → 0.7.23

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.
Files changed (95) hide show
  1. package/.cache/tsbuildinfo.json +1 -1
  2. package/demos/demo.html +3 -3
  3. package/demos/demo.min.html +1 -1
  4. package/demos/demo.styles.dark.html +10 -1
  5. package/demos/demo.styles.dark.min.html +9 -0
  6. package/demos/demo.styles.nudge.dark.html +18 -0
  7. package/demos/demo.styles.nudge.dark.min.html +9 -0
  8. package/demos/demo.styles.nudge.light.html +18 -0
  9. package/demos/demo.styles.nudge.light.min.html +9 -0
  10. package/demos/demo.styles.tenant_con-edison.dark.html +18 -0
  11. package/demos/demo.styles.tenant_con-edison.dark.min.html +9 -0
  12. package/demos/demo.styles.tenant_con-edison.light.html +18 -0
  13. package/demos/demo.styles.tenant_con-edison.light.min.html +9 -0
  14. package/demos/demo.styles.tenant_freeman.dark.html +18 -0
  15. package/demos/demo.styles.tenant_freeman.dark.min.html +9 -0
  16. package/demos/demo.styles.tenant_freeman.light.html +18 -0
  17. package/demos/demo.styles.tenant_frontier.dark.html +18 -0
  18. package/demos/demo.styles.tenant_frontier.dark.min.html +9 -0
  19. package/demos/demo.styles.tenant_frontier.light.html +18 -0
  20. package/demos/demo.styles.tenant_frontier.light.min.html +9 -0
  21. package/demos/demo.styles.tenant_oru.dark.html +18 -0
  22. package/demos/demo.styles.tenant_oru.dark.min.html +9 -0
  23. package/demos/demo.styles.tenant_oru.light.html +18 -0
  24. package/demos/demo.styles.tenant_oru.light.min.html +10 -0
  25. package/demos/demo.styles.tilli-pay.dark.html +18 -0
  26. package/demos/demo.styles.tilli-pay.dark.min.html +9 -0
  27. package/demos/demo.styles.tilli-pay.light.html +18 -0
  28. package/demos/demo.styles.tilli-pay.light.min.html +9 -0
  29. package/demos/demo.styles.tilli-website.dark.html +18 -0
  30. package/demos/demo.styles.tilli-website.dark.min.html +9 -0
  31. package/demos/demo.styles.tilli-website.light.html +18 -0
  32. package/demos/demo.styles.tilli-website.light.min.html +9 -0
  33. package/dist/_types.d.ts +1 -1
  34. package/dist/_types.d.ts.map +1 -1
  35. package/dist/_utils.d.ts +2 -2
  36. package/dist/_utils.d.ts.map +1 -1
  37. package/dist/_utils.js +2 -0
  38. package/dist/config/gui-options/html-components/ManageCookiePrefsButton.d.ts.map +1 -1
  39. package/dist/config/gui-options/html-components/ManageCookiePrefsButton.js +3 -0
  40. package/dist/config/gui-options/html-components/assets/CookieIcon.js +1 -1
  41. package/dist/init/nudge-website.d.ts +2 -0
  42. package/dist/init/nudge-website.d.ts.map +1 -0
  43. package/dist/init/nudge-website.js +124 -0
  44. package/dist/init/nudge.d.ts +2 -0
  45. package/dist/init/nudge.d.ts.map +1 -0
  46. package/dist/init/nudge.js +32 -0
  47. package/dist/init/tilli-pay-website.d.ts +2 -0
  48. package/dist/init/tilli-pay-website.d.ts.map +1 -0
  49. package/dist/init/tilli-pay-website.js +204 -0
  50. package/dist/init/tilli-pay.d.ts +2 -0
  51. package/dist/init/tilli-pay.d.ts.map +1 -0
  52. package/dist/init/tilli-pay.js +22 -0
  53. package/dist/init/tilli-website.js +188 -2
  54. package/dist/init/tilliX.d.ts +2 -0
  55. package/dist/init/tilliX.d.ts.map +1 -0
  56. package/dist/init/tilliX.js +24 -0
  57. package/dist/init/utils.script.d.ts +26 -0
  58. package/dist/init/utils.script.d.ts.map +1 -0
  59. package/dist/init/utils.script.js +63 -0
  60. package/dist/init.d.ts +1 -1
  61. package/dist/init.d.ts.map +1 -1
  62. package/dist/init.js +4 -2
  63. package/dist/styles/index.d.ts +5 -0
  64. package/dist/styles/index.d.ts.map +1 -1
  65. package/dist/styles/index.js +5 -0
  66. package/dist/styles/nudge.css +121 -0
  67. package/dist/styles/tenants/con-edison.css +157 -0
  68. package/dist/styles/tenants/freeman.css +56 -1
  69. package/dist/styles/tenants/frontier.css +59 -2
  70. package/dist/styles/tenants/oru.css +157 -0
  71. package/dist/styles/tilli-pay.css +121 -0
  72. package/dist/styles/tilli-website.css +121 -0
  73. package/package.json +1 -1
  74. package/src/_types.ts +3 -2
  75. package/src/_utils.ts +5 -3
  76. package/src/config/gui-options/html-components/ManageCookiePrefsButton.ts +3 -0
  77. package/src/config/gui-options/html-components/assets/CookieIcon.ts +1 -1
  78. package/src/init/nudge-website.ts +140 -0
  79. package/src/init/nudge.ts +45 -0
  80. package/src/init/tilli-pay-website.ts +221 -0
  81. package/src/init/tilli-pay.ts +35 -0
  82. package/src/init/tilli-website.ts +192 -2
  83. package/src/init/tilliX.ts +37 -0
  84. package/src/init/utils.script.ts +72 -0
  85. package/src/init.ts +4 -2
  86. package/src/styles/index.ts +5 -0
  87. package/src/styles/nudge.css +121 -0
  88. package/src/styles/tenants/con-edison.css +157 -0
  89. package/src/styles/tenants/freeman.css +56 -1
  90. package/src/styles/tenants/frontier.css +59 -2
  91. package/src/styles/tenants/oru.css +157 -0
  92. package/src/styles/tilli-pay.css +121 -0
  93. package/src/styles/tilli-website.css +121 -0
  94. package/demos/demo.styles.freeman.html +0 -9
  95. package/demos/demo.styles.frontier.html +0 -9
@@ -0,0 +1,221 @@
1
+ import type { CookieConsentConfig } from "@tilli-pro/cookieconsent";
2
+
3
+ import _config from "../config";
4
+ import { run } from "../init";
5
+ import {
6
+ makeInitFn,
7
+ stripInvalidLinkedCategoriesFromTranslations,
8
+ } from "./utils";
9
+
10
+ // TODO: migrate from monay.com to tillipay.com
11
+
12
+ const categories: CookieConsentConfig["categories"] = {
13
+ necessary: {
14
+ enabled: true, // "necessary" category is always enabled.
15
+ readOnly: true,
16
+ services: {
17
+ "Session": {
18
+ label: "Session",
19
+ cookies: [
20
+ {
21
+ name: /^(_scc_session)/, // session ID for core functionality
22
+ },
23
+ ],
24
+ },
25
+ },
26
+ },
27
+ functional: {
28
+ services: {
29
+ "Hubspot": {
30
+ label: "Hubspot",
31
+ cookies: [
32
+ {
33
+ name: /^(messagesUtk)/, // Hubspot (chat user identity)
34
+ domain: ".monay.com",
35
+ },
36
+ ],
37
+ },
38
+ },
39
+ autoClear: {
40
+ // TODO: DRY this with the services above
41
+ cookies: [
42
+ /** Hubspot */
43
+ {
44
+ name: /^(messagesUtk)/, // Hubspot (chat user identity)
45
+ domain: ".monay.com",
46
+ },
47
+ ],
48
+ },
49
+ },
50
+ analytics: {
51
+ services: {
52
+ "Google Analytics": {
53
+ label: "Google Analytics",
54
+ cookies: [
55
+ {
56
+ name: /^(_ga_)/, // Google Analytics
57
+ domain: "tilli.pro",
58
+ },
59
+ ],
60
+ },
61
+ "TelemetryDeck": {
62
+ label: "TelemetryDeck",
63
+ cookies: [
64
+ {
65
+ name: /^(_tccl_)/, // TelemetryDeck
66
+ domain: "tilli.pro",
67
+ },
68
+ ],
69
+ },
70
+ },
71
+ autoClear: {
72
+ // TODO: DRY this with the services above
73
+ cookies: [
74
+ /** Google Analytics */
75
+ {
76
+ name: /^(_ga_)/, // Google Analytics
77
+ domain: "tilli.pro",
78
+ },
79
+
80
+ /** TelemetryDeck */
81
+ {
82
+ name: /^(_tccl_)/, // TelemetryDeck
83
+ domain: "tilli.pro",
84
+ },
85
+ ],
86
+ },
87
+ },
88
+ marketing: {
89
+ services: {
90
+ "Hubspot": {
91
+ label: "Hubspot",
92
+ cookies: [
93
+ {
94
+ name: /^(__hs)/, // Hubspot (Session Tracking)
95
+ domain: "tilli.pro",
96
+ },
97
+ {
98
+ name: /^(hubspotutk)/, // Hubspot (User Tracking)
99
+ domain: "tilli.pro",
100
+ },
101
+ {
102
+ name: /^(__cf_bm)/, // Hubspot (Analytics - Cloudfare)
103
+ domain: ".hs-analytics.net",
104
+ },
105
+ {
106
+ name: /^(__cf_bm)/, // Hubspot (Banner - Cloudfare)
107
+ domain: ".hs-banner.com",
108
+ },
109
+ {
110
+ name: /^(__cf_bm)/, // Hubspot (Scripts - Cloudfare)
111
+ domain: ".hs-scripts.com",
112
+ },
113
+ {
114
+ name: /^(__cf_bm)/, // Hubspot (Adspixel - Cloudfare)
115
+ domain: ".hsadspixel.net",
116
+ },
117
+ {
118
+ name: /^(__cf_bm)/, // Hubspot (Twitter - Cloudfare)
119
+ domain: ".t.co",
120
+ },
121
+ {
122
+ name: /^(__cf_bm)/, // Hubspot (User Messages - Cloudfare)
123
+ domain: ".usermessages.com",
124
+ },
125
+ {
126
+ name: /^(_cfuvid)/, // Hubspot (Visitor ID - Cloudfare)
127
+ domain: ".hubspot.com",
128
+ },
129
+ ],
130
+ },
131
+ "Facebook": {
132
+ label: "Facebook",
133
+ cookies: [
134
+ {
135
+ name: /^(_fb)/, // Facebook (ads)
136
+ domain: "tilli.pro",
137
+ },
138
+ ],
139
+ },
140
+ "Twitter": {
141
+ label: "Twitter",
142
+ cookies: [
143
+ {
144
+ name: /^(muc_ads)/, // Twitter (ads)
145
+ domain: ".t.co",
146
+ },
147
+ ],
148
+ },
149
+ },
150
+ autoClear: {
151
+ // TODO: DRY this with the services above
152
+ cookies: [
153
+ /** Hubspot */
154
+ {
155
+ name: /^(__hs)/, // Hubspot (Session Tracking)
156
+ domain: "tilli.pro",
157
+ },
158
+ {
159
+ name: /^(__cf_bm)/, // Hubspot (Analytics - Cloudfare)
160
+ domain: ".hs-analytics.net",
161
+ },
162
+ {
163
+ name: /^(__cf_bm)/, // Hubspot (Banner - Cloudfare)
164
+ domain: ".hs-banner.com",
165
+ },
166
+ {
167
+ name: /^(__cf_bm)/, // Hubspot (Scripts - Cloudfare)
168
+ domain: ".hs-scripts.com",
169
+ },
170
+ {
171
+ name: /^(__cf_bm)/, // Hubspot (Adspixel - Cloudfare)
172
+ domain: ".hsadspixel.net",
173
+ },
174
+ {
175
+ name: /^(__cf_bm)/, // Hubspot (Twitter - Cloudfare)
176
+ domain: ".t.co",
177
+ },
178
+ {
179
+ name: /^(__cf_bm)/, // Hubspot (User Messages - Cloudfare)
180
+ domain: ".usermessages.com",
181
+ },
182
+ {
183
+ name: /^(_cfuvid)/, // Hubspot (Visitor ID - Cloudfare)
184
+ domain: ".hubspot.com",
185
+ },
186
+
187
+ /** Facebook */
188
+ {
189
+ name: /^(_fb)/, // Facebook (ads)
190
+ domain: "tilli.pro",
191
+ },
192
+
193
+ /** Twitter */
194
+ {
195
+ name: /^(muc_ads)/, // Twitter (ads)
196
+ domain: ".t.co",
197
+ },
198
+ ],
199
+ },
200
+ },
201
+ };
202
+
203
+ // TODO: DRY further w/ `./brf.ts`
204
+ const language: CookieConsentConfig["language"] = {
205
+ ..._config.language,
206
+ translations: stripInvalidLinkedCategoriesFromTranslations(
207
+ _config.language.translations,
208
+ categories,
209
+ true, // clear cookie tables // FIXME: refactor this to actually just use the proper cookie table accoring to the categories var
210
+ ),
211
+ };
212
+
213
+ const config: CookieConsentConfig = {
214
+ ..._config,
215
+ categories,
216
+ language,
217
+ };
218
+
219
+ // console.debug({ config }, "Initializing Cookie Consent (tilli Website)...");
220
+ const init = makeInitFn(run, config);
221
+ void init();
@@ -0,0 +1,35 @@
1
+ import type { CookieConsentConfig } from "@tilli-pro/cookieconsent";
2
+
3
+ import _config from "../config";
4
+ import { run } from "../init";
5
+ import {
6
+ makeInitFn,
7
+ stripInvalidLinkedCategoriesFromTranslations,
8
+ } from "./utils";
9
+
10
+ const categories: CookieConsentConfig["categories"] = {
11
+ necessary: {
12
+ enabled: true, // "necessary" category is always enabled.
13
+ readOnly: true,
14
+ },
15
+ };
16
+
17
+ // TODO: DRY further w/ `./brf.ts`
18
+ const language: CookieConsentConfig["language"] = {
19
+ ..._config.language,
20
+ translations: stripInvalidLinkedCategoriesFromTranslations(
21
+ _config.language.translations,
22
+ categories,
23
+ true, // clear cookie tables // FIXME: refactor this to actually just use the proper cookie table accoring to the categories var
24
+ ),
25
+ };
26
+
27
+ const config: CookieConsentConfig = {
28
+ ..._config,
29
+ categories,
30
+ language,
31
+ };
32
+
33
+ // console.debug({ config }, "Initializing Cookie Consent (tilli Website)...");
34
+ const init = makeInitFn(run, config);
35
+ void init();
@@ -11,9 +11,199 @@ const categories: CookieConsentConfig["categories"] = {
11
11
  necessary: {
12
12
  enabled: true, // "necessary" category is always enabled.
13
13
  readOnly: true,
14
+ services: {
15
+ "Session": {
16
+ label: "Session",
17
+ cookies: [
18
+ {
19
+ name: /^(_scc_session)/, // session ID for core functionality
20
+ },
21
+ ],
22
+ },
23
+ },
24
+ },
25
+ analytics: {
26
+ services: {
27
+ "Google Analytics": {
28
+ label: "Google Analytics",
29
+ cookies: [
30
+ {
31
+ name: /^(_ga_)/, // Google Analytics
32
+ domain: "tilli.pro",
33
+ },
34
+ ],
35
+ },
36
+ "TelemetryDeck": {
37
+ label: "TelemetryDeck",
38
+ cookies: [
39
+ {
40
+ name: /^(_tccl_)/, // TelemetryDeck
41
+ domain: "tilli.pro",
42
+ },
43
+ ],
44
+ },
45
+ },
46
+ autoClear: {
47
+ // TODO: DRY this with the services above
48
+ cookies: [
49
+ /** Google Analytics */
50
+ {
51
+ name: /^(_ga_)/, // Google Analytics
52
+ domain: "tilli.pro",
53
+ },
54
+
55
+ /** TelemetryDeck */
56
+ {
57
+ name: /^(_tccl_)/, // TelemetryDeck
58
+ domain: "tilli.pro",
59
+ },
60
+ ],
61
+ },
62
+ },
63
+ marketing: {
64
+ services: {
65
+ "Google Tag Manager": {
66
+ label: "Google Tag Manager",
67
+ cookies: [
68
+ {
69
+ name: /^(_gtm_)/, // Google Tag Manager
70
+ domain: "tilli.pro",
71
+ },
72
+ {
73
+ name: /^(_gat)/, // Google Tag Manager (analytics)
74
+ domain: "tilli.pro",
75
+ },
76
+ {
77
+ name: /^(_gid)/, // Google Tag Manager (session ID)
78
+ domain: "tilli.pro",
79
+ },
80
+ ],
81
+ },
82
+ "Hubspot": {
83
+ label: "Hubspot",
84
+ cookies: [
85
+ {
86
+ name: /^(__hs)/, // Hubspot (Session Tracking)
87
+ domain: "tilli.pro",
88
+ },
89
+ {
90
+ name: /^(hubspotutk)/, // Hubspot (User Tracking)
91
+ domain: "tilli.pro",
92
+ },
93
+ {
94
+ name: /^(__cf_bm)/, // Hubspot (Analytics - Cloudfare)
95
+ domain: ".hs-analytics.net",
96
+ },
97
+ {
98
+ name: /^(__cf_bm)/, // Hubspot (Banner - Cloudfare)
99
+ domain: ".hs-banner.com",
100
+ },
101
+ {
102
+ name: /^(__cf_bm)/, // Hubspot (Scripts - Cloudfare)
103
+ domain: ".hs-scripts.com",
104
+ },
105
+ {
106
+ name: /^(__cf_bm)/, // Hubspot (Adspixel - Cloudfare)
107
+ domain: ".hsadspixel.net",
108
+ },
109
+ {
110
+ name: /^(__cf_bm)/, // Hubspot (Twitter - Cloudfare)
111
+ domain: ".t.co",
112
+ },
113
+ {
114
+ name: /^(__cf_bm)/, // Hubspot (User Messages - Cloudfare)
115
+ domain: ".usermessages.com",
116
+ },
117
+ {
118
+ name: /^(_cfuvid)/, // Hubspot (Visitor ID - Cloudfare)
119
+ domain: ".hubspot.com",
120
+ },
121
+ ],
122
+ },
123
+ "Facebook": {
124
+ label: "Facebook",
125
+ cookies: [
126
+ {
127
+ name: /^(_fb)/, // Facebook (ads)
128
+ domain: "tilli.pro",
129
+ },
130
+ ],
131
+ },
132
+ "Twitter": {
133
+ label: "Twitter",
134
+ cookies: [
135
+ {
136
+ name: /^(muc_ads)/, // Twitter (ads)
137
+ domain: ".t.co",
138
+ },
139
+ ],
140
+ },
141
+ },
142
+ autoClear: {
143
+ // TODO: DRY this with the services above
144
+ cookies: [
145
+ /** Google Tag Manager */
146
+ {
147
+ name: /^(_gtm_)/, // Google Tag Manager
148
+ domain: "tilli.pro",
149
+ },
150
+ {
151
+ name: /^(_gat)/, // Google Tag Manager (analytics)
152
+ domain: "tilli.pro",
153
+ },
154
+ {
155
+ name: /^(_gid)/, // Google Tag Manager (session ID)
156
+ domain: "tilli.pro",
157
+ },
158
+
159
+ /** Hubspot */
160
+ {
161
+ name: /^(__hs)/, // Hubspot (Session Tracking)
162
+ domain: "tilli.pro",
163
+ },
164
+ {
165
+ name: /^(__cf_bm)/, // Hubspot (Analytics - Cloudfare)
166
+ domain: ".hs-analytics.net",
167
+ },
168
+ {
169
+ name: /^(__cf_bm)/, // Hubspot (Banner - Cloudfare)
170
+ domain: ".hs-banner.com",
171
+ },
172
+ {
173
+ name: /^(__cf_bm)/, // Hubspot (Scripts - Cloudfare)
174
+ domain: ".hs-scripts.com",
175
+ },
176
+ {
177
+ name: /^(__cf_bm)/, // Hubspot (Adspixel - Cloudfare)
178
+ domain: ".hsadspixel.net",
179
+ },
180
+ {
181
+ name: /^(__cf_bm)/, // Hubspot (Twitter - Cloudfare)
182
+ domain: ".t.co",
183
+ },
184
+ {
185
+ name: /^(__cf_bm)/, // Hubspot (User Messages - Cloudfare)
186
+ domain: ".usermessages.com",
187
+ },
188
+ {
189
+ name: /^(_cfuvid)/, // Hubspot (Visitor ID - Cloudfare)
190
+ domain: ".hubspot.com",
191
+ },
192
+
193
+ /** Facebook */
194
+ {
195
+ name: /^(_fb)/, // Facebook (ads)
196
+ domain: "tilli.pro",
197
+ },
198
+
199
+ /** Twitter */
200
+ {
201
+ name: /^(muc_ads)/, // Twitter (ads)
202
+ domain: ".t.co",
203
+ },
204
+ ],
205
+ },
14
206
  },
15
- analytics: {},
16
- marketing: {},
17
207
  };
18
208
 
19
209
  // TODO: DRY further w/ `./brf.ts`
@@ -0,0 +1,37 @@
1
+ import type { CookieConsentConfig } from "@tilli-pro/cookieconsent";
2
+
3
+ import _config from "../config";
4
+ import { run } from "../init";
5
+ import {
6
+ makeInitFn,
7
+ stripInvalidLinkedCategoriesFromTranslations,
8
+ } from "./utils";
9
+
10
+ const categories: CookieConsentConfig["categories"] = {
11
+ necessary: {
12
+ enabled: true, // "necessary" category is always enabled.
13
+ readOnly: true,
14
+ },
15
+ functional: {},
16
+ analytics: {},
17
+ };
18
+
19
+ // TODO: DRY further w/ `./brf.ts`
20
+ const language: CookieConsentConfig["language"] = {
21
+ ..._config.language,
22
+ translations: stripInvalidLinkedCategoriesFromTranslations(
23
+ _config.language.translations,
24
+ categories,
25
+ true, // clear cookie tables // FIXME: refactor this to actually just use the proper cookie table accoring to the categories var
26
+ ),
27
+ };
28
+
29
+ const config: CookieConsentConfig = {
30
+ ..._config,
31
+ categories,
32
+ language,
33
+ };
34
+
35
+ // console.debug({ config }, "Initializing Cookie Consent (tilli Website)...");
36
+ const init = makeInitFn(run, config);
37
+ void init();
@@ -0,0 +1,72 @@
1
+ /** extracts the `theme` parameter from the script URL */
2
+ export function getThemeFromScriptUrl(scriptUrl: string): string | null {
3
+ const url = new URL(scriptUrl, document.baseURI);
4
+ return url.searchParams.get("theme");
5
+ }
6
+
7
+ /** adds a `cc--<theme>` CSS class to the <html> element, if not already present */
8
+ export function addHtmlClass(theme: string): void {
9
+ const className = `cc--${theme}`;
10
+ const htmlEl = document.documentElement;
11
+
12
+ if (!htmlEl.classList.contains(className)) htmlEl.classList.add(className);
13
+ }
14
+
15
+ /**
16
+ * determines the URL of the currently executing script
17
+ * - (works for both ES modules (`import.meta.url`) and classic scripts (`document.currentScript`))
18
+ * @returns The script URL, or `undefined` if it cannot be determined.
19
+ */
20
+ export function getCurrentScriptUrl(): string | undefined {
21
+ if (
22
+ typeof document !== "undefined" &&
23
+ document.currentScript instanceof HTMLScriptElement
24
+ ) return document.currentScript.src;
25
+
26
+ if (
27
+ typeof import.meta !== "undefined" &&
28
+ typeof import.meta.url === "string"
29
+ ) return import.meta.url;
30
+
31
+ console.warn("[cc-plugin]: unable to resolve current script URL");
32
+ return undefined;
33
+ }
34
+
35
+ /**
36
+ * inits theme by reading the `theme` query param from the provided script URL (or auto-detected script)
37
+ * and then adding the corresponding CSS class to <html>.
38
+ *
39
+ * @param scriptUrl - Optional explicit URL; if omitted, auto-detection is used
40
+ *
41
+ * @usage in an ES module entry point:
42
+ * import { initTheme } from './init/utils.script.ts';
43
+ * initTheme(import.meta.url);
44
+ *
45
+ * @usage in a classic script:
46
+ * import { initTheme } from './init/utils.script.ts';
47
+ * initTheme();
48
+ */
49
+ export function initTheme(scriptUrl?: string): void {
50
+ const src = scriptUrl ?? getCurrentScriptUrl();
51
+ if (!src) return;
52
+
53
+ /** first, try to get theme from the direct script URL */
54
+ let theme = getThemeFromScriptUrl(src);
55
+
56
+ /** otherwise, try checking the URL of the script that loaded this script */
57
+ if (!theme) {
58
+ /** extract git SHA from the URL (looking for @<sha>/ in the path) */
59
+ const shaMatch = src.match(/@([0-9a-f]{7,40})\b/);
60
+ const sha = shaMatch ? shaMatch[1] : null;
61
+ if (sha && typeof document !== "undefined") {
62
+ /** find a <script> whose src contains the same SHA and "/init" in the path */
63
+ const scripts = Array.from(document.getElementsByTagName("script"));
64
+ const candidate = scripts.find((s) =>
65
+ s.src.includes(`@${sha}/`) && s.src.includes("/init")
66
+ );
67
+ if (candidate) theme = getThemeFromScriptUrl(candidate.src);
68
+ }
69
+ }
70
+
71
+ if (theme) addHtmlClass(theme);
72
+ }
package/src/init.ts CHANGED
@@ -1,4 +1,4 @@
1
- import "https://cdn.jsdelivr.net/gh/tilli-pro/cookieconsent@5fb70ab82fb1764d33cb75ab3bf9f3320d62cd75/dist/cookieconsent.umd.js";
1
+ import "https://cdn.jsdelivr.net/gh/tilli-pro/cookieconsent@693e3343f65c0e2a3c186bc4b913a83b9319a9f2/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";
@@ -6,6 +6,7 @@ import type { CookieConsentConfig } from "@tilli-pro/cookieconsent";
6
6
  import { cookieConsentTheme } from "./_utils";
7
7
  import _config from "./config";
8
8
  import styles from "./styles";
9
+ import { initTheme } from "./init/utils.script";
9
10
 
10
11
  declare module CookieConsent {
11
12
  const run: typeof _CookieConsent.run;
@@ -17,7 +18,7 @@ declare global {
17
18
  }
18
19
  }
19
20
 
20
- const GIT_SHA = "5fb70ab82fb1764d33cb75ab3bf9f3320d62cd75";
21
+ const GIT_SHA = "693e3343f65c0e2a3c186bc4b913a83b9319a9f2";
21
22
  const GIT_REPO = "tilli-pro/cookieconsent";
22
23
  const GIT_CDN_BASE_URL = "https://cdn.jsdelivr.net/gh";
23
24
  const GIT_CDN_URL = `${GIT_CDN_BASE_URL}/${GIT_REPO}@${GIT_SHA}`;
@@ -70,6 +71,7 @@ async function always() {
70
71
  loadCSS(CC_CSS_URL);
71
72
  loadNestedPluginCSS("styles", styles); // TODO: make dynamic (only import dependent styles - aka if a certain `init` config is specified)
72
73
  window.cookieConsentTheme = cookieConsentTheme; // used to fetch the correct classname to apply a specified theme | THIS SHOULD BE INJECTED INTO THE <HTML> TAG!!! // TODO: auto-inject (?)
74
+ initTheme();
73
75
  }
74
76
 
75
77
  void always();
@@ -1,6 +1,11 @@
1
1
  export default {
2
+ "tilli-website": "tilli-website.css",
3
+ "tilli-pay": "tilli-pay.css",
4
+ nudge: "nudge.css",
2
5
  tenants: {
3
6
  freeman: "freeman.css",
4
7
  frontier: "frontier.css",
8
+ "con-edison": "con-edison.css",
9
+ oru: "oru.css",
5
10
  },
6
11
  } as const;