@sentientui/core 0.34.3 → 0.35.0
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-DGRAS5VP.mjs → chunk-EUD4PUKP.mjs} +1 -1
- package/dist/chunk-EUD4PUKP.mjs.map +1 -0
- package/dist/{index-Dyc-wA0o.d.cts → index-Dg2gkw_l.d.cts} +1 -0
- package/dist/{index-JgzRgOO4.d.ts → index-DjbSOAEF.d.ts} +1 -0
- package/dist/index-consent.d.cts +63 -0
- package/dist/index-consent.d.ts +63 -0
- package/dist/index-consent.js +2 -0
- package/dist/index-consent.js.map +1 -0
- package/dist/index-consent.mjs +2 -0
- package/dist/index-consent.mjs.map +1 -0
- package/dist/index-engagement.js.map +1 -1
- package/dist/index-engagement.mjs +1 -1
- package/dist/index-graph.d.cts +3 -2
- package/dist/index-graph.d.ts +3 -2
- package/dist/index-graph.js.map +1 -1
- package/dist/index-graph.mjs +1 -1
- package/dist/index-local.d.cts +2 -1
- package/dist/index-local.d.ts +2 -1
- package/dist/index-style-sample.js +1 -1
- package/dist/index-style-sample.js.map +1 -1
- package/dist/index-style-sample.mjs +1 -1
- package/dist/index-style-sample.mjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +7 -1
- package/dist/chunk-DGRAS5VP.mjs.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.cjs';
|
|
2
2
|
import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-CJwAWbJr.cjs';
|
|
3
3
|
import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-D2ahkcbe.cjs';
|
|
4
|
+
import './index-consent.cjs';
|
|
4
5
|
import { SlotResult } from '@sentientui/policy';
|
|
5
6
|
|
|
6
7
|
/** Manages anonymous session identity with cookie + localStorage layers. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.js';
|
|
2
2
|
import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-CKXcaBjt.js';
|
|
3
3
|
import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-D2ahkcbe.js';
|
|
4
|
+
import './index-consent.js';
|
|
4
5
|
import { SlotResult } from '@sentientui/policy';
|
|
5
6
|
|
|
6
7
|
/** Manages anonymous session identity with cookie + localStorage layers. */
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
type ConsentPreset = 'cookiebot' | 'onetrust' | 'cookieyes' | 'tcf' | 'google-consent-mode';
|
|
2
|
+
type ConsentSource = ConsentPreset | {
|
|
3
|
+
cmp: 'cookiebot';
|
|
4
|
+
category?: 'preferences' | 'statistics' | 'marketing';
|
|
5
|
+
} | {
|
|
6
|
+
cmp: 'onetrust';
|
|
7
|
+
group?: string;
|
|
8
|
+
} | {
|
|
9
|
+
cmp: 'cookieyes';
|
|
10
|
+
category?: 'functional' | 'analytics' | 'performance' | 'advertisement';
|
|
11
|
+
} | {
|
|
12
|
+
cmp: 'tcf';
|
|
13
|
+
purposes?: number[];
|
|
14
|
+
} | {
|
|
15
|
+
cmp: 'google-consent-mode';
|
|
16
|
+
type?: 'analytics_storage' | 'ad_storage' | 'personalization_storage' | 'functionality_storage';
|
|
17
|
+
dataLayer?: string;
|
|
18
|
+
} | {
|
|
19
|
+
cmp?: undefined;
|
|
20
|
+
/** Cookie to read. Granted when its value equals `value`. */
|
|
21
|
+
cookie?: string;
|
|
22
|
+
/** Cookie value that means granted. @default 'accepted' */
|
|
23
|
+
value?: string;
|
|
24
|
+
/** Predicate for CMPs with a JS API. Takes precedence over `cookie`. */
|
|
25
|
+
check?: () => boolean;
|
|
26
|
+
/** Event that signals a decision (listened on window AND document). */
|
|
27
|
+
event?: string;
|
|
28
|
+
};
|
|
29
|
+
type ConsentWatcher = {
|
|
30
|
+
/** The decision right now: true/false, or null when the source can't tell
|
|
31
|
+
* yet (CMP not loaded, no decision stored). Callers treat null as "keep
|
|
32
|
+
* whatever you knew" — e.g. the server's read — and never as granted. */
|
|
33
|
+
read(): boolean | null;
|
|
34
|
+
/** Call `onChange` whenever the decision may have changed. */
|
|
35
|
+
subscribe(onChange: () => void): () => void;
|
|
36
|
+
};
|
|
37
|
+
/** Cookiebot `CookieConsent`: true/false for `category`, null when unknown. */
|
|
38
|
+
declare function cookiebotCookieGrants(raw: string | undefined, category?: string): boolean | null;
|
|
39
|
+
/** OneTrust `OptanonConsent`: is `group` active? null when unknown. */
|
|
40
|
+
declare function onetrustCookieGrants(raw: string | undefined, group?: string): boolean | null;
|
|
41
|
+
/** CookieYes `cookieyes-consent`: `category:yes|no`, null when unrecognised. */
|
|
42
|
+
declare function cookieyesCookieGrants(raw: string | undefined, category?: string): boolean | null;
|
|
43
|
+
/**
|
|
44
|
+
* Purpose consents from an IAB TCF v2 TC string (core segment). Bit layout
|
|
45
|
+
* (TCF v2.2 spec): Version 6 · Created 36 · LastUpdated 36 · CmpId 12 ·
|
|
46
|
+
* CmpVersion 12 · ConsentScreen 6 · ConsentLanguage 12 · VendorListVersion 12
|
|
47
|
+
* · TcfPolicyVersion 6 · IsServiceSpecific 1 · UseNonStandardTexts 1 ·
|
|
48
|
+
* SpecialFeatureOptIns 12 · PurposesConsent 24 → purposes start at bit 152.
|
|
49
|
+
* Null for anything that isn't a v2 string.
|
|
50
|
+
*/
|
|
51
|
+
declare function tcStringPurposes(tc: string | undefined): Set<number> | null;
|
|
52
|
+
/**
|
|
53
|
+
* Server-side read from the request's cookies (Next.js `AdaptiveRoot`).
|
|
54
|
+
* true/false when the CMP's cookie decides it, null when it can't be known on
|
|
55
|
+
* the server (no cookie yet, a JS-only source) — the caller then gates the
|
|
56
|
+
* first paint and lets the browser decide.
|
|
57
|
+
*/
|
|
58
|
+
declare function consentFromCookies(src: ConsentSource, getCookie: (name: string) => string | undefined): boolean | null;
|
|
59
|
+
/** The latest Consent Mode state for `type` in `dataLayer`, or null. */
|
|
60
|
+
declare function consentModeGranted(dataLayer: unknown, type?: string): boolean | null;
|
|
61
|
+
declare function consentWatcher(src: ConsentSource, win?: Window): ConsentWatcher;
|
|
62
|
+
|
|
63
|
+
export { type ConsentPreset, type ConsentSource, type ConsentWatcher, consentFromCookies, consentModeGranted, consentWatcher, cookiebotCookieGrants, cookieyesCookieGrants, onetrustCookieGrants, tcStringPurposes };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
type ConsentPreset = 'cookiebot' | 'onetrust' | 'cookieyes' | 'tcf' | 'google-consent-mode';
|
|
2
|
+
type ConsentSource = ConsentPreset | {
|
|
3
|
+
cmp: 'cookiebot';
|
|
4
|
+
category?: 'preferences' | 'statistics' | 'marketing';
|
|
5
|
+
} | {
|
|
6
|
+
cmp: 'onetrust';
|
|
7
|
+
group?: string;
|
|
8
|
+
} | {
|
|
9
|
+
cmp: 'cookieyes';
|
|
10
|
+
category?: 'functional' | 'analytics' | 'performance' | 'advertisement';
|
|
11
|
+
} | {
|
|
12
|
+
cmp: 'tcf';
|
|
13
|
+
purposes?: number[];
|
|
14
|
+
} | {
|
|
15
|
+
cmp: 'google-consent-mode';
|
|
16
|
+
type?: 'analytics_storage' | 'ad_storage' | 'personalization_storage' | 'functionality_storage';
|
|
17
|
+
dataLayer?: string;
|
|
18
|
+
} | {
|
|
19
|
+
cmp?: undefined;
|
|
20
|
+
/** Cookie to read. Granted when its value equals `value`. */
|
|
21
|
+
cookie?: string;
|
|
22
|
+
/** Cookie value that means granted. @default 'accepted' */
|
|
23
|
+
value?: string;
|
|
24
|
+
/** Predicate for CMPs with a JS API. Takes precedence over `cookie`. */
|
|
25
|
+
check?: () => boolean;
|
|
26
|
+
/** Event that signals a decision (listened on window AND document). */
|
|
27
|
+
event?: string;
|
|
28
|
+
};
|
|
29
|
+
type ConsentWatcher = {
|
|
30
|
+
/** The decision right now: true/false, or null when the source can't tell
|
|
31
|
+
* yet (CMP not loaded, no decision stored). Callers treat null as "keep
|
|
32
|
+
* whatever you knew" — e.g. the server's read — and never as granted. */
|
|
33
|
+
read(): boolean | null;
|
|
34
|
+
/** Call `onChange` whenever the decision may have changed. */
|
|
35
|
+
subscribe(onChange: () => void): () => void;
|
|
36
|
+
};
|
|
37
|
+
/** Cookiebot `CookieConsent`: true/false for `category`, null when unknown. */
|
|
38
|
+
declare function cookiebotCookieGrants(raw: string | undefined, category?: string): boolean | null;
|
|
39
|
+
/** OneTrust `OptanonConsent`: is `group` active? null when unknown. */
|
|
40
|
+
declare function onetrustCookieGrants(raw: string | undefined, group?: string): boolean | null;
|
|
41
|
+
/** CookieYes `cookieyes-consent`: `category:yes|no`, null when unrecognised. */
|
|
42
|
+
declare function cookieyesCookieGrants(raw: string | undefined, category?: string): boolean | null;
|
|
43
|
+
/**
|
|
44
|
+
* Purpose consents from an IAB TCF v2 TC string (core segment). Bit layout
|
|
45
|
+
* (TCF v2.2 spec): Version 6 · Created 36 · LastUpdated 36 · CmpId 12 ·
|
|
46
|
+
* CmpVersion 12 · ConsentScreen 6 · ConsentLanguage 12 · VendorListVersion 12
|
|
47
|
+
* · TcfPolicyVersion 6 · IsServiceSpecific 1 · UseNonStandardTexts 1 ·
|
|
48
|
+
* SpecialFeatureOptIns 12 · PurposesConsent 24 → purposes start at bit 152.
|
|
49
|
+
* Null for anything that isn't a v2 string.
|
|
50
|
+
*/
|
|
51
|
+
declare function tcStringPurposes(tc: string | undefined): Set<number> | null;
|
|
52
|
+
/**
|
|
53
|
+
* Server-side read from the request's cookies (Next.js `AdaptiveRoot`).
|
|
54
|
+
* true/false when the CMP's cookie decides it, null when it can't be known on
|
|
55
|
+
* the server (no cookie yet, a JS-only source) — the caller then gates the
|
|
56
|
+
* first paint and lets the browser decide.
|
|
57
|
+
*/
|
|
58
|
+
declare function consentFromCookies(src: ConsentSource, getCookie: (name: string) => string | undefined): boolean | null;
|
|
59
|
+
/** The latest Consent Mode state for `type` in `dataLayer`, or null. */
|
|
60
|
+
declare function consentModeGranted(dataLayer: unknown, type?: string): boolean | null;
|
|
61
|
+
declare function consentWatcher(src: ConsentSource, win?: Window): ConsentWatcher;
|
|
62
|
+
|
|
63
|
+
export { type ConsentPreset, type ConsentSource, type ConsentWatcher, consentFromCookies, consentModeGranted, consentWatcher, cookiebotCookieGrants, cookieyesCookieGrants, onetrustCookieGrants, tcStringPurposes };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var h=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var T=(o,n)=>{for(var e in n)h(o,e,{get:n[e],enumerable:!0})},E=(o,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of W(n))!R.call(o,s)&&s!==e&&h(o,s,{get:()=>n[s],enumerable:!(r=O(n,s))||r.enumerable});return o};var I=o=>E(h({},"__esModule",{value:!0}),o);var D={};T(D,{consentFromCookies:()=>L,consentModeGranted:()=>_,consentWatcher:()=>G,cookiebotCookieGrants:()=>y,cookieyesCookieGrants:()=>k,onetrustCookieGrants:()=>m,tcStringPurposes:()=>x});module.exports=I(D);var g=o=>{try{return decodeURIComponent(o)}catch(n){return o}};function d(o,n){if(o)for(let e of o.cookie.split(";")){let r=e.indexOf("=");if(r>0&&e.slice(0,r).trim()===n)return e.slice(r+1).trim()}}function f(o,n,e){let r=[o,...o.document?[o.document]:[]];for(let s of r)for(let t of n)s.addEventListener(t,e);return()=>{for(let s of r)for(let t of n)s.removeEventListener(t,e)}}function y(o,n="statistics"){if(o==null||o==="")return null;let e=g(o).trim();if(e==="-1")return!0;if(e==="0")return!1;let r=new RegExp(`[{,]\\s*${n}\\s*:\\s*(true|false)`).exec(e);return r?r[1]==="true":null}function m(o,n="C0002"){var r;if(o==null||o==="")return null;let e=(r=/(?:^|&)groups=([^&]*)/.exec(g(o)))==null?void 0:r[1];if(e==null)return null;for(let s of g(e).split(",")){let[t,i]=s.split(":");if(t===n)return i==="1"}return null}function k(o,n="analytics"){if(o==null||o==="")return null;let e=new RegExp(`(?:^|,)${n}:(yes|no)(?:,|$)`).exec(g(o));return e?e[1]==="yes":null}function x(o){if(!o)return null;let n=o.split(".")[0];if(!/^[A-Za-z0-9_-]+$/.test(n))return null;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",r="";for(let t of n)r+=e.indexOf(t).toString(2).padStart(6,"0");if(r.length<176||parseInt(r.slice(0,6),2)!==2)return null;let s=new Set;for(let t=1;t<=24;t++)r[151+t]==="1"&&s.add(t);return s}function A(o){var e,r,s,t,i,c;let n=typeof o=="string"?{cmp:o}:o;switch(n.cmp){case"cookiebot":return{cmp:"cookiebot",category:(e=n.category)!=null?e:"statistics"};case"onetrust":return{cmp:"onetrust",group:(r=n.group)!=null?r:"C0002"};case"cookieyes":return{cmp:"cookieyes",category:(s=n.category)!=null?s:"analytics"};case"tcf":return{cmp:"tcf",purposes:n.purposes&&n.purposes.length>0?n.purposes:[1]};case"google-consent-mode":return{cmp:"google-consent-mode",type:(t=n.type)!=null?t:"analytics_storage",dataLayer:(i=n.dataLayer)!=null?i:"dataLayer"};default:return{cmp:"custom",cookie:n.cookie,value:(c=n.value)!=null?c:"accepted",check:n.check,event:n.event}}}function L(o,n){let e=A(o);switch(e.cmp){case"cookiebot":return y(n("CookieConsent"),e.category);case"onetrust":return m(n("OptanonConsent"),e.group);case"cookieyes":return k(n("cookieyes-consent"),e.category);case"tcf":{let r=x(n("euconsent-v2"));return r?e.purposes.every(s=>r.has(s)):null}case"google-consent-mode":return null;case"custom":return!e.cookie||e.check?null:n(e.cookie)===e.value}}function _(o,n="analytics_storage"){var r;if(!Array.isArray(o))return null;let e=null;for(let s of o){let t=s&&typeof s=="object"&&"length"in s?Array.prototype.slice.call(s):null;if(!t||t[0]!=="consent"||t[1]!=="default"&&t[1]!=="update")continue;let i=(r=t[2])==null?void 0:r[n];i==="granted"?e=!0:i==="denied"&&(e=!1)}return e}function G(o,n=window){let e=A(o),r=n,s=n.document;switch(e.cmp){case"cookiebot":return{read:()=>{let t=r.Cookiebot;return t!=null&&t.consent&&typeof t.consent[e.category]=="boolean"?t.consent[e.category]===!0:y(d(s,"CookieConsent"),e.category)},subscribe:t=>f(n,["CookiebotOnAccept","CookiebotOnDecline","CookiebotOnConsentReady","CookiebotOnLoad"],t)};case"onetrust":return{read:()=>{let t=r.OnetrustActiveGroups;return typeof t=="string"?`,${t},`.includes(`,${e.group},`):m(d(s,"OptanonConsent"),e.group)},subscribe:t=>f(n,["OneTrustGroupsUpdated"],t)};case"cookieyes":return{read:()=>{var i;let t=r.getCkyConsent;if(typeof t=="function")try{let c=(i=t())==null?void 0:i.categories;if(c&&typeof c[e.category]=="boolean")return c[e.category]===!0}catch(c){}return k(d(s,"cookieyes-consent"),e.category)},subscribe:t=>f(n,["cookieyes_consent_update","cookieyes_banner_load","cookieyes_banner_loaded"],t)};case"tcf":{let t=null;return{read:()=>t,subscribe:i=>{let c,a=!1,p=(u,v)=>{!v||a||(typeof u.listenerId=="number"&&(c=u.listenerId),u.eventStatus==="cmpuishown"?t=!1:t=u.gdprApplies===!1||e.purposes.every(C=>{var w,S;return((S=(w=u.purpose)==null?void 0:w.consents)==null?void 0:S[C])===!0}),i())},b=0,l=()=>{if(a)return;let u=r.__tcfapi;typeof u=="function"?u("addEventListener",2,p):b++<40&&window.setTimeout(l,250)};return l(),()=>{a=!0;let u=r.__tcfapi;typeof u=="function"&&c!==void 0&&u("removeEventListener",2,()=>{},c)}}}}case"google-consent-mode":{let t=()=>r[e.dataLayer];return{read:()=>_(t(),e.type),subscribe:i=>{var l,u;let c=(u=r[l=e.dataLayer])!=null?u:r[l]=[],a=c.push,p=function(...v){let C=a.apply(c,v);return i(),C};c.push=p;let b=window.setInterval(i,1e3);return()=>{window.clearInterval(b),c.push===p&&(c.push=a)}}}}case"custom":return{read:()=>{if(e.check)try{return e.check()===!0}catch(i){return!1}if(!e.cookie)return null;let t=d(s,e.cookie);return t===void 0?null:t===e.value},subscribe:t=>e.event?f(n,[e.event],t):()=>{}}}}0&&(module.exports={consentFromCookies,consentModeGranted,consentWatcher,cookiebotCookieGrants,cookieyesCookieGrants,onetrustCookieGrants,tcStringPurposes});
|
|
2
|
+
//# sourceMappingURL=index-consent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index-consent.ts","../src/consent-sources.ts"],"sourcesContent":["/** `@sentientui/core/consent`: read a visitor's consent from the site's\n * consent platform (Cookiebot, OneTrust, CookieYes, IAB TCF v2.2, Google\n * Consent Mode v2, or a cookie/check of your own). Its own entry so installs\n * that never configure `consentFrom` don't download it. */\nexport {\n consentWatcher,\n consentFromCookies,\n consentModeGranted,\n tcStringPurposes,\n cookiebotCookieGrants,\n onetrustCookieGrants,\n cookieyesCookieGrants,\n} from './consent-sources.js';\nexport type { ConsentSource, ConsentPreset, ConsentWatcher } from './consent-sources.js';\n","// Consent sources: where the SDK reads a visitor's consent decision from, so a\n// site keeps its own consent manager (CMP) and we only OBSERVE it. Shared by\n// React (`consentFrom`), Next.js `AdaptiveRoot` (server read of the CMP's own\n// cookie → SSR for visitors who already consented) and the snippet.\n//\n// Presets encode each platform's documented API, verified 2026-09-24:\n// - Cookiebot: `Cookiebot.consent.{preferences,statistics,marketing}`; window\n// events CookiebotOnAccept / CookiebotOnDecline (both also fire on load for a\n// returning visitor) / CookiebotOnConsentReady; cookie `CookieConsent` =\n// `{stamp:'…',necessary:true,preferences:…,statistics:…,marketing:…,…}`,\n// \"0\" = declined, \"-1\" = consent not required in the visitor's region.\n// - OneTrust: `OnetrustActiveGroups` (\",C0001,C0002,\"), window event\n// OneTrustGroupsUpdated; cookie `OptanonConsent` with `groups=C0001:1,C0002:0`.\n// C0002 = Performance.\n// - CookieYes: `getCkyConsent().categories.{functional,analytics,performance,\n// advertisement}` (only after the banner loads); `cookieyes_consent_update`\n// dispatched on DOCUMENT; cookie `cookieyes-consent` observed as\n// `consentid:…,consent:yes,…,analytics:yes,…` (not officially documented —\n// used server-side only, and an unrecognised value is \"unknown\", not \"no\").\n// - IAB TCF v2.2: `__tcfapi('addEventListener', 2, cb)`; granted when GDPR\n// doesn't apply or every required purpose has consent. Server: the TC string\n// in `euconsent-v2` (the de-facto cookie; not every CMP writes it).\n// - Google Consent Mode v2: the latest `consent default|update` command in\n// `dataLayer` for the storage type. Most CMPs (Cookiebot, OneTrust,\n// CookieYes, Usercentrics, Didomi…) drive it, so it is a universal adapter.\n//\n// Every read is re-done from the source on each signal — an event payload is\n// never trusted — and a revocation reads false, which the callers turn into a\n// teardown. Unknown ≠ granted: a source that can't be read gates.\n\nexport type ConsentPreset = 'cookiebot' | 'onetrust' | 'cookieyes' | 'tcf' | 'google-consent-mode';\n\nexport type ConsentSource =\n | ConsentPreset\n | { cmp: 'cookiebot'; category?: 'preferences' | 'statistics' | 'marketing' }\n | { cmp: 'onetrust'; group?: string }\n | { cmp: 'cookieyes'; category?: 'functional' | 'analytics' | 'performance' | 'advertisement' }\n | { cmp: 'tcf'; purposes?: number[] }\n | {\n cmp: 'google-consent-mode';\n type?: 'analytics_storage' | 'ad_storage' | 'personalization_storage' | 'functionality_storage';\n dataLayer?: string;\n }\n | {\n cmp?: undefined;\n /** Cookie to read. Granted when its value equals `value`. */\n cookie?: string;\n /** Cookie value that means granted. @default 'accepted' */\n value?: string;\n /** Predicate for CMPs with a JS API. Takes precedence over `cookie`. */\n check?: () => boolean;\n /** Event that signals a decision (listened on window AND document). */\n event?: string;\n };\n\nexport type ConsentWatcher = {\n /** The decision right now: true/false, or null when the source can't tell\n * yet (CMP not loaded, no decision stored). Callers treat null as \"keep\n * whatever you knew\" — e.g. the server's read — and never as granted. */\n read(): boolean | null;\n /** Call `onChange` whenever the decision may have changed. */\n subscribe(onChange: () => void): () => void;\n};\n\ntype AnyWin = Window & Record<string, unknown>;\n\nconst decode = (v: string): string => {\n try {\n return decodeURIComponent(v);\n } catch {\n return v;\n }\n};\n\nfunction docCookie(doc: Document | undefined, name: string): string | undefined {\n if (!doc) return undefined;\n for (const part of doc.cookie.split(';')) {\n const i = part.indexOf('=');\n if (i > 0 && part.slice(0, i).trim() === name) return part.slice(i + 1).trim();\n }\n return undefined;\n}\n\n/** Listen to `names` on both window and document (CMPs use either). */\nfunction listen(win: Window, names: string[], cb: () => void): () => void {\n const targets: EventTarget[] = [win, ...(win.document ? [win.document] : [])];\n for (const t of targets) for (const n of names) t.addEventListener(n, cb);\n return () => {\n for (const t of targets) for (const n of names) t.removeEventListener(n, cb);\n };\n}\n\n// ── Cookie parsers (also used server-side) ────────────────────────────────\n\n/** Cookiebot `CookieConsent`: true/false for `category`, null when unknown. */\nexport function cookiebotCookieGrants(raw: string | undefined, category = 'statistics'): boolean | null {\n if (raw == null || raw === '') return null;\n const v = decode(raw).trim();\n if (v === '-1') return true; // consent not required in this region\n if (v === '0') return false;\n const m = new RegExp(`[{,]\\\\s*${category}\\\\s*:\\\\s*(true|false)`).exec(v);\n return m ? m[1] === 'true' : null;\n}\n\n/** OneTrust `OptanonConsent`: is `group` active? null when unknown. */\nexport function onetrustCookieGrants(raw: string | undefined, group = 'C0002'): boolean | null {\n if (raw == null || raw === '') return null;\n const groups = /(?:^|&)groups=([^&]*)/.exec(decode(raw))?.[1];\n if (groups == null) return null;\n for (const pair of decode(groups).split(',')) {\n const [g, on] = pair.split(':');\n if (g === group) return on === '1';\n }\n return null;\n}\n\n/** CookieYes `cookieyes-consent`: `category:yes|no`, null when unrecognised. */\nexport function cookieyesCookieGrants(raw: string | undefined, category = 'analytics'): boolean | null {\n if (raw == null || raw === '') return null;\n const m = new RegExp(`(?:^|,)${category}:(yes|no)(?:,|$)`).exec(decode(raw));\n return m ? m[1] === 'yes' : null;\n}\n\n/**\n * Purpose consents from an IAB TCF v2 TC string (core segment). Bit layout\n * (TCF v2.2 spec): Version 6 · Created 36 · LastUpdated 36 · CmpId 12 ·\n * CmpVersion 12 · ConsentScreen 6 · ConsentLanguage 12 · VendorListVersion 12\n * · TcfPolicyVersion 6 · IsServiceSpecific 1 · UseNonStandardTexts 1 ·\n * SpecialFeatureOptIns 12 · PurposesConsent 24 → purposes start at bit 152.\n * Null for anything that isn't a v2 string.\n */\nexport function tcStringPurposes(tc: string | undefined): Set<number> | null {\n if (!tc) return null;\n const core = tc.split('.')[0]!;\n if (!/^[A-Za-z0-9_-]+$/.test(core)) return null;\n const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';\n let bits = '';\n for (const ch of core) bits += alphabet.indexOf(ch).toString(2).padStart(6, '0');\n if (bits.length < 176 || parseInt(bits.slice(0, 6), 2) !== 2) return null;\n const out = new Set<number>();\n for (let p = 1; p <= 24; p++) if (bits[151 + p] === '1') out.add(p);\n return out;\n}\n\n// ── Normalisation ─────────────────────────────────────────────────────────\n\ntype Norm =\n | { cmp: 'cookiebot'; category: string }\n | { cmp: 'onetrust'; group: string }\n | { cmp: 'cookieyes'; category: string }\n | { cmp: 'tcf'; purposes: number[] }\n | { cmp: 'google-consent-mode'; type: string; dataLayer: string }\n | { cmp: 'custom'; cookie?: string; value: string; check?: () => boolean; event?: string };\n\nfunction normalize(input: ConsentSource): Norm {\n const src = (typeof input === 'string' ? { cmp: input } : input) as Exclude<ConsentSource, string>;\n switch (src.cmp) {\n case 'cookiebot':\n return { cmp: 'cookiebot', category: src.category ?? 'statistics' };\n case 'onetrust':\n return { cmp: 'onetrust', group: src.group ?? 'C0002' };\n case 'cookieyes':\n return { cmp: 'cookieyes', category: src.category ?? 'analytics' };\n case 'tcf':\n return { cmp: 'tcf', purposes: src.purposes && src.purposes.length > 0 ? src.purposes : [1] };\n case 'google-consent-mode':\n return { cmp: 'google-consent-mode', type: src.type ?? 'analytics_storage', dataLayer: src.dataLayer ?? 'dataLayer' };\n default:\n return { cmp: 'custom', cookie: src.cookie, value: src.value ?? 'accepted', check: src.check, event: src.event };\n }\n}\n\n/**\n * Server-side read from the request's cookies (Next.js `AdaptiveRoot`).\n * true/false when the CMP's cookie decides it, null when it can't be known on\n * the server (no cookie yet, a JS-only source) — the caller then gates the\n * first paint and lets the browser decide.\n */\nexport function consentFromCookies(src: ConsentSource, getCookie: (name: string) => string | undefined): boolean | null {\n const n = normalize(src);\n switch (n.cmp) {\n case 'cookiebot':\n return cookiebotCookieGrants(getCookie('CookieConsent'), n.category);\n case 'onetrust':\n return onetrustCookieGrants(getCookie('OptanonConsent'), n.group);\n case 'cookieyes':\n return cookieyesCookieGrants(getCookie('cookieyes-consent'), n.category);\n case 'tcf': {\n const p = tcStringPurposes(getCookie('euconsent-v2'));\n return p ? n.purposes.every((x) => p.has(x)) : null;\n }\n case 'google-consent-mode':\n return null;\n case 'custom':\n if (!n.cookie || n.check) return null;\n return getCookie(n.cookie) === n.value;\n }\n}\n\n/** The latest Consent Mode state for `type` in `dataLayer`, or null. */\nexport function consentModeGranted(dataLayer: unknown, type = 'analytics_storage'): boolean | null {\n if (!Array.isArray(dataLayer)) return null;\n let state: boolean | null = null;\n for (const item of dataLayer) {\n // gtag() pushes `arguments` objects; GTM templates push arrays.\n const args = item && typeof item === 'object' && 'length' in (item as object) ? Array.prototype.slice.call(item) : null;\n if (!args || args[0] !== 'consent' || (args[1] !== 'default' && args[1] !== 'update')) continue;\n const v = (args[2] as Record<string, unknown> | undefined)?.[type];\n if (v === 'granted') state = true;\n else if (v === 'denied') state = false;\n }\n return state;\n}\n\n// ── Browser watcher ───────────────────────────────────────────────────────\n\nexport function consentWatcher(src: ConsentSource, win: Window = window): ConsentWatcher {\n const n = normalize(src);\n const w = win as AnyWin;\n const doc = win.document;\n switch (n.cmp) {\n case 'cookiebot':\n return {\n read: () => {\n const cb = w.Cookiebot as { consent?: Record<string, unknown> } | undefined;\n if (cb?.consent && typeof cb.consent[n.category] === 'boolean') return cb.consent[n.category] === true;\n return cookiebotCookieGrants(docCookie(doc, 'CookieConsent'), n.category);\n },\n subscribe: (cb) => listen(win, ['CookiebotOnAccept', 'CookiebotOnDecline', 'CookiebotOnConsentReady', 'CookiebotOnLoad'], cb),\n };\n case 'onetrust':\n return {\n read: () => {\n const groups = w.OnetrustActiveGroups;\n if (typeof groups === 'string') return `,${groups},`.includes(`,${n.group},`);\n return onetrustCookieGrants(docCookie(doc, 'OptanonConsent'), n.group);\n },\n subscribe: (cb) => listen(win, ['OneTrustGroupsUpdated'], cb),\n };\n case 'cookieyes':\n return {\n read: () => {\n const get = w.getCkyConsent as (() => { categories?: Record<string, unknown> }) | undefined;\n if (typeof get === 'function') {\n try {\n const cats = get()?.categories;\n if (cats && typeof cats[n.category] === 'boolean') return cats[n.category] === true;\n } catch {\n /* banner not ready — fall through to the cookie */\n }\n }\n return cookieyesCookieGrants(docCookie(doc, 'cookieyes-consent'), n.category);\n },\n subscribe: (cb) => listen(win, ['cookieyes_consent_update', 'cookieyes_banner_load', 'cookieyes_banner_loaded'], cb),\n };\n case 'tcf': {\n let granted: boolean | null = null;\n return {\n read: () => granted,\n subscribe: (cb) => {\n type TcData = { gdprApplies?: boolean; eventStatus?: string; listenerId?: number; purpose?: { consents?: Record<string, boolean> } };\n type TcfApi = (cmd: string, v: number, cb: (d: TcData, ok: boolean) => void, param?: unknown) => void;\n let listenerId: number | undefined;\n let stopped = false;\n const onData = (d: TcData, ok: boolean): void => {\n if (!ok || stopped) return;\n if (typeof d.listenerId === 'number') listenerId = d.listenerId;\n // cmpuishown = the banner is up: no decision yet.\n if (d.eventStatus === 'cmpuishown') granted = false;\n else granted = d.gdprApplies === false || n.purposes.every((p) => d.purpose?.consents?.[p] === true);\n cb();\n };\n // CMPs install the IAB stub early, but a late one needs a moment.\n let tries = 0;\n const attach = (): void => {\n if (stopped) return;\n const api = w.__tcfapi as TcfApi | undefined;\n if (typeof api === 'function') api('addEventListener', 2, onData);\n else if (tries++ < 40) window.setTimeout(attach, 250);\n };\n attach();\n return () => {\n stopped = true;\n const api = w.__tcfapi as TcfApi | undefined;\n if (typeof api === 'function' && listenerId !== undefined) api('removeEventListener', 2, () => undefined, listenerId);\n };\n },\n };\n }\n case 'google-consent-mode': {\n const layer = (): unknown => w[n.dataLayer];\n return {\n read: () => consentModeGranted(layer(), n.type),\n subscribe: (cb) => {\n // gtag.js and GTM replace dataLayer.push with their own; wrapping it\n // can be undone by a later load, so a light poll backs the wrapper.\n const dl = (w[n.dataLayer] ??= []) as unknown[] & { push: (...a: unknown[]) => number };\n const original = dl.push;\n const wrapped = function (this: unknown, ...a: unknown[]): number {\n const r = original.apply(dl, a);\n cb();\n return r;\n };\n dl.push = wrapped;\n const timer = window.setInterval(cb, 1000);\n return () => {\n window.clearInterval(timer);\n if (dl.push === wrapped) dl.push = original;\n };\n },\n };\n }\n case 'custom':\n return {\n read: () => {\n if (n.check) {\n try {\n return n.check() === true;\n } catch {\n return false;\n }\n }\n if (!n.cookie) return null;\n const v = docCookie(doc, n.cookie);\n // No cookie yet = no decision yet; any other value = not granted.\n return v === undefined ? null : v === n.value;\n },\n subscribe: (cb) => (n.event ? listen(win, [n.event], cb) : () => undefined),\n };\n }\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,uBAAAC,EAAA,mBAAAC,EAAA,0BAAAC,EAAA,0BAAAC,EAAA,yBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAT,GCkEA,IAAMU,EAAUC,GAAsB,CACpC,GAAI,CACF,OAAO,mBAAmBA,CAAC,CAC7B,OAAQC,EAAA,CACN,OAAOD,CACT,CACF,EAEA,SAASE,EAAUC,EAA2BC,EAAkC,CAC9E,GAAKD,EACL,QAAWE,KAAQF,EAAI,OAAO,MAAM,GAAG,EAAG,CACxC,IAAMG,EAAID,EAAK,QAAQ,GAAG,EAC1B,GAAIC,EAAI,GAAKD,EAAK,MAAM,EAAGC,CAAC,EAAE,KAAK,IAAMF,EAAM,OAAOC,EAAK,MAAMC,EAAI,CAAC,EAA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IG,CAAC,EAC9B,OAAA1D,EAAG,EACI2D,CACT,EACAJ,EAAG,KAAOE,EACV,IAAMG,EAAQ,OAAO,YAAY5D,EAAI,GAAI,EACzC,MAAO,IAAM,CACX,OAAO,cAAc4D,CAAK,EACtBL,EAAG,OAASE,IAASF,EAAG,KAAOC,EACrC,CACF,CACF,CACF,CACA,IAAK,SACH,MAAO,CACL,KAAM,IAAM,CACV,GAAIrD,EAAE,MACJ,GAAI,CACF,OAAOA,EAAE,MAAM,IAAM,EACvB,OAAQZ,EAAA,CACN,MAAO,EACT,CAEF,GAAI,CAACY,EAAE,OAAQ,OAAO,KACtB,IAAMb,EAAIE,EAAUC,EAAKU,EAAE,MAAM,EAEjC,OAAOb,IAAM,OAAY,KAAOA,IAAMa,EAAE,KAC1C,EACA,UAAYH,GAAQG,EAAE,MAAQN,EAAOC,EAAK,CAACK,EAAE,KAAK,EAAGH,CAAE,EAAI,IAAG,EAChE,CACJ,CACF","names":["index_consent_exports","__export","consentFromCookies","consentModeGranted","consentWatcher","cookiebotCookieGrants","cookieyesCookieGrants","onetrustCookieGrants","tcStringPurposes","__toCommonJS","decode","v","e","docCookie","doc","name","part","i","listen","win","names","cb","targets","t","n","cookiebotCookieGrants","raw","category","m","onetrustCookieGrants","group","_a","groups","pair","g","on","cookieyesCookieGrants","tcStringPurposes","tc","core","alphabet","bits","ch","out","p","normalize","input","_b","_c","_d","_e","_f","src","consentFromCookies","getCookie","x","consentModeGranted","dataLayer","type","state","item","args","consentWatcher","w","get","cats","granted","listenerId","stopped","onData","d","ok","tries","attach","api","layer","dl","original","wrapped","a","r","timer"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./chunk-TMCGHANO.mjs";var g=r=>{try{return decodeURIComponent(r)}catch(t){return r}};function d(r,t){if(r)for(let e of r.cookie.split(";")){let o=e.indexOf("=");if(o>0&&e.slice(0,o).trim()===t)return e.slice(o+1).trim()}}function f(r,t,e){let o=[r,...r.document?[r.document]:[]];for(let s of o)for(let n of t)s.addEventListener(n,e);return()=>{for(let s of o)for(let n of t)s.removeEventListener(n,e)}}function b(r,t="statistics"){if(r==null||r==="")return null;let e=g(r).trim();if(e==="-1")return!0;if(e==="0")return!1;let o=new RegExp(`[{,]\\s*${t}\\s*:\\s*(true|false)`).exec(e);return o?o[1]==="true":null}function v(r,t="C0002"){var o;if(r==null||r==="")return null;let e=(o=/(?:^|&)groups=([^&]*)/.exec(g(r)))==null?void 0:o[1];if(e==null)return null;for(let s of g(e).split(",")){let[n,i]=s.split(":");if(n===t)return i==="1"}return null}function C(r,t="analytics"){if(r==null||r==="")return null;let e=new RegExp(`(?:^|,)${t}:(yes|no)(?:,|$)`).exec(g(r));return e?e[1]==="yes":null}function _(r){if(!r)return null;let t=r.split(".")[0];if(!/^[A-Za-z0-9_-]+$/.test(t))return null;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",o="";for(let n of t)o+=e.indexOf(n).toString(2).padStart(6,"0");if(o.length<176||parseInt(o.slice(0,6),2)!==2)return null;let s=new Set;for(let n=1;n<=24;n++)o[151+n]==="1"&&s.add(n);return s}function w(r){var e,o,s,n,i,c;let t=typeof r=="string"?{cmp:r}:r;switch(t.cmp){case"cookiebot":return{cmp:"cookiebot",category:(e=t.category)!=null?e:"statistics"};case"onetrust":return{cmp:"onetrust",group:(o=t.group)!=null?o:"C0002"};case"cookieyes":return{cmp:"cookieyes",category:(s=t.category)!=null?s:"analytics"};case"tcf":return{cmp:"tcf",purposes:t.purposes&&t.purposes.length>0?t.purposes:[1]};case"google-consent-mode":return{cmp:"google-consent-mode",type:(n=t.type)!=null?n:"analytics_storage",dataLayer:(i=t.dataLayer)!=null?i:"dataLayer"};default:return{cmp:"custom",cookie:t.cookie,value:(c=t.value)!=null?c:"accepted",check:t.check,event:t.event}}}function A(r,t){let e=w(r);switch(e.cmp){case"cookiebot":return b(t("CookieConsent"),e.category);case"onetrust":return v(t("OptanonConsent"),e.group);case"cookieyes":return C(t("cookieyes-consent"),e.category);case"tcf":{let o=_(t("euconsent-v2"));return o?e.purposes.every(s=>o.has(s)):null}case"google-consent-mode":return null;case"custom":return!e.cookie||e.check?null:t(e.cookie)===e.value}}function S(r,t="analytics_storage"){var o;if(!Array.isArray(r))return null;let e=null;for(let s of r){let n=s&&typeof s=="object"&&"length"in s?Array.prototype.slice.call(s):null;if(!n||n[0]!=="consent"||n[1]!=="default"&&n[1]!=="update")continue;let i=(o=n[2])==null?void 0:o[t];i==="granted"?e=!0:i==="denied"&&(e=!1)}return e}function L(r,t=window){let e=w(r),o=t,s=t.document;switch(e.cmp){case"cookiebot":return{read:()=>{let n=o.Cookiebot;return n!=null&&n.consent&&typeof n.consent[e.category]=="boolean"?n.consent[e.category]===!0:b(d(s,"CookieConsent"),e.category)},subscribe:n=>f(t,["CookiebotOnAccept","CookiebotOnDecline","CookiebotOnConsentReady","CookiebotOnLoad"],n)};case"onetrust":return{read:()=>{let n=o.OnetrustActiveGroups;return typeof n=="string"?`,${n},`.includes(`,${e.group},`):v(d(s,"OptanonConsent"),e.group)},subscribe:n=>f(t,["OneTrustGroupsUpdated"],n)};case"cookieyes":return{read:()=>{var i;let n=o.getCkyConsent;if(typeof n=="function")try{let c=(i=n())==null?void 0:i.categories;if(c&&typeof c[e.category]=="boolean")return c[e.category]===!0}catch(c){}return C(d(s,"cookieyes-consent"),e.category)},subscribe:n=>f(t,["cookieyes_consent_update","cookieyes_banner_load","cookieyes_banner_loaded"],n)};case"tcf":{let n=null;return{read:()=>n,subscribe:i=>{let c,a=!1,p=(u,m)=>{!m||a||(typeof u.listenerId=="number"&&(c=u.listenerId),u.eventStatus==="cmpuishown"?n=!1:n=u.gdprApplies===!1||e.purposes.every(k=>{var h,x;return((x=(h=u.purpose)==null?void 0:h.consents)==null?void 0:x[k])===!0}),i())},y=0,l=()=>{if(a)return;let u=o.__tcfapi;typeof u=="function"?u("addEventListener",2,p):y++<40&&window.setTimeout(l,250)};return l(),()=>{a=!0;let u=o.__tcfapi;typeof u=="function"&&c!==void 0&&u("removeEventListener",2,()=>{},c)}}}}case"google-consent-mode":{let n=()=>o[e.dataLayer];return{read:()=>S(n(),e.type),subscribe:i=>{var l,u;let c=(u=o[l=e.dataLayer])!=null?u:o[l]=[],a=c.push,p=function(...m){let k=a.apply(c,m);return i(),k};c.push=p;let y=window.setInterval(i,1e3);return()=>{window.clearInterval(y),c.push===p&&(c.push=a)}}}}case"custom":return{read:()=>{if(e.check)try{return e.check()===!0}catch(i){return!1}if(!e.cookie)return null;let n=d(s,e.cookie);return n===void 0?null:n===e.value},subscribe:n=>e.event?f(t,[e.event],n):()=>{}}}}export{A as consentFromCookies,S as consentModeGranted,L as consentWatcher,b as cookiebotCookieGrants,C as cookieyesCookieGrants,v as onetrustCookieGrants,_ as tcStringPurposes};
|
|
2
|
+
//# sourceMappingURL=index-consent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/consent-sources.ts"],"sourcesContent":["// Consent sources: where the SDK reads a visitor's consent decision from, so a\n// site keeps its own consent manager (CMP) and we only OBSERVE it. Shared by\n// React (`consentFrom`), Next.js `AdaptiveRoot` (server read of the CMP's own\n// cookie → SSR for visitors who already consented) and the snippet.\n//\n// Presets encode each platform's documented API, verified 2026-09-24:\n// - Cookiebot: `Cookiebot.consent.{preferences,statistics,marketing}`; window\n// events CookiebotOnAccept / CookiebotOnDecline (both also fire on load for a\n// returning visitor) / CookiebotOnConsentReady; cookie `CookieConsent` =\n// `{stamp:'…',necessary:true,preferences:…,statistics:…,marketing:…,…}`,\n// \"0\" = declined, \"-1\" = consent not required in the visitor's region.\n// - OneTrust: `OnetrustActiveGroups` (\",C0001,C0002,\"), window event\n// OneTrustGroupsUpdated; cookie `OptanonConsent` with `groups=C0001:1,C0002:0`.\n// C0002 = Performance.\n// - CookieYes: `getCkyConsent().categories.{functional,analytics,performance,\n// advertisement}` (only after the banner loads); `cookieyes_consent_update`\n// dispatched on DOCUMENT; cookie `cookieyes-consent` observed as\n// `consentid:…,consent:yes,…,analytics:yes,…` (not officially documented —\n// used server-side only, and an unrecognised value is \"unknown\", not \"no\").\n// - IAB TCF v2.2: `__tcfapi('addEventListener', 2, cb)`; granted when GDPR\n// doesn't apply or every required purpose has consent. Server: the TC string\n// in `euconsent-v2` (the de-facto cookie; not every CMP writes it).\n// - Google Consent Mode v2: the latest `consent default|update` command in\n// `dataLayer` for the storage type. Most CMPs (Cookiebot, OneTrust,\n// CookieYes, Usercentrics, Didomi…) drive it, so it is a universal adapter.\n//\n// Every read is re-done from the source on each signal — an event payload is\n// never trusted — and a revocation reads false, which the callers turn into a\n// teardown. Unknown ≠ granted: a source that can't be read gates.\n\nexport type ConsentPreset = 'cookiebot' | 'onetrust' | 'cookieyes' | 'tcf' | 'google-consent-mode';\n\nexport type ConsentSource =\n | ConsentPreset\n | { cmp: 'cookiebot'; category?: 'preferences' | 'statistics' | 'marketing' }\n | { cmp: 'onetrust'; group?: string }\n | { cmp: 'cookieyes'; category?: 'functional' | 'analytics' | 'performance' | 'advertisement' }\n | { cmp: 'tcf'; purposes?: number[] }\n | {\n cmp: 'google-consent-mode';\n type?: 'analytics_storage' | 'ad_storage' | 'personalization_storage' | 'functionality_storage';\n dataLayer?: string;\n }\n | {\n cmp?: undefined;\n /** Cookie to read. Granted when its value equals `value`. */\n cookie?: string;\n /** Cookie value that means granted. @default 'accepted' */\n value?: string;\n /** Predicate for CMPs with a JS API. Takes precedence over `cookie`. */\n check?: () => boolean;\n /** Event that signals a decision (listened on window AND document). */\n event?: string;\n };\n\nexport type ConsentWatcher = {\n /** The decision right now: true/false, or null when the source can't tell\n * yet (CMP not loaded, no decision stored). Callers treat null as \"keep\n * whatever you knew\" — e.g. the server's read — and never as granted. */\n read(): boolean | null;\n /** Call `onChange` whenever the decision may have changed. */\n subscribe(onChange: () => void): () => void;\n};\n\ntype AnyWin = Window & Record<string, unknown>;\n\nconst decode = (v: string): string => {\n try {\n return decodeURIComponent(v);\n } catch {\n return v;\n }\n};\n\nfunction docCookie(doc: Document | undefined, name: string): string | undefined {\n if (!doc) return undefined;\n for (const part of doc.cookie.split(';')) {\n const i = part.indexOf('=');\n if (i > 0 && part.slice(0, i).trim() === name) return part.slice(i + 1).trim();\n }\n return undefined;\n}\n\n/** Listen to `names` on both window and document (CMPs use either). */\nfunction listen(win: Window, names: string[], cb: () => void): () => void {\n const targets: EventTarget[] = [win, ...(win.document ? [win.document] : [])];\n for (const t of targets) for (const n of names) t.addEventListener(n, cb);\n return () => {\n for (const t of targets) for (const n of names) t.removeEventListener(n, cb);\n };\n}\n\n// ── Cookie parsers (also used server-side) ────────────────────────────────\n\n/** Cookiebot `CookieConsent`: true/false for `category`, null when unknown. */\nexport function cookiebotCookieGrants(raw: string | undefined, category = 'statistics'): boolean | null {\n if (raw == null || raw === '') return null;\n const v = decode(raw).trim();\n if (v === '-1') return true; // consent not required in this region\n if (v === '0') return false;\n const m = new RegExp(`[{,]\\\\s*${category}\\\\s*:\\\\s*(true|false)`).exec(v);\n return m ? m[1] === 'true' : null;\n}\n\n/** OneTrust `OptanonConsent`: is `group` active? null when unknown. */\nexport function onetrustCookieGrants(raw: string | undefined, group = 'C0002'): boolean | null {\n if (raw == null || raw === '') return null;\n const groups = /(?:^|&)groups=([^&]*)/.exec(decode(raw))?.[1];\n if (groups == null) return null;\n for (const pair of decode(groups).split(',')) {\n const [g, on] = pair.split(':');\n if (g === group) return on === '1';\n }\n return null;\n}\n\n/** CookieYes `cookieyes-consent`: `category:yes|no`, null when unrecognised. */\nexport function cookieyesCookieGrants(raw: string | undefined, category = 'analytics'): boolean | null {\n if (raw == null || raw === '') return null;\n const m = new RegExp(`(?:^|,)${category}:(yes|no)(?:,|$)`).exec(decode(raw));\n return m ? m[1] === 'yes' : null;\n}\n\n/**\n * Purpose consents from an IAB TCF v2 TC string (core segment). Bit layout\n * (TCF v2.2 spec): Version 6 · Created 36 · LastUpdated 36 · CmpId 12 ·\n * CmpVersion 12 · ConsentScreen 6 · ConsentLanguage 12 · VendorListVersion 12\n * · TcfPolicyVersion 6 · IsServiceSpecific 1 · UseNonStandardTexts 1 ·\n * SpecialFeatureOptIns 12 · PurposesConsent 24 → purposes start at bit 152.\n * Null for anything that isn't a v2 string.\n */\nexport function tcStringPurposes(tc: string | undefined): Set<number> | null {\n if (!tc) return null;\n const core = tc.split('.')[0]!;\n if (!/^[A-Za-z0-9_-]+$/.test(core)) return null;\n const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';\n let bits = '';\n for (const ch of core) bits += alphabet.indexOf(ch).toString(2).padStart(6, '0');\n if (bits.length < 176 || parseInt(bits.slice(0, 6), 2) !== 2) return null;\n const out = new Set<number>();\n for (let p = 1; p <= 24; p++) if (bits[151 + p] === '1') out.add(p);\n return out;\n}\n\n// ── Normalisation ─────────────────────────────────────────────────────────\n\ntype Norm =\n | { cmp: 'cookiebot'; category: string }\n | { cmp: 'onetrust'; group: string }\n | { cmp: 'cookieyes'; category: string }\n | { cmp: 'tcf'; purposes: number[] }\n | { cmp: 'google-consent-mode'; type: string; dataLayer: string }\n | { cmp: 'custom'; cookie?: string; value: string; check?: () => boolean; event?: string };\n\nfunction normalize(input: ConsentSource): Norm {\n const src = (typeof input === 'string' ? { cmp: input } : input) as Exclude<ConsentSource, string>;\n switch (src.cmp) {\n case 'cookiebot':\n return { cmp: 'cookiebot', category: src.category ?? 'statistics' };\n case 'onetrust':\n return { cmp: 'onetrust', group: src.group ?? 'C0002' };\n case 'cookieyes':\n return { cmp: 'cookieyes', category: src.category ?? 'analytics' };\n case 'tcf':\n return { cmp: 'tcf', purposes: src.purposes && src.purposes.length > 0 ? src.purposes : [1] };\n case 'google-consent-mode':\n return { cmp: 'google-consent-mode', type: src.type ?? 'analytics_storage', dataLayer: src.dataLayer ?? 'dataLayer' };\n default:\n return { cmp: 'custom', cookie: src.cookie, value: src.value ?? 'accepted', check: src.check, event: src.event };\n }\n}\n\n/**\n * Server-side read from the request's cookies (Next.js `AdaptiveRoot`).\n * true/false when the CMP's cookie decides it, null when it can't be known on\n * the server (no cookie yet, a JS-only source) — the caller then gates the\n * first paint and lets the browser decide.\n */\nexport function consentFromCookies(src: ConsentSource, getCookie: (name: string) => string | undefined): boolean | null {\n const n = normalize(src);\n switch (n.cmp) {\n case 'cookiebot':\n return cookiebotCookieGrants(getCookie('CookieConsent'), n.category);\n case 'onetrust':\n return onetrustCookieGrants(getCookie('OptanonConsent'), n.group);\n case 'cookieyes':\n return cookieyesCookieGrants(getCookie('cookieyes-consent'), n.category);\n case 'tcf': {\n const p = tcStringPurposes(getCookie('euconsent-v2'));\n return p ? n.purposes.every((x) => p.has(x)) : null;\n }\n case 'google-consent-mode':\n return null;\n case 'custom':\n if (!n.cookie || n.check) return null;\n return getCookie(n.cookie) === n.value;\n }\n}\n\n/** The latest Consent Mode state for `type` in `dataLayer`, or null. */\nexport function consentModeGranted(dataLayer: unknown, type = 'analytics_storage'): boolean | null {\n if (!Array.isArray(dataLayer)) return null;\n let state: boolean | null = null;\n for (const item of dataLayer) {\n // gtag() pushes `arguments` objects; GTM templates push arrays.\n const args = item && typeof item === 'object' && 'length' in (item as object) ? Array.prototype.slice.call(item) : null;\n if (!args || args[0] !== 'consent' || (args[1] !== 'default' && args[1] !== 'update')) continue;\n const v = (args[2] as Record<string, unknown> | undefined)?.[type];\n if (v === 'granted') state = true;\n else if (v === 'denied') state = false;\n }\n return state;\n}\n\n// ── Browser watcher ───────────────────────────────────────────────────────\n\nexport function consentWatcher(src: ConsentSource, win: Window = window): ConsentWatcher {\n const n = normalize(src);\n const w = win as AnyWin;\n const doc = win.document;\n switch (n.cmp) {\n case 'cookiebot':\n return {\n read: () => {\n const cb = w.Cookiebot as { consent?: Record<string, unknown> } | undefined;\n if (cb?.consent && typeof cb.consent[n.category] === 'boolean') return cb.consent[n.category] === true;\n return cookiebotCookieGrants(docCookie(doc, 'CookieConsent'), n.category);\n },\n subscribe: (cb) => listen(win, ['CookiebotOnAccept', 'CookiebotOnDecline', 'CookiebotOnConsentReady', 'CookiebotOnLoad'], cb),\n };\n case 'onetrust':\n return {\n read: () => {\n const groups = w.OnetrustActiveGroups;\n if (typeof groups === 'string') return `,${groups},`.includes(`,${n.group},`);\n return onetrustCookieGrants(docCookie(doc, 'OptanonConsent'), n.group);\n },\n subscribe: (cb) => listen(win, ['OneTrustGroupsUpdated'], cb),\n };\n case 'cookieyes':\n return {\n read: () => {\n const get = w.getCkyConsent as (() => { categories?: Record<string, unknown> }) | undefined;\n if (typeof get === 'function') {\n try {\n const cats = get()?.categories;\n if (cats && typeof cats[n.category] === 'boolean') return cats[n.category] === true;\n } catch {\n /* banner not ready — fall through to the cookie */\n }\n }\n return cookieyesCookieGrants(docCookie(doc, 'cookieyes-consent'), n.category);\n },\n subscribe: (cb) => listen(win, ['cookieyes_consent_update', 'cookieyes_banner_load', 'cookieyes_banner_loaded'], cb),\n };\n case 'tcf': {\n let granted: boolean | null = null;\n return {\n read: () => granted,\n subscribe: (cb) => {\n type TcData = { gdprApplies?: boolean; eventStatus?: string; listenerId?: number; purpose?: { consents?: Record<string, boolean> } };\n type TcfApi = (cmd: string, v: number, cb: (d: TcData, ok: boolean) => void, param?: unknown) => void;\n let listenerId: number | undefined;\n let stopped = false;\n const onData = (d: TcData, ok: boolean): void => {\n if (!ok || stopped) return;\n if (typeof d.listenerId === 'number') listenerId = d.listenerId;\n // cmpuishown = the banner is up: no decision yet.\n if (d.eventStatus === 'cmpuishown') granted = false;\n else granted = d.gdprApplies === false || n.purposes.every((p) => d.purpose?.consents?.[p] === true);\n cb();\n };\n // CMPs install the IAB stub early, but a late one needs a moment.\n let tries = 0;\n const attach = (): void => {\n if (stopped) return;\n const api = w.__tcfapi as TcfApi | undefined;\n if (typeof api === 'function') api('addEventListener', 2, onData);\n else if (tries++ < 40) window.setTimeout(attach, 250);\n };\n attach();\n return () => {\n stopped = true;\n const api = w.__tcfapi as TcfApi | undefined;\n if (typeof api === 'function' && listenerId !== undefined) api('removeEventListener', 2, () => undefined, listenerId);\n };\n },\n };\n }\n case 'google-consent-mode': {\n const layer = (): unknown => w[n.dataLayer];\n return {\n read: () => consentModeGranted(layer(), n.type),\n subscribe: (cb) => {\n // gtag.js and GTM replace dataLayer.push with their own; wrapping it\n // can be undone by a later load, so a light poll backs the wrapper.\n const dl = (w[n.dataLayer] ??= []) as unknown[] & { push: (...a: unknown[]) => number };\n const original = dl.push;\n const wrapped = function (this: unknown, ...a: unknown[]): number {\n const r = original.apply(dl, a);\n cb();\n return r;\n };\n dl.push = wrapped;\n const timer = window.setInterval(cb, 1000);\n return () => {\n window.clearInterval(timer);\n if (dl.push === wrapped) dl.push = original;\n };\n },\n };\n }\n case 'custom':\n return {\n read: () => {\n if (n.check) {\n try {\n return n.check() === true;\n } catch {\n return false;\n }\n }\n if (!n.cookie) return null;\n const v = docCookie(doc, n.cookie);\n // No cookie yet = no decision yet; any other value = not granted.\n return v === undefined ? null : v === n.value;\n },\n subscribe: (cb) => (n.event ? listen(win, [n.event], cb) : () => undefined),\n };\n }\n}\n"],"mappings":"6BAkEA,IAAMA,EAAUC,GAAsB,CACpC,GAAI,CACF,OAAO,mBAAmBA,CAAC,CAC7B,OAAQC,EAAA,CACN,OAAOD,CACT,CACF,EAEA,SAASE,EAAUC,EAA2BC,EAAkC,CAC9E,GAAKD,EACL,QAAWE,KAAQF,EAAI,OAAO,MAAM,GAAG,EAAG,CACxC,IAAMG,EAAID,EAAK,QAAQ,GAAG,EAC1B,GAAIC,EAAI,GAAKD,EAAK,MAAM,EAAGC,CAAC,EAAE,KAAK,IAAMF,EAAM,OAAOC,EAAK,MAAMC,EAAI,CAAC,EAAE,KAAK,CAC/E,CAEF,CAGA,SAASC,EAAOC,EAAaC,EAAiBC,EAA4B,CACxE,IAAMC,EAAyB,CAACH,EAAK,GAAIA,EAAI,SAAW,CAACA,EAAI,QAAQ,EAAI,CAAC,CAAE,EAC5E,QAAWI,KAAKD,EAAS,QAAW,K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,CACA,IAAK,SACH,MAAO,CACL,KAAM,IAAM,CACV,GAAIvB,EAAE,MACJ,GAAI,CACF,OAAOA,EAAE,MAAM,IAAM,EACvB,OAAQ1C,EAAA,CACN,MAAO,EACT,CAEF,GAAI,CAAC0C,EAAE,OAAQ,OAAO,KACtB,IAAM3C,EAAIE,EAAUC,EAAKwC,EAAE,MAAM,EAEjC,OAAO3C,IAAM,OAAY,KAAOA,IAAM2C,EAAE,KAC1C,EACA,UAAYjC,GAAQiC,EAAE,MAAQpC,EAAOC,EAAK,CAACmC,EAAE,KAAK,EAAGjC,CAAE,EAAI,IAAG,EAChE,CACJ,CACF","names":["decode","v","e","docCookie","doc","name","part","i","listen","win","names","cb","targets","t","cookiebotCookieGrants","raw","category","m","onetrustCookieGrants","group","_a","groups","pair","g","on","cookieyesCookieGrants","tcStringPurposes","tc","core","alphabet","bits","ch","out","p","normalize","input","_b","_c","_d","_e","_f","src","consentFromCookies","getCookie","n","x","consentModeGranted","dataLayer","type","state","item","args","consentWatcher","w","get","cats","granted","listenerId","stopped","onData","d","ok","tries","attach","api","layer","dl","original","wrapped","a","r","timer"]}
|