@tantainnovative/ndpr-toolkit 5.5.1 → 5.7.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/CHANGELOG.md +28 -0
- package/README.md +36 -0
- package/dist/{chunk-C77CRJLD.mjs → chunk-2T5MY2Q6.mjs} +1 -1
- package/dist/chunk-7PV64WEZ.js +1 -0
- package/dist/{chunk-VTBHDHYK.js → chunk-NTEYQLYM.js} +1 -1
- package/dist/chunk-PEUAA5EC.js +1 -0
- package/dist/chunk-PYSYBUIV.mjs +1 -0
- package/dist/chunk-QNXLY5EJ.mjs +1 -0
- package/dist/chunk-YMKN3YQL.js +1 -0
- package/dist/chunk-ZY4RCV5C.mjs +1 -0
- package/dist/consent.d.mts +114 -0
- package/dist/consent.d.ts +114 -0
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.d.mts +88 -0
- package/dist/core.d.ts +88 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/headless.d.mts +163 -0
- package/dist/headless.d.ts +163 -0
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/hooks.d.mts +90 -0
- package/dist/hooks.d.ts +90 -0
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +131 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/presets-consent.d.mts +2 -0
- package/dist/presets-consent.d.ts +2 -0
- package/dist/presets-consent.js +1 -1
- package/dist/presets-consent.mjs +1 -1
- package/dist/presets.d.mts +2 -0
- package/dist/presets.d.ts +2 -0
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/server.d.mts +88 -0
- package/dist/server.d.ts +88 -0
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/dist/unstyled.d.mts +64 -0
- package/dist/unstyled.d.ts +64 -0
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-HMKXK23C.mjs +0 -1
- package/dist/chunk-L2VO3MEJ.js +0 -1
- package/dist/chunk-PXUX4FYM.js +0 -1
- package/dist/chunk-YTU4FNM2.mjs +0 -1
- /package/dist/{chunk-YQTZWPOS.mjs → chunk-23CULZBM.mjs} +0 -0
- /package/dist/{chunk-OVW5ASY3.js → chunk-VKDW2IHV.js} +0 -0
package/dist/unstyled.d.mts
CHANGED
|
@@ -65,6 +65,8 @@ export declare interface ConsentBannerClassNames {
|
|
|
65
65
|
saveButton?: string;
|
|
66
66
|
customizePanel?: string;
|
|
67
67
|
selectAllButton?: string;
|
|
68
|
+
/** The optional on-page cookie scan panel (shown in the customize view) */
|
|
69
|
+
cookieScanPanel?: string;
|
|
68
70
|
/** Alias for acceptButton */
|
|
69
71
|
primaryButton?: string;
|
|
70
72
|
/** Alias for rejectButton */
|
|
@@ -188,6 +190,30 @@ export declare interface ConsentBannerProps {
|
|
|
188
190
|
* Called when the banner is shown, accepted, rejected, customized, or dismissed.
|
|
189
191
|
*/
|
|
190
192
|
onAnalytics?: (event: ConsentAnalyticsEvent) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Show a "cookies on this page" scan panel inside the customize view. It
|
|
195
|
+
* audits the cookies actually present against `declaredCookies` and flags
|
|
196
|
+
* undeclared ones — a transparency / self-audit aid (NDPA S.25-26 specific,
|
|
197
|
+
* informed consent). Off by default.
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
showCookieScan?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* The cookies you declare, matched against what's present when
|
|
203
|
+
* `showCookieScan` is on. Without it, every present cookie is treated as
|
|
204
|
+
* undeclared (though the built-in registry may still identify it).
|
|
205
|
+
*/
|
|
206
|
+
declaredCookies?: DeclaredCookie[];
|
|
207
|
+
/**
|
|
208
|
+
* Options forwarded to the scan (e.g. `knownCookies`, `useKnownRegistry`,
|
|
209
|
+
* or a `cookieString` to scan instead of `document.cookie`).
|
|
210
|
+
*/
|
|
211
|
+
cookieScanOptions?: CookieScanOptions;
|
|
212
|
+
/**
|
|
213
|
+
* Heading for the cookie scan panel.
|
|
214
|
+
* @default "Cookies on this page"
|
|
215
|
+
*/
|
|
216
|
+
cookieScanTitle?: string;
|
|
191
217
|
}
|
|
192
218
|
|
|
193
219
|
export declare const ConsentManager: React__default.FC<ConsentManagerProps>;
|
|
@@ -342,6 +368,44 @@ declare interface ConsentSettings {
|
|
|
342
368
|
lawfulBasis?: LawfulBasisType;
|
|
343
369
|
}
|
|
344
370
|
|
|
371
|
+
declare interface CookieScanOptions {
|
|
372
|
+
/**
|
|
373
|
+
* The cookie string to scan, in `document.cookie` form (`a=1; b=2`).
|
|
374
|
+
* Defaults to `document.cookie` in the browser, or `''` on the server.
|
|
375
|
+
*/
|
|
376
|
+
cookieString?: string;
|
|
377
|
+
/** Reference timestamp (epoch ms) recorded on the result. Defaults to `Date.now()`. */
|
|
378
|
+
asOf?: number;
|
|
379
|
+
/** Extra known cookies, checked before the built-in registry (so they can override it). */
|
|
380
|
+
knownCookies?: DeclaredCookie[];
|
|
381
|
+
/** Whether to fall back to the built-in known-cookie registry for undeclared cookies. @default true */
|
|
382
|
+
useKnownRegistry?: boolean;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Cookie scanner — audits the cookies actually present in the browser against
|
|
387
|
+
* the cookies you have declared, surfacing undeclared cookies that put you out
|
|
388
|
+
* of step with your cookie notice (NDPA 2023 S.25-26 / NDPC GAID 2025 on
|
|
389
|
+
* specific, informed consent).
|
|
390
|
+
*
|
|
391
|
+
* Pure and DOM-optional: pass `cookieString` to scan an arbitrary value (a
|
|
392
|
+
* `Cookie:` header on the server, a test fixture), or call it in the browser
|
|
393
|
+
* and it reads `document.cookie`. Safe to import from a server bundle.
|
|
394
|
+
*/
|
|
395
|
+
/** A cookie you declare against a consent category. */
|
|
396
|
+
declare interface DeclaredCookie {
|
|
397
|
+
/** Exact cookie name, a prefix (with `prefix: true`), or a RegExp matched against the name. */
|
|
398
|
+
name: string | RegExp;
|
|
399
|
+
/** Consent category this cookie belongs to (e.g. 'necessary', 'analytics', 'marketing'). */
|
|
400
|
+
category: string;
|
|
401
|
+
/** Who sets the cookie (e.g. 'Google Analytics'). */
|
|
402
|
+
provider?: string;
|
|
403
|
+
/** What the cookie is used for — surfaced in your cookie policy. */
|
|
404
|
+
purpose?: string;
|
|
405
|
+
/** Treat a string `name` as a prefix match instead of an exact match. Ignored for RegExp names. */
|
|
406
|
+
prefix?: boolean;
|
|
407
|
+
}
|
|
408
|
+
|
|
345
409
|
/**
|
|
346
410
|
* Represents the data submitted by the DSR request form.
|
|
347
411
|
*/
|
package/dist/unstyled.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export declare interface ConsentBannerClassNames {
|
|
|
65
65
|
saveButton?: string;
|
|
66
66
|
customizePanel?: string;
|
|
67
67
|
selectAllButton?: string;
|
|
68
|
+
/** The optional on-page cookie scan panel (shown in the customize view) */
|
|
69
|
+
cookieScanPanel?: string;
|
|
68
70
|
/** Alias for acceptButton */
|
|
69
71
|
primaryButton?: string;
|
|
70
72
|
/** Alias for rejectButton */
|
|
@@ -188,6 +190,30 @@ export declare interface ConsentBannerProps {
|
|
|
188
190
|
* Called when the banner is shown, accepted, rejected, customized, or dismissed.
|
|
189
191
|
*/
|
|
190
192
|
onAnalytics?: (event: ConsentAnalyticsEvent) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Show a "cookies on this page" scan panel inside the customize view. It
|
|
195
|
+
* audits the cookies actually present against `declaredCookies` and flags
|
|
196
|
+
* undeclared ones — a transparency / self-audit aid (NDPA S.25-26 specific,
|
|
197
|
+
* informed consent). Off by default.
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
showCookieScan?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* The cookies you declare, matched against what's present when
|
|
203
|
+
* `showCookieScan` is on. Without it, every present cookie is treated as
|
|
204
|
+
* undeclared (though the built-in registry may still identify it).
|
|
205
|
+
*/
|
|
206
|
+
declaredCookies?: DeclaredCookie[];
|
|
207
|
+
/**
|
|
208
|
+
* Options forwarded to the scan (e.g. `knownCookies`, `useKnownRegistry`,
|
|
209
|
+
* or a `cookieString` to scan instead of `document.cookie`).
|
|
210
|
+
*/
|
|
211
|
+
cookieScanOptions?: CookieScanOptions;
|
|
212
|
+
/**
|
|
213
|
+
* Heading for the cookie scan panel.
|
|
214
|
+
* @default "Cookies on this page"
|
|
215
|
+
*/
|
|
216
|
+
cookieScanTitle?: string;
|
|
191
217
|
}
|
|
192
218
|
|
|
193
219
|
export declare const ConsentManager: React__default.FC<ConsentManagerProps>;
|
|
@@ -342,6 +368,44 @@ declare interface ConsentSettings {
|
|
|
342
368
|
lawfulBasis?: LawfulBasisType;
|
|
343
369
|
}
|
|
344
370
|
|
|
371
|
+
declare interface CookieScanOptions {
|
|
372
|
+
/**
|
|
373
|
+
* The cookie string to scan, in `document.cookie` form (`a=1; b=2`).
|
|
374
|
+
* Defaults to `document.cookie` in the browser, or `''` on the server.
|
|
375
|
+
*/
|
|
376
|
+
cookieString?: string;
|
|
377
|
+
/** Reference timestamp (epoch ms) recorded on the result. Defaults to `Date.now()`. */
|
|
378
|
+
asOf?: number;
|
|
379
|
+
/** Extra known cookies, checked before the built-in registry (so they can override it). */
|
|
380
|
+
knownCookies?: DeclaredCookie[];
|
|
381
|
+
/** Whether to fall back to the built-in known-cookie registry for undeclared cookies. @default true */
|
|
382
|
+
useKnownRegistry?: boolean;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Cookie scanner — audits the cookies actually present in the browser against
|
|
387
|
+
* the cookies you have declared, surfacing undeclared cookies that put you out
|
|
388
|
+
* of step with your cookie notice (NDPA 2023 S.25-26 / NDPC GAID 2025 on
|
|
389
|
+
* specific, informed consent).
|
|
390
|
+
*
|
|
391
|
+
* Pure and DOM-optional: pass `cookieString` to scan an arbitrary value (a
|
|
392
|
+
* `Cookie:` header on the server, a test fixture), or call it in the browser
|
|
393
|
+
* and it reads `document.cookie`. Safe to import from a server bundle.
|
|
394
|
+
*/
|
|
395
|
+
/** A cookie you declare against a consent category. */
|
|
396
|
+
declare interface DeclaredCookie {
|
|
397
|
+
/** Exact cookie name, a prefix (with `prefix: true`), or a RegExp matched against the name. */
|
|
398
|
+
name: string | RegExp;
|
|
399
|
+
/** Consent category this cookie belongs to (e.g. 'necessary', 'analytics', 'marketing'). */
|
|
400
|
+
category: string;
|
|
401
|
+
/** Who sets the cookie (e.g. 'Google Analytics'). */
|
|
402
|
+
provider?: string;
|
|
403
|
+
/** What the cookie is used for — surfaced in your cookie policy. */
|
|
404
|
+
purpose?: string;
|
|
405
|
+
/** Treat a string `name` as a prefix match instead of an exact match. Ignored for RegExp names. */
|
|
406
|
+
prefix?: boolean;
|
|
407
|
+
}
|
|
408
|
+
|
|
345
409
|
/**
|
|
346
410
|
* Represents the data submitted by the DSR request form.
|
|
347
411
|
*/
|
package/dist/unstyled.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var chunkC32TMS75_js=require('./chunk-C32TMS75.js'),
|
|
2
|
+
'use strict';var chunkC32TMS75_js=require('./chunk-C32TMS75.js'),chunk7PV64WEZ_js=require('./chunk-7PV64WEZ.js');require('./chunk-YMKN3YQL.js'),require('./chunk-PEUAA5EC.js');var chunkFRHFIEWZ_js=require('./chunk-FRHFIEWZ.js');require('./chunk-UXUMYP4L.js'),require('./chunk-AME4HJR4.js'),require('./chunk-I5ZDNSX5.js'),require('./chunk-7563FVMY.js');var chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),P=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var P__default=/*#__PURE__*/_interopDefault(P);function e(C,R){let n=d=>{var s=d,{unstyled:l=true}=s,c=chunkRFPLZDIO_js.c(s,["unstyled"]);return P__default.default.createElement(C,chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},c),{unstyled:l}))};return n.displayName=R,n}var u=e(chunk7PV64WEZ_js.a,"UnstyledConsentBanner"),y=e(chunkC32TMS75_js.a,"UnstyledConsentManager"),S=e(chunkFRHFIEWZ_js.a,"UnstyledDSRRequestForm");exports.ConsentBanner=u;exports.ConsentManager=y;exports.DSRRequestForm=S;
|
package/dist/unstyled.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {a as a$2}from'./chunk-CNCEP66F.mjs';import {a as a$1}from'./chunk-
|
|
2
|
+
import {a as a$2}from'./chunk-CNCEP66F.mjs';import {a as a$1}from'./chunk-PYSYBUIV.mjs';import'./chunk-QNXLY5EJ.mjs';import'./chunk-ZY4RCV5C.mjs';import {a as a$3}from'./chunk-EAV4BZKO.mjs';import'./chunk-EWVK45Z3.mjs';import'./chunk-SFGW37LE.mjs';import'./chunk-PHA3YMFO.mjs';import'./chunk-5LJ652AH.mjs';import {c,b,a}from'./chunk-ZJYULEER.mjs';import P from'react';function e(C,R){let n=d=>{var s=d,{unstyled:l=true}=s,c$1=c(s,["unstyled"]);return P.createElement(C,b(a({},c$1),{unstyled:l}))};return n.displayName=R,n}var u=e(a$1,"UnstyledConsentBanner"),y=e(a$2,"UnstyledConsentManager"),S=e(a$3,"UnstyledDSRRequestForm");export{u as ConsentBanner,y as ConsentManager,S as DSRRequestForm};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tantainnovative/ndpr-toolkit",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"packageManager": "pnpm@10.34.1",
|
|
6
6
|
"description": "Nigeria Data Protection Toolkit — enterprise-grade compliance components for the Nigeria Data Protection Act (NDPA) 2023",
|
package/dist/chunk-HMKXK23C.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-YTU4FNM2.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-PHA3YMFO.mjs';import {a as a$1,b}from'./chunk-ZJYULEER.mjs';import {useState,useRef,useEffect,useCallback}from'react';import {createPortal}from'react-dom';import {jsx,jsxs}from'react/jsx-runtime';var Vn=({options:d,onSave:bn,title:A,description:y,acceptAllButtonText:P,rejectAllButtonText:E,customizeButtonText:D,saveButtonText:z,position:pn="bottom",variant:a$3="bar",zIndex:x=9999,version:C="1.0",show:h,manageStorage:L=true,storageKey:w="ndpr_consent",className:V="",buttonClassName:j="",primaryButtonClassName:ln="",secondaryButtonClassName:fn="",classNames:n,unstyled:o,onAnalytics:k})=>{var U,X,Z,T,m,N,nn,tn,en;let c$1=c(),gn=(U=A!=null?A:c$1.consent.title)!=null?U:"We Value Your Privacy",vn=(X=y!=null?y:c$1.consent.description)!=null?X:"We use cookies and similar technologies to provide our services and enhance your experience. Your consent is collected in accordance with NDPA Sections 25-26.",_n=(Z=P!=null?P:c$1.consent.acceptAll)!=null?Z:"Accept All",Cn=(T=E!=null?E:c$1.consent.rejectAll)!=null?T:"Reject All",hn=(m=D!=null?D:c$1.consent.customize)!=null?m:"Customize",an=(N=z!=null?z:c$1.consent.savePreferences)!=null?N:"Save Preferences",kn=(nn=c$1.consent.selectAll)!=null?nn:"Select All",Sn=(tn=c$1.consent.deselectAll)!=null?tn:"Deselect All",[b$1,u]=useState(false),[f,I]=useState(false),[S,B]=useState({}),[s,Bn]=useState(false),Rn=a({active:b$1}),$=useRef(null),q=useRef(false);useEffect(()=>{Bn(true);},[]);let p=useCallback((t,e)=>{k==null||k(a$1({action:t,timestamp:Date.now(),version:C},e!==void 0?{categories:e}:{}));},[k,C]);useEffect(()=>{let t={};if(d.forEach(e=>{t[e.id]=e.defaultValue||false;}),B(t),h===void 0)if(!L)u(true);else {let e=localStorage.getItem(w);if(e)try{JSON.parse(e).version!==C?u(!0):u(!1);}catch(G){u(true);}else u(true);}else u(h);},[d,w,C,L]),useEffect(()=>{h!==void 0&&u(h);},[h]);let An=()=>{let t={};d.forEach(e=>{t[e.id]=true;}),p("accepted_all",t),H(t);},J=()=>{let t={};d.forEach(e=>{t[e.id]=e.required||false;}),p("rejected_all",t),H(t);},yn=(t,e)=>{B(G=>b(a$1({},G),{[t]:e}));},Pn=()=>{let t={};d.forEach(e=>{t[e.id]=true;}),B(t);},En=()=>{let t={};d.forEach(e=>{t[e.id]=e.required||false;}),B(t);},W=d.length>0&&d.every(t=>S[t.id]),Dn=()=>{p("customized",S),H(S);},H=t=>{let e={consents:t,timestamp:Date.now(),version:C,method:f?"customize":"banner",hasInteracted:true};L&&localStorage.setItem(w,JSON.stringify(e)),bn(e),u(false),I(false);};if(useEffect(()=>{if(!b$1)return;let t=e=>{e.key==="Escape"&&(p("dismissed"),J());};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[b$1,p,d,f]),useEffect(()=>{b$1&&!q.current&&(q.current=true,p("shown")),b$1||(q.current=false);},[b$1,p]),useEffect(()=>{if(f&&$.current){let t=$.current;t.style.maxHeight="0px",t.style.opacity="0",t.offsetHeight,t.style.maxHeight=`${t.scrollHeight}px`,t.style.opacity="1";}},[f]),!b$1)return null;let g=a$3==="modal"?"center":pn,Y=g==="inline",O=g==="center",v=["ndpr-consent-banner"];a$3!=="bar"&&v.push(`ndpr-consent-banner--${a$3}`),g==="top"?v.push("ndpr-consent-banner--top"):g==="bottom"?v.push("ndpr-consent-banner--bottom"):g==="inline"&&v.push("ndpr-consent-banner--inline"),V&&v.push(V);let zn=v.join(" "),K=`ndpr-consent-banner__button ndpr-consent-banner__button--primary ${j} ${ln}`.trim(),Ln=`ndpr-consent-banner__button ndpr-consent-banner__button--secondary ${j} ${fn}`.trim(),wn=`ndpr-consent-banner__button ndpr-consent-banner__button--ghost ${j}`.trim(),jn=(n==null?void 0:n.primaryButton)||(n==null?void 0:n.acceptButton)||K,Q=(n==null?void 0:n.secondaryButton)||(n==null?void 0:n.rejectButton)||Ln,In=(n==null?void 0:n.customizeButton)||wn,$n=(n==null?void 0:n.saveButton)||K,F=jsx("div",{ref:Rn,tabIndex:-1,"data-ndpr-component":"consent-banner","data-ndpr-variant":a$3,"data-ndpr-position":g,className:a$2(zn,n==null?void 0:n.root,o),style:!Y&&!O?{zIndex:x}:void 0,role:"dialog","aria-modal":O||void 0,"aria-labelledby":"consent-banner-title","aria-describedby":"consent-banner-description",children:jsxs("div",{className:a$2("ndpr-consent-banner__container",n==null?void 0:n.container,o),children:[jsx("h2",{id:"consent-banner-title",className:a$2("ndpr-consent-banner__title",n==null?void 0:n.title,o),children:gn}),jsx("p",{id:"consent-banner-description",className:a$2("ndpr-consent-banner__description",n==null?void 0:n.description,o),children:vn}),f&&jsxs("div",{ref:$,className:a$2("ndpr-consent-banner__customize-panel",n==null?void 0:n.customizePanel,o),children:[jsx("div",{className:o?"":"ndpr-consent-banner__select-all-row",children:jsx("button",{type:"button",onClick:W?En:Pn,className:a$2("ndpr-consent-banner__select-all-button",n==null?void 0:n.selectAllButton,o),children:W?Sn:kn})}),jsx("div",{className:a$2("ndpr-consent-banner__options-list",n==null?void 0:n.optionsList,o),children:d.map(t=>jsxs("div",{className:a$2("ndpr-consent-banner__option",n==null?void 0:n.optionItem,o),children:[jsx("input",{id:`consent-${t.id}`,type:"checkbox",checked:S[t.id]||false,onChange:e=>yn(t.id,e.target.checked),disabled:t.required,className:a$2("ndpr-consent-banner__option-checkbox",n==null?void 0:n.optionCheckbox,o)}),jsxs("div",{className:o?"":"ndpr-consent-banner__option-text",children:[jsxs("label",{htmlFor:`consent-${t.id}`,className:a$2("ndpr-consent-banner__option-label",n==null?void 0:n.optionLabel,o),children:[t.label,t.required&&jsx("span",{className:o?"":"ndpr-consent-banner__required-marker",children:" *"})]}),jsx("p",{className:a$2("ndpr-consent-banner__option-description",n==null?void 0:n.optionDescription,o),children:t.description})]})]},t.id))}),jsxs("div",{className:a$2("ndpr-consent-banner__buttons",n==null?void 0:n.buttonGroup,o),children:[jsx("button",{onClick:Dn,className:a$2($n,n==null?void 0:n.saveButton,o),children:an}),jsx("button",{onClick:()=>I(false),className:a$2(Q,n==null?void 0:n.rejectButton,o),children:(en=c$1.common.back)!=null?en:"Back"})]})]}),!f&&jsxs("div",{className:a$2("ndpr-consent-banner__buttons",n==null?void 0:n.buttonGroup,o),children:[jsx("button",{onClick:An,className:a$2(jn,n==null?void 0:n.acceptButton,o),children:_n}),jsx("button",{onClick:J,className:a$2(Q,n==null?void 0:n.rejectButton,o),children:Cn}),jsx("button",{onClick:()=>I(true),className:a$2(In,n==null?void 0:n.customizeButton,o),children:hn})]}),jsx("div",{className:a$2("ndpr-consent-banner__footer-text",void 0,o),children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'})]})});if(Y)return F;if(O){let t=jsx("div",{className:o?"":"ndpr-consent-banner__overlay",style:{zIndex:x},children:F});return s?createPortal(t,document.body):null}return s?createPortal(F,document.body):null};export{Vn as a};
|
package/dist/chunk-L2VO3MEJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var react=require('react');var m='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function v(p){let{active:c,onEscape:o,autoFocus:r=true}=p,t=react.useRef(null),s=react.useRef(null);return react.useEffect(()=>{if(!c||(s.current=typeof document!="undefined"?document.activeElement:null,!t.current))return;let i=false,u;r&&(u=setTimeout(()=>{if(i||!t.current)return;let e=t.current.querySelectorAll(m);e.length>0?e[0].focus():(t.current.tabIndex<0&&(t.current.tabIndex=-1),t.current.focus());},0));let l=e=>{if(e.key==="Escape"&&o){o();return}if(e.key!=="Tab"||!t.current)return;let n=t.current.querySelectorAll(m);if(n.length===0)return;let f=n[0],a=n[n.length-1];e.shiftKey?document.activeElement===f&&(e.preventDefault(),a.focus()):document.activeElement===a&&(e.preventDefault(),f.focus());};return document.addEventListener("keydown",l),()=>{i=true,u&&clearTimeout(u),document.removeEventListener("keydown",l);let e=s.current;e&&typeof document!="undefined"&&document.contains(e)&&typeof e.focus=="function"&&e.focus();}},[c,o,r]),t}exports.a=v;
|
package/dist/chunk-PXUX4FYM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkL2VO3MEJ_js=require('./chunk-L2VO3MEJ.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkI5ZDNSX5_js=require('./chunk-I5ZDNSX5.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime');var Vn=({options:d,onSave:bn,title:A,description:y,acceptAllButtonText:P,rejectAllButtonText:E,customizeButtonText:D,saveButtonText:z,position:pn="bottom",variant:a="bar",zIndex:x=9999,version:C="1.0",show:h,manageStorage:L=true,storageKey:w="ndpr_consent",className:V="",buttonClassName:j="",primaryButtonClassName:ln="",secondaryButtonClassName:fn="",classNames:n,unstyled:o,onAnalytics:k})=>{var U,X,Z,T,m,N,nn,tn,en;let c=chunkI5ZDNSX5_js.c(),gn=(U=A!=null?A:c.consent.title)!=null?U:"We Value Your Privacy",vn=(X=y!=null?y:c.consent.description)!=null?X:"We use cookies and similar technologies to provide our services and enhance your experience. Your consent is collected in accordance with NDPA Sections 25-26.",_n=(Z=P!=null?P:c.consent.acceptAll)!=null?Z:"Accept All",Cn=(T=E!=null?E:c.consent.rejectAll)!=null?T:"Reject All",hn=(m=D!=null?D:c.consent.customize)!=null?m:"Customize",an=(N=z!=null?z:c.consent.savePreferences)!=null?N:"Save Preferences",kn=(nn=c.consent.selectAll)!=null?nn:"Select All",Sn=(tn=c.consent.deselectAll)!=null?tn:"Deselect All",[b,u]=react.useState(false),[f,I]=react.useState(false),[S,B]=react.useState({}),[s,Bn]=react.useState(false),Rn=chunkL2VO3MEJ_js.a({active:b}),$=react.useRef(null),q=react.useRef(false);react.useEffect(()=>{Bn(true);},[]);let p=react.useCallback((t,e)=>{k==null||k(chunkRFPLZDIO_js.a({action:t,timestamp:Date.now(),version:C},e!==void 0?{categories:e}:{}));},[k,C]);react.useEffect(()=>{let t={};if(d.forEach(e=>{t[e.id]=e.defaultValue||false;}),B(t),h===void 0)if(!L)u(true);else {let e=localStorage.getItem(w);if(e)try{JSON.parse(e).version!==C?u(!0):u(!1);}catch(G){u(true);}else u(true);}else u(h);},[d,w,C,L]),react.useEffect(()=>{h!==void 0&&u(h);},[h]);let An=()=>{let t={};d.forEach(e=>{t[e.id]=true;}),p("accepted_all",t),H(t);},J=()=>{let t={};d.forEach(e=>{t[e.id]=e.required||false;}),p("rejected_all",t),H(t);},yn=(t,e)=>{B(G=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},G),{[t]:e}));},Pn=()=>{let t={};d.forEach(e=>{t[e.id]=true;}),B(t);},En=()=>{let t={};d.forEach(e=>{t[e.id]=e.required||false;}),B(t);},W=d.length>0&&d.every(t=>S[t.id]),Dn=()=>{p("customized",S),H(S);},H=t=>{let e={consents:t,timestamp:Date.now(),version:C,method:f?"customize":"banner",hasInteracted:true};L&&localStorage.setItem(w,JSON.stringify(e)),bn(e),u(false),I(false);};if(react.useEffect(()=>{if(!b)return;let t=e=>{e.key==="Escape"&&(p("dismissed"),J());};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[b,p,d,f]),react.useEffect(()=>{b&&!q.current&&(q.current=true,p("shown")),b||(q.current=false);},[b,p]),react.useEffect(()=>{if(f&&$.current){let t=$.current;t.style.maxHeight="0px",t.style.opacity="0",t.offsetHeight,t.style.maxHeight=`${t.scrollHeight}px`,t.style.opacity="1";}},[f]),!b)return null;let g=a==="modal"?"center":pn,Y=g==="inline",O=g==="center",v=["ndpr-consent-banner"];a!=="bar"&&v.push(`ndpr-consent-banner--${a}`),g==="top"?v.push("ndpr-consent-banner--top"):g==="bottom"?v.push("ndpr-consent-banner--bottom"):g==="inline"&&v.push("ndpr-consent-banner--inline"),V&&v.push(V);let zn=v.join(" "),K=`ndpr-consent-banner__button ndpr-consent-banner__button--primary ${j} ${ln}`.trim(),Ln=`ndpr-consent-banner__button ndpr-consent-banner__button--secondary ${j} ${fn}`.trim(),wn=`ndpr-consent-banner__button ndpr-consent-banner__button--ghost ${j}`.trim(),jn=(n==null?void 0:n.primaryButton)||(n==null?void 0:n.acceptButton)||K,Q=(n==null?void 0:n.secondaryButton)||(n==null?void 0:n.rejectButton)||Ln,In=(n==null?void 0:n.customizeButton)||wn,$n=(n==null?void 0:n.saveButton)||K,F=jsxRuntime.jsx("div",{ref:Rn,tabIndex:-1,"data-ndpr-component":"consent-banner","data-ndpr-variant":a,"data-ndpr-position":g,className:chunkAME4HJR4_js.a(zn,n==null?void 0:n.root,o),style:!Y&&!O?{zIndex:x}:void 0,role:"dialog","aria-modal":O||void 0,"aria-labelledby":"consent-banner-title","aria-describedby":"consent-banner-description",children:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__container",n==null?void 0:n.container,o),children:[jsxRuntime.jsx("h2",{id:"consent-banner-title",className:chunkAME4HJR4_js.a("ndpr-consent-banner__title",n==null?void 0:n.title,o),children:gn}),jsxRuntime.jsx("p",{id:"consent-banner-description",className:chunkAME4HJR4_js.a("ndpr-consent-banner__description",n==null?void 0:n.description,o),children:vn}),f&&jsxRuntime.jsxs("div",{ref:$,className:chunkAME4HJR4_js.a("ndpr-consent-banner__customize-panel",n==null?void 0:n.customizePanel,o),children:[jsxRuntime.jsx("div",{className:o?"":"ndpr-consent-banner__select-all-row",children:jsxRuntime.jsx("button",{type:"button",onClick:W?En:Pn,className:chunkAME4HJR4_js.a("ndpr-consent-banner__select-all-button",n==null?void 0:n.selectAllButton,o),children:W?Sn:kn})}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__options-list",n==null?void 0:n.optionsList,o),children:d.map(t=>jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__option",n==null?void 0:n.optionItem,o),children:[jsxRuntime.jsx("input",{id:`consent-${t.id}`,type:"checkbox",checked:S[t.id]||false,onChange:e=>yn(t.id,e.target.checked),disabled:t.required,className:chunkAME4HJR4_js.a("ndpr-consent-banner__option-checkbox",n==null?void 0:n.optionCheckbox,o)}),jsxRuntime.jsxs("div",{className:o?"":"ndpr-consent-banner__option-text",children:[jsxRuntime.jsxs("label",{htmlFor:`consent-${t.id}`,className:chunkAME4HJR4_js.a("ndpr-consent-banner__option-label",n==null?void 0:n.optionLabel,o),children:[t.label,t.required&&jsxRuntime.jsx("span",{className:o?"":"ndpr-consent-banner__required-marker",children:" *"})]}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__option-description",n==null?void 0:n.optionDescription,o),children:t.description})]})]},t.id))}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__buttons",n==null?void 0:n.buttonGroup,o),children:[jsxRuntime.jsx("button",{onClick:Dn,className:chunkAME4HJR4_js.a($n,n==null?void 0:n.saveButton,o),children:an}),jsxRuntime.jsx("button",{onClick:()=>I(false),className:chunkAME4HJR4_js.a(Q,n==null?void 0:n.rejectButton,o),children:(en=c.common.back)!=null?en:"Back"})]})]}),!f&&jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__buttons",n==null?void 0:n.buttonGroup,o),children:[jsxRuntime.jsx("button",{onClick:An,className:chunkAME4HJR4_js.a(jn,n==null?void 0:n.acceptButton,o),children:_n}),jsxRuntime.jsx("button",{onClick:J,className:chunkAME4HJR4_js.a(Q,n==null?void 0:n.rejectButton,o),children:Cn}),jsxRuntime.jsx("button",{onClick:()=>I(true),className:chunkAME4HJR4_js.a(In,n==null?void 0:n.customizeButton,o),children:hn})]}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__footer-text",void 0,o),children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'})]})});if(Y)return F;if(O){let t=jsxRuntime.jsx("div",{className:o?"":"ndpr-consent-banner__overlay",style:{zIndex:x},children:F});return s?reactDom.createPortal(t,document.body):null}return s?reactDom.createPortal(F,document.body):null};exports.a=Vn;
|
package/dist/chunk-YTU4FNM2.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {useRef,useEffect}from'react';var m='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function v(p){let{active:c,onEscape:o,autoFocus:r=true}=p,t=useRef(null),s=useRef(null);return useEffect(()=>{if(!c||(s.current=typeof document!="undefined"?document.activeElement:null,!t.current))return;let i=false,u;r&&(u=setTimeout(()=>{if(i||!t.current)return;let e=t.current.querySelectorAll(m);e.length>0?e[0].focus():(t.current.tabIndex<0&&(t.current.tabIndex=-1),t.current.focus());},0));let l=e=>{if(e.key==="Escape"&&o){o();return}if(e.key!=="Tab"||!t.current)return;let n=t.current.querySelectorAll(m);if(n.length===0)return;let f=n[0],a=n[n.length-1];e.shiftKey?document.activeElement===f&&(e.preventDefault(),a.focus()):document.activeElement===a&&(e.preventDefault(),f.focus());};return document.addEventListener("keydown",l),()=>{i=true,u&&clearTimeout(u),document.removeEventListener("keydown",l);let e=s.current;e&&typeof document!="undefined"&&document.contains(e)&&typeof e.focus=="function"&&e.focus();}},[c,o,r]),t}export{v as a};
|
|
File without changes
|
|
File without changes
|