@tantainnovative/ndpr-toolkit 3.3.1 → 3.4.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 +529 -0
- package/dist/{ConsentBanner-CDRT0o2k.d.mts → ConsentBanner-F5ayys5K.d.mts} +10 -0
- package/dist/{ConsentBanner-Vxyt8SCX.d.ts → ConsentBanner-VqIPophc.d.ts} +10 -0
- package/dist/{styling-B7CBzYG7.d.ts → ConsentManager-C7I3PDe8.d.mts} +2 -62
- package/dist/{styling-uJLsBbER.d.mts → ConsentManager-CQ2IZtUU.d.ts} +2 -62
- package/dist/{sanitize-B0AzEm1D.d.mts → NDPRProvider-DYFb8xEl.d.ts} +2 -94
- package/dist/{sanitize-B0AzEm1D.d.ts → NDPRProvider-U3QNu6MA.d.mts} +2 -94
- package/dist/adapters.js +1 -1
- package/dist/adapters.mjs +1 -1
- package/dist/breach.js +1 -1
- package/dist/breach.mjs +1 -1
- package/dist/chunk-2WH4DLV5.js +3 -0
- package/dist/chunk-3NQQSU4P.js +2 -0
- package/dist/chunk-3VQAYQR7.js +7 -0
- package/dist/chunk-4R42ZNO7.mjs +318 -0
- package/dist/chunk-5HL4UBFV.js +2 -0
- package/dist/chunk-6HZL2WDU.mjs +2 -0
- package/dist/chunk-6QPRDQZF.js +2 -0
- package/dist/chunk-74Z23WUA.mjs +2 -0
- package/dist/chunk-AHSMDPG5.js +132 -0
- package/dist/chunk-BN77GP4W.mjs +2 -0
- package/dist/chunk-C5QO3SX4.js +2 -0
- package/dist/chunk-CISJAQ6W.mjs +2 -0
- package/dist/chunk-DUY6F3GT.mjs +94 -0
- package/dist/chunk-EHAZIKDX.js +81 -0
- package/dist/chunk-EPT2K355.mjs +2 -0
- package/dist/chunk-HGGLW5TE.js +2 -0
- package/dist/chunk-HQSU7LGM.js +94 -0
- package/dist/chunk-IZCWCE7W.mjs +2 -0
- package/dist/chunk-JBSCER34.js +2 -0
- package/dist/chunk-KF3EFJEF.mjs +3 -0
- package/dist/chunk-KSERBMXW.mjs +4 -0
- package/dist/chunk-LJNNPAFU.mjs +2 -0
- package/dist/{chunk-UXMGBIX6.js → chunk-LSCMXAPY.mjs} +4 -4
- package/dist/chunk-LSNL4XR5.js +2 -0
- package/dist/chunk-MG73MOZC.mjs +15 -0
- package/dist/chunk-NCOZB2WU.mjs +2 -0
- package/dist/chunk-NQNFS3QI.js +7 -0
- package/dist/{chunk-ZEOQYWOE.mjs → chunk-P2YV6DR3.js} +4 -4
- package/dist/chunk-P6QAFBCV.js +2 -0
- package/dist/chunk-QVULSG6J.mjs +3 -0
- package/dist/chunk-R5FW5XUQ.mjs +2 -0
- package/dist/chunk-RGNP45VR.js +2 -0
- package/dist/chunk-RLYTX3MM.js +2 -0
- package/dist/chunk-RNTNHVKZ.js +15 -0
- package/dist/chunk-RRVKUCFR.mjs +2 -0
- package/dist/chunk-RXL6CZAI.js +2 -0
- package/dist/chunk-RY3PGVLZ.mjs +2 -0
- package/dist/chunk-SUEGUY35.js +2 -0
- package/dist/chunk-SYMQJO2W.mjs +7 -0
- package/dist/chunk-TCN22KYP.mjs +7 -0
- package/dist/chunk-UFPSUO52.js +318 -0
- package/dist/chunk-VTITKWGX.mjs +2 -0
- package/dist/chunk-WH6ZMUOS.mjs +81 -0
- package/dist/chunk-WTJGLNTB.js +3 -0
- package/dist/chunk-XHROISIF.mjs +2 -0
- package/dist/chunk-XMBSJJ5U.js +4 -0
- package/dist/chunk-ZLSWOFAY.mjs +132 -0
- package/dist/chunk-ZPKVLTSX.js +2 -0
- package/dist/consent.d.mts +6 -4
- package/dist/consent.d.ts +6 -4
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.d.mts +6 -29
- package/dist/core.d.ts +6 -29
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/cross-border.js +1 -1
- package/dist/cross-border.mjs +1 -1
- package/dist/docx-BxKascXN.d.ts +64 -0
- package/dist/docx-CV7Vsry_.d.mts +64 -0
- package/dist/dpia.js +1 -1
- package/dist/dpia.mjs +1 -1
- package/dist/dsr.js +1 -1
- package/dist/dsr.mjs +1 -1
- package/dist/hooks.d.mts +3 -3
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis.js +1 -1
- package/dist/lawful-basis.mjs +1 -1
- package/dist/locale-CxJx2tzn.d.mts +25 -0
- package/dist/locale-DSkrtf-c.d.ts +25 -0
- package/dist/{policy-engine-C6nC2t3a.d.ts → policy-engine-CCUCud2T.d.ts} +1 -1
- package/dist/{policy-engine-DefZcX3R.d.mts → policy-engine-fYSqEqSW.d.mts} +1 -1
- package/dist/{policy-sections-DFDPVCCg.d.ts → policy-sections-BYx6fEFk.d.ts} +4 -2
- package/dist/{policy-sections-Bylm31kZ.d.mts → policy-sections-Dm97Nq8m.d.mts} +4 -2
- package/dist/{policy-templates-CIKcV0i1.d.ts → policy-templates-DhLwq4R-.d.ts} +8 -1
- package/dist/{policy-templates-DMsPwOSZ.d.mts → policy-templates-DwYl2329.d.mts} +8 -1
- package/dist/policy.d.mts +36 -71
- package/dist/policy.d.ts +36 -71
- package/dist/policy.js +1 -1
- package/dist/policy.mjs +1 -1
- package/dist/presets.d.mts +2 -2
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/dist/sanitize-CxxwKxAx.d.mts +94 -0
- package/dist/sanitize-CxxwKxAx.d.ts +94 -0
- package/dist/server.d.mts +24 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.js +2 -0
- package/dist/server.mjs +2 -0
- package/dist/styles.css +1423 -31
- package/dist/styling-BMDGQDgS.d.mts +64 -0
- package/dist/styling-BaoQtV06.d.ts +64 -0
- package/dist/unstyled.d.mts +52 -19
- package/dist/unstyled.d.ts +52 -19
- package/dist/unstyled.js +1 -1
- package/dist/unstyled.mjs +1 -1
- package/dist/{useAdaptivePolicyWizard-A1PyOy6P.d.mts → useAdaptivePolicyWizard-BnjW4OR4.d.mts} +1 -1
- package/dist/{useAdaptivePolicyWizard-LVIKhAxw.d.ts → useAdaptivePolicyWizard-sb3m4-Zk.d.ts} +1 -1
- package/dist/{useDefaultPrivacyPolicy-ySWU7nc-.d.mts → useDefaultPrivacyPolicy-Cs2WQSYQ.d.mts} +30 -9
- package/dist/{useDefaultPrivacyPolicy-DvCbeEl1.d.ts → useDefaultPrivacyPolicy-DkOqMg2e.d.ts} +30 -9
- package/package.json +14 -2
- package/dist/chunk-25OOUES4.js +0 -2
- package/dist/chunk-4JKTIR33.mjs +0 -2
- package/dist/chunk-5BUS6AI7.js +0 -2
- package/dist/chunk-5ECDPRSZ.js +0 -7
- package/dist/chunk-6YN73KR7.mjs +0 -2
- package/dist/chunk-CDZDT2OS.mjs +0 -320
- package/dist/chunk-CWUPGY3M.mjs +0 -3
- package/dist/chunk-CYU6YUJQ.mjs +0 -81
- package/dist/chunk-EKHBORAH.js +0 -81
- package/dist/chunk-ENIMJ6SQ.js +0 -2
- package/dist/chunk-FLKJSGR7.mjs +0 -94
- package/dist/chunk-FWLPJ5YI.js +0 -94
- package/dist/chunk-GCQRHMTQ.mjs +0 -144
- package/dist/chunk-GMLCWGNJ.js +0 -7
- package/dist/chunk-GXLSOZCH.mjs +0 -2
- package/dist/chunk-LETEUS5X.mjs +0 -2
- package/dist/chunk-LU4PFST7.js +0 -144
- package/dist/chunk-NBSVFQ5G.js +0 -2
- package/dist/chunk-OYR3L4XS.mjs +0 -7
- package/dist/chunk-QF6XNKU6.mjs +0 -2
- package/dist/chunk-QJ3JNHO7.js +0 -2
- package/dist/chunk-QNCGRCAX.mjs +0 -2
- package/dist/chunk-SAA7UVI2.js +0 -3
- package/dist/chunk-TI2M7H6R.mjs +0 -7
- package/dist/chunk-TXXWCB5O.js +0 -320
- package/dist/chunk-UGY5ZYUG.js +0 -2
- package/dist/chunk-UO6QPJLH.js +0 -2
- package/dist/chunk-UX6ZZNEM.mjs +0 -3
- package/dist/chunk-XFUEZ3MP.mjs +0 -2
- package/dist/chunk-XHSHPB74.js +0 -2
- package/dist/chunk-YCX6BFOQ.js +0 -2
- package/dist/chunk-YURSF2YO.mjs +0 -2
- package/dist/chunk-YZXUAIYN.js +0 -3
- package/dist/chunk-ZT7KNFAU.mjs +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {d,c,a as a$1,b as b$1}from'./chunk-TXBZPCGF.mjs';import {a as a$2}from'./chunk-AYKLAEOU.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useState,useMemo,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var q={name:"",description:"",lawfulBasis:"consent",lawfulBasisJustification:"",dataCategories:"",involvesSensitiveData:false,sensitiveDataCondition:"",dataSubjectCategories:"",purposes:"",retentionPeriod:"",retentionJustification:"",recipients:"",crossBorderTransfer:false,reviewDate:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""},Q=[{value:"consent",label:"Consent"},{value:"contract",label:"Contract"},{value:"legal_obligation",label:"Legal Obligation"},{value:"vital_interests",label:"Vital Interests"},{value:"public_interest",label:"Public Interest"},{value:"legitimate_interests",label:"Legitimate Interests"}],X=[{value:"explicit_consent",label:"Explicit Consent"},{value:"employment_law",label:"Employment Law"},{value:"vital_interests_incapable",label:"Vital Interests (Incapable)"},{value:"nonprofit_legitimate",label:"Nonprofit Legitimate Activities"},{value:"publicly_available",label:"Publicly Available Data"},{value:"legal_claims",label:"Legal Claims"},{value:"substantial_public_interest",label:"Substantial Public Interest"},{value:"health_purposes",label:"Health Purposes"},{value:"public_health",label:"Public Health"},{value:"archiving_research",label:"Archiving / Research"}],ye=({activities:g,onAddActivity:L,onUpdateActivity:F,onArchiveActivity:I,title:Z="Lawful Basis Tracker",description:ee="Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25.",className:te="",buttonClassName:m="",showSummary:ie=true,showComplianceGaps:re=true,classNames:i,unstyled:o})=>{let[x,f]=useState("list"),[a$3,w]=useState(q),[b$2,j]=useState(null),[J,ae]=useState(null),[A,ne]=useState("all"),[B,oe]=useState("all"),[S,de]=useState(""),[c$1,C]=useState([]),V=useMemo(()=>{let e=[...g];if(A!=="all"&&(e=e.filter(l=>l.status===A)),B!=="all"&&(e=e.filter(l=>l.lawfulBasis===B)),S){let l=S.toLowerCase();e=e.filter(p=>p.name.toLowerCase().includes(l)||p.description.toLowerCase().includes(l)||p.purposes.some(N=>N.toLowerCase().includes(l)));}return e.sort((l,p)=>p.updatedAt-l.updatedAt),e},[g,A,B,S]),y=useCallback(e=>new Date(e).toLocaleDateString(),[]),P=useMemo(()=>d(g),[g]),h=useMemo(()=>c(g),[g]),D=useCallback(e=>e.split(",").map(l=>l.trim()).filter(l=>l.length>0),[]),le=useCallback(()=>{w(q),j(null),C([]),f("form");},[]),M=useCallback(e=>{w({name:e.name,description:e.description,lawfulBasis:e.lawfulBasis,lawfulBasisJustification:e.lawfulBasisJustification,dataCategories:e.dataCategories.join(", "),involvesSensitiveData:e.involvesSensitiveData,sensitiveDataCondition:e.sensitiveDataCondition||"",dataSubjectCategories:e.dataSubjectCategories.join(", "),purposes:e.purposes.join(", "),retentionPeriod:e.retentionPeriod,retentionJustification:e.retentionJustification||"",recipients:(e.recipients||[]).join(", "),crossBorderTransfer:e.crossBorderTransfer,reviewDate:e.reviewDate?new Date(e.reviewDate).toISOString().split("T")[0]:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""}),j(e.id),C([]),f("form");},[]),se=useCallback(()=>{let e={name:a$3.name,description:a$3.description,lawfulBasis:a$3.lawfulBasis,lawfulBasisJustification:a$3.lawfulBasisJustification,dataCategories:D(a$3.dataCategories),involvesSensitiveData:a$3.involvesSensitiveData,sensitiveDataCondition:a$3.sensitiveDataCondition||void 0,dataSubjectCategories:D(a$3.dataSubjectCategories),purposes:D(a$3.purposes),retentionPeriod:a$3.retentionPeriod,retentionJustification:a$3.retentionJustification||void 0,recipients:a$3.recipients?D(a$3.recipients):void 0,crossBorderTransfer:a$3.crossBorderTransfer,reviewDate:a$3.reviewDate?new Date(a$3.reviewDate).getTime():void 0,status:"active"},l=b(a({},e),{id:b$2||"temp",createdAt:Date.now(),updatedAt:Date.now()}),p=a$1(l);if(!p.isValid){C(p.errors);return}b$2&&F?F(b$2,e):L&&L(e),w(q),j(null),C([]),f("list");},[a$3,b$2,F,L,D]),G=useCallback(e=>{I&&I(e);},[I]),pe=useCallback(e=>{ae(e),f("detail");},[]),n=useMemo(()=>J?g.find(e=>e.id===J):null,[g,J]),H=useCallback(e=>{let l={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--neutral",under_review:"ndpr-badge ndpr-badge--warning",archived:"ndpr-badge ndpr-badge--destructive"},p={active:"Active",inactive:"Inactive",under_review:"Under Review",archived:"Archived"};return jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${l[e]}`,i==null?void 0:i.statusBadge,o),children:p[e]})},[i==null?void 0:i.statusBadge,o]),U=useCallback(e=>{let l={consent:"ndpr-badge ndpr-badge--info",contract:"ndpr-badge ndpr-badge--info",legal_obligation:"ndpr-badge ndpr-badge--info",vital_interests:"ndpr-badge ndpr-badge--destructive",public_interest:"ndpr-badge ndpr-badge--warning",legitimate_interests:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},p={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${l[e]}`,children:p[e]})},[]),Y=useCallback(e=>e.dpoApproval?e.dpoApproval.approved?jsx("span",{className:"ndpr-badge ndpr-badge--success",children:"Approved"}):jsx("span",{className:"ndpr-badge ndpr-badge--warning",children:"Pending Approval"}):jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400",children:"No DPO Review"}),[]),ue=()=>jsxs("div",{"data-ndpr-component":"lawful-basis-tracker",className:a$2("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.summary,o),role:"status","aria-label":"Compliance summary",children:[jsxs("div",{className:a$2("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,o),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:P.totalActivities}),jsx("p",{className:"text-sm ndpr-text-info",children:"Total Activities"})]}),jsxs("div",{className:a$2("bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg",i==null?void 0:i.summaryCard,o),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:P.sensitiveDataActivities}),jsx("p",{className:"text-sm ndpr-text-warning",children:"Sensitive Data"})]}),jsxs("div",{className:a$2("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,o),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:P.crossBorderActivities}),jsx("p",{className:"text-sm ndpr-text-info",children:"Cross-Border Transfers"})]}),jsxs("div",{className:a$2("ndpr-alert ndpr-alert--destructive",i==null?void 0:i.summaryCard,o),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:P.activitiesWithoutApproval.length}),jsx("p",{className:"text-sm ndpr-text-destructive",children:"Pending Approval"})]})]}),R=useMemo(()=>h.filter(e=>e.severity==="high"),[h]),E=useMemo(()=>h.filter(e=>e.severity==="medium"),[h]),ce=()=>h.length===0?jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg mb-6",role:"status","aria-label":"No compliance gaps",children:[jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"No compliance gaps detected."}),jsx("p",{className:"text-xs ndpr-text-success mt-1",children:"All processing activities appear to be properly documented."})]}):jsxs("div",{className:"mb-6",role:"status","aria-label":`${h.length} compliance gaps detected`,children:[R.length>0&&jsxs("div",{className:a$2("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-3",i==null?void 0:i.gapAlert,o),children:[jsxs("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:["High Priority (",R.length,")"]}),jsx("ul",{className:"space-y-1",children:R.map((e,l)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:e.description},l))})]}),E.length>0&&jsxs("div",{className:a$2("ndpr-alert ndpr-alert--warning",i==null?void 0:i.gapAlert,o),children:[jsxs("p",{className:"text-sm ndpr-text-warning font-medium mb-2",children:["Medium Priority (",E.length,")"]}),jsx("ul",{className:"space-y-1",children:E.map((e,l)=>jsx("li",{className:"text-xs ndpr-text-warning",children:e.description},l))})]})]}),W=useCallback(()=>{f("list"),C([]);},[]),ge=useCallback(()=>{f("list");},[]),s=useCallback((e,l)=>{w(p=>b(a({},p),{[e]:l}));},[]),ve=useCallback(e=>{w(l=>b(a({},l),{involvesSensitiveData:e,sensitiveDataCondition:e?l.sensitiveDataCondition:""}));},[]),me=()=>jsxs("div",{className:a$2("",i==null?void 0:i.form,o),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",i==null?void 0:i.header,o),children:[jsx("h3",{className:"ndpr-section-heading",children:b$2?"Edit Processing Activity":"New Processing Activity"}),jsx("button",{onClick:W,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"})]}),c$1.length>0&&jsxs("div",{id:"form-errors",className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-4",role:"alert",children:[jsx("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:"Please correct the following errors:"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:c$1.map((e,l)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:e},l))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("label",{htmlFor:"activityName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"activityName",value:a$3.name,onChange:e=>s("name",e.target.value),placeholder:"e.g., Customer Account Management","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"activityDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"activityDescription",value:a$3.description,onChange:e=>s("description",e.target.value),placeholder:"Describe what processing is performed...",rows:3,"aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis (NDPA Section 25) *"}),jsx("select",{id:"lawfulBasis",value:a$3.lawfulBasis,onChange:e=>s("lawfulBasis",e.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,o),children:Q.map(e=>jsx("option",{value:e.value,children:e.label},e.value))}),jsx("p",{className:"mt-1 text-xs ndpr-text-muted",children:b$1(a$3.lawfulBasis)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:"Lawful Basis Justification *"}),jsx("textarea",{id:"justification",value:a$3.lawfulBasisJustification,onChange:e=>s("lawfulBasisJustification",e.target.value),placeholder:"Document why this lawful basis applies to this processing activity...",rows:3,"aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),a$3.lawfulBasis==="legitimate_interests"&&jsxs("div",{className:"border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 bg-indigo-50 dark:bg-indigo-900/20",children:[jsx("h4",{className:"text-sm font-semibold text-indigo-800 dark:text-indigo-200 mb-3",children:"Legitimate Interest Assessment (LIA)"}),jsx("p",{className:"text-xs text-indigo-600 dark:text-indigo-300 mb-4",children:"NDPA Section 25(1)(f) requires a balancing test when relying on legitimate interests."}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("label",{htmlFor:"liaPurpose",className:"ndpr-form-field__label",children:"Purpose Test"}),jsx("textarea",{id:"liaPurpose",value:a$3.liaPurposeTest,onChange:e=>s("liaPurposeTest",e.target.value),placeholder:"Describe the legitimate interest being pursued...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaNecessity",className:"ndpr-form-field__label",children:"Necessity Test"}),jsx("textarea",{id:"liaNecessity",value:a$3.liaNecessityTest,onChange:e=>s("liaNecessityTest",e.target.value),placeholder:"Explain why this processing is necessary for the stated purpose...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaBalancing",className:"ndpr-form-field__label",children:"Balancing Test"}),jsx("textarea",{id:"liaBalancing",value:a$3.liaBalancingTest,onChange:e=>s("liaBalancingTest",e.target.value),placeholder:"Assess the impact on data subjects' rights and interests...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaSafeguards",className:"ndpr-form-field__label",children:"Safeguards"}),jsx("input",{type:"text",id:"liaSafeguards",value:a$3.liaSafeguards,onChange:e=>s("liaSafeguards",e.target.value),placeholder:"List safeguards (comma-separated)...",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaConclusion",className:"ndpr-form-field__label",children:"Conclusion"}),jsx("textarea",{id:"liaConclusion",value:a$3.liaConclusion,onChange:e=>s("liaConclusion",e.target.value),placeholder:"State your overall conclusion...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories *"}),jsx("input",{type:"text",id:"dataCategories",value:a$3.dataCategories,onChange:e=>s("dataCategories",e.target.value),placeholder:"e.g., Name, Email, Phone Number (comma-separated)","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.involvesSensitiveData,onChange:e=>ve(e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Sensitive Personal Data (NDPA Section 27)"})]})}),a$3.involvesSensitiveData&&jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveCondition",className:"ndpr-form-field__label",children:"Sensitive Data Condition (NDPA Section 27) *"}),jsxs("select",{id:"sensitiveCondition",value:a$3.sensitiveDataCondition,onChange:e=>s("sensitiveDataCondition",e.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,o),children:[jsx("option",{value:"",children:"Select a condition..."}),X.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSubjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories *"}),jsx("input",{type:"text",id:"dataSubjectCategories",value:a$3.dataSubjectCategories,onChange:e=>s("dataSubjectCategories",e.target.value),placeholder:"e.g., Customers, Employees, Vendors (comma-separated)","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Processing Purposes *"}),jsx("input",{type:"text",id:"purposes",value:a$3.purposes,onChange:e=>s("purposes",e.target.value),placeholder:"e.g., Account management, Service delivery (comma-separated)","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:a$3.retentionPeriod,onChange:e=>s("retentionPeriod",e.target.value),placeholder:"e.g., 3 years after account closure","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:a$3.retentionJustification,onChange:e=>s("retentionJustification",e.target.value),placeholder:"Reason for the retention period",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients"}),jsx("input",{type:"text",id:"recipients",value:a$3.recipients,onChange:e=>s("recipients",e.target.value),placeholder:"e.g., Payment processor, Cloud provider (comma-separated)",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.crossBorderTransfer,onChange:e=>s("crossBorderTransfer",e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Cross-Border Transfer Outside Nigeria"})]})}),jsxs("div",{children:[jsx("label",{htmlFor:"reviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"reviewDate",value:a$3.reviewDate,onChange:e=>s("reviewDate",e.target.value),className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[jsx("button",{onClick:W,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"}),jsx("button",{onClick:se,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),o),children:b$2?"Update Activity":"Create Activity"})]})]})]}),fe=()=>{var l;if(!n)return jsx("div",{className:"ndpr-empty-state",children:jsx("p",{className:"ndpr-card__subtitle",children:"Activity not found."})});let e=a$1(n);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxs("div",{children:[jsx("button",{onClick:ge,className:"text-sm ndpr-text-primary hover:underline mb-2","aria-label":"Back to activities list",children:"Back to list"}),jsx("h3",{className:"ndpr-section-heading",children:n.name})]}),jsxs("div",{className:"ndpr-card__footer",children:[U(n.lawfulBasis),H(n.status),Y(n)]})]}),e.warnings.length>0&&jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md mb-4",children:[jsx("p",{className:"text-sm ndpr-text-warning font-medium mb-1",children:"Warnings"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:e.warnings.map((p,N)=>jsx("li",{className:"text-xs ndpr-text-warning",children:p},N))})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Description:"})," ",n.description]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Lawful Basis:"})," ",b$1(n.lawfulBasis)]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Justification:"})," ",n.lawfulBasisJustification]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Categories:"})," ",n.dataCategories.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Data Subject Categories:"})," ",n.dataSubjectCategories.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Purposes:"})," ",n.purposes.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Retention Period:"})," ",n.retentionPeriod,n.retentionJustification&&jsxs("span",{className:"ndpr-card__subtitle",children:[" ","(",n.retentionJustification,")"]})]})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",n.involvesSensitiveData?"Yes":"No",n.sensitiveDataCondition&&jsxs("span",{children:[" ","(Condition:"," ",((l=X.find(p=>p.value===n.sensitiveDataCondition))==null?void 0:l.label)||n.sensitiveDataCondition,")"]})]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Cross-Border Transfer:"})," ",n.crossBorderTransfer?"Yes":"No"]}),n.recipients&&n.recipients.length>0&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Recipients:"})," ",n.recipients.join(", ")]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Created:"})," ",y(n.createdAt)]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Last Updated:"})," ",y(n.updatedAt)]}),n.reviewDate&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Next Review:"})," ",y(n.reviewDate),n.reviewDate<Date.now()&&jsx("span",{className:"ndpr-text-destructive font-medium",children:" (Overdue)"})]})]})]}),n.dpoApproval&&jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-6",children:[jsx("h4",{className:"ndpr-section-heading",children:"DPO Approval"}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",n.dpoApproval.approved?"Approved":"Not Approved"]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Approved By:"})," ",n.dpoApproval.approvedBy]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Date:"})," ",y(n.dpoApproval.approvedAt)]}),n.dpoApproval.notes&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Notes:"})," ",n.dpoApproval.notes]})]}),jsxs("div",{className:"flex space-x-3",children:[jsx("button",{onClick:()=>M(n),"aria-label":`Edit ${n.name}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,children:"Edit"}),n.status!=="archived"&&jsx("button",{onClick:()=>G(n.id),"aria-label":`Archive ${n.name}`,className:`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 ${m}`,children:"Archive"})]})]})},be=()=>jsxs("div",{children:[jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"basisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"basisFilter",value:B,onChange:e=>oe(e.target.value),"aria-label":"Filter by lawful basis",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,o),children:[jsx("option",{value:"all",children:"All Bases"}),Q.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"statusFilterSelect",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"statusFilterSelect",value:A,onChange:e=>ne(e.target.value),"aria-label":"Filter by status",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,o),children:[jsx("option",{value:"all",children:"All Statuses"}),jsx("option",{value:"active",children:"Active"}),jsx("option",{value:"inactive",children:"Inactive"}),jsx("option",{value:"under_review",children:"Under Review"}),jsx("option",{value:"archived",children:"Archived"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchInput",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"searchInput",value:S,onChange:e=>de(e.target.value),placeholder:"Search activities...",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,o)})]}),jsx("div",{className:"flex items-end",children:jsx("button",{onClick:le,className:a$2(`w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),o),children:"Add Activity"})})]}),V.length===0?jsx("div",{className:"flex items-center justify-center h-32 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"ndpr-card__subtitle",children:"No processing activities found."})}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",i==null?void 0:i.table,o),children:[jsx("thead",{className:a$2("ndpr-table__head",i==null?void 0:i.tableHeader,o),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Activity"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"DPO Approval"}),jsx("th",{className:"ndpr-table__cell",children:"Sensitive Data"}),jsx("th",{className:"ndpr-table__cell",children:"Last Updated"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:V.map(e=>jsxs("tr",{className:a$2("border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",i==null?void 0:i.tableRow,o),children:[jsxs("td",{className:"ndpr-table__cell",children:[jsx("button",{onClick:()=>pe(e.id),className:"font-medium ndpr-text-primary hover:underline text-left",children:e.name}),jsx("p",{className:"text-xs ndpr-text-muted mt-1 truncate max-w-xs",children:e.description})]}),jsx("td",{className:"ndpr-table__cell",children:U(e.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:H(e.status)}),jsx("td",{className:"ndpr-table__cell",children:Y(e)}),jsx("td",{className:"ndpr-table__cell",children:jsx("span",{className:`text-xs ${e.involvesSensitiveData?"ndpr-text-warning font-medium":"ndpr-card__subtitle"}`,children:e.involvesSensitiveData?"Yes":"No"})}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:y(e.updatedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>M(e),"aria-label":`Edit ${e.name}`,className:"text-xs ndpr-text-primary hover:underline",children:"Edit"}),e.status!=="archived"&&jsx("button",{onClick:()=>G(e.id),"aria-label":`Archive ${e.name}`,className:"text-xs ndpr-text-muted hover:underline",children:"Archive"})]})})]},e.id))})]})})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${te}`,i==null?void 0:i.root,o),children:[jsx("h2",{className:a$2("ndpr-section-heading",i==null?void 0:i.title,o),children:Z}),jsx("p",{className:"ndpr-card__subtitle",children:ee}),ie&&x==="list"&&ue(),re&&x==="list"&&ce(),x==="list"&&be(),x==="form"&&me(),x==="detail"&&fe()]})};export{ye as a};//# sourceMappingURL=chunk-CISJAQ6W.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-CISJAQ6W.mjs.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {c,d,b as b$1}from'./chunk-LSCMXAPY.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {d as d$1,b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useId,useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var ye=({sections:_=c,variables:U=d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=useId(),[A,n]=useState(_),[i,s]=useState(U),[m,$]=useState("sections"),[S,X]=useState(""),[F,R]=useState(""),[J,Z]=useState(false),[v,I]=useState({});useEffect(()=>{n(_);},[_]),useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?b(a$1({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(b$1=>b$1.id===l?b(a$1({},b$1),{value:c}):b$1)),v[l]&&I(a=>{let b=a$1({},a);return delete b[l],b});},j=()=>{let l={},c=true;return i.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=A.filter(b=>b.included),c=Object.fromEntries(i.map(b=>[b.name,b.value])),a="";l.forEach(b=>{a+=`## ${b.title}
|
|
2
|
+
|
|
3
|
+
`,a+=b$1(b.template,c),a+=`
|
|
4
|
+
|
|
5
|
+
`;}),X(a),R(a),Z(true),$("preview");},h=()=>{L({sections:A,variables:i,content:N?F:S});},g=()=>jsxs("div",{"data-ndpr-component":"policy-generator",className:a("ndpr-form-section",r==null?void 0:r.sectionList,x),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsx("h3",{id:`${P}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),A.map(l=>{let c=`${P}-section-${l.id}`,a$1=l.description?`${P}-section-desc-${l.id}`:void 0;return jsx("div",{className:a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,x),children:jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":a$1,className:a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",r==null?void 0:r.input,x)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[l.title," ",l.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsx("p",{id:a$1,className:"ndpr-text-muted mt-1",children:l.description})]})]})},l.id)}),jsx("div",{className:"mt-6",children:jsx("button",{onClick:()=>$("variables"),className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return i.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxs("div",{className:a("",r==null?void 0:r.form,x),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsx("div",{className:"ndpr-form-section",children:Object.entries(l).map(([c,a$1])=>{let b=A.find(e=>e.id===c);return b&&!b.included?null:jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsx("h4",{className:"font-medium text-lg mb-3",children:b?b.title:"General Information"}),jsx("div",{className:"ndpr-form-section",children:a$1.map(e=>{let y=`${P}-var-${e.id}`,u=e.description?`${P}-var-desc-${e.id}`:void 0,z=v[e.id]?`${P}-var-err-${e.id}`:void 0,O=[u,z].filter(Boolean).join(" ")||void 0;return jsxs("div",{children:[jsxs("label",{htmlFor:y,className:"ndpr-form-field__label",children:[e.name," ",e.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsx("p",{id:u,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsx("textarea",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),rows:4,className:a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxs("select",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),className:a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0,children:[jsx("option",{value:"",children:"Select an option"}),e.options.map(E=>jsx("option",{value:E,children:E},E))]}):jsx("input",{id:y,type:e.inputType,value:e.value,onChange:E=>W(e.id,E.target.value),className:a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}),v[e.id]&&jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:v[e.id]})]},e.id)})})]},c)})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Sections"}),jsx("button",{onClick:ee,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxs("div",{children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),N?jsxs("div",{className:"ndpr-form-field",children:[jsx("label",{htmlFor:l,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsx("textarea",{id:l,value:F,onChange:c=>R(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsx("div",{className:"prose dark:prose-invert max-w-none",children:S.split(`
|
|
6
|
+
`).map((c,a)=>c.startsWith("## ")?jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},a):c.startsWith("### ")?jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},a):c===""?jsx("br",{},a):jsx("p",{className:"mb-2",children:c},a))})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Variables"}),jsx("button",{onClick:h,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${K}`,r==null?void 0:r.root,x),children:[jsxs("div",{className:a("mb-6",r==null?void 0:r.header,x),children:[jsx("h2",{className:a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsx("p",{className:a("ndpr-card__subtitle",r==null?void 0:r.description,x),children:V})]}),jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxs("ol",{className:"flex items-center w-full",children:[jsxs("li",{className:`flex w-full items-center ${m==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="sections"?"step":void 0,children:"1"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsx("span",{className:"sr-only",children:m==="sections"?" (current step)":""})]}),jsxs("li",{className:`flex w-full items-center ${m==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="variables"?"step":void 0,children:"2"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsx("span",{className:"sr-only",children:m==="variables"?" (current step)":""})]}),jsxs("li",{className:`flex items-center ${m==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="preview"?"step":void 0,children:"3"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsx("span",{className:"sr-only",children:m==="preview"?" (current step)":""})]})]})}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",r==null?void 0:r.complianceNotice,x),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),q()]})};var _e=({content:_,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:A,lastUpdated:n,classNames:i,unstyled:s=false})=>{let m=useId(),[$,S]=useState("preview"),X=`${m}-tab-preview`,F=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,v=(()=>{let h=_.split(`
|
|
7
|
+
`),g=[];return h.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=h=>{if(M)M(h);else if(h==="markdown"){let g=document.createElement("a"),w=new Blob([_],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||v.length===0?null:jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsx("ul",{className:"space-y-1",children:v.map((h,g)=>jsx("li",{style:{marginLeft:`${(h.level-2)*1.5}rem`},children:jsx("a",{href:`#${h.id}`,className:"ndpr-text-primary hover:underline",children:h.title})},g))})]}),W=()=>P?jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsx("h1",{className:"ndpr-card__title",children:A?`${A} Privacy Policy`:"Privacy Policy"}),jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",n?n.toLocaleDateString():"N/A"]})]}):null,j=()=>jsx("div",{className:a("prose dark:prose-invert max-w-none",i==null?void 0:i.sectionContent,s),children:_.split(`
|
|
8
|
+
`).map((h,g)=>{if(h.startsWith("## ")){let w=h.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h3",{id:C,className:a("text-xl font-bold mt-6 mb-3",i==null?void 0:i.sectionTitle,s),children:w},g)}else if(h.startsWith("### ")){let w=h.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h4",{id:C,className:a("text-lg font-bold mt-4 mb-2",i==null?void 0:i.sectionTitle,s),children:w},g)}else return h===""?jsx("br",{},g):jsx("p",{className:"mb-2",children:h},g)})}),ee=()=>N?jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>I("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as PDF"}),jsx("button",{onClick:()=>I("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as DOCX"}),jsx("button",{onClick:()=>I("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as HTML"}),jsx("button",{onClick:()=>I("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as Markdown"})]})]}):null;return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,i==null?void 0:i.root,s),children:[jsxs("div",{className:a("flex justify-between items-start mb-6",i==null?void 0:i.header,s),children:[jsxs("div",{children:[jsx("h2",{className:a("ndpr-section-heading",i==null?void 0:i.title,s),children:K}),jsx("p",{className:a("ndpr-card__subtitle",i==null?void 0:i.description,s),children:T})]}),r&&V&&jsx("button",{onClick:V,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${B}`,children:"Edit Policy"})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",i==null?void 0:i.complianceNotice,s),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:X,"aria-selected":$==="preview","aria-controls":R,onClick:()=>S("preview"),className:`inline-block p-4 ${$==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:F,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsx("div",{className:a("bg-white dark:bg-gray-800 p-4 rounded-md",i==null?void 0:i.content,s),children:$==="preview"?jsxs("div",{role:"tabpanel",id:R,"aria-labelledby":X,"aria-live":"polite",children:[W(),G(),jsx("div",{className:a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",i==null?void 0:i.section,s),children:j()})]}):jsx("div",{role:"tabpanel",id:J,"aria-labelledby":F,children:jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:_})})}),ee()]})};var Ae=({content:_,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:A,classNames:n,unstyled:i=false})=>{let s=useId(),[m,$]=useState([]),[S,X]=useState("pdf"),[F,R]=useState(false),[J,Z]=useState(null),[v,I]=useState(""),[G,W]=useState(""),[j,ee]=useState(""),[h,g]=useState(false),w=e=>{let y=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${y}.${e.toLowerCase()}`},C=e=>v?v.endsWith(`.${e.toLowerCase()}`)?v:`${v}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,y=M?M.toLocaleDateString():"N/A",u=`<!DOCTYPE html>
|
|
9
|
+
<html lang="en">
|
|
10
|
+
<head>
|
|
11
|
+
<meta charset="UTF-8">
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
13
|
+
<title>${e}</title>
|
|
14
|
+
<style>
|
|
15
|
+
body {
|
|
16
|
+
font-family: Arial, sans-serif;
|
|
17
|
+
line-height: 1.6;
|
|
18
|
+
color: #333;
|
|
19
|
+
max-width: 800px;
|
|
20
|
+
margin: 0 auto;
|
|
21
|
+
padding: 20px;
|
|
22
|
+
}
|
|
23
|
+
h1 {
|
|
24
|
+
font-size: 24px;
|
|
25
|
+
margin-bottom: 10px;
|
|
26
|
+
}
|
|
27
|
+
h2 {
|
|
28
|
+
font-size: 20px;
|
|
29
|
+
margin-top: 30px;
|
|
30
|
+
margin-bottom: 10px;
|
|
31
|
+
border-bottom: 1px solid #eee;
|
|
32
|
+
padding-bottom: 5px;
|
|
33
|
+
}
|
|
34
|
+
h3 {
|
|
35
|
+
font-size: 18px;
|
|
36
|
+
margin-top: 20px;
|
|
37
|
+
margin-bottom: 10px;
|
|
38
|
+
}
|
|
39
|
+
p {
|
|
40
|
+
margin-bottom: 15px;
|
|
41
|
+
}
|
|
42
|
+
.header {
|
|
43
|
+
text-align: center;
|
|
44
|
+
margin-bottom: 30px;
|
|
45
|
+
}
|
|
46
|
+
.footer {
|
|
47
|
+
margin-top: 50px;
|
|
48
|
+
text-align: center;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
color: #666;
|
|
51
|
+
border-top: 1px solid #eee;
|
|
52
|
+
padding-top: 20px;
|
|
53
|
+
}
|
|
54
|
+
.logo {
|
|
55
|
+
max-width: 200px;
|
|
56
|
+
margin-bottom: 20px;
|
|
57
|
+
}
|
|
58
|
+
.last-updated {
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
color: #666;
|
|
61
|
+
margin-bottom: 30px;
|
|
62
|
+
}
|
|
63
|
+
.compliance-notice {
|
|
64
|
+
background-color: #f8f9fa;
|
|
65
|
+
border: 1px solid #e9ecef;
|
|
66
|
+
padding: 15px;
|
|
67
|
+
margin-bottom: 30px;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
}
|
|
70
|
+
${A||""}
|
|
71
|
+
</style>
|
|
72
|
+
</head>
|
|
73
|
+
<body>
|
|
74
|
+
<div class="header">
|
|
75
|
+
${x&&P?`<img src="${P}" alt="${L||"Company"} Logo" class="logo">`:""}
|
|
76
|
+
${G?`<div class="custom-header">${G}</div>`:""}
|
|
77
|
+
<h1>${e}</h1>
|
|
78
|
+
<div class="last-updated">Last Updated: ${y}</div>
|
|
79
|
+
</div>`;r&&(u+=`
|
|
80
|
+
<div class="compliance-notice">
|
|
81
|
+
<strong>NDPA Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Act (NDPA) 2023.
|
|
82
|
+
It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPA requirements.
|
|
83
|
+
</div>`);let z=_.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return u+=`
|
|
84
|
+
<div class="content">
|
|
85
|
+
<p>${z}</p>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<div class="footer">
|
|
89
|
+
${j?`<div class="custom-footer">${j}</div>`:""}
|
|
90
|
+
<p>© ${new Date().getFullYear()} ${L||"Company"}. All rights reserved.</p>
|
|
91
|
+
</div>
|
|
92
|
+
</body>
|
|
93
|
+
</html>`,u},l=()=>d$1(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),y="",u;switch(e){case "pdf":let te=q();u=new Blob([te],{type:"text/html"}),y=URL.createObjectURL(u);break;case "docx":u=new Blob([_],{type:"text/plain"}),y=URL.createObjectURL(u);break;case "html":let pe=q();u=new Blob([pe],{type:"text/html"}),y=URL.createObjectURL(u);break;default:u=new Blob([_],{type:"text/markdown"}),y=URL.createObjectURL(u);break}let z=C(e),O=document.createElement("a");O.href=y,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let E={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:y,filename:z};$(te=>[E,...te]),V&&V(e,y);}catch(e){console.error("[ndpr-toolkit] Export error:",e),Z("An error occurred during export. Please try again.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],y=`${s}-export-format`;return jsxs("div",{"data-ndpr-component":"policy-exporter",className:a("mb-6",n==null?void 0:n.formatSelector,i),children:[jsx("label",{htmlFor:y,className:"ndpr-form-field__label",children:"Export Format"}),jsx("select",{id:y,value:S,onChange:u=>X(u.target.value),className:a("ndpr-form-field__input",n==null?void 0:n.formatOption,i),children:e.map(u=>jsx("option",{value:u.value,children:u.label},u.value))})]})},a$1=()=>h?jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsx("input",{type:"text",id:`${s}-custom-filename`,value:v,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxs("div",{className:"ml-3 text-sm",children:[jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),b=()=>!N||m.length===0?null:jsxs("div",{className:a("mt-6",n==null?void 0:n.preview,i),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxs("tr",{children:[jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,i),children:[jsxs("div",{className:a("mb-6",n==null?void 0:n.header,i),children:[jsx("h2",{className:a("ndpr-section-heading",n==null?void 0:n.title,i),children:K}),jsx("p",{className:a("ndpr-card__subtitle",n==null?void 0:n.description,i),children:T})]}),c(),a$1(),jsxs("div",{className:"mb-6",children:[jsx("button",{onClick:l,disabled:F,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${B} ${F?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),i),children:F?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,i),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),b()]})};export{ye as a,_e as b,Ae as c};//# sourceMappingURL=chunk-DUY6F3GT.mjs.map
|
|
94
|
+
//# sourceMappingURL=chunk-DUY6F3GT.mjs.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';var chunkBKRETVJ6_js=require('./chunk-BKRETVJ6.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var xe=({breachData:u,initialAssessment:f={},onComplete:y,title:J="Breach Risk Assessment",description:K="Assess the risk level of this data breach to determine notification requirements under NDPA Section 40.",submitButtonText:Z="Complete Assessment",className:se="",buttonClassName:Q="",classNames:b={},unstyled:o=false,showBreachSummary:l=true,showNotificationRequirements:C=true})=>{let[$,ae]=react.useState(f.confidentialityImpact||3),[B,h]=react.useState(f.integrityImpact||3),[_,S]=react.useState(f.availabilityImpact||3),[L,I]=react.useState(f.harmLikelihood||3),[j,T]=react.useState(f.harmSeverity||3),[O,q]=react.useState(f.risksToRightsAndFreedoms!==void 0?f.risksToRightsAndFreedoms:false),[U,H]=react.useState(f.highRisksToRightsAndFreedoms!==void 0?f.highRisksToRightsAndFreedoms:false),[X,ie]=react.useState(f.justification||""),[V,ne]=react.useState(0),[k,g]=react.useState("low"),[x,N]=react.useState(false),[R,z]=react.useState(0),[E,ee]=react.useState(0),[p,w]=react.useState(false),[M]=react.useState(()=>Date.now());react.useEffect(()=>{let W=$*.2+B*.1+_*.1+L*.3+j*.3;ne(Number(W.toFixed(1)));let Y;W<2?Y="low":W<3?Y="medium":W<4?Y="high":Y="critical",g(Y),N(O||Y==="high"||Y==="critical");let de=u.discoveredAt+4320*60*1e3;z(de);let pe=Date.now(),ue=(de-pe)/(3600*1e3);ee(Number(ue.toFixed(1)));},[$,B,_,L,j,O,u.discoveredAt]);let P=d=>new Date(d).toLocaleString(),a=d=>{d.preventDefault();let D={id:f.id||`assessment_${Date.now()}`,breachId:u.id,assessedAt:Date.now(),assessor:f.assessor||{name:"Assessment User",role:"Data Protection Officer",email:"dpo@example.com"},confidentialityImpact:$,integrityImpact:B,availabilityImpact:_,harmLikelihood:L,harmSeverity:j,overallRiskScore:V,riskLevel:k,risksToRightsAndFreedoms:O,highRisksToRightsAndFreedoms:U,justification:X};y(D),w(true);},m=d=>{switch(d){case 1:return "Minimal";case 2:return "Low";case 3:return "Moderate";case 4:return "High";case 5:return "Severe";default:return "Unknown"}},v=d=>jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[d]}`,b.riskBadge,o),children:d.charAt(0).toUpperCase()+d.slice(1)});return jsxRuntime.jsxs("div",{"data-ndpr-component":"breach-risk-assessment",className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${se}`,b.root,o),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",b.title,o),children:J}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:K}),l&&jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-2",children:"Breach Summary"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Title:"})," ",u.title]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Discovered:"})," ",P(u.discoveredAt)]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Status:"})," ",u.status.charAt(0).toUpperCase()+u.status.slice(1)]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Types:"})," ",u.dataTypes.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",u.affectedSystems.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",u.estimatedAffectedSubjects||"Unknown"]})]})]})]}),p?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Assessment Results"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Overall Risk Level:"})," ",v(k)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risk Score:"})," ",V," / 5"]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Assessed On:"})," ",P(M)]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",O?"Yes":"No"]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",U?"Yes":"No"]})]})]}),jsxRuntime.jsxs("div",{className:"mt-3",children:[jsxRuntime.jsx("p",{className:"text-sm mb-1",children:jsxRuntime.jsx("span",{className:"font-medium",children:"Justification:"})}),jsxRuntime.jsx("p",{className:"text-sm bg-white dark:bg-gray-800 p-2 rounded",children:X})]})]}),C&&jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`mb-6 p-4 rounded-md ${x?E>24?"ndpr-alert ndpr-alert--warning":"ndpr-alert ndpr-alert--destructive":"ndpr-alert ndpr-alert--success"}`,b.notificationStatus,o),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Requirements"}),x?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:`text-sm font-bold mb-2 ${E>24?"ndpr-text-warning":"ndpr-text-destructive"}`,children:"NDPC Notification Required"}),jsxRuntime.jsx("p",{className:"text-sm mb-2",children:"Under the NDPA (Section 40), this breach must be reported to the NDPC within 72 hours of discovery."}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Notification Deadline:"})," ",P(R)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Time Remaining:"})," ",jsxRuntime.jsx("span",{className:E<24?"ndpr-text-destructive font-bold":"",children:E>0?`${E} hours`:"Deadline passed"})]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Subject Notification:"})," ",U?"Required (NDPA Section 40(4))":"Not required unless directed by NDPC"]})]}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-bold mb-2 ndpr-text-success",children:"NDPC Notification Not Required"}),jsxRuntime.jsx("p",{className:"text-sm mb-2",children:"Based on this assessment, this breach does not need to be reported to the NDPC."}),jsxRuntime.jsx("p",{className:"text-sm mb-2",children:"However, the breach should still be documented internally for compliance purposes."})]}),jsxRuntime.jsxs("div",{className:"mt-3 text-sm",children:[jsxRuntime.jsx("p",{className:"font-medium",children:"Next Steps:"}),jsxRuntime.jsx("ul",{className:"list-disc pl-5 mt-1",children:x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("li",{children:"Prepare a notification report for the NDPC"}),jsxRuntime.jsx("li",{children:"Document all aspects of the breach and your response"}),U&&jsxRuntime.jsx("li",{children:"Prepare communications for affected data subjects"}),jsxRuntime.jsx("li",{children:"Implement measures to mitigate the impact of the breach"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("li",{children:"Document the breach and this assessment in your internal records"}),jsxRuntime.jsx("li",{children:"Implement measures to prevent similar breaches in the future"}),jsxRuntime.jsx("li",{children:"Review and update security measures as needed"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>w(false),className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${Q}`,b.primaryButton||b.submitButton,o),children:"Edit Assessment"})]}):jsxRuntime.jsx("form",{onSubmit:a,children:jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Impact Assessment"}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"confidentialityImpact",className:"ndpr-form-field__label",children:["Confidentiality Impact (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the confidentiality of data been compromised?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"confidentialityImpact",min:"1",max:"5",step:"1",value:$,onChange:d=>ae(parseInt(d.target.value)),className:chunkE64TU6IU_js.a("ndpr-form-field__range",b.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[m($)," (",$,")"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"integrityImpact",className:"ndpr-form-field__label",children:["Integrity Impact (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the integrity of data been compromised?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"integrityImpact",min:"1",max:"5",step:"1",value:B,onChange:d=>h(parseInt(d.target.value)),className:chunkE64TU6IU_js.a("ndpr-form-field__range",b.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(B)," (",B,")"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"availabilityImpact",className:"ndpr-form-field__label",children:["Availability Impact (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the availability of data or systems been compromised?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"availabilityImpact",min:"1",max:"5",step:"1",value:_,onChange:d=>S(parseInt(d.target.value)),className:chunkE64TU6IU_js.a("ndpr-form-field__range",b.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(_)," (",_,")"]})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Risk to Data Subjects"}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"harmLikelihood",className:"ndpr-form-field__label",children:["Likelihood of Harm (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How likely is it that data subjects will experience harm?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"harmLikelihood",min:"1",max:"5",step:"1",value:L,onChange:d=>I(parseInt(d.target.value)),className:chunkE64TU6IU_js.a("ndpr-form-field__range",b.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(L)," (",L,")"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"harmSeverity",className:"ndpr-form-field__label",children:["Severity of Harm (1-5)",jsxRuntime.jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How severe would the harm be to affected data subjects?"})]}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"range",id:"harmSeverity",min:"1",max:"5",step:"1",value:j,onChange:d=>T(parseInt(d.target.value)),className:chunkE64TU6IU_js.a("ndpr-form-field__range",b.slider,o)}),jsxRuntime.jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(j)," (",j,")"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"risksToRightsAndFreedoms",checked:O,onChange:d=>q(d.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:"risksToRightsAndFreedoms",className:"ml-2 text-sm font-medium",children:"This breach poses a risk to the rights and freedoms of data subjects"})]}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted ml-6",children:"Under the NDPA (Section 40), breaches that pose a risk to rights and freedoms must be reported to the NDPC within 72 hours."})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"highRisksToRightsAndFreedoms",checked:U,onChange:d=>H(d.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:"highRisksToRightsAndFreedoms",className:"ml-2 text-sm font-medium",children:"This breach poses a high risk to the rights and freedoms of data subjects"})]}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted ml-6",children:"Under the NDPA (Section 40(4)), breaches that pose a high risk to rights and freedoms also require notification to affected data subjects without undue delay."})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Overall Assessment"}),jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Overall Risk Score:"}),jsxRuntime.jsxs("span",{className:chunkE64TU6IU_js.a("",b.riskScore,o),children:[V," / 5"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risk Level:"}),v(k)]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:["Justification for Assessment ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"justification",value:X,onChange:d=>ie(d.target.value),rows:4,placeholder:"Explain the reasoning behind your assessment, including any factors that influenced your decision.",className:"ndpr-form-field__input",required:true})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. This assessment will determine if notification is required for this breach."})]}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{type:"submit",className:chunkE64TU6IU_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${Q}`,b.primaryButton||b.submitButton,o),children:Z})})]})})]})};var Se=({breachReports:u,riskAssessments:f,regulatoryNotifications:y,onSelectBreach:J,onRequestAssessment:K,onRequestNotification:Z,title:se="Breach Notification Manager",description:Q="Manage data breach notifications and track compliance with NDPA Section 40 requirements.",className:b="",buttonClassName:o="",classNames:l={},unstyled:C=false,showBreachDetails:$=true,showNotificationTimeline:ae=true,showDeadlineAlerts:B=true})=>{var P;let[h,_]=react.useState(null),[S,L]=react.useState(u),[I,j]=react.useState("all"),[T,O]=react.useState(""),[q,U]=react.useState("discoveredAt"),[H,X]=react.useState("desc");react.useEffect(()=>{let a=[...u];if(I!=="all"&&(a=a.filter(m=>m.status===I)),T){let m=T.toLowerCase();a=a.filter(v=>v.title.toLowerCase().includes(m)||v.description.toLowerCase().includes(m)||v.affectedSystems.some(d=>d.toLowerCase().includes(m))||v.dataTypes.some(d=>d.toLowerCase().includes(m)));}a.sort((m,v)=>{let d=0;switch(q){case "title":d=m.title.localeCompare(v.title);break;case "discoveredAt":d=m.discoveredAt-v.discoveredAt;break;case "status":d=m.status.localeCompare(v.status);break;case "riskLevel":let D=f.find(W=>W.breachId===m.id),F=f.find(W=>W.breachId===v.id),re=(D==null?void 0:D.riskLevel)||"unknown",oe=(F==null?void 0:F.riskLevel)||"unknown";d=re.localeCompare(oe);break;default:d=m.discoveredAt-v.discoveredAt;}return H==="asc"?d:-d}),L(a);},[u,I,T,q,H,f]),react.useEffect(()=>{S.length>0&&(h&&S.some(m=>m.id===h)||_(S[0].id));},[S,h]);let ie=a=>{_(a),J&&J(a);},V=()=>{h&&K&&K(h);},ne=()=>{h&&Z&&Z(h);},k=a=>new Date(a).toLocaleString(),g=h?u.find(a=>a.id===h):null,x=h?f.find(a=>a.breachId===h):null,N=h?y.find(a=>a.breachId===h):null,R=g?z(g,x):null;function z(a,m){let v=chunkBKRETVJ6_js.a(a,m||void 0),d=a.discoveredAt+v.timeframeHours*60*60*1e3;return {ndpcNotificationRequired:v.notificationRequired,ndpcNotificationDeadline:d,dataSubjectNotificationRequired:(m==null?void 0:m.highRisksToRightsAndFreedoms)||false,justification:v.justification}}function E(a){let m=Date.now(),v=(a-m)/(3600*1e3);return Number(v.toFixed(1))}let ee=a=>a?jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[a]}`,l.statusBadge,C),children:a.charAt(0).toUpperCase()+a.slice(1)}):null,p=a=>jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a(`px-2 py-1 rounded text-xs font-medium ${{ongoing:"ndpr-badge ndpr-badge--destructive",contained:"ndpr-badge ndpr-badge--warning",resolved:"ndpr-badge ndpr-badge--success"}[a]||"ndpr-badge ndpr-badge--neutral"}`,l.statusBadge,C),children:a.charAt(0).toUpperCase()+a.slice(1)}),w=()=>{if(!g||!R)return null;if(!R.ndpcNotificationRequired)return jsxRuntime.jsxs("div",{"data-ndpr-component":"breach-notification-manager",className:"ndpr-alert ndpr-alert--success",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"Notification Not Required"}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-success mt-1",children:"Based on the risk assessment, NDPC notification is not required for this breach."})]});if(N)return jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"Notification Sent"}),jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-success mt-1",children:["Notification was sent to the NDPC on ",k(N.sentAt),"."]})]});let a=E(R.ndpcNotificationDeadline);return a<=0?jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive font-medium",children:"Notification Deadline Passed"}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-destructive mt-1",children:"The 72-hour deadline for NDPC notification has passed. Notification should be sent immediately."})]}):a<=24?jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive font-medium",children:"Urgent: Notification Due Soon"}),jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["Only ",a," hours remaining until the NDPC notification deadline."]})]}):jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning font-medium",children:"Notification Required"}),jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-warning mt-1",children:["NDPC notification is required by ",k(R.ndpcNotificationDeadline)," (",a," hours remaining)."]})]})},M=()=>{if(!g)return null;let a=[{title:"Breach Discovered",date:g.discoveredAt,completed:true,description:`Breach was discovered on ${k(g.discoveredAt)}.`},{title:"Risk Assessment",date:x==null?void 0:x.assessedAt,completed:!!x,description:x?`Risk assessment completed on ${k(x.assessedAt)}.`:"Risk assessment has not been completed yet."}];return R!=null&&R.ndpcNotificationRequired&&a.push({title:"NDPC Notification",date:N==null?void 0:N.sentAt,completed:!!N,description:N?`Notification sent to the NDPC on ${k(N.sentAt)}.`:`Notification must be sent to the NDPC by ${k(R.ndpcNotificationDeadline)}.`}),R!=null&&R.dataSubjectNotificationRequired&&a.push({title:"Data Subject Notification",date:void 0,completed:false,description:"Notification to affected data subjects is required but has not been sent yet."}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-6",l.timeline,C),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Notification Timeline"}),jsxRuntime.jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:a.map((m,v)=>jsxRuntime.jsxs("li",{className:chunkE64TU6IU_js.a("mb-6 ml-4",l.timelineStep,C),children:[jsxRuntime.jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${m.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700"}`}),jsxRuntime.jsx("time",{className:"mb-1 text-sm font-normal leading-none ndpr-text-muted",children:m.date?k(m.date):"Pending"}),jsxRuntime.jsx("h4",{className:"ndpr-section-heading",children:m.title}),jsxRuntime.jsx("p",{className:"ndpr-form-field__hint",children:m.description})]},v))})]})};return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${b}`,l.root,C),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",l.header,C),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",l.title,C),children:se}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:Q})]}),jsxRuntime.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"statusFilter",className:"ndpr-form-field__label",children:"Status Filter"}),jsxRuntime.jsxs("select",{id:"statusFilter",value:I,onChange:a=>j(a.target.value),className:"ndpr-form-field__input",children:[jsxRuntime.jsx("option",{value:"all",children:"All Statuses"}),jsxRuntime.jsx("option",{value:"ongoing",children:"Ongoing"}),jsxRuntime.jsx("option",{value:"contained",children:"Contained"}),jsxRuntime.jsx("option",{value:"resolved",children:"Resolved"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sortBy",className:"ndpr-form-field__label",children:"Sort By"}),jsxRuntime.jsxs("select",{id:"sortBy",value:q,onChange:a=>U(a.target.value),className:"ndpr-form-field__input",children:[jsxRuntime.jsx("option",{value:"discoveredAt",children:"Discovery Date"}),jsxRuntime.jsx("option",{value:"title",children:"Title"}),jsxRuntime.jsx("option",{value:"status",children:"Status"}),jsxRuntime.jsx("option",{value:"riskLevel",children:"Risk Level"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"searchTerm",className:"ndpr-form-field__label",children:"Search"}),jsxRuntime.jsx("input",{type:"text",id:"searchTerm",value:T,onChange:a=>O(a.target.value),placeholder:"Search breaches...",className:"ndpr-form-field__input"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxRuntime.jsxs("div",{className:"md:col-span-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Breach Reports"}),S.length===0?jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"No breach reports found."}):jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("space-y-2 max-h-96 overflow-y-auto pr-2",l.breachList,C),children:S.map(a=>{let m=f.find(F=>F.breachId===a.id),v=y.find(F=>F.breachId===a.id),d=z(a,m),D=null;if(d!=null&&d.ndpcNotificationRequired)if(v)D=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-success",children:"Notified"});else {let F=E(d.ndpcNotificationDeadline);F<=0?D=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-destructive font-bold",children:"Overdue"}):F<=24?D=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-destructive",children:"Urgent"}):D=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-warning",children:"Required"});}else D=jsxRuntime.jsx("span",{className:"text-xs ndpr-text-success",children:"Not Required"});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`p-3 rounded-md cursor-pointer ${h===a.id?"ndpr-alert ndpr-alert--info":"ndpr-panel"}`,l.breachItem,C),onClick:()=>ie(a.id),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:a.title}),p(a.status)]}),jsxRuntime.jsxs("p",{className:"text-xs ndpr-text-muted mb-1",children:["Discovered: ",new Date(a.discoveredAt).toLocaleDateString()]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsxRuntime.jsx("div",{children:m&&ee(m.riskLevel)}),jsxRuntime.jsx("div",{children:D})]})]},a.id)})})]}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("md:col-span-2",l.detailPanel,C),children:g?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:g.title}),p(g.status)]}),B&&jsxRuntime.jsx("div",{className:"ndpr-form-field",children:w()}),$&&jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Discovered:"})," ",k(g.discoveredAt)]}),g.occurredAt&&jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Occurred:"})," ",k(g.occurredAt)]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Reporter:"})," ",g.reporter.name]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",g.affectedSystems.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Types:"})," ",g.dataTypes.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",g.estimatedAffectedSubjects||"Unknown"]})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Description:"}),jsxRuntime.jsx("p",{className:"ndpr-panel",children:g.description})]}),g.initialActions&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Initial Actions Taken:"}),jsxRuntime.jsx("p",{className:"ndpr-panel",children:g.initialActions})]})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Risk Assessment"}),x?jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-2",children:[jsxRuntime.jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Risk Level:"}),ee(x.riskLevel)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risk Score:"})," ",x.overallRiskScore," / 5"]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",x.risksToRightsAndFreedoms?"Yes":"No"]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",x.highRisksToRightsAndFreedoms?"Yes":"No"]}),jsxRuntime.jsx("p",{className:"text-sm mb-1",children:jsxRuntime.jsx("span",{className:"font-medium",children:"Justification:"})}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted bg-white dark:bg-gray-800 p-2 rounded-md",children:x.justification})]}):jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning",children:"Risk assessment has not been conducted yet."}),jsxRuntime.jsx("button",{onClick:V,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${o}`,children:"Conduct Risk Assessment"})]})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Status"}),N?jsxRuntime.jsxs("div",{className:"ndpr-panel",children:[jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Notification Sent:"})," ",k(N.sentAt)]}),jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Method:"})," ",N.method.charAt(0).toUpperCase()+N.method.slice(1)]}),N.referenceNumber&&jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Reference Number:"})," ",N.referenceNumber]}),(N.ndpcContact||N.nitdaContact)&&jsxRuntime.jsxs("p",{className:"text-sm mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"NDPC Contact:"})," ",(P=N.ndpcContact||N.nitdaContact)==null?void 0:P.name]})]}):jsxRuntime.jsx("div",{children:R!=null&&R.ndpcNotificationRequired?jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning",children:"NDPC notification is required but has not been sent yet."}),jsxRuntime.jsx("button",{onClick:ne,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${o}`,children:"Generate Notification"})]}):jsxRuntime.jsx("div",{className:"ndpr-alert ndpr-alert--success",children:jsxRuntime.jsx("p",{className:"text-sm ndpr-text-success",children:"NDPC notification is not required for this breach."})})})]}),ae&&M()]}):jsxRuntime.jsx("div",{className:"ndpr-empty-state",children:jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"Select a breach to view details"})})})]})]})};var Te=({breachData:u,assessmentData:f,organizationInfo:y,onGenerate:J,title:K="Generate NDPC Notification Report",description:Z="Generate a report for submission to the NDPC in compliance with NDPA Section 40 breach notification requirements.",generateButtonText:se="Generate Report",className:Q="",buttonClassName:b="",classNames:o={},unstyled:l=false,showPreview:C=true,allowEditing:$=true,allowDownload:ae=true,downloadFormat:B="pdf"})=>{let[h,_]=react.useState(""),[S,L]=react.useState(""),[I,j]=react.useState(""),[T,O]=react.useState(""),[q,U]=react.useState("email"),[H,X]=react.useState(""),[ie,V]=react.useState(""),[ne,k]=react.useState(false),[g,x]=react.useState(false);react.useEffect(()=>{let p=R();_(p),k(true);},[u,f,y]);let N=p=>new Date(p).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),R=()=>`
|
|
2
|
+
NDPC DATA BREACH NOTIFICATION
|
|
3
|
+
|
|
4
|
+
Date: ${new Date().toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}
|
|
5
|
+
|
|
6
|
+
Reference: NDPA Section 40 - Breach Notification
|
|
7
|
+
|
|
8
|
+
ORGANIZATION DETAILS
|
|
9
|
+
-------------------
|
|
10
|
+
Organization Name: ${y.name}
|
|
11
|
+
${y.registrationNumber?`Registration Number: ${y.registrationNumber}`:""}
|
|
12
|
+
Address: ${y.address}
|
|
13
|
+
${y.website?`Website: ${y.website}`:""}
|
|
14
|
+
|
|
15
|
+
DATA PROTECTION OFFICER
|
|
16
|
+
----------------------
|
|
17
|
+
Name: ${y.dpoName}
|
|
18
|
+
Email: ${y.dpoEmail}
|
|
19
|
+
${y.dpoPhone?`Phone: ${y.dpoPhone}`:""}
|
|
20
|
+
|
|
21
|
+
BREACH DETAILS
|
|
22
|
+
-------------
|
|
23
|
+
Breach Title: ${u.title}
|
|
24
|
+
Date Discovered: ${N(u.discoveredAt)}
|
|
25
|
+
${u.occurredAt?`Date Occurred: ${N(u.occurredAt)}`:"Date Occurred: Unknown"}
|
|
26
|
+
Status: ${u.status.charAt(0).toUpperCase()+u.status.slice(1)}
|
|
27
|
+
|
|
28
|
+
Description of the Breach:
|
|
29
|
+
${u.description}
|
|
30
|
+
|
|
31
|
+
Affected Systems/Applications:
|
|
32
|
+
${u.affectedSystems.join(", ")}
|
|
33
|
+
|
|
34
|
+
Types of Personal Data Involved:
|
|
35
|
+
${u.dataTypes.join(", ")}
|
|
36
|
+
|
|
37
|
+
Estimated Number of Data Subjects Affected:
|
|
38
|
+
${u.estimatedAffectedSubjects||"Unknown"}
|
|
39
|
+
|
|
40
|
+
RISK ASSESSMENT
|
|
41
|
+
--------------
|
|
42
|
+
${f?`
|
|
43
|
+
Overall Risk Level: ${f.riskLevel.charAt(0).toUpperCase()+f.riskLevel.slice(1)}
|
|
44
|
+
Risk to Rights and Freedoms of Data Subjects: ${f.risksToRightsAndFreedoms?"Yes":"No"}
|
|
45
|
+
High Risk to Rights and Freedoms of Data Subjects: ${f.highRisksToRightsAndFreedoms?"Yes":"No"}
|
|
46
|
+
|
|
47
|
+
Justification for Risk Assessment:
|
|
48
|
+
${f.justification}
|
|
49
|
+
`:"Risk assessment has not been conducted yet."}
|
|
50
|
+
|
|
51
|
+
MEASURES TAKEN
|
|
52
|
+
-------------
|
|
53
|
+
Measures taken or proposed to address the breach:
|
|
54
|
+
${u.initialActions||"To be determined"}
|
|
55
|
+
|
|
56
|
+
Measures taken or proposed to mitigate possible adverse effects:
|
|
57
|
+
[Please specify measures taken to mitigate adverse effects]
|
|
58
|
+
|
|
59
|
+
NOTIFICATION TO DATA SUBJECTS (NDPA Section 40(4))
|
|
60
|
+
----------------------------
|
|
61
|
+
Have data subjects been notified: [Yes/No]
|
|
62
|
+
If yes, date of notification: [Date]
|
|
63
|
+
If no, planned date of notification: [Date]
|
|
64
|
+
Reason for delay (if applicable): [Reason]
|
|
65
|
+
|
|
66
|
+
ADDITIONAL INFORMATION
|
|
67
|
+
---------------------
|
|
68
|
+
[Any additional information relevant to the breach]
|
|
69
|
+
|
|
70
|
+
This notification is made in compliance with the Nigeria Data Protection Act (NDPA), Section 40.
|
|
71
|
+
`,z=p=>{p.preventDefault();let w={id:`notification_${Date.now()}`,breachId:u.id,sentAt:Date.now(),method:q,referenceNumber:H||void 0,ndpcContact:S?{name:S,email:I,phone:T||void 0}:void 0,content:h,attachments:[]};J(w),x(true);},E=()=>{let p,w,M;switch(B){case "html":{p="text/html",w="html",M=`<!DOCTYPE html>
|
|
72
|
+
<html lang="en">
|
|
73
|
+
<head>
|
|
74
|
+
<meta charset="UTF-8">
|
|
75
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
76
|
+
<title>NDPC Breach Notification Report</title>
|
|
77
|
+
<style>body{font-family:monospace;white-space:pre-wrap;max-width:800px;margin:2rem auto;padding:0 1rem;}</style>
|
|
78
|
+
</head>
|
|
79
|
+
<body>${h.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</body>
|
|
80
|
+
</html>`;break}case "pdf":p="text/plain",w="pdf.txt",M=h;break;case "docx":p="text/plain",w="docx.txt",M=h;break;default:p="text/plain",w="txt",M=h;}let P=document.createElement("a"),a=new Blob([M],{type:p});P.href=URL.createObjectURL(a),P.download=`NDPC_Breach_Notification_${new Date().toISOString().split("T")[0]}.${w}`,document.body.appendChild(P),P.click(),document.body.removeChild(P);},ee=()=>[{value:"email",label:"Email"},{value:"portal",label:"NDPC Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map(w=>jsxRuntime.jsx("option",{value:w.value,children:w.label},w.value));return jsxRuntime.jsxs("div",{"data-ndpr-component":"regulatory-report-generator",className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o.root,l),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",o.header,l),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",o.title,l),children:K}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:Z})]}),g?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsxRuntime.jsx("h3",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Generated Successfully"}),jsxRuntime.jsx("p",{className:"ndpr-text-success",children:"Your NDPC notification report has been generated and is ready for submission. Please review the report carefully before submitting it to the NDPC."})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Submission Details"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Method:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:q.charAt(0).toUpperCase()+q.slice(1)})]}),S&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Contact Name:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:S})]}),I&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Contact Email:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:I})]}),T&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Contact Phone:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:T})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Date Generated:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:N(Date.now())})]}),jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Breach ID:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:u.id})]}),H&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-text-sm",o.field,l),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("font-medium",o.fieldLabel,l),children:"Reference Number:"})," ",jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("",o.fieldValue,l),children:H})]})]})]})]}),C&&jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Report Preview"}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("ndpr-panel",o.reportPreview,l),children:jsxRuntime.jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:h})})]}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[ae&&jsxRuntime.jsxs("button",{onClick:E,className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${b}`,o.secondaryButton||o.downloadButton,l),children:["Download Report (",B.toUpperCase(),")"]}),jsxRuntime.jsx("button",{onClick:()=>x(false),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${b}`,children:"Edit Report"})]})]}):jsxRuntime.jsx("form",{onSubmit:z,children:jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Notification Method"}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"method",className:"ndpr-form-field__label",children:["Method of Submission ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"method",value:q,onChange:p=>U(p.target.value),className:"ndpr-form-field__input",required:true,children:ee()})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"referenceNumber",className:"ndpr-form-field__label",children:"Reference Number (if available)"}),jsxRuntime.jsx("input",{type:"text",id:"referenceNumber",value:H,onChange:p=>X(p.target.value),placeholder:"e.g. NDPC/BR/2024/001",className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"NDPC Contact (if known)"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactName",className:"ndpr-form-field__label",children:"Contact Name"}),jsxRuntime.jsx("input",{type:"text",id:"contactName",value:S,onChange:p=>L(p.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactEmail",className:"ndpr-form-field__label",children:"Contact Email"}),jsxRuntime.jsx("input",{type:"email",id:"contactEmail",value:I,onChange:p=>j(p.target.value),className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"contactPhone",className:"ndpr-form-field__label",children:"Contact Phone"}),jsxRuntime.jsx("input",{type:"tel",id:"contactPhone",value:T,onChange:p=>O(p.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Additional Information"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"additionalInfo",className:"ndpr-form-field__label",children:"Additional Information to Include"}),jsxRuntime.jsx("textarea",{id:"additionalInfo",value:ie,onChange:p=>V(p.target.value),rows:3,placeholder:"Any additional information you want to include in the report",className:"ndpr-form-field__input"})]})]}),$&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:"Report Content"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reportContent",className:"ndpr-form-field__label",children:["Edit Report Content ",jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"reportContent",value:h,onChange:p=>_(p.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono",required:true})]})]}),jsxRuntime.jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. This report will help you comply with this requirement."})]}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{type:"submit",className:chunkE64TU6IU_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${b}`,o.primaryButton||o.generateButton,l),children:se})})]})})]})};exports.a=xe;exports.b=Se;exports.c=Te;//# sourceMappingURL=chunk-EHAZIKDX.js.map
|
|
81
|
+
//# sourceMappingURL=chunk-EHAZIKDX.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'./chunk-AYKLAEOU.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState,useRef,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var G=({options:p,settings:d,onSave:S,title:l="Manage Your Privacy Settings",description:R="Update your consent preferences at any time. Required cookies cannot be disabled as they are necessary for the website to function. Consent management is provided in accordance with NDPA Sections 25-26.",saveButtonText:w="Save Preferences",resetButtonText:M="Reset to Defaults",version:_="1.0",className:f="",buttonClassName:v="",primaryButtonClassName:T="",secondaryButtonClassName:k="",classNames:n,unstyled:e,showSuccessMessage:$=true,successMessage:D="Your preferences have been saved.",successMessageDuration:P=3e3})=>{let[u,c]=useState({}),[q,b$1]=useState(false),g=useRef(null);useEffect(()=>()=>{g.current&&clearTimeout(g.current);},[]),useEffect(()=>{if(d&&d.consents)c(d.consents);else {let t={};p.forEach(o=>{t[o.id]=o.defaultValue||false;}),c(t);}},[p,d]);let x=(t,o)=>{c(s=>b(a$1({},s),{[t]:o}));},E=()=>{let t={consents:u,timestamp:Date.now(),version:_,method:"manager",hasInteracted:true};S(t),$&&(b$1(true),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{b$1(false);},P));},I=()=>{let t={};p.forEach(o=>{t[o.id]=o.defaultValue||false;}),c(t);},L=`ndpr-consent-manager__button ndpr-consent-manager__button--primary ${v} ${T}`.trim(),y=`ndpr-consent-manager__button ndpr-consent-manager__button--secondary ${v} ${k}`.trim(),V=(n==null?void 0:n.primaryButton)||(n==null?void 0:n.saveButton)||L,F=(n==null?void 0:n.secondaryButton)||(n==null?void 0:n.resetButton)||y,O=`ndpr-consent-manager${f?` ${f}`:""}`;return jsxs("div",{"data-ndpr-component":"consent-manager",className:a(O,n==null?void 0:n.root,e),children:[jsx("h2",{className:a("ndpr-consent-manager__title",n==null?void 0:n.title,e),children:l}),jsx("p",{className:a("ndpr-consent-manager__description",n==null?void 0:n.description,e),children:R}),jsx("div",{className:a("ndpr-consent-manager__options-list",n==null?void 0:n.optionsList,e),children:p.map(t=>{let o=`consent-manager-${t.id}`;return jsxs("div",{className:a("ndpr-consent-manager__option",n==null?void 0:n.optionItem,e),children:[jsxs("div",{className:e?"":"ndpr-consent-manager__option-info",children:[jsx("h3",{className:e?"":"ndpr-consent-manager__option-label",children:t.label}),jsx("p",{className:e?"":"ndpr-consent-manager__option-description",children:t.description})]}),jsxs("label",{htmlFor:o,className:e?"":"ndpr-consent-manager__toggle-wrapper",children:[jsx("input",{id:o,type:"checkbox",className:e?"":"ndpr-consent-manager__toggle-input",checked:u[t.id]||false,onChange:s=>x(t.id,s.target.checked),disabled:t.required}),jsx("span",{"aria-hidden":"true",className:a("ndpr-consent-manager__toggle",n==null?void 0:n.toggle,e)}),jsxs("span",{className:e?"":"ndpr-consent-manager__toggle-status",children:[u[t.id]?"Enabled":"Disabled",t.required&&jsx("span",{className:e?"":"ndpr-consent-manager__required-marker",children:"(Required)"})]})]})]},t.id)})}),q&&jsx("div",{className:e?"":"ndpr-consent-manager__success","aria-live":"polite",role:"status",children:D}),jsxs("div",{className:e?"":"ndpr-consent-manager__buttons",children:[jsx("button",{onClick:E,className:a(V,n==null?void 0:n.saveButton,e),children:w}),jsx("button",{onClick:I,className:a(F,n==null?void 0:n.resetButton,e),children:M})]}),jsxs("div",{className:e?"":"ndpr-consent-manager__meta",children:[jsxs("p",{children:["Last updated: ",d?new Date(d.timestamp).toLocaleString():"Never"]}),jsxs("p",{children:["Version: ",_]})]})]})};export{G as a};//# sourceMappingURL=chunk-EPT2K355.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-EPT2K355.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),jsxRuntime=require('react/jsx-runtime');var f={consent:"Consent",dsr:"Data Subject Rights",dpia:"DPIA",breach:"Breach Notification",policy:"Privacy Policy",lawfulBasis:"Lawful Basis",crossBorder:"Cross-Border",ropa:"ROPA"},p={critical:"rgb(var(--ndpr-destructive))","needs-work":"rgb(var(--ndpr-warning))",good:"rgb(var(--ndpr-primary))",excellent:"rgb(var(--ndpr-success))"},m={critical:"Critical","needs-work":"Needs Work",good:"Good",excellent:"Excellent"},C={critical:"Critical",high:"High",medium:"Medium",low:"Low"},h=({score:t,rating:o,classNames:e,unstyled:l})=>{let r=p[o],i=2*Math.PI*40,g=i*(1-t/100);return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("relative inline-flex items-center justify-center",e==null?void 0:e.scoreCircle,l),role:"img","aria-label":`Compliance score: ${t} out of 100, rated ${m[o]}`,children:[jsxRuntime.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 100 100","aria-hidden":"true",children:[jsxRuntime.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:"rgba(0,0,0,0.08)",strokeWidth:"8"}),jsxRuntime.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:r,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:g,transform:"rotate(-90 50 50)",style:{transition:"stroke-dashoffset 0.4s ease"}})]}),jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("absolute text-2xl font-bold tabular-nums",e==null?void 0:e.scoreValue,l),style:{color:r},children:t})]})},x=({rating:t,className:o,unstyled:e})=>{let l=p[t];return jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("inline-block px-3 py-1 rounded-full text-sm font-semibold",o,e),style:{backgroundColor:`${l.replace("rgb(","rgba(").replace(")",", 0.12)")}`,color:l,border:`1px solid ${l.replace("rgb(","rgba(").replace(")",", 0.3)")}`},role:"status","aria-live":"polite",children:m[t]})},R=({moduleKey:t,module:o,classNames:e,unstyled:l})=>{var b;let r=o.score>=90?"excellent":o.score>=70?"good":o.score>=40?"needs-work":"critical",i=p[r];Math.round(o.score/100*(o.gaps.length+Math.round(o.score/100*5)));let u=o.gaps.length,c=(b=f[t])!=null?b:t;return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("rounded-lg border p-4 flex flex-col gap-2",e==null?void 0:e.moduleCard,l),style:{borderColor:`${i.replace("rgb(","rgba(").replace(")",", 0.25)")}`,backgroundColor:`${i.replace("rgb(","rgba(").replace(")",", 0.04)")}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("text-sm font-semibold truncate",e==null?void 0:e.moduleTitle,l),children:c}),jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("text-lg font-bold tabular-nums",e==null?void 0:e.moduleScore,l),style:{color:i},role:"status","aria-label":`${c} score: ${o.score}`,children:o.score})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{backgroundColor:"rgba(0,0,0,0.08)"},role:"progressbar","aria-valuenow":o.score,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${c} compliance score: ${o.score}%`,children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${o.score}%`,backgroundColor:i}})}),u>0&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("ndpr-form-field__hint",e==null?void 0:e.moduleGaps,l),children:[u," gap",u!==1?"s":""," to address"]})]})},y=({rec:t,classNames:o,unstyled:e})=>{var i,g;let r=(i={critical:p.critical,high:p["needs-work"],medium:p.good,low:p.excellent}[t.priority])!=null?i:p.good;return jsxRuntime.jsxs("div",{"data-testid":"recommendation-item",className:chunkE64TU6IU_js.a("flex gap-3 p-3 rounded-lg border border-gray-100 dark:border-gray-700 bg-white dark:bg-gray-800",o==null?void 0:o.recommendationItem,e),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("mt-0.5 shrink-0 inline-block px-2 py-0.5 rounded text-xs font-bold uppercase tracking-wide",o==null?void 0:o.recommendationPriority,e),style:{backgroundColor:`${r.replace("rgb(","rgba(").replace(")",", 0.12)")}`,color:r},children:(g=C[t.priority])!=null?g:t.priority}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("text-sm font-medium ndpr-text-foreground",o==null?void 0:o.recommendationTitle,e),children:t.label}),jsxRuntime.jsx("p",{className:"mt-0.5 text-xs ndpr-text-muted leading-relaxed",children:t.recommendation}),jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:[t.ndpaSection," \u2022 Effort: ",t.effort]})]})]})},P=({report:t,title:o="NDPA Compliance Dashboard",showRecommendations:e=true,maxRecommendations:l=5,classNames:r,unstyled:i=false})=>{let g=t.recommendations.slice(0,l),u=Object.entries(t.modules);return jsxRuntime.jsxs("div",{"data-ndpr-component":"compliance-dashboard",className:chunkE64TU6IU_js.a("w-full rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm p-6 flex flex-col gap-8",r==null?void 0:r.root,i),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex flex-col sm:flex-row items-start sm:items-center gap-6",r==null?void 0:r.header,i),children:[jsxRuntime.jsx(h,{score:t.score,rating:t.rating,classNames:{scoreCircle:r==null?void 0:r.scoreCircle,scoreValue:r==null?void 0:r.scoreValue},unstyled:i}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold ndpr-text-foreground leading-tight",children:o}),jsxRuntime.jsx(x,{rating:t.rating,className:r==null?void 0:r.ratingBadge,unstyled:i}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:["Generated on"," ",new Date(t.generatedAt).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})]})]})]}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 gap-3",r==null?void 0:r.modulesGrid,i),children:u.map(([c,b])=>jsxRuntime.jsx(R,{moduleKey:c,module:b,classNames:{moduleCard:r==null?void 0:r.moduleCard,moduleTitle:r==null?void 0:r.moduleTitle,moduleScore:r==null?void 0:r.moduleScore,moduleGaps:r==null?void 0:r.moduleGaps},unstyled:i},c))}),e&&g.length>0&&jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex flex-col gap-3",r==null?void 0:r.recommendationsSection,i),children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold ndpr-text-foreground",children:"Recommendations"}),g.map(c=>jsxRuntime.jsx(y,{rec:c,classNames:{recommendationItem:r==null?void 0:r.recommendationItem,recommendationPriority:r==null?void 0:r.recommendationPriority,recommendationTitle:r==null?void 0:r.recommendationTitle},unstyled:i},`${c.module}-${c.key}`))]})]})};exports.a=P;//# sourceMappingURL=chunk-HGGLW5TE.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-HGGLW5TE.js.map
|