@jini-ai/cookie-consent 0.7.3-next.1 → 0.7.3-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/client.min.js +1 -1
  2. package/dist/contract.d.ts +2 -78
  3. package/dist/extensions.min.js +1 -1
  4. package/dist/react/ConsentFields.d.ts +4 -1
  5. package/dist/react/ConsentFields.js +11 -5
  6. package/dist/render/css.d.ts +2 -12
  7. package/dist/site/config.d.ts +51 -0
  8. package/dist/site/config.js +75 -0
  9. package/dist/site/cookie-consent.d.ts +53 -0
  10. package/dist/site/cookie-consent.js +47 -0
  11. package/dist/site/document-assets.d.ts +44 -0
  12. package/dist/site/document-assets.js +78 -0
  13. package/dist/site/document-state.d.ts +71 -0
  14. package/dist/site/document-state.js +79 -0
  15. package/dist/site/ensure-privacy-defaults.d.ts +63 -0
  16. package/dist/site/ensure-privacy-defaults.js +44 -0
  17. package/dist/site/http.d.ts +281 -0
  18. package/dist/site/http.js +271 -0
  19. package/dist/site/pre-consent-cache.d.ts +33 -0
  20. package/dist/site/pre-consent-cache.js +43 -0
  21. package/dist/site/privacy-page-template.d.ts +9 -0
  22. package/dist/site/privacy-page-template.js +17 -0
  23. package/dist/site/readiness.d.ts +29 -0
  24. package/dist/site/readiness.js +91 -0
  25. package/dist/site/region-plugins.d.ts +90 -0
  26. package/dist/site/region-plugins.js +73 -0
  27. package/dist/site/request.d.ts +19 -0
  28. package/dist/site/request.js +29 -0
  29. package/dist/site/revisions.d.ts +33 -0
  30. package/dist/site/revisions.js +5 -0
  31. package/dist/site/revisions.repo.d.ts +20 -0
  32. package/dist/site/revisions.repo.js +53 -0
  33. package/dist/site/service.d.ts +204 -0
  34. package/dist/site/service.js +198 -0
  35. package/dist/site/settings.d.ts +54 -0
  36. package/dist/site/settings.js +100 -0
  37. package/dist/site/tool-registrations.d.ts +63 -0
  38. package/dist/site/tool-registrations.js +69 -0
  39. package/dist/site/validation.d.ts +21 -0
  40. package/dist/site/validation.js +77 -0
  41. package/package.json +138 -10
