@tantainnovative/ndpr-toolkit 3.0.0 → 3.2.1

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.
Files changed (149) hide show
  1. package/dist/{PolicyExporter-BIqSVjfC.d.mts → PolicyExporter-Bgi6nz82.d.mts} +93 -1
  2. package/dist/{PolicyExporter-BNWaPBGU.d.ts → PolicyExporter-BnvuFncj.d.ts} +93 -1
  3. package/dist/adapters.js +1 -1
  4. package/dist/adapters.mjs +1 -1
  5. package/dist/breach.js +1 -1
  6. package/dist/breach.mjs +1 -1
  7. package/dist/chunk-256APOQM.js +2 -0
  8. package/dist/chunk-2FWCVWKN.js +2 -0
  9. package/dist/chunk-3DJGO6WG.js +2 -0
  10. package/dist/chunk-44W4H2EY.js +2 -0
  11. package/dist/chunk-4XCL62MJ.mjs +2 -0
  12. package/dist/chunk-555WWZ3W.js +2 -0
  13. package/dist/chunk-6BXUVS6E.js +81 -0
  14. package/dist/{chunk-KHRBU5K7.js → chunk-6RQGQZT2.js} +2 -2
  15. package/dist/chunk-6TA2MVTU.mjs +2 -0
  16. package/dist/chunk-6WIP33TW.mjs +2 -0
  17. package/dist/{chunk-2ORDHJRD.js → chunk-7AVN424U.js} +2 -2
  18. package/dist/{chunk-5VMHKNJY.js → chunk-7SMLHZ4B.js} +2 -2
  19. package/dist/chunk-A4PK7JB2.js +2 -0
  20. package/dist/chunk-ABDB7LEV.mjs +2 -0
  21. package/dist/chunk-BKRETVJ6.js +2 -0
  22. package/dist/chunk-CWUPGY3M.mjs +3 -0
  23. package/dist/chunk-DJGS7SSN.mjs +2 -0
  24. package/dist/{chunk-SVCRYM4I.mjs → chunk-E4NCJ7RD.mjs} +2 -2
  25. package/dist/chunk-E63VPR7U.js +2 -0
  26. package/dist/chunk-EH2I4L7M.mjs +316 -0
  27. package/dist/chunk-ELKB2AFZ.js +2 -0
  28. package/dist/chunk-FDDI426Y.mjs +2 -0
  29. package/dist/chunk-FOXZRRMW.mjs +2 -0
  30. package/dist/chunk-GCQRHMTQ.mjs +144 -0
  31. package/dist/chunk-GKKAK6ES.mjs +3 -0
  32. package/dist/chunk-GOD4LA2J.mjs +2 -0
  33. package/dist/{chunk-SWF3YVE5.js → chunk-GOU6FU6Y.js} +3 -3
  34. package/dist/chunk-HO5M7M4M.js +2 -0
  35. package/dist/chunk-I23WPZNQ.mjs +94 -0
  36. package/dist/chunk-I4M2AA3N.js +2 -0
  37. package/dist/chunk-I54CDQGN.js +3 -0
  38. package/dist/{chunk-6D3ZUGBB.mjs → chunk-IR7VCBWV.mjs} +2 -2
  39. package/dist/{chunk-4VVARDN2.mjs → chunk-K45S6YQV.mjs} +2 -2
  40. package/dist/chunk-KBAFOVE3.js +2 -0
  41. package/dist/{chunk-P7BSBCB3.js → chunk-KBP26GLC.js} +2 -2
  42. package/dist/chunk-KVOGOLIR.js +316 -0
  43. package/dist/chunk-LU4PFST7.js +144 -0
  44. package/dist/chunk-MDWG2KDA.mjs +2 -0
  45. package/dist/chunk-NN233SGA.mjs +3 -0
  46. package/dist/chunk-NRQELKAE.js +2 -0
  47. package/dist/chunk-NUDVUAD4.mjs +81 -0
  48. package/dist/chunk-NXQMU36Z.mjs +2 -0
  49. package/dist/chunk-P42Z5CFE.js +2 -0
  50. package/dist/chunk-PATONNTZ.mjs +2 -0
  51. package/dist/{chunk-WLSW4Z4W.mjs → chunk-PM7O5IGE.mjs} +2 -2
  52. package/dist/chunk-Q7VHB64E.mjs +2 -0
  53. package/dist/{chunk-PEH5GIMN.js → chunk-QH6YUVJS.js} +2 -2
  54. package/dist/chunk-QY7PD5XB.js +94 -0
  55. package/dist/chunk-R3OYAJI6.mjs +2 -0
  56. package/dist/chunk-S4GRSNB4.js +2 -0
  57. package/dist/chunk-SAA7UVI2.js +3 -0
  58. package/dist/{chunk-PYEX7DFR.mjs → chunk-SHMJNRHO.mjs} +3 -3
  59. package/dist/chunk-TVW6KBVV.mjs +2 -0
  60. package/dist/chunk-U62QYKVG.mjs +2 -0
  61. package/dist/chunk-UDNRAQLE.js +3 -0
  62. package/dist/{chunk-5RSOLEEP.js → chunk-UXMGBIX6.js} +4 -4
  63. package/dist/{chunk-UZ5EZOA7.js → chunk-VK27WVV3.js} +2 -2
  64. package/dist/{chunk-G26I6MP5.mjs → chunk-VWPGIES4.mjs} +2 -2
  65. package/dist/{chunk-NPLXE43Q.mjs → chunk-XQ4M5FHC.mjs} +2 -2
  66. package/dist/{chunk-CAB7O3GR.mjs → chunk-ZEOQYWOE.mjs} +4 -4
  67. package/dist/consent.js +1 -1
  68. package/dist/consent.mjs +1 -1
  69. package/dist/core.d.mts +9 -46
  70. package/dist/core.d.ts +9 -46
  71. package/dist/core.js +1 -1
  72. package/dist/core.mjs +1 -1
  73. package/dist/cross-border.js +1 -1
  74. package/dist/cross-border.mjs +1 -1
  75. package/dist/dpia.js +1 -1
  76. package/dist/dpia.mjs +1 -1
  77. package/dist/dsr.js +1 -1
  78. package/dist/dsr.mjs +1 -1
  79. package/dist/hooks.d.mts +2 -0
  80. package/dist/hooks.d.ts +2 -0
  81. package/dist/hooks.js +1 -1
  82. package/dist/hooks.mjs +1 -1
  83. package/dist/index.d.mts +2 -3
  84. package/dist/index.d.ts +2 -3
  85. package/dist/index.js +1 -1
  86. package/dist/index.mjs +1 -1
  87. package/dist/lawful-basis.js +1 -1
  88. package/dist/lawful-basis.mjs +1 -1
  89. package/dist/policy-engine-C-tShzZH.d.mts +154 -0
  90. package/dist/policy-engine-DSQpT55_.d.ts +154 -0
  91. package/dist/policy-sections-CfNVBLCh.d.mts +54 -0
  92. package/dist/policy-sections-DqH0iZRf.d.ts +54 -0
  93. package/dist/policy.d.mts +86 -5
  94. package/dist/policy.d.ts +86 -5
  95. package/dist/policy.js +1 -1
  96. package/dist/policy.mjs +1 -1
  97. package/dist/presets.d.mts +5 -15
  98. package/dist/presets.d.ts +5 -15
  99. package/dist/presets.js +1 -1
  100. package/dist/presets.mjs +1 -1
  101. package/dist/ropa.js +1 -1
  102. package/dist/ropa.mjs +1 -1
  103. package/dist/sanitize-9mOO_cJW.d.mts +147 -0
  104. package/dist/sanitize-9mOO_cJW.d.ts +147 -0
  105. package/dist/useAdaptivePolicyWizard-B9Op2gYM.d.ts +52 -0
  106. package/dist/useAdaptivePolicyWizard-N4eUM4Tj.d.mts +52 -0
  107. package/package.json +9 -3
  108. package/dist/PolicyGenerator-BvcWPbxp.d.mts +0 -96
  109. package/dist/PolicyGenerator-BzRwtlgn.d.ts +0 -96
  110. package/dist/chunk-27NYSWUG.mjs +0 -2
  111. package/dist/chunk-2SYNHRP6.mjs +0 -2
  112. package/dist/chunk-2W7ARAW2.js +0 -2
  113. package/dist/chunk-3F34NACG.js +0 -2
  114. package/dist/chunk-3RGJV3VF.js +0 -7
  115. package/dist/chunk-3V23O4ZJ.js +0 -2
  116. package/dist/chunk-3XAUN5IM.mjs +0 -3
  117. package/dist/chunk-6E54NSAO.mjs +0 -2
  118. package/dist/chunk-7F5F5YWI.mjs +0 -2
  119. package/dist/chunk-7FIUX3ZM.js +0 -89
  120. package/dist/chunk-CMZTI7SG.js +0 -2
  121. package/dist/chunk-EPF7J2FK.js +0 -3
  122. package/dist/chunk-FR7ZYZXB.js +0 -2
  123. package/dist/chunk-FXTZDKDC.mjs +0 -3
  124. package/dist/chunk-GIV2OHE6.mjs +0 -2
  125. package/dist/chunk-GPJVTGHR.mjs +0 -2
  126. package/dist/chunk-GVANK6PL.js +0 -3
  127. package/dist/chunk-HNZK7LY3.mjs +0 -2
  128. package/dist/chunk-IKEPXHCZ.js +0 -2
  129. package/dist/chunk-ILCNDOBU.js +0 -2
  130. package/dist/chunk-IQQW52EF.js +0 -2
  131. package/dist/chunk-ISSGO2YT.mjs +0 -72
  132. package/dist/chunk-J6IKAGUP.mjs +0 -89
  133. package/dist/chunk-KNE4NXCY.mjs +0 -7
  134. package/dist/chunk-LFNA6WYQ.mjs +0 -2
  135. package/dist/chunk-PGSA2O5P.mjs +0 -2
  136. package/dist/chunk-RGYK4VAY.mjs +0 -2
  137. package/dist/chunk-RSUDIFZV.mjs +0 -2
  138. package/dist/chunk-RYZEIDNR.js +0 -2
  139. package/dist/chunk-SBNAMPAP.mjs +0 -2
  140. package/dist/chunk-SSGJREE3.js +0 -2
  141. package/dist/chunk-U6VWHC46.js +0 -72
  142. package/dist/chunk-UK656RCG.js +0 -2
  143. package/dist/chunk-UOSEH6DC.js +0 -2
  144. package/dist/chunk-VDZKGCAF.js +0 -2
  145. package/dist/chunk-WSHSHIIM.mjs +0 -2
  146. package/dist/chunk-XSK4BSZJ.mjs +0 -2
  147. package/dist/chunk-Y34DQYS7.js +0 -2
  148. package/dist/chunk-YJCGEOLO.mjs +0 -2
  149. package/dist/chunk-ZCZ5RRZO.js +0 -2
