@tantainnovative/ndpr-toolkit 1.0.10 → 2.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 +289 -136
- package/dist/breach-BpSBPrdk.d.mts +185 -0
- package/dist/breach-BpSBPrdk.d.ts +185 -0
- package/dist/breach-D5zJYNph.d.mts +17 -0
- package/dist/breach-D7NgrdMX.d.ts +17 -0
- package/dist/breach.d.mts +275 -0
- package/dist/breach.d.ts +275 -0
- package/dist/breach.js +2 -0
- package/dist/breach.js.map +1 -0
- package/dist/breach.mjs +2 -0
- package/dist/breach.mjs.map +1 -0
- package/dist/chunk-2SYNHRP6.mjs +2 -0
- package/dist/chunk-2SYNHRP6.mjs.map +1 -0
- package/dist/chunk-2XHD22J7.mjs +7 -0
- package/dist/chunk-2XHD22J7.mjs.map +1 -0
- package/dist/chunk-4A354HL3.js +2 -0
- package/dist/chunk-4A354HL3.js.map +1 -0
- package/dist/chunk-4DKT6IB6.js +94 -0
- package/dist/chunk-4DKT6IB6.js.map +1 -0
- package/dist/chunk-5ZBO2UPH.js +2 -0
- package/dist/chunk-5ZBO2UPH.js.map +1 -0
- package/dist/chunk-6JFTAYXV.mjs +2 -0
- package/dist/chunk-6JFTAYXV.mjs.map +1 -0
- package/dist/chunk-6JVYYLS7.js +2 -0
- package/dist/chunk-6JVYYLS7.js.map +1 -0
- package/dist/chunk-6SGG6WPA.mjs +2 -0
- package/dist/chunk-6SGG6WPA.mjs.map +1 -0
- package/dist/chunk-AQEGDEQM.js +7 -0
- package/dist/chunk-AQEGDEQM.js.map +1 -0
- package/dist/chunk-C2IJWCZQ.mjs +2 -0
- package/dist/chunk-C2IJWCZQ.mjs.map +1 -0
- package/dist/chunk-CMZTI7SG.js +2 -0
- package/dist/chunk-CMZTI7SG.js.map +1 -0
- package/dist/chunk-DB3JH4DS.mjs +2 -0
- package/dist/chunk-DB3JH4DS.mjs.map +1 -0
- package/dist/chunk-EWOZKYLY.mjs +2 -0
- package/dist/chunk-EWOZKYLY.mjs.map +1 -0
- package/dist/chunk-FFW7RUAG.mjs +94 -0
- package/dist/chunk-FFW7RUAG.mjs.map +1 -0
- package/dist/chunk-FK3CSFLJ.js +2 -0
- package/dist/chunk-FK3CSFLJ.js.map +1 -0
- package/dist/chunk-GIV2OHE6.mjs +2 -0
- package/dist/chunk-GIV2OHE6.mjs.map +1 -0
- package/dist/chunk-GMLNWS2N.mjs +2 -0
- package/dist/chunk-GMLNWS2N.mjs.map +1 -0
- package/dist/chunk-IQF726GS.js +2 -0
- package/dist/chunk-IQF726GS.js.map +1 -0
- package/dist/chunk-IWUUVRLJ.js +2 -0
- package/dist/chunk-IWUUVRLJ.js.map +1 -0
- package/dist/chunk-JUN6YPLL.mjs +72 -0
- package/dist/chunk-JUN6YPLL.mjs.map +1 -0
- package/dist/chunk-L3FKTBGV.js +72 -0
- package/dist/chunk-L3FKTBGV.js.map +1 -0
- package/dist/chunk-L52PDW6O.mjs +2 -0
- package/dist/chunk-L52PDW6O.mjs.map +1 -0
- package/dist/chunk-LI6WJ3LZ.js +2 -0
- package/dist/chunk-LI6WJ3LZ.js.map +1 -0
- package/dist/chunk-LXRXDTPI.js +2 -0
- package/dist/chunk-LXRXDTPI.js.map +1 -0
- package/dist/chunk-MQFZHA2D.js +2 -0
- package/dist/chunk-MQFZHA2D.js.map +1 -0
- package/dist/chunk-OITITR6K.mjs +2 -0
- package/dist/chunk-OITITR6K.mjs.map +1 -0
- package/dist/chunk-PDJGTQMY.mjs +2 -0
- package/dist/chunk-PDJGTQMY.mjs.map +1 -0
- package/dist/chunk-PGSA2O5P.mjs +2 -0
- package/dist/chunk-PGSA2O5P.mjs.map +1 -0
- package/dist/chunk-PM7CMTMB.js +4 -0
- package/dist/chunk-PM7CMTMB.js.map +1 -0
- package/dist/chunk-PYEX7DFR.mjs +4 -0
- package/dist/chunk-PYEX7DFR.mjs.map +1 -0
- package/dist/chunk-QKK5S54L.mjs +2 -0
- package/dist/chunk-QKK5S54L.mjs.map +1 -0
- package/dist/chunk-RB26MIRI.js +2 -0
- package/dist/chunk-RB26MIRI.js.map +1 -0
- package/dist/chunk-RGYK4VAY.mjs +2 -0
- package/dist/chunk-RGYK4VAY.mjs.map +1 -0
- package/dist/chunk-RHWW5FDP.js +16 -0
- package/dist/chunk-RHWW5FDP.js.map +1 -0
- package/dist/chunk-RYZEIDNR.js +2 -0
- package/dist/chunk-RYZEIDNR.js.map +1 -0
- package/dist/chunk-SLNMKGQ2.mjs +2 -0
- package/dist/chunk-SLNMKGQ2.mjs.map +1 -0
- package/dist/chunk-SSGJREE3.js +2 -0
- package/dist/chunk-SSGJREE3.js.map +1 -0
- package/dist/chunk-SWF3YVE5.js +4 -0
- package/dist/chunk-SWF3YVE5.js.map +1 -0
- package/dist/chunk-T44JQT2O.mjs +2 -0
- package/dist/chunk-T44JQT2O.mjs.map +1 -0
- package/dist/chunk-TDDAYVKK.js +2 -0
- package/dist/chunk-TDDAYVKK.js.map +1 -0
- package/dist/chunk-TXBZPCGF.mjs +2 -0
- package/dist/chunk-TXBZPCGF.mjs.map +1 -0
- package/dist/chunk-U2CGMEWB.js +2 -0
- package/dist/chunk-U2CGMEWB.js.map +1 -0
- package/dist/chunk-UUWVBENC.js +2 -0
- package/dist/chunk-UUWVBENC.js.map +1 -0
- package/dist/chunk-UYP64PV7.mjs +4 -0
- package/dist/chunk-UYP64PV7.mjs.map +1 -0
- package/dist/chunk-VMJBW3EF.mjs +2 -0
- package/dist/chunk-VMJBW3EF.mjs.map +1 -0
- package/dist/chunk-WW3X3ELF.js +2 -0
- package/dist/chunk-WW3X3ELF.js.map +1 -0
- package/dist/chunk-WWT2ZSNU.mjs +2 -0
- package/dist/chunk-WWT2ZSNU.mjs.map +1 -0
- package/dist/chunk-XMKA6GVK.mjs +16 -0
- package/dist/chunk-XMKA6GVK.mjs.map +1 -0
- package/dist/chunk-Y34DQYS7.js +2 -0
- package/dist/chunk-Y34DQYS7.js.map +1 -0
- package/dist/chunk-ZU73VG3X.js +2 -0
- package/dist/chunk-ZU73VG3X.js.map +1 -0
- package/dist/consent-CmVzqZUk.d.mts +99 -0
- package/dist/consent-CmVzqZUk.d.ts +99 -0
- package/dist/consent-DCc5zjXI.d.mts +24 -0
- package/dist/consent-DLWb5ota.d.ts +24 -0
- package/dist/consent.d.mts +197 -0
- package/dist/consent.d.ts +197 -0
- package/dist/consent.js +2 -0
- package/dist/consent.js.map +1 -0
- package/dist/consent.mjs +2 -0
- package/dist/consent.mjs.map +1 -0
- package/dist/core.d.mts +14 -0
- package/dist/core.d.ts +14 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +2 -0
- package/dist/core.mjs.map +1 -0
- package/dist/cross-border-BrIy1ieh.d.mts +192 -0
- package/dist/cross-border-BrIy1ieh.d.ts +192 -0
- package/dist/cross-border.d.mts +58 -0
- package/dist/cross-border.d.ts +58 -0
- package/dist/cross-border.js +2 -0
- package/dist/cross-border.js.map +1 -0
- package/dist/cross-border.mjs +2 -0
- package/dist/cross-border.mjs.map +1 -0
- package/dist/dpia-B9ZZJG5a.d.mts +15 -0
- package/dist/dpia-fdtTd2DI.d.ts +15 -0
- package/dist/dpia-vWfE_9bO.d.mts +137 -0
- package/dist/dpia-vWfE_9bO.d.ts +137 -0
- package/dist/dpia.d.mts +179 -0
- package/dist/dpia.d.ts +179 -0
- package/dist/dpia.js +2 -0
- package/dist/dpia.js.map +1 -0
- package/dist/dpia.mjs +2 -0
- package/dist/dpia.mjs.map +1 -0
- package/dist/dsr-jq5NUEdz.d.ts +14 -0
- package/dist/dsr-pQzQ3H1O.d.mts +128 -0
- package/dist/dsr-pQzQ3H1O.d.ts +128 -0
- package/dist/dsr-whPkiI0_.d.mts +14 -0
- package/dist/dsr.d.mts +192 -0
- package/dist/dsr.d.ts +192 -0
- package/dist/dsr.js +2 -0
- package/dist/dsr.js.map +1 -0
- package/dist/dsr.mjs +2 -0
- package/dist/dsr.mjs.map +1 -0
- package/dist/hooks.d.mts +17 -0
- package/dist/hooks.d.ts +17 -0
- package/dist/hooks.js +2 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hooks.mjs +2 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/index.d.mts +31 -448
- package/dist/index.d.ts +31 -448
- package/dist/index.js +1 -190
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -190
- package/dist/index.mjs.map +1 -1
- package/dist/lawful-basis-CWtvDG1x.d.mts +112 -0
- package/dist/lawful-basis-CWtvDG1x.d.ts +112 -0
- package/dist/lawful-basis-D-oXFizg.d.mts +57 -0
- package/dist/lawful-basis-v04AhbK2.d.ts +57 -0
- package/dist/lawful-basis.d.mts +55 -0
- package/dist/lawful-basis.d.ts +55 -0
- package/dist/lawful-basis.js +2 -0
- package/dist/lawful-basis.js.map +1 -0
- package/dist/lawful-basis.mjs +2 -0
- package/dist/lawful-basis.mjs.map +1 -0
- package/dist/policy.d.mts +195 -0
- package/dist/policy.d.ts +195 -0
- package/dist/policy.js +2 -0
- package/dist/policy.js.map +1 -0
- package/dist/policy.mjs +2 -0
- package/dist/policy.mjs.map +1 -0
- package/dist/privacy-9FcJceMr.d.mts +15 -0
- package/dist/privacy-BXz7O2ej.d.ts +15 -0
- package/dist/privacy-Ca6te9Ir.d.mts +138 -0
- package/dist/privacy-Ca6te9Ir.d.ts +138 -0
- package/dist/ropa-BebGfqKQ.d.ts +200 -0
- package/dist/ropa-Rb4dsFSz.d.mts +200 -0
- package/dist/ropa.d.mts +45 -0
- package/dist/ropa.d.ts +45 -0
- package/dist/ropa.js +2 -0
- package/dist/ropa.js.map +1 -0
- package/dist/ropa.mjs +2 -0
- package/dist/ropa.mjs.map +1 -0
- package/dist/unstyled.d.mts +4 -4
- package/dist/unstyled.d.ts +4 -4
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.js.map +1 -1
- package/dist/unstyled.mjs +1 -1
- package/dist/unstyled.mjs.map +1 -1
- package/dist/useBreach-DRKnexsk.d.mts +99 -0
- package/dist/useBreach-DuT0N0K1.d.ts +99 -0
- package/dist/useConsent-D0pAfTlb.d.ts +65 -0
- package/dist/useConsent-DOt2Njst.d.mts +65 -0
- package/dist/useCrossBorderTransfer-D4FQYfFt.d.ts +66 -0
- package/dist/useCrossBorderTransfer-TVnY8_UX.d.mts +66 -0
- package/dist/useDPIA-DFDHBLSa.d.ts +94 -0
- package/dist/useDPIA-FqPofFaV.d.mts +94 -0
- package/dist/useDSR-DAqqOBXb.d.ts +74 -0
- package/dist/useDSR-OXM5Q9rf.d.mts +74 -0
- package/dist/useLawfulBasis-DNQ8YszQ.d.mts +68 -0
- package/dist/useLawfulBasis-RILM_xsx.d.ts +68 -0
- package/dist/usePrivacyPolicy-CfySfBLS.d.ts +89 -0
- package/dist/usePrivacyPolicy-Dit2sFuV.d.mts +89 -0
- package/dist/useROPA-Bcs6cRdi.d.ts +64 -0
- package/dist/useROPA-nmcSiUYv.d.mts +64 -0
- package/package.json +144 -20
package/dist/unstyled.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{createContext,useContext}from'react';var v=createContext(void 0);function i(){let n=useContext(v);if(!n)throw new Error("useConsent must be used within a ConsentProvider");return n}var C=({className:n,children:a})=>{let{showBanner:o,acceptAll:r,rejectAll:l,openSettings:c}=i();return o?e.createElement("div",{className:n,role:"region","aria-label":"Cookie consent"},a||e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement("h3",null,"Cookie Consent"),e.createElement("p",null,"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.")),e.createElement("div",null,e.createElement("button",{onClick:r,"aria-label":"Accept all cookies"},"Accept All"),e.createElement("button",{onClick:l,"aria-label":"Reject non-essential cookies"},"Reject All"),e.createElement("button",{onClick:c,"aria-label":"Manage cookie preferences"},"Manage Preferences")))):null};var h=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],f=({className:n,children:a})=>{let{showSettings:o,consentState:r,updateConsent:l,savePreferences:c,closeSettings:p}=i();if(!o)return null;let g=()=>{c(r);};return e.createElement("div",{className:n,role:"dialog","aria-label":"Cookie preferences"},a||e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement("h2",null,"Cookie Preferences"),e.createElement("p",null,"Manage your cookie preferences. You can enable or disable different categories of cookies below.")),e.createElement("div",null,h.map(s=>e.createElement("div",{key:s.id},e.createElement("div",null,e.createElement("h4",null,s.name),e.createElement("p",null,s.description)),e.createElement("input",{type:"checkbox",checked:r[s.id],onChange:k=>l(s.id,k.target.checked),disabled:s.disabled,"aria-label":`Toggle ${s.name}`})))),e.createElement("div",null,e.createElement("button",{onClick:p,"aria-label":"Cancel changes"},"Cancel"),e.createElement("button",{onClick:g,"aria-label":"Save cookie preferences"},"Save Preferences"))))};var u=({category:n,className:a,label:o})=>{let{consentState:r,updateConsent:l}=i();return e.createElement("label",{className:a},e.createElement("input",{type:"checkbox",checked:r[n],onChange:c=>l(n,c.target.checked),"aria-label":o||`Toggle ${n} cookies`}),o&&e.createElement("span",null,o))};export{C as ConsentBanner,f as ConsentSettings,u as ConsentToggle};//# sourceMappingURL=unstyled.mjs.map
|
|
1
|
+
import'./chunk-WWT2ZSNU.mjs';import e,{createContext,useContext}from'react';var v=createContext(void 0);function i(){let n=useContext(v);if(!n)throw new Error("useConsent must be used within a ConsentProvider");return n}var C=({className:n,children:a})=>{let{showBanner:o,acceptAll:r,rejectAll:l,openSettings:c}=i();return o?e.createElement("div",{className:n,role:"region","aria-label":"Cookie consent"},a||e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement("h3",null,"Cookie Consent"),e.createElement("p",null,"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.")),e.createElement("div",null,e.createElement("button",{onClick:r,"aria-label":"Accept all cookies"},"Accept All"),e.createElement("button",{onClick:l,"aria-label":"Reject non-essential cookies"},"Reject All"),e.createElement("button",{onClick:c,"aria-label":"Manage cookie preferences"},"Manage Preferences")))):null};var h=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],f=({className:n,children:a})=>{let{showSettings:o,consentState:r,updateConsent:l,savePreferences:c,closeSettings:p}=i();if(!o)return null;let g=()=>{c(r);};return e.createElement("div",{className:n,role:"dialog","aria-label":"Cookie preferences"},a||e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement("h2",null,"Cookie Preferences"),e.createElement("p",null,"Manage your cookie preferences. You can enable or disable different categories of cookies below.")),e.createElement("div",null,h.map(s=>e.createElement("div",{key:s.id},e.createElement("div",null,e.createElement("h4",null,s.name),e.createElement("p",null,s.description)),e.createElement("input",{type:"checkbox",checked:r[s.id],onChange:k=>l(s.id,k.target.checked),disabled:s.disabled,"aria-label":`Toggle ${s.name}`})))),e.createElement("div",null,e.createElement("button",{onClick:p,"aria-label":"Cancel changes"},"Cancel"),e.createElement("button",{onClick:g,"aria-label":"Save cookie preferences"},"Save Preferences"))))};var u=({category:n,className:a,label:o})=>{let{consentState:r,updateConsent:l}=i();return e.createElement("label",{className:a},e.createElement("input",{type:"checkbox",checked:r[n],onChange:c=>l(n,c.target.checked),"aria-label":o||`Toggle ${n} cookies`}),o&&e.createElement("span",null,o))};export{C as ConsentBanner,f as ConsentSettings,u as ConsentToggle};//# sourceMappingURL=unstyled.mjs.map
|
|
2
2
|
//# sourceMappingURL=unstyled.mjs.map
|
package/dist/unstyled.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/ConsentContext.tsx","../src/components/consent/unstyled/UnstyledConsentBanner.tsx","../src/components/consent/unstyled/UnstyledConsentSettings.tsx","../src/components/consent/unstyled/UnstyledConsentToggle.tsx"],"names":["ConsentContext","createContext","useConsent","context","useContext","UnstyledConsentBanner","className","children","showBanner","acceptAll","rejectAll","openSettings","React","cookieCategories","UnstyledConsentSettings","showSettings","consentState","updateConsent","savePreferences","closeSettings","handleSave","category","e","UnstyledConsentToggle","label"],"mappings":"+CA4BA,IAAMA,EAAiBC,aAAAA,CAA+C,MAAS,EA0IxE,SAASC,CAAAA,EAAa,CAC3B,IAAMC,CAAAA,CAAUC,WAAWJ,CAAc,CAAA,CACzC,GAAI,CAACG,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,kDAAkD,CAAA,CAEpE,OAAOA,CACT,CCpKO,IAAME,EAA8D,CAAC,CAC1E,UAAAC,CAAAA,CACA,QAAA,CAAAC,CACF,CAAA,GAAM,CACJ,GAAM,CAAE,UAAA,CAAAC,EAAY,SAAA,CAAAC,CAAAA,CAAW,UAAAC,CAAAA,CAAW,YAAA,CAAAC,CAAa,CAAA,CAAIT,CAAAA,GAE3D,OAAKM,CAAAA,CAGHI,EAAA,aAAA,CAAC,KAAA,CAAA,CAAI,UAAWN,CAAAA,CAAW,IAAA,CAAK,SAAS,YAAA,CAAW,gBAAA,CAAA,CACjDC,GACCK,CAAAA,CAAA,aAAA,CAAAA,EAAA,QAAA,CAAA,IAAA,CACEA,CAAAA,CAAA,cAAC,KAAA,CAAA,IAAA,CACCA,CAAAA,CAAA,cAAC,IAAA,CAAA,IAAA,CAAG,gBAAc,EAClBA,CAAAA,CAAA,aAAA,CAAC,SAAE,8GAA4G,CACjH,EACAA,CAAAA,CAAA,aAAA,CAAC,WACCA,CAAAA,CAAA,aAAA,CAAC,UAAO,OAAA,CAASH,CAAAA,CAAW,aAAW,oBAAA,CAAA,CAAqB,YAE5D,EACAG,CAAAA,CAAA,aAAA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K,UAAA,CACL,OAAA,CAASI,EAAaK,CAAQ,CAAA,CAC9B,SAAWC,CAAAA,EAAML,CAAAA,CAAcI,EAAUC,CAAAA,CAAE,MAAA,CAAO,OAAO,CAAA,CACzD,YAAA,CAAYE,GAAS,CAAA,OAAA,EAAUH,CAAQ,WACzC,CAAA,CACCG,CAAAA,EAASZ,EAAA,aAAA,CAAC,MAAA,CAAA,IAAA,CAAMY,CAAM,CACzB,CAEJ","file":"unstyled.mjs","sourcesContent":["import React, { createContext, useContext, useState, useCallback, useEffect, ReactNode } from 'react';\n\nexport interface ConsentCategories {\n necessary: boolean;\n analytics: boolean;\n marketing: boolean;\n functional: boolean;\n [key: string]: boolean;\n}\n\nexport interface ConsentState {\n hasUserConsented: boolean;\n consentState: ConsentCategories;\n showBanner: boolean;\n showSettings: boolean;\n}\n\nexport interface ConsentActions {\n acceptAll: () => void;\n rejectAll: () => void;\n savePreferences: (preferences: Partial<ConsentCategories>) => void;\n openSettings: () => void;\n closeSettings: () => void;\n updateConsent: (category: keyof ConsentCategories, value: boolean) => void;\n}\n\nexport interface ConsentContextValue extends ConsentState, ConsentActions {}\n\nconst ConsentContext = createContext<ConsentContextValue | undefined>(undefined);\n\nexport interface ConsentProviderProps {\n children: ReactNode;\n initialConsent?: Partial<ConsentCategories>;\n onConsentChange?: (consent: ConsentCategories) => void;\n storageKey?: string;\n}\n\nconst defaultConsent: ConsentCategories = {\n necessary: true, // Always true\n analytics: false,\n marketing: false,\n functional: false,\n};\n\nexport function ConsentProvider({\n children,\n initialConsent = {},\n onConsentChange,\n storageKey = 'ndpr-consent',\n}: ConsentProviderProps) {\n const [consentState, setConsentState] = useState<ConsentCategories>(() => {\n // Try to load from localStorage\n if (typeof window !== 'undefined') {\n const stored = localStorage.getItem(storageKey);\n if (stored) {\n try {\n const parsed = JSON.parse(stored);\n return { ...defaultConsent, ...parsed };\n } catch (e) {\n console.error('Failed to parse consent from localStorage', e);\n }\n }\n }\n return { ...defaultConsent, ...initialConsent };\n });\n\n const [hasUserConsented, setHasUserConsented] = useState(() => {\n if (typeof window !== 'undefined') {\n return localStorage.getItem(`${storageKey}-set`) === 'true';\n }\n return false;\n });\n\n const [showBanner, setShowBanner] = useState(!hasUserConsented);\n const [showSettings, setShowSettings] = useState(false);\n\n // Persist consent to localStorage\n useEffect(() => {\n if (typeof window !== 'undefined' && hasUserConsented) {\n localStorage.setItem(storageKey, JSON.stringify(consentState));\n localStorage.setItem(`${storageKey}-set`, 'true');\n }\n }, [consentState, hasUserConsented, storageKey]);\n\n // Notify parent of consent changes\n useEffect(() => {\n if (hasUserConsented && onConsentChange) {\n onConsentChange(consentState);\n }\n }, [consentState, hasUserConsented, onConsentChange]);\n\n const acceptAll = useCallback(() => {\n const newConsent: ConsentCategories = {\n necessary: true,\n analytics: true,\n marketing: true,\n functional: true,\n };\n setConsentState(newConsent);\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const rejectAll = useCallback(() => {\n const newConsent: ConsentCategories = {\n necessary: true,\n analytics: false,\n marketing: false,\n functional: false,\n };\n setConsentState(newConsent);\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const savePreferences = useCallback((preferences: Partial<ConsentCategories>) => {\n setConsentState(prev => ({\n ...prev,\n ...preferences,\n necessary: true, // Always keep necessary as true\n }));\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const updateConsent = useCallback((category: keyof ConsentCategories, value: boolean) => {\n if (category === 'necessary') return; // Can't change necessary cookies\n \n setConsentState(prev => ({\n ...prev,\n [category]: value,\n }));\n }, []);\n\n const openSettings = useCallback(() => {\n setShowSettings(true);\n setShowBanner(false);\n }, []);\n\n const closeSettings = useCallback(() => {\n setShowSettings(false);\n }, []);\n\n const value: ConsentContextValue = {\n hasUserConsented,\n consentState,\n showBanner,\n showSettings,\n acceptAll,\n rejectAll,\n savePreferences,\n openSettings,\n closeSettings,\n updateConsent,\n };\n\n return (\n <ConsentContext.Provider value={value}>\n {children}\n </ConsentContext.Provider>\n );\n}\n\nexport function useConsent() {\n const context = useContext(ConsentContext);\n if (!context) {\n throw new Error('useConsent must be used within a ConsentProvider');\n }\n return context;\n}\n\n// Export for external use\nexport { ConsentContext };","import React, { ReactNode } from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentBannerProps {\n className?: string;\n children?: ReactNode;\n}\n\nexport const UnstyledConsentBanner: React.FC<UnstyledConsentBannerProps> = ({\n className,\n children,\n}) => {\n const { showBanner, acceptAll, rejectAll, openSettings } = useConsent();\n\n if (!showBanner) return null;\n\n return (\n <div className={className} role=\"region\" aria-label=\"Cookie consent\">\n {children || (\n <>\n <div>\n <h3>Cookie Consent</h3>\n <p>We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.</p>\n </div>\n <div>\n <button onClick={acceptAll} aria-label=\"Accept all cookies\">\n Accept All\n </button>\n <button onClick={rejectAll} aria-label=\"Reject non-essential cookies\">\n Reject All\n </button>\n <button onClick={openSettings} aria-label=\"Manage cookie preferences\">\n Manage Preferences\n </button>\n </div>\n </>\n )}\n </div>\n );\n};","import React, { ReactNode } from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentSettingsProps {\n className?: string;\n children?: ReactNode;\n}\n\nconst cookieCategories = [\n {\n id: 'necessary',\n name: 'Necessary Cookies',\n description: 'These cookies are essential for the website to function properly.',\n disabled: true,\n },\n {\n id: 'analytics',\n name: 'Analytics Cookies',\n description: 'These cookies help us understand how visitors interact with our website.',\n disabled: false,\n },\n {\n id: 'marketing',\n name: 'Marketing Cookies',\n description: 'These cookies are used to track visitors across websites for marketing purposes.',\n disabled: false,\n },\n {\n id: 'functional',\n name: 'Functional Cookies',\n description: 'These cookies enable personalized features and functionality.',\n disabled: false,\n },\n];\n\nexport const UnstyledConsentSettings: React.FC<UnstyledConsentSettingsProps> = ({\n className,\n children,\n}) => {\n const { showSettings, consentState, updateConsent, savePreferences, closeSettings } = useConsent();\n\n if (!showSettings) return null;\n\n const handleSave = () => {\n savePreferences(consentState);\n };\n\n return (\n <div className={className} role=\"dialog\" aria-label=\"Cookie preferences\">\n {children || (\n <>\n <div>\n <h2>Cookie Preferences</h2>\n <p>Manage your cookie preferences. You can enable or disable different categories of cookies below.</p>\n </div>\n \n <div>\n {cookieCategories.map((category) => (\n <div key={category.id}>\n <div>\n <h4>{category.name}</h4>\n <p>{category.description}</p>\n </div>\n <input\n type=\"checkbox\"\n checked={consentState[category.id as keyof typeof consentState]}\n onChange={(e) => updateConsent(category.id as keyof typeof consentState, e.target.checked)}\n disabled={category.disabled}\n aria-label={`Toggle ${category.name}`}\n />\n </div>\n ))}\n </div>\n\n <div>\n <button onClick={closeSettings} aria-label=\"Cancel changes\">\n Cancel\n </button>\n <button onClick={handleSave} aria-label=\"Save cookie preferences\">\n Save Preferences\n </button>\n </div>\n </>\n )}\n </div>\n );\n};","import React from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentToggleProps {\n category: 'analytics' | 'marketing' | 'functional';\n className?: string;\n label?: string;\n}\n\nexport const UnstyledConsentToggle: React.FC<UnstyledConsentToggleProps> = ({\n category,\n className,\n label,\n}) => {\n const { consentState, updateConsent } = useConsent();\n\n return (\n <label className={className}>\n <input\n type=\"checkbox\"\n checked={consentState[category]}\n onChange={(e) => updateConsent(category, e.target.checked)}\n aria-label={label || `Toggle ${category} cookies`}\n />\n {label && <span>{label}</span>}\n </label>\n );\n};"]}
|
|
1
|
+
{"version":3,"sources":["../src/contexts/ConsentContext.tsx","../src/components/consent/unstyled/UnstyledConsentBanner.tsx","../src/components/consent/unstyled/UnstyledConsentSettings.tsx","../src/components/consent/unstyled/UnstyledConsentToggle.tsx"],"names":["ConsentContext","createContext","useConsent","context","useContext","UnstyledConsentBanner","className","children","showBanner","acceptAll","rejectAll","openSettings","React","cookieCategories","UnstyledConsentSettings","showSettings","consentState","updateConsent","savePreferences","closeSettings","handle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yled.mjs","sourcesContent":["import React, { createContext, useContext, useState, useCallback, useEffect, ReactNode } from 'react';\n\nexport interface ConsentCategories {\n necessary: boolean;\n analytics: boolean;\n marketing: boolean;\n functional: boolean;\n [key: string]: boolean;\n}\n\nexport interface ConsentState {\n hasUserConsented: boolean;\n consentState: ConsentCategories;\n showBanner: boolean;\n showSettings: boolean;\n}\n\nexport interface ConsentActions {\n acceptAll: () => void;\n rejectAll: () => void;\n savePreferences: (preferences: Partial<ConsentCategories>) => void;\n openSettings: () => void;\n closeSettings: () => void;\n updateConsent: (category: keyof ConsentCategories, value: boolean) => void;\n}\n\nexport interface ConsentContextValue extends ConsentState, ConsentActions {}\n\nconst ConsentContext = createContext<ConsentContextValue | undefined>(undefined);\n\nexport interface ConsentProviderProps {\n children: ReactNode;\n initialConsent?: Partial<ConsentCategories>;\n onConsentChange?: (consent: ConsentCategories) => void;\n storageKey?: string;\n}\n\nconst defaultConsent: ConsentCategories = {\n necessary: true, // Always true\n analytics: false,\n marketing: false,\n functional: false,\n};\n\nexport function ConsentProvider({\n children,\n initialConsent = {},\n onConsentChange,\n storageKey = 'ndpr-consent',\n}: ConsentProviderProps) {\n const [consentState, setConsentState] = useState<ConsentCategories>(() => {\n // Try to load from localStorage\n if (typeof window !== 'undefined') {\n const stored = localStorage.getItem(storageKey);\n if (stored) {\n try {\n const parsed = JSON.parse(stored);\n return { ...defaultConsent, ...parsed };\n } catch (e) {\n console.error('Failed to parse consent from localStorage', e);\n }\n }\n }\n return { ...defaultConsent, ...initialConsent };\n });\n\n const [hasUserConsented, setHasUserConsented] = useState(() => {\n if (typeof window !== 'undefined') {\n return localStorage.getItem(`${storageKey}-set`) === 'true';\n }\n return false;\n });\n\n const [showBanner, setShowBanner] = useState(!hasUserConsented);\n const [showSettings, setShowSettings] = useState(false);\n\n // Persist consent to localStorage\n useEffect(() => {\n if (typeof window !== 'undefined' && hasUserConsented) {\n localStorage.setItem(storageKey, JSON.stringify(consentState));\n localStorage.setItem(`${storageKey}-set`, 'true');\n }\n }, [consentState, hasUserConsented, storageKey]);\n\n // Notify parent of consent changes\n useEffect(() => {\n if (hasUserConsented && onConsentChange) {\n onConsentChange(consentState);\n }\n }, [consentState, hasUserConsented, onConsentChange]);\n\n const acceptAll = useCallback(() => {\n const newConsent: ConsentCategories = {\n necessary: true,\n analytics: true,\n marketing: true,\n functional: true,\n };\n setConsentState(newConsent);\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const rejectAll = useCallback(() => {\n const newConsent: ConsentCategories = {\n necessary: true,\n analytics: false,\n marketing: false,\n functional: false,\n };\n setConsentState(newConsent);\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const savePreferences = useCallback((preferences: Partial<ConsentCategories>) => {\n setConsentState(prev => ({\n ...prev,\n ...preferences,\n necessary: true, // Always keep necessary as true\n }));\n setHasUserConsented(true);\n setShowBanner(false);\n setShowSettings(false);\n }, []);\n\n const updateConsent = useCallback((category: keyof ConsentCategories, value: boolean) => {\n if (category === 'necessary') return; // Can't change necessary cookies\n \n setConsentState(prev => ({\n ...prev,\n [category]: value,\n }));\n }, []);\n\n const openSettings = useCallback(() => {\n setShowSettings(true);\n setShowBanner(false);\n }, []);\n\n const closeSettings = useCallback(() => {\n setShowSettings(false);\n }, []);\n\n const value: ConsentContextValue = {\n hasUserConsented,\n consentState,\n showBanner,\n showSettings,\n acceptAll,\n rejectAll,\n savePreferences,\n openSettings,\n closeSettings,\n updateConsent,\n };\n\n return (\n <ConsentContext.Provider value={value}>\n {children}\n </ConsentContext.Provider>\n );\n}\n\nexport function useConsent() {\n const context = useContext(ConsentContext);\n if (!context) {\n throw new Error('useConsent must be used within a ConsentProvider');\n }\n return context;\n}\n\n// Export for external use\nexport { ConsentContext };","import React, { ReactNode } from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentBannerProps {\n className?: string;\n children?: ReactNode;\n}\n\nexport const UnstyledConsentBanner: React.FC<UnstyledConsentBannerProps> = ({\n className,\n children,\n}) => {\n const { showBanner, acceptAll, rejectAll, openSettings } = useConsent();\n\n if (!showBanner) return null;\n\n return (\n <div className={className} role=\"region\" aria-label=\"Cookie consent\">\n {children || (\n <>\n <div>\n <h3>Cookie Consent</h3>\n <p>We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.</p>\n </div>\n <div>\n <button onClick={acceptAll} aria-label=\"Accept all cookies\">\n Accept All\n </button>\n <button onClick={rejectAll} aria-label=\"Reject non-essential cookies\">\n Reject All\n </button>\n <button onClick={openSettings} aria-label=\"Manage cookie preferences\">\n Manage Preferences\n </button>\n </div>\n </>\n )}\n </div>\n );\n};","import React, { ReactNode } from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentSettingsProps {\n className?: string;\n children?: ReactNode;\n}\n\nconst cookieCategories = [\n {\n id: 'necessary',\n name: 'Necessary Cookies',\n description: 'These cookies are essential for the website to function properly.',\n disabled: true,\n },\n {\n id: 'analytics',\n name: 'Analytics Cookies',\n description: 'These cookies help us understand how visitors interact with our website.',\n disabled: false,\n },\n {\n id: 'marketing',\n name: 'Marketing Cookies',\n description: 'These cookies are used to track visitors across websites for marketing purposes.',\n disabled: false,\n },\n {\n id: 'functional',\n name: 'Functional Cookies',\n description: 'These cookies enable personalized features and functionality.',\n disabled: false,\n },\n];\n\nexport const UnstyledConsentSettings: React.FC<UnstyledConsentSettingsProps> = ({\n className,\n children,\n}) => {\n const { showSettings, consentState, updateConsent, savePreferences, closeSettings } = useConsent();\n\n if (!showSettings) return null;\n\n const handleSave = () => {\n savePreferences(consentState);\n };\n\n return (\n <div className={className} role=\"dialog\" aria-label=\"Cookie preferences\">\n {children || (\n <>\n <div>\n <h2>Cookie Preferences</h2>\n <p>Manage your cookie preferences. You can enable or disable different categories of cookies below.</p>\n </div>\n \n <div>\n {cookieCategories.map((category) => (\n <div key={category.id}>\n <div>\n <h4>{category.name}</h4>\n <p>{category.description}</p>\n </div>\n <input\n type=\"checkbox\"\n checked={consentState[category.id as keyof typeof consentState]}\n onChange={(e) => updateConsent(category.id as keyof typeof consentState, e.target.checked)}\n disabled={category.disabled}\n aria-label={`Toggle ${category.name}`}\n />\n </div>\n ))}\n </div>\n\n <div>\n <button onClick={closeSettings} aria-label=\"Cancel changes\">\n Cancel\n </button>\n <button onClick={handleSave} aria-label=\"Save cookie preferences\">\n Save Preferences\n </button>\n </div>\n </>\n )}\n </div>\n );\n};","import React from 'react';\nimport { useConsent } from '@/contexts/ConsentContext';\n\nexport interface UnstyledConsentToggleProps {\n category: 'analytics' | 'marketing' | 'functional';\n className?: string;\n label?: string;\n}\n\nexport const UnstyledConsentToggle: React.FC<UnstyledConsentToggleProps> = ({\n category,\n className,\n label,\n}) => {\n const { consentState, updateConsent } = useConsent();\n\n return (\n <label className={className}>\n <input\n type=\"checkbox\"\n checked={consentState[category]}\n onChange={(e) => updateConsent(category, e.target.checked)}\n aria-label={label || `Toggle ${category} cookies`}\n />\n {label && <span>{label}</span>}\n </label>\n );\n};"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification, N as NotificationRequirement } from './breach-BpSBPrdk.mjs';
|
|
2
|
+
|
|
3
|
+
interface UseBreachOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Available breach categories
|
|
6
|
+
*/
|
|
7
|
+
categories: BreachCategory[];
|
|
8
|
+
/**
|
|
9
|
+
* Initial breach reports
|
|
10
|
+
*/
|
|
11
|
+
initialReports?: BreachReport[];
|
|
12
|
+
/**
|
|
13
|
+
* Storage key for breach data
|
|
14
|
+
* @default "ndpr_breach_data"
|
|
15
|
+
*/
|
|
16
|
+
storageKey?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to use local storage to persist breach data
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
useLocalStorage?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Callback function called when a breach is reported
|
|
24
|
+
*/
|
|
25
|
+
onReport?: (report: BreachReport) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback function called when a risk assessment is completed
|
|
28
|
+
*/
|
|
29
|
+
onAssessment?: (assessment: RiskAssessment) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Callback function called when a notification is sent
|
|
32
|
+
*/
|
|
33
|
+
onNotification?: (notification: RegulatoryNotification) => void;
|
|
34
|
+
}
|
|
35
|
+
interface UseBreachReturn {
|
|
36
|
+
/**
|
|
37
|
+
* All breach reports
|
|
38
|
+
*/
|
|
39
|
+
reports: BreachReport[];
|
|
40
|
+
/**
|
|
41
|
+
* All risk assessments
|
|
42
|
+
*/
|
|
43
|
+
assessments: RiskAssessment[];
|
|
44
|
+
/**
|
|
45
|
+
* All regulatory notifications
|
|
46
|
+
*/
|
|
47
|
+
notifications: RegulatoryNotification[];
|
|
48
|
+
/**
|
|
49
|
+
* Submit a new breach report
|
|
50
|
+
*/
|
|
51
|
+
reportBreach: (reportData: Omit<BreachReport, 'id' | 'reportedAt'>) => BreachReport;
|
|
52
|
+
/**
|
|
53
|
+
* Update an existing breach report
|
|
54
|
+
*/
|
|
55
|
+
updateReport: (id: string, updates: Partial<BreachReport>) => BreachReport | null;
|
|
56
|
+
/**
|
|
57
|
+
* Get a breach report by ID
|
|
58
|
+
*/
|
|
59
|
+
getReport: (id: string) => BreachReport | null;
|
|
60
|
+
/**
|
|
61
|
+
* Conduct a risk assessment for a breach
|
|
62
|
+
*/
|
|
63
|
+
assessRisk: (breachId: string, assessmentData: Omit<RiskAssessment, 'id' | 'breachId' | 'assessedAt'>) => RiskAssessment;
|
|
64
|
+
/**
|
|
65
|
+
* Get a risk assessment for a breach
|
|
66
|
+
*/
|
|
67
|
+
getAssessment: (breachId: string) => RiskAssessment | null;
|
|
68
|
+
/**
|
|
69
|
+
* Calculate notification requirements based on a risk assessment
|
|
70
|
+
*/
|
|
71
|
+
calculateNotificationRequirements: (breachId: string) => NotificationRequirement | null;
|
|
72
|
+
/**
|
|
73
|
+
* Send a regulatory notification
|
|
74
|
+
*/
|
|
75
|
+
sendNotification: (breachId: string, notificationData: Omit<RegulatoryNotification, 'id' | 'breachId' | 'sentAt'>) => RegulatoryNotification;
|
|
76
|
+
/**
|
|
77
|
+
* Get a regulatory notification for a breach
|
|
78
|
+
*/
|
|
79
|
+
getNotification: (breachId: string) => RegulatoryNotification | null;
|
|
80
|
+
/**
|
|
81
|
+
* Get breaches that require notification within the next X hours
|
|
82
|
+
*/
|
|
83
|
+
getBreachesRequiringNotification: (hoursThreshold?: number) => Array<{
|
|
84
|
+
report: BreachReport;
|
|
85
|
+
assessment: RiskAssessment;
|
|
86
|
+
requirements: NotificationRequirement;
|
|
87
|
+
hoursRemaining: number;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Clear all breach data
|
|
91
|
+
*/
|
|
92
|
+
clearBreachData: () => void;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Hook for managing data breach notifications in compliance with the NDPA (Section 40)
|
|
96
|
+
*/
|
|
97
|
+
declare function useBreach({ categories, initialReports, storageKey, useLocalStorage, onReport, onAssessment, onNotification }: UseBreachOptions): UseBreachReturn;
|
|
98
|
+
|
|
99
|
+
export { useBreach as u };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { a as BreachCategory, B as BreachReport, R as RiskAssessment, b as RegulatoryNotification, N as NotificationRequirement } from './breach-BpSBPrdk.js';
|
|
2
|
+
|
|
3
|
+
interface UseBreachOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Available breach categories
|
|
6
|
+
*/
|
|
7
|
+
categories: BreachCategory[];
|
|
8
|
+
/**
|
|
9
|
+
* Initial breach reports
|
|
10
|
+
*/
|
|
11
|
+
initialReports?: BreachReport[];
|
|
12
|
+
/**
|
|
13
|
+
* Storage key for breach data
|
|
14
|
+
* @default "ndpr_breach_data"
|
|
15
|
+
*/
|
|
16
|
+
storageKey?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to use local storage to persist breach data
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
useLocalStorage?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Callback function called when a breach is reported
|
|
24
|
+
*/
|
|
25
|
+
onReport?: (report: BreachReport) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback function called when a risk assessment is completed
|
|
28
|
+
*/
|
|
29
|
+
onAssessment?: (assessment: RiskAssessment) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Callback function called when a notification is sent
|
|
32
|
+
*/
|
|
33
|
+
onNotification?: (notification: RegulatoryNotification) => void;
|
|
34
|
+
}
|
|
35
|
+
interface UseBreachReturn {
|
|
36
|
+
/**
|
|
37
|
+
* All breach reports
|
|
38
|
+
*/
|
|
39
|
+
reports: BreachReport[];
|
|
40
|
+
/**
|
|
41
|
+
* All risk assessments
|
|
42
|
+
*/
|
|
43
|
+
assessments: RiskAssessment[];
|
|
44
|
+
/**
|
|
45
|
+
* All regulatory notifications
|
|
46
|
+
*/
|
|
47
|
+
notifications: RegulatoryNotification[];
|
|
48
|
+
/**
|
|
49
|
+
* Submit a new breach report
|
|
50
|
+
*/
|
|
51
|
+
reportBreach: (reportData: Omit<BreachReport, 'id' | 'reportedAt'>) => BreachReport;
|
|
52
|
+
/**
|
|
53
|
+
* Update an existing breach report
|
|
54
|
+
*/
|
|
55
|
+
updateReport: (id: string, updates: Partial<BreachReport>) => BreachReport | null;
|
|
56
|
+
/**
|
|
57
|
+
* Get a breach report by ID
|
|
58
|
+
*/
|
|
59
|
+
getReport: (id: string) => BreachReport | null;
|
|
60
|
+
/**
|
|
61
|
+
* Conduct a risk assessment for a breach
|
|
62
|
+
*/
|
|
63
|
+
assessRisk: (breachId: string, assessmentData: Omit<RiskAssessment, 'id' | 'breachId' | 'assessedAt'>) => RiskAssessment;
|
|
64
|
+
/**
|
|
65
|
+
* Get a risk assessment for a breach
|
|
66
|
+
*/
|
|
67
|
+
getAssessment: (breachId: string) => RiskAssessment | null;
|
|
68
|
+
/**
|
|
69
|
+
* Calculate notification requirements based on a risk assessment
|
|
70
|
+
*/
|
|
71
|
+
calculateNotificationRequirements: (breachId: string) => NotificationRequirement | null;
|
|
72
|
+
/**
|
|
73
|
+
* Send a regulatory notification
|
|
74
|
+
*/
|
|
75
|
+
sendNotification: (breachId: string, notificationData: Omit<RegulatoryNotification, 'id' | 'breachId' | 'sentAt'>) => RegulatoryNotification;
|
|
76
|
+
/**
|
|
77
|
+
* Get a regulatory notification for a breach
|
|
78
|
+
*/
|
|
79
|
+
getNotification: (breachId: string) => RegulatoryNotification | null;
|
|
80
|
+
/**
|
|
81
|
+
* Get breaches that require notification within the next X hours
|
|
82
|
+
*/
|
|
83
|
+
getBreachesRequiringNotification: (hoursThreshold?: number) => Array<{
|
|
84
|
+
report: BreachReport;
|
|
85
|
+
assessment: RiskAssessment;
|
|
86
|
+
requirements: NotificationRequirement;
|
|
87
|
+
hoursRemaining: number;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Clear all breach data
|
|
91
|
+
*/
|
|
92
|
+
clearBreachData: () => void;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Hook for managing data breach notifications in compliance with the NDPA (Section 40)
|
|
96
|
+
*/
|
|
97
|
+
declare function useBreach({ categories, initialReports, storageKey, useLocalStorage, onReport, onAssessment, onNotification }: UseBreachOptions): UseBreachReturn;
|
|
98
|
+
|
|
99
|
+
export { useBreach as u };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { C as ConsentOption, b as ConsentStorageOptions, a as ConsentSettings } from './consent-CmVzqZUk.js';
|
|
2
|
+
|
|
3
|
+
interface UseConsentOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Consent options to present to the user
|
|
6
|
+
*/
|
|
7
|
+
options: ConsentOption[];
|
|
8
|
+
/**
|
|
9
|
+
* Storage options for consent settings
|
|
10
|
+
*/
|
|
11
|
+
storageOptions?: ConsentStorageOptions;
|
|
12
|
+
/**
|
|
13
|
+
* Version of the consent form
|
|
14
|
+
* @default "1.0"
|
|
15
|
+
*/
|
|
16
|
+
version?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Callback function called when consent settings change
|
|
19
|
+
*/
|
|
20
|
+
onChange?: (settings: ConsentSettings) => void;
|
|
21
|
+
}
|
|
22
|
+
interface UseConsentReturn {
|
|
23
|
+
/**
|
|
24
|
+
* Current consent settings
|
|
25
|
+
*/
|
|
26
|
+
settings: ConsentSettings | null;
|
|
27
|
+
/**
|
|
28
|
+
* Whether consent has been given for a specific option
|
|
29
|
+
*/
|
|
30
|
+
hasConsent: (optionId: string) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Update consent settings
|
|
33
|
+
*/
|
|
34
|
+
updateConsent: (consents: Record<string, boolean>) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Accept all consent options
|
|
37
|
+
*/
|
|
38
|
+
acceptAll: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Reject all non-required consent options
|
|
41
|
+
*/
|
|
42
|
+
rejectAll: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the consent banner should be shown
|
|
45
|
+
*/
|
|
46
|
+
shouldShowBanner: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether consent settings are valid
|
|
49
|
+
*/
|
|
50
|
+
isValid: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Validation errors (if any)
|
|
53
|
+
*/
|
|
54
|
+
validationErrors: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Reset consent settings (clear from storage)
|
|
57
|
+
*/
|
|
58
|
+
resetConsent: () => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Hook for managing user consent in compliance with NDPA
|
|
62
|
+
*/
|
|
63
|
+
declare function useConsent({ options, storageOptions, version, onChange }: UseConsentOptions): UseConsentReturn;
|
|
64
|
+
|
|
65
|
+
export { useConsent as u };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { C as ConsentOption, b as ConsentStorageOptions, a as ConsentSettings } from './consent-CmVzqZUk.mjs';
|
|
2
|
+
|
|
3
|
+
interface UseConsentOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Consent options to present to the user
|
|
6
|
+
*/
|
|
7
|
+
options: ConsentOption[];
|
|
8
|
+
/**
|
|
9
|
+
* Storage options for consent settings
|
|
10
|
+
*/
|
|
11
|
+
storageOptions?: ConsentStorageOptions;
|
|
12
|
+
/**
|
|
13
|
+
* Version of the consent form
|
|
14
|
+
* @default "1.0"
|
|
15
|
+
*/
|
|
16
|
+
version?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Callback function called when consent settings change
|
|
19
|
+
*/
|
|
20
|
+
onChange?: (settings: ConsentSettings) => void;
|
|
21
|
+
}
|
|
22
|
+
interface UseConsentReturn {
|
|
23
|
+
/**
|
|
24
|
+
* Current consent settings
|
|
25
|
+
*/
|
|
26
|
+
settings: ConsentSettings | null;
|
|
27
|
+
/**
|
|
28
|
+
* Whether consent has been given for a specific option
|
|
29
|
+
*/
|
|
30
|
+
hasConsent: (optionId: string) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Update consent settings
|
|
33
|
+
*/
|
|
34
|
+
updateConsent: (consents: Record<string, boolean>) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Accept all consent options
|
|
37
|
+
*/
|
|
38
|
+
acceptAll: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Reject all non-required consent options
|
|
41
|
+
*/
|
|
42
|
+
rejectAll: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the consent banner should be shown
|
|
45
|
+
*/
|
|
46
|
+
shouldShowBanner: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether consent settings are valid
|
|
49
|
+
*/
|
|
50
|
+
isValid: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Validation errors (if any)
|
|
53
|
+
*/
|
|
54
|
+
validationErrors: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Reset consent settings (clear from storage)
|
|
57
|
+
*/
|
|
58
|
+
resetConsent: () => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Hook for managing user consent in compliance with NDPA
|
|
62
|
+
*/
|
|
63
|
+
declare function useConsent({ options, storageOptions, version, onChange }: UseConsentOptions): UseConsentReturn;
|
|
64
|
+
|
|
65
|
+
export { useConsent as u };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { C as CrossBorderTransfer, b as CrossBorderSummary, d as TransferValidationResult } from './cross-border-BrIy1ieh.js';
|
|
2
|
+
|
|
3
|
+
interface UseCrossBorderTransferOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Initial transfers to load
|
|
6
|
+
*/
|
|
7
|
+
initialTransfers?: CrossBorderTransfer[];
|
|
8
|
+
/**
|
|
9
|
+
* Storage key for transfer data
|
|
10
|
+
* @default "ndpr_cross_border_transfers"
|
|
11
|
+
*/
|
|
12
|
+
storageKey?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to use local storage to persist transfers
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
useLocalStorage?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Callback function called when a transfer is added
|
|
20
|
+
*/
|
|
21
|
+
onAdd?: (transfer: CrossBorderTransfer) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Callback function called when a transfer is updated
|
|
24
|
+
*/
|
|
25
|
+
onUpdate?: (transfer: CrossBorderTransfer) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback function called when a transfer is removed
|
|
28
|
+
*/
|
|
29
|
+
onRemove?: (id: string) => void;
|
|
30
|
+
}
|
|
31
|
+
interface UseCrossBorderTransferReturn {
|
|
32
|
+
/**
|
|
33
|
+
* All cross-border transfers
|
|
34
|
+
*/
|
|
35
|
+
transfers: CrossBorderTransfer[];
|
|
36
|
+
/**
|
|
37
|
+
* Add a new cross-border transfer
|
|
38
|
+
*/
|
|
39
|
+
addTransfer: (transfer: Omit<CrossBorderTransfer, 'id' | 'createdAt' | 'updatedAt'>) => CrossBorderTransfer;
|
|
40
|
+
/**
|
|
41
|
+
* Update an existing cross-border transfer
|
|
42
|
+
*/
|
|
43
|
+
updateTransfer: (id: string, updates: Partial<CrossBorderTransfer>) => CrossBorderTransfer | null;
|
|
44
|
+
/**
|
|
45
|
+
* Remove a cross-border transfer
|
|
46
|
+
*/
|
|
47
|
+
removeTransfer: (id: string) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get a cross-border transfer by ID
|
|
50
|
+
*/
|
|
51
|
+
getTransfer: (id: string) => CrossBorderTransfer | null;
|
|
52
|
+
/**
|
|
53
|
+
* Get a compliance summary of all cross-border transfers
|
|
54
|
+
*/
|
|
55
|
+
getSummary: () => CrossBorderSummary;
|
|
56
|
+
/**
|
|
57
|
+
* Validate a cross-border transfer
|
|
58
|
+
*/
|
|
59
|
+
validateTransfer: (transfer: CrossBorderTransfer) => TransferValidationResult;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Hook for managing cross-border data transfers in compliance with NDPA Part VI (Sections 41-45)
|
|
63
|
+
*/
|
|
64
|
+
declare function useCrossBorderTransfer({ initialTransfers, storageKey, useLocalStorage, onAdd, onUpdate, onRemove, }?: UseCrossBorderTransferOptions): UseCrossBorderTransferReturn;
|
|
65
|
+
|
|
66
|
+
export { useCrossBorderTransfer as u };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { C as CrossBorderTransfer, b as CrossBorderSummary, d as TransferValidationResult } from './cross-border-BrIy1ieh.mjs';
|
|
2
|
+
|
|
3
|
+
interface UseCrossBorderTransferOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Initial transfers to load
|
|
6
|
+
*/
|
|
7
|
+
initialTransfers?: CrossBorderTransfer[];
|
|
8
|
+
/**
|
|
9
|
+
* Storage key for transfer data
|
|
10
|
+
* @default "ndpr_cross_border_transfers"
|
|
11
|
+
*/
|
|
12
|
+
storageKey?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to use local storage to persist transfers
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
useLocalStorage?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Callback function called when a transfer is added
|
|
20
|
+
*/
|
|
21
|
+
onAdd?: (transfer: CrossBorderTransfer) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Callback function called when a transfer is updated
|
|
24
|
+
*/
|
|
25
|
+
onUpdate?: (transfer: CrossBorderTransfer) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Callback function called when a transfer is removed
|
|
28
|
+
*/
|
|
29
|
+
onRemove?: (id: string) => void;
|
|
30
|
+
}
|
|
31
|
+
interface UseCrossBorderTransferReturn {
|
|
32
|
+
/**
|
|
33
|
+
* All cross-border transfers
|
|
34
|
+
*/
|
|
35
|
+
transfers: CrossBorderTransfer[];
|
|
36
|
+
/**
|
|
37
|
+
* Add a new cross-border transfer
|
|
38
|
+
*/
|
|
39
|
+
addTransfer: (transfer: Omit<CrossBorderTransfer, 'id' | 'createdAt' | 'updatedAt'>) => CrossBorderTransfer;
|
|
40
|
+
/**
|
|
41
|
+
* Update an existing cross-border transfer
|
|
42
|
+
*/
|
|
43
|
+
updateTransfer: (id: string, updates: Partial<CrossBorderTransfer>) => CrossBorderTransfer | null;
|
|
44
|
+
/**
|
|
45
|
+
* Remove a cross-border transfer
|
|
46
|
+
*/
|
|
47
|
+
removeTransfer: (id: string) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get a cross-border transfer by ID
|
|
50
|
+
*/
|
|
51
|
+
getTransfer: (id: string) => CrossBorderTransfer | null;
|
|
52
|
+
/**
|
|
53
|
+
* Get a compliance summary of all cross-border transfers
|
|
54
|
+
*/
|
|
55
|
+
getSummary: () => CrossBorderSummary;
|
|
56
|
+
/**
|
|
57
|
+
* Validate a cross-border transfer
|
|
58
|
+
*/
|
|
59
|
+
validateTransfer: (transfer: CrossBorderTransfer) => TransferValidationResult;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Hook for managing cross-border data transfers in compliance with NDPA Part VI (Sections 41-45)
|
|
63
|
+
*/
|
|
64
|
+
declare function useCrossBorderTransfer({ initialTransfers, storageKey, useLocalStorage, onAdd, onUpdate, onRemove, }?: UseCrossBorderTransferOptions): UseCrossBorderTransferReturn;
|
|
65
|
+
|
|
66
|
+
export { useCrossBorderTransfer as u };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { a as DPIASection, b as DPIAResult, D as DPIAQuestion } from './dpia-vWfE_9bO.js';
|
|
2
|
+
|
|
3
|
+
interface UseDPIAOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Sections of the DPIA questionnaire
|
|
6
|
+
*/
|
|
7
|
+
sections: DPIASection[];
|
|
8
|
+
/**
|
|
9
|
+
* Initial answers (if resuming a DPIA)
|
|
10
|
+
*/
|
|
11
|
+
initialAnswers?: Record<string, any>;
|
|
12
|
+
/**
|
|
13
|
+
* Storage key for DPIA data
|
|
14
|
+
* @default "ndpr_dpia_data"
|
|
15
|
+
*/
|
|
16
|
+
storageKey?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to use local storage to persist DPIA data
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
useLocalStorage?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Callback function called when the DPIA is completed
|
|
24
|
+
*/
|
|
25
|
+
onComplete?: (result: DPIAResult) => void;
|
|
26
|
+
}
|
|
27
|
+
interface UseDPIAReturn {
|
|
28
|
+
/**
|
|
29
|
+
* Current section index
|
|
30
|
+
*/
|
|
31
|
+
currentSectionIndex: number;
|
|
32
|
+
/**
|
|
33
|
+
* Current section
|
|
34
|
+
*/
|
|
35
|
+
currentSection: DPIASection | null;
|
|
36
|
+
/**
|
|
37
|
+
* All answers
|
|
38
|
+
*/
|
|
39
|
+
answers: Record<string, any>;
|
|
40
|
+
/**
|
|
41
|
+
* Update an answer
|
|
42
|
+
*/
|
|
43
|
+
updateAnswer: (questionId: string, value: any) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Go to the next section
|
|
46
|
+
*/
|
|
47
|
+
nextSection: () => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Go to the previous section
|
|
50
|
+
*/
|
|
51
|
+
prevSection: () => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Go to a specific section
|
|
54
|
+
*/
|
|
55
|
+
goToSection: (index: number) => boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Check if the current section is valid
|
|
58
|
+
*/
|
|
59
|
+
isCurrentSectionValid: () => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Get validation errors for the current section
|
|
62
|
+
*/
|
|
63
|
+
getCurrentSectionErrors: () => Record<string, string>;
|
|
64
|
+
/**
|
|
65
|
+
* Check if the DPIA is complete
|
|
66
|
+
*/
|
|
67
|
+
isComplete: () => boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Complete the DPIA and generate a result
|
|
70
|
+
*/
|
|
71
|
+
completeDPIA: (assessorInfo: {
|
|
72
|
+
name: string;
|
|
73
|
+
role: string;
|
|
74
|
+
email: string;
|
|
75
|
+
}, title: string, processingDescription: string) => DPIAResult;
|
|
76
|
+
/**
|
|
77
|
+
* Get the visible questions for the current section
|
|
78
|
+
*/
|
|
79
|
+
getVisibleQuestions: () => DPIAQuestion[];
|
|
80
|
+
/**
|
|
81
|
+
* Reset the DPIA
|
|
82
|
+
*/
|
|
83
|
+
resetDPIA: () => void;
|
|
84
|
+
/**
|
|
85
|
+
* Progress percentage
|
|
86
|
+
*/
|
|
87
|
+
progress: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Hook for conducting Data Protection Impact Assessments in compliance with the NDPA 2023
|
|
91
|
+
*/
|
|
92
|
+
declare function useDPIA({ sections, initialAnswers, storageKey, useLocalStorage, onComplete }: UseDPIAOptions): UseDPIAReturn;
|
|
93
|
+
|
|
94
|
+
export { useDPIA as u };
|