@@ -1 +1 @@
1
- "use strict";(()=>{var R="jini_choices",K="jini_region",H="jini:consent",J="jini:consent-ready",D="jini:consent-open",B="jini-consent-config",h=["functional","analytics","marketing"],G=["necessary",...h],V=["accept","reject","save","do-not-sell","withdraw"];var P="consent-adapter";var I=864e5,W=180*I,fe=6e4,M=/^[\w-]{16,128}$/,$=Object.freeze({necessary:!0,functional:!1,analytics:!1,marketing:!1});function z({configured:e,hint:t},n={}){return e!=="auto"?e:t==="us"?"opt-out":"opt-in"}var E=(e,t=e,n=t)=>({functional:e,analytics:t,marketing:n});function U({action:e,picked:t={}},n={}){return e==="accept"?E(!0):e==="save"?E(t.functional===!0,t.analytics===!0,t.marketing===!0):e==="do-not-sell"?E(t.functional!==!1,!1):E(!1)}function ge({flags:e,gpc:t},n={}){return{necessary:!0,functional:e.functional,analytics:e.analytics&&!t,marketing:e.marketing&&!t}}function Q({stored:e,policy:t,region:n,gpc:o,nowMs:r},{maxAgeMs:s=W,durable:p=!1,anonymous:C=!1}={}){let y=ye({stored:e,policy:t,nowMs:r},{maxAgeMs:s,anonymous:C}),m=ge({flags:C?$:y?.c??E(n==="opt-out"),gpc:o}),v={contract:1,policy:t,region:n,gpc:o,choices:m,...me({choices:m,live:y,durable:p,anonymous:C,gpc:o})};return y?{...v,status:"set",action:y.a,at:y.t,receipt:Ce(y)}:{...v,status:"pending",action:null,at:null,receipt:"none"}}function ye({stored:e,policy:t,nowMs:n},{maxAgeMs:o=W,anonymous:r=!1}={}){return!r&&e&&e.p===t&&e.t<=n+fe&&n-e.t<=o?e:null}function me({choices:e,live:t,durable:n,anonymous:o,gpc:r},s={}){let p=t&&n&&!t.r,C=o||p?$:e,y=C.analytics?"full":"none";return{allowed:C,analyticsLevel:o&&!r?"anonymous":y}}function Ce(e){return e.r?"stored":e.q?"pending":"local"}function Y({raw:e},t={}){if(!e||e.length>1024)return null;let n;try{n=JSON.parse(e)}catch{return null}if(!be(n))return null;let o={v:1,p:n.p,c:E(n.c.functional,n.c.analytics,n.c.marketing),t:n.t,a:n.a};return typeof n.r=="string"&&M.test(n.r)&&(o.r=n.r),n.q===1&&(o.q=1),o}function be(e){return!e||e.v!==1||typeof e.p!="string"||!Number.isFinite(e.t)?!1:V.includes(e.a)&&Se(e.c)}function Se(e){let t=e;return!t||typeof t!="object"?!1:["functional","analytics","marketing"].every(n=>Object.hasOwn(t,n)&&typeof t[n]=="boolean")}function X({state:e,consent:t=[]},n={}){return t.every(o=>G.includes(o)&&e.allowed[o]===!0)}var ve=/^[a-z0-9][a-z0-9._:-]{0,63}$/;function Z(e={},{slots:t=[],onProblem:n=()=>{}}={}){let o=new Map,r=[],s=new Set,p=new Set,C=a=>r.filter(c=>c.kind===a).sort((c,l)=>l.priority-c.priority).map(c=>c.value),y=a=>p.forEach(c=>{if(c.kind===a)try{c.fn(C(a))}catch{}});function m(a,c){let l=S=>(n({id:String(a.id),kind:a.kind,reason:S,...c.source?{source:c.source}:{}}),()=>{});if(!ve.test(String(a.id)))return l("short lowercase id");let A=o.get(a.kind).accept({contribution:a});if(typeof A=="string")return l(A);if(r.some(S=>S.kind===a.kind&&S.id===a.id))return l("duplicate id");let b={kind:a.kind,id:a.id,value:A,priority:c.priority??0};return r.push(b),y(a.kind),()=>{let S=r.indexOf(b);S>=0&&(r.splice(S,1),y(a.kind))}}let v={defineSlot({slot:a}){if(!o.has(a.kind)){o.set(a.kind,a);for(let c of s)c.raw.kind===a.kind&&(s.delete(c),c.dispose=m(c.raw,c.options))}},registerPlugin(a,c={}){if(o.has(a.kind))return m(a,c);let l={raw:a,options:c,dispose:()=>{s.delete(l)}};return s.add(l),()=>l.dispose()},list:({kind:a})=>C(a),subscribe({kind:a,listener:c}){let l={kind:a,fn:c};return p.add(l),()=>{p.delete(l)}}};for(let a of t)v.defineSlot({slot:a});return v}var ee={kind:P,accept({contribution:e}){return h.includes(e.category)?typeof e.grant=="function"||typeof e.src=="string"?e:"grant() or src needed":"category must be functional, analytics or marketing"}};var he=["type","data-src","data-type","data-consent-category"],xe=':not(html)[data-consent-open],a[href="#privacy-choices"]';function w({doc:e,name:t},n={}){let o=e.cookie.split(/;\s*/).find(r=>r.startsWith(t+"="));try{return o?decodeURIComponent(o.slice(t.length+1)):null}catch{return null}}function te({doc:e,name:t,value:n,maxAgeS:o},{domain:r}={}){let s=e.defaultView?.location.protocol==="https:"?"; Secure":"";e.cookie=`${t}=${encodeURIComponent(n)}; Path=/; Max-Age=${Math.floor(o)}; SameSite=Lax${s}`+(r?"; Domain="+r:"")}function Ae(e,t){let n=(e.defaultView?.location.hostname??"").split("."),o=`${t}=; Path=/; Max-Age=0`;e.cookie=o;for(let r=0;r<n.length-1;r++)e.cookie=`${o}; Domain=.${n.slice(r).join(".")}`}function x({doc:e,storage:t},n={}){if(t){for(let o of e.cookie.split(/;\s*/)){let r=o.split("=")[0];t.cookies?.some(s=>r.startsWith(s))&&Ae(e,r)}try{let o=e.defaultView.localStorage;for(let r of Object.keys(o))t.local?.some(s=>r.startsWith(s))&&o.removeItem(r)}catch{}}}function ne({doc:e,allowed:t,ran:n},o={}){e.querySelectorAll('script[type="text/plain"],iframe[data-src],template[data-jini-consent-resource]').forEach(r=>{let s=r.content,p=s?r.dataset.category:r.dataset.consentCategory;!h.includes(p)||!t[p]||(n.add(p),r.tagName==="IFRAME"?(r.src=r.dataset.src,r.removeAttribute("data-src")):r.replaceWith(s??Ee(e,r)))})}function Ee(e,t){let n=e.createElement("script");for(let{name:o,value:r}of t.attributes)he.includes(o)||n.setAttribute(o,r);return t.nonce&&(n.nonce=t.nonce),t.dataset.type&&(n.type=t.dataset.type),t.dataset.src?n.src=t.dataset.src:n.text=t.text,n.async=!1,n}function oe({api:e,doc:t},n={}){t.addEventListener("click",o=>{o.target.closest?.(xe)&&(o.preventDefault(),e.open())})}var ie=({state:e},t={})=>h.some(n=>e.choices[n]&&!e.allowed[n]);var ke=(e,t)=>Promise.race([e,new Promise(n=>setTimeout(n,t))]),O=e=>{try{e()}catch{}},Pe=e=>e?.mode==="durable"?e:null;function Re({config:e,ports:t},n={}){let{doc:o}=t,r=n.plugins??Z({},{slots:[ee]}),s=Pe(n.evidence),p=new Map,C=new Set,y=new Set,m=e.banner==="off",v=(e.maxAgeDays??180)*I,a=z({configured:e.regionMode,hint:m?null:w({doc:o,name:K})}),c=()=>m?null:Y({raw:w({doc:o,name:R})}),l=c(),A=!0,b=S();function S(){return Q({stored:l,policy:e.policy,region:a,gpc:t.gpc(),nowMs:t.now()},{maxAgeMs:v,durable:!!s,anonymous:m})}function N(){let i=JSON.stringify(l);te({doc:o,name:R,value:i,maxAgeS:v/1e3},{domain:e.cookieDomain}),A=w({doc:o,name:R})===i}function j(i){i.generation++;let u=new AbortController,d=Promise.resolve(i.adapter??t.importModule(i.entry.src).then(g=>i.adapter=g.default)).then(g=>(O(()=>g.onState?.({state:b,purge:x})),u.signal.aborted||m&&b.analyticsLevel==="none"?null:Promise.resolve().then(()=>g.grant({config:i.entry.config??g.config,state:b,signal:u.signal,purge:x})).then((pe={})=>pe,()=>({}))),()=>null);i.run={ctl:u,result:d}}async function L(i){let u=i.run,f=i.generation;i.run=void 0,u.ctl.abort();let d=await u.result;if(!d)return!1;let g=await Promise.resolve().then(()=>d.revoke?.()).catch(()=>!1);return!m&&i.generation===f&&x({doc:o,storage:i.adapter?.storage??i.entry.storage}),!g}function ce(i){let u=[];for(let d of p.values()){let g=m?i.analyticsLevel==="anonymous":i.allowed[d.entry.category];g&&!d.run&&j(d),!g&&d.run&&u.push(L(d)),O(()=>d.adapter?.onState?.({state:i,purge:x}))}m||ne({doc:o,allowed:i.allowed,ran:y});let f=h.some(d=>y.has(d)&&!i.allowed[d]);Promise.all(u).then(d=>{(f||d.includes(!0))&&t.reload()})}function k(){let i=b=S(),u=o.documentElement;return u.dataset.consent=i.status,u.dataset.consentRegion=i.region,u.toggleAttribute("data-consent-gpc",i.gpc),ce(i),C.forEach(f=>O(()=>f(i))),o.dispatchEvent(new CustomEvent(H,{detail:i})),i}async function q(i,u){if(!s)return;let f=JSON.stringify({policy:i.p,choices:i.c,action:i.a,gpc:t.gpc(),previousId:u}),d=await t.fetch(s.endpoint,{method:"POST",credentials:"same-origin",keepalive:!0,headers:{"content-type":"application/json"},body:f}).catch(()=>null),g=d?.ok?await d.json().catch(()=>null):null;l!==i||T()||typeof g?.id!="string"||!M.test(g.id)||(l={...i,r:g.id},delete l.q,N(),k())}async function le({action:i},{choices:u={}}={}){if(m)return k();let f=l?.r;l={v:1,p:e.policy,c:U({action:i,picked:u}),t:t.now(),a:i,...s?{q:1}:{}},N();let d=k(),g=q(l,f);return s&&ie({state:d})&&await ke(g,s.waitMs??1500),b}function ue(i){if(m&&(!i.supportsAnonymous||i.category!=="analytics"))return;let u={entry:i,generation:0,adapter:typeof i.grant=="function"?i:void 0};p.set(i.id,u),m||b.allowed[i.category]?j(u):x({doc:o,storage:i.storage}),O(()=>u.adapter?.onState?.({state:b,purge:x}))}function F(i){let u=new Set(i.map(f=>f.id));for(let[f,d]of p)u.has(f)||(p.delete(f),d.run&&L(d).then(g=>{g&&t.reload()}));for(let f of i)p.has(f.id)||ue(f)}function T(){let i=c();return!i&&!A||["t","a","r"].every(u=>i?.[u]===l?.[u])?!1:(l=i,k(),!0)}let de={contract:1,plugins:r,set:le,get:()=>b,allows:({consent:i})=>X({state:b,consent:i}),subscribe:({listener:i})=>(C.add(i),()=>{C.delete(i)}),open:()=>{o.dispatchEvent(new CustomEvent(D))},setOpen:({open:i})=>{o.documentElement.toggleAttribute("data-consent-open",i)}};return r.subscribe({kind:P,listener:F}),F(r.list({kind:P})),e.plugins?.forEach(i=>r.registerPlugin(i,{source:"page"})),k(),o.addEventListener("visibilitychange",()=>{o.visibilityState==="visible"&&T()}),o.defaultView?.addEventListener("pageshow",T),l?.q&&l.p===e.policy&&q(l),de}function _({win:e},t={}){return{doc:e.document,fetch:e.fetch.bind(e),now:Date.now,reload:()=>e.location.reload(),gpc:()=>e.navigator.globalPrivacyControl===!0||e.navigator.doNotTrack==="1",importModule:n=>import(n)}}function re({doc:e},t={}){try{return JSON.parse(e.getElementById(B)?.textContent??"")}catch{return null}}function we({win:e=window}={},{ports:t=_({win:e}),bindBanner:n}={}){if(e.jiniConsent)return e.jiniConsent;let o=e.document,r=re({doc:o});if(r)return se(e,r,{ports:t,bindBanner:n})}function se(e,t,{ports:n=_({win:e}),bindBanner:o}){let r=e.document,s=Re({config:t,ports:n},{evidence:t.evidence}),p=Array.isArray(e.jiniConsentQueue)?e.jiniConsentQueue:[];return e.jiniConsent=s,e.jiniConsentQueue={push:(...C)=>C.forEach(y=>s.plugins.registerPlugin(y,{source:"queue"}))},e.jiniConsentQueue.push(...p),oe({api:s,doc:r}),t.banner==="jini"&&o?.({api:s,doc:r}),r.dispatchEvent(new CustomEvent(J,{detail:s})),s}async function ae({win:e},t={}){if(e.jiniConsent)return e.jiniConsent;let n=re({doc:e.document});if(!n||n.banner==="off")return;if(!n.context)return we({win:e},t);let o=t.ports??_({win:e});try{let r=await o.fetch(n.context,{credentials:"same-origin",cache:"no-store"}).then(s=>s.ok?s.json():null);if(!Te(r))return;if(r.policy!==n.policy){Oe({win:e,policy:n.policy,reload:o.reload});return}return se(e,{...n,regionMode:r.regionMode},{...t,ports:o})}catch{return}}function Oe({win:e,policy:t,reload:n}){try{let o=`jini-consent-reload:${t}`;if(e.sessionStorage.getItem(o))return;e.sessionStorage.setItem(o,"1"),n()}catch{}}function Te(e){let t=e;return t?.enabled===!0&&typeof t.policy=="string"&&["auto","opt-in","opt-out"].includes(String(t.regionMode))}ae({win:window});})();
1
+ "use strict";(()=>{var R="jini_choices",K="jini_region",H="jini:consent",J="jini:consent-ready",D="jini:consent-open",B="jini-consent-config",h=["functional","analytics","marketing"],G=["necessary",...h],W=["accept","reject","save","do-not-sell","withdraw"];var P="consent-adapter";var I=864e5,$=180*I,fe=6e4,_=/^[\w-]{16,128}$/,V=Object.freeze({necessary:!0,functional:!1,analytics:!1,marketing:!1});function z({configured:e,hint:t},n={}){return e!=="auto"?e:t==="us"?"opt-out":"opt-in"}var x=(e,t=e,n=t)=>({functional:e,analytics:t,marketing:n});function Q({action:e,picked:t={}},n={}){return e==="accept"?x(!0):e==="save"?x(t.functional===!0,t.analytics===!0,t.marketing===!0):e==="do-not-sell"?x(t.functional!==!1,!1):x(!1)}function ge({flags:e,gpc:t},n={}){return{necessary:!0,functional:e.functional,analytics:e.analytics&&!t,marketing:e.marketing&&!t}}function U({stored:e,policy:t,region:n,gpc:o,nowMs:r},{maxAgeMs:s=$,durable:p=!1,anonymous:C=!1}={}){let y=ye({stored:e,policy:t,nowMs:r},{maxAgeMs:s,anonymous:C}),m=ge({flags:C?V:y?.c??x(n==="opt-out"),gpc:o}),v={contract:1,policy:t,region:n,gpc:o,choices:m,...me({choices:m,live:y,durable:p,anonymous:C,gpc:o})};return y?{...v,status:"set",action:y.a,at:y.t,receipt:Ce(y)}:{...v,status:"pending",action:null,at:null,receipt:"none"}}function ye({stored:e,policy:t,nowMs:n},{maxAgeMs:o=$,anonymous:r=!1}={}){return!r&&e&&e.p===t&&e.t<=n+fe&&n-e.t<=o?e:null}function me({choices:e,live:t,durable:n,anonymous:o,gpc:r},s={}){let p=t&&n&&!t.r,C=o||p?V:e,y=C.analytics?"full":"none";return{allowed:C,analyticsLevel:o&&!r?"anonymous":y}}function Ce(e){return e.r?"stored":e.q?"pending":"local"}function Y({raw:e},t={}){if(!e||e.length>1024)return null;let n;try{n=JSON.parse(e)}catch{return null}if(!be(n))return null;let o={v:1,p:n.p,c:x(n.c.functional,n.c.analytics,n.c.marketing),t:n.t,a:n.a};return typeof n.r=="string"&&_.test(n.r)&&(o.r=n.r),n.q===1&&(o.q=1),o}function be(e){return!e||e.v!==1||typeof e.p!="string"||!Number.isFinite(e.t)?!1:W.includes(e.a)&&Se(e.c)}function Se(e){let t=e;return!t||typeof t!="object"?!1:["functional","analytics","marketing"].every(n=>Object.hasOwn(t,n)&&typeof t[n]=="boolean")}function X({state:e,consent:t=[]},n={}){return t.every(o=>G.includes(o)&&e.allowed[o]===!0)}var ve=/^[a-z0-9][a-z0-9._:-]{0,63}$/;function Z(e={},{slots:t=[],onProblem:n=()=>{}}={}){let o=new Map,r=[],s=new Set,p=new Set,C=a=>r.filter(c=>c.kind===a).sort((c,l)=>l.priority-c.priority).map(c=>c.value),y=a=>p.forEach(c=>{if(c.kind===a)try{c.fn(C(a))}catch{}});function m(a,c){let l=S=>(n({id:String(a.id),kind:a.kind,reason:S,...c.source?{source:c.source}:{}}),()=>{});if(!ve.test(String(a.id)))return l("short lowercase id");let E=o.get(a.kind).accept({contribution:a});if(typeof E=="string")return l(E);if(r.some(S=>S.kind===a.kind&&S.id===a.id))return l("duplicate id");let b={kind:a.kind,id:a.id,value:E,priority:c.priority??0};return r.push(b),y(a.kind),()=>{let S=r.indexOf(b);S>=0&&(r.splice(S,1),y(a.kind))}}let v={defineSlot({slot:a}){if(!o.has(a.kind)){o.set(a.kind,a);for(let c of s)c.raw.kind===a.kind&&(s.delete(c),c.dispose=m(c.raw,c.options))}},registerPlugin(a,c={}){if(o.has(a.kind))return m(a,c);let l={raw:a,options:c,dispose:()=>{s.delete(l)}};return s.add(l),()=>l.dispose()},list:({kind:a})=>C(a),subscribe({kind:a,listener:c}){let l={kind:a,fn:c};return p.add(l),()=>{p.delete(l)}}};for(let a of t)v.defineSlot({slot:a});return v}var ee={kind:P,accept({contribution:e}){return h.includes(e.category)?typeof e.grant=="function"||typeof e.src=="string"?e:"grant() or src needed":"category must be functional, analytics or marketing"}};var he=["type","data-src","data-type","data-consent-category"],Ae=':not(html)[data-consent-open],a[href="#privacy-choices"]';function w({doc:e,name:t},n={}){let o=e.cookie.split(/;\s*/).find(r=>r.startsWith(t+"="));try{return o?decodeURIComponent(o.slice(t.length+1)):null}catch{return null}}function te({doc:e,name:t,value:n,maxAgeS:o},{domain:r}={}){let s=e.defaultView?.location.protocol==="https:"?"; Secure":"";e.cookie=`${t}=${encodeURIComponent(n)}; Path=/; Max-Age=${Math.floor(o)}; SameSite=Lax${s}`+(r?"; Domain="+r:"")}function Ee(e,t){let n=(e.defaultView?.location.hostname??"").split("."),o=`${t}=; Path=/; Max-Age=0`;e.cookie=o;for(let r=0;r<n.length-1;r++)e.cookie=`${o}; Domain=.${n.slice(r).join(".")}`}function A({doc:e,storage:t},n={}){if(t){for(let o of e.cookie.split(/;\s*/)){let r=o.split("=")[0];t.cookies?.some(s=>r.startsWith(s))&&Ee(e,r)}try{let o=e.defaultView.localStorage;for(let r of Object.keys(o))t.local?.some(s=>r.startsWith(s))&&o.removeItem(r)}catch{}}}function ne({doc:e,allowed:t,ran:n},o={}){e.querySelectorAll('script[type="text/plain"],iframe[data-src],template[data-jini-consent-resource]').forEach(r=>{let s=r.content,p=s?r.dataset.category:r.dataset.consentCategory;!h.includes(p)||!t[p]||(n.add(p),r.tagName==="IFRAME"?(r.src=r.dataset.src,r.removeAttribute("data-src")):r.replaceWith(s??xe(e,r)))})}function xe(e,t){let n=e.createElement("script");for(let{name:o,value:r}of t.attributes)he.includes(o)||n.setAttribute(o,r);return t.nonce&&(n.nonce=t.nonce),t.dataset.type&&(n.type=t.dataset.type),t.dataset.src?n.src=t.dataset.src:n.text=t.text,n.async=!1,n}function oe({api:e,doc:t},n={}){t.addEventListener("click",o=>{o.target.closest?.(Ae)&&(o.preventDefault(),e.open())})}var ie=({state:e},t={})=>h.some(n=>e.choices[n]&&!e.allowed[n]);var ke=(e,t)=>Promise.race([e,new Promise(n=>setTimeout(n,t))]),O=e=>{try{e()}catch{}},Pe=e=>e?.mode==="durable"?e:null;function Re({config:e,ports:t},n={}){let{doc:o}=t,r=n.plugins??Z({},{slots:[ee]}),s=Pe(n.evidence),p=new Map,C=new Set,y=new Set,m=e.banner==="off",v=(e.maxAgeDays??180)*I,a=z({configured:e.regionMode,hint:m?null:w({doc:o,name:K})}),c=()=>m?null:Y({raw:w({doc:o,name:R})}),l=c(),E=!0,b=S();function S(){return U({stored:l,policy:e.policy,region:a,gpc:t.gpc(),nowMs:t.now()},{maxAgeMs:v,durable:!!s,anonymous:m})}function j(){let i=JSON.stringify(l);te({doc:o,name:R,value:i,maxAgeS:v/1e3},{domain:e.cookieDomain}),E=w({doc:o,name:R})===i}function N(i){i.generation++;let u=new AbortController,d=Promise.resolve(i.adapter??t.importModule(i.entry.src).then(g=>i.adapter=g.default)).then(g=>(O(()=>g.onState?.({state:b,purge:A})),u.signal.aborted||m&&b.analyticsLevel==="none"?null:Promise.resolve().then(()=>g.grant({config:i.entry.config??g.config,state:b,signal:u.signal,purge:A})).then((pe={})=>pe,()=>({}))),()=>null);i.run={ctl:u,result:d}}async function L(i){let u=i.run,f=i.generation;i.run=void 0,u.ctl.abort();let d=await u.result;if(!d)return!1;let g=await Promise.resolve().then(()=>d.revoke?.()).catch(()=>!1);return!m&&i.generation===f&&A({doc:o,storage:i.adapter?.storage??i.entry.storage}),!g}function ce(i){let u=[];for(let d of p.values()){let g=m?i.analyticsLevel==="anonymous":i.allowed[d.entry.category];g&&!d.run&&N(d),!g&&d.run&&u.push(L(d)),O(()=>d.adapter?.onState?.({state:i,purge:A}))}m||ne({doc:o,allowed:i.allowed,ran:y});let f=h.some(d=>y.has(d)&&!i.allowed[d]);Promise.all(u).then(d=>{(f||d.includes(!0))&&t.reload()})}function k(){let i=b=S(),u=o.documentElement;return u.dataset.consent=i.status,u.dataset.consentRegion=i.region,u.toggleAttribute("data-consent-gpc",i.gpc),ce(i),C.forEach(f=>O(()=>f(i))),o.dispatchEvent(new CustomEvent(H,{detail:i})),i}async function q(i,u){if(!s)return;let f=JSON.stringify({policy:i.p,choices:i.c,action:i.a,gpc:t.gpc(),previousId:u}),d=await t.fetch(s.endpoint,{method:"POST",credentials:"same-origin",keepalive:!0,headers:{"content-type":"application/json"},body:f}).catch(()=>null),g=d?.ok?await d.json().catch(()=>null):null;l!==i||T()||typeof g?.id!="string"||!_.test(g.id)||(l={...i,r:g.id},delete l.q,j(),k())}async function le({action:i},{choices:u={}}={}){if(m)return k();let f=l?.r;l={v:1,p:e.policy,c:Q({action:i,picked:u}),t:t.now(),a:i,...s?{q:1}:{}},j();let d=k(),g=q(l,f);return s&&ie({state:d})&&await ke(g,s.waitMs??1500),b}function ue(i){if(m&&(!i.supportsAnonymous||i.category!=="analytics"))return;let u={entry:i,generation:0,adapter:typeof i.grant=="function"?i:void 0};p.set(i.id,u),m||b.allowed[i.category]?N(u):A({doc:o,storage:i.storage}),O(()=>u.adapter?.onState?.({state:b,purge:A}))}function F(i){let u=new Set(i.map(f=>f.id));for(let[f,d]of p)u.has(f)||(p.delete(f),d.run&&L(d).then(g=>{g&&t.reload()}));for(let f of i)p.has(f.id)||ue(f)}function T(){let i=c();return!i&&!E||["t","a","r"].every(u=>i?.[u]===l?.[u])?!1:(l=i,k(),!0)}let de={contract:1,plugins:r,set:le,get:()=>b,allows:({consent:i})=>X({state:b,consent:i}),subscribe:({listener:i})=>(C.add(i),()=>{C.delete(i)}),open:()=>{o.dispatchEvent(new CustomEvent(D))},setOpen:({open:i})=>{o.documentElement.toggleAttribute("data-consent-open",i)}};return r.subscribe({kind:P,listener:F}),F(r.list({kind:P})),e.plugins?.forEach(i=>r.registerPlugin(i,{source:"page"})),k(),o.addEventListener("visibilitychange",()=>{o.visibilityState==="visible"&&T()}),o.defaultView?.addEventListener("pageshow",T),l?.q&&l.p===e.policy&&q(l),de}function M({win:e},t={}){return{doc:e.document,fetch:e.fetch.bind(e),now:Date.now,reload:()=>e.location.reload(),gpc:()=>e.navigator.globalPrivacyControl===!0||e.navigator.doNotTrack==="1",importModule:n=>import(n)}}function re({doc:e},t={}){try{return JSON.parse(e.getElementById(B)?.textContent??"")}catch{return null}}function we({win:e=window}={},{ports:t=M({win:e}),bindBanner:n}={}){if(e.jiniConsent)return e.jiniConsent;let o=e.document,r=re({doc:o});if(r)return se(e,r,{ports:t,bindBanner:n})}function se(e,t,{ports:n=M({win:e}),bindBanner:o}){let r=e.document,s=Re({config:t,ports:n},{evidence:t.evidence}),p=Array.isArray(e.jiniConsentQueue)?e.jiniConsentQueue:[];return e.jiniConsent=s,e.jiniConsentQueue={push:(...C)=>C.forEach(y=>s.plugins.registerPlugin(y,{source:"queue"}))},e.jiniConsentQueue.push(...p),oe({api:s,doc:r}),t.banner==="jini"&&o?.({api:s,doc:r}),r.dispatchEvent(new CustomEvent(J,{detail:s})),s}async function ae({win:e},t={}){if(e.jiniConsent)return e.jiniConsent;let n=re({doc:e.document});if(!n||n.banner==="off")return;if(!n.context)return we({win:e},t);let o=t.ports??M({win:e});try{let r=await o.fetch(n.context,{credentials:"same-origin",cache:"no-store"}).then(s=>s.ok?s.json():null);if(!Te(r))return;if(r.policy!==n.policy){Oe({win:e,policy:n.policy,reload:o.reload});return}return se(e,{...n,regionMode:r.regionMode},{...t,ports:o})}catch{return}}function Oe({win:e,policy:t,reload:n}){try{let o=`jini-consent-reload:${t}`;if(e.sessionStorage.getItem(o))return;e.sessionStorage.setItem(o,"1"),n()}catch{}}function Te(e){let t=e;return t?.enabled===!0&&typeof t.policy=="string"&&["auto","opt-in","opt-out"].includes(String(t.regionMode))}ae({win:window});})();
@@ -1,7 +1,8 @@
1
1
  /** @file @jini-ai/cookie-consent contract: the only module a banner, plugin or host feature needs to import.
2
2
  * Types and constants only. Every call that injects something takes (required, optional): the first
3
3
  * argument is an object of required fields/ports, the second an object of optional ones. */
