@1consent/react 0.1.0-beta.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -15
- package/dist/client-provider.d.ts +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +236 -136
- package/dist/provider.d.ts +17 -1
- package/dist/react-server.js +16 -9
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
# @1consent/react
|
|
2
2
|
|
|
3
|
-
React 19
|
|
3
|
+
React 19 integration for 1Consent. It renders the synchronous CMP embed,
|
|
4
4
|
keeps third-party markup inert until consent, and exposes reactive consent
|
|
5
5
|
state without making server-rendered HTML visitor-specific.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
It works with server-rendered apps (Next.js, React Router or Remix, Astro)
|
|
8
|
+
and client-rendered apps (for example a Vite SPA started with `createRoot`). In
|
|
9
|
+
server-rendered HTML the CMP embed and the inline engine run while the page
|
|
10
|
+
parses; in a client-rendered app the provider inserts them when it mounts.
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
The protected public-repository workflow stages each release with provenance
|
|
11
|
-
for a maintainer's npm 2FA approval. The first release uses a short-lived
|
|
12
|
-
stage-only token; later releases use trusted publishing. Before a release is
|
|
13
|
-
approved and verified against the registry, test the reviewed local tarball.
|
|
12
|
+
## Distribution status
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
Stable releases are published on npm's `latest` dist-tag; prereleases use the
|
|
15
|
+
`beta` dist-tag. The protected public-repository workflow stages each release
|
|
16
|
+
with provenance for a maintainer's npm 2FA approval, using trusted publishing.
|
|
16
17
|
|
|
17
18
|
```sh
|
|
18
|
-
npm install @1consent/react
|
|
19
|
+
npm install @1consent/react
|
|
19
20
|
```
|
|
20
21
|
|
|
21
22
|
## Public API
|
|
@@ -23,14 +24,15 @@ npm install @1consent/react@beta
|
|
|
23
24
|
- `OneConsentProvider` embeds the CMP and framework-associated fast path.
|
|
24
25
|
- `OneConsent` gates plain script, iframe, pixel, or other intrinsic markup by
|
|
25
26
|
configured service or category.
|
|
26
|
-
- `useConsent` returns
|
|
27
|
+
- `useConsent(name)` returns whether a service or category currently has
|
|
28
|
+
consent (`false` until consent is known) and reacts to CMP updates.
|
|
27
29
|
- `OneConsentServiceMap` and `OneConsentCategoryMap` are declaration-merging
|
|
28
30
|
targets populated by `1c typegen`.
|
|
29
31
|
|
|
30
|
-
The generated declaration files are included in the package. React is the
|
|
31
|
-
only peer dependency
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
The generated declaration files are included in the package. React 19 is the
|
|
33
|
+
only peer dependency and there are no runtime dependencies: 1Consent workspace
|
|
34
|
+
implementation packages are bundled into the JavaScript artifact instead of
|
|
35
|
+
becoming consumer dependencies.
|
|
34
36
|
|
|
35
37
|
See the 1Consent developer reference for the complete API and integration
|
|
36
38
|
guidance.
|
|
@@ -60,5 +62,5 @@ From this repository's root, pack the reviewed artifact into an existing directo
|
|
|
60
62
|
npm pack ./packages/libs/react --pack-destination /path/to/tarballs
|
|
61
63
|
```
|
|
62
64
|
|
|
63
|
-
Install that tarball in a React 19
|
|
65
|
+
Install that tarball in a React 19 test project. This repository contains the
|
|
64
66
|
reviewed distribution artifacts; it does not contain the private source build.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @1consent/react — client entry provider (1CO-1601)
|
|
3
|
+
*
|
|
4
|
+
* The `react-server` entry exports the hook-free markup provider. This client
|
|
5
|
+
* entry keeps that markup whenever the scripts come from server HTML (server
|
|
6
|
+
* rendering and hydration) and, on a client-only mount, inserts real script
|
|
7
|
+
* elements instead: React never executes a `<script>` it renders on the client.
|
|
8
|
+
*/
|
|
9
|
+
import { type ReactNode } from "react";
|
|
10
|
+
import { type OneConsentProviderProps } from "./provider.js";
|
|
11
|
+
export declare function OneConsentProvider(props: OneConsentProviderProps): ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* context: Next.js (App or Pages Router), Vite SPAs, Remix/React Router,
|
|
6
6
|
* Astro islands. No Next.js-specific APIs are used.
|
|
7
7
|
*/
|
|
8
|
+
export { OneConsentProvider } from "./client-provider.js";
|
|
8
9
|
export type { OneConsentProps } from "./one-consent.js";
|
|
9
10
|
export { OneConsent } from "./one-consent.js";
|
|
10
11
|
export type { OneConsentEnvironment, OneConsentProviderProps } from "./provider.js";
|
|
11
|
-
export { OneConsentProvider } from "./provider.js";
|
|
12
12
|
export type { OneConsentCategoryMap, OneConsentServiceMap, RegisteredCategoryName, RegisteredServiceName, } from "./types.js";
|
|
13
13
|
export { useConsent } from "./use-consent.js";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/client-provider.tsx
|
|
2
|
+
import { useLayoutEffect, useState, useSyncExternalStore } from "react";
|
|
3
|
+
|
|
1
4
|
// ../../contracts/dist/consent-data-governance.js
|
|
2
5
|
var CONSENT_MAX_AGE_DAYS = 390;
|
|
3
6
|
var CONSENT_MAX_AGE_MS = CONSENT_MAX_AGE_DAYS * 24 * 60 * 60 * 1e3;
|
|
@@ -12,42 +15,141 @@ function isConsentExpiryFresh(expiresAt, now = Date.now()) {
|
|
|
12
15
|
return expiresAt >= now && expiresAt <= latestPermittedExpiry;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
// ../../contracts/dist/
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
// ../../contracts/dist/consent-fastpath.js
|
|
19
|
+
var RUNTIME_CONFIG_EVENT = "1consent:config";
|
|
20
|
+
var SERVICE_TEMPLATE_ATTRS = ["data-1c-service", "data-1c-service-tag", "data-1c-tag"];
|
|
21
|
+
var CATEGORY_TEMPLATE_ATTR = "data-1c-category";
|
|
22
|
+
var ONCE_TEMPLATE_ATTR = "data-1c-once";
|
|
23
|
+
function fnv1a36(input) {
|
|
24
|
+
let hash = 2166136261;
|
|
25
|
+
for (let i = 0; i < input.length; i++) {
|
|
26
|
+
hash ^= input.charCodeAt(i);
|
|
27
|
+
hash = hash + ((hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24)) >>> 0;
|
|
28
|
+
}
|
|
29
|
+
return hash.toString(36);
|
|
20
30
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
31
|
+
function writeAlias(map, key, granted) {
|
|
32
|
+
map[key] = key in map ? map[key] === true && granted : granted;
|
|
23
33
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
34
|
+
function buildConsentAliasMaps(services, categories, serviceConsent, categoryConsent) {
|
|
35
|
+
const state = buildConsentAliasState(services, categories, serviceConsent, categoryConsent);
|
|
36
|
+
return { services: state.services, categories: state.categories };
|
|
26
37
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
function buildConsentAliasState(services, categories, serviceConsent, categoryConsent) {
|
|
39
|
+
const serviceAliases = {};
|
|
40
|
+
const memberCounts = /* @__PURE__ */ new Map();
|
|
41
|
+
let nonEssentialGranted = false;
|
|
42
|
+
for (const service of services) {
|
|
43
|
+
const granted = service.essential === true || serviceConsent[service.id] === true;
|
|
44
|
+
if (granted && service.essential !== true)
|
|
45
|
+
nonEssentialGranted = true;
|
|
46
|
+
writeAlias(serviceAliases, service.id, granted);
|
|
47
|
+
if (service.catalogServiceKey) {
|
|
48
|
+
writeAlias(serviceAliases, service.catalogServiceKey, granted);
|
|
49
|
+
}
|
|
50
|
+
if (service.tag)
|
|
51
|
+
writeAlias(serviceAliases, service.tag, granted);
|
|
52
|
+
if (service.name)
|
|
53
|
+
writeAlias(serviceAliases, service.name, granted);
|
|
54
|
+
if (service.categoryId) {
|
|
55
|
+
const counts = memberCounts.get(service.categoryId) ?? { total: 0, granted: 0 };
|
|
56
|
+
counts.total += 1;
|
|
57
|
+
if (granted)
|
|
58
|
+
counts.granted += 1;
|
|
59
|
+
memberCounts.set(service.categoryId, counts);
|
|
60
|
+
}
|
|
35
61
|
}
|
|
62
|
+
const categoryAliases = {};
|
|
63
|
+
for (const category of categories) {
|
|
64
|
+
const counts = memberCounts.get(category.id);
|
|
65
|
+
const derived = counts !== void 0 && counts.total > 0 && counts.granted === counts.total;
|
|
66
|
+
const granted = category.essential === true || categoryConsent[category.id] === true || derived;
|
|
67
|
+
if (granted && category.essential !== true && categoryConsent[category.id] === true) {
|
|
68
|
+
nonEssentialGranted = true;
|
|
69
|
+
}
|
|
70
|
+
writeAlias(categoryAliases, category.id, granted);
|
|
71
|
+
writeAlias(categoryAliases, category.name, granted);
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
services: serviceAliases,
|
|
75
|
+
categories: categoryAliases,
|
|
76
|
+
nonEssentialGranted
|
|
77
|
+
};
|
|
36
78
|
}
|
|
37
|
-
function
|
|
38
|
-
if (
|
|
79
|
+
function hasGpcSignal() {
|
|
80
|
+
if (typeof navigator === "undefined")
|
|
39
81
|
return false;
|
|
40
|
-
|
|
82
|
+
const nav = navigator;
|
|
83
|
+
return nav.globalPrivacyControl === true;
|
|
41
84
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
85
|
+
|
|
86
|
+
// ../react-fastpath/dist/generated/engine-source.js
|
|
87
|
+
var REACT_FASTPATH_SOURCE = '"use strict";(()=>{var $e=/^[A-Za-z0-9_-]{1,64}$/;var He=/^[\\da-f]{8}(-[\\da-f]{4}){3}-[\\da-f]{12}$/i,je=(r,s,y)=>typeof r=="string"&&s.test(r)&&!(y!=null&&y.test(r)),ie=r=>je(r,$e,He);var ze=1440*60*1e3;function Ge(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function ce(r){return Ge(r)&&ie(r.appId)&&ie(r.frameworkId)}var Ke="1consent";function Pe(r){return typeof r=="string"&&/^1consent-wix-[A-Za-z0-9]{1,64}$/.test(r)}function ae(r){var s;return(s=r.browserStorageScope)!=null?s:Ke}function ke(){let r=[],s=!1,y=!1,b,A,F=()=>{var l;if(!(s||y)){for(s=!0;!y&&r.length>0;){let f=r.shift();if(!f)break;if(!f.slot.isConnected||!f.allowed())continue;let i=f.recreate(f.source),u=i.hasAttribute("type")?i.type.trim().toLowerCase():i.getAttribute("language")?`text/${(l=i.getAttribute("language"))==null?void 0:l.trim().toLowerCase()}`:"",M=u===""||/^(?:application|text)\\/(?:x-)?(?:java|ecma)script$/.test(u)||/^text\\/(?:javascript1\\.[0-5]|jscript|livescript)$/.test(u);if(i.src&&M&&!i.hasAttribute("async")&&!i.defer&&!i.noModule){let N=new MutationObserver(()=>{i.isConnected||S()}),S=()=>{b===I&&(I(),s=!1,F())},I=()=>{N.disconnect(),i.removeEventListener("load",S),i.removeEventListener("error",S),b=void 0,A=void 0};b=I,A=()=>{(!i.isConnected||!f.allowed())&&(I(),s=!1)},i.addEventListener("load",S),i.addEventListener("error",S),N.observe(f.slot.ownerDocument,{childList:!0,subtree:!0}),f.slot.replaceWith(i),i.isConnected||S();return}f.slot.replaceWith(i)}s=!1}};return{activate(l,f,i,u){let M=Array.from(l.querySelectorAll("script"),S=>{let I=document.createComment("1c-script");return S.replaceWith(I),{source:S,slot:I,allowed:i,recreate:u}}),N=!s;s=!0,r.push(...M);try{f(l)}finally{N&&(s=!1),F()}},setPaused(l){y=l},recheck(){if(!y){A==null||A();for(let l=r.length-1;l>=0;l--){let f=r[l];f&&(!f.slot.isConnected||!f.allowed())&&r.splice(l,1)}}},flush:F,clear(){r.length=0,b==null||b(),s=!1}}}(()=>{var Te,Ce,we,Oe,Ne,Re,xe;let r=window,s=document,y=["data-1c-service","data-1c-service-tag","data-1c-tag"],b="data-1c-category",A="data-1c-resolved",F="data-1c-once",l="1consent:config",f=33696e6,i=y.concat(b).map(e=>`template[${e}]:not([${A}])`).join(","),u=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),M=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)},N=e=>{var o,c;let t=((o=e.services)!=null?o:[]).map(d=>{var g,p,V;return`${d.id}\\0${(g=d.name)!=null?g:""}\\0${(p=d.tag)!=null?p:""}\\0${(V=d.categoryId)!=null?V:""}\\0${d.essential?1:0}${d.catalogServiceKey?`\\0k\\0${d.catalogServiceKey}`:""}${d.usSensitive?"\\x001":""}`}).sort(),n=((c=e.categories)!=null?c:[]).map(d=>`${d.id}\\0${d.name}\\0${d.essential?1:0}`).sort();return M(`s:${t.join("")}|c:${n.join("")}`)},S=((Te=s.currentScript)==null?void 0:Te.getAttribute("data-1c-app-id"))||"",I=((Ce=s.currentScript)==null?void 0:Ce.getAttribute("data-1c-framework-versions"))||"{}",z={};try{z=JSON.parse(I)}catch{}let a=r.__1CONSENT_CONFIG__,$=a==null?void 0:a.publicIdentity,q=(we=a==null?void 0:a.consentEpoch)!=null?we:0,R=a==null?void 0:a.framework.type,x=a==null?void 0:a.machine,B=(Oe=a==null?void 0:a.languages)==null?void 0:Oe.primary,w=a!==void 0&&(a.browserStorageScope===void 0||Pe(a.browserStorageScope))&&ce($)&&$.appId===S&&(R==="gdpr"||R==="tcf"||R==="us")&&(x==="P"||x==="S"||x==="D")&&typeof B=="string"&&B.length>0&&Number.isSafeInteger(q)&&q>=0,m=w?a:void 0,P=(Ne=m==null?void 0:m.appId)!=null?Ne:"",k=(Re=m==null?void 0:m.framework.id)!=null?Re:"",H=w&&R!=null?R:"",j=w&&x!=null?x:"",G=w&&B!=null?B:"",ue=w?$.appId:"",Y=w?$.frameworkId:"",de=u(z)?z[Y]:void 0,v=typeof de=="string"?de:"",O=w?q:-1,J=ae(m!=null?m:{}),pe=JSON.stringify([J,P,k,ue,Y,H,j,G,v,O]),X=!1,Z=!1,Q,ee,te,fe=!1,le=()=>{var e,t;try{let n=r.__1CONSENT_CONFIG__;return X||Z||!n||P.length===0||k.length===0||O<0||n.appId!==P||ae(n)!==J||n.framework.id!==k||!ce(n.publicIdentity)||n.publicIdentity.appId!==ue||n.publicIdentity.frameworkId!==Y||n.framework.type!==H||n.machine!==j||((e=n.languages)==null?void 0:e.primary)!==G||((t=n.consentEpoch)!=null?t:0)!==O||v.length===0?!1:((n!==Q||n.services!==ee||n.categories!==te)&&(Q=n,ee=n.services,te=n.categories,fe=N(n)===v),fe)}catch{return!1}},h=r.__1CONSENT_REACT_FASTPATH__;if(h){try{if(h.runtimeKey===pe&&h.supportsPendingConsent===!0&&typeof h.updateConsent=="function"&&typeof h.promote=="function"&&le()&&typeof h.reconcile=="function"&&h.reconcile())return}catch{}try{typeof h.destroy=="function"&&h.destroy()}catch{}r.__1CONSENT_REACT_FASTPATH__===h&&delete r.__1CONSENT_REACT_FASTPATH__}let _=null,E=null,L,me=!1,T,D=ke(),K,ne=()=>{},C=()=>X||Z?!1:le()?!0:(Z=!0,D.clear(),_=null,E=null,T==null||T.disconnect(),ne(),r.__1CONSENT_REACT_FASTPATH__===K&&delete r.__1CONSENT_REACT_FASTPATH__,!1),ge=new Set,ye=e=>{if(!e||typeof e!="object")return!1;for(let t of Object.values(e))if(typeof t!="boolean")return!1;return!0},ve=()=>navigator.globalPrivacyControl===!0;try{let e=localStorage.getItem(J);if(e&&P&&k&&v&&O>=0){let t=Date.now(),n=t+f,o=JSON.parse(e),c=u(o)&&u(o.apps)?o.apps[P]:void 0,d=u(c)?c.frameworks:void 0,g=u(d)?d[k]:void 0,p=u(g)?g.fastPath:void 0,V=u(g)?g.consent:void 0,se=u(g)&&"consentEpoch"in g?g.consentEpoch:0,Me=u(g)&&g.type===H&&g.machine===j&&typeof se=="number"&&Number.isSafeInteger(se)&&se>=O&&g.primaryLanguage===G,W=(m==null?void 0:m.framework.type)==="tcf"?(xe=r.__1cTcf)==null?void 0:xe.tcData:void 0,Be=(m==null?void 0:m.framework.type)!=="tcf"||u(V)&&typeof V.tcString=="string"&&(W==null?void 0:W.eventStatus)==="tcloaded"&&W.tcString===V.tcString;u(o)&&o.schemaVersion===1&&Me&&u(p)&&p.structuralVersion===v&&typeof p.consentEpoch=="number"&&Number.isSafeInteger(p.consentEpoch)&&p.consentEpoch>=O&&Number.isSafeInteger(t)&&t>=0&&Number.isSafeInteger(n)&&typeof p.expiresAt=="number"&&Number.isSafeInteger(p.expiresAt)&&p.expiresAt>=t&&p.expiresAt<=n&&ye(p.services)&&Be&&!(p.gpcRevocable===!0&&ve())&&(L=p.expiresAt,_=p.services,E=ye(p.categories)?p.categories:{})}}catch{}let Le=e=>{for(let t of y){let n=e.getAttribute(t);if(n!==null)return n}return e.getAttribute(b)},Se=e=>{if(me||L!==void 0&&Date.now()>L)return!1;for(let n of y){let o=e.getAttribute(n);if(o!==null)return _!==null&&_[o]===!0}let t=e.getAttribute(b);return t!==null?E!==null&&E[t]===!0:!1},De=e=>{let t=s.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},U=e=>{if(!C()||e.hasAttribute(A)||!Se(e))return!1;e.setAttribute(A,"");let t=e.getAttribute(F);if(t!==null){if(ge.has(t))return!1;ge.add(t)}let n=e.content.cloneNode(!0);return n instanceof DocumentFragment?(D.activate(n,o=>e.after(o),()=>e.isConnected&&C()&&Se(e),De),!0):!1},re=e=>e instanceof HTMLTemplateElement,_e=8,Ve=()=>new Promise(e=>{let t=r.scheduler;t!=null&&t.postTask?t.postTask(e,{priority:"user-visible"}):setTimeout(e,0)}),oe=e=>{if(!C())return[];let t=[];for(let c of e.querySelectorAll(i))re(c)&&t.push(c);let n=[],o=0;for(;o<t.length&&o<_e;o++){let c=t[o];if(c&&U(c)){let d=Le(c);d!==null&&n.push(d)}}return o<t.length&&(async()=>{for(;o<t.length;o++){o%_e===0&&await Ve();let c=t[o];if(c)try{U(c)}catch{}}})(),n},Ee=!1,be=()=>C()?s.readyState!=="loading"?oe(s):(Ee||(Ee=!0,s.addEventListener("DOMContentLoaded",()=>oe(s),{once:!0})),[]):[];T=new MutationObserver(e=>{if(!(!C()||s.readyState==="loading"||_===null&&E===null))for(let t of e)for(let n of t.addedNodes)re(n)?U(n):n instanceof Element&&oe(n)}),T.observe(s.documentElement,{childList:!0,subtree:!0});let he=()=>{Q=void 0,ee=void 0,te=void 0,C()},Fe=()=>{X=!0,D.clear(),_=null,E=null,T==null||T.disconnect(),ne(),r.__1CONSENT_REACT_FASTPATH__===K&&delete r.__1CONSENT_REACT_FASTPATH__},Ae=(e,t,n,o=!1)=>{if(C()){me=o,D.setPaused(o),L!==void 0&&Date.now()>L&&(_=null,E=null),n!==void 0&&(L=n===0?void 0:n),_=_||{},E=E||{};for(let c of Object.keys(e))_[c]=e[c]===!0;if(t)for(let c of Object.keys(t))E[c]=t[c]===!0;D.recheck()}},Ie=()=>(D.flush(),be());K={appId:P,frameworkId:k,frameworkType:H,machine:j,primaryLanguage:G,structuralVersion:v,consentEpoch:O,runtimeKey:pe,apply(e,t){return Ae(e,t),Ie()},supportsPendingConsent:!0,updateConsent:Ae,promote:Ie,resolve(e){return e!==null&&re(e)?U(e):!1},reconcile:C,destroy:Fe},r.__1CONSENT_REACT_FASTPATH__=K,r.addEventListener(l,he),ne=()=>r.removeEventListener(l,he),(_!==null||E!==null)&&be()})();})();';
|
|
88
|
+
|
|
89
|
+
// src/client-scripts.ts
|
|
90
|
+
function setNonce(script, nonce) {
|
|
91
|
+
if (nonce) script.nonce = nonce;
|
|
92
|
+
}
|
|
93
|
+
function findLoader(cmpSrc) {
|
|
94
|
+
const target = new URL(cmpSrc, document.baseURI);
|
|
95
|
+
for (const script of document.scripts) {
|
|
96
|
+
if (!script.src) continue;
|
|
97
|
+
const source = new URL(script.src);
|
|
98
|
+
if (source.origin === target.origin && source.pathname === target.pathname) return script;
|
|
99
|
+
}
|
|
100
|
+
return void 0;
|
|
101
|
+
}
|
|
102
|
+
function insertEngine({ appId, frameworkVersions, nonce }) {
|
|
103
|
+
const script = document.createElement("script");
|
|
104
|
+
script.setAttribute("data-1c-react-fastpath", "");
|
|
105
|
+
script.setAttribute("data-1c-app-id", appId);
|
|
106
|
+
script.setAttribute("data-1c-framework-versions", frameworkVersions);
|
|
107
|
+
setNonce(script, nonce);
|
|
108
|
+
script.text = REACT_FASTPATH_SOURCE;
|
|
109
|
+
document.head.appendChild(script);
|
|
110
|
+
script.remove();
|
|
111
|
+
}
|
|
112
|
+
function mountClientScripts(options) {
|
|
113
|
+
try {
|
|
114
|
+
return startClientScripts(options);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
console.error("[1Consent] OneConsentProvider could not load the CMP.", error);
|
|
117
|
+
return () => void 0;
|
|
118
|
+
}
|
|
46
119
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
120
|
+
function startClientScripts(options) {
|
|
121
|
+
const win = window;
|
|
122
|
+
if (win.__1CONSENT_CONFIG__ !== void 0) {
|
|
123
|
+
insertEngine(options);
|
|
124
|
+
return () => void 0;
|
|
125
|
+
}
|
|
126
|
+
const { cmpSrc, nonce } = options;
|
|
127
|
+
let loader = cmpSrc === void 0 ? void 0 : findLoader(cmpSrc);
|
|
128
|
+
const stop = () => {
|
|
129
|
+
window.removeEventListener(RUNTIME_CONFIG_EVENT, start);
|
|
130
|
+
loader?.removeEventListener("load", start);
|
|
131
|
+
};
|
|
132
|
+
function start() {
|
|
133
|
+
if (win.__1CONSENT_CONFIG__ === void 0) return;
|
|
134
|
+
stop();
|
|
135
|
+
try {
|
|
136
|
+
insertEngine(options);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error(
|
|
139
|
+
"[1Consent] OneConsentProvider could not start the consent engine.",
|
|
140
|
+
error
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
window.addEventListener(RUNTIME_CONFIG_EVENT, start);
|
|
145
|
+
if (cmpSrc !== void 0 && loader === void 0) {
|
|
146
|
+
loader = document.createElement("script");
|
|
147
|
+
loader.src = cmpSrc;
|
|
148
|
+
setNonce(loader, nonce);
|
|
149
|
+
document.head.appendChild(loader);
|
|
150
|
+
}
|
|
151
|
+
loader?.addEventListener("load", start);
|
|
152
|
+
return stop;
|
|
51
153
|
}
|
|
52
154
|
|
|
53
155
|
// ../../shared/dist/public-package-urls.js
|
|
@@ -109,71 +211,113 @@ function getCmpScriptUrl(appId, opts = {}) {
|
|
|
109
211
|
return opts.frameworkId ? `${base}?frameworkId=${opts.frameworkId}` : base;
|
|
110
212
|
}
|
|
111
213
|
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
214
|
+
// src/provider.tsx
|
|
215
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
216
|
+
function resolveEnvAppId() {
|
|
217
|
+
if (typeof process === "undefined" || !process?.env) return void 0;
|
|
218
|
+
return process.env.NEXT_PUBLIC_1CONSENT_APP_ID;
|
|
219
|
+
}
|
|
220
|
+
function resolveProviderSources({
|
|
221
|
+
appId,
|
|
222
|
+
fastPathVersions,
|
|
223
|
+
cmpSrc,
|
|
224
|
+
// Auto-detection maps a customer's NODE_ENV=development to 1Consent's
|
|
225
|
+
// internal "local" zone (unreachable outside our stack) — default to
|
|
226
|
+
// production and let internal setups override explicitly.
|
|
227
|
+
environment = "production",
|
|
228
|
+
loadCmp = true
|
|
229
|
+
}) {
|
|
230
|
+
const resolvedAppId = appId ?? resolveEnvAppId();
|
|
231
|
+
const resolvedCmpSrc = cmpSrc ?? (resolvedAppId !== void 0 ? getCmpScriptUrl(resolvedAppId, { env: environment }) : void 0);
|
|
232
|
+
if (loadCmp && resolvedCmpSrc === void 0) {
|
|
233
|
+
throw new Error(
|
|
234
|
+
"[1Consent] Missing App ID: pass the `appId` prop to <OneConsentProvider> or set the NEXT_PUBLIC_1CONSENT_APP_ID environment variable."
|
|
235
|
+
);
|
|
121
236
|
}
|
|
122
|
-
return
|
|
237
|
+
return {
|
|
238
|
+
appId: resolvedAppId ?? "",
|
|
239
|
+
cmpSrc: loadCmp ? resolvedCmpSrc : void 0,
|
|
240
|
+
frameworkVersions: JSON.stringify(fastPathVersions ?? {})
|
|
241
|
+
};
|
|
123
242
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
243
|
+
function OneConsentProvider(props) {
|
|
244
|
+
const { appId, cmpSrc, frameworkVersions } = resolveProviderSources(props);
|
|
245
|
+
const { nonce, children } = props;
|
|
246
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
247
|
+
cmpSrc !== void 0 && /* @__PURE__ */ jsx("script", { src: cmpSrc, nonce }),
|
|
248
|
+
/* @__PURE__ */ jsx(
|
|
249
|
+
"script",
|
|
250
|
+
{
|
|
251
|
+
"data-1c-react-fastpath": "",
|
|
252
|
+
"data-1c-app-id": appId,
|
|
253
|
+
"data-1c-framework-versions": frameworkVersions,
|
|
254
|
+
nonce,
|
|
255
|
+
children: REACT_FASTPATH_SOURCE
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
children
|
|
259
|
+
] });
|
|
126
260
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
261
|
+
|
|
262
|
+
// src/client-provider.tsx
|
|
263
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
264
|
+
var subscribeNever = () => () => void 0;
|
|
265
|
+
function OneConsentProvider2(props) {
|
|
266
|
+
const rendering = useSyncExternalStore(
|
|
267
|
+
subscribeNever,
|
|
268
|
+
() => "client",
|
|
269
|
+
() => "server-html"
|
|
270
|
+
);
|
|
271
|
+
const [scriptsFrom] = useState(rendering);
|
|
272
|
+
const { appId, cmpSrc, frameworkVersions } = resolveProviderSources(props);
|
|
273
|
+
const { nonce } = props;
|
|
274
|
+
useLayoutEffect(() => {
|
|
275
|
+
if (scriptsFrom === "server-html") return;
|
|
276
|
+
return mountClientScripts({ appId, cmpSrc, frameworkVersions, nonce });
|
|
277
|
+
}, [scriptsFrom, appId, cmpSrc, frameworkVersions, nonce]);
|
|
278
|
+
if (scriptsFrom === "server-html") return /* @__PURE__ */ jsx2(OneConsentProvider, { ...props });
|
|
279
|
+
return props.children;
|
|
130
280
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const categoryAliases = {};
|
|
156
|
-
for (const category of categories) {
|
|
157
|
-
const counts = memberCounts.get(category.id);
|
|
158
|
-
const derived = counts !== void 0 && counts.total > 0 && counts.granted === counts.total;
|
|
159
|
-
const granted = category.essential === true || categoryConsent[category.id] === true || derived;
|
|
160
|
-
if (granted && category.essential !== true && categoryConsent[category.id] === true) {
|
|
161
|
-
nonEssentialGranted = true;
|
|
162
|
-
}
|
|
163
|
-
writeAlias(categoryAliases, category.id, granted);
|
|
164
|
-
writeAlias(categoryAliases, category.name, granted);
|
|
281
|
+
|
|
282
|
+
// ../../contracts/dist/browser-storage.js
|
|
283
|
+
var BROWSER_STORAGE_KEY = "1consent";
|
|
284
|
+
function browserStorageKey(config) {
|
|
285
|
+
return config.browserStorageScope ?? BROWSER_STORAGE_KEY;
|
|
286
|
+
}
|
|
287
|
+
var BROWSER_STORAGE_SCHEMA_VERSION = 1;
|
|
288
|
+
function emptyBrowserStore() {
|
|
289
|
+
return { schemaVersion: BROWSER_STORAGE_SCHEMA_VERSION, apps: {} };
|
|
290
|
+
}
|
|
291
|
+
function isRecord(value) {
|
|
292
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
293
|
+
}
|
|
294
|
+
function isOneConsentBrowserStore(value) {
|
|
295
|
+
return isRecord(value) && value.schemaVersion === BROWSER_STORAGE_SCHEMA_VERSION && isRecord(value.apps);
|
|
296
|
+
}
|
|
297
|
+
function parseBrowserStore(raw) {
|
|
298
|
+
if (!raw)
|
|
299
|
+
return emptyBrowserStore();
|
|
300
|
+
try {
|
|
301
|
+
const value = JSON.parse(raw);
|
|
302
|
+
return isOneConsentBrowserStore(value) ? value : emptyBrowserStore();
|
|
303
|
+
} catch {
|
|
304
|
+
return emptyBrowserStore();
|
|
165
305
|
}
|
|
166
|
-
return {
|
|
167
|
-
services: serviceAliases,
|
|
168
|
-
categories: categoryAliases,
|
|
169
|
-
nonEssentialGranted
|
|
170
|
-
};
|
|
171
306
|
}
|
|
172
|
-
function
|
|
173
|
-
if (
|
|
307
|
+
function isBooleanRecord(value) {
|
|
308
|
+
if (!isRecord(value))
|
|
174
309
|
return false;
|
|
175
|
-
|
|
176
|
-
|
|
310
|
+
return Object.values(value).every((entry) => typeof entry === "boolean");
|
|
311
|
+
}
|
|
312
|
+
function isBrowserFastPathState(value) {
|
|
313
|
+
if (!isRecord(value))
|
|
314
|
+
return false;
|
|
315
|
+
return typeof value.structuralVersion === "string" && typeof value.consentEpoch === "number" && Number.isSafeInteger(value.consentEpoch) && value.consentEpoch >= 0 && typeof value.expiresAt === "number" && Number.isSafeInteger(value.expiresAt) && value.expiresAt >= 0 && isBooleanRecord(value.services) && isBooleanRecord(value.categories) && (value.decisionIntegrity === void 0 || typeof value.decisionIntegrity === "string") && (value.tcfCmpId === void 0 || typeof value.tcfCmpId === "number" && Number.isSafeInteger(value.tcfCmpId) && value.tcfCmpId >= 0 && value.tcfCmpId <= 4095) && (value.tcfValidationVersion === void 0 || typeof value.tcfValidationVersion === "number" && Number.isSafeInteger(value.tcfValidationVersion) && value.tcfValidationVersion > 0) && (value.tcfDisclosedVendorKey === void 0 || typeof value.tcfDisclosedVendorKey === "string" && /^(?:[1-9]\d*(?:,[1-9]\d*)*)?$/.test(value.tcfDisclosedVendorKey)) && (value.tcfApiDataIntegrity === void 0 || typeof value.tcfApiDataIntegrity === "string") && (value.gpcRevocable === void 0 || value.gpcRevocable === true) && (value.posture === void 0 || value.posture === true);
|
|
316
|
+
}
|
|
317
|
+
function isFreshBrowserFastPathState(value, now = Date.now()) {
|
|
318
|
+
if (!isBrowserFastPathState(value))
|
|
319
|
+
return false;
|
|
320
|
+
return isConsentExpiryFresh(value.expiresAt, now);
|
|
177
321
|
}
|
|
178
322
|
|
|
179
323
|
// src/serialize.ts
|
|
@@ -334,7 +478,7 @@ function serializeChildren(children) {
|
|
|
334
478
|
}
|
|
335
479
|
|
|
336
480
|
// src/one-consent.tsx
|
|
337
|
-
import { jsx } from "react/jsx-runtime";
|
|
481
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
338
482
|
var SERVICE_ATTR = SERVICE_TEMPLATE_ATTRS[0] ?? "data-1c-service";
|
|
339
483
|
function OneConsent(props) {
|
|
340
484
|
const { nonce, children } = props;
|
|
@@ -354,7 +498,7 @@ function OneConsent(props) {
|
|
|
354
498
|
const onceAttr = props.once ? ` ${ONCE_TEMPLATE_ATTR}="${fnv1a36(`${attr}=${key}|${content}`)}"` : "";
|
|
355
499
|
const nonceAttr = nonce ? ` nonce="${escapeAttribute(nonce)}"` : "";
|
|
356
500
|
const html = `<template ${attr}="${escapeAttribute(key)}"${onceAttr}>${content}</template><script${nonceAttr}>window.__1CONSENT_REACT_FASTPATH__&&window.__1CONSENT_REACT_FASTPATH__.resolve(document.currentScript.previousElementSibling);</script>`;
|
|
357
|
-
return /* @__PURE__ */
|
|
501
|
+
return /* @__PURE__ */ jsx3(
|
|
358
502
|
"div",
|
|
359
503
|
{
|
|
360
504
|
"data-1c-slot": "",
|
|
@@ -365,52 +509,8 @@ function OneConsent(props) {
|
|
|
365
509
|
);
|
|
366
510
|
}
|
|
367
511
|
|
|
368
|
-
// ../react-fastpath/dist/generated/engine-source.js
|
|
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
|
-
|
|
371
|
-
// src/provider.tsx
|
|
372
|
-
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
373
|
-
function resolveEnvAppId() {
|
|
374
|
-
if (typeof process === "undefined" || !process?.env) return void 0;
|
|
375
|
-
return process.env.NEXT_PUBLIC_1CONSENT_APP_ID;
|
|
376
|
-
}
|
|
377
|
-
function OneConsentProvider({
|
|
378
|
-
appId,
|
|
379
|
-
fastPathVersions,
|
|
380
|
-
nonce,
|
|
381
|
-
cmpSrc,
|
|
382
|
-
// Auto-detection maps a customer's NODE_ENV=development to 1Consent's
|
|
383
|
-
// internal "local" zone (unreachable outside our stack) — default to
|
|
384
|
-
// production and let internal setups override explicitly.
|
|
385
|
-
environment = "production",
|
|
386
|
-
loadCmp = true,
|
|
387
|
-
children
|
|
388
|
-
}) {
|
|
389
|
-
const resolvedAppId = appId ?? resolveEnvAppId();
|
|
390
|
-
const resolvedCmpSrc = cmpSrc ?? (resolvedAppId !== void 0 ? getCmpScriptUrl(resolvedAppId, { env: environment }) : void 0);
|
|
391
|
-
if (loadCmp && resolvedCmpSrc === void 0) {
|
|
392
|
-
throw new Error(
|
|
393
|
-
"[1Consent] Missing App ID: pass the `appId` prop to <OneConsentProvider> or set the NEXT_PUBLIC_1CONSENT_APP_ID environment variable."
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
397
|
-
loadCmp && resolvedCmpSrc !== void 0 && /* @__PURE__ */ jsx2("script", { src: resolvedCmpSrc, nonce }),
|
|
398
|
-
/* @__PURE__ */ jsx2(
|
|
399
|
-
"script",
|
|
400
|
-
{
|
|
401
|
-
"data-1c-react-fastpath": "",
|
|
402
|
-
"data-1c-app-id": resolvedAppId ?? "",
|
|
403
|
-
"data-1c-framework-versions": JSON.stringify(fastPathVersions ?? {}),
|
|
404
|
-
nonce,
|
|
405
|
-
dangerouslySetInnerHTML: { __html: REACT_FASTPATH_SOURCE }
|
|
406
|
-
}
|
|
407
|
-
),
|
|
408
|
-
children
|
|
409
|
-
] });
|
|
410
|
-
}
|
|
411
|
-
|
|
412
512
|
// src/use-consent.ts
|
|
413
|
-
import { useEffect, useState } from "react";
|
|
513
|
+
import { useEffect, useState as useState2 } from "react";
|
|
414
514
|
function readMirrorConsent(key) {
|
|
415
515
|
try {
|
|
416
516
|
const api = window.__1CONSENT_REACT_FASTPATH__;
|
|
@@ -422,7 +522,7 @@ function readMirrorConsent(key) {
|
|
|
422
522
|
if (!config || config.appId !== api.appId || config.framework.id !== api.frameworkId || !Number.isSafeInteger(liveEpoch) || liveEpoch < 0 || liveEpoch !== api.consentEpoch || config.languages.primary.length === 0) {
|
|
423
523
|
return false;
|
|
424
524
|
}
|
|
425
|
-
const root = parseBrowserStore(localStorage.getItem(
|
|
525
|
+
const root = parseBrowserStore(localStorage.getItem(browserStorageKey(config)));
|
|
426
526
|
const framework = root.apps[api.appId]?.frameworks[api.frameworkId];
|
|
427
527
|
if (!framework || framework.type !== config.framework.type || framework.machine !== config.machine || (framework.consentEpoch ?? 0) < liveEpoch || framework.primaryLanguage !== config.languages.primary) {
|
|
428
528
|
return false;
|
|
@@ -521,7 +621,7 @@ function whenBusAvailable(listener) {
|
|
|
521
621
|
};
|
|
522
622
|
}
|
|
523
623
|
function useConsent(key) {
|
|
524
|
-
const [granted, setGranted] =
|
|
624
|
+
const [granted, setGranted] = useState2(false);
|
|
525
625
|
useEffect(() => {
|
|
526
626
|
setGranted(readMirrorConsent(key));
|
|
527
627
|
let disposed = false;
|
|
@@ -554,6 +654,6 @@ function useConsent(key) {
|
|
|
554
654
|
}
|
|
555
655
|
export {
|
|
556
656
|
OneConsent,
|
|
557
|
-
OneConsentProvider,
|
|
657
|
+
OneConsentProvider2 as OneConsentProvider,
|
|
558
658
|
useConsent
|
|
559
659
|
};
|
package/dist/provider.d.ts
CHANGED
|
@@ -40,4 +40,20 @@ export interface OneConsentProviderProps {
|
|
|
40
40
|
loadCmp?: boolean;
|
|
41
41
|
children?: ReactNode;
|
|
42
42
|
}
|
|
43
|
-
export
|
|
43
|
+
export interface ProviderSources {
|
|
44
|
+
/** Resolved app id ("" when unresolved: the fast path stays cold). */
|
|
45
|
+
appId: string;
|
|
46
|
+
/** CMP embed URL, or undefined when `loadCmp` is false. */
|
|
47
|
+
cmpSrc: string | undefined;
|
|
48
|
+
/** JSON of the framework-associated build stamps. */
|
|
49
|
+
frameworkVersions: string;
|
|
50
|
+
}
|
|
51
|
+
/** Resolve what the provider loads; throws when the CMP embed has no app id. */
|
|
52
|
+
export declare function resolveProviderSources({ appId, fastPathVersions, cmpSrc, environment, loadCmp, }: OneConsentProviderProps): ProviderSources;
|
|
53
|
+
/**
|
|
54
|
+
* Server-rendered provider markup. The browser runs these scripts only when
|
|
55
|
+
* they arrive in the HTML; React never executes a `<script>` it renders on the
|
|
56
|
+
* client, so the client entry (`client-provider.tsx`) inserts them itself on a
|
|
57
|
+
* client-only mount.
|
|
58
|
+
*/
|
|
59
|
+
export declare function OneConsentProvider(props: OneConsentProviderProps): import("react").JSX.Element;
|
package/dist/react-server.js
CHANGED
|
@@ -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";(()=>{var He=1440*60*1e3;function
|
|
263
|
+
var REACT_FASTPATH_SOURCE = '"use strict";(()=>{var $e=/^[A-Za-z0-9_-]{1,64}$/;var He=/^[\\da-f]{8}(-[\\da-f]{4}){3}-[\\da-f]{12}$/i,je=(r,s,y)=>typeof r=="string"&&s.test(r)&&!(y!=null&&y.test(r)),ie=r=>je(r,$e,He);var ze=1440*60*1e3;function Ge(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function ce(r){return Ge(r)&&ie(r.appId)&&ie(r.frameworkId)}var Ke="1consent";function Pe(r){return typeof r=="string"&&/^1consent-wix-[A-Za-z0-9]{1,64}$/.test(r)}function ae(r){var s;return(s=r.browserStorageScope)!=null?s:Ke}function ke(){let r=[],s=!1,y=!1,b,A,F=()=>{var l;if(!(s||y)){for(s=!0;!y&&r.length>0;){let f=r.shift();if(!f)break;if(!f.slot.isConnected||!f.allowed())continue;let i=f.recreate(f.source),u=i.hasAttribute("type")?i.type.trim().toLowerCase():i.getAttribute("language")?`text/${(l=i.getAttribute("language"))==null?void 0:l.trim().toLowerCase()}`:"",M=u===""||/^(?:application|text)\\/(?:x-)?(?:java|ecma)script$/.test(u)||/^text\\/(?:javascript1\\.[0-5]|jscript|livescript)$/.test(u);if(i.src&&M&&!i.hasAttribute("async")&&!i.defer&&!i.noModule){let N=new MutationObserver(()=>{i.isConnected||S()}),S=()=>{b===I&&(I(),s=!1,F())},I=()=>{N.disconnect(),i.removeEventListener("load",S),i.removeEventListener("error",S),b=void 0,A=void 0};b=I,A=()=>{(!i.isConnected||!f.allowed())&&(I(),s=!1)},i.addEventListener("load",S),i.addEventListener("error",S),N.observe(f.slot.ownerDocument,{childList:!0,subtree:!0}),f.slot.replaceWith(i),i.isConnected||S();return}f.slot.replaceWith(i)}s=!1}};return{activate(l,f,i,u){let M=Array.from(l.querySelectorAll("script"),S=>{let I=document.createComment("1c-script");return S.replaceWith(I),{source:S,slot:I,allowed:i,recreate:u}}),N=!s;s=!0,r.push(...M);try{f(l)}finally{N&&(s=!1),F()}},setPaused(l){y=l},recheck(){if(!y){A==null||A();for(let l=r.length-1;l>=0;l--){let f=r[l];f&&(!f.slot.isConnected||!f.allowed())&&r.splice(l,1)}}},flush:F,clear(){r.length=0,b==null||b(),s=!1}}}(()=>{var Te,Ce,we,Oe,Ne,Re,xe;let r=window,s=document,y=["data-1c-service","data-1c-service-tag","data-1c-tag"],b="data-1c-category",A="data-1c-resolved",F="data-1c-once",l="1consent:config",f=33696e6,i=y.concat(b).map(e=>`template[${e}]:not([${A}])`).join(","),u=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),M=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)},N=e=>{var o,c;let t=((o=e.services)!=null?o:[]).map(d=>{var g,p,V;return`${d.id}\\0${(g=d.name)!=null?g:""}\\0${(p=d.tag)!=null?p:""}\\0${(V=d.categoryId)!=null?V:""}\\0${d.essential?1:0}${d.catalogServiceKey?`\\0k\\0${d.catalogServiceKey}`:""}${d.usSensitive?"\\x001":""}`}).sort(),n=((c=e.categories)!=null?c:[]).map(d=>`${d.id}\\0${d.name}\\0${d.essential?1:0}`).sort();return M(`s:${t.join("")}|c:${n.join("")}`)},S=((Te=s.currentScript)==null?void 0:Te.getAttribute("data-1c-app-id"))||"",I=((Ce=s.currentScript)==null?void 0:Ce.getAttribute("data-1c-framework-versions"))||"{}",z={};try{z=JSON.parse(I)}catch{}let a=r.__1CONSENT_CONFIG__,$=a==null?void 0:a.publicIdentity,q=(we=a==null?void 0:a.consentEpoch)!=null?we:0,R=a==null?void 0:a.framework.type,x=a==null?void 0:a.machine,B=(Oe=a==null?void 0:a.languages)==null?void 0:Oe.primary,w=a!==void 0&&(a.browserStorageScope===void 0||Pe(a.browserStorageScope))&&ce($)&&$.appId===S&&(R==="gdpr"||R==="tcf"||R==="us")&&(x==="P"||x==="S"||x==="D")&&typeof B=="string"&&B.length>0&&Number.isSafeInteger(q)&&q>=0,m=w?a:void 0,P=(Ne=m==null?void 0:m.appId)!=null?Ne:"",k=(Re=m==null?void 0:m.framework.id)!=null?Re:"",H=w&&R!=null?R:"",j=w&&x!=null?x:"",G=w&&B!=null?B:"",ue=w?$.appId:"",Y=w?$.frameworkId:"",de=u(z)?z[Y]:void 0,v=typeof de=="string"?de:"",O=w?q:-1,J=ae(m!=null?m:{}),pe=JSON.stringify([J,P,k,ue,Y,H,j,G,v,O]),X=!1,Z=!1,Q,ee,te,fe=!1,le=()=>{var e,t;try{let n=r.__1CONSENT_CONFIG__;return X||Z||!n||P.length===0||k.length===0||O<0||n.appId!==P||ae(n)!==J||n.framework.id!==k||!ce(n.publicIdentity)||n.publicIdentity.appId!==ue||n.publicIdentity.frameworkId!==Y||n.framework.type!==H||n.machine!==j||((e=n.languages)==null?void 0:e.primary)!==G||((t=n.consentEpoch)!=null?t:0)!==O||v.length===0?!1:((n!==Q||n.services!==ee||n.categories!==te)&&(Q=n,ee=n.services,te=n.categories,fe=N(n)===v),fe)}catch{return!1}},h=r.__1CONSENT_REACT_FASTPATH__;if(h){try{if(h.runtimeKey===pe&&h.supportsPendingConsent===!0&&typeof h.updateConsent=="function"&&typeof h.promote=="function"&&le()&&typeof h.reconcile=="function"&&h.reconcile())return}catch{}try{typeof h.destroy=="function"&&h.destroy()}catch{}r.__1CONSENT_REACT_FASTPATH__===h&&delete r.__1CONSENT_REACT_FASTPATH__}let _=null,E=null,L,me=!1,T,D=ke(),K,ne=()=>{},C=()=>X||Z?!1:le()?!0:(Z=!0,D.clear(),_=null,E=null,T==null||T.disconnect(),ne(),r.__1CONSENT_REACT_FASTPATH__===K&&delete r.__1CONSENT_REACT_FASTPATH__,!1),ge=new Set,ye=e=>{if(!e||typeof e!="object")return!1;for(let t of Object.values(e))if(typeof t!="boolean")return!1;return!0},ve=()=>navigator.globalPrivacyControl===!0;try{let e=localStorage.getItem(J);if(e&&P&&k&&v&&O>=0){let t=Date.now(),n=t+f,o=JSON.parse(e),c=u(o)&&u(o.apps)?o.apps[P]:void 0,d=u(c)?c.frameworks:void 0,g=u(d)?d[k]:void 0,p=u(g)?g.fastPath:void 0,V=u(g)?g.consent:void 0,se=u(g)&&"consentEpoch"in g?g.consentEpoch:0,Me=u(g)&&g.type===H&&g.machine===j&&typeof se=="number"&&Number.isSafeInteger(se)&&se>=O&&g.primaryLanguage===G,W=(m==null?void 0:m.framework.type)==="tcf"?(xe=r.__1cTcf)==null?void 0:xe.tcData:void 0,Be=(m==null?void 0:m.framework.type)!=="tcf"||u(V)&&typeof V.tcString=="string"&&(W==null?void 0:W.eventStatus)==="tcloaded"&&W.tcString===V.tcString;u(o)&&o.schemaVersion===1&&Me&&u(p)&&p.structuralVersion===v&&typeof p.consentEpoch=="number"&&Number.isSafeInteger(p.consentEpoch)&&p.consentEpoch>=O&&Number.isSafeInteger(t)&&t>=0&&Number.isSafeInteger(n)&&typeof p.expiresAt=="number"&&Number.isSafeInteger(p.expiresAt)&&p.expiresAt>=t&&p.expiresAt<=n&&ye(p.services)&&Be&&!(p.gpcRevocable===!0&&ve())&&(L=p.expiresAt,_=p.services,E=ye(p.categories)?p.categories:{})}}catch{}let Le=e=>{for(let t of y){let n=e.getAttribute(t);if(n!==null)return n}return e.getAttribute(b)},Se=e=>{if(me||L!==void 0&&Date.now()>L)return!1;for(let n of y){let o=e.getAttribute(n);if(o!==null)return _!==null&&_[o]===!0}let t=e.getAttribute(b);return t!==null?E!==null&&E[t]===!0:!1},De=e=>{let t=s.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},U=e=>{if(!C()||e.hasAttribute(A)||!Se(e))return!1;e.setAttribute(A,"");let t=e.getAttribute(F);if(t!==null){if(ge.has(t))return!1;ge.add(t)}let n=e.content.cloneNode(!0);return n instanceof DocumentFragment?(D.activate(n,o=>e.after(o),()=>e.isConnected&&C()&&Se(e),De),!0):!1},re=e=>e instanceof HTMLTemplateElement,_e=8,Ve=()=>new Promise(e=>{let t=r.scheduler;t!=null&&t.postTask?t.postTask(e,{priority:"user-visible"}):setTimeout(e,0)}),oe=e=>{if(!C())return[];let t=[];for(let c of e.querySelectorAll(i))re(c)&&t.push(c);let n=[],o=0;for(;o<t.length&&o<_e;o++){let c=t[o];if(c&&U(c)){let d=Le(c);d!==null&&n.push(d)}}return o<t.length&&(async()=>{for(;o<t.length;o++){o%_e===0&&await Ve();let c=t[o];if(c)try{U(c)}catch{}}})(),n},Ee=!1,be=()=>C()?s.readyState!=="loading"?oe(s):(Ee||(Ee=!0,s.addEventListener("DOMContentLoaded",()=>oe(s),{once:!0})),[]):[];T=new MutationObserver(e=>{if(!(!C()||s.readyState==="loading"||_===null&&E===null))for(let t of e)for(let n of t.addedNodes)re(n)?U(n):n instanceof Element&&oe(n)}),T.observe(s.documentElement,{childList:!0,subtree:!0});let he=()=>{Q=void 0,ee=void 0,te=void 0,C()},Fe=()=>{X=!0,D.clear(),_=null,E=null,T==null||T.disconnect(),ne(),r.__1CONSENT_REACT_FASTPATH__===K&&delete r.__1CONSENT_REACT_FASTPATH__},Ae=(e,t,n,o=!1)=>{if(C()){me=o,D.setPaused(o),L!==void 0&&Date.now()>L&&(_=null,E=null),n!==void 0&&(L=n===0?void 0:n),_=_||{},E=E||{};for(let c of Object.keys(e))_[c]=e[c]===!0;if(t)for(let c of Object.keys(t))E[c]=t[c]===!0;D.recheck()}},Ie=()=>(D.flush(),be());K={appId:P,frameworkId:k,frameworkType:H,machine:j,primaryLanguage:G,structuralVersion:v,consentEpoch:O,runtimeKey:pe,apply(e,t){return Ae(e,t),Ie()},supportsPendingConsent:!0,updateConsent:Ae,promote:Ie,resolve(e){return e!==null&&re(e)?U(e):!1},reconcile:C,destroy:Fe},r.__1CONSENT_REACT_FASTPATH__=K,r.addEventListener(l,he),ne=()=>r.removeEventListener(l,he),(_!==null||E!==null)&&be()})();})();';
|
|
264
264
|
|
|
265
265
|
// src/provider.tsx
|
|
266
266
|
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
@@ -268,17 +268,15 @@ function resolveEnvAppId() {
|
|
|
268
268
|
if (typeof process === "undefined" || !process?.env) return void 0;
|
|
269
269
|
return process.env.NEXT_PUBLIC_1CONSENT_APP_ID;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function resolveProviderSources({
|
|
272
272
|
appId,
|
|
273
273
|
fastPathVersions,
|
|
274
|
-
nonce,
|
|
275
274
|
cmpSrc,
|
|
276
275
|
// Auto-detection maps a customer's NODE_ENV=development to 1Consent's
|
|
277
276
|
// internal "local" zone (unreachable outside our stack) — default to
|
|
278
277
|
// production and let internal setups override explicitly.
|
|
279
278
|
environment = "production",
|
|
280
|
-
loadCmp = true
|
|
281
|
-
children
|
|
279
|
+
loadCmp = true
|
|
282
280
|
}) {
|
|
283
281
|
const resolvedAppId = appId ?? resolveEnvAppId();
|
|
284
282
|
const resolvedCmpSrc = cmpSrc ?? (resolvedAppId !== void 0 ? getCmpScriptUrl(resolvedAppId, { env: environment }) : void 0);
|
|
@@ -287,16 +285,25 @@ function OneConsentProvider({
|
|
|
287
285
|
"[1Consent] Missing App ID: pass the `appId` prop to <OneConsentProvider> or set the NEXT_PUBLIC_1CONSENT_APP_ID environment variable."
|
|
288
286
|
);
|
|
289
287
|
}
|
|
288
|
+
return {
|
|
289
|
+
appId: resolvedAppId ?? "",
|
|
290
|
+
cmpSrc: loadCmp ? resolvedCmpSrc : void 0,
|
|
291
|
+
frameworkVersions: JSON.stringify(fastPathVersions ?? {})
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function OneConsentProvider(props) {
|
|
295
|
+
const { appId, cmpSrc, frameworkVersions } = resolveProviderSources(props);
|
|
296
|
+
const { nonce, children } = props;
|
|
290
297
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
291
|
-
|
|
298
|
+
cmpSrc !== void 0 && /* @__PURE__ */ jsx2("script", { src: cmpSrc, nonce }),
|
|
292
299
|
/* @__PURE__ */ jsx2(
|
|
293
300
|
"script",
|
|
294
301
|
{
|
|
295
302
|
"data-1c-react-fastpath": "",
|
|
296
|
-
"data-1c-app-id":
|
|
297
|
-
"data-1c-framework-versions":
|
|
303
|
+
"data-1c-app-id": appId,
|
|
304
|
+
"data-1c-framework-versions": frameworkVersions,
|
|
298
305
|
nonce,
|
|
299
|
-
|
|
306
|
+
children: REACT_FASTPATH_SOURCE
|
|
300
307
|
}
|
|
301
308
|
),
|
|
302
309
|
children
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1consent/react",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "React 19 consent components and hooks for the 1Consent CMP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"access": "public",
|
|
26
26
|
"provenance": true,
|
|
27
27
|
"registry": "https://registry.npmjs.org/",
|
|
28
|
-
"tag": "
|
|
28
|
+
"tag": "latest"
|
|
29
29
|
},
|
|
30
30
|
"main": "./dist/index.js",
|
|
31
31
|
"types": "./dist/index.d.ts",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"dist/index.d.ts",
|
|
35
35
|
"dist/react-server.js",
|
|
36
36
|
"dist/react-server.d.ts",
|
|
37
|
+
"dist/client-provider.d.ts",
|
|
37
38
|
"dist/one-consent.d.ts",
|
|
38
39
|
"dist/provider.d.ts",
|
|
39
40
|
"dist/types.d.ts",
|
|
@@ -49,9 +50,6 @@
|
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"react": ">=19.0.0"
|
|
53
|
-
},
|
|
54
|
-
"dependencies": {
|
|
55
|
-
"zod": "^4.4.3"
|
|
53
|
+
"react": ">=19.0.0 <20.0.0"
|
|
56
54
|
}
|
|
57
55
|
}
|