@scalemule/news-publication 0.0.13 → 0.0.14

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.
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { checkUrlConsentBridge, hasConsented, isGeoConsentRequired, queryNetworkConsentHub, DEFAULT_CONSENT_HUB_URL, acceptAllCookies, rejectOptionalCookies, COOKIE_CONSENT_EVENT, recordConsentToCompliance, setNetworkConsentHub } from './chunk-L5OE6DND.js';
2
+ import { checkUrlConsentBridge, hasConsented, isGeoConsentRequired, queryNetworkConsentHub, DEFAULT_CONSENT_HUB_URL, acceptAllCookies, rejectOptionalCookies, COOKIE_CONSENT_EVENT, recordConsentToCompliance, setNetworkConsentHub } from './chunk-QWK6G2UF.js';
3
3
  import { useState, useEffect } from 'react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -0,0 +1,117 @@
1
+ import { recordConsentToCompliance as recordConsentToCompliance$1 } from '@scalemule/compliance';
2
+ export { COOKIE_CONSENT_BACKUP_KEY, COOKIE_CONSENT_EVENT, COOKIE_CONSENT_KEY, COOKIE_CONSENT_MAX_AGE_SECONDS, DEFAULT_CONSENT_HUB_URL, DEFAULT_PREFERENCES_ACCEPTED, DEFAULT_PREFERENCES_REJECTED, EU_EEA_UK_COUNTRIES, NETWORK_CONSENT_STORAGE_KEY, acceptAllCookies, checkUrlConsentBridge, clearCookieConsent, decorateNetworkUrl, getCookieConsent, hasConsented, isCategoryAllowed, isGeoConsentRequired, queryNetworkConsentHub, rejectOptionalCookies, setCookieConsent, setNetworkConsentHub } from '@scalemule/compliance';
3
+
4
+ // src/cookies.ts
5
+ async function recordConsentToCompliance(record, options) {
6
+ return recordConsentToCompliance$1(record, options);
7
+ }
8
+ var COOKIE_CATEGORIES = [
9
+ {
10
+ id: "essential",
11
+ title: "Strictly Necessary Cookies",
12
+ shortDescription: "Essential for site security, navigation, and privacy preference management.",
13
+ fullDescription: "These cookies are necessary for the website to function properly and securely. They enable core features such as load balancing, CSRF protection, secure session tokens, and remembering your cookie consent choice. Because the site cannot function without them, they cannot be turned off.",
14
+ required: true,
15
+ cookies: [
16
+ {
17
+ name: "sm_cookie_consent_v1",
18
+ provider: "First-Party (ScaleMule)",
19
+ purpose: "Stores your verified cookie privacy and category consent choices.",
20
+ duration: "1 year",
21
+ type: "HTTP Cookie"
22
+ },
23
+ {
24
+ name: "napsite_session_v1",
25
+ provider: "First-Party",
26
+ purpose: "Maintains session continuity, security tokens, and server routing.",
27
+ duration: "30 minutes (idle)",
28
+ type: "Session Storage"
29
+ },
30
+ {
31
+ name: "napsite_preview",
32
+ provider: "First-Party",
33
+ purpose: "Verifies preview access permissions when viewing unpublished newsroom editions.",
34
+ duration: "14 days",
35
+ type: "HTTP Cookie"
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ id: "performance",
41
+ title: "Performance & Analytics Cookies",
42
+ shortDescription: "Help us measure reader engagement, story completion, and site reliability.",
43
+ fullDescription: "These cookies collect anonymous information about how visitors navigate our news publication. They allow us to count article reads, understand scroll depth and reading completion, and identify broken links or slow-loading assets so we can keep our community reporting responsive and fast. All metrics are aggregated and never contain personal information.",
44
+ required: false,
45
+ cookies: [
46
+ {
47
+ name: "napsite_visitor_v1",
48
+ provider: "First-Party",
49
+ purpose: "A randomized anonymous UUIDv7 to count distinct readers without tracking personal identity.",
50
+ duration: "1 year",
51
+ type: "Local Storage"
52
+ },
53
+ {
54
+ name: "napsite_analytics_v1",
55
+ provider: "First-Party",
56
+ purpose: "Connects reading completion and web vitals to the anonymous session.",
57
+ duration: "30 minutes",
58
+ type: "HTTP Cookie"
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ id: "functional",
64
+ title: "Functional & Personalization Cookies",
65
+ shortDescription: "Remember your reading preferences, text size, and narration audio settings.",
66
+ fullDescription: "These cookies enable enhanced convenience features designed for readers. They remember your custom text sizing, keep your preferred audio narration playback speed (e.g., 1.0x vs 1.25x), and preserve your local town filters across the front page so you always see news closest to your neighborhood.",
67
+ required: false,
68
+ cookies: [
69
+ {
70
+ name: "reader_text_size",
71
+ provider: "First-Party",
72
+ purpose: "Remembers your preferred reading font size across articles.",
73
+ duration: "1 year",
74
+ type: "Local Storage"
75
+ },
76
+ {
77
+ name: "news_publication_theme",
78
+ provider: "First-Party",
79
+ purpose: "Remembers your reading theme preference (light, dark, or system).",
80
+ duration: "1 year",
81
+ type: "HTTP Cookie"
82
+ },
83
+ {
84
+ name: "audio_narration_speed",
85
+ provider: "First-Party",
86
+ purpose: "Stores your preferred audio player playback rate (e.g. 1.0x, 1.25x).",
87
+ duration: "1 year",
88
+ type: "Local Storage"
89
+ }
90
+ ]
91
+ },
92
+ {
93
+ id: "advertising",
94
+ title: "Advertising & Local Sponsorship Cookies",
95
+ shortDescription: "Support local business sponsors by capping repetition and measuring notices.",
96
+ fullDescription: "Our journalism is supported by local business sponsors and community partners. These cookies ensure you do not see the same sponsor banner repeatedly (frequency capping) and help local merchants measure whether their announcement reached their community. They never track your activity across unrelated third-party websites or build external advertising profiles.",
97
+ required: false,
98
+ cookies: [
99
+ {
100
+ name: "napsite_sponsor_cap",
101
+ provider: "First-Party",
102
+ purpose: "Prevents repetitive display of identical local business announcements.",
103
+ duration: "7 days",
104
+ type: "Local Storage"
105
+ },
106
+ {
107
+ name: "local_sponsor_ref",
108
+ provider: "First-Party",
109
+ purpose: "Attributes community inquiries directly to the sponsoring local merchant.",
110
+ duration: "30 days",
111
+ type: "Local Storage"
112
+ }
113
+ ]
114
+ }
115
+ ];
116
+
117
+ export { COOKIE_CATEGORIES, recordConsentToCompliance };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { getCookieConsent, DEFAULT_PREFERENCES_ACCEPTED, COOKIE_CATEGORIES, setCookieConsent, recordConsentToCompliance, DEFAULT_PREFERENCES_REJECTED } from './chunk-L5OE6DND.js';
2
+ import { getCookieConsent, DEFAULT_PREFERENCES_ACCEPTED, COOKIE_CATEGORIES, setCookieConsent, recordConsentToCompliance, DEFAULT_PREFERENCES_REJECTED } from './chunk-QWK6G2UF.js';
3
3
  import { useState, useEffect } from 'react';
4
4
  import { jsxs, jsx } from 'react/jsx-runtime';
5
5
 
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var compliance = require('@scalemule/compliance');
4
+ var react = require('@scalemule/compliance/react');
5
+
6
+
7
+
8
+ Object.keys(compliance).forEach(function (k) {
9
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
10
+ enumerable: true,
11
+ get: function () { return compliance[k]; }
12
+ });
13
+ });
14
+ Object.keys(react).forEach(function (k) {
15
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
16
+ enumerable: true,
17
+ get: function () { return react[k]; }
18
+ });
19
+ });
@@ -0,0 +1,2 @@
1
+ export * from '@scalemule/compliance';
2
+ export * from '@scalemule/compliance/react';
@@ -0,0 +1,2 @@
1
+ export * from '@scalemule/compliance';
2
+ export * from '@scalemule/compliance/react';
@@ -0,0 +1,2 @@
1
+ export * from '@scalemule/compliance';
2
+ export * from '@scalemule/compliance/react';
@@ -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
- if (typeof window === "undefined") return;
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
- setNetworkConsentHub("accepted", consentHubUrl);
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
- setNetworkConsentHub("rejected", consentHubUrl);
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-5MHPE77S.js';
3
- import './chunk-L5OE6DND.js';
2
+ export { CookieConsentBanner } from './chunk-5YQYJ2L2.js';
3
+ import './chunk-QWK6G2UF.js';