@scalemule/news-publication 0.0.13 → 0.0.15
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/chunk-5W4EMBFY.js +106 -0
- package/dist/{chunk-5MHPE77S.js → chunk-5YQYJ2L2.js} +1 -1
- package/dist/chunk-7TBML5Q7.js +57 -0
- package/dist/chunk-QWK6G2UF.js +117 -0
- package/dist/{chunk-FUUL2PSF.js → chunk-WZ3NQRQO.js} +1 -1
- package/dist/compliance.cjs +19 -0
- package/dist/compliance.d.cts +2 -0
- package/dist/compliance.d.ts +2 -0
- package/dist/compliance.js +2 -0
- package/dist/cookie-consent-banner.cjs +25 -369
- package/dist/cookie-consent-banner.js +2 -2
- package/dist/cookie-settings-view.cjs +21 -193
- package/dist/cookie-settings-view.js +2 -2
- package/dist/index.cjs +287 -448
- package/dist/index.d.cts +16 -113
- package/dist/index.d.ts +16 -113
- package/dist/index.js +5 -3
- package/dist/{marketplace-CpGWPbFk.d.ts → marketplace-29i5w4LS.d.cts} +1 -1
- package/dist/{marketplace-CpGWPbFk.d.cts → marketplace-29i5w4LS.d.ts} +1 -1
- package/dist/marketplace-view.d.cts +1 -1
- package/dist/marketplace-view.d.ts +1 -1
- package/dist/{meet-5Ym5bxfh.d.cts → meet-RWmfj3I3.d.cts} +1 -1
- package/dist/{meet-5Ym5bxfh.d.ts → meet-RWmfj3I3.d.ts} +1 -1
- package/dist/meet-forms.d.cts +1 -1
- package/dist/meet-forms.d.ts +1 -1
- package/dist/meet-view.d.cts +1 -1
- package/dist/meet-view.d.ts +1 -1
- package/dist/network-bar.cjs +145 -0
- package/dist/network-bar.d.cts +15 -0
- package/dist/network-bar.d.ts +15 -0
- package/dist/network-bar.js +3 -0
- package/dist/network.cjs +115 -0
- package/dist/network.d.cts +23 -0
- package/dist/network.d.ts +23 -0
- package/dist/network.js +2 -0
- package/dist/snapshot-file.d.cts +1 -1
- package/dist/snapshot-file.d.ts +1 -1
- package/dist/{snapshot-BS4hn1dk.d.ts → snapshot-sHgQHuAF.d.cts} +1 -1
- package/dist/{snapshot-BS4hn1dk.d.cts → snapshot-sHgQHuAF.d.ts} +1 -1
- package/package.json +22 -2
- package/dist/chunk-L5OE6DND.js +0 -506
|
@@ -2,359 +2,11 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var react = require('react');
|
|
5
|
+
var compliance = require('@scalemule/compliance');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
|
|
7
|
-
// src/cookies.ts
|
|
8
|
-
var COOKIE_CONSENT_KEY = "sm_cookie_consent_v1";
|
|
9
|
-
var COOKIE_CONSENT_BACKUP_KEY = "napsite_cookie_consent_v1";
|
|
10
|
-
var COOKIE_CONSENT_EVENT = "scalemule-cookie-consent-change";
|
|
11
|
-
var COOKIE_CONSENT_MAX_AGE_SECONDS = 365 * 24 * 60 * 60;
|
|
12
|
-
var DEFAULT_CONSENT_HUB_URL = "https://bayareachronicle.com/consent-bridge.html";
|
|
13
|
-
var NETWORK_CONSENT_STORAGE_KEY = "sm_network_consent_status";
|
|
14
|
-
var DEFAULT_PREFERENCES_REJECTED = {
|
|
15
|
-
performance: false,
|
|
16
|
-
functional: false,
|
|
17
|
-
advertising: false
|
|
18
|
-
};
|
|
19
|
-
var DEFAULT_PREFERENCES_ACCEPTED = {
|
|
20
|
-
performance: true,
|
|
21
|
-
functional: true,
|
|
22
|
-
advertising: true
|
|
23
|
-
};
|
|
24
|
-
var memoryConsent = null;
|
|
25
|
-
function readCookie(name) {
|
|
26
|
-
if (typeof document === "undefined") return null;
|
|
27
|
-
const match = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/([.$?*|{}()[\]\\/+^])/g, "\\$1") + "=([^;]*)"));
|
|
28
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
29
|
-
}
|
|
30
|
-
function writeCookie(name, value, maxAgeSeconds) {
|
|
31
|
-
if (typeof document === "undefined") return;
|
|
32
|
-
const secure = typeof location !== "undefined" && location.protocol === "https:" ? "; Secure" : "";
|
|
33
|
-
document.cookie = `${name}=${encodeURIComponent(value)}; Path=/; Max-Age=${maxAgeSeconds}; SameSite=Lax${secure}`;
|
|
34
|
-
}
|
|
35
|
-
function getCookieConsent() {
|
|
36
|
-
if (typeof window === "undefined") return memoryConsent;
|
|
37
|
-
try {
|
|
38
|
-
const raw = readCookie(COOKIE_CONSENT_KEY) || readCookie(COOKIE_CONSENT_BACKUP_KEY);
|
|
39
|
-
if (raw) {
|
|
40
|
-
const parsed = JSON.parse(raw);
|
|
41
|
-
if (parsed && parsed.version === 1 && parsed.preferences) {
|
|
42
|
-
memoryConsent = parsed;
|
|
43
|
-
return parsed;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const stored = window.localStorage?.getItem(COOKIE_CONSENT_KEY);
|
|
47
|
-
if (stored) {
|
|
48
|
-
const parsed = JSON.parse(stored);
|
|
49
|
-
if (parsed && parsed.version === 1 && parsed.preferences) {
|
|
50
|
-
memoryConsent = parsed;
|
|
51
|
-
return parsed;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
} catch {
|
|
55
|
-
}
|
|
56
|
-
return memoryConsent;
|
|
57
|
-
}
|
|
58
|
-
var EU_EEA_UK_COUNTRIES = /* @__PURE__ */ new Set([
|
|
59
|
-
"AT",
|
|
60
|
-
"BE",
|
|
61
|
-
"BG",
|
|
62
|
-
"HR",
|
|
63
|
-
"CY",
|
|
64
|
-
"CZ",
|
|
65
|
-
"DK",
|
|
66
|
-
"EE",
|
|
67
|
-
"FI",
|
|
68
|
-
"FR",
|
|
69
|
-
"DE",
|
|
70
|
-
"GR",
|
|
71
|
-
"HU",
|
|
72
|
-
"IE",
|
|
73
|
-
"IT",
|
|
74
|
-
"LV",
|
|
75
|
-
"LT",
|
|
76
|
-
"LU",
|
|
77
|
-
"MT",
|
|
78
|
-
"NL",
|
|
79
|
-
"PL",
|
|
80
|
-
"PT",
|
|
81
|
-
"RO",
|
|
82
|
-
"SK",
|
|
83
|
-
"SI",
|
|
84
|
-
"ES",
|
|
85
|
-
"SE",
|
|
86
|
-
"IS",
|
|
87
|
-
"LI",
|
|
88
|
-
"NO",
|
|
89
|
-
"GB",
|
|
90
|
-
"CH"
|
|
91
|
-
]);
|
|
92
|
-
function isGeoConsentRequired(countryCode) {
|
|
93
|
-
if (countryCode && typeof countryCode === "string") {
|
|
94
|
-
const code = countryCode.trim().toUpperCase();
|
|
95
|
-
if (code.length === 2) {
|
|
96
|
-
return EU_EEA_UK_COUNTRIES.has(code);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (typeof window !== "undefined") {
|
|
100
|
-
try {
|
|
101
|
-
const cached = readCookie("sm_geo_country") || window.localStorage?.getItem("sm_geo_country");
|
|
102
|
-
if (cached && typeof cached === "string" && cached.length === 2) {
|
|
103
|
-
return EU_EEA_UK_COUNTRIES.has(cached.toUpperCase());
|
|
104
|
-
}
|
|
105
|
-
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
106
|
-
if (tz) {
|
|
107
|
-
if (/^(America|US|Canada|Pacific)\//i.test(tz)) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
if (/^(Europe|Atlantic\/Reykjavik|Atlantic\/Canary|Atlantic\/Faeroe|Atlantic\/Madeira|Atlantic\/Azores|WET|CET|EET|GMT)/i.test(tz)) {
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
} catch {
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
function checkUrlConsentBridge() {
|
|
120
|
-
if (typeof window === "undefined") return false;
|
|
121
|
-
try {
|
|
122
|
-
const url = new URL(window.location.href);
|
|
123
|
-
const param = url.searchParams.get("sm_consent");
|
|
124
|
-
if (!param) return false;
|
|
125
|
-
if (param === "accepted" || param === "1" || param === "all") {
|
|
126
|
-
acceptAllCookies();
|
|
127
|
-
} else if (param === "rejected" || param === "0" || param === "essential") {
|
|
128
|
-
rejectOptionalCookies();
|
|
129
|
-
} else {
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
url.searchParams.delete("sm_consent");
|
|
133
|
-
const newSearch = url.searchParams.toString() ? `?${url.searchParams.toString()}` : "";
|
|
134
|
-
window.history.replaceState(null, "", `${url.pathname}${newSearch}${url.hash}`);
|
|
135
|
-
return true;
|
|
136
|
-
} catch {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function queryNetworkConsentHub(hubUrl = DEFAULT_CONSENT_HUB_URL, timeoutMs = 1e3) {
|
|
141
|
-
if (typeof window === "undefined") return Promise.resolve(null);
|
|
142
|
-
try {
|
|
143
|
-
const hubOrigin = new URL(hubUrl).origin;
|
|
144
|
-
if (window.location.origin === hubOrigin) {
|
|
145
|
-
try {
|
|
146
|
-
const direct = window.localStorage?.getItem(NETWORK_CONSENT_STORAGE_KEY);
|
|
147
|
-
if (direct === "accepted" || direct === "rejected") {
|
|
148
|
-
return Promise.resolve(direct);
|
|
149
|
-
}
|
|
150
|
-
} catch {
|
|
151
|
-
}
|
|
152
|
-
return Promise.resolve(null);
|
|
153
|
-
}
|
|
154
|
-
return new Promise((resolve) => {
|
|
155
|
-
let settled = false;
|
|
156
|
-
let iframe = null;
|
|
157
|
-
let timer = null;
|
|
158
|
-
const finish = (result) => {
|
|
159
|
-
if (settled) return;
|
|
160
|
-
settled = true;
|
|
161
|
-
if (timer !== null) window.clearTimeout(timer);
|
|
162
|
-
window.removeEventListener("message", onMessage);
|
|
163
|
-
if (iframe && iframe.parentNode) {
|
|
164
|
-
try {
|
|
165
|
-
iframe.parentNode.removeChild(iframe);
|
|
166
|
-
} catch {
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
resolve(result);
|
|
170
|
-
};
|
|
171
|
-
const sendGet = () => {
|
|
172
|
-
try {
|
|
173
|
-
iframe?.contentWindow?.postMessage({ type: "SM_CONSENT_GET" }, hubOrigin);
|
|
174
|
-
} catch {
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
const onMessage = (event) => {
|
|
178
|
-
if (event.origin !== hubOrigin) return;
|
|
179
|
-
const data = event.data;
|
|
180
|
-
if (!data || typeof data !== "object") return;
|
|
181
|
-
if (data.type === "SM_CONSENT_STATUS") {
|
|
182
|
-
const status = data.status === "accepted" || data.status === "rejected" ? data.status : null;
|
|
183
|
-
finish(status);
|
|
184
|
-
} else if (data.type === "SM_CONSENT_BRIDGE_READY") {
|
|
185
|
-
sendGet();
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
window.addEventListener("message", onMessage);
|
|
189
|
-
timer = window.setTimeout(() => {
|
|
190
|
-
finish(null);
|
|
191
|
-
}, timeoutMs);
|
|
192
|
-
try {
|
|
193
|
-
iframe = document.createElement("iframe");
|
|
194
|
-
iframe.src = hubUrl;
|
|
195
|
-
iframe.style.position = "absolute";
|
|
196
|
-
iframe.style.width = "0";
|
|
197
|
-
iframe.style.height = "0";
|
|
198
|
-
iframe.style.border = "0";
|
|
199
|
-
iframe.style.display = "none";
|
|
200
|
-
iframe.style.visibility = "hidden";
|
|
201
|
-
iframe.setAttribute("aria-hidden", "true");
|
|
202
|
-
iframe.setAttribute("tabindex", "-1");
|
|
203
|
-
iframe.onload = () => {
|
|
204
|
-
sendGet();
|
|
205
|
-
};
|
|
206
|
-
iframe.onerror = () => {
|
|
207
|
-
finish(null);
|
|
208
|
-
};
|
|
209
|
-
const target = document.body || document.documentElement;
|
|
210
|
-
target.appendChild(iframe);
|
|
211
|
-
} catch {
|
|
212
|
-
finish(null);
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
} catch {
|
|
216
|
-
return Promise.resolve(null);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function setNetworkConsentHub(status, hubUrl = DEFAULT_CONSENT_HUB_URL) {
|
|
220
|
-
if (typeof window === "undefined") return;
|
|
221
|
-
try {
|
|
222
|
-
const hubOrigin = new URL(hubUrl).origin;
|
|
223
|
-
if (window.location.origin === hubOrigin) {
|
|
224
|
-
try {
|
|
225
|
-
if (status) {
|
|
226
|
-
window.localStorage?.setItem(NETWORK_CONSENT_STORAGE_KEY, status);
|
|
227
|
-
} else {
|
|
228
|
-
window.localStorage?.removeItem(NETWORK_CONSENT_STORAGE_KEY);
|
|
229
|
-
}
|
|
230
|
-
} catch {
|
|
231
|
-
}
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
let iframe = null;
|
|
235
|
-
let timer = null;
|
|
236
|
-
const cleanup = () => {
|
|
237
|
-
if (timer !== null) window.clearTimeout(timer);
|
|
238
|
-
window.removeEventListener("message", onMessage);
|
|
239
|
-
if (iframe && iframe.parentNode) {
|
|
240
|
-
try {
|
|
241
|
-
iframe.parentNode.removeChild(iframe);
|
|
242
|
-
} catch {
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
const sendSet = () => {
|
|
247
|
-
try {
|
|
248
|
-
iframe?.contentWindow?.postMessage({ type: "SM_CONSENT_SET", status }, hubOrigin);
|
|
249
|
-
} catch {
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
const onMessage = (event) => {
|
|
253
|
-
if (event.origin !== hubOrigin) return;
|
|
254
|
-
const data = event.data;
|
|
255
|
-
if (!data || typeof data !== "object") return;
|
|
256
|
-
if (data.type === "SM_CONSENT_SAVED") {
|
|
257
|
-
cleanup();
|
|
258
|
-
} else if (data.type === "SM_CONSENT_BRIDGE_READY") {
|
|
259
|
-
sendSet();
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
window.addEventListener("message", onMessage);
|
|
263
|
-
timer = window.setTimeout(cleanup, 2500);
|
|
264
|
-
try {
|
|
265
|
-
iframe = document.createElement("iframe");
|
|
266
|
-
iframe.src = hubUrl;
|
|
267
|
-
iframe.style.position = "absolute";
|
|
268
|
-
iframe.style.width = "0";
|
|
269
|
-
iframe.style.height = "0";
|
|
270
|
-
iframe.style.border = "0";
|
|
271
|
-
iframe.style.display = "none";
|
|
272
|
-
iframe.style.visibility = "hidden";
|
|
273
|
-
iframe.setAttribute("aria-hidden", "true");
|
|
274
|
-
iframe.setAttribute("tabindex", "-1");
|
|
275
|
-
iframe.onload = () => {
|
|
276
|
-
sendSet();
|
|
277
|
-
};
|
|
278
|
-
iframe.onerror = cleanup;
|
|
279
|
-
const target = document.body || document.documentElement;
|
|
280
|
-
target.appendChild(iframe);
|
|
281
|
-
} catch {
|
|
282
|
-
cleanup();
|
|
283
|
-
}
|
|
284
|
-
} catch {
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
function hasConsented() {
|
|
288
|
-
return getCookieConsent() !== null;
|
|
289
|
-
}
|
|
290
|
-
function setCookieConsent(preferences, source = "settings_save") {
|
|
291
|
-
const mergedPreferences = {
|
|
292
|
-
essential: true,
|
|
293
|
-
performance: Boolean(preferences.performance),
|
|
294
|
-
functional: Boolean(preferences.functional),
|
|
295
|
-
advertising: Boolean(preferences.advertising)
|
|
296
|
-
};
|
|
297
|
-
let anonymous_id;
|
|
298
|
-
if (typeof window !== "undefined") {
|
|
299
|
-
try {
|
|
300
|
-
anonymous_id = window.localStorage?.getItem("napsite_visitor_v1") || void 0;
|
|
301
|
-
} catch {
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
const record = {
|
|
305
|
-
version: 1,
|
|
306
|
-
preferences: mergedPreferences,
|
|
307
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
308
|
-
anonymous_id,
|
|
309
|
-
source
|
|
310
|
-
};
|
|
311
|
-
memoryConsent = record;
|
|
312
|
-
const serialized = JSON.stringify(record);
|
|
313
|
-
writeCookie(COOKIE_CONSENT_KEY, serialized, COOKIE_CONSENT_MAX_AGE_SECONDS);
|
|
314
|
-
writeCookie(COOKIE_CONSENT_BACKUP_KEY, serialized, COOKIE_CONSENT_MAX_AGE_SECONDS);
|
|
315
|
-
if (typeof window !== "undefined") {
|
|
316
|
-
try {
|
|
317
|
-
window.localStorage?.setItem(COOKIE_CONSENT_KEY, serialized);
|
|
318
|
-
} catch {
|
|
319
|
-
}
|
|
320
|
-
const networkStatus = mergedPreferences.performance || mergedPreferences.advertising ? "accepted" : "rejected";
|
|
321
|
-
setNetworkConsentHub(networkStatus);
|
|
322
|
-
window.dispatchEvent(new CustomEvent(COOKIE_CONSENT_EVENT, { detail: record }));
|
|
323
|
-
}
|
|
324
|
-
return record;
|
|
325
|
-
}
|
|
326
|
-
function acceptAllCookies() {
|
|
327
|
-
return setCookieConsent(DEFAULT_PREFERENCES_ACCEPTED, "banner_accept");
|
|
328
|
-
}
|
|
329
|
-
function rejectOptionalCookies() {
|
|
330
|
-
return setCookieConsent(DEFAULT_PREFERENCES_REJECTED, "banner_reject");
|
|
331
|
-
}
|
|
332
8
|
async function recordConsentToCompliance(record, options) {
|
|
333
|
-
|
|
334
|
-
const endpoint = options?.endpoint || "/api/compliance/consent";
|
|
335
|
-
try {
|
|
336
|
-
const payload = {
|
|
337
|
-
consent_type: "cookie_policy",
|
|
338
|
-
granted: record.preferences.performance || record.preferences.advertising,
|
|
339
|
-
preferences: record.preferences,
|
|
340
|
-
source: record.source,
|
|
341
|
-
anonymous_id: record.anonymous_id,
|
|
342
|
-
timestamp: record.timestamp,
|
|
343
|
-
url: window.location.href,
|
|
344
|
-
user_agent: window.navigator.userAgent
|
|
345
|
-
};
|
|
346
|
-
if (typeof navigator.sendBeacon === "function") {
|
|
347
|
-
navigator.sendBeacon(endpoint, new Blob([JSON.stringify(payload)], { type: "application/json" }));
|
|
348
|
-
} else {
|
|
349
|
-
await fetch(endpoint, {
|
|
350
|
-
method: "POST",
|
|
351
|
-
headers: { "content-type": "application/json" },
|
|
352
|
-
body: JSON.stringify(payload),
|
|
353
|
-
keepalive: true
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
} catch {
|
|
357
|
-
}
|
|
9
|
+
return compliance.recordConsentToCompliance(record, options);
|
|
358
10
|
}
|
|
359
11
|
function CookieConsentBanner({
|
|
360
12
|
title = "Help Us Improve Our Website with Cookies",
|
|
@@ -365,39 +17,39 @@ function CookieConsentBanner({
|
|
|
365
17
|
complianceEndpoint = "/api/compliance/consent",
|
|
366
18
|
countryCode,
|
|
367
19
|
forceShow = false,
|
|
368
|
-
consentHubUrl = DEFAULT_CONSENT_HUB_URL
|
|
20
|
+
consentHubUrl = compliance.DEFAULT_CONSENT_HUB_URL
|
|
369
21
|
}) {
|
|
370
22
|
const [mounted, setMounted] = react.useState(false);
|
|
371
23
|
const [visible, setVisible] = react.useState(false);
|
|
372
24
|
react.useEffect(() => {
|
|
373
25
|
setMounted(true);
|
|
374
|
-
if (checkUrlConsentBridge()) {
|
|
26
|
+
if (compliance.checkUrlConsentBridge()) {
|
|
375
27
|
setVisible(false);
|
|
376
28
|
return;
|
|
377
29
|
}
|
|
378
|
-
if (hasConsented()) {
|
|
30
|
+
if (compliance.hasConsented()) {
|
|
379
31
|
setVisible(false);
|
|
380
32
|
return;
|
|
381
33
|
}
|
|
382
|
-
if (!forceShow && !isGeoConsentRequired(countryCode)) {
|
|
34
|
+
if (!forceShow && !compliance.isGeoConsentRequired(countryCode)) {
|
|
383
35
|
setVisible(false);
|
|
384
|
-
void queryNetworkConsentHub(consentHubUrl, 1200).then((networkStatus) => {
|
|
36
|
+
void compliance.queryNetworkConsentHub(consentHubUrl, 1200).then((networkStatus) => {
|
|
385
37
|
if (networkStatus === "accepted") {
|
|
386
|
-
acceptAllCookies();
|
|
38
|
+
compliance.acceptAllCookies();
|
|
387
39
|
} else if (networkStatus === "rejected") {
|
|
388
|
-
rejectOptionalCookies();
|
|
40
|
+
compliance.rejectOptionalCookies();
|
|
389
41
|
}
|
|
390
42
|
});
|
|
391
43
|
return;
|
|
392
44
|
}
|
|
393
45
|
let cancelled = false;
|
|
394
|
-
void queryNetworkConsentHub(consentHubUrl, 1e3).then((networkStatus) => {
|
|
46
|
+
void compliance.queryNetworkConsentHub(consentHubUrl, 1e3).then((networkStatus) => {
|
|
395
47
|
if (cancelled) return;
|
|
396
48
|
if (networkStatus === "accepted") {
|
|
397
|
-
acceptAllCookies();
|
|
49
|
+
compliance.acceptAllCookies();
|
|
398
50
|
setVisible(false);
|
|
399
51
|
} else if (networkStatus === "rejected") {
|
|
400
|
-
rejectOptionalCookies();
|
|
52
|
+
compliance.rejectOptionalCookies();
|
|
401
53
|
setVisible(false);
|
|
402
54
|
} else {
|
|
403
55
|
setVisible(true);
|
|
@@ -409,27 +61,31 @@ function CookieConsentBanner({
|
|
|
409
61
|
}, [countryCode, forceShow, consentHubUrl]);
|
|
410
62
|
react.useEffect(() => {
|
|
411
63
|
const onConsentChange = () => {
|
|
412
|
-
if (hasConsented()) {
|
|
64
|
+
if (compliance.hasConsented()) {
|
|
413
65
|
setVisible(false);
|
|
414
66
|
}
|
|
415
67
|
};
|
|
416
|
-
window.addEventListener(COOKIE_CONSENT_EVENT, onConsentChange);
|
|
417
|
-
return () => window.removeEventListener(COOKIE_CONSENT_EVENT, onConsentChange);
|
|
68
|
+
window.addEventListener(compliance.COOKIE_CONSENT_EVENT, onConsentChange);
|
|
69
|
+
return () => window.removeEventListener(compliance.COOKIE_CONSENT_EVENT, onConsentChange);
|
|
418
70
|
}, []);
|
|
419
71
|
if (!mounted || !visible) return null;
|
|
420
72
|
const handleAccept = () => {
|
|
421
|
-
const record = acceptAllCookies();
|
|
73
|
+
const record = compliance.acceptAllCookies();
|
|
422
74
|
setVisible(false);
|
|
423
75
|
void recordConsentToCompliance(record, {
|
|
424
|
-
endpoint: complianceEndpoint
|
|
425
|
-
|
|
76
|
+
endpoint: complianceEndpoint,
|
|
77
|
+
publicationSlug
|
|
78
|
+
});
|
|
79
|
+
compliance.setNetworkConsentHub("accepted", consentHubUrl);
|
|
426
80
|
};
|
|
427
81
|
const handleReject = () => {
|
|
428
|
-
const record = rejectOptionalCookies();
|
|
82
|
+
const record = compliance.rejectOptionalCookies();
|
|
429
83
|
setVisible(false);
|
|
430
84
|
void recordConsentToCompliance(record, {
|
|
431
|
-
endpoint: complianceEndpoint
|
|
432
|
-
|
|
85
|
+
endpoint: complianceEndpoint,
|
|
86
|
+
publicationSlug
|
|
87
|
+
});
|
|
88
|
+
compliance.setNetworkConsentHub("rejected", consentHubUrl);
|
|
433
89
|
};
|
|
434
90
|
const defaultText = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
435
91
|
"We use cookies and device data to analyze performance, support local sponsors, and remember your reading preferences across our news network. View",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { CookieConsentBanner } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { CookieConsentBanner } from './chunk-5YQYJ2L2.js';
|
|
3
|
+
import './chunk-QWK6G2UF.js';
|