@@ -0,0 +1,94 @@
1
+ import {b,c,a as a$2}from'./chunk-ZEOQYWOE.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>&copy; ${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-I23WPZNQ.mjs.map
94
+ //# sourceMappingURL=chunk-I23WPZNQ.mjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkBKRETVJ6_js=require('./chunk-BKRETVJ6.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function G(c,d){switch(d.type){case "LOAD":return d.payload;case "ADD_REPORT":return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},c),{reports:[...c.reports,d.payload]});case "UPDATE_REPORT":{let f=[...c.reports];return f[d.payload.index]=d.payload.report,chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},c),{reports:f})}case "SET_ASSESSMENT":{let{existing:f,id:S,assessment:g}=d.payload,A=f?c.assessments.map(R=>R.id===S?g:R):[...c.assessments,g];return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},c),{assessments:A})}case "SET_NOTIFICATION":{let{existing:f,id:S,notification:g}=d.payload,A=f?c.notifications.map(R=>R.id===S?g:R):[...c.notifications,g];return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},c),{notifications:A})}case "CLEAR":return {reports:[],assessments:[],notifications:[]}}}function J(c,d){return d?chunkELKB2AFZ_js.a(c):{load:()=>null,save:()=>{},remove:()=>{}}}function X({categories:c,initialReports:d=[],adapter:f,storageKey:S="ndpr_breach_data",useLocalStorage:g=true,onReport:A,onAssessment:R,onNotification:I}){let k=f!=null?f:J(S,g),E=react.useRef(k);E.current=k;let[b,y]=react.useReducer(G,{reports:d,assessments:[],notifications:[]}),[x,T]=react.useState(true),l=react.useRef(b);l.current=b;let h=react.useCallback(t=>{Promise.resolve(E.current.save(t)).catch(s=>{console.warn("[ndpr-toolkit] Failed to save breach data:",s);});},[]);react.useEffect(()=>{let t=false;try{let s=E.current.load(),i=e=>{var r,n,a;e&&y({type:"LOAD",payload:{reports:(r=e.reports)!=null?r:[],assessments:(n=e.assessments)!=null?n:[],notifications:(a=e.notifications)!=null?a:[]}}),T(!1);};s instanceof Promise?s.then(e=>{t||i(e);},()=>{t||T(!1);}):i(s);}catch(s){t||T(false);}return ()=>{t=true;}},[]);let B=react.useCallback(t=>`${t}_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,[]),_=react.useCallback(t=>{let s=chunkMQFZHA2D_js.a({id:B("breach"),reportedAt:Date.now()},t);y({type:"ADD_REPORT",payload:s});let i=l.current,e=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{reports:[...i.reports,s]});return h(e),A&&A(s),s},[B,A,h]),P=react.useCallback((t,s)=>{let i=l.current,e=i.reports.findIndex(a=>a.id===t);if(e===-1)return null;let r=chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},i.reports[e]),s);y({type:"UPDATE_REPORT",payload:{index:e,report:r}});let n=[...i.reports];return n[e]=r,h(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{reports:n})),r},[h]),w=react.useCallback(t=>l.current.reports.find(s=>s.id===t)||null,[]),L=react.useCallback((t,s)=>{let i=l.current,e=i.assessments.find(u=>u.breachId===t),r,n;e?(r=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},e),s),{assessedAt:Date.now()}),n=true):(r=chunkMQFZHA2D_js.a({id:B("assessment"),breachId:t,assessedAt:Date.now()},s),n=false),y({type:"SET_ASSESSMENT",payload:{existing:n,id:e==null?void 0:e.id,assessment:r}});let a=n?i.assessments.map(u=>u.id===e.id?r:u):[...i.assessments,r];return h(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{assessments:a})),R&&R(r),r},[B,R,h]),U=react.useCallback(t=>l.current.assessments.find(s=>s.breachId===t)||null,[]),D=react.useCallback(t=>{let s=l.current.reports.find(N=>N.id===t)||null,i=l.current.assessments.find(N=>N.breachId===t)||null;if(!s)return null;let{severityLevel:e,notificationRequired:r,timeframeHours:n,justification:a}=chunkBKRETVJ6_js.a(s,i||void 0),u=s.discoveredAt+n*60*60*1e3;return {ndpcNotificationRequired:r,ndpcNotificationDeadline:u,dataSubjectNotificationRequired:e==="high"||e==="critical",justification:a}},[]),F=react.useCallback((t,s)=>{let i=l.current,e=i.notifications.find(u=>u.breachId===t),r,n;e?(r=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},e),s),{sentAt:Date.now()}),n=true):(r=chunkMQFZHA2D_js.a({id:B("notification"),breachId:t,sentAt:Date.now()},s),n=false),y({type:"SET_NOTIFICATION",payload:{existing:n,id:e==null?void 0:e.id,notification:r}});let a=n?i.notifications.map(u=>u.id===e.id?r:u):[...i.notifications,r];return h(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{notifications:a})),I&&I(r),r},[B,I,h]),M=react.useCallback(t=>l.current.notifications.find(s=>s.breachId===t)||null,[]),$=react.useCallback((t=24)=>{let s=Date.now(),i=l.current,e=[];return i.reports.forEach(r=>{if(i.notifications.some(O=>O.breachId===r.id))return;let n=i.assessments.find(O=>O.breachId===r.id)||null;if(!n)return;let a=D(r.id);if(!a||!a.ndpcNotificationRequired)return;let N=(a.ndpcNotificationDeadline-s)/(3600*1e3);N<=t&&e.push({report:r,assessment:n,requirements:a,hoursRemaining:N});}),e.sort((r,n)=>r.hoursRemaining-n.hoursRemaining)},[D]),j=react.useCallback(()=>{y({type:"CLEAR"}),Promise.resolve(E.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove breach data:",t);});},[]);return {reports:b.reports,assessments:b.assessments,notifications:b.notifications,reportBreach:_,updateReport:P,getReport:w,assessRisk:L,getAssessment:U,calculateNotificationRequirements:D,sendNotification:F,getNotification:M,getBreachesRequiringNotification:$,clearBreachData:j,isLoading:x}}exports.a=X;//# sourceMappingURL=chunk-I4M2AA3N.js.map
2
+ //# sourceMappingURL=chunk-I4M2AA3N.js.map
@@ -0,0 +1,3 @@
1
+ 'use strict';function r(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}
2
+ exports.a=r;//# sourceMappingURL=chunk-I54CDQGN.js.map
3
+ //# sourceMappingURL=chunk-I54CDQGN.js.map
@@ -1,2 +1,2 @@
1
- import {a as a$2}from'./chunk-FXTZDKDC.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var lr=({requestTypes:I,onSubmit:Q,onValidationError:q,title:X="Submit a Data Subject Request",description:V="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part IV, Sections 29-36.",submitButtonText:s="Submit Request",className:A="",buttonClassName:D="",showConfirmation:N=true,confirmationMessage:rr="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:_=true,identifierTypes:k=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:er=true,labels:y={},classNames:r,unstyled:o=false,isSubmitting:f=false,defaultValues:g,onReset:S})=>{var G,Y,H,L,U,W;let[c,P]=useState((g==null?void 0:g.requestType)||""),[R,j]=useState(((G=g==null?void 0:g.dataSubject)==null?void 0:G.fullName)||""),[x,E]=useState(((Y=g==null?void 0:g.dataSubject)==null?void 0:Y.email)||""),[F,O]=useState(((H=g==null?void 0:g.dataSubject)==null?void 0:H.phone)||""),[B,z]=useState(((L=g==null?void 0:g.dataSubject)==null?void 0:L.identifierType)||((U=k[0])==null?void 0:U.id)||""),[T,M]=useState(((W=g==null?void 0:g.dataSubject)==null?void 0:W.identifierValue)||""),[b$1,w]=useState((g==null?void 0:g.additionalInfo)||{}),[ir,$]=useState(false),[d,Z]=useState({}),tr=()=>{var e;P(""),j(""),E(""),O(""),z(((e=k[0])==null?void 0:e.id)||""),M(""),w({}),$(false),Z({}),S==null||S();},u=I.find(e=>e.id===c),or=e=>{P(e.target.value),w({});},v=(e,a)=>{w(l=>b(a$1({},l),{[e]:a}));},nr=()=>{let e={};return R.trim()||(e.fullName="Full name is required"),x.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(x)||(e.email="Email is invalid"):e.email="Email is required",c||(e.requestType="Please select a request type"),_&&!T.trim()&&(e.identifierValue="Identifier value is required"),u!=null&&u.requiresAdditionalInfo&&u.additionalFields&&u.additionalFields.forEach(a=>{a.required&&!b$1[a.id]&&(e[`additional_${a.id}`]=`${a.label} is required`);}),Z(e),e},dr=e=>{e.preventDefault();let a=nr();if(Object.keys(a).length>0){q==null||q(a);return}let l=Object.keys(b$1).length>0?Object.fromEntries(Object.entries(b$1).map(([ar,C])=>[ar,typeof C=="string"?a$2(C):C])):void 0,h={requestType:c,dataSubject:{fullName:a$2(R),email:a$2(x),phone:F?a$2(F):void 0,identifierType:B,identifierValue:a$2(T)},additionalInfo:l,submittedAt:Date.now()};Q(h),N&&$(true);};return ir?jsxs("div",{className:a(`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${A}`,r==null?void 0:r.successMessage,o),children:[jsx("h2",{className:a("text-lg font-bold text-green-800 dark:text-green-200 mb-2",r==null?void 0:r.title,o),children:"Request Submitted"}),jsx("p",{className:a("text-green-700 dark:text-green-300",r==null?void 0:r.description,o),children:rr}),jsx("button",{onClick:()=>$(false),className:a(`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${D}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:"Submit Another Request"})]}):jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${A}`,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:X}),jsx("p",{className:a("mb-6 text-gray-600 dark:text-gray-300",r==null?void 0:r.description,o),children:V}),jsx("form",{onSubmit:dr,className:a("",r==null?void 0:r.form,o),children:jsxs("div",{className:a("space-y-4",r==null?void 0:r.fieldGroup,o),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",r==null?void 0:r.label,o),children:[y.name||"Full Name"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:R,onChange:e=>j(e.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),required:true,"aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.email||"Email Address"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"email",id:"email",value:x,onChange:e=>E(e.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),required:true,"aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsx("p",{id:"email-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.email})]}),er&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:F,onChange:e=>O(e.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",{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",r==null?void 0:r.label,o),children:[y.requestType||"Request Type"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsxs("select",{id:"requestType",value:c,onChange:or,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),required:true,"aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),I.map(e=>jsx("option",{value:e.id,children:e.name},e.id))]}),d.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.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",r==null?void 0:r.label,o),children:y.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))]",r==null?void 0:r.textarea,o),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),_&&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",r==null?void 0:r.label,o),children:["Identifier Type ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("select",{id:"identifierType",value:B,onChange:e=>z(e.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),required:true,children:k.map(e=>jsx("option",{value:e.id,children:e.label},e.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Value ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:T,onChange:e=>M(e.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),required:true,"aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.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(e=>jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[e.label," ",e.required&&jsx("span",{className:"text-red-500",children:"*"})]}),e.type==="text"&&jsx("input",{type:"text",id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.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))]",r==null?void 0:r.input,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="textarea"&&jsx("textarea",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.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))]",r==null?void 0:r.textarea,o),rows:4,required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="select"&&e.options&&jsxs("select",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.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),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0,children:[jsx("option",{value:"",children:e.placeholder||"Select an option"}),e.options.map(a=>jsx("option",{value:a,children:a},a))]}),e.type==="checkbox"&&jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{type:"checkbox",id:e.id,checked:!!b$1[e.id],onChange:a=>v(e.id,a.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0})}),jsx("div",{className:"ml-3 text-sm",children:jsx("label",{htmlFor:e.id,className:"text-gray-700 dark:text-gray-300",children:e.placeholder||e.label})})]}),e.type==="file"&&jsx("input",{type:"file",id:e.id,onChange:a=>{var h;let l=(h=a.target.files)==null?void 0:h[0];l&&v(e.id,l);},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),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),d[`additional_${e.id}`]&&jsx("p",{id:`additional-${e.id}-error`,role:"alert",className:"mt-1 text-sm text-red-500",children:d[`additional_${e.id}`]})]},e.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:[f&&(r==null?void 0:r.loadingOverlay)&&jsx("div",{className:r.loadingOverlay}),jsx("button",{type:"submit",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 ${D} ${f?"opacity-50 cursor-not-allowed":""}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:f?"Submitting...":y.submit||s}),jsx("button",{type:"button",onClick:tr,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,o),children:"Reset"})]})]})})]})};export{lr as a};//# sourceMappingURL=chunk-6D3ZUGBB.mjs.map
2
- //# sourceMappingURL=chunk-6D3ZUGBB.mjs.map
1
+ import {a as a$2}from'./chunk-GKKAK6ES.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var lr=({requestTypes:I,onSubmit:Q,onValidationError:q,title:X="Submit a Data Subject Request",description:V="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part IV, Sections 29-36.",submitButtonText:s="Submit Request",className:A="",buttonClassName:D="",showConfirmation:N=true,confirmationMessage:rr="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:_=true,identifierTypes:k=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:er=true,labels:y={},classNames:r,unstyled:o=false,isSubmitting:f=false,defaultValues:g,onReset:S})=>{var G,Y,H,L,U,W;let[c,P]=useState((g==null?void 0:g.requestType)||""),[R,j]=useState(((G=g==null?void 0:g.dataSubject)==null?void 0:G.fullName)||""),[x,E]=useState(((Y=g==null?void 0:g.dataSubject)==null?void 0:Y.email)||""),[F,O]=useState(((H=g==null?void 0:g.dataSubject)==null?void 0:H.phone)||""),[B,z]=useState(((L=g==null?void 0:g.dataSubject)==null?void 0:L.identifierType)||((U=k[0])==null?void 0:U.id)||""),[T,M]=useState(((W=g==null?void 0:g.dataSubject)==null?void 0:W.identifierValue)||""),[b$1,w]=useState((g==null?void 0:g.additionalInfo)||{}),[ir,$]=useState(false),[d,Z]=useState({}),tr=()=>{var e;P(""),j(""),E(""),O(""),z(((e=k[0])==null?void 0:e.id)||""),M(""),w({}),$(false),Z({}),S==null||S();},u=I.find(e=>e.id===c),or=e=>{P(e.target.value),w({});},v=(e,a)=>{w(l=>b(a$1({},l),{[e]:a}));},nr=()=>{let e={};return R.trim()||(e.fullName="Full name is required"),x.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(x)||(e.email="Email is invalid"):e.email="Email is required",c||(e.requestType="Please select a request type"),_&&!T.trim()&&(e.identifierValue="Identifier value is required"),u!=null&&u.requiresAdditionalInfo&&u.additionalFields&&u.additionalFields.forEach(a=>{a.required&&!b$1[a.id]&&(e[`additional_${a.id}`]=`${a.label} is required`);}),Z(e),e},dr=e=>{e.preventDefault();let a=nr();if(Object.keys(a).length>0){q==null||q(a);return}let l=Object.keys(b$1).length>0?Object.fromEntries(Object.entries(b$1).map(([ar,C])=>[ar,typeof C=="string"?a$2(C):C])):void 0,h={requestType:c,dataSubject:{fullName:a$2(R),email:a$2(x),phone:F?a$2(F):void 0,identifierType:B,identifierValue:a$2(T)},additionalInfo:l,submittedAt:Date.now()};Q(h),N&&$(true);};return ir?jsxs("div",{className:a(`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${A}`,r==null?void 0:r.successMessage,o),children:[jsx("h2",{className:a("text-lg font-bold text-green-800 dark:text-green-200 mb-2",r==null?void 0:r.title,o),children:"Request Submitted"}),jsx("p",{className:a("text-green-700 dark:text-green-300",r==null?void 0:r.description,o),children:rr}),jsx("button",{onClick:()=>$(false),className:a(`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${D}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:"Submit Another Request"})]}):jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${A}`,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:X}),jsx("p",{className:a("mb-6 text-gray-600 dark:text-gray-300",r==null?void 0:r.description,o),children:V}),jsx("form",{onSubmit:dr,className:a("",r==null?void 0:r.form,o),children:jsxs("div",{className:a("space-y-4",r==null?void 0:r.fieldGroup,o),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",r==null?void 0:r.label,o),children:[y.name||"Full Name"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:R,onChange:e=>j(e.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),required:true,"aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.email||"Email Address"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"email",id:"email",value:x,onChange:e=>E(e.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),required:true,"aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsx("p",{id:"email-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.email})]}),er&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:F,onChange:e=>O(e.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",{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",r==null?void 0:r.label,o),children:[y.requestType||"Request Type"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsxs("select",{id:"requestType",value:c,onChange:or,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),required:true,"aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),I.map(e=>jsx("option",{value:e.id,children:e.name},e.id))]}),d.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.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",r==null?void 0:r.label,o),children:y.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))]",r==null?void 0:r.textarea,o),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),_&&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",r==null?void 0:r.label,o),children:["Identifier Type ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("select",{id:"identifierType",value:B,onChange:e=>z(e.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),required:true,children:k.map(e=>jsx("option",{value:e.id,children:e.label},e.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Value ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:T,onChange:e=>M(e.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),required:true,"aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.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(e=>jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[e.label," ",e.required&&jsx("span",{className:"text-red-500",children:"*"})]}),e.type==="text"&&jsx("input",{type:"text",id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.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))]",r==null?void 0:r.input,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="textarea"&&jsx("textarea",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.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))]",r==null?void 0:r.textarea,o),rows:4,required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="select"&&e.options&&jsxs("select",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.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),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0,children:[jsx("option",{value:"",children:e.placeholder||"Select an option"}),e.options.map(a=>jsx("option",{value:a,children:a},a))]}),e.type==="checkbox"&&jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{type:"checkbox",id:e.id,checked:!!b$1[e.id],onChange:a=>v(e.id,a.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0})}),jsx("div",{className:"ml-3 text-sm",children:jsx("label",{htmlFor:e.id,className:"text-gray-700 dark:text-gray-300",children:e.placeholder||e.label})})]}),e.type==="file"&&jsx("input",{type:"file",id:e.id,onChange:a=>{var h;let l=(h=a.target.files)==null?void 0:h[0];l&&v(e.id,l);},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),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),d[`additional_${e.id}`]&&jsx("p",{id:`additional-${e.id}-error`,role:"alert",className:"mt-1 text-sm text-red-500",children:d[`additional_${e.id}`]})]},e.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:[f&&(r==null?void 0:r.loadingOverlay)&&jsx("div",{className:r.loadingOverlay}),jsx("button",{type:"submit",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 ${D} ${f?"opacity-50 cursor-not-allowed":""}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:f?"Submitting...":y.submit||s}),jsx("button",{type:"button",onClick:tr,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,o),children:"Reset"})]})]})})]})};export{lr as a};//# sourceMappingURL=chunk-IR7VCBWV.mjs.map
2
+ //# sourceMappingURL=chunk-IR7VCBWV.mjs.map
@@ -1,2 +1,2 @@
1
- import {b,d,c,a as a$2}from'./chunk-PYEX7DFR.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {a as a$1,b as b$1}from'./chunk-WWT2ZSNU.mjs';import {useState,useMemo,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var I=[{value:"consent",label:"Consent (Section 25(1)(a))"},{value:"contract",label:"Contract (Section 25(1)(b))"},{value:"legal_obligation",label:"Legal Obligation (Section 25(1)(c))"},{value:"vital_interests",label:"Vital Interests (Section 25(1)(d))"},{value:"public_interest",label:"Public Interest (Section 25(1)(e))"},{value:"legitimate_interests",label:"Legitimate Interests (Section 25(1)(f))"}],N=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"archived",label:"Archived"}],ke=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}];function we(){let l=Date.now();return {id:`proc_${l}_${Math.random().toString(36).substring(2,11)}`,name:"",description:"",controllerDetails:{name:"",contact:"",address:""},lawfulBasis:"consent",lawfulBasisJustification:"",purposes:[],dataCategories:[],dataSubjectCategories:[],recipients:[],retentionPeriod:"",securityMeasures:[],dataSource:"data_subject",dpiaRequired:false,automatedDecisionMaking:false,status:"active",createdAt:l,updatedAt:l}}function ee(l){return l?new Date(l).toLocaleDateString():"N/A"}var Pe=({ropa:l,onAddRecord:R,onUpdateRecord:S,onArchiveRecord:P,title:te="Record of Processing Activities (ROPA)",description:re="Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",className:ae="",buttonClassName:A="",classNames:e,unstyled:d$1})=>{let[b$2,v]=useState("list"),[w,ie]=useState(""),[C,oe]=useState("all"),[D,de]=useState("all"),[n,x]=useState(null),[M,h]=useState([]),[O,L]=useState(""),[j,_]=useState(""),[E,T]=useState(""),[U,$]=useState(""),[J,q]=useState(""),[V,G]=useState(""),[z,H]=useState(""),c$1=useMemo(()=>b(l),[l]),f=useMemo(()=>d(l),[l]),W=useMemo(()=>{let a=[...l.records];if(C!=="all"&&(a=a.filter(r=>r.status===C)),D!=="all"&&(a=a.filter(r=>r.lawfulBasis===D)),w){let r=w.toLowerCase();a=a.filter(u=>u.name.toLowerCase().includes(r)||u.description.toLowerCase().includes(r)||u.dataCategories.some(p=>p.toLowerCase().includes(r))||u.department&&u.department.toLowerCase().includes(r));}return a},[l.records,C,D,w]);useEffect(()=>{n&&(L(n.purposes.join(", ")),_(n.dataCategories.join(", ")),T((n.sensitiveDataCategories||[]).join(", ")),$(n.dataSubjectCategories.join(", ")),q(n.recipients.join(", ")),G(n.securityMeasures.join(", ")),H((n.systemsUsed||[]).join(", ")));},[n==null?void 0:n.id]);let ne=()=>{let a=we();a.controllerDetails.name=l.organizationName,a.controllerDetails.contact=l.organizationContact,a.controllerDetails.address=l.organizationAddress,l.ndpcRegistrationNumber&&(a.controllerDetails.registrationNumber=l.ndpcRegistrationNumber),l.dpoDetails&&(a.controllerDetails.dpoContact=l.dpoDetails.email),x(a),h([]),v("form");},le=a=>{x(a$1({},a)),h([]),v("form");},m=a=>a.split(",").map(r=>r.trim()).filter(r=>r.length>0),ue=()=>{if(!n)return;let a=b$1(a$1({},n),{purposes:m(O),dataCategories:m(j),sensitiveDataCategories:m(E),dataSubjectCategories:m(U),recipients:m(J),securityMeasures:m(V),systemsUsed:m(z),updatedAt:Date.now()});a.sensitiveDataCategories&&a.sensitiveDataCategories.length===0&&(a.sensitiveDataCategories=void 0),a.systemsUsed&&a.systemsUsed.length===0&&(a.systemsUsed=void 0);let r=a$2(a);if(!r.valid){h(r.errors);return}l.records.find(p=>p.id===a.id)?S==null||S(a.id,a):R==null||R(a),x(null),h([]),v("list");},ge=a=>{P==null||P(a);},se=()=>{let a=c(l),r=new Blob([a],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(r),p=document.createElement("a");p.href=u,p.download=`ropa_${l.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,p.click(),setTimeout(()=>URL.revokeObjectURL(u),100);},K=()=>{x(null),h([]),v("list");},g=(a,r)=>{n&&x(u=>u&&b$1(a$1({},u),{[a]:r}));},B=(a,r)=>{n&&x(u=>u&&b$1(a$1({},u),{controllerDetails:b$1(a$1({},u.controllerDetails),{[a]:r})}));},ce=a=>!!a.nextReviewDate&&a.nextReviewDate<=Date.now(),pe=a$1=>{let r={active:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",inactive:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},u={active:"Active",inactive:"Inactive",archived:"Archived"};return jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${r[a$1]}`,e==null?void 0:e.statusBadge,d$1),children:u[a$1]})},me=a=>jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:{consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"}[a]}),be=()=>jsxs("div",{className:a("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,d$1),children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Organization"}),jsx("p",{className:"text-sm font-semibold",children:l.organizationName})]}),l.dpoDetails&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Data Protection Officer"}),jsx("p",{className:"text-sm font-semibold",children:l.dpoDetails.name}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:l.dpoDetails.email})]}),l.ndpcRegistrationNumber&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"NDPC Registration No."}),jsx("p",{className:"text-sm font-semibold",children:l.ndpcRegistrationNumber})]})]}),jsxs("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:["Version ",l.version," | Last Updated: ",ee(l.lastUpdated)]})]}),ve=()=>jsxs("div",{className:a("mb-6",e==null?void 0:e.summary,d$1),children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxs("div",{className:a("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,d$1),children:[jsx("p",{className:"text-2xl font-bold text-blue-700 dark:text-blue-300",children:c$1.totalRecords}),jsx("p",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Total Records"})]}),jsxs("div",{className:a("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,d$1),children:[jsx("p",{className:"text-2xl font-bold text-green-700 dark:text-green-300",children:c$1.activeRecords}),jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"Active"})]}),jsxs("div",{className:a("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,d$1),children:[jsx("p",{className:"text-2xl font-bold text-purple-700 dark:text-purple-300",children:c$1.crossBorderRecords}),jsx("p",{className:"text-xs text-purple-600 dark:text-purple-400",children:"Cross-Border"})]}),jsxs("div",{className:a("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,d$1),children:[jsx("p",{className:"text-2xl font-bold text-orange-700 dark:text-orange-300",children:f.length}),jsx("p",{className:"text-xs text-orange-600 dark:text-orange-400",children:"Records with Gaps"})]})]}),jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm font-medium mb-2",children:"By Lawful Basis"}),I.map(a=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a.label.split(" (")[0]}),jsx("span",{className:"font-medium",children:c$1.byLawfulBasis[a.value]||0})]},a.value))]}),jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm font-medium mb-2",children:"Risk Indicators"}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Sensitive Data"}),jsx("span",{className:"font-medium",children:c$1.sensitiveDataRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"DPIA Required"}),jsx("span",{className:"font-medium",children:c$1.dpiaRequiredRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Automated Decisions"}),jsx("span",{className:"font-medium",children:c$1.automatedDecisionRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Due for Review"}),jsx("span",{className:`font-medium ${c$1.recordsDueForReview.length>0?"text-red-600 dark:text-red-400":""}`,children:c$1.recordsDueForReview.length})]})]}),c$1.topDepartments.length>0&&jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm font-medium mb-2",children:"Top Departments"}),c$1.topDepartments.slice(0,5).map(a=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a.department}),jsx("span",{className:"font-medium",children:a.count})]},a.department))]})]}),f.length>0&&jsxs("div",{className:a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,d$1),children:[jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-2",children:"Compliance Gaps Detected"}),f.slice(0,5).map(a=>jsxs("div",{className:"mb-2",children:[jsx("p",{className:"text-xs font-medium text-red-700 dark:text-red-300",children:a.recordName}),jsx("ul",{className:"list-disc list-inside",children:a.gaps.map((r,u)=>jsx("li",{className:"text-xs text-red-600 dark:text-red-400",children:r},u))})]},a.recordId)),f.length>5&&jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:["...and ",f.length-5," more record(s) with gaps."]})]})]}),xe=()=>jsxs("div",{children:[jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"ropaSearch",className:"block text-sm font-medium mb-1",children:"Search"}),jsx("input",{type:"text",id:"ropaSearch",value:w,onChange:a=>ie(a.target.value),placeholder:"Search records...",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,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaStatusFilter",className:"block text-sm font-medium mb-1",children:"Status"}),jsxs("select",{id:"ropaStatusFilter",value:C,onChange:a=>oe(a.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,d$1),children:[jsx("option",{value:"all",children:"All Statuses"}),N.map(a=>jsx("option",{value:a.value,children:a.label},a.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaBasisFilter",className:"block text-sm font-medium mb-1",children:"Lawful Basis"}),jsxs("select",{id:"ropaBasisFilter",value:D,onChange:a=>de(a.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,d$1),children:[jsx("option",{value:"all",children:"All Bases"}),I.map(a=>jsx("option",{value:a.value,children:a.label.split(" (")[0]},a.value))]})]}),jsxs("div",{className:"flex items-end space-x-2",children:[jsx("button",{onClick:ne,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${A}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),d$1),children:"Add Record"}),jsx("button",{onClick:se,className:a(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${A}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),d$1),children:"Export CSV"})]})]}),W.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm text-center py-8",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a("w-full text-sm text-left",e==null?void 0:e.table,d$1),children:[jsx("thead",{className:a("text-xs uppercase bg-gray-50 dark:bg-gray-700",e==null?void 0:e.tableHeader,d$1),children:jsxs("tr",{children:[jsx("th",{className:"px-4 py-3",children:"Name"}),jsx("th",{className:"px-4 py-3",children:"Lawful Basis"}),jsx("th",{className:"px-4 py-3",children:"Data Categories"}),jsx("th",{className:"px-4 py-3",children:"Status"}),jsx("th",{className:"px-4 py-3",children:"Last Reviewed"}),jsx("th",{className:"px-4 py-3",children:"Actions"})]})}),jsx("tbody",{children:W.map(a$1=>{let r=ce(a$1),u=f.some(p=>p.recordId===a$1.id);return jsxs("tr",{className:a(`border-b dark:border-gray-600 ${r?"bg-red-50 dark:bg-red-900/10":u?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} hover:bg-gray-50 dark:hover:bg-gray-700`,e==null?void 0:e.tableRow,d$1),children:[jsx("td",{className:"px-4 py-3",children:jsxs("div",{children:[jsx("p",{className:"font-medium",children:a$1.name}),a$1.department&&jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:a$1.department}),r&&jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"px-4 py-3",children:me(a$1.lawfulBasis)}),jsx("td",{className:"px-4 py-3",children:jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300 max-w-xs truncate",children:a$1.dataCategories.join(", ")})}),jsx("td",{className:"px-4 py-3",children:pe(a$1.status)}),jsx("td",{className:"px-4 py-3 text-xs text-gray-600 dark:text-gray-400",children:ee(a$1.lastReviewedAt)}),jsx("td",{className:"px-4 py-3",children:jsxs("div",{className:"flex space-x-2",children:[jsx("button",{onClick:()=>le(a$1),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline text-xs",children:"Edit"}),a$1.status!=="archived"&&jsx("button",{onClick:()=>ge(a$1.id),className:"text-gray-600 dark:text-gray-400 hover:underline text-xs",children:"Archive"})]})})]},a$1.id)})})]})})]}),fe=()=>{if(!n)return null;let a$1=!l.records.find(r=>r.id===n.id);return jsxs("div",{className:a("",e==null?void 0:e.form,d$1),children:[jsxs("div",{className:a("flex justify-between items-center mb-4",e==null?void 0:e.header,d$1),children:[jsx("h3",{className:"text-lg font-medium",children:a$1?"Add Processing Record":"Edit Processing Record"}),jsx("button",{onClick:K,className:"text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 text-sm",children:"Cancel"})]}),M.length>0&&jsxs("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-md",children:[jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside",children:M.map((r,u)=>jsx("li",{className:"text-xs text-red-600 dark:text-red-400",children:r},u))})]}),jsxs("div",{className:"space-y-6",children:[jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Basic Information"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"recordName",className:"block text-sm font-medium mb-1",children:"Activity Name *"}),jsx("input",{type:"text",id:"recordName",value:n.name,onChange:r=>g("name",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,d$1),placeholder:"e.g., Customer Account Management"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordDepartment",className:"block text-sm font-medium mb-1",children:"Department"}),jsx("input",{type:"text",id:"recordDepartment",value:n.department||"",onChange:r=>g("department",r.target.value||void 0),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,d$1),placeholder:"e.g., Marketing"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"recordDescription",className:"block text-sm font-medium mb-1",children:"Description *"}),jsx("textarea",{id:"recordDescription",value:n.description,onChange:r=>g("description",r.target.value),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))]",e==null?void 0:e.input,d$1),placeholder:"Describe what personal data processing is performed..."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordStatus",className:"block text-sm font-medium mb-1",children:"Status *"}),jsx("select",{id:"recordStatus",value:n.status,onChange:r=>g("status",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,d$1),children:N.map(r=>jsx("option",{value:r.value,children:r.label},r.value))})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Controller Details"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"controllerName",className:"block text-sm font-medium mb-1",children:"Controller Name *"}),jsx("input",{type:"text",id:"controllerName",value:n.controllerDetails.name,onChange:r=>B("name",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,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"controllerContact",className:"block text-sm font-medium mb-1",children:"Controller Contact *"}),jsx("input",{type:"text",id:"controllerContact",value:n.controllerDetails.contact,onChange:r=>B("contact",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,d$1)})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"controllerAddress",className:"block text-sm font-medium mb-1",children:"Controller Address *"}),jsx("input",{type:"text",id:"controllerAddress",value:n.controllerDetails.address,onChange:r=>B("address",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,d$1)})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Lawful Basis (NDPA Section 25)"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"block text-sm font-medium mb-1",children:"Lawful Basis *"}),jsx("select",{id:"lawfulBasis",value:n.lawfulBasis,onChange:r=>g("lawfulBasis",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,d$1),children:I.map(r=>jsx("option",{value:r.value,children:r.label},r.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasisJustification",className:"block text-sm font-medium mb-1",children:"Justification *"}),jsx("textarea",{id:"lawfulBasisJustification",value:n.lawfulBasisJustification,onChange:r=>g("lawfulBasisJustification",r.target.value),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))]",e==null?void 0:e.input,d$1),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Data Details"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"block text-sm font-medium mb-1",children:"Purposes * (comma-separated)"}),jsx("input",{type:"text",id:"purposes",value:O,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,d$1),placeholder:"e.g., Account management, Service delivery"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"block text-sm font-medium mb-1",children:"Data Categories * (comma-separated)"}),jsx("input",{type:"text",id:"dataCategories",value:j,onChange:r=>_(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,d$1),placeholder:"e.g., Name, Email, Phone number"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveData",className:"block text-sm font-medium mb-1",children:"Sensitive Data Categories (comma-separated)"}),jsx("input",{type:"text",id:"sensitiveData",value:E,onChange:r=>T(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,d$1),placeholder:"e.g., Health data, Biometric data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"subjectCategories",className:"block text-sm font-medium mb-1",children:"Data Subject Categories * (comma-separated)"}),jsx("input",{type:"text",id:"subjectCategories",value:U,onChange:r=>$(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,d$1),placeholder:"e.g., Customers, Employees"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"block text-sm font-medium mb-1",children:"Recipients * (comma-separated)"}),jsx("input",{type:"text",id:"recipients",value:J,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,d$1),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSource",className:"block text-sm font-medium mb-1",children:"Data Source *"}),jsx("select",{id:"dataSource",value:n.dataSource,onChange:r=>g("dataSource",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,d$1),children:ke.map(r=>jsx("option",{value:r.value,children:r.label},r.value))})]}),n.dataSource==="third_party"&&jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"thirdPartyDetails",className:"block text-sm font-medium mb-1",children:"Third-Party Source Details *"}),jsx("input",{type:"text",id:"thirdPartyDetails",value:n.thirdPartySourceDetails||"",onChange:r=>g("thirdPartySourceDetails",r.target.value||void 0),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,d$1),placeholder:"Describe the third-party data source..."})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Retention and Security"}),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:n.retentionPeriod,onChange:r=>g("retentionPeriod",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,d$1),placeholder:"e.g., 5 years after account closure"})]}),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:n.retentionJustification||"",onChange:r=>g("retentionJustification",r.target.value||void 0),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,d$1),placeholder:"Why this retention period is necessary..."})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"securityMeasures",className:"block text-sm font-medium mb-1",children:"Security Measures * (comma-separated)"}),jsx("input",{type:"text",id:"securityMeasures",value:V,onChange:r=>G(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,d$1),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"systemsUsed",className:"block text-sm font-medium mb-1",children:"Systems Used (comma-separated)"}),jsx("input",{type:"text",id:"systemsUsed",value:z,onChange:r=>H(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,d$1),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Risk Indicators"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"dpiaRequired",checked:n.dpiaRequired,onChange:r=>g("dpiaRequired",r.target.checked),className:"rounded border-gray-300 dark:border-gray-600"}),jsx("label",{htmlFor:"dpiaRequired",className:"text-sm font-medium",children:"DPIA Required"})]}),n.dpiaRequired&&jsxs("div",{children:[jsx("label",{htmlFor:"dpiaReference",className:"block text-sm font-medium mb-1",children:"DPIA Reference *"}),jsx("input",{type:"text",id:"dpiaReference",value:n.dpiaReference||"",onChange:r=>g("dpiaReference",r.target.value||void 0),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,d$1),placeholder:"Reference to the completed DPIA"})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:n.automatedDecisionMaking,onChange:r=>g("automatedDecisionMaking",r.target.checked),className:"rounded border-gray-300 dark:border-gray-600"}),jsx("label",{htmlFor:"automatedDecisionMaking",className:"text-sm font-medium",children:"Automated Decision-Making"})]}),n.automatedDecisionMaking&&jsxs("div",{children:[jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"block text-sm font-medium mb-1",children:"Automated Decision-Making Details *"}),jsx("textarea",{id:"automatedDecisionMakingDetails",value:n.automatedDecisionMakingDetails||"",onChange:r=>g("automatedDecisionMakingDetails",r.target.value||void 0),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))]",e==null?void 0:e.input,d$1),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Review Schedule"}),jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:jsxs("div",{children:[jsx("label",{htmlFor:"nextReviewDate",className:"block text-sm font-medium mb-1",children:"Next Review Date"}),jsx("input",{type:"date",id:"nextReviewDate",value:n.nextReviewDate?new Date(n.nextReviewDate).toISOString().slice(0,10):"",onChange:r=>g("nextReviewDate",r.target.value?new Date(r.target.value).getTime():void 0),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,d$1)})]})})]}),jsxs("div",{className:"flex justify-end space-x-3",children:[jsx("button",{onClick:K,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-sm",children:"Cancel"}),jsx("button",{onClick:ue,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${A}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),d$1),children:a$1?"Add Record":"Save Changes"})]})]})]})},ye=()=>jsxs("div",{className:"flex space-x-4 mb-6 border-b border-gray-200 dark:border-gray-600",children:[jsx("button",{onClick:()=>v("list"),className:`pb-2 text-sm font-medium ${b$2==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsx("button",{onClick:()=>v("summary"),className:`pb-2 text-sm font-medium ${b$2==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ae}`,e==null?void 0:e.root,d$1),children:[jsx("h2",{className:a("text-xl font-bold mb-2",e==null?void 0:e.title,d$1),children:te}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:re}),be(),b$2!=="form"&&ye(),b$2==="list"&&xe(),b$2==="summary"&&ve(),b$2==="form"&&fe()]})};export{Pe as a};//# sourceMappingURL=chunk-4VVARDN2.mjs.map
2
- //# sourceMappingURL=chunk-4VVARDN2.mjs.map
1
+ import {b,d,c,a as a$2}from'./chunk-SHMJNRHO.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {a as a$1,b as b$1}from'./chunk-WWT2ZSNU.mjs';import {useState,useMemo,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var I=[{value:"consent",label:"Consent (Section 25(1)(a))"},{value:"contract",label:"Contract (Section 25(1)(b))"},{value:"legal_obligation",label:"Legal Obligation (Section 25(1)(c))"},{value:"vital_interests",label:"Vital Interests (Section 25(1)(d))"},{value:"public_interest",label:"Public Interest (Section 25(1)(e))"},{value:"legitimate_interests",label:"Legitimate Interests (Section 25(1)(f))"}],N=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"archived",label:"Archived"}],ke=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}];function we(){let l=Date.now();return {id:`proc_${l}_${Math.random().toString(36).substring(2,11)}`,name:"",description:"",controllerDetails:{name:"",contact:"",address:""},lawfulBasis:"consent",lawfulBasisJustification:"",purposes:[],dataCategories:[],dataSubjectCategories:[],recipients:[],retentionPeriod:"",securityMeasures:[],dataSource:"data_subject",dpiaRequired:false,automatedDecisionMaking:false,status:"active",createdAt:l,updatedAt:l}}function ee(l){return l?new Date(l).toLocaleDateString():"N/A"}var Pe=({ropa:l,onAddRecord:R,onUpdateRecord:S,onArchiveRecord:P,title:te="Record of Processing Activities (ROPA)",description:re="Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",className:ae="",buttonClassName:A="",classNames:e,unstyled:d$1})=>{let[b$2,v]=useState("list"),[w,ie]=useState(""),[C,oe]=useState("all"),[D,de]=useState("all"),[n,x]=useState(null),[M,h]=useState([]),[O,L]=useState(""),[j,_]=useState(""),[E,T]=useState(""),[U,$]=useState(""),[J,q]=useState(""),[V,G]=useState(""),[z,H]=useState(""),c$1=useMemo(()=>b(l),[l]),f=useMemo(()=>d(l),[l]),W=useMemo(()=>{let a=[...l.records];if(C!=="all"&&(a=a.filter(r=>r.status===C)),D!=="all"&&(a=a.filter(r=>r.lawfulBasis===D)),w){let r=w.toLowerCase();a=a.filter(u=>u.name.toLowerCase().includes(r)||u.description.toLowerCase().includes(r)||u.dataCategories.some(p=>p.toLowerCase().includes(r))||u.department&&u.department.toLowerCase().includes(r));}return a},[l.records,C,D,w]);useEffect(()=>{n&&(L(n.purposes.join(", ")),_(n.dataCategories.join(", ")),T((n.sensitiveDataCategories||[]).join(", ")),$(n.dataSubjectCategories.join(", ")),q(n.recipients.join(", ")),G(n.securityMeasures.join(", ")),H((n.systemsUsed||[]).join(", ")));},[n==null?void 0:n.id]);let ne=()=>{let a=we();a.controllerDetails.name=l.organizationName,a.controllerDetails.contact=l.organizationContact,a.controllerDetails.address=l.organizationAddress,l.ndpcRegistrationNumber&&(a.controllerDetails.registrationNumber=l.ndpcRegistrationNumber),l.dpoDetails&&(a.controllerDetails.dpoContact=l.dpoDetails.email),x(a),h([]),v("form");},le=a=>{x(a$1({},a)),h([]),v("form");},m=a=>a.split(",").map(r=>r.trim()).filter(r=>r.length>0),ue=()=>{if(!n)return;let a=b$1(a$1({},n),{purposes:m(O),dataCategories:m(j),sensitiveDataCategories:m(E),dataSubjectCategories:m(U),recipients:m(J),securityMeasures:m(V),systemsUsed:m(z),updatedAt:Date.now()});a.sensitiveDataCategories&&a.sensitiveDataCategories.length===0&&(a.sensitiveDataCategories=void 0),a.systemsUsed&&a.systemsUsed.length===0&&(a.systemsUsed=void 0);let r=a$2(a);if(!r.valid){h(r.errors);return}l.records.find(p=>p.id===a.id)?S==null||S(a.id,a):R==null||R(a),x(null),h([]),v("list");},ge=a=>{P==null||P(a);},se=()=>{let a=c(l),r=new Blob([a],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(r),p=document.createElement("a");p.href=u,p.download=`ropa_${l.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,p.click(),setTimeout(()=>URL.revokeObjectURL(u),100);},K=()=>{x(null),h([]),v("list");},g=(a,r)=>{n&&x(u=>u&&b$1(a$1({},u),{[a]:r}));},B=(a,r)=>{n&&x(u=>u&&b$1(a$1({},u),{controllerDetails:b$1(a$1({},u.controllerDetails),{[a]:r})}));},ce=a=>!!a.nextReviewDate&&a.nextReviewDate<=Date.now(),pe=a$1=>{let r={active:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",inactive:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},u={active:"Active",inactive:"Inactive",archived:"Archived"};return jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${r[a$1]}`,e==null?void 0:e.statusBadge,d$1),children:u[a$1]})},me=a=>jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:{consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"}[a]}),be=()=>jsxs("div",{className:a("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,d$1),children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Organization"}),jsx("p",{className:"text-sm font-semibold",children:l.organizationName})]}),l.dpoDetails&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Data Protection Officer"}),jsx("p",{className:"text-sm font-semibold",children:l.dpoDetails.name}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:l.dpoDetails.email})]}),l.ndpcRegistrationNumber&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"NDPC Registration No."}),jsx("p",{className:"text-sm font-semibold",children:l.ndpcRegistrationNumber})]})]}),jsxs("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:["Version ",l.version," | Last Updated: ",ee(l.lastUpdated)]})]}),ve=()=>jsxs("div",{className:a("mb-6",e==null?void 0:e.summary,d$1),children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxs("div",{className:a("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,d$1),children:[jsx("p",{className:"text-2xl font-bold text-blue-700 dark:text-blue-300",children:c$1.totalRecords}),jsx("p",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Total Records"})]}),jsxs("div",{className:a("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,d$1),children:[jsx("p",{className:"text-2xl font-bold text-green-700 dark:text-green-300",children:c$1.activeRecords}),jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"Active"})]}),jsxs("div",{className:a("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,d$1),children:[jsx("p",{className:"text-2xl font-bold text-purple-700 dark:text-purple-300",children:c$1.crossBorderRecords}),jsx("p",{className:"text-xs text-purple-600 dark:text-purple-400",children:"Cross-Border"})]}),jsxs("div",{className:a("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,d$1),children:[jsx("p",{className:"text-2xl font-bold text-orange-700 dark:text-orange-300",children:f.length}),jsx("p",{className:"text-xs text-orange-600 dark:text-orange-400",children:"Records with Gaps"})]})]}),jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm font-medium mb-2",children:"By Lawful Basis"}),I.map(a=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a.label.split(" (")[0]}),jsx("span",{className:"font-medium",children:c$1.byLawfulBasis[a.value]||0})]},a.value))]}),jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm font-medium mb-2",children:"Risk Indicators"}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Sensitive Data"}),jsx("span",{className:"font-medium",children:c$1.sensitiveDataRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"DPIA Required"}),jsx("span",{className:"font-medium",children:c$1.dpiaRequiredRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Automated Decisions"}),jsx("span",{className:"font-medium",children:c$1.automatedDecisionRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Due for Review"}),jsx("span",{className:`font-medium ${c$1.recordsDueForReview.length>0?"text-red-600 dark:text-red-400":""}`,children:c$1.recordsDueForReview.length})]})]}),c$1.topDepartments.length>0&&jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm font-medium mb-2",children:"Top Departments"}),c$1.topDepartments.slice(0,5).map(a=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a.department}),jsx("span",{className:"font-medium",children:a.count})]},a.department))]})]}),f.length>0&&jsxs("div",{className:a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,d$1),children:[jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-2",children:"Compliance Gaps Detected"}),f.slice(0,5).map(a=>jsxs("div",{className:"mb-2",children:[jsx("p",{className:"text-xs font-medium text-red-700 dark:text-red-300",children:a.recordName}),jsx("ul",{className:"list-disc list-inside",children:a.gaps.map((r,u)=>jsx("li",{className:"text-xs text-red-600 dark:text-red-400",children:r},u))})]},a.recordId)),f.length>5&&jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:["...and ",f.length-5," more record(s) with gaps."]})]})]}),xe=()=>jsxs("div",{children:[jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"ropaSearch",className:"block text-sm font-medium mb-1",children:"Search"}),jsx("input",{type:"text",id:"ropaSearch",value:w,onChange:a=>ie(a.target.value),placeholder:"Search records...",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,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaStatusFilter",className:"block text-sm font-medium mb-1",children:"Status"}),jsxs("select",{id:"ropaStatusFilter",value:C,onChange:a=>oe(a.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,d$1),children:[jsx("option",{value:"all",children:"All Statuses"}),N.map(a=>jsx("option",{value:a.value,children:a.label},a.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaBasisFilter",className:"block text-sm font-medium mb-1",children:"Lawful Basis"}),jsxs("select",{id:"ropaBasisFilter",value:D,onChange:a=>de(a.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,d$1),children:[jsx("option",{value:"all",children:"All Bases"}),I.map(a=>jsx("option",{value:a.value,children:a.label.split(" (")[0]},a.value))]})]}),jsxs("div",{className:"flex items-end space-x-2",children:[jsx("button",{onClick:ne,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${A}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),d$1),children:"Add Record"}),jsx("button",{onClick:se,className:a(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${A}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),d$1),children:"Export CSV"})]})]}),W.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm text-center py-8",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a("w-full text-sm text-left",e==null?void 0:e.table,d$1),children:[jsx("thead",{className:a("text-xs uppercase bg-gray-50 dark:bg-gray-700",e==null?void 0:e.tableHeader,d$1),children:jsxs("tr",{children:[jsx("th",{className:"px-4 py-3",children:"Name"}),jsx("th",{className:"px-4 py-3",children:"Lawful Basis"}),jsx("th",{className:"px-4 py-3",children:"Data Categories"}),jsx("th",{className:"px-4 py-3",children:"Status"}),jsx("th",{className:"px-4 py-3",children:"Last Reviewed"}),jsx("th",{className:"px-4 py-3",children:"Actions"})]})}),jsx("tbody",{children:W.map(a$1=>{let r=ce(a$1),u=f.some(p=>p.recordId===a$1.id);return jsxs("tr",{className:a(`border-b dark:border-gray-600 ${r?"bg-red-50 dark:bg-red-900/10":u?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} hover:bg-gray-50 dark:hover:bg-gray-700`,e==null?void 0:e.tableRow,d$1),children:[jsx("td",{className:"px-4 py-3",children:jsxs("div",{children:[jsx("p",{className:"font-medium",children:a$1.name}),a$1.department&&jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:a$1.department}),r&&jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"px-4 py-3",children:me(a$1.lawfulBasis)}),jsx("td",{className:"px-4 py-3",children:jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300 max-w-xs truncate",children:a$1.dataCategories.join(", ")})}),jsx("td",{className:"px-4 py-3",children:pe(a$1.status)}),jsx("td",{className:"px-4 py-3 text-xs text-gray-600 dark:text-gray-400",children:ee(a$1.lastReviewedAt)}),jsx("td",{className:"px-4 py-3",children:jsxs("div",{className:"flex space-x-2",children:[jsx("button",{onClick:()=>le(a$1),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline text-xs",children:"Edit"}),a$1.status!=="archived"&&jsx("button",{onClick:()=>ge(a$1.id),className:"text-gray-600 dark:text-gray-400 hover:underline text-xs",children:"Archive"})]})})]},a$1.id)})})]})})]}),fe=()=>{if(!n)return null;let a$1=!l.records.find(r=>r.id===n.id);return jsxs("div",{className:a("",e==null?void 0:e.form,d$1),children:[jsxs("div",{className:a("flex justify-between items-center mb-4",e==null?void 0:e.header,d$1),children:[jsx("h3",{className:"text-lg font-medium",children:a$1?"Add Processing Record":"Edit Processing Record"}),jsx("button",{onClick:K,className:"text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 text-sm",children:"Cancel"})]}),M.length>0&&jsxs("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-md",children:[jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside",children:M.map((r,u)=>jsx("li",{className:"text-xs text-red-600 dark:text-red-400",children:r},u))})]}),jsxs("div",{className:"space-y-6",children:[jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Basic Information"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"recordName",className:"block text-sm font-medium mb-1",children:"Activity Name *"}),jsx("input",{type:"text",id:"recordName",value:n.name,onChange:r=>g("name",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,d$1),placeholder:"e.g., Customer Account Management"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordDepartment",className:"block text-sm font-medium mb-1",children:"Department"}),jsx("input",{type:"text",id:"recordDepartment",value:n.department||"",onChange:r=>g("department",r.target.value||void 0),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,d$1),placeholder:"e.g., Marketing"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"recordDescription",className:"block text-sm font-medium mb-1",children:"Description *"}),jsx("textarea",{id:"recordDescription",value:n.description,onChange:r=>g("description",r.target.value),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))]",e==null?void 0:e.input,d$1),placeholder:"Describe what personal data processing is performed..."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordStatus",className:"block text-sm font-medium mb-1",children:"Status *"}),jsx("select",{id:"recordStatus",value:n.status,onChange:r=>g("status",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,d$1),children:N.map(r=>jsx("option",{value:r.value,children:r.label},r.value))})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Controller Details"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"controllerName",className:"block text-sm font-medium mb-1",children:"Controller Name *"}),jsx("input",{type:"text",id:"controllerName",value:n.controllerDetails.name,onChange:r=>B("name",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,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"controllerContact",className:"block text-sm font-medium mb-1",children:"Controller Contact *"}),jsx("input",{type:"text",id:"controllerContact",value:n.controllerDetails.contact,onChange:r=>B("contact",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,d$1)})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"controllerAddress",className:"block text-sm font-medium mb-1",children:"Controller Address *"}),jsx("input",{type:"text",id:"controllerAddress",value:n.controllerDetails.address,onChange:r=>B("address",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,d$1)})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Lawful Basis (NDPA Section 25)"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"block text-sm font-medium mb-1",children:"Lawful Basis *"}),jsx("select",{id:"lawfulBasis",value:n.lawfulBasis,onChange:r=>g("lawfulBasis",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,d$1),children:I.map(r=>jsx("option",{value:r.value,children:r.label},r.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasisJustification",className:"block text-sm font-medium mb-1",children:"Justification *"}),jsx("textarea",{id:"lawfulBasisJustification",value:n.lawfulBasisJustification,onChange:r=>g("lawfulBasisJustification",r.target.value),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))]",e==null?void 0:e.input,d$1),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Data Details"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"block text-sm font-medium mb-1",children:"Purposes * (comma-separated)"}),jsx("input",{type:"text",id:"purposes",value:O,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,d$1),placeholder:"e.g., Account management, Service delivery"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"block text-sm font-medium mb-1",children:"Data Categories * (comma-separated)"}),jsx("input",{type:"text",id:"dataCategories",value:j,onChange:r=>_(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,d$1),placeholder:"e.g., Name, Email, Phone number"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveData",className:"block text-sm font-medium mb-1",children:"Sensitive Data Categories (comma-separated)"}),jsx("input",{type:"text",id:"sensitiveData",value:E,onChange:r=>T(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,d$1),placeholder:"e.g., Health data, Biometric data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"subjectCategories",className:"block text-sm font-medium mb-1",children:"Data Subject Categories * (comma-separated)"}),jsx("input",{type:"text",id:"subjectCategories",value:U,onChange:r=>$(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,d$1),placeholder:"e.g., Customers, Employees"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"block text-sm font-medium mb-1",children:"Recipients * (comma-separated)"}),jsx("input",{type:"text",id:"recipients",value:J,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,d$1),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSource",className:"block text-sm font-medium mb-1",children:"Data Source *"}),jsx("select",{id:"dataSource",value:n.dataSource,onChange:r=>g("dataSource",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,d$1),children:ke.map(r=>jsx("option",{value:r.value,children:r.label},r.value))})]}),n.dataSource==="third_party"&&jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"thirdPartyDetails",className:"block text-sm font-medium mb-1",children:"Third-Party Source Details *"}),jsx("input",{type:"text",id:"thirdPartyDetails",value:n.thirdPartySourceDetails||"",onChange:r=>g("thirdPartySourceDetails",r.target.value||void 0),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,d$1),placeholder:"Describe the third-party data source..."})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Retention and Security"}),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:n.retentionPeriod,onChange:r=>g("retentionPeriod",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,d$1),placeholder:"e.g., 5 years after account closure"})]}),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:n.retentionJustification||"",onChange:r=>g("retentionJustification",r.target.value||void 0),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,d$1),placeholder:"Why this retention period is necessary..."})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"securityMeasures",className:"block text-sm font-medium mb-1",children:"Security Measures * (comma-separated)"}),jsx("input",{type:"text",id:"securityMeasures",value:V,onChange:r=>G(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,d$1),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"systemsUsed",className:"block text-sm font-medium mb-1",children:"Systems Used (comma-separated)"}),jsx("input",{type:"text",id:"systemsUsed",value:z,onChange:r=>H(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,d$1),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Risk Indicators"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"dpiaRequired",checked:n.dpiaRequired,onChange:r=>g("dpiaRequired",r.target.checked),className:"rounded border-gray-300 dark:border-gray-600"}),jsx("label",{htmlFor:"dpiaRequired",className:"text-sm font-medium",children:"DPIA Required"})]}),n.dpiaRequired&&jsxs("div",{children:[jsx("label",{htmlFor:"dpiaReference",className:"block text-sm font-medium mb-1",children:"DPIA Reference *"}),jsx("input",{type:"text",id:"dpiaReference",value:n.dpiaReference||"",onChange:r=>g("dpiaReference",r.target.value||void 0),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,d$1),placeholder:"Reference to the completed DPIA"})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:n.automatedDecisionMaking,onChange:r=>g("automatedDecisionMaking",r.target.checked),className:"rounded border-gray-300 dark:border-gray-600"}),jsx("label",{htmlFor:"automatedDecisionMaking",className:"text-sm font-medium",children:"Automated Decision-Making"})]}),n.automatedDecisionMaking&&jsxs("div",{children:[jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"block text-sm font-medium mb-1",children:"Automated Decision-Making Details *"}),jsx("textarea",{id:"automatedDecisionMakingDetails",value:n.automatedDecisionMakingDetails||"",onChange:r=>g("automatedDecisionMakingDetails",r.target.value||void 0),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))]",e==null?void 0:e.input,d$1),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsx("legend",{className:"text-sm font-medium px-2",children:"Review Schedule"}),jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:jsxs("div",{children:[jsx("label",{htmlFor:"nextReviewDate",className:"block text-sm font-medium mb-1",children:"Next Review Date"}),jsx("input",{type:"date",id:"nextReviewDate",value:n.nextReviewDate?new Date(n.nextReviewDate).toISOString().slice(0,10):"",onChange:r=>g("nextReviewDate",r.target.value?new Date(r.target.value).getTime():void 0),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,d$1)})]})})]}),jsxs("div",{className:"flex justify-end space-x-3",children:[jsx("button",{onClick:K,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-sm",children:"Cancel"}),jsx("button",{onClick:ue,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${A}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),d$1),children:a$1?"Add Record":"Save Changes"})]})]})]})},ye=()=>jsxs("div",{className:"flex space-x-4 mb-6 border-b border-gray-200 dark:border-gray-600",children:[jsx("button",{onClick:()=>v("list"),className:`pb-2 text-sm font-medium ${b$2==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsx("button",{onClick:()=>v("summary"),className:`pb-2 text-sm font-medium ${b$2==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ae}`,e==null?void 0:e.root,d$1),children:[jsx("h2",{className:a("text-xl font-bold mb-2",e==null?void 0:e.title,d$1),children:te}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:re}),be(),b$2!=="form"&&ye(),b$2==="list"&&xe(),b$2==="summary"&&ve(),b$2==="form"&&fe()]})};export{Pe as a};//# sourceMappingURL=chunk-K45S6YQV.mjs.map
2
+ //# sourceMappingURL=chunk-K45S6YQV.mjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkP42Z5CFE_js=require('./chunk-P42Z5CFE.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function H(i,A){return A?chunkELKB2AFZ_js.a(i):{load:()=>null,save:()=>{},remove:()=>{}}}function Y({sections:i,initialAnswers:A={},adapter:v,storageKey:E="ndpr_dpia_data",useLocalStorage:C=true,onComplete:P}){let b=v!=null?v:H(E,C),d=react.useRef(b);d.current=b;let[f,g]=react.useState(0),[a,p]=react.useState(A),[T,m]=react.useState(true);react.useEffect(()=>{let r=false;try{let t=d.current.load();t instanceof Promise?t.then(e=>{r||(e&&p(e),m(!1));},()=>{r||m(!1);}):(t&&p(t),m(!1));}catch(t){r||m(false);}return ()=>{r=true;}},[]);let c=i[f]||null,_=r=>{Promise.resolve(d.current.save(r)).catch(t=>{console.warn("[ndpr-toolkit] Failed to save DPIA answers:",t);});},$=(r,t)=>{p(e=>{let s=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{[r]:t});return _(s),s});},h=r=>r.showWhen?r.showWhen.every(t=>{let e=a[t.questionId];switch(t.operator){case "equals":return e===t.value;case "contains":return Array.isArray(e)?e.includes(t.value):false;case "greaterThan":return typeof e=="number"?e>t.value:false;case "lessThan":return typeof e=="number"?e<t.value:false;default:return true}}):true,y=()=>c?c.questions.filter(h):[],w=()=>c?y().every(t=>{if(!t.required)return true;let e=a[t.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,O=()=>{let r={};return c&&y().forEach(e=>{if(!e.required)return;let s=a[e.id];s==null||typeof s=="string"&&s.trim()===""?r[e.id]="This question is required":Array.isArray(s)&&s.length===0&&(r[e.id]="At least one option must be selected");}),r},U=()=>w()&&f<i.length-1?(g(r=>r+1),true):false,V=()=>f>0?(g(r=>r-1),true):false,B=r=>r>=0&&r<i.length?(g(r),true):false,F=()=>i.every(r=>r.questions.filter(h).every(e=>{if(!e.required)return true;let s=a[e.id];return !(s==null||typeof s=="string"&&s.trim()===""||Array.isArray(s)&&s.length===0)})),W=()=>{let r=[];return i.forEach(t=>{t.questions.forEach(e=>{let s=a[e.id];if(s!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(s)?s:[s]).forEach(o=>{var D;let l=(D=e.options)==null?void 0:D.find(u=>u.value===o);if(l!=null&&l.riskLevel){let u=l.riskLevel,R=u==="low"?1:u==="medium"?3:5,S=u==="low"?1:u==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${l.label}`,likelihood:R,impact:S,score:R*S,level:u,mitigated:false,relatedQuestionIds:[e.id]});}});else {let n=e.riskLevel,o=n==="low"?1:n==="medium"?3:5,l=n==="low"?1:n==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:o,impact:l,score:o*l,level:n,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},K=(r,t,e)=>{let s=W(),n={id:`dpia_${Date.now()}`,title:t,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:a,risks:s,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},o=chunkP42Z5CFE_js.a(n);return n.overallRiskLevel=o.overallRiskLevel,n.canProceed=o.canProceed,n.conclusion=o.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",n.recommendations=o.recommendations,P&&P(n),n},M=()=>{p({}),g(0),Promise.resolve(d.current.remove()).catch(r=>{console.warn("[ndpr-toolkit] Failed to remove DPIA data:",r);});},j=(()=>{let r=0,t=0;return i.forEach(e=>{e.questions.forEach(s=>{if(s.required&&h(s)){t++;let n=a[s.id];n!=null&&!(typeof n=="string"&&n.trim()==="")&&!(Array.isArray(n)&&n.length===0)&&r++;}});}),t>0?Math.round(r/t*100):0})();return {currentSectionIndex:f,currentSection:c,answers:a,updateAnswer:$,nextSection:U,prevSection:V,goToSection:B,isCurrentSectionValid:w,getCurrentSectionErrors:O,isComplete:F,completeDPIA:K,getVisibleQuestions:y,resetDPIA:M,progress:j,isLoading:T}}exports.a=Y;//# sourceMappingURL=chunk-KBAFOVE3.js.map
2
+ //# sourceMappingURL=chunk-KBAFOVE3.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkIQF726GS_js=require('./chunk-IQF726GS.js'),chunkUK656RCG_js=require('./chunk-UK656RCG.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function j(m,l){return l?chunkUK656RCG_js.a(m):{load:()=>null,save:()=>{},remove:()=>{}}}function Q({initialTransfers:m=[],adapter:l,storageKey:R="ndpr_cross_border_transfers",useLocalStorage:q=true,onAdd:g,onUpdate:C,onRemove:B}={}){let y=l!=null?l:j(R,q),v=react.useRef(y);v.current=y;let[i,u]=react.useState(m),[x,T]=react.useState(true);react.useEffect(()=>{let e=false;try{let r=v.current.load();r instanceof Promise?r.then(t=>{e||(t&&u(t),T(!1));},()=>{e||T(!1);}):(r&&u(r),T(!1));}catch(r){e||T(false);}return ()=>{e=true;}},[]);let f=react.useCallback(e=>{Promise.resolve(v.current.save(e)).catch(r=>{console.warn("[ndpr-toolkit] Failed to save cross-border transfers:",r);});},[]),M=()=>"cbt_"+Date.now()+"_"+Math.random().toString(36).substring(2,11),D=react.useCallback(e=>{let r=Date.now(),t=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{id:M(),createdAt:r,updatedAt:r});return u(a=>{let n=[...a,t];return f(n),n}),g&&g(t),t},[g,f]),k=react.useCallback((e,r)=>{let t=null;return u(a=>{let n=a.findIndex(A=>A.id===e);if(n===-1)return a;t=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},a[n]),r),{updatedAt:Date.now()});let o=[...a];return o[n]=t,f(o),o}),t&&C&&C(t),t},[C,f]),I=react.useCallback(e=>{let r=false;return u(t=>{if(t.findIndex(o=>o.id===e)===-1)return t;r=true;let n=t.filter(o=>o.id!==e);return f(n),n}),r&&B&&B(e),r},[B,f]),L=react.useCallback(e=>i.find(r=>r.id===e)||null,[i]),U=react.useCallback(()=>{let e=Date.now(),r=i.filter(s=>s.status==="active"),t=["adequacy_decision","standard_clauses","binding_corporate_rules","ndpc_authorization","explicit_consent","contract_performance","public_interest","legal_claims","vital_interests"],a={};for(let s of t)a[s]=r.filter(c=>c.transferMechanism===s).length;let n=["adequate","inadequate","pending_review","unknown"],o={};for(let s of n)o[s]=r.filter(c=>c.adequacyStatus===s).length;let A=i.filter(s=>{var c,b;return s.status==="pending_approval"||((c=s.ndpcApproval)==null?void 0:c.required)&&!((b=s.ndpcApproval)!=null&&b.approved)}),P=720*60*60*1e3,V=i.filter(s=>s.reviewDate&&s.reviewDate<=e+P&&s.status==="active"),F=i.filter(s=>!s.tiaCompleted&&s.status==="active"),z=i.filter(s=>s.riskLevel==="high"&&s.status==="active");return {totalActiveTransfers:r.length,byMechanism:a,byAdequacy:o,pendingApproval:A,dueForReview:V,missingTIA:F,highRiskTransfers:z,lastUpdated:e}},[i]),O=react.useCallback(e=>chunkIQF726GS_js.c(e),[]);return {transfers:i,addTransfer:D,updateTransfer:k,removeTransfer:I,getTransfer:L,getSummary:U,validateTransfer:O,isLoading:x}}exports.a=Q;//# sourceMappingURL=chunk-P7BSBCB3.js.map
2
- //# sourceMappingURL=chunk-P7BSBCB3.js.map
1
+ 'use strict';var chunkIQF726GS_js=require('./chunk-IQF726GS.js'),chunkELKB2AFZ_js=require('./chunk-ELKB2AFZ.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function j(m,l){return l?chunkELKB2AFZ_js.a(m):{load:()=>null,save:()=>{},remove:()=>{}}}function Q({initialTransfers:m=[],adapter:l,storageKey:R="ndpr_cross_border_transfers",useLocalStorage:q=true,onAdd:g,onUpdate:C,onRemove:B}={}){let y=l!=null?l:j(R,q),v=react.useRef(y);v.current=y;let[i,u]=react.useState(m),[x,T]=react.useState(true);react.useEffect(()=>{let e=false;try{let r=v.current.load();r instanceof Promise?r.then(t=>{e||(t&&u(t),T(!1));},()=>{e||T(!1);}):(r&&u(r),T(!1));}catch(r){e||T(false);}return ()=>{e=true;}},[]);let f=react.useCallback(e=>{Promise.resolve(v.current.save(e)).catch(r=>{console.warn("[ndpr-toolkit] Failed to save cross-border transfers:",r);});},[]),M=()=>"cbt_"+Date.now()+"_"+Math.random().toString(36).substring(2,11),D=react.useCallback(e=>{let r=Date.now(),t=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},e),{id:M(),createdAt:r,updatedAt:r});return u(a=>{let n=[...a,t];return f(n),n}),g&&g(t),t},[g,f]),k=react.useCallback((e,r)=>{let t=null;return u(a=>{let n=a.findIndex(A=>A.id===e);if(n===-1)return a;t=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},a[n]),r),{updatedAt:Date.now()});let o=[...a];return o[n]=t,f(o),o}),t&&C&&C(t),t},[C,f]),I=react.useCallback(e=>{let r=false;return u(t=>{if(t.findIndex(o=>o.id===e)===-1)return t;r=true;let n=t.filter(o=>o.id!==e);return f(n),n}),r&&B&&B(e),r},[B,f]),L=react.useCallback(e=>i.find(r=>r.id===e)||null,[i]),U=react.useCallback(()=>{let e=Date.now(),r=i.filter(s=>s.status==="active"),t=["adequacy_decision","standard_clauses","binding_corporate_rules","ndpc_authorization","explicit_consent","contract_performance","public_interest","legal_claims","vital_interests"],a={};for(let s of t)a[s]=r.filter(c=>c.transferMechanism===s).length;let n=["adequate","inadequate","pending_review","unknown"],o={};for(let s of n)o[s]=r.filter(c=>c.adequacyStatus===s).length;let A=i.filter(s=>{var c,b;return s.status==="pending_approval"||((c=s.ndpcApproval)==null?void 0:c.required)&&!((b=s.ndpcApproval)!=null&&b.approved)}),P=720*60*60*1e3,V=i.filter(s=>s.reviewDate&&s.reviewDate<=e+P&&s.status==="active"),F=i.filter(s=>!s.tiaCompleted&&s.status==="active"),z=i.filter(s=>s.riskLevel==="high"&&s.status==="active");return {totalActiveTransfers:r.length,byMechanism:a,byAdequacy:o,pendingApproval:A,dueForReview:V,missingTIA:F,highRiskTransfers:z,lastUpdated:e}},[i]),O=react.useCallback(e=>chunkIQF726GS_js.c(e),[]);return {transfers:i,addTransfer:D,updateTransfer:k,removeTransfer:I,getTransfer:L,getSummary:U,validateTransfer:O,isLoading:x}}exports.a=Q;//# sourceMappingURL=chunk-KBP26GLC.js.map
2
+ //# sourceMappingURL=chunk-KBP26GLC.js.map