@tantainnovative/ndpr-toolkit 2.2.0 → 2.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/README.md +26 -11
- package/dist/breach-ouXoVTWs.d.ts +438 -0
- package/dist/breach-yRiyyc4n.d.mts +438 -0
- package/dist/breach.d.mts +3 -349
- package/dist/breach.d.ts +3 -349
- package/dist/breach.js +1 -1
- package/dist/breach.mjs +1 -1
- package/dist/chunk-2XFAV267.mjs +2 -0
- package/dist/chunk-32UIWTGD.js +72 -0
- package/dist/chunk-4JUDKBA2.mjs +7 -0
- package/dist/chunk-4VVARDN2.mjs +2 -0
- package/dist/chunk-5RSOLEEP.js +63 -0
- package/dist/chunk-AYKLAEOU.mjs +2 -0
- package/dist/chunk-BGHQTZAC.js +94 -0
- package/dist/chunk-BZTTQS4A.mjs +7 -0
- package/dist/chunk-CAB7O3GR.mjs +63 -0
- package/dist/chunk-CL53OI3I.js +7 -0
- package/dist/chunk-E64TU6IU.js +2 -0
- package/dist/chunk-EKVTLHBQ.js +2 -0
- package/dist/chunk-ELKEZEV5.mjs +2 -0
- package/dist/chunk-EPF7J2FK.js +3 -0
- package/dist/chunk-ER7X6E36.js +2 -0
- package/dist/chunk-FXTZDKDC.mjs +3 -0
- package/dist/chunk-IBEKLDBY.mjs +2 -0
- package/dist/chunk-ILCNDOBU.js +2 -0
- package/dist/chunk-K3GMTMQ6.js +2 -0
- package/dist/chunk-MJGOLP5M.js +2 -0
- package/dist/chunk-NW4A3JW6.mjs +2 -0
- package/dist/chunk-P3PULLYP.mjs +2 -0
- package/dist/chunk-SKJCQKFL.mjs +94 -0
- package/dist/chunk-TCJCE6WN.js +2 -0
- package/dist/chunk-UZ5EZOA7.js +2 -0
- package/dist/chunk-WSHSHIIM.mjs +2 -0
- package/dist/chunk-XMYUYQH7.mjs +72 -0
- package/dist/chunk-ZNTMZ6NM.js +7 -0
- package/dist/consent-audit-BdByjYlM.d.mts +65 -0
- package/dist/consent-audit-DhbfMR0n.d.ts +65 -0
- package/dist/consent.d.mts +55 -8
- package/dist/consent.d.ts +55 -8
- package/dist/consent.js +1 -1
- package/dist/consent.mjs +1 -1
- package/dist/core.d.mts +52 -2
- package/dist/core.d.ts +52 -2
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{cross-border-entry-CtX8_o-_.d.ts → cross-border-entry-BrWVPly6.d.ts} +7 -0
- package/dist/{cross-border-entry-BfF7jw5o.d.mts → cross-border-entry-cCTvpwnT.d.mts} +7 -0
- package/dist/cross-border.d.mts +1 -1
- package/dist/cross-border.d.ts +1 -1
- package/dist/cross-border.js +1 -1
- package/dist/cross-border.mjs +1 -1
- package/dist/dpia.d.mts +14 -0
- package/dist/dpia.d.ts +14 -0
- package/dist/dpia.js +1 -1
- package/dist/dpia.mjs +1 -1
- package/dist/dsr-190YpijW.d.ts +307 -0
- package/dist/dsr-BTT-Xd7H.d.mts +307 -0
- package/dist/dsr.d.mts +3 -251
- package/dist/dsr.d.ts +3 -251
- package/dist/dsr.js +1 -1
- package/dist/dsr.mjs +1 -1
- package/dist/hooks.d.mts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +11 -10
- package/dist/index.d.ts +11 -10
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{lawful-basis-entry-BeSX7u0U.d.ts → lawful-basis-entry-15qjKcNO.d.ts} +6 -0
- package/dist/{lawful-basis-entry-CMPPM9Rh.d.mts → lawful-basis-entry-CxZrofwG.d.mts} +6 -0
- package/dist/lawful-basis.d.mts +1 -1
- package/dist/lawful-basis.d.ts +1 -1
- package/dist/lawful-basis.js +1 -1
- package/dist/lawful-basis.mjs +1 -1
- package/dist/{policy-dmsRlqgM.d.ts → policy-D2_jh5-T.d.ts} +15 -5
- package/dist/{policy-kZN23hrR.d.mts → policy-E0fXZkda.d.mts} +15 -5
- package/dist/policy-templates-CIKcV0i1.d.ts +36 -0
- package/dist/policy-templates-DMsPwOSZ.d.mts +36 -0
- package/dist/policy.d.mts +3 -3
- package/dist/policy.d.ts +3 -3
- package/dist/policy.js +1 -1
- package/dist/policy.mjs +1 -1
- package/dist/{ropa-entry-DIEQ9WFs.d.ts → ropa-entry-B0D7X1GV.d.ts} +10 -1
- package/dist/{ropa-entry-CZJ91ymk.d.mts → ropa-entry-DiOThOc2.d.mts} +10 -1
- package/dist/ropa.d.mts +1 -1
- package/dist/ropa.d.ts +1 -1
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/dist/styles.css +40 -28
- package/dist/styles.d.ts +1 -0
- package/dist/{usePrivacyPolicy-CfySfBLS.d.ts → useDefaultPrivacyPolicy-B7kTHbZh.d.ts} +39 -2
- package/dist/{usePrivacyPolicy-Dit2sFuV.d.mts → useDefaultPrivacyPolicy-CUluF_ic.d.mts} +39 -2
- package/package.json +9 -7
- package/dist/chunk-4RGDNVR5.mjs +0 -72
- package/dist/chunk-6LM3RAFO.js +0 -7
- package/dist/chunk-7DNQSOER.js +0 -2
- package/dist/chunk-A7DRHSDQ.mjs +0 -2
- package/dist/chunk-DB3JH4DS.mjs +0 -2
- package/dist/chunk-FC6EG34C.js +0 -72
- package/dist/chunk-FDB6KZUD.mjs +0 -2
- package/dist/chunk-FZUCKGIM.mjs +0 -7
- package/dist/chunk-G3JNFZPT.js +0 -2
- package/dist/chunk-HXCRMA4J.mjs +0 -2
- package/dist/chunk-IC7VOOKJ.mjs +0 -2
- package/dist/chunk-ICUZG6CD.mjs +0 -2
- package/dist/chunk-IW5PHOG7.mjs +0 -7
- package/dist/chunk-IWUUVRLJ.js +0 -2
- package/dist/chunk-JKEAPTYP.js +0 -7
- package/dist/chunk-N52S64SU.js +0 -2
- package/dist/chunk-PM7CMTMB.js +0 -4
- package/dist/chunk-SKAMVXBI.mjs +0 -94
- package/dist/chunk-UYP64PV7.mjs +0 -4
- package/dist/chunk-VURIXCGY.js +0 -2
- package/dist/chunk-VXRY3V42.js +0 -94
- package/dist/chunk-YBPHGEL2.js +0 -2
- package/dist/consent-DCc5zjXI.d.mts +0 -24
- package/dist/consent-DLWb5ota.d.ts +0 -24
- package/dist/privacy-9FcJceMr.d.mts +0 -15
- package/dist/privacy-BXz7O2ej.d.ts +0 -15
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {d,c,b as b$1,a as a$2}from'./chunk-TXBZPCGF.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var F={name:"",description:"",lawfulBasis:"consent",lawfulBasisJustification:"",dataCategories:"",involvesSensitiveData:false,sensitiveDataCondition:"",dataSubjectCategories:"",purposes:"",retentionPeriod:"",retentionJustification:"",recipients:"",crossBorderTransfer:false,reviewDate:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""},H=[{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"}],Y=[{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"}],fe=({activities:b$2,onAddActivity:_,onUpdateActivity:j,onArchiveActivity:I,title:W="Lawful Basis Tracker",description:q="Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25.",className:z="",buttonClassName:f="",showSummary:K=true,showComplianceGaps:Q=true,classNames:r,unstyled:o})=>{let[y,m]=useState("list"),[a$3,p]=useState(F),[h,S]=useState(null),[J,X]=useState(null),[k,Z]=useState("all"),[C,ee]=useState("all"),[A,te]=useState(""),[R,x]=useState([]),[N,re]=useState(b$2);useEffect(()=>{let t=[...b$2];if(k!=="all"&&(t=t.filter(l=>l.status===k)),C!=="all"&&(t=t.filter(l=>l.lawfulBasis===C)),A){let l=A.toLowerCase();t=t.filter(s=>s.name.toLowerCase().includes(l)||s.description.toLowerCase().includes(l)||s.purposes.some(v=>v.toLowerCase().includes(l)));}t.sort((l,s)=>s.updatedAt-l.updatedAt),re(t);},[b$2,k,C,A]);let w=t=>new Date(t).toLocaleDateString(),D=d(b$2),P=c(b$2),B=t=>t.split(",").map(l=>l.trim()).filter(l=>l.length>0),ie=()=>{p(F),S(null),x([]),m("form");},E=t=>{p({name:t.name,description:t.description,lawfulBasis:t.lawfulBasis,lawfulBasisJustification:t.lawfulBasisJustification,dataCategories:t.dataCategories.join(", "),involvesSensitiveData:t.involvesSensitiveData,sensitiveDataCondition:t.sensitiveDataCondition||"",dataSubjectCategories:t.dataSubjectCategories.join(", "),purposes:t.purposes.join(", "),retentionPeriod:t.retentionPeriod,retentionJustification:t.retentionJustification||"",recipients:(t.recipients||[]).join(", "),crossBorderTransfer:t.crossBorderTransfer,reviewDate:t.reviewDate?new Date(t.reviewDate).toISOString().split("T")[0]:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""}),S(t.id),x([]),m("form");},ae=()=>{let t={name:a$3.name,description:a$3.description,lawfulBasis:a$3.lawfulBasis,lawfulBasisJustification:a$3.lawfulBasisJustification,dataCategories:B(a$3.dataCategories),involvesSensitiveData:a$3.involvesSensitiveData,sensitiveDataCondition:a$3.sensitiveDataCondition||void 0,dataSubjectCategories:B(a$3.dataSubjectCategories),purposes:B(a$3.purposes),retentionPeriod:a$3.retentionPeriod,retentionJustification:a$3.retentionJustification||void 0,recipients:a$3.recipients?B(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$1({},t),{id:h||"temp",createdAt:Date.now(),updatedAt:Date.now()}),s=a$2(l);if(!s.isValid){x(s.errors);return}h&&j?j(h,t):_&&_(t),p(F),S(null),x([]),m("list");},O=t=>{I&&I(t);},ne=t=>{X(t),m("detail");},d$1=J?b$2.find(t=>t.id===J):null,V=t=>{let l={active:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",inactive:"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",under_review:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",archived:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"},s={active:"Active",inactive:"Inactive",under_review:"Under Review",archived:"Archived"};return jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${l[t]}`,r==null?void 0:r.statusBadge,o),children:s[t]})},$=t=>{let l={consent:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",contract:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",legal_obligation:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",vital_interests:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",public_interest:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",legitimate_interests:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},s={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[t]}`,children:s[t]})},M=t=>t.dpoApproval?t.dpoApproval.approved?jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"Approved"}):jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",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"}),oe=()=>jsxs("div",{className:a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",r==null?void 0:r.summary,o),children:[jsxs("div",{className:a("bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,o),children:[jsx("p",{className:"text-2xl font-bold text-blue-800 dark:text-blue-200",children:D.totalActivities}),jsx("p",{className:"text-sm text-blue-600 dark:text-blue-300",children:"Total Activities"})]}),jsxs("div",{className:a("bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,o),children:[jsx("p",{className:"text-2xl font-bold text-orange-800 dark:text-orange-200",children:D.sensitiveDataActivities}),jsx("p",{className:"text-sm text-orange-600 dark:text-orange-300",children:"Sensitive Data"})]}),jsxs("div",{className:a("bg-purple-50 dark:bg-purple-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,o),children:[jsx("p",{className:"text-2xl font-bold text-purple-800 dark:text-purple-200",children:D.crossBorderActivities}),jsx("p",{className:"text-sm text-purple-600 dark:text-purple-300",children:"Cross-Border Transfers"})]}),jsxs("div",{className:a("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,o),children:[jsx("p",{className:"text-2xl font-bold text-red-800 dark:text-red-200",children:D.activitiesWithoutApproval.length}),jsx("p",{className:"text-sm text-red-600 dark:text-red-300",children:"Pending Approval"})]})]}),de=()=>{if(P.length===0)return jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg mb-6",children:[jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"No compliance gaps detected."}),jsx("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:"All processing activities appear to be properly documented."})]});let t=P.filter(s=>s.severity==="high"),l=P.filter(s=>s.severity==="medium");return jsxs("div",{className:"mb-6",children:[t.length>0&&jsxs("div",{className:a("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-3",r==null?void 0:r.gapAlert,o),children:[jsxs("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-2",children:["High Priority (",t.length,")"]}),jsx("ul",{className:"space-y-1",children:t.map((s,v)=>jsx("li",{className:"text-xs text-red-700 dark:text-red-300",children:s.description},v))})]}),l.length>0&&jsxs("div",{className:a("bg-yellow-50 dark:bg-yellow-900/20 p-4 rounded-lg",r==null?void 0:r.gapAlert,o),children:[jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-2",children:["Medium Priority (",l.length,")"]}),jsx("ul",{className:"space-y-1",children:l.map((s,v)=>jsx("li",{className:"text-xs text-yellow-700 dark:text-yellow-300",children:s.description},v))})]})]})},le=()=>jsxs("div",{className:a("",r==null?void 0:r.form,o),children:[jsxs("div",{className:a("flex justify-between items-center mb-4",r==null?void 0:r.header,o),children:[jsx("h3",{className:"text-lg font-medium",children:h?"Edit Processing Activity":"New Processing Activity"}),jsx("button",{onClick:()=>{m("list"),x([]);},className:`px-4 py-2 text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${f}`,children:"Cancel"})]}),R.length>0&&jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-4",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-2",children:"Please correct the following errors:"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:R.map((t,l)=>jsx("li",{className:"text-xs text-red-700 dark:text-red-300",children:t},l))})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"activityName",className:"block text-sm font-medium mb-1",children:"Activity Name *"}),jsx("input",{type:"text",id:"activityName",value:a$3.name,onChange:t=>p(b(a$1({},a$3),{name:t.target.value})),placeholder:"e.g., Customer Account Management",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"activityDescription",className:"block text-sm font-medium mb-1",children:"Description *"}),jsx("textarea",{id:"activityDescription",value:a$3.description,onChange:t=>p(b(a$1({},a$3),{description:t.target.value})),placeholder:"Describe what processing is performed...",rows:3,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"block text-sm font-medium mb-1",children:"Lawful Basis (NDPA Section 25) *"}),jsx("select",{id:"lawfulBasis",value:a$3.lawfulBasis,onChange:t=>p(b(a$1({},a$3),{lawfulBasis:t.target.value})),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),children:H.map(t=>jsx("option",{value:t.value,children:t.label},t.value))}),jsx("p",{className:"mt-1 text-xs text-gray-600 dark:text-gray-400",children:b$1(a$3.lawfulBasis)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"justification",className:"block text-sm font-medium mb-1",children:"Lawful Basis Justification *"}),jsx("textarea",{id:"justification",value:a$3.lawfulBasisJustification,onChange:t=>p(b(a$1({},a$3),{lawfulBasisJustification:t.target.value})),placeholder:"Document why this lawful basis applies to this processing activity...",rows:3,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.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:"space-y-3",children:[jsxs("div",{children:[jsx("label",{htmlFor:"liaPurpose",className:"block text-sm font-medium mb-1",children:"Purpose Test"}),jsx("textarea",{id:"liaPurpose",value:a$3.liaPurposeTest,onChange:t=>p(b(a$1({},a$3),{liaPurposeTest:t.target.value})),placeholder:"Describe the legitimate interest being pursued...",rows:2,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaNecessity",className:"block text-sm font-medium mb-1",children:"Necessity Test"}),jsx("textarea",{id:"liaNecessity",value:a$3.liaNecessityTest,onChange:t=>p(b(a$1({},a$3),{liaNecessityTest:t.target.value})),placeholder:"Explain why this processing is necessary for the stated purpose...",rows:2,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaBalancing",className:"block text-sm font-medium mb-1",children:"Balancing Test"}),jsx("textarea",{id:"liaBalancing",value:a$3.liaBalancingTest,onChange:t=>p(b(a$1({},a$3),{liaBalancingTest:t.target.value})),placeholder:"Assess the impact on data subjects' rights and interests...",rows:2,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaSafeguards",className:"block text-sm font-medium mb-1",children:"Safeguards"}),jsx("input",{type:"text",id:"liaSafeguards",value:a$3.liaSafeguards,onChange:t=>p(b(a$1({},a$3),{liaSafeguards:t.target.value})),placeholder:"List safeguards (comma-separated)...",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaConclusion",className:"block text-sm font-medium mb-1",children:"Conclusion"}),jsx("textarea",{id:"liaConclusion",value:a$3.liaConclusion,onChange:t=>p(b(a$1({},a$3),{liaConclusion:t.target.value})),placeholder:"State your overall conclusion...",rows:2,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"block text-sm font-medium mb-1",children:"Data Categories *"}),jsx("input",{type:"text",id:"dataCategories",value:a$3.dataCategories,onChange:t=>p(b(a$1({},a$3),{dataCategories:t.target.value})),placeholder:"e.g., Name, Email, Phone Number (comma-separated)",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.involvesSensitiveData,onChange:t=>p(b(a$1({},a$3),{involvesSensitiveData:t.target.checked,sensitiveDataCondition:t.target.checked?a$3.sensitiveDataCondition:""})),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("span",{className:"text-sm font-medium",children:"Involves Sensitive Personal Data (NDPA Section 27)"})]})}),a$3.involvesSensitiveData&&jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveCondition",className:"block text-sm font-medium mb-1",children:"Sensitive Data Condition (NDPA Section 27) *"}),jsxs("select",{id:"sensitiveCondition",value:a$3.sensitiveDataCondition,onChange:t=>p(b(a$1({},a$3),{sensitiveDataCondition:t.target.value})),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),children:[jsx("option",{value:"",children:"Select a condition..."}),Y.map(t=>jsx("option",{value:t.value,children:t.label},t.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSubjectCategories",className:"block text-sm font-medium mb-1",children:"Data Subject Categories *"}),jsx("input",{type:"text",id:"dataSubjectCategories",value:a$3.dataSubjectCategories,onChange:t=>p(b(a$1({},a$3),{dataSubjectCategories:t.target.value})),placeholder:"e.g., Customers, Employees, Vendors (comma-separated)",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"block text-sm font-medium mb-1",children:"Processing Purposes *"}),jsx("input",{type:"text",id:"purposes",value:a$3.purposes,onChange:t=>p(b(a$1({},a$3),{purposes:t.target.value})),placeholder:"e.g., Account management, Service delivery (comma-separated)",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"block text-sm font-medium mb-1",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:a$3.retentionPeriod,onChange:t=>p(b(a$1({},a$3),{retentionPeriod:t.target.value})),placeholder:"e.g., 3 years after account closure",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"block text-sm font-medium mb-1",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:a$3.retentionJustification,onChange:t=>p(b(a$1({},a$3),{retentionJustification:t.target.value})),placeholder:"Reason for the retention period",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"block text-sm font-medium mb-1",children:"Recipients"}),jsx("input",{type:"text",id:"recipients",value:a$3.recipients,onChange:t=>p(b(a$1({},a$3),{recipients:t.target.value})),placeholder:"e.g., Payment processor, Cloud provider (comma-separated)",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.crossBorderTransfer,onChange:t=>p(b(a$1({},a$3),{crossBorderTransfer:t.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:"text-sm font-medium",children:"Involves Cross-Border Transfer Outside Nigeria"})]})}),jsxs("div",{children:[jsx("label",{htmlFor:"reviewDate",className:"block text-sm font-medium mb-1",children:"Next Review Date"}),jsx("input",{type:"date",id:"reviewDate",value:a$3.reviewDate,onChange:t=>p(b(a$1({},a$3),{reviewDate:t.target.value})),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[jsx("button",{onClick:()=>{m("list"),x([]);},className:`px-4 py-2 text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${f}`,children:"Cancel"}),jsx("button",{onClick:ae,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${f}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:h?"Update Activity":"Create Activity"})]})]})]}),se=()=>{var l;if(!d$1)return jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Activity not found."})});let t=a$2(d$1);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxs("div",{children:[jsx("button",{onClick:()=>m("list"),className:"text-sm text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline mb-2",children:"Back to list"}),jsx("h3",{className:"text-lg font-medium",children:d$1.name})]}),jsxs("div",{className:"flex space-x-2",children:[$(d$1.lawfulBasis),V(d$1.status),M(d$1)]})]}),t.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 text-yellow-800 dark:text-yellow-200 font-medium mb-1",children:"Warnings"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:t.warnings.map((s,v)=>jsx("li",{className:"text-xs text-yellow-700 dark:text-yellow-300",children:s},v))})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Description:"})," ",d$1.description]}),jsxs("p",{className:"text-sm mt-2",children:[jsx("span",{className:"font-medium",children:"Lawful Basis:"})," ",b$1(d$1.lawfulBasis)]}),jsxs("p",{className:"text-sm mt-2",children:[jsx("span",{className:"font-medium",children:"Justification:"})," ",d$1.lawfulBasisJustification]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Data Categories:"})," ",d$1.dataCategories.join(", ")]}),jsxs("p",{className:"text-sm mt-2",children:[jsx("span",{className:"font-medium",children:"Data Subject Categories:"})," ",d$1.dataSubjectCategories.join(", ")]}),jsxs("p",{className:"text-sm mt-2",children:[jsx("span",{className:"font-medium",children:"Purposes:"})," ",d$1.purposes.join(", ")]}),jsxs("p",{className:"text-sm mt-2",children:[jsx("span",{className:"font-medium",children:"Retention Period:"})," ",d$1.retentionPeriod,d$1.retentionJustification&&jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:[" ","(",d$1.retentionJustification,")"]})]})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",d$1.involvesSensitiveData?"Yes":"No",d$1.sensitiveDataCondition&&jsxs("span",{children:[" ","(Condition:"," ",((l=Y.find(s=>s.value===d$1.sensitiveDataCondition))==null?void 0:l.label)||d$1.sensitiveDataCondition,")"]})]}),jsxs("p",{className:"text-sm mt-2",children:[jsx("span",{className:"font-medium",children:"Cross-Border Transfer:"})," ",d$1.crossBorderTransfer?"Yes":"No"]}),d$1.recipients&&d$1.recipients.length>0&&jsxs("p",{className:"text-sm mt-2",children:[jsx("span",{className:"font-medium",children:"Recipients:"})," ",d$1.recipients.join(", ")]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Created:"})," ",w(d$1.createdAt)]}),jsxs("p",{className:"text-sm mt-2",children:[jsx("span",{className:"font-medium",children:"Last Updated:"})," ",w(d$1.updatedAt)]}),d$1.reviewDate&&jsxs("p",{className:"text-sm mt-2",children:[jsx("span",{className:"font-medium",children:"Next Review:"})," ",w(d$1.reviewDate),d$1.reviewDate<Date.now()&&jsx("span",{className:"text-red-600 dark:text-red-400 font-medium",children:" (Overdue)"})]})]})]}),d$1.dpoApproval&&jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-6",children:[jsx("h4",{className:"text-sm font-semibold mb-2",children:"DPO Approval"}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",d$1.dpoApproval.approved?"Approved":"Not Approved"]}),jsxs("p",{className:"text-sm mt-1",children:[jsx("span",{className:"font-medium",children:"Approved By:"})," ",d$1.dpoApproval.approvedBy]}),jsxs("p",{className:"text-sm mt-1",children:[jsx("span",{className:"font-medium",children:"Date:"})," ",w(d$1.dpoApproval.approvedAt)]}),d$1.dpoApproval.notes&&jsxs("p",{className:"text-sm mt-1",children:[jsx("span",{className:"font-medium",children:"Notes:"})," ",d$1.dpoApproval.notes]})]}),jsxs("div",{className:"flex space-x-3",children:[jsx("button",{onClick:()=>E(d$1),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${f}`,children:"Edit"}),d$1.status!=="archived"&&jsx("button",{onClick:()=>O(d$1.id),className:`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 ${f}`,children:"Archive"})]})]})},pe=()=>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:"block text-sm font-medium mb-1",children:"Lawful Basis"}),jsxs("select",{id:"basisFilter",value:C,onChange:t=>ee(t.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),children:[jsx("option",{value:"all",children:"All Bases"}),H.map(t=>jsx("option",{value:t.value,children:t.label},t.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"statusFilterSelect",className:"block text-sm font-medium mb-1",children:"Status"}),jsxs("select",{id:"statusFilterSelect",value:k,onChange:t=>Z(t.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.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:"block text-sm font-medium mb-1",children:"Search"}),jsx("input",{type:"text",id:"searchInput",value:A,onChange:t=>te(t.target.value),placeholder:"Search activities...",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsx("div",{className:"flex items-end",children:jsx("button",{onClick:ie,className:a(`w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${f}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:"Add Activity"})})]}),N.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:"text-gray-600 dark:text-gray-400 text-sm",children:"No processing activities found."})}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a("w-full text-sm text-left",r==null?void 0:r.table,o),children:[jsx("thead",{className:a("text-xs uppercase bg-gray-50 dark:bg-gray-700",r==null?void 0:r.tableHeader,o),children:jsxs("tr",{children:[jsx("th",{className:"px-4 py-3",children:"Activity"}),jsx("th",{className:"px-4 py-3",children:"Lawful Basis"}),jsx("th",{className:"px-4 py-3",children:"Status"}),jsx("th",{className:"px-4 py-3",children:"DPO Approval"}),jsx("th",{className:"px-4 py-3",children:"Sensitive Data"}),jsx("th",{className:"px-4 py-3",children:"Last Updated"}),jsx("th",{className:"px-4 py-3",children:"Actions"})]})}),jsx("tbody",{children:N.map(t=>jsxs("tr",{className:a("border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",r==null?void 0:r.tableRow,o),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("button",{onClick:()=>ne(t.id),className:"font-medium text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline text-left",children:t.name}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1 truncate max-w-xs",children:t.description})]}),jsx("td",{className:"px-4 py-3",children:$(t.lawfulBasis)}),jsx("td",{className:"px-4 py-3",children:V(t.status)}),jsx("td",{className:"px-4 py-3",children:M(t)}),jsx("td",{className:"px-4 py-3",children:jsx("span",{className:`text-xs ${t.involvesSensitiveData?"text-orange-600 dark:text-orange-400 font-medium":"text-gray-600 dark:text-gray-400"}`,children:t.involvesSensitiveData?"Yes":"No"})}),jsx("td",{className:"px-4 py-3 text-xs text-gray-600 dark:text-gray-400",children:w(t.updatedAt)}),jsx("td",{className:"px-4 py-3",children:jsxs("div",{className:"flex space-x-2",children:[jsx("button",{onClick:()=>E(t),className:"text-xs text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline",children:"Edit"}),t.status!=="archived"&&jsx("button",{onClick:()=>O(t.id),className:"text-xs text-gray-600 dark:text-gray-400 hover:underline",children:"Archive"})]})})]},t.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${z}`,r==null?void 0:r.root,o),children:[jsx("h2",{className:a("text-xl font-bold mb-2",r==null?void 0:r.title,o),children:W}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:q}),K&&y==="list"&&oe(),Q&&y==="list"&&de(),y==="list"&&pe(),y==="form"&&le(),y==="detail"&&se()]})};export{fe as a};//# sourceMappingURL=chunk-ELKEZEV5.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-ELKEZEV5.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkTDDAYVKK_js=require('./chunk-TDDAYVKK.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var F={name:"",description:"",lawfulBasis:"consent",lawfulBasisJustification:"",dataCategories:"",involvesSensitiveData:false,sensitiveDataCondition:"",dataSubjectCategories:"",purposes:"",retentionPeriod:"",retentionJustification:"",recipients:"",crossBorderTransfer:false,reviewDate:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""},H=[{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"}],Y=[{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"}],fe=({activities:b,onAddActivity:_,onUpdateActivity:j,onArchiveActivity:I,title:W="Lawful Basis Tracker",description:q="Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25.",className:z="",buttonClassName:f="",showSummary:K=true,showComplianceGaps:Q=true,classNames:r,unstyled:o})=>{let[y,m]=react.useState("list"),[a,p]=react.useState(F),[h,S]=react.useState(null),[J,X]=react.useState(null),[k,Z]=react.useState("all"),[C,ee]=react.useState("all"),[A,te]=react.useState(""),[R,x]=react.useState([]),[N,re]=react.useState(b);react.useEffect(()=>{let t=[...b];if(k!=="all"&&(t=t.filter(l=>l.status===k)),C!=="all"&&(t=t.filter(l=>l.lawfulBasis===C)),A){let l=A.toLowerCase();t=t.filter(s=>s.name.toLowerCase().includes(l)||s.description.toLowerCase().includes(l)||s.purposes.some(v=>v.toLowerCase().includes(l)));}t.sort((l,s)=>s.updatedAt-l.updatedAt),re(t);},[b,k,C,A]);let w=t=>new Date(t).toLocaleDateString(),D=chunkTDDAYVKK_js.d(b),P=chunkTDDAYVKK_js.c(b),B=t=>t.split(",").map(l=>l.trim()).filter(l=>l.length>0),ie=()=>{p(F),S(null),x([]),m("form");},E=t=>{p({name:t.name,description:t.description,lawfulBasis:t.lawfulBasis,lawfulBasisJustification:t.lawfulBasisJustification,dataCategories:t.dataCategories.join(", "),involvesSensitiveData:t.involvesSensitiveData,sensitiveDataCondition:t.sensitiveDataCondition||"",dataSubjectCategories:t.dataSubjectCategories.join(", "),purposes:t.purposes.join(", "),retentionPeriod:t.retentionPeriod,retentionJustification:t.retentionJustification||"",recipients:(t.recipients||[]).join(", "),crossBorderTransfer:t.crossBorderTransfer,reviewDate:t.reviewDate?new Date(t.reviewDate).toISOString().split("T")[0]:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""}),S(t.id),x([]),m("form");},ae=()=>{let t={name:a.name,description:a.description,lawfulBasis:a.lawfulBasis,lawfulBasisJustification:a.lawfulBasisJustification,dataCategories:B(a.dataCategories),involvesSensitiveData:a.involvesSensitiveData,sensitiveDataCondition:a.sensitiveDataCondition||void 0,dataSubjectCategories:B(a.dataSubjectCategories),purposes:B(a.purposes),retentionPeriod:a.retentionPeriod,retentionJustification:a.retentionJustification||void 0,recipients:a.recipients?B(a.recipients):void 0,crossBorderTransfer:a.crossBorderTransfer,reviewDate:a.reviewDate?new Date(a.reviewDate).getTime():void 0,status:"active"},l=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{id:h||"temp",createdAt:Date.now(),updatedAt:Date.now()}),s=chunkTDDAYVKK_js.a(l);if(!s.isValid){x(s.errors);return}h&&j?j(h,t):_&&_(t),p(F),S(null),x([]),m("list");},O=t=>{I&&I(t);},ne=t=>{X(t),m("detail");},d=J?b.find(t=>t.id===J):null,V=t=>{let l={active:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",inactive:"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",under_review:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",archived:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"},s={active:"Active",inactive:"Inactive",under_review:"Under Review",archived:"Archived"};return jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a(`px-2 py-1 rounded text-xs font-medium ${l[t]}`,r==null?void 0:r.statusBadge,o),children:s[t]})},$=t=>{let l={consent:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",contract:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",legal_obligation:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",vital_interests:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",public_interest:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",legitimate_interests:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},s={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"};return jsxRuntime.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${l[t]}`,children:s[t]})},M=t=>t.dpoApproval?t.dpoApproval.approved?jsxRuntime.jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"Approved"}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",children:"Pending Approval"}):jsxRuntime.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"}),oe=()=>jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",r==null?void 0:r.summary,o),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,o),children:[jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-800 dark:text-blue-200",children:D.totalActivities}),jsxRuntime.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-300",children:"Total Activities"})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,o),children:[jsxRuntime.jsx("p",{className:"text-2xl font-bold text-orange-800 dark:text-orange-200",children:D.sensitiveDataActivities}),jsxRuntime.jsx("p",{className:"text-sm text-orange-600 dark:text-orange-300",children:"Sensitive Data"})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-purple-50 dark:bg-purple-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,o),children:[jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-800 dark:text-purple-200",children:D.crossBorderActivities}),jsxRuntime.jsx("p",{className:"text-sm text-purple-600 dark:text-purple-300",children:"Cross-Border Transfers"})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg",r==null?void 0:r.summaryCard,o),children:[jsxRuntime.jsx("p",{className:"text-2xl font-bold text-red-800 dark:text-red-200",children:D.activitiesWithoutApproval.length}),jsxRuntime.jsx("p",{className:"text-sm text-red-600 dark:text-red-300",children:"Pending Approval"})]})]}),de=()=>{if(P.length===0)return jsxRuntime.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg mb-6",children:[jsxRuntime.jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"No compliance gaps detected."}),jsxRuntime.jsx("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:"All processing activities appear to be properly documented."})]});let t=P.filter(s=>s.severity==="high"),l=P.filter(s=>s.severity==="medium");return jsxRuntime.jsxs("div",{className:"mb-6",children:[t.length>0&&jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-3",r==null?void 0:r.gapAlert,o),children:[jsxRuntime.jsxs("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-2",children:["High Priority (",t.length,")"]}),jsxRuntime.jsx("ul",{className:"space-y-1",children:t.map((s,v)=>jsxRuntime.jsx("li",{className:"text-xs text-red-700 dark:text-red-300",children:s.description},v))})]}),l.length>0&&jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-yellow-50 dark:bg-yellow-900/20 p-4 rounded-lg",r==null?void 0:r.gapAlert,o),children:[jsxRuntime.jsxs("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-2",children:["Medium Priority (",l.length,")"]}),jsxRuntime.jsx("ul",{className:"space-y-1",children:l.map((s,v)=>jsxRuntime.jsx("li",{className:"text-xs text-yellow-700 dark:text-yellow-300",children:s.description},v))})]})]})},le=()=>jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",r==null?void 0:r.form,o),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex justify-between items-center mb-4",r==null?void 0:r.header,o),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium",children:h?"Edit Processing Activity":"New Processing Activity"}),jsxRuntime.jsx("button",{onClick:()=>{m("list"),x([]);},className:`px-4 py-2 text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${f}`,children:"Cancel"})]}),R.length>0&&jsxRuntime.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-4",children:[jsxRuntime.jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-2",children:"Please correct the following errors:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside space-y-1",children:R.map((t,l)=>jsxRuntime.jsx("li",{className:"text-xs text-red-700 dark:text-red-300",children:t},l))})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"activityName",className:"block text-sm font-medium mb-1",children:"Activity Name *"}),jsxRuntime.jsx("input",{type:"text",id:"activityName",value:a.name,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{name:t.target.value})),placeholder:"e.g., Customer Account Management",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"activityDescription",className:"block text-sm font-medium mb-1",children:"Description *"}),jsxRuntime.jsx("textarea",{id:"activityDescription",value:a.description,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{description:t.target.value})),placeholder:"Describe what processing is performed...",rows:3,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"lawfulBasis",className:"block text-sm font-medium mb-1",children:"Lawful Basis (NDPA Section 25) *"}),jsxRuntime.jsx("select",{id:"lawfulBasis",value:a.lawfulBasis,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{lawfulBasis:t.target.value})),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),children:H.map(t=>jsxRuntime.jsx("option",{value:t.value,children:t.label},t.value))}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-gray-600 dark:text-gray-400",children:chunkTDDAYVKK_js.b(a.lawfulBasis)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"justification",className:"block text-sm font-medium mb-1",children:"Lawful Basis Justification *"}),jsxRuntime.jsx("textarea",{id:"justification",value:a.lawfulBasisJustification,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{lawfulBasisJustification:t.target.value})),placeholder:"Document why this lawful basis applies to this processing activity...",rows:3,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),a.lawfulBasis==="legitimate_interests"&&jsxRuntime.jsxs("div",{className:"border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 bg-indigo-50 dark:bg-indigo-900/20",children:[jsxRuntime.jsx("h4",{className:"text-sm font-semibold text-indigo-800 dark:text-indigo-200 mb-3",children:"Legitimate Interest Assessment (LIA)"}),jsxRuntime.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."}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaPurpose",className:"block text-sm font-medium mb-1",children:"Purpose Test"}),jsxRuntime.jsx("textarea",{id:"liaPurpose",value:a.liaPurposeTest,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{liaPurposeTest:t.target.value})),placeholder:"Describe the legitimate interest being pursued...",rows:2,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaNecessity",className:"block text-sm font-medium mb-1",children:"Necessity Test"}),jsxRuntime.jsx("textarea",{id:"liaNecessity",value:a.liaNecessityTest,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{liaNecessityTest:t.target.value})),placeholder:"Explain why this processing is necessary for the stated purpose...",rows:2,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaBalancing",className:"block text-sm font-medium mb-1",children:"Balancing Test"}),jsxRuntime.jsx("textarea",{id:"liaBalancing",value:a.liaBalancingTest,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{liaBalancingTest:t.target.value})),placeholder:"Assess the impact on data subjects' rights and interests...",rows:2,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaSafeguards",className:"block text-sm font-medium mb-1",children:"Safeguards"}),jsxRuntime.jsx("input",{type:"text",id:"liaSafeguards",value:a.liaSafeguards,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{liaSafeguards:t.target.value})),placeholder:"List safeguards (comma-separated)...",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaConclusion",className:"block text-sm font-medium mb-1",children:"Conclusion"}),jsxRuntime.jsx("textarea",{id:"liaConclusion",value:a.liaConclusion,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{liaConclusion:t.target.value})),placeholder:"State your overall conclusion...",rows:2,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataCategories",className:"block text-sm font-medium mb-1",children:"Data Categories *"}),jsxRuntime.jsx("input",{type:"text",id:"dataCategories",value:a.dataCategories,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{dataCategories:t.target.value})),placeholder:"e.g., Name, Email, Phone Number (comma-separated)",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("label",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:a.involvesSensitiveData,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{involvesSensitiveData:t.target.checked,sensitiveDataCondition:t.target.checked?a.sensitiveDataCondition:""})),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Involves Sensitive Personal Data (NDPA Section 27)"})]})}),a.involvesSensitiveData&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sensitiveCondition",className:"block text-sm font-medium mb-1",children:"Sensitive Data Condition (NDPA Section 27) *"}),jsxRuntime.jsxs("select",{id:"sensitiveCondition",value:a.sensitiveDataCondition,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{sensitiveDataCondition:t.target.value})),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),children:[jsxRuntime.jsx("option",{value:"",children:"Select a condition..."}),Y.map(t=>jsxRuntime.jsx("option",{value:t.value,children:t.label},t.value))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataSubjectCategories",className:"block text-sm font-medium mb-1",children:"Data Subject Categories *"}),jsxRuntime.jsx("input",{type:"text",id:"dataSubjectCategories",value:a.dataSubjectCategories,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{dataSubjectCategories:t.target.value})),placeholder:"e.g., Customers, Employees, Vendors (comma-separated)",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"purposes",className:"block text-sm font-medium mb-1",children:"Processing Purposes *"}),jsxRuntime.jsx("input",{type:"text",id:"purposes",value:a.purposes,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{purposes:t.target.value})),placeholder:"e.g., Account management, Service delivery (comma-separated)",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionPeriod",className:"block text-sm font-medium mb-1",children:"Retention Period *"}),jsxRuntime.jsx("input",{type:"text",id:"retentionPeriod",value:a.retentionPeriod,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{retentionPeriod:t.target.value})),placeholder:"e.g., 3 years after account closure",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionJustification",className:"block text-sm font-medium mb-1",children:"Retention Justification"}),jsxRuntime.jsx("input",{type:"text",id:"retentionJustification",value:a.retentionJustification,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{retentionJustification:t.target.value})),placeholder:"Reason for the retention period",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recipients",className:"block text-sm font-medium mb-1",children:"Recipients"}),jsxRuntime.jsx("input",{type:"text",id:"recipients",value:a.recipients,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{recipients:t.target.value})),placeholder:"e.g., Payment processor, Cloud provider (comma-separated)",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("label",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:a.crossBorderTransfer,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{crossBorderTransfer:t.target.checked})),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"Involves Cross-Border Transfer Outside Nigeria"})]})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"reviewDate",className:"block text-sm font-medium mb-1",children:"Next Review Date"}),jsxRuntime.jsx("input",{type:"date",id:"reviewDate",value:a.reviewDate,onChange:t=>p(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{reviewDate:t.target.value})),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[jsxRuntime.jsx("button",{onClick:()=>{m("list"),x([]);},className:`px-4 py-2 text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${f}`,children:"Cancel"}),jsxRuntime.jsx("button",{onClick:ae,className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${f}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:h?"Update Activity":"Create Activity"})]})]})]}),se=()=>{var l;if(!d)return jsxRuntime.jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Activity not found."})});let t=chunkTDDAYVKK_js.a(d);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{onClick:()=>m("list"),className:"text-sm text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline mb-2",children:"Back to list"}),jsxRuntime.jsx("h3",{className:"text-lg font-medium",children:d.name})]}),jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[$(d.lawfulBasis),V(d.status),M(d)]})]}),t.warnings.length>0&&jsxRuntime.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md mb-4",children:[jsxRuntime.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-1",children:"Warnings"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside space-y-1",children:t.warnings.map((s,v)=>jsxRuntime.jsx("li",{className:"text-xs text-yellow-700 dark:text-yellow-300",children:s},v))})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Description:"})," ",d.description]}),jsxRuntime.jsxs("p",{className:"text-sm mt-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Lawful Basis:"})," ",chunkTDDAYVKK_js.b(d.lawfulBasis)]}),jsxRuntime.jsxs("p",{className:"text-sm mt-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Justification:"})," ",d.lawfulBasisJustification]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Categories:"})," ",d.dataCategories.join(", ")]}),jsxRuntime.jsxs("p",{className:"text-sm mt-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Subject Categories:"})," ",d.dataSubjectCategories.join(", ")]}),jsxRuntime.jsxs("p",{className:"text-sm mt-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Purposes:"})," ",d.purposes.join(", ")]}),jsxRuntime.jsxs("p",{className:"text-sm mt-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Retention Period:"})," ",d.retentionPeriod,d.retentionJustification&&jsxRuntime.jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:[" ","(",d.retentionJustification,")"]})]})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",d.involvesSensitiveData?"Yes":"No",d.sensitiveDataCondition&&jsxRuntime.jsxs("span",{children:[" ","(Condition:"," ",((l=Y.find(s=>s.value===d.sensitiveDataCondition))==null?void 0:l.label)||d.sensitiveDataCondition,")"]})]}),jsxRuntime.jsxs("p",{className:"text-sm mt-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Cross-Border Transfer:"})," ",d.crossBorderTransfer?"Yes":"No"]}),d.recipients&&d.recipients.length>0&&jsxRuntime.jsxs("p",{className:"text-sm mt-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Recipients:"})," ",d.recipients.join(", ")]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Created:"})," ",w(d.createdAt)]}),jsxRuntime.jsxs("p",{className:"text-sm mt-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Last Updated:"})," ",w(d.updatedAt)]}),d.reviewDate&&jsxRuntime.jsxs("p",{className:"text-sm mt-2",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Next Review:"})," ",w(d.reviewDate),d.reviewDate<Date.now()&&jsxRuntime.jsx("span",{className:"text-red-600 dark:text-red-400 font-medium",children:" (Overdue)"})]})]})]}),d.dpoApproval&&jsxRuntime.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-6",children:[jsxRuntime.jsx("h4",{className:"text-sm font-semibold mb-2",children:"DPO Approval"}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Status:"})," ",d.dpoApproval.approved?"Approved":"Not Approved"]}),jsxRuntime.jsxs("p",{className:"text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Approved By:"})," ",d.dpoApproval.approvedBy]}),jsxRuntime.jsxs("p",{className:"text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Date:"})," ",w(d.dpoApproval.approvedAt)]}),d.dpoApproval.notes&&jsxRuntime.jsxs("p",{className:"text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Notes:"})," ",d.dpoApproval.notes]})]}),jsxRuntime.jsxs("div",{className:"flex space-x-3",children:[jsxRuntime.jsx("button",{onClick:()=>E(d),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${f}`,children:"Edit"}),d.status!=="archived"&&jsxRuntime.jsx("button",{onClick:()=>O(d.id),className:`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 ${f}`,children:"Archive"})]})]})},pe=()=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"basisFilter",className:"block text-sm font-medium mb-1",children:"Lawful Basis"}),jsxRuntime.jsxs("select",{id:"basisFilter",value:C,onChange:t=>ee(t.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),children:[jsxRuntime.jsx("option",{value:"all",children:"All Bases"}),H.map(t=>jsxRuntime.jsx("option",{value:t.value,children:t.label},t.value))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"statusFilterSelect",className:"block text-sm font-medium mb-1",children:"Status"}),jsxRuntime.jsxs("select",{id:"statusFilterSelect",value:k,onChange:t=>Z(t.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),children:[jsxRuntime.jsx("option",{value:"all",children:"All Statuses"}),jsxRuntime.jsx("option",{value:"active",children:"Active"}),jsxRuntime.jsx("option",{value:"inactive",children:"Inactive"}),jsxRuntime.jsx("option",{value:"under_review",children:"Under Review"}),jsxRuntime.jsx("option",{value:"archived",children:"Archived"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"searchInput",className:"block text-sm font-medium mb-1",children:"Search"}),jsxRuntime.jsx("input",{type:"text",id:"searchInput",value:A,onChange:t=>te(t.target.value),placeholder:"Search activities...",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]}),jsxRuntime.jsx("div",{className:"flex items-end",children:jsxRuntime.jsx("button",{onClick:ie,className:chunkE64TU6IU_js.a(`w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${f}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:"Add Activity"})})]}),N.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-32 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No processing activities found."})}):jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:chunkE64TU6IU_js.a("w-full text-sm text-left",r==null?void 0:r.table,o),children:[jsxRuntime.jsx("thead",{className:chunkE64TU6IU_js.a("text-xs uppercase bg-gray-50 dark:bg-gray-700",r==null?void 0:r.tableHeader,o),children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Activity"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Lawful Basis"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Status"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"DPO Approval"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Sensitive Data"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Last Updated"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{children:N.map(t=>jsxRuntime.jsxs("tr",{className:chunkE64TU6IU_js.a("border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",r==null?void 0:r.tableRow,o),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("button",{onClick:()=>ne(t.id),className:"font-medium text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline text-left",children:t.name}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1 truncate max-w-xs",children:t.description})]}),jsxRuntime.jsx("td",{className:"px-4 py-3",children:$(t.lawfulBasis)}),jsxRuntime.jsx("td",{className:"px-4 py-3",children:V(t.status)}),jsxRuntime.jsx("td",{className:"px-4 py-3",children:M(t)}),jsxRuntime.jsx("td",{className:"px-4 py-3",children:jsxRuntime.jsx("span",{className:`text-xs ${t.involvesSensitiveData?"text-orange-600 dark:text-orange-400 font-medium":"text-gray-600 dark:text-gray-400"}`,children:t.involvesSensitiveData?"Yes":"No"})}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-xs text-gray-600 dark:text-gray-400",children:w(t.updatedAt)}),jsxRuntime.jsx("td",{className:"px-4 py-3",children:jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("button",{onClick:()=>E(t),className:"text-xs text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline",children:"Edit"}),t.status!=="archived"&&jsxRuntime.jsx("button",{onClick:()=>O(t.id),className:"text-xs text-gray-600 dark:text-gray-400 hover:underline",children:"Archive"})]})})]},t.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${z}`,r==null?void 0:r.root,o),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",r==null?void 0:r.title,o),children:W}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:q}),K&&y==="list"&&oe(),Q&&y==="list"&&de(),y==="list"&&pe(),y==="form"&&le(),y==="detail"&&se()]})};exports.a=fe;//# sourceMappingURL=chunk-ER7X6E36.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-ER7X6E36.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-2SYNHRP6.mjs';import {a as a$3}from'./chunk-FXTZDKDC.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {b,a as a$2}from'./chunk-WWT2ZSNU.mjs';import {useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var ke=({requestTypes:A,onSubmit:z,onValidationError:M,title:K="Submit a Data Subject Request",description:te="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part IV, Sections 29-36.",submitButtonText:oe="Submit Request",className:W="",buttonClassName:H="",showConfirmation:re=true,confirmationMessage:ie="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:V=true,identifierTypes:l=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:b$1=true,labels:D={},classNames:e,unstyled:m=false,isSubmitting:C=false,defaultValues:k,onReset:$})=>{var t,d,h,q,se,ge;let[I,_]=useState((k==null?void 0:k.requestType)||""),[E,F]=useState(((t=k==null?void 0:k.dataSubject)==null?void 0:t.fullName)||""),[B,L]=useState(((d=k==null?void 0:k.dataSubject)==null?void 0:d.email)||""),[Y,Z]=useState(((h=k==null?void 0:k.dataSubject)==null?void 0:h.phone)||""),[ae,P]=useState(((q=k==null?void 0:k.dataSubject)==null?void 0:q.identifierType)||((se=l[0])==null?void 0:se.id)||""),[G,Q]=useState(((ge=k==null?void 0:k.dataSubject)==null?void 0:ge.identifierValue)||""),[j,J]=useState((k==null?void 0:k.additionalInfo)||{}),[T,U]=useState(false),[o,i]=useState({}),v=()=>{var r;_(""),F(""),L(""),Z(""),P(((r=l[0])==null?void 0:r.id)||""),Q(""),J({}),U(false),i({}),$==null||$();},u=A.find(r=>r.id===I),R=r=>{_(r.target.value),J({});},s=(r,w)=>{J(X=>b(a$2({},X),{[r]:w}));},x=()=>{let r={};return E.trim()||(r.fullName="Full name is required"),B.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(B)||(r.email="Email is invalid"):r.email="Email is required",I||(r.requestType="Please select a request type"),V&&!G.trim()&&(r.identifierValue="Identifier value is required"),u!=null&&u.requiresAdditionalInfo&&u.additionalFields&&u.additionalFields.forEach(w=>{w.required&&!j[w.id]&&(r[`additional_${w.id}`]=`${w.label} is required`);}),i(r),r},S=r=>{r.preventDefault();let w=x();if(Object.keys(w).length>0){M==null||M(w);return}let X=Object.keys(j).length>0?Object.fromEntries(Object.entries(j).map(([be,le])=>[be,typeof le=="string"?a$3(le):le])):void 0,ne={requestType:I,dataSubject:{fullName:a$3(E),email:a$3(B),phone:Y?a$3(Y):void 0,identifierType:ae,identifierValue:a$3(G)},additionalInfo:X,submittedAt:Date.now()};z(ne),re&&U(true);};return T?jsxs("div",{className:a(`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${W}`,e==null?void 0:e.successMessage,m),children:[jsx("h2",{className:a("text-lg font-bold text-green-800 dark:text-green-200 mb-2",e==null?void 0:e.title,m),children:"Request Submitted"}),jsx("p",{className:a("text-green-700 dark:text-green-300",e==null?void 0:e.description,m),children:ie}),jsx("button",{onClick:()=>U(false),className:a(`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${H}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),m),children:"Submit Another Request"})]}):jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${W}`,e==null?void 0:e.root,m),children:[jsx("h2",{className:a("text-xl font-bold mb-2",e==null?void 0:e.title,m),children:K}),jsx("p",{className:a("mb-6 text-gray-600 dark:text-gray-300",e==null?void 0:e.description,m),children:te}),jsx("form",{onSubmit:S,className:a("",e==null?void 0:e.form,m),children:jsxs("div",{className:a("space-y-4",e==null?void 0:e.fieldGroup,m),children:[jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Personal Information"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"fullName",className:a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:[D.name||"Full Name"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:E,onChange:r=>F(r.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:true,"aria-invalid":!!o.fullName,"aria-describedby":o.fullName?"fullName-error":void 0}),o.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:o.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:[D.email||"Email Address"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"email",id:"email",value:B,onChange:r=>L(r.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:true,"aria-invalid":!!o.email,"aria-describedby":o.email?"email-error":void 0}),o.email&&jsx("p",{id:"email-error",role:"alert",className:"mt-1 text-sm text-red-500",children:o.email})]}),b$1&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:Y,onChange:r=>Z(r.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m)})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Request Details"}),jsxs("div",{className:"mb-4",children:[jsxs("label",{htmlFor:"requestType",className:a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:[D.requestType||"Request Type"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsxs("select",{id:"requestType",value:I,onChange:R,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,m),required:true,"aria-invalid":!!o.requestType,"aria-describedby":o.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),A.map(r=>jsx("option",{value:r.id,children:r.name},r.id))]}),o.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:"mt-1 text-sm text-red-500",children:o.requestType})]}),u&&jsxs("div",{className:"mb-4 p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-2",children:u.description}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Estimated completion time: ",u.estimatedCompletionTime," ",u.estimatedCompletionTime===1?"day":"days"]})]}),jsxs("div",{className:"mb-4",children:[jsx("label",{htmlFor:"requestDescription",className:a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:D.description||"Additional Information"}),jsx("textarea",{id:"requestDescription",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.textarea,m),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),V&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Identity Verification"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"identifierType",className:a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:["Identifier Type ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("select",{id:"identifierType",value:ae,onChange:r=>P(r.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,m),required:true,children:l.map(r=>jsx("option",{value:r.id,children:r.label},r.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:["Identifier Value ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:G,onChange:r=>Q(r.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:true,"aria-invalid":!!o.identifierValue,"aria-describedby":o.identifierValue?"identifierValue-error":void 0}),o.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:"mt-1 text-sm text-red-500",children:o.identifierValue})]})]})]}),(u==null?void 0:u.requiresAdditionalInfo)&&u.additionalFields&&u.additionalFields.length>0&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Additional Information"}),jsx("div",{className:"space-y-4",children:u.additionalFields.map(r=>jsxs("div",{children:[jsxs("label",{htmlFor:r.id,className:a("block text-sm font-medium mb-1",e==null?void 0:e.label,m),children:[r.label," ",r.required&&jsx("span",{className:"text-red-500",children:"*"})]}),r.type==="text"&&jsx("input",{type:"text",id:r.id,value:j[r.id]||"",onChange:w=>s(r.id,w.target.value),placeholder:r.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0}),r.type==="textarea"&&jsx("textarea",{id:r.id,value:j[r.id]||"",onChange:w=>s(r.id,w.target.value),placeholder:r.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.textarea,m),rows:4,required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0}),r.type==="select"&&r.options&&jsxs("select",{id:r.id,value:j[r.id]||"",onChange:w=>s(r.id,w.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,m),required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0,children:[jsx("option",{value:"",children:r.placeholder||"Select an option"}),r.options.map(w=>jsx("option",{value:w,children:w},w))]}),r.type==="checkbox"&&jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{type:"checkbox",id:r.id,checked:!!j[r.id],onChange:w=>s(r.id,w.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0})}),jsx("div",{className:"ml-3 text-sm",children:jsx("label",{htmlFor:r.id,className:"text-gray-700 dark:text-gray-300",children:r.placeholder||r.label})})]}),r.type==="file"&&jsx("input",{type:"file",id:r.id,onChange:w=>{var ne;let X=(ne=w.target.files)==null?void 0:ne[0];X&&s(r.id,X);},className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,m),required:r.required,"aria-invalid":!!o[`additional_${r.id}`],"aria-describedby":o[`additional_${r.id}`]?`additional-${r.id}-error`:void 0}),o[`additional_${r.id}`]&&jsx("p",{id:`additional-${r.id}-error`,role:"alert",className:"mt-1 text-sm text-red-500",children:o[`additional_${r.id}`]})]},r.id))})]}),jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("h3",{className:"text-sm font-semibold mb-2",children:"Privacy Notice"}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:"The information you provide in this form will be used solely for the purpose of processing your data subject request. We will retain this information for as long as necessary to fulfill your request and to comply with our legal obligations. For more information, please refer to our Privacy Policy."})]}),jsxs("div",{className:"mt-6 flex gap-3 relative",children:[C&&(e==null?void 0:e.loadingOverlay)&&jsx("div",{className:e.loadingOverlay}),jsx("button",{type:"submit",disabled:C,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 ${H} ${C?"opacity-50 cursor-not-allowed":""}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),m),children:C?"Submitting...":D.submit||oe}),jsx("button",{type:"button",onClick:v,className:a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,m),children:"Reset"})]})]})})]})};var je=({requests:A,onSelectRequest:z,onUpdateStatus:M,onAssignRequest:K,title:te="Data Subject Request Dashboard",description:oe="Track and manage data subject requests in compliance with NDPA Part IV requirements.",className:W="",buttonClassName:H="",showRequestDetails:re=true,showRequestTimeline:ie=true,showDeadlineAlerts:V=true,assignees:l=[],classNames:b,unstyled:D=false})=>{let[e,m]=useState(null),[C,k]=useState(A),[$,I]=useState("all"),[_,E]=useState("all"),[F,B]=useState(""),[L,Y]=useState("createdAt"),[Z,ae]=useState("desc"),[P,G]=useState("");useEffect(()=>{let t=[...A];if($!=="all"&&(t=t.filter(d=>d.status===$)),_!=="all"&&(t=t.filter(d=>d.type===_)),F){let d=F.toLowerCase();t=t.filter(h=>h.subject.name.toLowerCase().includes(d)||h.subject.email.toLowerCase().includes(d)||h.description&&h.description.toLowerCase().includes(d));}t.sort((d,h)=>{let q=0;switch(L){case "createdAt":q=d.createdAt-h.createdAt;break;case "dueDate":q=(d.dueDate||0)-(h.dueDate||0);break;case "type":q=d.type.localeCompare(h.type);break;case "status":q=d.status.localeCompare(h.status);break;default:q=d.createdAt-h.createdAt;}return Z==="asc"?q:-q}),k(t);},[A,$,_,F,L,Z]),useEffect(()=>{C.length>0&&!e&&m(C[0].id);},[C,e]);let Q=t=>{m(t),z&&z(t);},j=t=>{e&&M&&M(e,t);},J=()=>{e&&P&&K&&(K(e,P),G(""));},T=t=>new Date(t).toLocaleDateString(),U=t=>{let d=Date.now(),h=(t-d)/(1440*60*1e3);return Math.ceil(h)},o=e?A.find(t=>t.id===e):null,i=t=>{let d={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},h={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${d[t]}`,children:h[t]})},v=t=>jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",inProgress:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",rejected:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",awaitingVerification:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200"}[t]}`,b==null?void 0:b.statusBadge,D),children:t==="inProgress"?"In Progress":t==="awaitingVerification"?"Awaiting Verification":t.charAt(0).toUpperCase()+t.slice(1)}),u=t=>{if(!t.dueDate)return null;let d=U(t.dueDate);return d<=0?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Deadline Passed"}),jsx("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:"The response deadline has passed. Immediate action is required."})]}):d<=3?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Urgent: Deadline Approaching"}),jsxs("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:["Only ",d," day",d!==1?"s":""," remaining until the response deadline."]})]}):d<=7?jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md",children:[jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium",children:"Deadline Approaching"}),jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:[d," days remaining until the response deadline."]})]}):jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md",children:[jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"Deadline Tracking"}),jsxs("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:[d," days remaining until the response deadline."]})]})},R=t=>{let d=[{title:"Request Received",date:t.createdAt,completed:true,description:`Request was received on ${T(t.createdAt)}.`}];return t.verifiedAt?d.push({title:"Identity Verified",date:t.verifiedAt,completed:true,description:`Data subject's identity was verified on ${T(t.verifiedAt)}.`}):t.status==="awaitingVerification"&&d.push({title:"Identity Verification",date:Date.now(),completed:false,description:"Awaiting verification of data subject's identity."}),(t.status==="inProgress"||t.status==="completed"||t.status==="rejected")&&d.push({title:"Processing Started",date:t.updatedAt,completed:true,description:`Request processing started on ${T(t.updatedAt)}.`}),t.status==="completed"?d.push({title:"Request Completed",date:t.completedAt||Date.now(),completed:true,description:`Request was completed on ${T(t.completedAt||Date.now())}.`}):t.status==="rejected"&&d.push({title:"Request Rejected",date:t.completedAt||Date.now(),completed:true,description:`Request was rejected on ${T(t.completedAt||Date.now())}.${t.rejectionReason?` Reason: ${t.rejectionReason}`:""}`}),t.dueDate&&d.push({title:"Response Deadline",date:t.dueDate,completed:Date.now()>t.dueDate,description:`Response is due by ${T(t.dueDate)}.`}),jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:d.map((h,q)=>jsxs("li",{className:"mb-6 ml-4",children:[jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${h.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"}`}),jsx("time",{className:"mb-1 text-sm font-normal leading-none text-gray-600 dark:text-gray-500",children:h.date?T(h.date):"Pending"}),jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:h.title}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:h.description})]},q))})]})},s=()=>[{value:"all",label:"All Types"},{value:"information",label:"Information (NDPA Section 29)"},{value:"access",label:"Access (NDPA Section 30)"},{value:"rectification",label:"Rectification (NDPA Section 31)"},{value:"erasure",label:"Erasure (NDPA Section 32)"},{value:"restriction",label:"Restriction (NDPA Section 33)"},{value:"portability",label:"Portability (NDPA Section 34)"},{value:"objection",label:"Objection (NDPA Section 35)"},{value:"automated_decision_making",label:"Automated Decision-Making (NDPA Section 36)"}].map(d=>jsx("option",{value:d.value,children:d.label},d.value)),x=()=>[{value:"all",label:"All Statuses"},{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(d=>jsx("option",{value:d.value,children:d.label},d.value)),S=()=>[{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(d=>jsx("option",{value:d.value,children:d.label},d.value));return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${W}`,b==null?void 0:b.root,D),children:[jsxs("div",{className:a("",b==null?void 0:b.header,D),children:[jsx("h2",{className:a("text-xl font-bold mb-2",b==null?void 0:b.title,D),children:te}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:oe})]}),jsxs("div",{className:a("mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",b==null?void 0:b.filters,D),children:[jsxs("div",{children:[jsx("label",{htmlFor:"statusFilter",className:"block text-sm font-medium mb-1",children:"Status Filter"}),jsx("select",{id:"statusFilter",value:$,onChange:t=>I(t.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:x()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"typeFilter",className:"block text-sm font-medium mb-1",children:"Request Type Filter"}),jsx("select",{id:"typeFilter",value:_,onChange:t=>E(t.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:s()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sortBy",className:"block text-sm font-medium mb-1",children:"Sort By"}),jsxs("select",{id:"sortBy",value:L,onChange:t=>Y(t.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"createdAt",children:"Date Received"}),jsx("option",{value:"dueDate",children:"Due Date"}),jsx("option",{value:"type",children:"Request Type"}),jsx("option",{value:"status",children:"Status"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchTerm",className:"block text-sm font-medium mb-1",children:"Search"}),jsx("input",{type:"text",id:"searchTerm",value:F,onChange:t=>B(t.target.value),placeholder:"Search requests...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxs("div",{className:"md:col-span-1",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"DSR Requests"}),C.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data subject requests found."}):jsx("div",{className:a("space-y-2 max-h-96 overflow-y-auto pr-2",b==null?void 0:b.requestList,D),children:C.map(t=>{let d=t.dueDate?U(t.dueDate):null,h=null;return d!==null&&(d<=0?h=jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-bold",children:"Overdue"}):d<=3?h=jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:"Urgent"}):d<=7&&(h=jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Soon"}))),jsxs("div",{className:a(`p-3 rounded-md cursor-pointer ${e===t.id?"bg-[rgb(var(--ndpr-primary)/0.05)] dark:bg-[rgb(var(--ndpr-primary)/0.1)] border border-[rgb(var(--ndpr-primary)/0.2)] dark:border-[rgb(var(--ndpr-primary)/0.3)]":"bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"}`,b==null?void 0:b.requestItem,D),onClick:()=>Q(t.id),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),i(t.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:["Received: ",T(t.createdAt)]}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsx("div",{children:v(t.status)}),jsx("div",{children:h})]})]},t.id)})})]}),jsx("div",{className:a("md:col-span-2",b==null?void 0:b.detailPanel,D),children:o?jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsx("h3",{className:"text-lg font-medium",children:o.subject.name}),jsxs("div",{className:"flex space-x-2",children:[i(o.type),v(o.status)]})]}),V&&o.dueDate&&jsx("div",{className:"mb-4",children:u(o)}),re&&jsxs("div",{className:"mb-6",children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Email:"})," ",o.subject.email]}),o.subject.phone&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Phone:"})," ",o.subject.phone]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Received:"})," ",T(o.createdAt)]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Request Type:"})," ",{information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"}[o.type]||o.type]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",o.status==="inProgress"?"In Progress":o.status==="awaitingVerification"?"Awaiting Verification":o.status.charAt(0).toUpperCase()+o.status.slice(1)]}),o.dueDate&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Due Date:"})," ",T(o.dueDate)]})]})]}),o.description&&jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium",children:"Request Details:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:o.description})]}),o.additionalInfo&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium",children:"Additional Information:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:typeof o.additionalInfo=="object"?JSON.stringify(o.additionalInfo,null,2):String(o.additionalInfo||"No additional information provided")})]})]}),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("h3",{className:"text-md font-medium mb-2",children:"Update Status"}),jsxs("div",{className:"flex space-x-2",children:[jsx("select",{value:o.status,onChange:t=>j(t.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:S()}),jsx("button",{onClick:()=>j(o.status),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${H}`,children:"Update"})]})]}),l.length>0&&jsxs("div",{children:[jsx("h3",{className:"text-md font-medium mb-2",children:"Assign Request"}),jsxs("div",{className:"flex space-x-2",children:[jsxs("select",{value:P,onChange:t=>G(t.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"",children:"Select Assignee"}),l.map(t=>jsx("option",{value:t,children:t},t))]}),jsx("button",{onClick:J,disabled:!P,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] disabled:bg-gray-300 disabled:text-gray-500 ${H}`,children:"Assign"})]})]})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Request Summary"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:jsx("pre",{children:JSON.stringify(a$1(o),null,2)})})})]}),ie&&R(o)]}):jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Select a request to view details"})})})]})]})};var _e=({requests:A,onSelectRequest:z,title:M="DSR Request Tracker",description:K="Track the status and progress of data subject requests as required by NDPA Part IV.",className:te="",buttonClassName:oe="",showSummaryStats:W=true,showTypeBreakdown:H=true,showStatusBreakdown:re=true,showTimelineChart:ie=true,showOverdueRequests:V=true,classNames:l,unstyled:b=false})=>{let[D,e]=useState("30days"),[m,C]=useState(A),[k,$]=useState([]),[I,_]=useState([]);useEffect(()=>{let i=Date.now(),v;switch(D){case "7days":v=A.filter(s=>i-s.createdAt<=10080*60*1e3);break;case "30days":v=A.filter(s=>i-s.createdAt<=720*60*60*1e3);break;case "90days":v=A.filter(s=>i-s.createdAt<=2160*60*60*1e3);break;default:v=[...A];}C(v);let u=v.filter(s=>s.dueDate&&i>s.dueDate&&s.status!=="completed"&&s.status!=="rejected");$(u);let R=v.filter(s=>s.dueDate&&i<s.dueDate&&s.dueDate-i<=10080*60*1e3&&s.status!=="completed"&&s.status!=="rejected");_(R);},[A,D]);let E=i=>{z&&z(i);},F=i=>new Date(i).toLocaleDateString(),B=i=>{let v=Date.now(),u=(i-v)/(1440*60*1e3);return Math.ceil(u)},L=()=>{let i=m.filter(u=>u.status==="completed"&&u.completedAt&&u.createdAt);if(i.length===0)return null;let v=i.reduce((u,R)=>{let s=((R.completedAt||0)-R.createdAt)/864e5;return u+s},0);return Number((v/i.length).toFixed(1))},Y=()=>{let i=m.filter(u=>(u.status==="completed"||u.status==="rejected")&&u.completedAt&&u.dueDate);if(i.length===0)return null;let v=i.filter(u=>(u.completedAt||0)<=(u.dueDate||0));return Math.round(v.length/i.length*100)},Z=()=>{let i={};return m.forEach(v=>{i[v.type]=(i[v.type]||0)+1;}),{information:i.information||0,access:i.access||0,rectification:i.rectification||0,erasure:i.erasure||0,restriction:i.restriction||0,portability:i.portability||0,objection:i.objection||0,automated_decision_making:i.automated_decision_making||0}},ae=()=>{let i={};return m.forEach(v=>{i[v.status]=(i[v.status]||0)+1;}),{pending:i.pending||0,awaitingVerification:i.awaitingVerification||0,inProgress:i.inProgress||0,completed:i.completed||0,rejected:i.rejected||0}},P=i=>{let v={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},u={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${v[i]}`,children:u[i]})},Q=()=>{let i=m.length,v=m.filter(x=>x.status!=="completed"&&x.status!=="rejected").length;m.filter(x=>x.status==="completed"||x.status==="rejected").length;let R=L(),s=Y();return jsxs("div",{className:a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",l==null?void 0:l.stats,b),children:[jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",l==null?void 0:l.statCard,b),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Total Requests"}),jsx("p",{className:"text-2xl font-bold",children:i})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",l==null?void 0:l.statCard,b),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Pending Requests"}),jsx("p",{className:"text-2xl font-bold",children:v})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",l==null?void 0:l.statCard,b),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Avg. Response Time"}),jsx("p",{className:"text-2xl font-bold",children:R!==null?`${R} days`:"N/A"})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",l==null?void 0:l.statCard,b),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Compliance Rate"}),jsx("p",{className:"text-2xl font-bold",children:s!==null?`${s}%`:"N/A"})]})]})},j=()=>{let i=Z(),v=m.length,u=Object.entries(i).sort(([,R],[,s])=>s-R).map(([R])=>R);return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",l==null?void 0:l.table,b),children:[jsx("h3",{className:a("text-lg font-medium mb-4",l==null?void 0:l.tableHeader,b),children:"Request Types"}),v===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsx("div",{className:"space-y-4",children:u.map(R=>{let s=i[R],x=Math.round(s/v*100);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-center mb-1",children:[jsxs("div",{className:"flex items-center",children:[P(R),jsxs("span",{className:"ml-2 text-sm",children:[s," requests"]})]}),jsxs("span",{className:"text-sm font-medium",children:[x,"%"]})]}),jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5",children:jsx("div",{className:"bg-[rgb(var(--ndpr-primary))] h-2.5 rounded-full",style:{width:`${x}%`}})})]},R)})})]})},J=()=>{let i=ae(),v=m.length,u=["pending","awaitingVerification","inProgress","completed","rejected"],R={pending:"bg-yellow-500",awaitingVerification:"bg-purple-500",inProgress:"bg-blue-500",completed:"bg-green-500",rejected:"bg-red-500"};return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",l==null?void 0:l.table,b),children:[jsx("h3",{className:a("text-lg font-medium mb-4",l==null?void 0:l.tableHeader,b),children:"Request Status"}),v===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{children:[jsx("div",{className:"flex h-4 mb-2",children:u.map(s=>{let x=i[s],S=x/v*100;return S>0?jsx("div",{className:`${R[s]} first:rounded-l-full last:rounded-r-full`,style:{width:`${S}%`},title:`${s}: ${x} (${Math.round(S)}%)`},s):null})}),jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 mt-4",children:u.map(s=>{let x=i[s],S=Math.round(x/v*100);return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:`w-3 h-3 rounded-full ${R[s]} mr-2`}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium",children:s==="inProgress"?"In Progress":s==="awaitingVerification"?"Awaiting Verification":s.charAt(0).toUpperCase()+s.slice(1)}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:[x," (",S,"%)"]})]})]},s)})})]})]})},T=()=>{let i={};m.forEach(x=>{let S=new Date(x.createdAt),t=`${S.getFullYear()}-${String(S.getMonth()+1).padStart(2,"0")}`;i[t]=(i[t]||0)+1;});let u=Object.keys(i).sort().slice(-6),R=Math.max(...Object.values(i).filter(x=>x>0),1),s=x=>{let[S,t]=x.split("-");return `${t}/${S.slice(2)}`};return jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),u.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{className:"h-40",children:[jsx("div",{className:"flex h-32 items-end justify-between space-x-2",children:u.map(x=>{let S=i[x],t=`${S/R*100}%`;return jsx("div",{className:"flex flex-col items-center flex-1",children:jsx("div",{className:"w-full bg-[rgb(var(--ndpr-primary))] rounded-t",style:{height:t},title:`${s(x)}: ${S} requests`})},x)})}),jsx("div",{className:"flex justify-between mt-2",children:u.map(x=>jsx("div",{className:"text-xs text-center",children:s(x)},x))})]})]})},U=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Overdue Requests"}),k.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No overdue requests."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:k.map(i=>jsxs("div",{className:a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md cursor-pointer hover:bg-red-100 dark:hover:bg-red-900/30",l==null?void 0:l.tableRow,b),onClick:()=>E(i.id),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:i.subject.name}),P(i.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:i.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",F(i.dueDate||0)]}),jsxs("p",{className:"text-xs font-bold text-red-600 dark:text-red-400",children:["Overdue by ",Math.abs(B(i.dueDate||0))," days"]})]})]},i.id))})]}),o=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Upcoming Deadlines"}),I.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No upcoming deadlines in the next 7 days."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:I.map(i=>{let v=B(i.dueDate||0);return jsxs("div",{className:a("p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md cursor-pointer hover:bg-yellow-100 dark:hover:bg-yellow-900/30",l==null?void 0:l.tableRow,b),onClick:()=>E(i.id),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:i.subject.name}),P(i.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:i.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",F(i.dueDate||0)]}),jsxs("p",{className:`text-xs font-bold ${v<=3?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`,children:["Due in ",v," days"]})]})]},i.id)})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${te}`,l==null?void 0:l.root,b),children:[jsxs("div",{className:a("flex flex-col md:flex-row md:justify-between md:items-center mb-6",l==null?void 0:l.header,b),children:[jsxs("div",{children:[jsx("h2",{className:a("text-xl font-bold mb-2",l==null?void 0:l.title,b),children:M}),jsx("p",{className:"text-gray-600 dark:text-gray-300",children:K})]}),jsxs("div",{className:"mt-4 md:mt-0",children:[jsx("label",{htmlFor:"timeframe",className:"block text-sm font-medium mb-1",children:"Timeframe"}),jsxs("select",{id:"timeframe",value:D,onChange:i=>e(i.target.value),className:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"7days",children:"Last 7 Days"}),jsx("option",{value:"30days",children:"Last 30 Days"}),jsx("option",{value:"90days",children:"Last 90 Days"}),jsx("option",{value:"all",children:"All Time"})]})]})]}),W&&Q(),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxs("div",{children:[H&&j(),re&&J()]}),jsxs("div",{children:[ie&&T(),V&&U(),V&&o()]})]})]})};export{ke as a,je as b,_e as c};//# sourceMappingURL=chunk-IBEKLDBY.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-IBEKLDBY.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var m=react.createContext({}),g=u=>{var i=u,{children:t}=i,e=chunkMQFZHA2D_js.c(i,["children"]);let n=react.useMemo(()=>{if(!e.theme)return;let r={};return e.theme.primary&&(r["--ndpr-primary"]=e.theme.primary),e.theme.primaryHover&&(r["--ndpr-primary-hover"]=e.theme.primaryHover),e.theme.primaryForeground&&(r["--ndpr-primary-foreground"]=e.theme.primaryForeground),Object.keys(r).length>0?r:void 0},[e.theme]);return jsxRuntime.jsx(m.Provider,{value:e,children:n?jsxRuntime.jsx("div",{style:n,children:t}):t})};function P(){return react.useContext(m)}exports.a=g;exports.b=P;//# sourceMappingURL=chunk-ILCNDOBU.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-ILCNDOBU.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime');var he=({options:a,onSave:y,title:m="We Value Your Privacy",description:A="We use cookies and similar technologies to provide our services and enhance your experience. Your consent is collected in accordance with NDPA Sections 25-26.",acceptAllButtonText:I="Accept All",rejectAllButtonText:P="Reject All",customizeButtonText:E="Customize",saveButtonText:O="Save Preferences",position:x="bottom",zIndex:p=9999,version:u="1.0",show:h,manageStorage:n=true,storageKey:l="ndpr_consent",className:z="",buttonClassName:k="",primaryButtonClassName:L="",secondaryButtonClassName:C="",classNames:e,unstyled:r,onAnalytics:c})=>{let[f,b]=react.useState(false),[w,R]=react.useState(false),[S,i]=react.useState({}),v=react.useRef(null),M=react.useRef(null),G=react.useRef(false),D=react.useCallback((t,d)=>{c==null||c(chunkMQFZHA2D_js.a({action:t,timestamp:Date.now(),version:u},d!==void 0?{categories:d}:{}));},[c,u]);react.useEffect(()=>{let t={};if(a.forEach(d=>{t[d.id]=d.defaultValue||false;}),i(t),h===void 0)if(!n)b(true);else {let d=localStorage.getItem(l);if(d)try{JSON.parse(d).version!==u?b(!0):b(!1);}catch(Y){b(true);}else b(true);}else b(h);},[a,l,u,n]),react.useEffect(()=>{h!==void 0&&b(h);},[h]);let oe=()=>{let t={};a.forEach(d=>{t[d.id]=true;}),D("accepted_all",t),U(t);},ie=()=>{let t={};a.forEach(d=>{t[d.id]=d.required||false;}),D("rejected_all",t),U(t);},de=(t,d)=>{i(Y=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},Y),{[t]:d}));},ge=()=>{let t={};a.forEach(d=>{t[d.id]=true;}),i(t);},ae=()=>{let t={};a.forEach(d=>{t[d.id]=d.required||false;}),i(t);},Q=a.length>0&&a.every(t=>S[t.id]),ue=()=>{D("customized",S),U(S);},U=t=>{let d={consents:t,timestamp:Date.now(),version:u,method:w?"customize":"banner",hasInteracted:true};n&&localStorage.setItem(l,JSON.stringify(d)),y(d),b(false),R(false);},X=react.useCallback(()=>{D("dismissed"),b(false),R(false);},[D]);if(react.useEffect(()=>{if(!f)return;let t=d=>{d.key==="Escape"&&X();};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[f,X]),react.useEffect(()=>{f&&!G.current&&(G.current=true,D("shown")),f||(G.current=false);},[f,D]),react.useEffect(()=>{f&&v.current&&v.current.focus();},[f]),react.useEffect(()=>{if(w&&M.current){let t=M.current;t.style.maxHeight="0px",t.style.opacity="0",t.offsetHeight,t.style.maxHeight=`${t.scrollHeight}px`,t.style.opacity="1";}},[w]),!f)return null;let ce=(e==null?void 0:e.primaryButton)||(e==null?void 0:e.acceptButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${k} ${L}`,Z=(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.rejectButton)||`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 ${k} ${C}`,fe=(e==null?void 0:e.customizeButton)||`px-4 py-2 bg-transparent text-gray-800 dark:text-white hover:underline ${k}`,pe=(e==null?void 0:e.saveButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${k} ${L}`,J=x==="inline",V=x==="center",j;J||V?j="":x==="top"?j="fixed inset-x-0 top-0":j="fixed inset-x-0 bottom-0";let H=jsxRuntime.jsx("div",{ref:v,tabIndex:-1,"data-ndpr-component":"consent-banner",className:chunkE64TU6IU_js.a(`${J?"":j} bg-white dark:bg-gray-800 shadow-lg p-3 sm:p-4 border border-gray-200 dark:border-gray-700 ${V?"max-w-lg w-full":""} ${z}`,e==null?void 0:e.root,r),style:!J&&!V?{zIndex:p}:void 0,role:"dialog","aria-labelledby":"consent-banner-title","aria-describedby":"consent-banner-description",children:jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("max-w-6xl mx-auto",e==null?void 0:e.container,r),children:[jsxRuntime.jsx("h2",{id:"consent-banner-title",className:chunkE64TU6IU_js.a("text-lg font-bold mb-2",e==null?void 0:e.title,r),children:m}),jsxRuntime.jsx("p",{id:"consent-banner-description",className:chunkE64TU6IU_js.a("text-sm sm:text-base mb-4",e==null?void 0:e.description,r),children:A}),w&&jsxRuntime.jsxs("div",{ref:M,className:chunkE64TU6IU_js.a("mb-4 p-3 sm:p-4 rounded-md border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50",e==null?void 0:e.customizePanel,r),style:{overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out"},children:[jsxRuntime.jsx("div",{className:"mb-3 flex items-center justify-end",children:jsxRuntime.jsx("button",{type:"button",onClick:Q?ae:ge,className:chunkE64TU6IU_js.a("text-sm font-medium text-[rgb(var(--ndpr-primary))] hover:underline",e==null?void 0:e.selectAllButton,r),children:Q?"Deselect All":"Select All"})}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("space-y-3",e==null?void 0:e.optionsList,r),children:a.map(t=>jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex items-start",e==null?void 0:e.optionItem,r),children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:`consent-${t.id}`,type:"checkbox",checked:S[t.id]||false,onChange:d=>de(t.id,d.target.checked),disabled:t.required,className:chunkE64TU6IU_js.a("h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.optionCheckbox,r)})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsxs("label",{htmlFor:`consent-${t.id}`,className:chunkE64TU6IU_js.a("font-medium",e==null?void 0:e.optionLabel,r),children:[t.label," ",t.required&&jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("text-gray-600 dark:text-gray-400",e==null?void 0:e.optionDescription,r),children:t.description})]})]},t.id))}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-4 flex flex-col sm:flex-row flex-wrap gap-2",e==null?void 0:e.buttonGroup,r),children:[jsxRuntime.jsx("button",{onClick:ue,className:chunkE64TU6IU_js.a(pe,e==null?void 0:e.saveButton,r),children:O}),jsxRuntime.jsx("button",{onClick:()=>R(false),className:chunkE64TU6IU_js.a(Z,e==null?void 0:e.rejectButton,r),children:"Back"})]})]}),!w&&jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex flex-col sm:flex-row flex-wrap gap-2",e==null?void 0:e.buttonGroup,r),children:[jsxRuntime.jsx("button",{onClick:oe,className:chunkE64TU6IU_js.a(ce,e==null?void 0:e.acceptButton,r),children:I}),jsxRuntime.jsx("button",{onClick:ie,className:chunkE64TU6IU_js.a(Z,e==null?void 0:e.rejectButton,r),children:P}),jsxRuntime.jsx("button",{onClick:()=>R(true),className:chunkE64TU6IU_js.a(fe,e==null?void 0:e.customizeButton,r),children:E})]}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("mt-2 text-xs text-gray-600 dark:text-gray-400",void 0,r),children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'})]})});if(J)return H;if(V){let t=jsxRuntime.jsxs("div",{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:p},children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),jsxRuntime.jsx("div",{className:"relative",children:H})]});return typeof document!="undefined"?reactDom.createPortal(t,document.body):t}return typeof document!="undefined"?reactDom.createPortal(H,document.body):H};var Re=({options:a,settings:y,onSave:m,title:A="Manage Your Privacy Settings",description:I="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:P="Save Preferences",resetButtonText:E="Reset to Defaults",version:O="1.0",className:x="",buttonClassName:p="",primaryButtonClassName:u="",secondaryButtonClassName:h="",classNames:n,unstyled:l,showSuccessMessage:z=true,successMessage:k="Your preferences have been saved.",successMessageDuration:L=3e3})=>{let[C,e]=react.useState({}),[r,c]=react.useState(false);react.useEffect(()=>{if(y&&y.consents)e(y.consents);else {let i={};a.forEach(v=>{i[v.id]=v.defaultValue||false;}),e(i);}},[a,y]);let f=(i,v)=>{e(M=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},M),{[i]:v}));},b=()=>{let i={consents:C,timestamp:Date.now(),version:O,method:"manager",hasInteracted:true};m(i),z&&(c(true),setTimeout(()=>{c(false);},L));},w=()=>{let i={};a.forEach(v=>{i[v.id]=v.defaultValue||false;}),e(i);},R=(n==null?void 0:n.primaryButton)||(n==null?void 0:n.saveButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${p} ${u}`,S=(n==null?void 0:n.secondaryButton)||(n==null?void 0:n.resetButton)||`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 ${p} ${h}`;return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 ${x}`,n==null?void 0:n.root,l),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",n==null?void 0:n.title,l),children:A}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("mb-6 text-gray-600 dark:text-gray-300",n==null?void 0:n.description,l),children:I}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("space-y-6",n==null?void 0:n.optionsList,l),children:a.map(i=>jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("border-b border-gray-200 dark:border-gray-700 pb-4 last:border-0",n==null?void 0:n.optionItem,l),children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:i.label}),jsxRuntime.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:i.description})]}),jsxRuntime.jsx("div",{className:"ml-4 flex-shrink-0",children:jsxRuntime.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",className:"sr-only peer",checked:C[i.id]||false,onChange:v=>f(i.id,v.target.checked),disabled:i.required}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a(`w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-[rgb(var(--ndpr-ring)/0.3)] rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[rgb(var(--ndpr-primary))] ${i.required?"opacity-60":""}`,n==null?void 0:n.toggle,l)}),jsxRuntime.jsxs("span",{className:"ml-3 text-sm font-medium text-gray-900 dark:text-gray-300",children:[C[i.id]?"Enabled":"Disabled",i.required&&jsxRuntime.jsx("span",{className:"text-xs text-red-500 ml-1",children:"(Required)"})]})]})})]})},i.id))}),r&&jsxRuntime.jsx("div",{className:"mt-4 p-3 bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200 rounded-md",children:k}),jsxRuntime.jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[jsxRuntime.jsx("button",{onClick:b,className:chunkE64TU6IU_js.a(R,n==null?void 0:n.saveButton,l),children:P}),jsxRuntime.jsx("button",{onClick:w,className:chunkE64TU6IU_js.a(S,n==null?void 0:n.resetButton,l),children:E})]}),jsxRuntime.jsxs("div",{className:"mt-4 text-xs text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsxs("p",{children:["Last updated: ",y?new Date(y.timestamp).toLocaleString():"Never"]}),jsxRuntime.jsxs("p",{children:["Version: ",O]})]})]})};var Oe=({settings:a,storageOptions:y={},onLoad:m,onSave:A,autoSave:I=true,autoLoad:P=true,classNames:E,unstyled:O,children:x})=>{let{storageKey:p="ndpr_consent",storageType:u="localStorage",cookieOptions:h={}}=y,[n,l]=react.useState(false);react.useEffect(()=>{P&&!n&&z();},[P,n]),react.useEffect(()=>{I&&n&&k(a);},[a,I,n]);let z=()=>{let e=null;try{if(u==="localStorage"&&typeof window!="undefined"){let r=localStorage.getItem(p);r&&(e=JSON.parse(r));}else if(u==="sessionStorage"&&typeof window!="undefined"){let r=sessionStorage.getItem(p);r&&(e=JSON.parse(r));}else if(u==="cookie"&&typeof document!="undefined"){let c=document.cookie.split(";").find(f=>f.trim().startsWith(`${p}=`));if(c){let f=c.split("=")[1];e=JSON.parse(decodeURIComponent(f));}}l(!0),m&&m(e);}catch(r){console.error("Error loading consent settings:",r),l(true),m&&m(null);}return e},k=e=>{try{let r=JSON.stringify(e);if(u==="localStorage"&&typeof window!="undefined")localStorage.setItem(p,r);else if(u==="sessionStorage"&&typeof window!="undefined")sessionStorage.setItem(p,r);else if(u==="cookie"&&typeof document!="undefined"){let{domain:c,path:f="/",expires:b=365,secure:w=!0,sameSite:R="Lax"}=h,S=new Date;S.setDate(S.getDate()+b);let i=`${p}=${encodeURIComponent(r)}; path=${f}; expires=${S.toUTCString()}`;c&&(i+=`; domain=${c}`),w&&(i+="; secure"),i+=`; samesite=${R}`,document.cookie=i;}return A&&A(e),!0}catch(r){return console.error("Error saving consent settings:",r),false}},L=()=>{try{if(u==="localStorage"&&typeof window!="undefined")localStorage.removeItem(p);else if(u==="sessionStorage"&&typeof window!="undefined")sessionStorage.removeItem(p);else if(u==="cookie"&&typeof document!="undefined"){let{domain:e,path:r="/"}=h,c=`${p}=; path=${r}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;e&&(c+=`; domain=${e}`),document.cookie=c;}return !0}catch(e){return console.error("Error clearing consent settings:",e),false}},C=chunkE64TU6IU_js.a("",E==null?void 0:E.root,O);if(typeof x=="function"){let e=x({loadSettings:z,saveSettings:k,clearSettings:L,loaded:n});return C?jsxRuntime.jsx("div",{className:C,children:e}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})}return C?jsxRuntime.jsx("div",{className:C,children:x}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:x})};exports.a=he;exports.b=Re;exports.c=Oe;//# sourceMappingURL=chunk-K3GMTMQ6.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-K3GMTMQ6.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js');var i="ndpr_consent",c="_audit";function a(n,e){if(!n)return "consent_given";let t=n.consents,o=e.consents;return Object.values(o).every(r=>!r)||Object.keys(t).some(r=>t[r]&&o[r]===false)?"consent_withdrawn":"consent_updated"}function y(n,e,t){return {action:t!=null?t:a(e!=null?e:null,n),timestamp:n.timestamp||Date.now(),version:n.version,categories:chunkMQFZHA2D_js.a({},n.consents),method:n.method,userAgent:typeof navigator!="undefined"?navigator.userAgent:void 0}}function d(n=i){let e=`${n}${c}`;if(typeof window=="undefined")return [];try{let t=localStorage.getItem(e);if(!t)return [];let o=JSON.parse(t);return Array.isArray(o)?o:[]}catch(t){return []}}function g(n,e=i){let t=`${e}${c}`;if(typeof window!="undefined")try{let o=d(e);o.push(n),localStorage.setItem(t,JSON.stringify(o));}catch(o){}}exports.a=y;exports.b=d;exports.c=g;//# sourceMappingURL=chunk-MJGOLP5M.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-MJGOLP5M.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-AYKLAEOU.mjs';import {a,b}from'./chunk-WWT2ZSNU.mjs';import {useState,useRef,useCallback,useEffect}from'react';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var he=({options:a$2,onSave:y,title:m="We Value Your Privacy",description:A="We use cookies and similar technologies to provide our services and enhance your experience. Your consent is collected in accordance with NDPA Sections 25-26.",acceptAllButtonText:I="Accept All",rejectAllButtonText:P="Reject All",customizeButtonText:E="Customize",saveButtonText:O="Save Preferences",position:x="bottom",zIndex:p=9999,version:u="1.0",show:h,manageStorage:n=true,storageKey:l="ndpr_consent",className:z="",buttonClassName:k="",primaryButtonClassName:L="",secondaryButtonClassName:C="",classNames:e,unstyled:r,onAnalytics:c})=>{let[f,b$1]=useState(false),[w,R]=useState(false),[S,i]=useState({}),v=useRef(null),M=useRef(null),G=useRef(false),D=useCallback((t,d)=>{c==null||c(a({action:t,timestamp:Date.now(),version:u},d!==void 0?{categories:d}:{}));},[c,u]);useEffect(()=>{let t={};if(a$2.forEach(d=>{t[d.id]=d.defaultValue||false;}),i(t),h===void 0)if(!n)b$1(true);else {let d=localStorage.getItem(l);if(d)try{JSON.parse(d).version!==u?b$1(!0):b$1(!1);}catch(Y){b$1(true);}else b$1(true);}else b$1(h);},[a$2,l,u,n]),useEffect(()=>{h!==void 0&&b$1(h);},[h]);let oe=()=>{let t={};a$2.forEach(d=>{t[d.id]=true;}),D("accepted_all",t),U(t);},ie=()=>{let t={};a$2.forEach(d=>{t[d.id]=d.required||false;}),D("rejected_all",t),U(t);},de=(t,d)=>{i(Y=>b(a({},Y),{[t]:d}));},ge=()=>{let t={};a$2.forEach(d=>{t[d.id]=true;}),i(t);},ae=()=>{let t={};a$2.forEach(d=>{t[d.id]=d.required||false;}),i(t);},Q=a$2.length>0&&a$2.every(t=>S[t.id]),ue=()=>{D("customized",S),U(S);},U=t=>{let d={consents:t,timestamp:Date.now(),version:u,method:w?"customize":"banner",hasInteracted:true};n&&localStorage.setItem(l,JSON.stringify(d)),y(d),b$1(false),R(false);},X=useCallback(()=>{D("dismissed"),b$1(false),R(false);},[D]);if(useEffect(()=>{if(!f)return;let t=d=>{d.key==="Escape"&&X();};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[f,X]),useEffect(()=>{f&&!G.current&&(G.current=true,D("shown")),f||(G.current=false);},[f,D]),useEffect(()=>{f&&v.current&&v.current.focus();},[f]),useEffect(()=>{if(w&&M.current){let t=M.current;t.style.maxHeight="0px",t.style.opacity="0",t.offsetHeight,t.style.maxHeight=`${t.scrollHeight}px`,t.style.opacity="1";}},[w]),!f)return null;let ce=(e==null?void 0:e.primaryButton)||(e==null?void 0:e.acceptButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${k} ${L}`,Z=(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.rejectButton)||`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 ${k} ${C}`,fe=(e==null?void 0:e.customizeButton)||`px-4 py-2 bg-transparent text-gray-800 dark:text-white hover:underline ${k}`,pe=(e==null?void 0:e.saveButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${k} ${L}`,J=x==="inline",V=x==="center",j;J||V?j="":x==="top"?j="fixed inset-x-0 top-0":j="fixed inset-x-0 bottom-0";let H=jsx("div",{ref:v,tabIndex:-1,"data-ndpr-component":"consent-banner",className:a$1(`${J?"":j} bg-white dark:bg-gray-800 shadow-lg p-3 sm:p-4 border border-gray-200 dark:border-gray-700 ${V?"max-w-lg w-full":""} ${z}`,e==null?void 0:e.root,r),style:!J&&!V?{zIndex:p}:void 0,role:"dialog","aria-labelledby":"consent-banner-title","aria-describedby":"consent-banner-description",children:jsxs("div",{className:a$1("max-w-6xl mx-auto",e==null?void 0:e.container,r),children:[jsx("h2",{id:"consent-banner-title",className:a$1("text-lg font-bold mb-2",e==null?void 0:e.title,r),children:m}),jsx("p",{id:"consent-banner-description",className:a$1("text-sm sm:text-base mb-4",e==null?void 0:e.description,r),children:A}),w&&jsxs("div",{ref:M,className:a$1("mb-4 p-3 sm:p-4 rounded-md border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50",e==null?void 0:e.customizePanel,r),style:{overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out"},children:[jsx("div",{className:"mb-3 flex items-center justify-end",children:jsx("button",{type:"button",onClick:Q?ae:ge,className:a$1("text-sm font-medium text-[rgb(var(--ndpr-primary))] hover:underline",e==null?void 0:e.selectAllButton,r),children:Q?"Deselect All":"Select All"})}),jsx("div",{className:a$1("space-y-3",e==null?void 0:e.optionsList,r),children:a$2.map(t=>jsxs("div",{className:a$1("flex items-start",e==null?void 0:e.optionItem,r),children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`consent-${t.id}`,type:"checkbox",checked:S[t.id]||false,onChange:d=>de(t.id,d.target.checked),disabled:t.required,className:a$1("h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.optionCheckbox,r)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:`consent-${t.id}`,className:a$1("font-medium",e==null?void 0:e.optionLabel,r),children:[t.label," ",t.required&&jsx("span",{className:"text-red-500",children:"*"})]}),jsx("p",{className:a$1("text-gray-600 dark:text-gray-400",e==null?void 0:e.optionDescription,r),children:t.description})]})]},t.id))}),jsxs("div",{className:a$1("mt-4 flex flex-col sm:flex-row flex-wrap gap-2",e==null?void 0:e.buttonGroup,r),children:[jsx("button",{onClick:ue,className:a$1(pe,e==null?void 0:e.saveButton,r),children:O}),jsx("button",{onClick:()=>R(false),className:a$1(Z,e==null?void 0:e.rejectButton,r),children:"Back"})]})]}),!w&&jsxs("div",{className:a$1("flex flex-col sm:flex-row flex-wrap gap-2",e==null?void 0:e.buttonGroup,r),children:[jsx("button",{onClick:oe,className:a$1(ce,e==null?void 0:e.acceptButton,r),children:I}),jsx("button",{onClick:ie,className:a$1(Z,e==null?void 0:e.rejectButton,r),children:P}),jsx("button",{onClick:()=>R(true),className:a$1(fe,e==null?void 0:e.customizeButton,r),children:E})]}),jsx("div",{className:a$1("mt-2 text-xs text-gray-600 dark:text-gray-400",void 0,r),children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'})]})});if(J)return H;if(V){let t=jsxs("div",{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:p},children:[jsx("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),jsx("div",{className:"relative",children:H})]});return typeof document!="undefined"?createPortal(t,document.body):t}return typeof document!="undefined"?createPortal(H,document.body):H};var Re=({options:a$2,settings:y,onSave:m,title:A="Manage Your Privacy Settings",description:I="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:P="Save Preferences",resetButtonText:E="Reset to Defaults",version:O="1.0",className:x="",buttonClassName:p="",primaryButtonClassName:u="",secondaryButtonClassName:h="",classNames:n,unstyled:l,showSuccessMessage:z=true,successMessage:k="Your preferences have been saved.",successMessageDuration:L=3e3})=>{let[C,e]=useState({}),[r,c]=useState(false);useEffect(()=>{if(y&&y.consents)e(y.consents);else {let i={};a$2.forEach(v=>{i[v.id]=v.defaultValue||false;}),e(i);}},[a$2,y]);let f=(i,v)=>{e(M=>b(a({},M),{[i]:v}));},b$1=()=>{let i={consents:C,timestamp:Date.now(),version:O,method:"manager",hasInteracted:true};m(i),z&&(c(true),setTimeout(()=>{c(false);},L));},w=()=>{let i={};a$2.forEach(v=>{i[v.id]=v.defaultValue||false;}),e(i);},R=(n==null?void 0:n.primaryButton)||(n==null?void 0:n.saveButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${p} ${u}`,S=(n==null?void 0:n.secondaryButton)||(n==null?void 0:n.resetButton)||`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 ${p} ${h}`;return jsxs("div",{className:a$1(`bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 ${x}`,n==null?void 0:n.root,l),children:[jsx("h2",{className:a$1("text-xl font-bold mb-2",n==null?void 0:n.title,l),children:A}),jsx("p",{className:a$1("mb-6 text-gray-600 dark:text-gray-300",n==null?void 0:n.description,l),children:I}),jsx("div",{className:a$1("space-y-6",n==null?void 0:n.optionsList,l),children:a$2.map(i=>jsx("div",{className:a$1("border-b border-gray-200 dark:border-gray-700 pb-4 last:border-0",n==null?void 0:n.optionItem,l),children:jsxs("div",{className:"flex items-start justify-between",children:[jsxs("div",{children:[jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:i.label}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:i.description})]}),jsx("div",{className:"ml-4 flex-shrink-0",children:jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[jsx("input",{type:"checkbox",className:"sr-only peer",checked:C[i.id]||false,onChange:v=>f(i.id,v.target.checked),disabled:i.required}),jsx("div",{className:a$1(`w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-[rgb(var(--ndpr-ring)/0.3)] rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[rgb(var(--ndpr-primary))] ${i.required?"opacity-60":""}`,n==null?void 0:n.toggle,l)}),jsxs("span",{className:"ml-3 text-sm font-medium text-gray-900 dark:text-gray-300",children:[C[i.id]?"Enabled":"Disabled",i.required&&jsx("span",{className:"text-xs text-red-500 ml-1",children:"(Required)"})]})]})})]})},i.id))}),r&&jsx("div",{className:"mt-4 p-3 bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200 rounded-md",children:k}),jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[jsx("button",{onClick:b$1,className:a$1(R,n==null?void 0:n.saveButton,l),children:P}),jsx("button",{onClick:w,className:a$1(S,n==null?void 0:n.resetButton,l),children:E})]}),jsxs("div",{className:"mt-4 text-xs text-gray-600 dark:text-gray-400",children:[jsxs("p",{children:["Last updated: ",y?new Date(y.timestamp).toLocaleString():"Never"]}),jsxs("p",{children:["Version: ",O]})]})]})};var Oe=({settings:a,storageOptions:y={},onLoad:m,onSave:A,autoSave:I=true,autoLoad:P=true,classNames:E,unstyled:O,children:x})=>{let{storageKey:p="ndpr_consent",storageType:u="localStorage",cookieOptions:h={}}=y,[n,l]=useState(false);useEffect(()=>{P&&!n&&z();},[P,n]),useEffect(()=>{I&&n&&k(a);},[a,I,n]);let z=()=>{let e=null;try{if(u==="localStorage"&&typeof window!="undefined"){let r=localStorage.getItem(p);r&&(e=JSON.parse(r));}else if(u==="sessionStorage"&&typeof window!="undefined"){let r=sessionStorage.getItem(p);r&&(e=JSON.parse(r));}else if(u==="cookie"&&typeof document!="undefined"){let c=document.cookie.split(";").find(f=>f.trim().startsWith(`${p}=`));if(c){let f=c.split("=")[1];e=JSON.parse(decodeURIComponent(f));}}l(!0),m&&m(e);}catch(r){console.error("Error loading consent settings:",r),l(true),m&&m(null);}return e},k=e=>{try{let r=JSON.stringify(e);if(u==="localStorage"&&typeof window!="undefined")localStorage.setItem(p,r);else if(u==="sessionStorage"&&typeof window!="undefined")sessionStorage.setItem(p,r);else if(u==="cookie"&&typeof document!="undefined"){let{domain:c,path:f="/",expires:b=365,secure:w=!0,sameSite:R="Lax"}=h,S=new Date;S.setDate(S.getDate()+b);let i=`${p}=${encodeURIComponent(r)}; path=${f}; expires=${S.toUTCString()}`;c&&(i+=`; domain=${c}`),w&&(i+="; secure"),i+=`; samesite=${R}`,document.cookie=i;}return A&&A(e),!0}catch(r){return console.error("Error saving consent settings:",r),false}},L=()=>{try{if(u==="localStorage"&&typeof window!="undefined")localStorage.removeItem(p);else if(u==="sessionStorage"&&typeof window!="undefined")sessionStorage.removeItem(p);else if(u==="cookie"&&typeof document!="undefined"){let{domain:e,path:r="/"}=h,c=`${p}=; path=${r}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;e&&(c+=`; domain=${e}`),document.cookie=c;}return !0}catch(e){return console.error("Error clearing consent settings:",e),false}},C=a$1("",E==null?void 0:E.root,O);if(typeof x=="function"){let e=x({loadSettings:z,saveSettings:k,clearSettings:L,loaded:n});return C?jsx("div",{className:C,children:e}):jsx(Fragment,{children:e})}return C?jsx("div",{className:C,children:x}):jsx(Fragment,{children:x})};export{he as a,Re as b,Oe as c};//# sourceMappingURL=chunk-NW4A3JW6.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-NW4A3JW6.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-WWT2ZSNU.mjs';var i="ndpr_consent",c="_audit";function a(n,e){if(!n)return "consent_given";let t=n.consents,o=e.consents;return Object.values(o).every(r=>!r)||Object.keys(t).some(r=>t[r]&&o[r]===false)?"consent_withdrawn":"consent_updated"}function y(n,e,t){return {action:t!=null?t:a(e!=null?e:null,n),timestamp:n.timestamp||Date.now(),version:n.version,categories:a$1({},n.consents),method:n.method,userAgent:typeof navigator!="undefined"?navigator.userAgent:void 0}}function d(n=i){let e=`${n}${c}`;if(typeof window=="undefined")return [];try{let t=localStorage.getItem(e);if(!t)return [];let o=JSON.parse(t);return Array.isArray(o)?o:[]}catch(t){return []}}function g(n,e=i){let t=`${e}${c}`;if(typeof window!="undefined")try{let o=d(e);o.push(n),localStorage.setItem(t,JSON.stringify(o));}catch(o){}}export{y as a,d as b,g as c};//# sourceMappingURL=chunk-P3PULLYP.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-P3PULLYP.mjs.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {b,c,a as a$2}from'./chunk-CAB7O3GR.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {d,b as b$1,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var ur=({sections:P=b,variables:R=c,onGenerate:S,title:q="NDPA Privacy Policy Generator",description:B="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:j="",buttonClassName:L="",generateButtonText:z="Generate Policy",showPreview:A=true,allowEditing:V=true,classNames:e,unstyled:x=false})=>{let[T,U]=useState(P),[a$3,t]=useState(R),[m,C]=useState("sections"),[E,X]=useState(""),[F,D]=useState(""),[_,G]=useState(false),[h,W]=useState({});useEffect(()=>{U(P);},[P]),useEffect(()=>{t(R);},[R]);let s=n=>{U(b=>b.map(p=>p.id===n?b$1(a$1({},p),{included:!p.included}):p));},g=(n,b)=>{t(p=>p.map(u=>u.id===n?b$1(a$1({},u),{value:b}):u)),h[n]&&W(p=>{let u=a$1({},p);return delete u[n],u});},v=()=>{let n={},b=true;return a$3.forEach(p=>{p.required&&!p.value&&(n[p.id]=`${p.name} is required`,b=false);}),W(n),b},k=()=>{if(!v()){C("variables");return}let n=T.filter(u=>u.included),b=Object.fromEntries(a$3.map(u=>[u.name,u.value])),p="";n.forEach(u=>{p+=`## ${u.title}
|
|
2
|
+
|
|
3
|
+
`,p+=a$2(u.template,b),p+=`
|
|
4
|
+
|
|
5
|
+
`;}),X(p),D(p),G(true),C("preview");},H=()=>{S({sections:T,variables:a$3,content:V?F:E});},I=()=>jsxs("div",{className:a("space-y-4",e==null?void 0:e.sectionList,x),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),T.map(n=>jsx("div",{className:a("border border-gray-200 dark:border-gray-700 rounded-md p-4",e==null?void 0:e.sectionItem,x),children:jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`section-${n.id}`,type:"checkbox",checked:n.included,onChange:()=>s(n.id),disabled:n.required,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",e==null?void 0:e.input,x)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:`section-${n.id}`,className:"font-medium text-gray-900 dark:text-white",children:[n.title," ",n.required&&jsx("span",{className:"text-red-500",children:"*"})]}),n.description&&jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:n.description})]})]})},n.id)),jsx("div",{className:"mt-6",children:jsx("button",{onClick:()=>C("variables"),className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${L}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.generateButton),x),children:"Next: Fill Variables"})})]}),J=()=>{let n={};return a$3.forEach(b=>{let p=b.id.split(".")[0];n[p]||(n[p]=[]),n[p].push(b);}),jsxs("div",{className:a("",e==null?void 0:e.form,x),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsx("div",{className:"space-y-6",children:Object.entries(n).map(([b,p])=>{let u=T.find(r=>r.id===b);return u&&!u.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:u?u.title:"General Information"}),jsx("div",{className:"space-y-4",children:p.map(r=>jsxs("div",{children:[jsxs("label",{htmlFor:`var-${r.id}`,className:"block text-sm font-medium mb-1",children:[r.name," ",r.required&&jsx("span",{className:"text-red-500",children:"*"})]}),r.description&&jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-2",children:r.description}),r.inputType==="textarea"?jsx("textarea",{id:`var-${r.id}`,value:r.value,onChange:c=>g(r.id,c.target.value),rows:4,className:a(`w-full px-3 py-2 border ${h[r.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`,e==null?void 0:e.input,x),required:r.required}):r.inputType==="select"&&r.options?jsxs("select",{id:`var-${r.id}`,value:r.value,onChange:c=>g(r.id,c.target.value),className:a(`w-full px-3 py-2 border ${h[r.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`,e==null?void 0:e.input,x),required:r.required,children:[jsx("option",{value:"",children:"Select an option"}),r.options.map(c=>jsx("option",{value:c,children:c},c))]}):jsx("input",{id:`var-${r.id}`,type:r.inputType,value:r.value,onChange:c=>g(r.id,c.target.value),className:a(`w-full px-3 py-2 border ${h[r.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`,e==null?void 0:e.input,x),required:r.required}),h[r.id]&&jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-500",children:h[r.id]})]},r.id))})]},b)})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>C("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 ${L}`,children:"Back to Sections"}),jsx("button",{onClick:k,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${L}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.generateButton),x),children:z})]})]})},N=()=>jsxs("div",{children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),V?jsxs("div",{className:"mb-4",children:[jsx("label",{htmlFor:"policy-content",className:"block text-sm font-medium mb-1",children:"Edit Policy Content"}),jsx("textarea",{id:"policy-content",value:F,onChange:n=>D(n.target.value),rows:20,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] font-mono text-sm"})]}):jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-4",children:jsx("div",{className:"prose dark:prose-invert max-w-none",children:E.split(`
|
|
6
|
+
`).map((n,b)=>n.startsWith("## ")?jsx("h2",{className:"text-xl font-bold mt-6 mb-3",children:n.substring(3)},b):n.startsWith("### ")?jsx("h3",{className:"text-lg font-bold mt-4 mb-2",children:n.substring(4)},b):n===""?jsx("br",{},b):jsx("p",{className:"mb-2",children:n},b))})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>C("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 ${L}`,children:"Back to Variables"}),jsx("button",{onClick:H,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${L}`,children:"Save Policy"})]})]}),K=()=>{switch(m){case "sections":return I();case "variables":return J();case "preview":return N();default:return I()}};return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${j}`,e==null?void 0:e.root,x),children:[jsxs("div",{className:a("mb-6",e==null?void 0:e.header,x),children:[jsx("h2",{className:a("text-xl font-bold mb-2",e==null?void 0:e.title,x),children:q}),jsx("p",{className:a("text-gray-600 dark:text-gray-300",e==null?void 0:e.description,x),children:B})]}),jsx("div",{className:"mb-8",children:jsxs("ol",{className:"flex items-center w-full",children:[jsxs("li",{className:`flex w-full items-center ${m==="sections"?"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400"} 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"?"bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)]":"bg-gray-100 dark:bg-gray-700"} rounded-full shrink-0`,children:"1"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"})]}),jsxs("li",{className:`flex w-full items-center ${m==="variables"?"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400"} 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"?"bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)]":"bg-gray-100 dark:bg-gray-700"} rounded-full shrink-0`,children:"2"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"})]}),jsxs("li",{className:`flex items-center ${m==="preview"?"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400"}`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)]":"bg-gray-100 dark:bg-gray-700"} rounded-full shrink-0`,children:"3"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"})]})]})}),jsxs("div",{className:a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",e==null?void 0:e.complianceNotice,x),children:[jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"text-blue-700 dark:text-blue-300 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."})]}),K()]})};var wr=({content:P,sections:R,variables:S,onExport:q,onEdit:B,title:j="Privacy Policy Preview",description:L="Preview your NDPA-compliant privacy policy before exporting.",className:z="",buttonClassName:A="",showExportOptions:V=true,showEditButton:e=true,showTableOfContents:x=true,showMetadata:T=true,organizationName:U,lastUpdated:a$1=new Date,classNames:t,unstyled:m=false})=>{let[C,E]=useState("preview"),F=(()=>{let s=P.split(`
|
|
7
|
+
`),g=[];return s.forEach(v=>{if(v.startsWith("## ")){let k=v.substring(3).trim(),H=k.toLowerCase().replace(/[^a-z0-9]+/g,"-");g.push({id:H,title:k,level:2});}else if(v.startsWith("### ")){let k=v.substring(4).trim(),H=k.toLowerCase().replace(/[^a-z0-9]+/g,"-");g.push({id:H,title:k,level:3});}}),g})(),D=s=>{if(q)q(s);else if(s==="markdown"){let g=document.createElement("a"),v=new Blob([P],{type:"text/markdown"});g.href=URL.createObjectURL(v),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},_=()=>!x||F.length===0?null:jsxs("div",{className:"mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsx("ul",{className:"space-y-1",children:F.map((s,g)=>jsx("li",{style:{marginLeft:`${(s.level-2)*1.5}rem`},children:jsx("a",{href:`#${s.id}`,className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline",children:s.title})},g))})]}),G=()=>T?jsxs("div",{className:"mb-6",children:[jsx("h1",{className:"text-2xl font-bold mb-2",children:U?`${U} Privacy Policy`:"Privacy Policy"}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Last Updated: ",a$1.toLocaleDateString()]})]}):null,h=()=>jsx("div",{className:a("prose dark:prose-invert max-w-none",t==null?void 0:t.sectionContent,m),children:P.split(`
|
|
8
|
+
`).map((s,g)=>{if(s.startsWith("## ")){let v=s.substring(3).trim(),k=v.toLowerCase().replace(/[^a-z0-9]+/g,"-");return jsx("h2",{id:k,className:a("text-xl font-bold mt-6 mb-3",t==null?void 0:t.sectionTitle,m),children:v},g)}else if(s.startsWith("### ")){let v=s.substring(4).trim(),k=v.toLowerCase().replace(/[^a-z0-9]+/g,"-");return jsx("h3",{id:k,className:a("text-lg font-bold mt-4 mb-2",t==null?void 0:t.sectionTitle,m),children:v},g)}else return s===""?jsx("br",{},g):jsx("p",{className:"mb-2",children:s},g)})}),W=()=>V?jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxs("div",{className:"flex flex-wrap gap-3",children:[jsx("button",{onClick:()=>D("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${A}`,children:"Export as PDF"}),jsx("button",{onClick:()=>D("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${A}`,children:"Export as DOCX"}),jsx("button",{onClick:()=>D("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${A}`,children:"Export as HTML"}),jsx("button",{onClick:()=>D("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${A}`,children:"Export as Markdown"})]})]}):null;return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${z}`,t==null?void 0:t.root,m),children:[jsxs("div",{className:a("flex justify-between items-start mb-6",t==null?void 0:t.header,m),children:[jsxs("div",{children:[jsx("h2",{className:a("text-xl font-bold mb-2",t==null?void 0:t.title,m),children:j}),jsx("p",{className:a("text-gray-600 dark:text-gray-300",t==null?void 0:t.description,m),children:L})]}),e&&B&&jsx("button",{onClick:B,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 ${A}`,children:"Edit Policy"})]}),jsxs("div",{className:a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",t==null?void 0:t.complianceNotice,m),children:[jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"text-blue-700 dark:text-blue-300 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("ul",{className:"flex flex-wrap -mb-px",children:[jsx("li",{className:"mr-2",children:jsx("button",{onClick:()=>E("preview"),className:`inline-block p-4 ${C==="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("li",{className:"mr-2",children:jsx("button",{onClick:()=>E("markdown"),className:`inline-block p-4 ${C==="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",t==null?void 0:t.content,m),children:C==="preview"?jsxs("div",{children:[G(),_(),jsx("div",{className:a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",t==null?void 0:t.section,m),children:h()})]}):jsx("div",{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:P})})}),W()]})};var Sr=({content:P,title:R="Privacy Policy",organizationName:S,lastUpdated:q=new Date,onExportComplete:B,componentTitle:j="Export Privacy Policy",description:L="Export your NDPA-compliant privacy policy in various formats.",className:z="",buttonClassName:A="",showExportHistory:V=true,includeComplianceNotice:e=true,includeLogo:x=false,logoUrl:T,customStyles:U,classNames:a$1,unstyled:t=false})=>{let[m,C]=useState([]),[E,X]=useState("pdf"),[F,D]=useState(false),[_,G]=useState(null),[h,W]=useState(""),[s,g]=useState(""),[v,k]=useState(""),[H,I]=useState(false),J=r=>{let c=new Date().toISOString().split("T")[0];return `${S?S.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${c}.${r.toLowerCase()}`},N=r=>h?h.endsWith(`.${r.toLowerCase()}`)?h:`${h}.${r.toLowerCase()}`:J(r),K=()=>{let r=S?`${S} ${R}`:R,c=q.toLocaleDateString(),w=`<!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>${r}</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
|
+
${U||""}
|
|
71
|
+
</style>
|
|
72
|
+
</head>
|
|
73
|
+
<body>
|
|
74
|
+
<div class="header">
|
|
75
|
+
${x&&T?`<img src="${T}" alt="${S||"Company"} Logo" class="logo">`:""}
|
|
76
|
+
${s?`<div class="custom-header">${s}</div>`:""}
|
|
77
|
+
<h1>${r}</h1>
|
|
78
|
+
<div class="last-updated">Last Updated: ${c}</div>
|
|
79
|
+
</div>`;e&&(w+=`
|
|
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 Q=P.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return w+=`
|
|
84
|
+
<div class="content">
|
|
85
|
+
<p>${Q}</p>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<div class="footer">
|
|
89
|
+
${v?`<div class="custom-footer">${v}</div>`:""}
|
|
90
|
+
<p>© ${new Date().getFullYear()} ${S||"Company"}. All rights reserved.</p>
|
|
91
|
+
</div>
|
|
92
|
+
</body>
|
|
93
|
+
</html>`,w},n=()=>d(null,null,function*(){D(true),G(null);try{let r=E.toLowerCase(),c="",w;switch(r){case "pdf":let rr=K();w=new Blob([rr],{type:"text/html"}),c=URL.createObjectURL(w);break;case "docx":w=new Blob([P],{type:"text/plain"}),c=URL.createObjectURL(w);break;case "html":let lr=K();w=new Blob([lr],{type:"text/html"}),c=URL.createObjectURL(w);break;default:w=new Blob([P],{type:"text/markdown"}),c=URL.createObjectURL(w);break}let Q=N(r),Y=document.createElement("a");Y.href=c,Y.download=Q,document.body.appendChild(Y),Y.click(),document.body.removeChild(Y);let dr={id:`export_${Date.now()}`,format:r,timestamp:Date.now(),url:c,filename:Q};C(rr=>[dr,...rr]),B&&B(r,c);}catch(r){console.error("Export error:",r),G("An error occurred during export. Please try again.");}finally{D(false);}}),b=()=>{let r=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}];return jsxs("div",{className:a("mb-6",a$1==null?void 0:a$1.formatSelector,t),children:[jsx("label",{htmlFor:"export-format",className:"block text-sm font-medium mb-1",children:"Export Format"}),jsx("select",{id:"export-format",value:E,onChange:c=>X(c.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",a$1==null?void 0:a$1.formatOption,t),children:r.map(c=>jsx("option",{value:c.value,children:c.label},c.value))})]})},p=()=>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:()=>I(false),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm",children:"Hide Advanced Options"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"custom-filename",className:"block text-sm font-medium mb-1",children:"Custom Filename"}),jsx("input",{type:"text",id:"custom-filename",value:h,onChange:r=>W(r.target.value),placeholder:J(E),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:"Leave blank to use the default filename format."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"custom-header",className:"block text-sm font-medium mb-1",children:"Custom Header HTML (for HTML/PDF exports)"}),jsx("textarea",{id:"custom-header",value:s,onChange:r=>g(r.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"custom-footer",className:"block text-sm font-medium mb-1",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsx("textarea",{id:"custom-footer",value:v,onChange:r=>k(r.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:"include-compliance-notice",type:"checkbox",checked:e,onChange:r=>I(r.target.checked),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:"include-compliance-notice",className:"font-medium text-gray-900 dark:text-white",children:"Include NDPA Compliance Notice"}),jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsx("button",{type:"button",onClick:()=>I(true),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm mb-6",children:"Show Advanced Options"}),u=()=>!V||m.length===0?null:jsxs("div",{className:a("mt-6",a$1==null?void 0:a$1.preview,t),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 text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Date"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Format"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Filename"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 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(r=>jsxs("tr",{children:[jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:new Date(r.timestamp).toLocaleString()}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:r.format.toUpperCase()}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:r.filename}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsx("a",{href:r.url,download:r.filename,className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},r.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${z}`,a$1==null?void 0:a$1.root,t),children:[jsxs("div",{className:a("mb-6",a$1==null?void 0:a$1.header,t),children:[jsx("h2",{className:a("text-xl font-bold mb-2",a$1==null?void 0:a$1.title,t),children:j}),jsx("p",{className:a("text-gray-600 dark:text-gray-300",a$1==null?void 0:a$1.description,t),children:L})]}),b(),p(),jsxs("div",{className:"mb-6",children:[jsx("button",{onClick:n,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 ${A} ${F?"opacity-70 cursor-not-allowed":""}`,(a$1==null?void 0:a$1.primaryButton)||(a$1==null?void 0:a$1.exportButton),t),children:F?"Exporting...":`Export as ${E.toUpperCase()}`}),_&&jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-500",children:_})]}),jsxs("div",{className:a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",a$1==null?void 0:a$1.complianceNotice,t),children:[jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"Export Tips"}),jsxs("ul",{className:"text-blue-700 dark:text-blue-300 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."})]})]}),u()]})};export{ur as a,wr as b,Sr as c};//# sourceMappingURL=chunk-SKJCQKFL.mjs.map
|
|
94
|
+
//# sourceMappingURL=chunk-SKJCQKFL.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunk5RSOLEEP_js=require('./chunk-5RSOLEEP.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function O({templates:y,initialPolicy:c,storageKey:f="ndpr_privacy_policy",useLocalStorage:m=true,onGenerate:g}){let[n,u]=react.useState(c||null),[a,p]=react.useState(null),[d,P]=react.useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""});react.useEffect(()=>{if(m&&typeof window!="undefined"&&!c)try{let i=localStorage.getItem(f);if(i){let{policy:o,template:e,organizationInfo:t}=JSON.parse(i);if(o&&u(o),e){let s=y.find(x=>x.id===e.id);s&&p(s);}t&&P(t);}}catch(i){console.error("Error loading privacy policy data:",i);}},[f,m,c,y]),react.useEffect(()=>{if(m&&typeof window!="undefined")try{localStorage.setItem(f,JSON.stringify({policy:n,template:a,organizationInfo:d}));}catch(i){console.error("Error saving privacy policy data:",i);}},[n,a,d,f,m]);let V=i=>{let o=y.find(s=>s.id===i);if(!o)return false;p(o);o.sections.map(s=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{customContent:void 0}));return Object.keys(o.variables).forEach(s=>{o.variables[s].defaultValue||"";}),true},h=i=>{P(o=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},o),i));},w=(i,o)=>{a&&(n?u(e=>e&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{sections:e.sections.map(t=>t.id===i?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{included:o}):t)})):p(e=>e&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{sections:e.sections.map(t=>t.id===i?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{included:o}):t)})));},z=(i,o)=>{a&&(n?u(e=>e&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{sections:e.sections.map(t=>t.id===i?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{customContent:o}):t)})):p(e=>e&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{sections:e.sections.map(t=>t.id===i?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{customContent:o}):t)})));},E=(i,o)=>{n&&u(e=>e&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{variableValues:chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e.variableValues),{[i]:o})}));},S=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return {policy:n,selectedTemplate:a,organizationInfo:d,selectTemplate:V,updateOrganizationInfo:h,toggleSection:w,updateSectionContent:z,updateVariableValue:E,generatePolicy:()=>{if(!a)throw new Error("No template selected");let i=Date.now(),o={id:(n==null?void 0:n.id)||S(),title:`Privacy Policy for ${d.name}`,templateId:a.id,organizationInfo:d,sections:a.sections.map(e=>{var t;return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{customContent:(t=n==null?void 0:n.sections.find(s=>s.id===e.id))==null?void 0:t.customContent})}),variableValues:(n==null?void 0:n.variableValues)||{},effectiveDate:i,lastUpdated:i,version:"1.0"};return u(o),g&&g(o),o},getPolicyText:()=>{if(!n)return {fullText:"",sectionTexts:{},missingVariables:[]};let i=chunk5RSOLEEP_js.a(n.sections,n.organizationInfo);return typeof i=="string"?{fullText:i,sectionTexts:{full:i},missingVariables:[]}:i},resetPolicy:()=>{u(null),p(null),P({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),m&&typeof window!="undefined"&&localStorage.removeItem(f);},isValid:()=>{let i=[];if(a||i.push("No template selected"),d.name||i.push("Organization name is required"),d.website||i.push("Organization website is required"),d.privacyEmail||i.push("Privacy contact email is required"),a){let o=a.sections.filter(t=>t.required),e=(n==null?void 0:n.sections.filter(t=>t.included))||[];o.forEach(t=>{e.some(s=>s.id===t.id)||i.push(`Required section "${t.title}" must be included`);});}return a&&n&&Object.entries(a.variables).forEach(([o,e])=>{e.required&&!n.variableValues[o]&&i.push(`Required variable "${e.name}" must have a value`);}),{valid:i.length===0,errors:i}}}}function J(y={}){let{orgInfo:c,storageKey:f,useLocalStorage:m}=y,{sections:g,variables:n}=chunk5RSOLEEP_js.d();if(c)for(let a of n)c.name&&a.name==="orgName"&&(a.value=c.name),c.email&&a.name==="privacyEmail"&&(a.value=c.email),c.dpoName&&a.name==="dpoName"&&(a.value=c.dpoName);let u={id:"default-business",name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:g,variables:Object.fromEntries(n.map(a=>[a.name,{name:a.name,description:a.description,required:a.required,defaultValue:a.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true};return O({templates:[u],storageKey:f,useLocalStorage:m})}exports.a=O;exports.b=J;//# sourceMappingURL=chunk-TCJCE6WN.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-TCJCE6WN.js.map
|