4
- import type { ConsentAppearanceTokens } from './render/css.js';
4
+ import type { BannerMode, Category, ConsentAction, ConsentState, Contribution, DeclaredScript, Flags, Optional, RawContribution, RegionMode } from '@jini-ai/core/contracts/site/cookie-consent';
5
+ export type { BannerMode, Category, Choices, ConsentAction, ConsentAnalyticsProof, ConsentConfig, ConsentState, Contribution, DeclaredScript, Flags, Optional, RawContribution, ReceiptStatus, RegionHint, RegionMode, RegionRequest, RegionResolver } from '@jini-ai/core/contracts/site/cookie-consent';
5
6
  export declare const CONTRACT: 1;
6
7
  /** Separate from the CMS engine's HttpOnly jini_consent: browsers cannot overwrite that cookie. */
7
8
  export declare const CONSENT_COOKIE = "jini_choices";
@@ -16,21 +17,10 @@ export declare const OPEN_EVENT = "jini:consent-open";
16
17
  /** Id of the JSON <script> that carries the PageConfig. */
17
18
  export declare const CONFIG_ID = "jini-consent-config";
18
19
  export declare const OPTIONAL: readonly ["functional", "analytics", "marketing"];
19
- export type Optional = typeof OPTIONAL[number];
20
20
  export declare const CATEGORIES: readonly ["necessary", "functional", "analytics", "marketing"];
