@1consent/react 0.1.0-beta.2 → 0.1.0-beta.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.
package/dist/index.js CHANGED
@@ -366,7 +366,7 @@ function OneConsent(props) {
366
366
  }
367
367
 
368
368
  // ../react-fastpath/dist/generated/engine-source.js
369
- var REACT_FASTPATH_SOURCE = '"use strict";(()=>{function ve(){let o=[],c=!1,E=!1,h,b,F=()=>{var f;if(!(c||E)){for(c=!0;!E&&o.length>0;){let d=o.shift();if(!d)break;if(!d.slot.isConnected||!d.allowed())continue;let s=d.recreate(d.source),a=s.hasAttribute("type")?s.type.trim().toLowerCase():s.getAttribute("language")?`text/${(f=s.getAttribute("language"))==null?void 0:f.trim().toLowerCase()}`:"",H=a===""||/^(?:application|text)\\/(?:x-)?(?:java|ecma)script$/.test(a)||/^text\\/(?:javascript1\\.[0-5]|jscript|livescript)$/.test(a);if(s.src&&H&&!s.hasAttribute("async")&&!s.defer&&!s.noModule){let w=new MutationObserver(()=>{s.isConnected||m()}),m=()=>{h===A&&(A(),c=!1,F())},A=()=>{w.disconnect(),s.removeEventListener("load",m),s.removeEventListener("error",m),h=void 0,b=void 0};h=A,b=()=>{(!s.isConnected||!d.allowed())&&(A(),c=!1)},s.addEventListener("load",m),s.addEventListener("error",m),w.observe(d.slot.ownerDocument,{childList:!0,subtree:!0}),d.slot.replaceWith(s),s.isConnected||m();return}d.slot.replaceWith(s)}c=!1}};return{activate(f,d,s,a){let H=Array.from(f.querySelectorAll("script"),m=>{let A=document.createComment("1c-script");return m.replaceWith(A),{source:m,slot:A,allowed:s,recreate:a}}),w=!c;c=!0,o.push(...H);try{d(f)}finally{w&&(c=!1),F()}},setPaused(f){E=f},recheck(){if(!E){b==null||b();for(let f=o.length-1;f>=0;f--){let d=o[f];d&&(!d.slot.isConnected||!d.allowed())&&o.splice(f,1)}}},flush:F,clear(){o.length=0,h==null||h(),c=!1}}}(()=>{var _e,ye,he,Se,be,Ae,Te,Ee;let o=window,c=document,E=["data-1c-service","data-1c-service-tag","data-1c-tag"],h="data-1c-category",b="data-1c-resolved",F="data-1c-once",f="1consent:config",d=33696e6,s=E.concat(h).map(e=>`template[${e}]:not([${b}])`).join(","),a=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),H=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)},w=e=>{var r,i;let t=((r=e.services)!=null?r:[]).map(l=>{var g,u,M;return`${l.id}\\0${(g=l.name)!=null?g:""}\\0${(u=l.tag)!=null?u:""}\\0${(M=l.categoryId)!=null?M:""}\\0${l.essential?1:0}${l.catalogServiceKey?`\\0k\\0${l.catalogServiceKey}`:""}${l.usSensitive?"\\x001":""}`}).sort(),n=((i=e.categories)!=null?i:[]).map(l=>`${l.id}\\0${l.name}\\0${l.essential?1:0}`).sort();return H(`s:${t.join("")}|c:${n.join("")}`)},m=((_e=c.currentScript)==null?void 0:_e.getAttribute("data-1c-app-id"))||"",A=((ye=c.currentScript)==null?void 0:ye.getAttribute("data-1c-framework-versions"))||"{}",q={};try{q=JSON.parse(A)}catch{}let p=o.__1CONSENT_CONFIG__,J=(he=p==null?void 0:p.consentEpoch)!=null?he:0,k=p==null?void 0:p.framework.type,O=p==null?void 0:p.machine,D=(Se=p==null?void 0:p.languages)==null?void 0:Se.primary,j=p!==void 0&&p.appId===m&&(k==="gdpr"||k==="tcf"||k==="us")&&(O==="P"||O==="S"||O==="D")&&typeof D=="string"&&D.length>0&&Number.isSafeInteger(J)&&J>=0,T=j?p:void 0,P=(be=T==null?void 0:T.appId)!=null?be:"",N=(Ae=T==null?void 0:T.framework.id)!=null?Ae:"",V=j&&k!=null?k:"",x=j&&O!=null?O:"",K=j&&D!=null?D:"",ne=a(q)?q[N]:void 0,I=typeof ne=="string"?ne:"",R=j?J:-1,re=JSON.stringify([P,N,V,x,K,I,R]),B=!1,Q=!1,U,X,Y,oe=!1,se=()=>{var e,t;try{let n=o.__1CONSENT_CONFIG__;return B||Q||!n||P.length===0||N.length===0||R<0||n.appId!==P||n.framework.id!==N||n.framework.type!==V||n.machine!==x||((e=n.languages)==null?void 0:e.primary)!==K||((t=n.consentEpoch)!=null?t:0)!==R||I.length===0?!1:((n!==U||n.services!==X||n.categories!==Y)&&(U=n,X=n.services,Y=n.categories,oe=w(n)===I),oe)}catch{return!1}},S=o.__1CONSENT_REACT_FASTPATH__;if(S){try{if(S.runtimeKey===re&&S.supportsPendingConsent===!0&&typeof S.updateConsent=="function"&&typeof S.promote=="function"&&se()&&typeof S.reconcile=="function"&&S.reconcile())return}catch{}try{typeof S.destroy=="function"&&S.destroy()}catch{}o.__1CONSENT_REACT_FASTPATH__===S&&delete o.__1CONSENT_REACT_FASTPATH__}let _=null,y=null,L,ie=!1,v,$=ve(),G,z=()=>{},C=()=>B||Q?!1:se()?!0:(Q=!0,$.clear(),_=null,y=null,v==null||v.disconnect(),z(),o.__1CONSENT_REACT_FASTPATH__===G&&delete o.__1CONSENT_REACT_FASTPATH__,!1),ce=new Set,ae=e=>{if(!e||typeof e!="object")return!1;for(let t of Object.values(e))if(typeof t!="boolean")return!1;return!0},Ce=()=>navigator.globalPrivacyControl===!0;try{let e=localStorage.getItem("1consent");if(e&&P&&N&&I&&R>=0){let t=Date.now(),n=t+d,r=JSON.parse(e),i=a(r)&&a(r.apps)?r.apps[P]:void 0,l=a(i)?i.frameworks:void 0,g=a(l)?l[N]:void 0,u=a(g)?g.fastPath:void 0,M=a(g)?g.consent:void 0,te=a(g)&&"consentEpoch"in g?g.consentEpoch:0,Oe=a(g)&&g.type===V&&g.machine===x&&typeof te=="number"&&Number.isSafeInteger(te)&&te>=R&&g.primaryLanguage===K,Pe=(T==null?void 0:T.framework.type)!=="tcf"||a(M)&&typeof M.tcString=="string"&&((Ee=(Te=o.__1cTcf)==null?void 0:Te.tcData)==null?void 0:Ee.eventStatus)==="tcloaded"&&o.__1cTcf.tcData.tcString===M.tcString;a(r)&&r.schemaVersion===1&&Oe&&a(u)&&u.structuralVersion===I&&typeof u.consentEpoch=="number"&&Number.isSafeInteger(u.consentEpoch)&&u.consentEpoch>=R&&Number.isSafeInteger(t)&&t>=0&&Number.isSafeInteger(n)&&typeof u.expiresAt=="number"&&Number.isSafeInteger(u.expiresAt)&&u.expiresAt>=t&&u.expiresAt<=n&&ae(u.services)&&Pe&&!(u.gpcRevocable===!0&&Ce())&&(L=u.expiresAt,_=u.services,y=ae(u.categories)?u.categories:{})}}catch{}let Ne=e=>{for(let t of E){let n=e.getAttribute(t);if(n!==null)return n}return e.getAttribute(h)},le=e=>{if(ie||L!==void 0&&Date.now()>L)return!1;for(let n of E){let r=e.getAttribute(n);if(r!==null)return _!==null&&_[r]===!0}let t=e.getAttribute(h);return t!==null?y!==null&&y[t]===!0:!1},Re=e=>{let t=c.createElement("script");for(let n of e.attributes)t.setAttribute(n.name,n.value);return e.src?e.hasAttribute("async")||(t.async=!1):t.text=e.text||"",t},W=e=>{if(!C()||e.hasAttribute(b)||!le(e))return!1;e.setAttribute(b,"");let t=e.getAttribute(F);if(t!==null){if(ce.has(t))return!1;ce.add(t)}let n=e.content.cloneNode(!0);return n instanceof DocumentFragment?($.activate(n,r=>e.after(r),()=>e.isConnected&&C()&&le(e),Re),!0):!1},Z=e=>e instanceof HTMLTemplateElement,ue=8,we=()=>new Promise(e=>{let t=o.scheduler;t!=null&&t.postTask?t.postTask(e,{priority:"user-visible"}):setTimeout(e,0)}),ee=e=>{if(!C())return[];let t=[];for(let i of e.querySelectorAll(s))Z(i)&&t.push(i);let n=[],r=0;for(;r<t.length&&r<ue;r++){let i=t[r];if(i&&W(i)){let l=Ne(i);l!==null&&n.push(l)}}return r<t.length&&(async()=>{for(;r<t.length;r++){r%ue===0&&await we();let i=t[r];if(i)try{W(i)}catch{}}})(),n},de=!1,fe=()=>C()?c.readyState!=="loading"?ee(c):(de||(de=!0,c.addEventListener("DOMContentLoaded",()=>ee(c),{once:!0})),[]):[];v=new MutationObserver(e=>{if(!(!C()||c.readyState==="loading"||_===null&&y===null))for(let t of e)for(let n of t.addedNodes)Z(n)?W(n):n instanceof Element&&ee(n)}),v.observe(c.documentElement,{childList:!0,subtree:!0});let pe=()=>{U=void 0,X=void 0,Y=void 0,C()},ke=()=>{B=!0,$.clear(),_=null,y=null,v==null||v.disconnect(),z(),o.__1CONSENT_REACT_FASTPATH__===G&&delete o.__1CONSENT_REACT_FASTPATH__},ge=(e,t,n,r=!1)=>{if(C()){ie=r,$.setPaused(r),L!==void 0&&Date.now()>L&&(_=null,y=null),n!==void 0&&(L=n===0?void 0:n),_=_||{},y=y||{};for(let i of Object.keys(e))_[i]=e[i]===!0;if(t)for(let i of Object.keys(t))y[i]=t[i]===!0;$.recheck()}},me=()=>($.flush(),fe());G={appId:P,frameworkId:N,frameworkType:V,machine:x,primaryLanguage:K,structuralVersion:I,consentEpoch:R,runtimeKey:re,apply(e,t){return ge(e,t),me()},supportsPendingConsent:!0,updateConsent:ge,promote:me,resolve(e){return e!==null&&Z(e)?W(e):!1},reconcile:C,destroy:ke},o.__1CONSENT_REACT_FASTPATH__=G,o.addEventListener(f,pe),z=()=>o.removeEventListener(f,pe),(_!==null||y!==null)&&fe()})();})();';
369
+ var REACT_FASTPATH_SOURCE = '"use strict";(()=>{var He=1440*60*1e3;function De(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Fe(r){return typeof r=="string"&&/^[A-Za-z0-9_-]{1,64}$/.test(r)&&!/^[\\da-f]{8}(-[\\da-f]{4}){3}-[\\da-f]{12}$/i.test(r)}function se(r){return De(r)&&[r.appId,r.frameworkId].every(Fe)}function Oe(){let r=[],c=!1,T=!1,E,h,F=()=>{var p;if(!(c||T)){for(c=!0;!T&&r.length>0;){let d=r.shift();if(!d)break;if(!d.slot.isConnected||!d.allowed())continue;let s=d.recreate(d.source),a=s.hasAttribute("type")?s.type.trim().toLowerCase():s.getAttribute("language")?`text/${(p=s.getAttribute("language"))==null?void 0:p.trim().toLowerCase()}`:"",H=a===""||/^(?:application|text)\\/(?:x-)?(?:java|ecma)script$/.test(a)||/^text\\/(?:javascript1\\.[0-5]|jscript|livescript)$/.test(a);if(s.src&&H&&!s.hasAttribute("async")&&!s.defer&&!s.noModule){let O=new MutationObserver(()=>{s.isConnected||y()}),y=()=>{E===b&&(b(),c=!1,F())},b=()=>{O.disconnect(),s.removeEventListener("load",y),s.removeEventListener("error",y),E=void 0,h=void 0};E=b,h=()=>{(!s.isConnected||!d.allowed())&&(b(),c=!1)},s.addEventListener("load",y),s.addEventListener("error",y),O.observe(d.slot.ownerDocument,{childList:!0,subtree:!0}),d.slot.replaceWith(s),s.isConnected||y();return}d.slot.replaceWith(s)}c=!1}};return{activate(p,d,s,a){let H=Array.from(p.querySelectorAll("script"),y=>{let b=document.createComment("1c-script");return y.replaceWith(b),{source:y,slot:b,allowed:s,recreate:a}}),O=!c;c=!0,r.push(...H);try{d(p)}finally{O&&(c=!1),F()}},setPaused(p){T=p},recheck(){if(!T){h==null||h();for(let p=r.length-1;p>=0;p--){let d=r[p];d&&(!d.slot.isConnected||!d.allowed())&&r.splice(p,1)}}},flush:F,clear(){r.length=0,E==null||E(),c=!1}}}(()=>{var he,be,Te,Ce,Ie,Ne,ve;let r=window,c=document,T=["data-1c-service","data-1c-service-tag","data-1c-tag"],E="data-1c-category",h="data-1c-resolved",F="data-1c-once",p="1consent:config",d=33696e6,s=T.concat(E).map(e=>`template[${e}]:not([${h}])`).join(","),a=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),H=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)},O=e=>{var o,i;let t=((o=e.services)!=null?o:[]).map(u=>{var m,l,D;return`${u.id}\\0${(m=u.name)!=null?m:""}\\0${(l=u.tag)!=null?l:""}\\0${(D=u.categoryId)!=null?D:""}\\0${u.essential?1:0}${u.catalogServiceKey?`\\0k\\0${u.catalogServiceKey}`:""}${u.usSensitive?"\\x001":""}`}).sort(),n=((i=e.categories)!=null?i:[]).map(u=>`${u.id}\\0${u.name}\\0${u.essential?1:0}`).sort();return H(`s:${t.join("")}|c:${n.join("")}`)},y=((he=c.currentScript)==null?void 0:he.getAttribute("data-1c-app-id"))||"",b=((be=c.currentScript)==null?void 0:be.getAttribute("data-1c-framework-versions"))||"{}",q={};try{q=JSON.parse(b)}catch{}let f=r.__1CONSENT_CONFIG__,j=f==null?void 0:f.publicIdentity,z=(Te=f==null?void 0:f.consentEpoch)!=null?Te:0,R=f==null?void 0:f.framework.type,w=f==null?void 0:f.machine,$=(Ce=f==null?void 0:f.languages)==null?void 0:Ce.primary,N=f!==void 0&&se(j)&&j.appId===y&&(R==="gdpr"||R==="tcf"||R==="us")&&(w==="P"||w==="S"||w==="D")&&typeof $=="string"&&$.length>0&&Number.isSafeInteger(z)&&z>=0,g=N?f:void 0,k=(Ie=g==null?void 0:g.appId)!=null?Ie:"",P=(Ne=g==null?void 0:g.framework.id)!=null?Ne:"",V=N&&R!=null?R:"",G=N&&w!=null?w:"",B=N&&$!=null?$:"",ie=N?j.appId:"",J=N?j.frameworkId:"",ce=a(q)?q[J]:void 0,L=typeof ce=="string"?ce:"",v=N?z:-1,ae=JSON.stringify([k,P,ie,J,V,G,B,L,v]),Y=!1,X=!1,Q,Z,ee,ue=!1,le=()=>{var e,t;try{let n=r.__1CONSENT_CONFIG__;return Y||X||!n||k.length===0||P.length===0||v<0||n.appId!==k||n.framework.id!==P||!se(n.publicIdentity)||n.publicIdentity.appId!==ie||n.publicIdentity.frameworkId!==J||n.framework.type!==V||n.machine!==G||((e=n.languages)==null?void 0:e.primary)!==B||((t=n.consentEpoch)!=null?t:0)!==v||L.length===0?!1:((n!==Q||n.services!==Z||n.categories!==ee)&&(Q=n,Z=n.services,ee=n.categories,ue=O(n)===L),ue)}catch{return!1}},A=r.__1CONSENT_REACT_FASTPATH__;if(A){try{if(A.runtimeKey===ae&&A.supportsPendingConsent===!0&&typeof A.updateConsent=="function"&&typeof A.promote=="function"&&le()&&typeof A.reconcile=="function"&&A.reconcile())return}catch{}try{typeof A.destroy=="function"&&A.destroy()}catch{}r.__1CONSENT_REACT_FASTPATH__===A&&delete r.__1CONSENT_REACT_FASTPATH__}let _=null,S=null,x,de=!1,C,M=Oe(),U,te=()=>{},I=()=>Y||X?!1:le()?!0:(X=!0,M.clear(),_=null,S=null,C==null||C.disconnect(),te(),r.__1CONSENT_REACT_FASTPATH__===U&&delete r.__1CONSENT_REACT_FASTPATH__,!1),fe=new Set,pe=e=>{if(!e||typeof e!="object")return!1;for(let t of Object.values(e))if(typeof t!="boolean")return!1;return!0},Re=()=>navigator.globalPrivacyControl===!0;try{let e=localStorage.getItem("1consent");if(e&&k&&P&&L&&v>=0){let t=Date.now(),n=t+d,o=JSON.parse(e),i=a(o)&&a(o.apps)?o.apps[k]:void 0,u=a(i)?i.frameworks:void 0,m=a(u)?u[P]:void 0,l=a(m)?m.fastPath:void 0,D=a(m)?m.consent:void 0,oe=a(m)&&"consentEpoch"in m?m.consentEpoch:0,xe=a(m)&&m.type===V&&m.machine===G&&typeof oe=="number"&&Number.isSafeInteger(oe)&&oe>=v&&m.primaryLanguage===B,W=(g==null?void 0:g.framework.type)==="tcf"?(ve=r.__1cTcf)==null?void 0:ve.tcData:void 0,Me=(g==null?void 0:g.framework.type)!=="tcf"||a(D)&&typeof D.tcString=="string"&&(W==null?void 0:W.eventStatus)==="tcloaded"&&W.tcString===D.tcString;a(o)&&o.schemaVersion===1&&xe&&a(l)&&l.structuralVersion===L&&typeof l.consentEpoch=="number"&&Number.isSafeInteger(l.consentEpoch)&&l.consentEpoch>=v&&Number.isSafeInteger(t)&&t>=0&&Number.isSafeInteger(n)&&typeof l.expiresAt=="number"&&Number.isSafeInteger(l.expiresAt)&&l.expiresAt>=t&&l.expiresAt<=n&&pe(l.services)&&Me&&!(l.gpcRevocable===!0&&Re())&&(x=l.expiresAt,_=l.services,S=pe(l.categories)?l.categories:{})}}catch{}let we=e=>{for(let t of T){let n=e.getAttribute(t);if(n!==null)return n}return e.getAttribute(E)},me=e=>{if(de||x!==void 0&&Date.now()>x)return!1;for(let n of T){let o=e.getAttribute(n);if(o!==null)return _!==null&&_[o]===!0}let t=e.getAttribute(E);return t!==null?S!==null&&S[t]===!0:!1},ke=e=>{let t=c.createElement("script");for(let n of e.attributes)t.setAttribute(n.name,n.value);return e.src?e.hasAttribute("async")||(t.async=!1):t.text=e.text||"",t},K=e=>{if(!I()||e.hasAttribute(h)||!me(e))return!1;e.setAttribute(h,"");let t=e.getAttribute(F);if(t!==null){if(fe.has(t))return!1;fe.add(t)}let n=e.content.cloneNode(!0);return n instanceof DocumentFragment?(M.activate(n,o=>e.after(o),()=>e.isConnected&&I()&&me(e),ke),!0):!1},ne=e=>e instanceof HTMLTemplateElement,ge=8,Pe=()=>new Promise(e=>{let t=r.scheduler;t!=null&&t.postTask?t.postTask(e,{priority:"user-visible"}):setTimeout(e,0)}),re=e=>{if(!I())return[];let t=[];for(let i of e.querySelectorAll(s))ne(i)&&t.push(i);let n=[],o=0;for(;o<t.length&&o<ge;o++){let i=t[o];if(i&&K(i)){let u=we(i);u!==null&&n.push(u)}}return o<t.length&&(async()=>{for(;o<t.length;o++){o%ge===0&&await Pe();let i=t[o];if(i)try{K(i)}catch{}}})(),n},ye=!1,_e=()=>I()?c.readyState!=="loading"?re(c):(ye||(ye=!0,c.addEventListener("DOMContentLoaded",()=>re(c),{once:!0})),[]):[];C=new MutationObserver(e=>{if(!(!I()||c.readyState==="loading"||_===null&&S===null))for(let t of e)for(let n of t.addedNodes)ne(n)?K(n):n instanceof Element&&re(n)}),C.observe(c.documentElement,{childList:!0,subtree:!0});let Se=()=>{Q=void 0,Z=void 0,ee=void 0,I()},Le=()=>{Y=!0,M.clear(),_=null,S=null,C==null||C.disconnect(),te(),r.__1CONSENT_REACT_FASTPATH__===U&&delete r.__1CONSENT_REACT_FASTPATH__},Ee=(e,t,n,o=!1)=>{if(I()){de=o,M.setPaused(o),x!==void 0&&Date.now()>x&&(_=null,S=null),n!==void 0&&(x=n===0?void 0:n),_=_||{},S=S||{};for(let i of Object.keys(e))_[i]=e[i]===!0;if(t)for(let i of Object.keys(t))S[i]=t[i]===!0;M.recheck()}},Ae=()=>(M.flush(),_e());U={appId:k,frameworkId:P,frameworkType:V,machine:G,primaryLanguage:B,structuralVersion:L,consentEpoch:v,runtimeKey:ae,apply(e,t){return Ee(e,t),Ae()},supportsPendingConsent:!0,updateConsent:Ee,promote:Ae,resolve(e){return e!==null&&ne(e)?K(e):!1},reconcile:I,destroy:Le},r.__1CONSENT_REACT_FASTPATH__=U,r.addEventListener(p,Se),te=()=>r.removeEventListener(p,Se),(_!==null||S!==null)&&_e()})();})();';
370
370
 