21
- export type Category = typeof CATEGORIES[number];
22
- export type Flags = Record<Optional, boolean>;
23
- export type Choices = Readonly<{
24
- necessary: true;
25
- } & Flags>;
26
21
  export declare const ACTIONS: readonly ["accept", "reject", "save", "do-not-sell", "withdraw"];
27
- export type ConsentAction = typeof ACTIONS[number];
28
- export type RegionMode = 'opt-in' | 'opt-out';
29
- /** A resolver's definite answer. Resolvers return null for "unknown: ask the next one". */
30
- export type RegionHint = 'us' | 'strict';
31
22
  /** jini = the built-in banner; headless = "My own" banner; off = anonymous analytics only, no UI. */
32
23
  export declare const BANNER_MODES: readonly ["jini", "headless", "off"];
33
- export type BannerMode = typeof BANNER_MODES[number];
34
24
  /** durable = a server stores receipts and grants wait for one; local = browser-only evidence (static
35
25
  * export, Electron, file:), labelled as such and never presented as a server receipt. */
36
26
  export type Evidence = {
@@ -40,8 +30,6 @@ export type Evidence = {
40
30
  } | {
41
31
  mode: 'local';
42
32
  };
43
- /** 'stored' = server receipt; 'pending' = sent, unconfirmed; 'local' = browser-only, labelled as such. */
44
- export type ReceiptStatus = 'none' | 'local' | 'pending' | 'stored';
45
33
  /** Cookie wire format (JSON, URI-encoded). `c` is what the visitor chose; GPC is applied on read.
46
34
  * v = format, p = policy version, t = choice time (ms), a = action, r = receipt id, q = receipt pending. */
47
35
  export interface StoredChoice {
@@ -53,55 +41,6 @@ export interface StoredChoice {
53
41
  r?: string;
54
42
  q?: 1;
55
43
  }
56
- export interface ConsentState {
57
- contract: 1;
58
- policy: string;
59
- status: 'pending' | 'set';
60
- region: RegionMode;
61
- /** Effective privacy opt-out: GPC or DNT. The historical field name is retained on receipts. */
62
- gpc: boolean;
63
- /** Analytics adapters/collectors must enforce this level, not just allowed.analytics. */
64
- analyticsLevel: 'none' | 'anonymous' | 'full';
65
- /** What the banner shows: the choice (or region default), GPC-clamped. */
66
- choices: Choices;
67
- /** Full category permissions; durable grants await their receipt. Never read `choices` as permission.
68
- * Anonymous analytics keeps allowed.analytics false; adapters/collectors use analyticsLevel. */
69
- allowed: Choices;
70
- action: ConsentAction | null;
71
- at: number | null;
72
- receipt: ReceiptStatus;
73
- }
74
- /** Saved host policy. Existing revisions keep their field names when execution moves to declarations. */
75
- export interface ConsentConfig {
76
- enabled: boolean;
77
- /** @deprecated Retained for saved-setting compatibility; declared scripts do not evaluate this flag. */
78
- allowUnsafeEval?: boolean;
79
- regionMode: 'auto' | RegionMode;
80
- policyVersion: string;
81
- privacyPolicyUrl: string;
82
- title: string;
83
- message: string;
84
- acceptLabel: string;
85
- rejectLabel: string;
86
- preferencesLabel: string;
87
- placement?: 'bottom-bar' | 'bottom-left' | 'bottom-right' | 'top-bar';
88
- reopen?: 'corner' | 'link';
89
- secondaryLinkLabel?: string;
90
- secondaryLinkUrl?: string;
91
- appearance?: ConsentAppearanceTokens;
92
- customCss?: string;
93
- bannerMode?: BannerMode;
94
- }
95
- /** Internal delivery evidence; never an analytics property or visitor identity. */
96
- export interface ConsentAnalyticsProof {
97
- receiptId: string;
98
- policyVersion: string;
99
- }
100
- export interface Contribution<K extends string = string> {
101
- readonly id: string;
102
- readonly kind: K;
103
- }
104
- export type RawContribution = Contribution & Record<string, unknown>;
105
44
  export interface SlotKind<T extends Contribution = Contribution> {
106
45
  readonly kind: T['kind'];
107
46
  /** Trust boundary: the typed, normalized contribution, or a plain-language reason to refuse it. */
@@ -180,17 +119,6 @@ export interface LazyAdapter extends Contribution<typeof ADAPTER_KIND> {
180
119
  }
181
120
  export type AdapterContribution = ConsentAdapter | LazyAdapter;
182
121
  export declare const REGION_KIND = "region-resolver";
183
- export interface RegionRequest {
184
- header(name: string): string | null;
185
- ip: string | null;
186
- }
187
- export interface RegionResolver extends Contribution<typeof REGION_KIND> {
188
- resolve(required: {
189
- request: RegionRequest;
190
- }, optional?: {
191
- signal?: AbortSignal;
192
- }): RegionHint | null | Promise<RegionHint | null>;
193
- }
194
122
  /** Data-only form for a plugin manifest; the region slot turns it into a RegionResolver. */
195
123
  export interface HeaderRegion extends Contribution<typeof REGION_KIND> {
196
124
  header: string;
@@ -204,10 +132,6 @@ export interface ConsentBridge extends Contribution<typeof BRIDGE_KIND> {
204
132
  doc: Document;
205
133
  }, optional?: object): void | (() => void);
206
134
  }
207
- export interface DeclaredScript {
208
- src: string;
209
- consent?: readonly Category[];
210
- }
211
135
  export interface ClientConfig {
212
136
  contract: 1;
213
137
  policy: string;
@@ -1 +1 @@
1
- "use strict";(()=>{var x="jini:consent-ready",S="jini:consent-open",v="jini-consent-config",g=["functional","analytics","marketing"],m=["necessary",...g];var u="consent-bridge";function f({state:e,consent:n=[]},t={}){return n.every(o=>m.includes(o)&&e.allowed[o]===!0)}function O(e){if(!/^(?:https?:\/\/|\/(?!\/)|\.\.?\/)/.test(e))return!1;try{return["http:","https:"].includes(new URL(e,"https://declared.invalid").protocol)}catch{return!1}}function w(e){if(!e||typeof e!="object")return!1;let{src:n,consent:t}=e;return typeof n!="string"||!n.trim()||/[\s\\]/.test(n)||!O(n)?!1:t===void 0||Array.isArray(t)&&t.every(o=>m.includes(o))}function E({scripts:e},n={}){if(e===void 0)return{scripts:[],problems:[]};if(!Array.isArray(e))return{scripts:[],problems:["scripts must be an array"]};let t=[],o=[];return e.forEach((a,i)=>{w(a)?t.push({src:a.src,...a.consent&&{consent:[...a.consent]}}):o.push(`scripts[${i}] needs an HTTP(S) or relative src and known consent categories`)}),{scripts:t,problems:o}}function P(e){let n={};for(let t of g){let o=e.querySelector(`input[name="${t}"]`);o&&(n[t]=o.checked)}return n}function y(e,n){for(let t of g){let o=e.querySelector(`input[name="${t}"]`);o&&(o.checked=n.choices[t],o.disabled=n.gpc&&t!=="functional")}}var C=({state:e},n={})=>g.some(t=>e.choices[t]&&!e.allowed[t]);function h({api:e,doc:n}){let t=n.getElementById("jini-consent");if(!t)return;let o=t.querySelector("[data-consent-error]"),a=r=>{t.hidden=!r,e.setOpen({open:r})},i=r=>{o&&(o.hidden=!C({state:r})),C({state:r})||a(!1)};t.addEventListener("click",r=>{let s=r.target.closest?.("[data-consent-action]")?.dataset.consentAction;s&&(r.preventDefault(),e.set({action:s},{choices:P(t)}).then(i))}),t.addEventListener("keydown",r=>{r.key==="Escape"&&e.get().status==="set"&&a(!1)}),n.addEventListener(S,()=>{y(t,e.get()),a(!0),t.querySelector("button")?.focus()}),e.subscribe({listener:r=>{y(t,r),o&&!o.hidden&&!C({state:r})&&i(r)}}),y(t,e.get()),a(e.get().status==="pending")}function A({doc:e,reload:n},t={}){let o=[...e.querySelectorAll("iframe[data-src][data-jini-consent]")].map(i=>({node:i,consent:j(i),started:!1})),a=!1;return i=>{if(a)return;let r=o.filter(s=>s.started&&!f({state:i,consent:s.consent}));if(r.length){a=!0,r.forEach(s=>s.node.removeAttribute("src")),n();return}o.forEach(s=>{s.started||!f({state:i,consent:s.consent})||(s.started=!0,s.node.setAttribute("src",s.node.dataset.src))})}}function j(e){try{let n=JSON.parse(e.dataset.jiniConsent);if(Array.isArray(n))return n}catch{}return["invalid"]}var N={kind:u,accept:({contribution:e})=>typeof e.mount=="function"||typeof e.src=="string"?e:"mount() or module src needed"};function L(e){e.disposed=!0;try{e.dispose?.()}catch{}}function R({api:e,doc:n},t={}){let o=new Map;function a(i){for(let[r,s]of o)i.some(d=>d.id===r)||(L(s),o.delete(r));for(let r of i){if(o.has(r.id))continue;let s={disposed:!1,dispose:void 0};o.set(r.id,s);let d=c=>{if(!s.disposed)try{let l=c.mount?.({api:e,doc:n});typeof l=="function"&&(s.dispose=l)}catch{}};r.mount?d(r):import(r.src).then(c=>d(c.default)).catch(()=>{})}}e.plugins.defineSlot({slot:N}),e.plugins.subscribe({kind:u,listener:i=>a(i)}),a(e.plugins.list({kind:u}))}function D({doc:e,scripts:n,reload:t},o={}){let a=E({scripts:n}).scripts.map(c=>({script:c,started:!1,node:null})),i=null,r,s=!1;function d(){if(i||s)return;let c=a.find(b=>!b.started&&f({state:r,consent:b.script.consent}));if(!c)return;c.started=!0;let l=e.createElement("script");c.node=i=l,l.async=!1,l.src=c.script.src;let p=()=>{i===l&&(i=null),d()};l.onload=p,l.onerror=p,e.head.append(l)}return c=>{r=c;let l=a.filter(p=>p.started&&!f({state:c,consent:p.script.consent}));l.length&&!s&&(s=!0,l.forEach(p=>p.node?.remove()),t()),d()}}var k=Symbol.for("jini-consent:features");function I({api:e,doc:n,config:t,reload:o},{bindBanner:a}={}){if(Object.prototype.hasOwnProperty.call(e,k))return;Object.defineProperty(e,k,{value:!0});let i=M({doc:n,config:t,reload:o});e.subscribe({listener:i}),i(e.get()),R({api:e,doc:n}),t.banner==="jini"&&a&&e.plugins.registerPlugin({id:"jini-banner",kind:u,mount:a})}function M({doc:e,config:n,reload:t}){let o=!1,a=!1,i=()=>{o=!0},r=D({doc:e,scripts:n.scripts??[],reload:i}),s=A({doc:e,reload:i});return d=>{s(d),r(d),!(!o||a)&&(a=!0,t())}}function T(){let e=window.jiniConsent;if(e)try{let n=JSON.parse(document.getElementById(v)?.textContent??"");I({api:e,doc:document,config:n,reload:()=>location.reload()},{bindBanner:h})}catch{}}document.addEventListener(x,T);T();})();
1
+ "use strict";(()=>{var b="jini:consent-ready",v="jini:consent-open",E="jini-consent-config",g=["functional","analytics","marketing"],m=["necessary",...g];var u="consent-bridge";function f({state:e,consent:n=[]},t={}){return n.every(o=>m.includes(o)&&e.allowed[o]===!0)}function w(e){if(!/^(?:https?:\/\/|\/(?!\/)|\.\.?\/)/.test(e))return!1;try{return["http:","https:"].includes(new URL(e,"https://declared.invalid").protocol)}catch{return!1}}function O(e){if(!e||typeof e!="object")return!1;let{src:n,consent:t}=e;return typeof n!="string"||!n.trim()||/[\s\\]/.test(n)||!w(n)?!1:t===void 0||Array.isArray(t)&&t.every(o=>m.includes(o))}function x({scripts:e},n={}){if(e===void 0)return{scripts:[],problems:[]};if(!Array.isArray(e))return{scripts:[],problems:["scripts must be an array"]};let t=[],o=[];return e.forEach((a,r)=>{O(a)?t.push({src:a.src,...a.consent&&{consent:[...a.consent]}}):o.push(`scripts[${r}] needs an HTTP(S) or relative src and known consent categories`)}),{scripts:t,problems:o}}function P(e){let n={};for(let t of g){let o=e.querySelector(`input[name="${t}"]`);o&&(n[t]=o.checked)}return n}function y(e,n){for(let t of g){let o=e.querySelector(`input[name="${t}"]`);o&&(o.checked=n.choices[t],o.disabled=n.gpc&&t!=="functional")}}var C=({state:e},n={})=>g.some(t=>e.choices[t]&&!e.allowed[t]);function h({api:e,doc:n}){let t=n.getElementById("jini-consent");if(!t)return;let o=t.querySelector("[data-consent-error]"),a=i=>{t.hidden=!i,e.setOpen({open:i})},r=i=>{o&&(o.hidden=!C({state:i})),C({state:i})||a(!1)};t.addEventListener("click",i=>{let s=i.target.closest?.("[data-consent-action]")?.dataset.consentAction;s&&(i.preventDefault(),e.set({action:s},{choices:P(t)}).then(r))}),t.addEventListener("keydown",i=>{i.key==="Escape"&&e.get().status==="set"&&a(!1)}),n.addEventListener(v,()=>{y(t,e.get()),a(!0),t.querySelector("button")?.focus()}),e.subscribe({listener:i=>{y(t,i),o&&!o.hidden&&!C({state:i})&&r(i)}}),y(t,e.get()),a(e.get().status==="pending")}function A({doc:e,reload:n},t={}){let o=[...e.querySelectorAll("iframe[data-src][data-jini-consent]")].map(r=>({node:r,consent:j(r),started:!1})),a=!1;return r=>{if(a)return;let i=o.filter(s=>s.started&&!f({state:r,consent:s.consent}));if(i.length){a=!0,i.forEach(s=>s.node.removeAttribute("src")),n();return}o.forEach(s=>{s.started||!f({state:r,consent:s.consent})||(s.started=!0,s.node.setAttribute("src",s.node.dataset.src))})}}function j(e){try{let n=JSON.parse(e.dataset.jiniConsent);if(Array.isArray(n))return n}catch{}return["invalid"]}var N={kind:u,accept:({contribution:e})=>typeof e.mount=="function"||typeof e.src=="string"?e:"mount() or module src needed"};function _(e){e.disposed=!0;try{e.dispose?.()}catch{}}function D({api:e,doc:n},t={}){let o=new Map;function a(r){for(let[i,s]of o)r.some(l=>l.id===i)||(_(s),o.delete(i));for(let i of r){if(o.has(i.id))continue;let s={disposed:!1,dispose:void 0};o.set(i.id,s);let l=c=>{if(!s.disposed)try{let d=c.mount?.({api:e,doc:n});typeof d=="function"&&(s.dispose=d)}catch{}};i.mount?l(i):import(i.src).then(c=>l(c.default)).catch(()=>{})}}e.plugins.defineSlot({slot:N}),e.plugins.subscribe({kind:u,listener:r=>a(r)}),a(e.plugins.list({kind:u}))}function R({doc:e,scripts:n,reload:t},o={}){let a=x({scripts:n}).scripts.map(c=>({script:c,started:!1,node:null})),r=null,i,s=!1;function l(){if(r||s)return;let c=a.find(S=>!S.started&&f({state:i,consent:S.script.consent}));if(!c)return;c.started=!0;let d=e.createElement("script");c.node=r=d,d.async=!1,d.src=c.script.src;let p=()=>{r===d&&(r=null),l()};d.onload=p,d.onerror=p,e.head.append(d)}return c=>{i=c;let d=a.filter(p=>p.started&&!f({state:c,consent:p.script.consent}));d.length&&!s&&(s=!0,d.forEach(p=>p.node?.remove()),t()),l()}}var k=Symbol.for("jini-consent:features");function I({api:e,doc:n,config:t,reload:o},{bindBanner:a}={}){if(Object.prototype.hasOwnProperty.call(e,k))return;Object.defineProperty(e,k,{value:!0});let r=M({doc:n,config:t,reload:o});e.subscribe({listener:r}),r(e.get()),D({api:e,doc:n}),t.banner==="jini"&&a&&e.plugins.registerPlugin({id:"jini-banner",kind:u,mount:a})}function M({doc:e,config:n,reload:t}){let o=!1,a=!1,r=()=>{o=!0},i=R({doc:e,scripts:n.scripts??[],reload:r}),s=A({doc:e,reload:r});return l=>{s(l),i(l),!(!o||a)&&(a=!0,t())}}function T(){let e=window.jiniConsent;if(e)try{let n=JSON.parse(document.getElementById(E)?.textContent??"");I({api:e,doc:document,config:n,reload:()=>location.reload()},{bindBanner:h})}catch{}}document.addEventListener(b,T);T();})();
@@ -23,6 +23,9 @@ export interface ConsentFieldsProps {
23
23
  problems?: readonly ConsentFieldProblem[] | undefined;
24
24
  /** Host translations keyed by the exact fallback copy; unspecified entries use English. */
25
25
  dictionary?: Readonly<Record<string, string>> | undefined;
26
+ /** The host product's name. The built-in banner mode is labelled `<productName> banner`, so a host
27
+ * translates it under that exact key; omitted, the label names no product ("Built-in banner"). */
28
+ productName?: string | undefined;
26
29
  /** Host max lengths per text field; the defaults are the engine's loosest bounds. */
27
30
  limits?: Readonly<Partial<Record<TextKey | 'policyVersion', number>>> | undefined;
28
31
  /** Seam for tests: the handlers hook, defaulted to the real one. */
@@ -31,7 +34,7 @@ export interface ConsentFieldsProps {
31
34
  /** Banner copy and its links. Optional host modes report only a mode patch; the host's independent
32
35
  * enabled switch stays authoritative. Text is always plain text.
33
36
  * @example <ConsentBannerFields value={value} onChange={onChange} bannerModes={['jini', 'headless', 'off']} /> */
34
- export declare function ConsentBannerFields({ value, onChange, disabled, problems, dictionary, limits, bannerModes, useConsentSettingsPanelHook }: ConsentFieldsProps & {
37
+ export declare function ConsentBannerFields({ value, onChange, disabled, problems, dictionary, productName, limits, bannerModes, useConsentSettingsPanelHook }: ConsentFieldsProps & {
35
38
  bannerModes?: readonly NonNullable<ConsentSettingsView['bannerMode']>[] | undefined;
36
39
  }): import("react").JSX.Element;
37
40
  /** On/off, region behavior and the version that re-asks visitors when it changes. */
@@ -7,7 +7,13 @@ const BANNER_FIELDS = [
7
7
  { key: 'preferencesLabel', label: 'Preferences label' }, { key: 'privacyPolicyUrl', label: 'Privacy policy page URL' },
8
8
  { key: 'secondaryLinkLabel', label: 'Second link text' }, { key: 'secondaryLinkUrl', label: 'Second link URL' },
9
9
  ];
10
- const BANNER_MODE_LABELS = { jini: 'Jini banner', headless: 'My own', off: 'None' };
10
+ const BANNER_MODE_LABELS = { headless: 'My own', off: 'None' };
11
+ /** The built-in banner is the host product's banner, so its label is the host's name and not Jini's. */
12
+ function bannerModeLabel({ mode, productName }, _optional = {}) {
13
+ if (mode !== 'jini')
14
+ return BANNER_MODE_LABELS[mode];
15
+ return productName ? `${productName} banner` : 'Built-in banner';
16
+ }
11
17
  const REGION_LABELS = {
12
18
  auto: 'Automatic (unknown region: opt-in)', 'opt-in': 'Opt-in everywhere (EU / UK)', 'opt-out': 'Opt-out everywhere (California)',
13
19
  };
@@ -40,19 +46,19 @@ function Field({ label, field, problems, children }) {
40
46
  }
41
47
  /** Host-supplied banner modes. Native radios provide keyboard selection; the hint keeps its space
42
48
  * while hidden, and the parent fieldset supplies the disabled state. */
43
- function BannerModeFields({ value, onChange, dictionary, modes, useConsentSettingsPanelHook = useConsentSettingsPanel }) {
49
+ function BannerModeFields({ value, onChange, dictionary, productName, modes, useConsentSettingsPanelHook = useConsentSettingsPanel }) {
44
50
  const id = useId();
45
51
  const t = createConsentTranslator({ dictionary });
46
52
  const handlers = useConsentSettingsPanelHook({ value, onChange });
47
- return _jsxs("fieldset", { className: "jini-consent-banner-modes", "aria-describedby": value.bannerMode === 'headless' ? `${id}-mode-hint` : undefined, children: [_jsx("legend", { children: t('Banner mode') }), _jsx("div", { className: "jini-consent-banner-options", children: modes.map(mode => _jsxs("label", { children: [_jsx("input", { type: "radio", name: `${id}-banner-mode`, value: mode, checked: (value.bannerMode ?? 'jini') === mode, onChange: handlers.bannerMode({ mode }) }), _jsx("span", { children: t(BANNER_MODE_LABELS[mode]) })] }, mode)) }), _jsx("p", { id: `${id}-mode-hint`, className: "jini-hint jini-consent-banner-mode-hint", style: { visibility: value.bannerMode === 'headless' ? 'visible' : 'hidden' }, children: t('Your banner calls window.jiniConsent.set(...)') })] });
53
+ return _jsxs("fieldset", { className: "jini-consent-banner-modes", "aria-describedby": value.bannerMode === 'headless' ? `${id}-mode-hint` : undefined, children: [_jsx("legend", { children: t('Banner mode') }), _jsx("div", { className: "jini-consent-banner-options", children: modes.map(mode => _jsxs("label", { children: [_jsx("input", { type: "radio", name: `${id}-banner-mode`, value: mode, checked: (value.bannerMode ?? 'jini') === mode, onChange: handlers.bannerMode({ mode }) }), _jsx("span", { children: t(bannerModeLabel({ mode, productName })) })] }, mode)) }), _jsx("p", { id: `${id}-mode-hint`, className: "jini-hint jini-consent-banner-mode-hint", style: { visibility: value.bannerMode === 'headless' ? 'visible' : 'hidden' }, children: t('Your banner calls window.jiniConsent.set(...)') })] });
48
54
  }
49
55
  /** Banner copy and its links. Optional host modes report only a mode patch; the host's independent
50
56
  * enabled switch stays authoritative. Text is always plain text.
51
57
  * @example <ConsentBannerFields value={value} onChange={onChange} bannerModes={['jini', 'headless', 'off']} /> */
52
- export function ConsentBannerFields({ value, onChange, disabled = false, problems, dictionary, limits = {}, bannerModes, useConsentSettingsPanelHook = useConsentSettingsPanel }) {
58
+ export function ConsentBannerFields({ value, onChange, disabled = false, problems, dictionary, productName, limits = {}, bannerModes, useConsentSettingsPanelHook = useConsentSettingsPanel }) {
53
59
  const t = createConsentTranslator({ dictionary });
54
60
  const handlers = useConsentSettingsPanelHook({ value, onChange });
55
- return _jsxs("fieldset", { disabled: disabled, className: "jini-consent-settings-fields", children: [_jsx("legend", { children: t('Banner text') }), bannerModes && _jsx(BannerModeFields, { value: value, onChange: onChange, dictionary: dictionary, modes: bannerModes, useConsentSettingsPanelHook: useConsentSettingsPanelHook }), BANNER_FIELDS.map(({ key, label, multiline }) => _jsx(Field, { label: t(label), field: key, problems: problems, children: aria => multiline
61
+ return _jsxs("fieldset", { disabled: disabled, className: "jini-consent-settings-fields", children: [_jsx("legend", { children: t('Banner text') }), bannerModes && _jsx(BannerModeFields, { value: value, onChange: onChange, dictionary: dictionary, productName: productName, modes: bannerModes, useConsentSettingsPanelHook: useConsentSettingsPanelHook }), BANNER_FIELDS.map(({ key, label, multiline }) => _jsx(Field, { label: t(label), field: key, problems: problems, children: aria => multiline
56
62
  ? _jsx("textarea", { className: "jini-input", value: value[key] ?? '', maxLength: limits[key] ?? 2000, rows: 3, onChange: handlers.text(key), ...aria })
57
63
  : _jsx("input", { className: "jini-input", type: "text", value: value[key] ?? '', maxLength: limits[key] ?? 2000, onChange: handlers.text(key), ...aria }) }, key)), _jsx("p", { className: "jini-hint", children: t('Link a published privacy page, such as /privacy. The second link is optional.') })] });
58
64
  }
@@ -1,16 +1,7 @@
1
+ import type { ConsentAppearanceTokens } from '@jini-ai/core/contracts/site/cookie-consent';
2
+ export type { ConsentAppearanceTokens } from '@jini-ai/core/contracts/site/cookie-consent';
1
3
  export declare const CONSENT_CSS_SCOPE = "#jini-consent";
2
4
  export declare const CONSENT_MAX_CSS_LENGTH = 16384;
3
- /** Bounded appearance tokens; colors are opaque hex and must meet 4.5:1 contrast. */
4
- export interface ConsentAppearanceTokens {
5
- backgroundColor?: string;
6
- textColor?: string;
7
- borderColor?: string;
8
- borderRadius?: string;
9
- padding?: string;
10
- fontSize?: string;
11
- maxWidth?: string;
12
- fontFamily?: string;
13
- }
14
5
  export interface ConsentCssProblem {
15
6
  code: 'size' | 'syntax' | 'selector' | 'property' | 'value' | 'contrast';
16
7
  message: string;
@@ -48,5 +39,4 @@ export declare function compileConsentCss({ css, tokens }: {
48
39
  css?: string;
49
40
  tokens?: ConsentAppearanceTokens;
50
41
  }, _optional?: {}): ConsentCssResult;
51
- export {};
52
42
  //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1,51 @@
1
+ /** Host-owned site copy/policy linkage; shared by server registration and its admin adapter.
2
+ * Kept free of Node and engine imports: the admin bundle imports this file directly. */
3
+ export declare const SITE_CONSENT_NAMESPACE = "core.consent";
4
+ /** Where the first-visit banner sits; the engine owns the matching CSS. */
5
+ export declare const SITE_CONSENT_PLACEMENTS: readonly ["bottom-bar", "bottom-left", "bottom-right", "top-bar"];
6
+ export type SiteConsentPlacement = typeof SITE_CONSENT_PLACEMENTS[number];
7
+ /** Which banner the site shows: Jini's, the owner's own (built on window.jiniConsent), or none.
8
+ * Absent in a saved config means "follow `enabled`": on = Jini banner, off = none. */
9
+ export declare const SITE_CONSENT_BANNER_MODES: readonly ["jini", "headless", "off"];
10
+ export type SiteConsentBannerMode = typeof SITE_CONSENT_BANNER_MODES[number];
11
+ export declare const SITE_CONSENT_REGION_MODES: readonly ["auto", "opt-in", "opt-out"];
12
+ export type SiteConsentRegionMode = typeof SITE_CONSENT_REGION_MODES[number];
13
+ export declare const SITE_CONSENT_DEFAULTS: {
14
+ enabled: boolean;
15
+ regionMode: SiteConsentRegionMode;
16
+ policyVersion: string;
17
+ privacyPolicyUrl: string;
18
+ secondaryLinkLabel: string;
19
+ secondaryLinkUrl: string;
20
+ title: string;
21
+ message: string;
22
+ acceptLabel: string;
23
+ rejectLabel: string;
24
+ preferencesLabel: string;
25
+ placement: SiteConsentPlacement;
26
+ };
27
+ export type SiteConsentSettings = typeof SITE_CONSENT_DEFAULTS & {
28
+ allowUnsafeEval?: boolean;
29
+ reopen?: 'link';
30
+ bannerMode?: SiteConsentBannerMode;
31
+ };
32
+ /** The host's default banner Custom CSS: live whenever the owner's field is empty, and shown in that
33
+ * field so the owner edits it like their own. The engine allows only its banner selectors and a few
34
+ * safe properties (no var(), alpha colors, layout or font sizes under 16px), so this sets shape and
35
+ * spacing only; colors keep following the site theme in light and dark. */
36
+ export declare const SITE_CONSENT_DEFAULT_CSS = "/* Default cookie banner style. Edit it freely; \"Reset to default\" brings it back. */\n#jini-consent {\n padding: 16px;\n border-radius: 14px;\n}\n#jini-consent button {\n border-radius: 8px;\n}\n#jini-consent a {\n border-radius: 6px;\n}\n";
37
+ /** An empty or unset Custom CSS means "use the default"; an owner's own CSS is never replaced.
38
+ * Shared by public delivery, the admin preview and the editor snapshot, so all three show the same
39
+ * banner. @complexity O(css length). */
40
+ export declare function withSiteConsentDefaultCss<T extends object>({ config }: {
41
+ config: T;
42
+ }, _options?: {}): T;
43
+ /** Plain-text fields and their limits; config text is always rendered as text, never HTML. */
44
+ export declare const SITE_CONSENT_TEXT_LIMITS: Readonly<Record<'title' | 'message' | 'acceptLabel' | 'rejectLabel' | 'preferencesLabel' | 'secondaryLinkLabel', number>>;
45
+ /** Mirrors the engine's consentPolicyHref so the admin can say why a link is refused before saving:
46
+ * a local path (/privacy) or an https URL without credentials. Empty means "no link".
47
+ * @returns null when acceptable, else a sentence naming the fix. @complexity O(url length). */
48
+ export declare function siteConsentLinkProblem({ url }: {
49
+ url: string;
50
+ }, _options?: {}): string | null;
51
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,75 @@
1
+ /** Host-owned site copy/policy linkage; shared by server registration and its admin adapter.
2
+ * Kept free of Node and engine imports: the admin bundle imports this file directly. */
3
+ export const SITE_CONSENT_NAMESPACE = 'core.consent';
4
+ /** Where the first-visit banner sits; the engine owns the matching CSS. */
5
+ export const SITE_CONSENT_PLACEMENTS = ['bottom-bar', 'bottom-left', 'bottom-right', 'top-bar'];
6
+ /** Which banner the site shows: Jini's, the owner's own (built on window.jiniConsent), or none.
7
+ * Absent in a saved config means "follow `enabled`": on = Jini banner, off = none. */
8
+ export const SITE_CONSENT_BANNER_MODES = ['jini', 'headless', 'off'];
9
+ export const SITE_CONSENT_REGION_MODES = ['auto', 'opt-in', 'opt-out'];
10
+ export const SITE_CONSENT_DEFAULTS = {
11
+ // Off by default (owner, 2026-11-02: the banner kept causing problems) until the owner turns it
12
+ // on. Explicit owner on/off choices and published policies still win (settings.ts), so a site
13
+ // that already chose enabled:true keeps its banner.
14
+ enabled: false,
15
+ // A configured trusted header resolves US opt-out; unknown stays strict (Reject shown).
16
+ regionMode: 'auto',
17
+ policyVersion: '1',
18
+ privacyPolicyUrl: '/privacy',
19
+ secondaryLinkLabel: '',
20
+ secondaryLinkUrl: '',
21
+ title: 'Your cookie choices',
22
+ message: 'We use necessary cookies to run this site. You can choose whether to allow functional, analytics, and marketing cookies.',
23
+ acceptLabel: 'Accept all',
24
+ rejectLabel: 'Reject non-essential',
25
+ preferencesLabel: 'Cookie preferences',
26
+ // A corner card covers far less of the page than a full-width bar (owner, 2026-10-22).
27
+ placement: 'bottom-right',
28
+ };
29
+ /** The host's default banner Custom CSS: live whenever the owner's field is empty, and shown in that
30
+ * field so the owner edits it like their own. The engine allows only its banner selectors and a few
31
+ * safe properties (no var(), alpha colors, layout or font sizes under 16px), so this sets shape and
32
+ * spacing only; colors keep following the site theme in light and dark. */
33
+ export const SITE_CONSENT_DEFAULT_CSS = `/* Default cookie banner style. Edit it freely; "Reset to default" brings it back. */
34
+ #jini-consent {
35
+ padding: 16px;
36
+ border-radius: 14px;
37
+ }
38
+ #jini-consent button {
39
+ border-radius: 8px;
40
+ }
41
+ #jini-consent a {
42
+ border-radius: 6px;
43
+ }
44
+ `;
45
+ /** An empty or unset Custom CSS means "use the default"; an owner's own CSS is never replaced.
46
+ * Shared by public delivery, the admin preview and the editor snapshot, so all three show the same
47
+ * banner. @complexity O(css length). */
48
+ export function withSiteConsentDefaultCss({ config }, _options = {}) {
49
+ const { customCss } = config;
50
+ const empty = customCss === undefined || (typeof customCss === 'string' && customCss.trim() === '');
51
+ return empty ? { ...config, customCss: SITE_CONSENT_DEFAULT_CSS } : config;
52
+ }
53
+ /** Plain-text fields and their limits; config text is always rendered as text, never HTML. */
54
+ export const SITE_CONSENT_TEXT_LIMITS = {
55
+ title: 120, message: 600, acceptLabel: 40, rejectLabel: 40, preferencesLabel: 40, secondaryLinkLabel: 60,
56
+ };
57
+ /** Mirrors the engine's consentPolicyHref so the admin can say why a link is refused before saving:
58
+ * a local path (/privacy) or an https URL without credentials. Empty means "no link".
59
+ * @returns null when acceptable, else a sentence naming the fix. @complexity O(url length). */
60
+ export function siteConsentLinkProblem({ url }, _options = {}) {
61
+ if (url === '')
62
+ return null;
63
+ if (/^\/(?!\/)/.test(url))
64
+ return /[\\\x00-\x20]/.test(url) ? 'Remove spaces and backslashes from the link.' : null;
65
+ try {
66
+ const parsed = new URL(url);
67
+ if (parsed.protocol !== 'https:')
68
+ return 'Use a page on this site, like /privacy, or an https:// address.';
69
+ return parsed.username || parsed.password ? 'Remove the user name or password from the link.' : null;
70
+ }
71
+ catch {
72
+ return 'Use a page on this site, like /privacy, or an https:// address.';
73
+ }
74
+ }
75
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1,53 @@
1
+ /** @file Site consent settings → `@jini-ai/cookie-consent` banner input. The converter runs on read, so
2
+ * every saved revision (old snapshots included) renders without a re-save.
3
+ * Field names are unchanged: title, message, acceptLabel,
4
+ * rejectLabel, preferencesLabel, privacyPolicyUrl, secondaryLink*, placement, appearance and
5
+ * customCss map one to one. No Node, no engine state: preview, live pages and exports share it. */
6
+ import { type RenderBannerConfig, type RenderBannerOptions, type RenderedBanner } from '../render/index.js';
7
+ import type { RawContribution } from '../contract.js';
8
+ import type { SiteConsentBannerMode } from './config.js';
9
+ /** The saved site config fields the converter reads (a superset is fine). */
10
+ export interface SiteConsentSource {
11
+ enabled: boolean;
12
+ regionMode: string;
13
+ policyVersion: string;
14
+ privacyPolicyUrl: string;
15
+ title: string;
16
+ message: string;
17
+ acceptLabel: string;
18
+ rejectLabel: string;
19
+ preferencesLabel: string;
20
+ secondaryLinkLabel?: string;
21
+ secondaryLinkUrl?: string;
22
+ placement?: string;
23
+ appearance?: object;
24
+ customCss?: string;
25
+ bannerMode?: SiteConsentBannerMode;
26
+ }
27
+ export interface SiteCookieConsent {
28
+ banner: RenderBannerConfig;
29
+ options: Pick<RenderBannerOptions, 'placement' | 'reopen' | 'appearance' | 'customCss'>;
30
+ }
31
+ /** The on/off switch still rules: off = no banner. On, the saved mode applies, and an older config
32
+ * without one gets the Jini banner. @complexity O(1). */
33
+ export declare function siteBannerMode({ config }: {
34
+ config: Pick<SiteConsentSource, 'enabled' | 'bannerMode'>;
35
+ }, _optional?: {}): SiteConsentBannerMode;
36
+ /** One site config → `renderBanner` input. `policy` is the published policy id (owner
37
+ * version + revision), so a new publication asks visitors again. A global opt-out is read as `auto`:
38
+ * EU, UK and unknown visitors always keep Reject. @complexity O(fields). */
39
+ export declare function toSiteCookieConsent({ config, policy }: {
40
+ config: SiteConsentSource;
41
+ policy: string;
42
+ }, { plugins }?: {
43
+ plugins?: readonly RawContribution[];
44
+ }): SiteCookieConsent;
45
+ /** The scriptless admin preview of one config for a region: the same markup live pages get.
46
+ * @complexity O(copy + CSS length). */
47
+ export declare function renderSiteConsentPreview({ config, policy }: {
48
+ config: SiteConsentSource;
49
+ policy: string;
50
+ }, { region }?: {
51
+ region?: 'opt-in' | 'opt-out';
52
+ }): RenderedBanner;
53
+ //# sourceMappingURL=cookie-consent.d.ts.map
@@ -0,0 +1,47 @@
1
+ /** @file Site consent settings → `@jini-ai/cookie-consent` banner input. The converter runs on read, so
2
+ * every saved revision (old snapshots included) renders without a re-save.
3
+ * Field names are unchanged: title, message, acceptLabel,
4
+ * rejectLabel, preferencesLabel, privacyPolicyUrl, secondaryLink*, placement, appearance and
5
+ * customCss map one to one. No Node, no engine state: preview, live pages and exports share it. */
6
+ import { renderBanner, CONSENT_PLACEMENTS } from '../render/index.js';
7
+ /** The on/off switch still rules: off = no banner. On, the saved mode applies, and an older config
8
+ * without one gets the Jini banner. @complexity O(1). */
9
+ export function siteBannerMode({ config }, _optional = {}) {
10
+ return config.enabled ? config.bannerMode ?? 'jini' : 'off';
11
+ }
12
+ /** One site config → `renderBanner` input. `policy` is the published policy id (owner
13
+ * version + revision), so a new publication asks visitors again. A global opt-out is read as `auto`:
14
+ * EU, UK and unknown visitors always keep Reject. @complexity O(fields). */
15
+ export function toSiteCookieConsent({ config, policy }, { plugins } = {}) {
16
+ return {
17
+ banner: {
18
+ mode: siteBannerMode({ config }),
19
+ client: { contract: 1, policy, regionMode: config.regionMode === 'opt-in' ? 'opt-in' : 'auto', ...(plugins?.length ? { plugins } : {}) },
20
+ copy: {
21
+ title: config.title, message: config.message, acceptLabel: config.acceptLabel, rejectLabel: config.rejectLabel,
22
+ preferencesLabel: config.preferencesLabel, privacyPolicyUrl: config.privacyPolicyUrl,
23
+ ...(config.secondaryLinkLabel && config.secondaryLinkUrl ? { secondaryLinkLabel: config.secondaryLinkLabel, secondaryLinkUrl: config.secondaryLinkUrl } : {}),
24
+ },
25
+ },
26
+ options: siteBannerOptions({ config }),
27
+ };
28
+ }
29
+ /** Placement, reopen and the owner's styling; an unknown placement falls back to the renderer's. @complexity O(1). */
30
+ function siteBannerOptions({ config }, _optional = {}) {
31
+ const placement = CONSENT_PLACEMENTS.includes(config.placement) ? config.placement : undefined;
32
+ return {
33
+ // The host adds its own footer "Cookie settings" link, so the corner button stays off.
34
+ reopen: 'link',
35
+ ...(placement ? { placement } : {}),
36
+ ...(config.appearance ? { appearance: config.appearance } : {}),
37
+ ...(config.customCss ? { customCss: config.customCss } : {}),
38
+ };
39
+ }
40
+ /** The scriptless admin preview of one config for a region: the same markup live pages get.
41
+ * @complexity O(copy + CSS length). */
42
+ export function renderSiteConsentPreview({ config, policy }, { region = 'opt-in' } = {}) {
43
+ const { banner, options } = toSiteCookieConsent({ config, policy });
44
+ // "None" still previews the Jini banner, so the owner can see what switching it on would show.
45
+ return renderBanner({ ...banner, mode: banner.mode === 'off' ? 'jini' : banner.mode }, { ...options, preview: { region } });
46
+ }
47
+ //# sourceMappingURL=cookie-consent.js.map
@@ -0,0 +1,44 @@
1
+ import type { ConsentConfig, DeclaredScript, RawContribution } from '@jini-ai/core/contracts/site/cookie-consent';
2
+ /** Document construction consumes data, never a completed response body. */
3
+ export declare function siteConsentDocumentAssets(required: {
4
+ readPolicy: () => Promise<ConsentConfig | null>;
5
+ readDeclarations: () => Promise<readonly DeclaredScript[]>;
6
+ hasConsent: boolean;
7
+ preview: () => boolean;
8
+ exporting: () => boolean;
9
+ plugins: (required: {
10
+ live: boolean;
11
+ }) => Promise<readonly RawContribution[]>;
12
+ scripts: readonly DeclaredScript[];
13
+ static?: true;
14
+ clientSrc: string | undefined;
15
+ extensionSrc: string;
16
+ loaderSrc: string;
17
+ endpoint: string;
18
+ }, _optional?: {}): Promise<{
19
+ head: string;
20
+ body: string;
21
+ }>;
22
+ /** JSON declaration URLs are invisible to an HTML crawler. No live collectors enter an export. */
23
+ export declare function siteConsentExportAssets({ readPolicy, readDeclarations, hasConsent, client, extensionSrc }: {
24
+ readPolicy: () => Promise<ConsentConfig | null>;
25
+ readDeclarations: () => Promise<readonly DeclaredScript[]>;
26
+ hasConsent: () => boolean;
27
+ client: () => {
28
+ src: string;
29
+ } | undefined;
30
+ extensionSrc: string;
31
+ }, _optional?: {}): Promise<readonly string[]>;
32
+ export declare function staticConsentLoaderScript({ head, body, exporting }: {
33
+ head: string;
34
+ body: string;
35
+ exporting: boolean;
36
+ }, _optional?: {}): string;
37
+ export declare function documentPlugins(required: {
38
+ live: boolean;
39
+ adapters: () => readonly RawContribution[];
40
+ browserPlugins: () => Promise<readonly RawContribution[]>;
41
+ diagnosticsEnabled: () => Promise<boolean>;
42
+ diagnostics: () => RawContribution;
43
+ }, _optional?: {}): Promise<readonly RawContribution[]>;
44
+ //# sourceMappingURL=document-assets.d.ts.map