371
371
  // src/provider.tsx
372
372
  import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
@@ -260,7 +260,7 @@ function OneConsent(props) {
260
260
  }
261
261
 
262
262
  // ../react-fastpath/dist/generated/engine-source.js
263
- var REACT_FASTPATH_SOURCE = '"use strict";(()=>{function ve(){let o=[],c=!1,E=!1,h,b,F=()=>{var f;if(!(c||E)){for(c=!0;!E&&o.length>0;){let d=o.shift();if(!d)break;if(!d.slot.isConnected||!d.allowed())continue;let s=d.recreate(d.source),a=s.hasAttribute("type")?s.type.trim().toLowerCase():s.getAttribute("language")?`text/${(f=s.getAttribute("language"))==null?void 0:f.trim().toLowerCase()}`:"",H=a===""||/^(?:application|text)\\/(?:x-)?(?:java|ecma)script$/.test(a)||/^text\\/(?:javascript1\\.[0-5]|jscript|livescript)$/.test(a);if(s.src&&H&&!s.hasAttribute("async")&&!s.defer&&!s.noModule){let w=new MutationObserver(()=>{s.isConnected||m()}),m=()=>{h===A&&(A(),c=!1,F())},A=()=>{w.disconnect(),s.removeEventListener("load",m),s.removeEventListener("error",m),h=void 0,b=void 0};h=A,b=()=>{(!s.isConnected||!d.allowed())&&(A(),c=!1)},s.addEventListener("load",m),s.addEventListener("error",m),w.observe(d.slot.ownerDocument,{childList:!0,subtree:!0}),d.slot.replaceWith(s),s.isConnected||m();return}d.slot.replaceWith(s)}c=!1}};return{activate(f,d,s,a){let H=Array.from(f.querySelectorAll("script"),m=>{let A=document.createComment("1c-script");return m.replaceWith(A),{source:m,slot:A,allowed:s,recreate:a}}),w=!c;c=!0,o.push(...H);try{d(f)}finally{w&&(c=!1),F()}},setPaused(f){E=f},recheck(){if(!E){b==null||b();for(let f=o.length-1;f>=0;f--){let d=o[f];d&&(!d.slot.isConnected||!d.allowed())&&o.splice(f,1)}}},flush:F,clear(){o.length=0,h==null||h(),c=!1}}}(()=>{var _e,ye,he,Se,be,Ae,Te,Ee;let o=window,c=document,E=["data-1c-service","data-1c-service-tag","data-1c-tag"],h="data-1c-category",b="data-1c-resolved",F="data-1c-once",f="1consent:config",d=33696e6,s=E.concat(h).map(e=>`template[${e}]:not([${b}])`).join(","),a=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),H=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)},w=e=>{var r,i;let t=((r=e.services)!=null?r:[]).map(l=>{var g,u,M;return`${l.id}\\0${(g=l.name)!=null?g:""}\\0${(u=l.tag)!=null?u:""}\\0${(M=l.categoryId)!=null?M:""}\\0${l.essential?1:0}${l.catalogServiceKey?`\\0k\\0${l.catalogServiceKey}`:""}${l.usSensitive?"\\x001":""}`}).sort(),n=((i=e.categories)!=null?i:[]).map(l=>`${l.id}\\0${l.name}\\0${l.essential?1:0}`).sort();return H(`s:${t.join("")}|c:${n.join("")}`)},m=((_e=c.currentScript)==null?void 0:_e.getAttribute("data-1c-app-id"))||"",A=((ye=c.currentScript)==null?void 0:ye.getAttribute("data-1c-framework-versions"))||"{}",q={};try{q=JSON.parse(A)}catch{}let p=o.__1CONSENT_CONFIG__,J=(he=p==null?void 0:p.consentEpoch)!=null?he:0,k=p==null?void 0:p.framework.type,O=p==null?void 0:p.machine,D=(Se=p==null?void 0:p.languages)==null?void 0:Se.primary,j=p!==void 0&&p.appId===m&&(k==="gdpr"||k==="tcf"||k==="us")&&(O==="P"||O==="S"||O==="D")&&typeof D=="string"&&D.length>0&&Number.isSafeInteger(J)&&J>=0,T=j?p:void 0,P=(be=T==null?void 0:T.appId)!=null?be:"",N=(Ae=T==null?void 0:T.framework.id)!=null?Ae:"",V=j&&k!=null?k:"",x=j&&O!=null?O:"",K=j&&D!=null?D:"",ne=a(q)?q[N]:void 0,I=typeof ne=="string"?ne:"",R=j?J:-1,re=JSON.stringify([P,N,V,x,K,I,R]),B=!1,Q=!1,U,X,Y,oe=!1,se=()=>{var e,t;try{let n=o.__1CONSENT_CONFIG__;return B||Q||!n||P.length===0||N.length===0||R<0||n.appId!==P||n.framework.id!==N||n.framework.type!==V||n.machine!==x||((e=n.languages)==null?void 0:e.primary)!==K||((t=n.consentEpoch)!=null?t:0)!==R||I.length===0?!1:((n!==U||n.services!==X||n.categories!==Y)&&(U=n,X=n.services,Y=n.categories,oe=w(n)===I),oe)}catch{return!1}},S=o.__1CONSENT_REACT_FASTPATH__;if(S){try{if(S.runtimeKey===re&&S.supportsPendingConsent===!0&&typeof S.updateConsent=="function"&&typeof S.promote=="function"&&se()&&typeof S.reconcile=="function"&&S.reconcile())return}catch{}try{typeof S.destroy=="function"&&S.destroy()}catch{}o.__1CONSENT_REACT_FASTPATH__===S&&delete o.__1CONSENT_REACT_FASTPATH__}let _=null,y=null,L,ie=!1,v,$=ve(),G,z=()=>{},C=()=>B||Q?!1:se()?!0:(Q=!0,$.clear(),_=null,y=null,v==null||v.disconnect(),z(),o.__1CONSENT_REACT_FASTPATH__===G&&delete o.__1CONSENT_REACT_FASTPATH__,!1),ce=new Set,ae=e=>{if(!e||typeof e!="object")return!1;for(let t of Object.values(e))if(typeof t!="boolean")return!1;return!0},Ce=()=>navigator.globalPrivacyControl===!0;try{let e=localStorage.getItem("1consent");if(e&&P&&N&&I&&R>=0){let t=Date.now(),n=t+d,r=JSON.parse(e),i=a(r)&&a(r.apps)?r.apps[P]:void 0,l=a(i)?i.frameworks:void 0,g=a(l)?l[N]:void 0,u=a(g)?g.fastPath:void 0,M=a(g)?g.consent:void 0,te=a(g)&&"consentEpoch"in g?g.consentEpoch:0,Oe=a(g)&&g.type===V&&g.machine===x&&typeof te=="number"&&Number.isSafeInteger(te)&&te>=R&&g.primaryLanguage===K,Pe=(T==null?void 0:T.framework.type)!=="tcf"||a(M)&&typeof M.tcString=="string"&&((Ee=(Te=o.__1cTcf)==null?void 0:Te.tcData)==null?void 0:Ee.eventStatus)==="tcloaded"&&o.__1cTcf.tcData.tcString===M.tcString;a(r)&&r.schemaVersion===1&&Oe&&a(u)&&u.structuralVersion===I&&typeof u.consentEpoch=="number"&&Number.isSafeInteger(u.consentEpoch)&&u.consentEpoch>=R&&Number.isSafeInteger(t)&&t>=0&&Number.isSafeInteger(n)&&typeof u.expiresAt=="number"&&Number.isSafeInteger(u.expiresAt)&&u.expiresAt>=t&&u.expiresAt<=n&&ae(u.services)&&Pe&&!(u.gpcRevocable===!0&&Ce())&&(L=u.expiresAt,_=u.services,y=ae(u.categories)?u.categories:{})}}catch{}let Ne=e=>{for(let t of E){let n=e.getAttribute(t);if(n!==null)return n}return e.getAttribute(h)},le=e=>{if(ie||L!==void 0&&Date.now()>L)return!1;for(let n of E){let r=e.getAttribute(n);if(r!==null)return _!==null&&_[r]===!0}let t=e.getAttribute(h);return t!==null?y!==null&&y[t]===!0:!1},Re=e=>{let t=c.createElement("script");for(let n of e.attributes)t.setAttribute(n.name,n.value);return e.src?e.hasAttribute("async")||(t.async=!1):t.text=e.text||"",t},W=e=>{if(!C()||e.hasAttribute(b)||!le(e))return!1;e.setAttribute(b,"");let t=e.getAttribute(F);if(t!==null){if(ce.has(t))return!1;ce.add(t)}let n=e.content.cloneNode(!0);return n instanceof DocumentFragment?($.activate(n,r=>e.after(r),()=>e.isConnected&&C()&&le(e),Re),!0):!1},Z=e=>e instanceof HTMLTemplateElement,ue=8,we=()=>new Promise(e=>{let t=o.scheduler;t!=null&&t.postTask?t.postTask(e,{priority:"user-visible"}):setTimeout(e,0)}),ee=e=>{if(!C())return[];let t=[];for(let i of e.querySelectorAll(s))Z(i)&&t.push(i);let n=[],r=0;for(;r<t.length&&r<ue;r++){let i=t[r];if(i&&W(i)){let l=Ne(i);l!==null&&n.push(l)}}return r<t.length&&(async()=>{for(;r<t.length;r++){r%ue===0&&await we();let i=t[r];if(i)try{W(i)}catch{}}})(),n},de=!1,fe=()=>C()?c.readyState!=="loading"?ee(c):(de||(de=!0,c.addEventListener("DOMContentLoaded",()=>ee(c),{once:!0})),[]):[];v=new MutationObserver(e=>{if(!(!C()||c.readyState==="loading"||_===null&&y===null))for(let t of e)for(let n of t.addedNodes)Z(n)?W(n):n instanceof Element&&ee(n)}),v.observe(c.documentElement,{childList:!0,subtree:!0});let pe=()=>{U=void 0,X=void 0,Y=void 0,C()},ke=()=>{B=!0,$.clear(),_=null,y=null,v==null||v.disconnect(),z(),o.__1CONSENT_REACT_FASTPATH__===G&&delete o.__1CONSENT_REACT_FASTPATH__},ge=(e,t,n,r=!1)=>{if(C()){ie=r,$.setPaused(r),L!==void 0&&Date.now()>L&&(_=null,y=null),n!==void 0&&(L=n===0?void 0:n),_=_||{},y=y||{};for(let i of Object.keys(e))_[i]=e[i]===!0;if(t)for(let i of Object.keys(t))y[i]=t[i]===!0;$.recheck()}},me=()=>($.flush(),fe());G={appId:P,frameworkId:N,frameworkType:V,machine:x,primaryLanguage:K,structuralVersion:I,consentEpoch:R,runtimeKey:re,apply(e,t){return ge(e,t),me()},supportsPendingConsent:!0,updateConsent:ge,promote:me,resolve(e){return e!==null&&Z(e)?W(e):!1},reconcile:C,destroy:ke},o.__1CONSENT_REACT_FASTPATH__=G,o.addEventListener(f,pe),z=()=>o.removeEventListener(f,pe),(_!==null||y!==null)&&fe()})();})();';
263
+ var REACT_FASTPATH_SOURCE = '"use strict";(()=>{var He=1440*60*1e3;function De(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Fe(r){return typeof r=="string"&&/^[A-Za-z0-9_-]{1,64}$/.test(r)&&!/^[\\da-f]{8}(-[\\da-f]{4}){3}-[\\da-f]{12}$/i.test(r)}function se(r){return De(r)&&[r.appId,r.frameworkId].every(Fe)}function Oe(){let r=[],c=!1,T=!1,E,h,F=()=>{var p;if(!(c||T)){for(c=!0;!T&&r.length>0;){let d=r.shift();if(!d)break;if(!d.slot.isConnected||!d.allowed())continue;let s=d.recreate(d.source),a=s.hasAttribute("type")?s.type.trim().toLowerCase():s.getAttribute("language")?`text/${(p=s.getAttribute("language"))==null?void 0:p.trim().toLowerCase()}`:"",H=a===""||/^(?:application|text)\\/(?:x-)?(?:java|ecma)script$/.test(a)||/^text\\/(?:javascript1\\.[0-5]|jscript|livescript)$/.test(a);if(s.src&&H&&!s.hasAttribute("async")&&!s.defer&&!s.noModule){let O=new MutationObserver(()=>{s.isConnected||y()}),y=()=>{E===b&&(b(),c=!1,F())},b=()=>{O.disconnect(),s.removeEventListener("load",y),s.removeEventListener("error",y),E=void 0,h=void 0};E=b,h=()=>{(!s.isConnected||!d.allowed())&&(b(),c=!1)},s.addEventListener("load",y),s.addEventListener("error",y),O.observe(d.slot.ownerDocument,{childList:!0,subtree:!0}),d.slot.replaceWith(s),s.isConnected||y();return}d.slot.replaceWith(s)}c=!1}};return{activate(p,d,s,a){let H=Array.from(p.querySelectorAll("script"),y=>{let b=document.createComment("1c-script");return y.replaceWith(b),{source:y,slot:b,allowed:s,recreate:a}}),O=!c;c=!0,r.push(...H);try{d(p)}finally{O&&(c=!1),F()}},setPaused(p){T=p},recheck(){if(!T){h==null||h();for(let p=r.length-1;p>=0;p--){let d=r[p];d&&(!d.slot.isConnected||!d.allowed())&&r.splice(p,1)}}},flush:F,clear(){r.length=0,E==null||E(),c=!1}}}(()=>{var he,be,Te,Ce,Ie,Ne,ve;let r=window,c=document,T=["data-1c-service","data-1c-service-tag","data-1c-tag"],E="data-1c-category",h="data-1c-resolved",F="data-1c-once",p="1consent:config",d=33696e6,s=T.concat(E).map(e=>`template[${e}]:not([${h}])`).join(","),a=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),H=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)},O=e=>{var o,i;let t=((o=e.services)!=null?o:[]).map(u=>{var m,l,D;return`${u.id}\\0${(m=u.name)!=null?m:""}\\0${(l=u.tag)!=null?l:""}\\0${(D=u.categoryId)!=null?D:""}\\0${u.essential?1:0}${u.catalogServiceKey?`\\0k\\0${u.catalogServiceKey}`:""}${u.usSensitive?"\\x001":""}`}).sort(),n=((i=e.categories)!=null?i:[]).map(u=>`${u.id}\\0${u.name}\\0${u.essential?1:0}`).sort();return H(`s:${t.join("")}|c:${n.join("")}`)},y=((he=c.currentScript)==null?void 0:he.getAttribute("data-1c-app-id"))||"",b=((be=c.currentScript)==null?void 0:be.getAttribute("data-1c-framework-versions"))||"{}",q={};try{q=JSON.parse(b)}catch{}let f=r.__1CONSENT_CONFIG__,j=f==null?void 0:f.publicIdentity,z=(Te=f==null?void 0:f.consentEpoch)!=null?Te:0,R=f==null?void 0:f.framework.type,w=f==null?void 0:f.machine,$=(Ce=f==null?void 0:f.languages)==null?void 0:Ce.primary,N=f!==void 0&&se(j)&&j.appId===y&&(R==="gdpr"||R==="tcf"||R==="us")&&(w==="P"||w==="S"||w==="D")&&typeof $=="string"&&$.length>0&&Number.isSafeInteger(z)&&z>=0,g=N?f:void 0,k=(Ie=g==null?void 0:g.appId)!=null?Ie:"",P=(Ne=g==null?void 0:g.framework.id)!=null?Ne:"",V=N&&R!=null?R:"",G=N&&w!=null?w:"",B=N&&$!=null?$:"",ie=N?j.appId:"",J=N?j.frameworkId:"",ce=a(q)?q[J]:void 0,L=typeof ce=="string"?ce:"",v=N?z:-1,ae=JSON.stringify([k,P,ie,J,V,G,B,L,v]),Y=!1,X=!1,Q,Z,ee,ue=!1,le=()=>{var e,t;try{let n=r.__1CONSENT_CONFIG__;return Y||X||!n||k.length===0||P.length===0||v<0||n.appId!==k||n.framework.id!==P||!se(n.publicIdentity)||n.publicIdentity.appId!==ie||n.publicIdentity.frameworkId!==J||n.framework.type!==V||n.machine!==G||((e=n.languages)==null?void 0:e.primary)!==B||((t=n.consentEpoch)!=null?t:0)!==v||L.length===0?!1:((n!==Q||n.services!==Z||n.categories!==ee)&&(Q=n,Z=n.services,ee=n.categories,ue=O(n)===L),ue)}catch{return!1}},A=r.__1CONSENT_REACT_FASTPATH__;if(A){try{if(A.runtimeKey===ae&&A.supportsPendingConsent===!0&&typeof A.updateConsent=="function"&&typeof A.promote=="function"&&le()&&typeof A.reconcile=="function"&&A.reconcile())return}catch{}try{typeof A.destroy=="function"&&A.destroy()}catch{}r.__1CONSENT_REACT_FASTPATH__===A&&delete r.__1CONSENT_REACT_FASTPATH__}let _=null,S=null,x,de=!1,C,M=Oe(),U,te=()=>{},I=()=>Y||X?!1:le()?!0:(X=!0,M.clear(),_=null,S=null,C==null||C.disconnect(),te(),r.__1CONSENT_REACT_FASTPATH__===U&&delete r.__1CONSENT_REACT_FASTPATH__,!1),fe=new Set,pe=e=>{if(!e||typeof e!="object")return!1;for(let t of Object.values(e))if(typeof t!="boolean")return!1;return!0},Re=()=>navigator.globalPrivacyControl===!0;try{let e=localStorage.getItem("1consent");if(e&&k&&P&&L&&v>=0){let t=Date.now(),n=t+d,o=JSON.parse(e),i=a(o)&&a(o.apps)?o.apps[k]:void 0,u=a(i)?i.frameworks:void 0,m=a(u)?u[P]:void 0,l=a(m)?m.fastPath:void 0,D=a(m)?m.consent:void 0,oe=a(m)&&"consentEpoch"in m?m.consentEpoch:0,xe=a(m)&&m.type===V&&m.machine===G&&typeof oe=="number"&&Number.isSafeInteger(oe)&&oe>=v&&m.primaryLanguage===B,W=(g==null?void 0:g.framework.type)==="tcf"?(ve=r.__1cTcf)==null?void 0:ve.tcData:void 0,Me=(g==null?void 0:g.framework.type)!=="tcf"||a(D)&&typeof D.tcString=="string"&&(W==null?void 0:W.eventStatus)==="tcloaded"&&W.tcString===D.tcString;a(o)&&o.schemaVersion===1&&xe&&a(l)&&l.structuralVersion===L&&typeof l.consentEpoch=="number"&&Number.isSafeInteger(l.consentEpoch)&&l.consentEpoch>=v&&Number.isSafeInteger(t)&&t>=0&&Number.isSafeInteger(n)&&typeof l.expiresAt=="number"&&Number.isSafeInteger(l.expiresAt)&&l.expiresAt>=t&&l.expiresAt<=n&&pe(l.services)&&Me&&!(l.gpcRevocable===!0&&Re())&&(x=l.expiresAt,_=l.services,S=pe(l.categories)?l.categories:{})}}catch{}let we=e=>{for(let t of T){let n=e.getAttribute(t);if(n!==null)return n}return e.getAttribute(E)},me=e=>{if(de||x!==void 0&&Date.now()>x)return!1;for(let n of T){let o=e.getAttribute(n);if(o!==null)return _!==null&&_[o]===!0}let t=e.getAttribute(E);return t!==null?S!==null&&S[t]===!0:!1},ke=e=>{let t=c.createElement("script");for(let n of e.attributes)t.setAttribute(n.name,n.value);return e.src?e.hasAttribute("async")||(t.async=!1):t.text=e.text||"",t},K=e=>{if(!I()||e.hasAttribute(h)||!me(e))return!1;e.setAttribute(h,"");let t=e.getAttribute(F);if(t!==null){if(fe.has(t))return!1;fe.add(t)}let n=e.content.cloneNode(!0);return n instanceof DocumentFragment?(M.activate(n,o=>e.after(o),()=>e.isConnected&&I()&&me(e),ke),!0):!1},ne=e=>e instanceof HTMLTemplateElement,ge=8,Pe=()=>new Promise(e=>{let t=r.scheduler;t!=null&&t.postTask?t.postTask(e,{priority:"user-visible"}):setTimeout(e,0)}),re=e=>{if(!I())return[];let t=[];for(let i of e.querySelectorAll(s))ne(i)&&t.push(i);let n=[],o=0;for(;o<t.length&&o<ge;o++){let i=t[o];if(i&&K(i)){let u=we(i);u!==null&&n.push(u)}}return o<t.length&&(async()=>{for(;o<t.length;o++){o%ge===0&&await Pe();let i=t[o];if(i)try{K(i)}catch{}}})(),n},ye=!1,_e=()=>I()?c.readyState!=="loading"?re(c):(ye||(ye=!0,c.addEventListener("DOMContentLoaded",()=>re(c),{once:!0})),[]):[];C=new MutationObserver(e=>{if(!(!I()||c.readyState==="loading"||_===null&&S===null))for(let t of e)for(let n of t.addedNodes)ne(n)?K(n):n instanceof Element&&re(n)}),C.observe(c.documentElement,{childList:!0,subtree:!0});let Se=()=>{Q=void 0,Z=void 0,ee=void 0,I()},Le=()=>{Y=!0,M.clear(),_=null,S=null,C==null||C.disconnect(),te(),r.__1CONSENT_REACT_FASTPATH__===U&&delete r.__1CONSENT_REACT_FASTPATH__},Ee=(e,t,n,o=!1)=>{if(I()){de=o,M.setPaused(o),x!==void 0&&Date.now()>x&&(_=null,S=null),n!==void 0&&(x=n===0?void 0:n),_=_||{},S=S||{};for(let i of Object.keys(e))_[i]=e[i]===!0;if(t)for(let i of Object.keys(t))S[i]=t[i]===!0;M.recheck()}},Ae=()=>(M.flush(),_e());U={appId:k,frameworkId:P,frameworkType:V,machine:G,primaryLanguage:B,structuralVersion:L,consentEpoch:v,runtimeKey:ae,apply(e,t){return Ee(e,t),Ae()},supportsPendingConsent:!0,updateConsent:Ee,promote:Ae,resolve(e){return e!==null&&ne(e)?K(e):!1},reconcile:I,destroy:Le},r.__1CONSENT_REACT_FASTPATH__=U,r.addEventListener(p,Se),te=()=>r.removeEventListener(p,Se),(_!==null||S!==null)&&_e()})();})();';
264
264
 
265
265
  // src/provider.tsx
266
266
  import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1consent/react",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "React 19 consent components and hooks for the 1Consent CMP.",
5
5
  "type": "module",
6
6
  "sideEffects": false,