@tantainnovative/ndpr-toolkit 3.11.0 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/dist/breach.d.mts +7 -1
  3. package/dist/breach.d.ts +7 -1
  4. package/dist/breach.js +1 -1
  5. package/dist/breach.mjs +1 -1
  6. package/dist/chunk-37VFK5SR.js +6 -0
  7. package/dist/chunk-3E4IH7CE.js +1 -0
  8. package/dist/chunk-3H6FYU3Z.mjs +93 -0
  9. package/dist/chunk-3I6FYA5C.js +103 -0
  10. package/dist/chunk-3SIYRGJF.js +93 -0
  11. package/dist/chunk-3XU6FL2I.js +1 -0
  12. package/dist/chunk-42JPSNVV.mjs +6 -0
  13. package/dist/chunk-42UJFTII.js +1 -0
  14. package/dist/chunk-737EMUUC.mjs +1 -0
  15. package/dist/chunk-7FXNGGMO.js +1 -0
  16. package/dist/chunk-B2EXRSYG.mjs +1 -0
  17. package/dist/chunk-BGV2AKT7.mjs +1 -0
  18. package/dist/chunk-BL5W472Q.js +1 -0
  19. package/dist/chunk-BPMVJOHH.mjs +1 -0
  20. package/dist/chunk-ELK6VFKC.mjs +2 -0
  21. package/dist/chunk-F5MGMNQF.js +2 -0
  22. package/dist/chunk-FRQFU44F.mjs +1 -0
  23. package/dist/{chunk-WYH3OA5L.mjs → chunk-I2ZBMR7F.mjs} +1 -1
  24. package/dist/chunk-J7BIJ45O.mjs +103 -0
  25. package/dist/{chunk-US2VGJ7I.js → chunk-KH3EQJQE.js} +1 -1
  26. package/dist/{chunk-IPWX5I5P.mjs → chunk-L3FR4PQE.mjs} +1 -1
  27. package/dist/chunk-N72RNTGP.mjs +6 -0
  28. package/dist/chunk-NB6SKG76.mjs +1 -0
  29. package/dist/chunk-NUIRMJKQ.mjs +2 -0
  30. package/dist/chunk-O2WEABB3.js +1 -0
  31. package/dist/chunk-PXDSPF5B.js +2 -0
  32. package/dist/chunk-QGUOFGVJ.js +2 -0
  33. package/dist/chunk-RBKFNCGO.mjs +1 -0
  34. package/dist/chunk-TTMGFC6C.js +1 -0
  35. package/dist/{chunk-TWJHEIQH.js → chunk-UZNWXJ2W.js} +1 -1
  36. package/dist/chunk-V5TZJJWU.mjs +1 -0
  37. package/dist/chunk-WCTFED27.js +1 -0
  38. package/dist/chunk-WHQ4PEYS.mjs +2 -0
  39. package/dist/chunk-WKUC65HL.mjs +1 -0
  40. package/dist/chunk-WMISQDSV.js +1 -0
  41. package/dist/{chunk-MTSZ7GL6.mjs → chunk-WVHMY2BV.mjs} +1 -1
  42. package/dist/chunk-XYGGUGTO.js +6 -0
  43. package/dist/chunk-YDKWD6MQ.js +1 -0
  44. package/dist/chunk-Z2M5VJX2.mjs +1 -0
  45. package/dist/{chunk-D3DVVJCT.js → chunk-ZD2W3YU2.js} +1 -1
  46. package/dist/chunk-ZM5DLFCZ.js +1 -0
  47. package/dist/chunk-ZQHGIOYP.mjs +1 -0
  48. package/dist/consent.js +1 -1
  49. package/dist/consent.mjs +1 -1
  50. package/dist/core.d.mts +62 -0
  51. package/dist/core.d.ts +62 -0
  52. package/dist/core.js +1 -1
  53. package/dist/core.mjs +1 -1
  54. package/dist/cross-border-lite.js +1 -1
  55. package/dist/cross-border-lite.mjs +1 -1
  56. package/dist/cross-border.js +1 -1
  57. package/dist/cross-border.mjs +1 -1
  58. package/dist/dpia.js +1 -1
  59. package/dist/dpia.mjs +1 -1
  60. package/dist/dsr.js +1 -1
  61. package/dist/dsr.mjs +1 -1
  62. package/dist/headless.d.mts +24 -3
  63. package/dist/headless.d.ts +24 -3
  64. package/dist/headless.js +1 -1
  65. package/dist/headless.mjs +1 -1
  66. package/dist/hooks.d.mts +24 -3
  67. package/dist/hooks.d.ts +24 -3
  68. package/dist/hooks.js +1 -1
  69. package/dist/hooks.mjs +1 -1
  70. package/dist/index.d.mts +93 -4
  71. package/dist/index.d.ts +93 -4
  72. package/dist/index.js +1 -1
  73. package/dist/index.mjs +1 -1
  74. package/dist/lawful-basis-lite.js +1 -1
  75. package/dist/lawful-basis-lite.mjs +1 -1
  76. package/dist/lawful-basis.js +1 -1
  77. package/dist/lawful-basis.mjs +1 -1
  78. package/dist/policy.js +1 -1
  79. package/dist/policy.mjs +1 -1
  80. package/dist/presets-consent.js +1 -1
  81. package/dist/presets-consent.mjs +1 -1
  82. package/dist/presets-dsr.js +1 -1
  83. package/dist/presets-dsr.mjs +1 -1
  84. package/dist/presets-policy.d.mts +23 -0
  85. package/dist/presets-policy.d.ts +23 -0
  86. package/dist/presets-policy.js +1 -1
  87. package/dist/presets-policy.mjs +1 -1
  88. package/dist/presets.d.mts +230 -1
  89. package/dist/presets.d.ts +230 -1
  90. package/dist/presets.js +1 -1
  91. package/dist/presets.mjs +1 -1
  92. package/dist/ropa-lite.js +1 -1
  93. package/dist/ropa-lite.mjs +1 -1
  94. package/dist/ropa.d.mts +24 -3
  95. package/dist/ropa.d.ts +24 -3
  96. package/dist/ropa.js +1 -1
  97. package/dist/ropa.mjs +1 -1
  98. package/dist/server.d.mts +62 -0
  99. package/dist/server.d.ts +62 -0
  100. package/dist/server.js +1 -1
  101. package/dist/server.mjs +1 -1
  102. package/dist/styles.css +2 -0
  103. package/dist/unstyled.js +1 -1
  104. package/dist/unstyled.mjs +1 -1
  105. package/package.json +1 -1
  106. package/dist/chunk-25TNTLHJ.mjs +0 -1
  107. package/dist/chunk-3JPDTXGC.js +0 -1
  108. package/dist/chunk-43OQNS2J.mjs +0 -6
  109. package/dist/chunk-5AECGMEB.js +0 -1
  110. package/dist/chunk-5EKQX6GM.mjs +0 -1
  111. package/dist/chunk-5GVMKUMP.js +0 -1
  112. package/dist/chunk-6GM2PBTF.js +0 -2
  113. package/dist/chunk-73BMSK67.js +0 -1
  114. package/dist/chunk-COD3RMTL.mjs +0 -1
  115. package/dist/chunk-EKNWO4DK.js +0 -1
  116. package/dist/chunk-EXEXUAF6.mjs +0 -1
  117. package/dist/chunk-EZCGTHQV.js +0 -6
  118. package/dist/chunk-FMJ6ICLJ.js +0 -1
  119. package/dist/chunk-G7JKRYM5.mjs +0 -1
  120. package/dist/chunk-GEP52QFH.mjs +0 -1
  121. package/dist/chunk-IB3KSUPZ.mjs +0 -1
  122. package/dist/chunk-JWAN5J4Y.js +0 -1
  123. package/dist/chunk-KY6WYHWB.mjs +0 -2
  124. package/dist/chunk-NDKDKDDX.js +0 -1
  125. package/dist/chunk-O2RDZGM2.js +0 -2
  126. package/dist/chunk-O45PKBZA.mjs +0 -6
  127. package/dist/chunk-OLEUIYE2.mjs +0 -1
  128. package/dist/chunk-PGI2LM6P.js +0 -103
  129. package/dist/chunk-PZRQWPWD.js +0 -1
  130. package/dist/chunk-Q4CSVWSS.mjs +0 -1
  131. package/dist/chunk-QMAVEHOR.js +0 -1
  132. package/dist/chunk-RBMLGRDN.mjs +0 -1
  133. package/dist/chunk-RPXRPGHL.mjs +0 -1
  134. package/dist/chunk-SSH4U4TJ.js +0 -6
  135. package/dist/chunk-TDHH7GS2.mjs +0 -2
  136. package/dist/chunk-WDDCKYWA.js +0 -1
  137. package/dist/chunk-WKTKTLMF.js +0 -1
  138. package/dist/chunk-X3GCGC3H.mjs +0 -103
  139. package/dist/chunk-XN2UYZXH.mjs +0 -93
  140. package/dist/chunk-YWCBI7SI.js +0 -93
  141. package/dist/chunk-ZQZJNKVB.mjs +0 -1
@@ -1,103 +0,0 @@
1
- import {a as a$1}from'./chunk-WTGKZX7J.mjs';import {b,a as a$2}from'./chunk-ITCY2Z66.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {useState,useEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var we=({breachData:l,initialAssessment:f={},onComplete:k,title:J="Breach Risk Assessment",description:K="Assess the risk level of this data breach to determine notification requirements under NDPA Section 40.",submitButtonText:Q="Complete Assessment",className:se="",buttonClassName:Z="",classNames:b={},unstyled:d=false,showBreachSummary:c=true,showNotificationRequirements:S=true})=>{let[L,ae]=useState(f.confidentialityImpact||3),[B,h]=useState(f.integrityImpact||3),[I,D]=useState(f.availabilityImpact||3),[E,T]=useState(f.harmLikelihood||3),[O,F]=useState(f.harmSeverity||3),[U,j]=useState(f.risksToRightsAndFreedoms!==void 0?f.risksToRightsAndFreedoms:false),[H,M]=useState(f.highRisksToRightsAndFreedoms!==void 0?f.highRisksToRightsAndFreedoms:false),[X,ie]=useState(f.justification||""),[Y,re]=useState(0),[C,v]=useState("low"),[x,g]=useState(false),[R,z]=useState(0),[q,ee]=useState(0),[u,w]=useState(false),[$]=useState(()=>Date.now());useEffect(()=>{let W=L*.2+B*.1+I*.1+E*.3+O*.3;re(Number(W.toFixed(1)));let V;W<2?V="low":W<3?V="medium":W<4?V="high":V="critical",v(V),g(U||V==="high"||V==="critical");let de=l.discoveredAt+4320*60*1e3;z(de);let fe=Date.now(),Ne=(de-fe)/(3600*1e3);ee(Number(Ne.toFixed(1)));},[L,B,I,E,O,U,l.discoveredAt]);let P=r=>new Date(r).toLocaleString(),a$1=r=>{r.preventDefault();let y={id:f.id||`assessment_${Date.now()}`,breachId:l.id,assessedAt:Date.now(),assessor:f.assessor||{name:"Assessment User",role:"Data Protection Officer",email:"dpo@example.com"},confidentialityImpact:L,integrityImpact:B,availabilityImpact:I,harmLikelihood:E,harmSeverity:O,overallRiskScore:Y,riskLevel:C,risksToRightsAndFreedoms:U,highRisksToRightsAndFreedoms:H,justification:X};k(y),w(true);},m=r=>{switch(r){case 1:return "Minimal";case 2:return "Low";case 3:return "Moderate";case 4:return "High";case 5:return "Severe";default:return "Unknown"}},N=r=>jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[r]}`,b.riskBadge,d),children:r.charAt(0).toUpperCase()+r.slice(1)});return jsxs("div",{"data-ndpr-component":"breach-risk-assessment",className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${se}`,b.root,d),children:[jsx("h2",{className:a("ndpr-section-heading",b.title,d),children:J}),jsx("p",{className:"ndpr-card__subtitle",children:K}),c&&jsxs("div",{className:"ndpr-panel",children:[jsx("h3",{className:"text-lg font-medium mb-2",children:"Breach Summary"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Title:"})," ",l.title]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Discovered:"})," ",P(l.discoveredAt)]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",l.status.charAt(0).toUpperCase()+l.status.slice(1)]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Types:"})," ",l.dataTypes.join(", ")]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",l.affectedSystems.join(", ")]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",l.estimatedAffectedSubjects||"Unknown"]})]})]})]}),u?jsxs("div",{children:[jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Assessment Results"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Overall Risk Level:"})," ",N(C)]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Risk Score:"})," ",Y," / 5"]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Assessed On:"})," ",P($)]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",U?"Yes":"No"]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",H?"Yes":"No"]})]})]}),jsxs("div",{className:"mt-3",children:[jsx("p",{className:"text-sm mb-1",children:jsx("span",{className:"font-medium",children:"Justification:"})}),jsx("p",{className:"text-sm bg-white dark:bg-gray-800 p-2 rounded",children:X})]})]}),S&&jsxs("div",{className:a(`mb-6 p-4 rounded-md ${x?q>24?"ndpr-alert ndpr-alert--warning":"ndpr-alert ndpr-alert--destructive":"ndpr-alert ndpr-alert--success"}`,b.notificationStatus,d),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Requirements"}),x?jsxs("div",{children:[jsx("p",{className:`text-sm font-bold mb-2 ${q>24?"ndpr-text-warning":"ndpr-text-destructive"}`,children:"NDPC Notification Required"}),jsx("p",{className:"text-sm mb-2",children:"Under the NDPA (Section 40), this breach must be reported to the NDPC within 72 hours of discovery."}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Notification Deadline:"})," ",P(R)]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Time Remaining:"})," ",jsx("span",{className:q<24?"ndpr-text-destructive font-bold":"",children:q>0?`${q} hours`:"Deadline passed"})]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Data Subject Notification:"})," ",H?"Required (NDPA Section 40(4))":"Not required unless directed by NDPC"]})]}):jsxs("div",{children:[jsx("p",{className:"text-sm font-bold mb-2 ndpr-text-success",children:"NDPC Notification Not Required"}),jsx("p",{className:"text-sm mb-2",children:"Based on this assessment, this breach does not need to be reported to the NDPC."}),jsx("p",{className:"text-sm mb-2",children:"However, the breach should still be documented internally for compliance purposes."})]}),jsxs("div",{className:"mt-3 text-sm",children:[jsx("p",{className:"font-medium",children:"Next Steps:"}),jsx("ul",{className:"list-disc pl-5 mt-1",children:x?jsxs(Fragment,{children:[jsx("li",{children:"Prepare a notification report for the NDPC"}),jsx("li",{children:"Document all aspects of the breach and your response"}),H&&jsx("li",{children:"Prepare communications for affected data subjects"}),jsx("li",{children:"Implement measures to mitigate the impact of the breach"})]}):jsxs(Fragment,{children:[jsx("li",{children:"Document the breach and this assessment in your internal records"}),jsx("li",{children:"Implement measures to prevent similar breaches in the future"}),jsx("li",{children:"Review and update security measures as needed"})]})})]})]}),jsx("button",{onClick:()=>w(false),className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${Z}`,b.primaryButton||b.submitButton,d),children:"Edit Assessment"})]}):jsx("form",{onSubmit:a$1,children:jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Impact Assessment"}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"confidentialityImpact",className:"ndpr-form-field__label",children:["Confidentiality Impact (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the confidentiality of data been compromised?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"confidentialityImpact",min:"1",max:"5",step:"1",value:L,onChange:r=>ae(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(L)," (",L,")"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"integrityImpact",className:"ndpr-form-field__label",children:["Integrity Impact (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the integrity of data been compromised?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"integrityImpact",min:"1",max:"5",step:"1",value:B,onChange:r=>h(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(B)," (",B,")"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"availabilityImpact",className:"ndpr-form-field__label",children:["Availability Impact (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the availability of data or systems been compromised?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"availabilityImpact",min:"1",max:"5",step:"1",value:I,onChange:r=>D(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(I)," (",I,")"]})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Risk to Data Subjects"}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"harmLikelihood",className:"ndpr-form-field__label",children:["Likelihood of Harm (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How likely is it that data subjects will experience harm?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"harmLikelihood",min:"1",max:"5",step:"1",value:E,onChange:r=>T(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(E)," (",E,")"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"harmSeverity",className:"ndpr-form-field__label",children:["Severity of Harm (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How severe would the harm be to affected data subjects?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"harmSeverity",min:"1",max:"5",step:"1",value:O,onChange:r=>F(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(O)," (",O,")"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("div",{className:"flex items-center mb-2",children:[jsx("input",{type:"checkbox",id:"risksToRightsAndFreedoms",checked:U,onChange:r=>j(r.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"risksToRightsAndFreedoms",className:"ml-2 text-sm font-medium",children:"This breach poses a risk to the rights and freedoms of data subjects"})]}),jsx("p",{className:"text-xs ndpr-text-muted ml-6",children:"Under the NDPA (Section 40), breaches that pose a risk to rights and freedoms must be reported to the NDPC within 72 hours."})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("div",{className:"flex items-center mb-2",children:[jsx("input",{type:"checkbox",id:"highRisksToRightsAndFreedoms",checked:H,onChange:r=>M(r.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"highRisksToRightsAndFreedoms",className:"ml-2 text-sm font-medium",children:"This breach poses a high risk to the rights and freedoms of data subjects"})]}),jsx("p",{className:"text-xs ndpr-text-muted ml-6",children:"Under the NDPA (Section 40(4)), breaches that pose a high risk to rights and freedoms also require notification to affected data subjects without undue delay."})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Overall Assessment"}),jsxs("div",{className:"ndpr-panel",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"font-medium",children:"Overall Risk Score:"}),jsxs("span",{className:a("",b.riskScore,d),children:[Y," / 5"]})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"font-medium",children:"Risk Level:"}),N(C)]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:["Justification for Assessment ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"justification",value:X,onChange:r=>ie(r.target.value),rows:4,placeholder:"Explain the reasoning behind your assessment, including any factors that influenced your decision.",className:"ndpr-form-field__input",required:true})]})]}),jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsx("p",{className:"ndpr-text-info text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. This assessment will determine if notification is required for this breach."})]}),jsx("div",{className:"mt-6",children:jsx("button",{type:"submit",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 ${Z}`,b.primaryButton||b.submitButton,d),children:Q})})]})})]})};var Pe=({breachReports:l,riskAssessments:f,regulatoryNotifications:k,onSelectBreach:J,onRequestAssessment:K,onRequestNotification:Q,title:se="Breach Notification Manager",description:Z="Manage data breach notifications and track compliance with NDPA Section 40 requirements.",className:b="",buttonClassName:d="",classNames:c={},unstyled:S=false,showBreachDetails:L=true,showNotificationTimeline:ae=true,showDeadlineAlerts:B=true})=>{var P;let[h,I]=useState(null),[D,E]=useState(l),[T,O]=useState("all"),[F,U]=useState(""),[j,H]=useState("discoveredAt"),[M,X]=useState("desc");useEffect(()=>{let a=[...l];if(T!=="all"&&(a=a.filter(m=>m.status===T)),F){let m=F.toLowerCase();a=a.filter(N=>N.title.toLowerCase().includes(m)||N.description.toLowerCase().includes(m)||N.affectedSystems.some(r=>r.toLowerCase().includes(m))||N.dataTypes.some(r=>r.toLowerCase().includes(m)));}a.sort((m,N)=>{let r=0;switch(j){case "title":r=m.title.localeCompare(N.title);break;case "discoveredAt":r=m.discoveredAt-N.discoveredAt;break;case "status":r=m.status.localeCompare(N.status);break;case "riskLevel":let y=f.find(W=>W.breachId===m.id),_=f.find(W=>W.breachId===N.id),ne=(y==null?void 0:y.riskLevel)||"unknown",oe=(_==null?void 0:_.riskLevel)||"unknown";r=ne.localeCompare(oe);break;default:r=m.discoveredAt-N.discoveredAt;}return M==="asc"?r:-r}),E(a);},[l,T,F,j,M,f]),useEffect(()=>{D.length>0&&(h&&D.some(m=>m.id===h)||I(D[0].id));},[D,h]);let ie=a=>{I(a),J&&J(a);},Y=()=>{h&&K&&K(h);},re=()=>{h&&Q&&Q(h);},C=a=>new Date(a).toLocaleString(),v=h?l.find(a=>a.id===h):null,x=h?f.find(a=>a.breachId===h):null,g=h?k.find(a=>a.breachId===h):null,R=v?z(v,x):null;function z(a,m){let N=a$1(a,m||void 0),r=a.discoveredAt+N.timeframeHours*60*60*1e3;return {ndpcNotificationRequired:N.notificationRequired,ndpcNotificationDeadline:r,dataSubjectNotificationRequired:(m==null?void 0:m.highRisksToRightsAndFreedoms)||false,justification:N.justification}}function q(a){let m=Date.now(),N=(a-m)/(3600*1e3);return Number(N.toFixed(1))}let ee=a$1=>a$1?jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[a$1]}`,c.statusBadge,S),children:a$1.charAt(0).toUpperCase()+a$1.slice(1)}):null,u=a$1=>jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{ongoing:"ndpr-badge ndpr-badge--destructive",contained:"ndpr-badge ndpr-badge--warning",resolved:"ndpr-badge ndpr-badge--success"}[a$1]||"ndpr-badge ndpr-badge--neutral"}`,c.statusBadge,S),children:a$1.charAt(0).toUpperCase()+a$1.slice(1)}),w=()=>{if(!v||!R)return null;if(!R.ndpcNotificationRequired)return jsxs("div",{"data-ndpr-component":"breach-notification-manager",className:"ndpr-alert ndpr-alert--success",children:[jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"Notification Not Required"}),jsx("p",{className:"text-xs ndpr-text-success mt-1",children:"Based on the risk assessment, NDPC notification is not required for this breach."})]});if(g)return jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"Notification Sent"}),jsxs("p",{className:"text-xs ndpr-text-success mt-1",children:["Notification was sent to the NDPC on ",C(g.sentAt),"."]})]});let a=q(R.ndpcNotificationDeadline);return a<=0?jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsx("p",{className:"text-sm ndpr-text-destructive font-medium",children:"Notification Deadline Passed"}),jsx("p",{className:"text-xs ndpr-text-destructive mt-1",children:"The 72-hour deadline for NDPC notification has passed. Notification should be sent immediately."})]}):a<=24?jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsx("p",{className:"text-sm ndpr-text-destructive font-medium",children:"Urgent: Notification Due Soon"}),jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["Only ",a," hours remaining until the NDPC notification deadline."]})]}):jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm ndpr-text-warning font-medium",children:"Notification Required"}),jsxs("p",{className:"text-xs ndpr-text-warning mt-1",children:["NDPC notification is required by ",C(R.ndpcNotificationDeadline)," (",a," hours remaining)."]})]})},$=()=>{if(!v)return null;let a$1=[{title:"Breach Discovered",date:v.discoveredAt,completed:true,description:`Breach was discovered on ${C(v.discoveredAt)}.`},{title:"Risk Assessment",date:x==null?void 0:x.assessedAt,completed:!!x,description:x?`Risk assessment completed on ${C(x.assessedAt)}.`:"Risk assessment has not been completed yet."}];return R!=null&&R.ndpcNotificationRequired&&a$1.push({title:"NDPC Notification",date:g==null?void 0:g.sentAt,completed:!!g,description:g?`Notification sent to the NDPC on ${C(g.sentAt)}.`:`Notification must be sent to the NDPC by ${C(R.ndpcNotificationDeadline)}.`}),R!=null&&R.dataSubjectNotificationRequired&&a$1.push({title:"Data Subject Notification",date:void 0,completed:false,description:"Notification to affected data subjects is required but has not been sent yet."}),jsxs("div",{className:a("mt-6",c.timeline,S),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Notification Timeline"}),jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:a$1.map((m,N)=>jsxs("li",{className:a("mb-6 ml-4",c.timelineStep,S),children:[jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${m.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700"}`}),jsx("time",{className:"mb-1 text-sm font-normal leading-none ndpr-text-muted",children:m.date?C(m.date):"Pending"}),jsx("h4",{className:"ndpr-section-heading",children:m.title}),jsx("p",{className:"ndpr-form-field__hint",children:m.description})]},N))})]})};return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${b}`,c.root,S),children:[jsxs("div",{className:a("",c.header,S),children:[jsx("h2",{className:a("ndpr-section-heading",c.title,S),children:se}),jsx("p",{className:"ndpr-card__subtitle",children:Z})]}),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"statusFilter",className:"ndpr-form-field__label",children:"Status Filter"}),jsxs("select",{id:"statusFilter",value:T,onChange:a=>O(a.target.value),className:"ndpr-form-field__input",children:[jsx("option",{value:"all",children:"All Statuses"}),jsx("option",{value:"ongoing",children:"Ongoing"}),jsx("option",{value:"contained",children:"Contained"}),jsx("option",{value:"resolved",children:"Resolved"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sortBy",className:"ndpr-form-field__label",children:"Sort By"}),jsxs("select",{id:"sortBy",value:j,onChange:a=>H(a.target.value),className:"ndpr-form-field__input",children:[jsx("option",{value:"discoveredAt",children:"Discovery Date"}),jsx("option",{value:"title",children:"Title"}),jsx("option",{value:"status",children:"Status"}),jsx("option",{value:"riskLevel",children:"Risk Level"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchTerm",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"searchTerm",value:F,onChange:a=>U(a.target.value),placeholder:"Search breaches...",className:"ndpr-form-field__input"})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxs("div",{className:"md:col-span-1",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Breach Reports"}),D.length===0?jsx("p",{className:"ndpr-card__subtitle",children:"No breach reports found."}):jsx("div",{className:a("space-y-2 max-h-96 overflow-y-auto pr-2",c.breachList,S),children:D.map(a$1=>{let m=f.find(_=>_.breachId===a$1.id),N=k.find(_=>_.breachId===a$1.id),r=z(a$1,m),y=null;if(r!=null&&r.ndpcNotificationRequired)if(N)y=jsx("span",{className:"text-xs ndpr-text-success",children:"Notified"});else {let _=q(r.ndpcNotificationDeadline);_<=0?y=jsx("span",{className:"text-xs ndpr-text-destructive font-bold",children:"Overdue"}):_<=24?y=jsx("span",{className:"text-xs ndpr-text-destructive",children:"Urgent"}):y=jsx("span",{className:"text-xs ndpr-text-warning",children:"Required"});}else y=jsx("span",{className:"text-xs ndpr-text-success",children:"Not Required"});return jsxs("div",{className:a(`p-3 rounded-md cursor-pointer ${h===a$1.id?"ndpr-alert ndpr-alert--info":"ndpr-panel"}`,c.breachItem,S),onClick:()=>ie(a$1.id),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:a$1.title}),u(a$1.status)]}),jsxs("p",{className:"text-xs ndpr-text-muted mb-1",children:["Discovered: ",new Date(a$1.discoveredAt).toLocaleDateString()]}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsx("div",{children:m&&ee(m.riskLevel)}),jsx("div",{children:y})]})]},a$1.id)})})]}),jsx("div",{className:a("md:col-span-2",c.detailPanel,S),children:v?jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsx("h3",{className:"ndpr-section-heading",children:v.title}),u(v.status)]}),B&&jsx("div",{className:"ndpr-form-field",children:w()}),L&&jsxs("div",{className:"mb-6",children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Discovered:"})," ",C(v.discoveredAt)]}),v.occurredAt&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Occurred:"})," ",C(v.occurredAt)]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Reporter:"})," ",v.reporter.name]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",v.affectedSystems.join(", ")]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Types:"})," ",v.dataTypes.join(", ")]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",v.estimatedAffectedSubjects||"Unknown"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Description:"}),jsx("p",{className:"ndpr-panel",children:v.description})]}),v.initialActions&&jsxs("div",{children:[jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Initial Actions Taken:"}),jsx("p",{className:"ndpr-panel",children:v.initialActions})]})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Risk Assessment"}),x?jsxs("div",{className:"ndpr-panel",children:[jsxs("div",{className:"flex justify-between items-center mb-2",children:[jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Risk Level:"}),ee(x.riskLevel)]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Risk Score:"})," ",x.overallRiskScore," / 5"]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",x.risksToRightsAndFreedoms?"Yes":"No"]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",x.highRisksToRightsAndFreedoms?"Yes":"No"]}),jsx("p",{className:"text-sm mb-1",children:jsx("span",{className:"font-medium",children:"Justification:"})}),jsx("p",{className:"text-xs ndpr-text-muted bg-white dark:bg-gray-800 p-2 rounded-md",children:x.justification})]}):jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm ndpr-text-warning",children:"Risk assessment has not been conducted yet."}),jsx("button",{onClick:Y,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${d}`,children:"Conduct Risk Assessment"})]})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Status"}),g?jsxs("div",{className:"ndpr-panel",children:[jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Notification Sent:"})," ",C(g.sentAt)]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Method:"})," ",g.method.charAt(0).toUpperCase()+g.method.slice(1)]}),g.referenceNumber&&jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Reference Number:"})," ",g.referenceNumber]}),(g.ndpcContact||g.nitdaContact)&&jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"NDPC Contact:"})," ",(P=g.ndpcContact||g.nitdaContact)==null?void 0:P.name]})]}):jsx("div",{children:R!=null&&R.ndpcNotificationRequired?jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm ndpr-text-warning",children:"NDPC notification is required but has not been sent yet."}),jsx("button",{onClick:re,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${d}`,children:"Generate Notification"})]}):jsx("div",{className:"ndpr-alert ndpr-alert--success",children:jsx("p",{className:"text-sm ndpr-text-success",children:"NDPC notification is not required for this breach."})})})]}),ae&&$()]}):jsx("div",{className:"ndpr-empty-state",children:jsx("p",{className:"ndpr-card__subtitle",children:"Select a breach to view details"})})})]})]})};var Le=({breachData:l,assessmentData:f,organizationInfo:k,onGenerate:J,title:K="Generate NDPC Notification Report",description:Q="Generate a report for submission to the NDPC in compliance with NDPA Section 40 breach notification requirements.",generateButtonText:se="Generate Report",className:Z="",buttonClassName:b$1="",classNames:d={},unstyled:c=false,showPreview:S=true,allowEditing:L=true,allowDownload:ae=true,downloadFormat:B="pdf"})=>{let[h,I]=useState(""),[D,E]=useState(""),[T,O]=useState(""),[F,U]=useState(""),[j,H]=useState("email"),[M,X]=useState(""),[ie,Y]=useState(""),[re,C]=useState(false),[v,x]=useState(false);useEffect(()=>{let u=R();I(u),C(true);},[l,f,k]);let g=u=>new Date(u).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),R=()=>{var m,N,r,y,_,ne;let w=new Date().toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),$=((m=l.dpoContact)==null?void 0:m.name)||k.dpoName,P=((N=l.dpoContact)==null?void 0:N.email)||k.dpoEmail,a=((r=l.dpoContact)==null?void 0:r.phone)||k.dpoPhone;return `
2
- NDPC DATA BREACH NOTIFICATION
3
-
4
- Date: ${w}
5
- ${l.isPhasedReport?"Report Type: PHASED / INTERIM REPORT":"Report Type: Full Report"}
6
- ${l.supplementsReportId?`Supplements Report ID: ${l.supplementsReportId}`:""}
7
-
8
- Reference: NDPA Section 40 - Personal Data Breaches
9
-
10
- ORGANIZATION DETAILS
11
- -------------------
12
- Organization Name: ${k.name}
13
- ${k.registrationNumber?`Registration Number: ${k.registrationNumber}`:""}
14
- Address: ${k.address}
15
- ${k.website?`Website: ${k.website}`:""}
16
-
17
- DATA PROTECTION OFFICER (Section 32 contact point)
18
- ----------------------
19
- Name: ${$}
20
- Email: ${P}
21
- ${a?`Phone: ${a}`:""}
22
-
23
- BREACH DETAILS
24
- -------------
25
- Breach Title: ${l.title}
26
- Date Discovered: ${g(l.discoveredAt)}
27
- ${l.occurredAt?`Date Occurred: ${g(l.occurredAt)}`:"Date Occurred: Unknown"}
28
- Status: ${l.status.charAt(0).toUpperCase()+l.status.slice(1)}
29
-
30
- Nature of the Personal Data Breach (Section 40(2)):
31
- ${l.description}
32
-
33
- Affected Systems/Applications:
34
- ${l.affectedSystems.join(", ")}
35
-
36
- Types of Personal Data Involved:
37
- ${l.dataTypes.join(", ")}
38
- ${l.involvesSensitiveData?"Sensitive personal data (Section 30) involved: YES":""}
39
-
40
- Categories of Data Subjects Affected (Section 40(2)):
41
- ${((y=l.dataSubjectCategories)==null?void 0:y.join(", "))||"[Not specified \u2014 required by NDPC]"}
42
-
43
- Approximate Number of Data Subjects Affected:
44
- ${(_=l.estimatedAffectedSubjects)!=null?_:"Unknown"}
45
-
46
- Approximate Number of Personal Data Records Concerned (Section 40(2)):
47
- ${(ne=l.approximateRecordCount)!=null?ne:"Unknown"}
48
-
49
- RISK ASSESSMENT
50
- --------------
51
- ${f?`
52
- Overall Risk Level: ${f.riskLevel.charAt(0).toUpperCase()+f.riskLevel.slice(1)}
53
- Risk to Rights and Freedoms of Data Subjects: ${f.risksToRightsAndFreedoms?"Yes":"No"}
54
- High Risk to Rights and Freedoms of Data Subjects: ${f.highRisksToRightsAndFreedoms?"Yes":"No"}
55
-
56
- Justification for Risk Assessment:
57
- ${f.justification}
58
- `:"Risk assessment has not been conducted yet."}
59
-
60
- LIKELY CONSEQUENCES OF THE BREACH (Section 40(3))
61
- --------------------------------
62
- ${l.likelyConsequences||"[Please describe likely consequences for affected data subjects \u2014 identity theft, financial loss, discrimination, etc.]"}
63
-
64
- MEASURES TAKEN OR PROPOSED
65
- -------------
66
- Measures taken to address the breach:
67
- ${l.initialActions||"To be determined"}
68
-
69
- Measures taken or proposed to mitigate possible adverse effects (Section 40(3)):
70
- ${l.mitigationMeasures||"[Please specify mitigation measures]"}
71
-
72
- NOTIFICATION TO DATA SUBJECTS (Section 40(3))
73
- ----------------------------
74
- Have data subjects been notified: [Yes/No]
75
- If yes, date of notification: [Date]
76
- If no, planned date of notification: [Date]
77
- Reason for delay (if applicable): [Reason]
78
-
79
- ${l.isPhasedReport?`PHASED REPORT NOTE
80
- ---------------------
81
- This report is submitted in phases under NDPA Section 40(2) because complete
82
- information was not available within 72 hours of discovery. A supplementary
83
- report will be filed once additional facts are confirmed.
84
- `:""}
85
- ADDITIONAL INFORMATION
86
- ---------------------
87
- [Any additional information relevant to the breach]
88
-
89
- This notification is made in compliance with the Nigeria Data Protection Act (NDPA), Section 40.
90
-
91
- IMPORTANT NOTICE
92
- ---------------------
93
- ${b}
94
- `},z=u=>{u.preventDefault();let w={id:`notification_${Date.now()}`,breachId:l.id,sentAt:Date.now(),method:j,referenceNumber:M||void 0,ndpcContact:D?{name:D,email:T,phone:F||void 0}:void 0,content:h,attachments:[]};J(w),x(true);},q=()=>{let u,w,$;switch(B){case "html":{u="text/html",w="html",$=`<!DOCTYPE html>
95
- <html lang="en">
96
- <head>
97
- <meta charset="UTF-8">
98
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
99
- <title>NDPC Breach Notification Report</title>
100
- <style>body{font-family:monospace;white-space:pre-wrap;max-width:800px;margin:2rem auto;padding:0 1rem;}</style>
101
- </head>
102
- <body>${h.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</body>
103
- </html>`;break}case "pdf":u="text/plain",w="pdf.txt",$=h;break;case "docx":u="text/plain",w="docx.txt",$=h;break;default:u="text/plain",w="txt",$=h;}let P=document.createElement("a"),a=new Blob([$],{type:u});P.href=URL.createObjectURL(a),P.download=`NDPC_Breach_Notification_${new Date().toISOString().split("T")[0]}.${w}`,document.body.appendChild(P),P.click(),document.body.removeChild(P);},ee=()=>[{value:"email",label:"Email"},{value:"portal",label:"NDPC Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map(w=>jsx("option",{value:w.value,children:w.label},w.value));return jsxs("div",{"data-ndpr-component":"regulatory-report-generator",className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Z}`,d.root,c),children:[jsxs("div",{className:a("",d.header,c),children:[jsx("h2",{className:a("ndpr-section-heading",d.title,c),children:K}),jsx("p",{className:"ndpr-card__subtitle",children:Q})]}),v?jsxs("div",{children:[jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsx("h3",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Generated Successfully"}),jsx("p",{className:"ndpr-text-success",children:"Your NDPC notification report has been generated and is ready for submission. Please review the report carefully before submitting it to the NDPC."})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"ndpr-section-heading",children:"Submission Details"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Method:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:j.charAt(0).toUpperCase()+j.slice(1)})]}),D&&jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Contact Name:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:D})]}),T&&jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Contact Email:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:T})]}),F&&jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Contact Phone:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:F})]})]}),jsxs("div",{children:[jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Date Generated:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:g(Date.now())})]}),jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Breach ID:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:l.id})]}),M&&jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Reference Number:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:M})]})]})]})]}),S&&jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"ndpr-section-heading",children:"Report Preview"}),jsx("div",{className:a("ndpr-panel",d.reportPreview,c),children:jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:h})})]}),jsxs("div",{className:"ndpr-card__footer",children:[ae&&jsxs("button",{onClick:q,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${b$1}`,d.secondaryButton||d.downloadButton,c),children:["Download Report (",B.toUpperCase(),")"]}),jsx("button",{onClick:()=>x(false),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${b$1}`,children:"Edit Report"})]})]}):jsx("form",{onSubmit:z,children:jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Notification Method"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"method",className:"ndpr-form-field__label",children:["Method of Submission ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("select",{id:"method",value:j,onChange:u=>H(u.target.value),className:"ndpr-form-field__input",required:true,children:ee()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"referenceNumber",className:"ndpr-form-field__label",children:"Reference Number (if available)"}),jsx("input",{type:"text",id:"referenceNumber",value:M,onChange:u=>X(u.target.value),placeholder:"e.g. NDPC/BR/2024/001",className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"NDPC Contact (if known)"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxs("div",{children:[jsx("label",{htmlFor:"contactName",className:"ndpr-form-field__label",children:"Contact Name"}),jsx("input",{type:"text",id:"contactName",value:D,onChange:u=>E(u.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"contactEmail",className:"ndpr-form-field__label",children:"Contact Email"}),jsx("input",{type:"email",id:"contactEmail",value:T,onChange:u=>O(u.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"contactPhone",className:"ndpr-form-field__label",children:"Contact Phone"}),jsx("input",{type:"tel",id:"contactPhone",value:F,onChange:u=>U(u.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Additional Information"}),jsxs("div",{children:[jsx("label",{htmlFor:"additionalInfo",className:"ndpr-form-field__label",children:"Additional Information to Include"}),jsx("textarea",{id:"additionalInfo",value:ie,onChange:u=>Y(u.target.value),rows:3,placeholder:"Any additional information you want to include in the report",className:"ndpr-form-field__input"})]})]}),L&&jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Report Content"}),jsxs("div",{children:[jsxs("label",{htmlFor:"reportContent",className:"ndpr-form-field__label",children:["Edit Report Content ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"reportContent",value:h,onChange:u=>I(u.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono",required:true})]})]}),jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsx("p",{className:"ndpr-text-info text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. This report will help you comply with this requirement."}),jsx("p",{className:"ndpr-text-muted text-xs mt-2 italic",role:"note",children:a$2})]}),jsx("div",{className:"mt-6",children:jsx("button",{type:"submit",className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${b$1}`,d.primaryButton||d.generateButton,c),children:se})})]})})]})};export{we as a,Pe as b,Le as c};
@@ -1,93 +0,0 @@
1
- import {c,d,b as b$1}from'./chunk-NBQQ2GN3.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {d as d$1,b,a as a$1}from'./chunk-ZJYULEER.mjs';import {useId,useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var ye=({sections:E=c,variables:U=d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=useId(),[F,n]=useState(E),[o,s]=useState(U),[m,$]=useState("sections"),[S,X]=useState(""),[A,R]=useState(""),[J,Z]=useState(false),[h,I]=useState({});useEffect(()=>{n(E);},[E]),useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?b(a$1({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(f=>f.id===l?b(a$1({},f),{value:c}):f)),h[l]&&I(a=>{let f=a$1({},a);return delete f[l],f});},j=()=>{let l={},c=true;return o.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=F.filter(f=>f.included),c=Object.fromEntries(o.map(f=>[f.name,f.value])),a="";l.forEach(f=>{a+=`## ${f.title}
2
-
3
- `,a+=b$1(f.template,c),a+=`
4
-
5
- `;}),X(a),R(a),Z(true),$("preview");},y=()=>{L({sections:F,variables:o,content:N?A:S});},g=()=>jsxs("div",{"data-ndpr-component":"policy-generator",className:a("ndpr-form-section",r==null?void 0:r.sectionList,x),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsx("h3",{id:`${P}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),F.map(l=>{let c=`${P}-section-${l.id}`,a$1=l.description?`${P}-section-desc-${l.id}`:void 0;return jsx("div",{className:a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,x),children:jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":a$1,className:a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",r==null?void 0:r.input,x)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[l.title," ",l.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsx("p",{id:a$1,className:"ndpr-text-muted mt-1",children:l.description})]})]})},l.id)}),jsx("div",{className:"mt-6",children:jsx("button",{onClick:()=>$("variables"),className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return o.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxs("div",{className:a("",r==null?void 0:r.form,x),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsx("div",{className:"ndpr-form-section",children:Object.entries(l).map(([c,a$1])=>{let f=F.find(e=>e.id===c);return f&&!f.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:f?f.title:"General Information"}),jsx("div",{className:"ndpr-form-section",children:a$1.map(e=>{let u=`${P}-var-${e.id}`,b=e.description?`${P}-var-desc-${e.id}`:void 0,z=h[e.id]?`${P}-var-err-${e.id}`:void 0,O=[b,z].filter(Boolean).join(" ")||void 0;return jsxs("div",{children:[jsxs("label",{htmlFor:u,className:"ndpr-form-field__label",children:[e.name," ",e.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsx("p",{id:b,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsx("textarea",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),rows:4,className:a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxs("select",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),className:a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0,children:[jsx("option",{value:"",children:"Select an option"}),e.options.map(_=>jsx("option",{value:_,children:_},_))]}):jsx("input",{id:u,type:e.inputType,value:e.value,onChange:_=>W(e.id,_.target.value),className:a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}),h[e.id]&&jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:h[e.id]})]},e.id)})})]},c)})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Sections"}),jsx("button",{onClick:ee,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxs("div",{children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),N?jsxs("div",{className:"ndpr-form-field",children:[jsx("label",{htmlFor:l,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsx("textarea",{id:l,value:A,onChange:c=>R(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsx("div",{className:"prose dark:prose-invert max-w-none",children:S.split(`
6
- `).map((c,a)=>c.startsWith("## ")?jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},a):c.startsWith("### ")?jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},a):c===""?jsx("br",{},a):jsx("p",{className:"mb-2",children:c},a))})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Variables"}),jsx("button",{onClick:y,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${K}`,r==null?void 0:r.root,x),children:[jsxs("div",{className:a("mb-6",r==null?void 0:r.header,x),children:[jsx("h2",{className:a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsx("p",{className:a("ndpr-card__subtitle",r==null?void 0:r.description,x),children:V})]}),jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxs("ol",{className:"flex items-center w-full",children:[jsxs("li",{className:`flex w-full items-center ${m==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="sections"?"step":void 0,children:"1"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsx("span",{className:"sr-only",children:m==="sections"?" (current step)":""})]}),jsxs("li",{className:`flex w-full items-center ${m==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="variables"?"step":void 0,children:"2"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsx("span",{className:"sr-only",children:m==="variables"?" (current step)":""})]}),jsxs("li",{className:`flex items-center ${m==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="preview"?"step":void 0,children:"3"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsx("span",{className:"sr-only",children:m==="preview"?" (current step)":""})]})]})}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",r==null?void 0:r.complianceNotice,x),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),q()]})};var Ee=({content:E,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:F,lastUpdated:n,classNames:o,unstyled:s=false})=>{let m=useId(),[$,S]=useState("preview"),X=`${m}-tab-preview`,A=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,h=(()=>{let y=E.split(`
7
- `),g=[];return y.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=y=>{if(M)M(y);else if(y==="markdown"){let g=document.createElement("a"),w=new Blob([E],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||h.length===0?null:jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsx("ul",{className:"space-y-1",children:h.map((y,g)=>jsx("li",{style:{marginLeft:`${(y.level-2)*1.5}rem`},children:jsx("a",{href:`#${y.id}`,className:"ndpr-text-primary hover:underline",children:y.title})},g))})]}),W=()=>P?jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsx("h1",{className:"ndpr-card__title",children:F?`${F} Privacy Policy`:"Privacy Policy"}),jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",n?n.toLocaleDateString():"N/A"]})]}):null,j=()=>jsx("div",{className:a("prose dark:prose-invert max-w-none",o==null?void 0:o.sectionContent,s),children:E.split(`
8
- `).map((y,g)=>{if(y.startsWith("## ")){let w=y.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h3",{id:C,className:a("text-xl font-bold mt-6 mb-3",o==null?void 0:o.sectionTitle,s),children:w},g)}else if(y.startsWith("### ")){let w=y.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h4",{id:C,className:a("text-lg font-bold mt-4 mb-2",o==null?void 0:o.sectionTitle,s),children:w},g)}else return y===""?jsx("br",{},g):jsx("p",{className:"mb-2",children:y},g)})}),ee=()=>N?jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>I("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as PDF"}),jsx("button",{onClick:()=>I("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as DOCX"}),jsx("button",{onClick:()=>I("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as HTML"}),jsx("button",{onClick:()=>I("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as Markdown"})]})]}):null;return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o==null?void 0:o.root,s),children:[jsxs("div",{className:a("flex justify-between items-start mb-6",o==null?void 0:o.header,s),children:[jsxs("div",{children:[jsx("h2",{className:a("ndpr-section-heading",o==null?void 0:o.title,s),children:K}),jsx("p",{className:a("ndpr-card__subtitle",o==null?void 0:o.description,s),children:T})]}),r&&V&&jsx("button",{onClick:V,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${B}`,children:"Edit Policy"})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",o==null?void 0:o.complianceNotice,s),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:X,"aria-selected":$==="preview","aria-controls":R,onClick:()=>S("preview"),className:`inline-block p-4 ${$==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:A,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsx("div",{className:a("bg-white dark:bg-gray-800 p-4 rounded-md",o==null?void 0:o.content,s),children:$==="preview"?jsxs("div",{role:"tabpanel",id:R,"aria-labelledby":X,"aria-live":"polite",children:[W(),G(),jsx("div",{className:a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",o==null?void 0:o.section,s),children:j()})]}):jsx("div",{role:"tabpanel",id:J,"aria-labelledby":A,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:E})})}),ee()]})};var Fe=({content:E,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:F,classNames:n,unstyled:o=false})=>{let s=useId(),[m,$]=useState([]),[S,X]=useState("pdf"),[A,R]=useState(false),[J,Z]=useState(null),[h,I]=useState(""),[G,W]=useState(""),[j,ee]=useState(""),[y,g]=useState(false),w=e=>{let u=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${u}.${e.toLowerCase()}`},C=e=>h?h.endsWith(`.${e.toLowerCase()}`)?h:`${h}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,u=M?M.toLocaleDateString():"N/A",b=`<!DOCTYPE html>
9
- <html lang="en">
10
- <head>
11
- <meta charset="UTF-8">
12
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
13
- <title>${e}</title>
14
- <style>
15
- body {
16
- font-family: Arial, sans-serif;
17
- line-height: 1.6;
18
- color: #333;
19
- max-width: 800px;
20
- margin: 0 auto;
21
- padding: 20px;
22
- }
23
- h1 {
24
- font-size: 24px;
25
- margin-bottom: 10px;
26
- }
27
- h2 {
28
- font-size: 20px;
29
- margin-top: 30px;
30
- margin-bottom: 10px;
31
- border-bottom: 1px solid #eee;
32
- padding-bottom: 5px;
33
- }
34
- h3 {
35
- font-size: 18px;
36
- margin-top: 20px;
37
- margin-bottom: 10px;
38
- }
39
- p {
40
- margin-bottom: 15px;
41
- }
42
- .header {
43
- text-align: center;
44
- margin-bottom: 30px;
45
- }
46
- .footer {
47
- margin-top: 50px;
48
- text-align: center;
49
- font-size: 12px;
50
- color: #666;
51
- border-top: 1px solid #eee;
52
- padding-top: 20px;
53
- }
54
- .logo {
55
- max-width: 200px;
56
- margin-bottom: 20px;
57
- }
58
- .last-updated {
59
- font-size: 12px;
60
- color: #666;
61
- margin-bottom: 30px;
62
- }
63
- .compliance-notice {
64
- background-color: #f8f9fa;
65
- border: 1px solid #e9ecef;
66
- padding: 15px;
67
- margin-bottom: 30px;
68
- font-size: 14px;
69
- }
70
- ${F||""}
71
- </style>
72
- </head>
73
- <body>
74
- <div class="header">
75
- ${x&&P?`<img src="${P}" alt="${L||"Company"} Logo" class="logo">`:""}
76
- ${G?`<div class="custom-header">${G}</div>`:""}
77
- <h1>${e}</h1>
78
- <div class="last-updated">Last Updated: ${u}</div>
79
- </div>`;r&&(b+=`
80
- <div class="compliance-notice">
81
- <strong>NDPA Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Act (NDPA) 2023.
82
- It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPA requirements.
83
- </div>`);let z=E.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return b+=`
84
- <div class="content">
85
- <p>${z}</p>
86
- </div>
87
-
88
- <div class="footer">
89
- ${j?`<div class="custom-footer">${j}</div>`:""}
90
- <p>&copy; ${new Date().getFullYear()} ${L||"Company"}. All rights reserved.</p>
91
- </div>
92
- </body>
93
- </html>`,b},l=()=>d$1(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),u="",b;switch(e){case "pdf":let te=q();b=new Blob([te],{type:"text/html"}),u=URL.createObjectURL(b);break;case "docx":b=new Blob([E],{type:"text/plain"}),u=URL.createObjectURL(b);break;case "html":let pe=q();b=new Blob([pe],{type:"text/html"}),u=URL.createObjectURL(b);break;default:b=new Blob([E],{type:"text/markdown"}),u=URL.createObjectURL(b);break}let z=C(e),O=document.createElement("a");O.href=u,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let _={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:u,filename:z};$(te=>[_,...te]),V&&V(e,u);}catch(e){console.error("[ndpr-toolkit/policy] Export failed:",e);let u=e instanceof Error&&e.message?e.message.length>200?`${e.message.slice(0,200)}\u2026`:e.message:null;Z(u?`[ndpr-toolkit/policy] Export failed: ${u}`:"[ndpr-toolkit/policy] Export failed \u2014 see the browser console for the underlying error.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],u=`${s}-export-format`;return jsxs("div",{"data-ndpr-component":"policy-exporter",className:a("mb-6",n==null?void 0:n.formatSelector,o),children:[jsx("label",{htmlFor:u,className:"ndpr-form-field__label",children:"Export Format"}),jsx("select",{id:u,value:S,onChange:b=>X(b.target.value),className:a("ndpr-form-field__input",n==null?void 0:n.formatOption,o),children:e.map(b=>jsx("option",{value:b.value,children:b.label},b.value))})]})},a$1=()=>y?jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsx("input",{type:"text",id:`${s}-custom-filename`,value:h,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxs("div",{className:"ml-3 text-sm",children:[jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),f=()=>!N||m.length===0?null:jsxs("div",{className:a("mt-6",n==null?void 0:n.preview,o),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxs("tr",{children:[jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,o),children:[jsxs("div",{className:a("mb-6",n==null?void 0:n.header,o),children:[jsx("h2",{className:a("ndpr-section-heading",n==null?void 0:n.title,o),children:K}),jsx("p",{className:a("ndpr-card__subtitle",n==null?void 0:n.description,o),children:T})]}),c(),a$1(),jsxs("div",{className:"mb-6",children:[jsx("button",{onClick:l,disabled:A,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${B} ${A?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),o),children:A?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,o),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),f()]})};export{ye as a,Ee as b,Fe as c};
@@ -1,93 +0,0 @@
1
- 'use strict';var chunkD2ZKDQVL_js=require('./chunk-D2ZKDQVL.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ye=({sections:E=chunkD2ZKDQVL_js.c,variables:U=chunkD2ZKDQVL_js.d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=react.useId(),[F,n]=react.useState(E),[o,s]=react.useState(U),[m,$]=react.useState("sections"),[S,X]=react.useState(""),[A,R]=react.useState(""),[J,Z]=react.useState(false),[h,I]=react.useState({});react.useEffect(()=>{n(E);},[E]),react.useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(f=>f.id===l?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},f),{value:c}):f)),h[l]&&I(a=>{let f=chunkRFPLZDIO_js.a({},a);return delete f[l],f});},j=()=>{let l={},c=true;return o.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=F.filter(f=>f.included),c=Object.fromEntries(o.map(f=>[f.name,f.value])),a="";l.forEach(f=>{a+=`## ${f.title}
2
-
3
- `,a+=chunkD2ZKDQVL_js.b(f.template,c),a+=`
4
-
5
- `;}),X(a),R(a),Z(true),$("preview");},y=()=>{L({sections:F,variables:o,content:N?A:S});},g=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-generator",className:chunkAME4HJR4_js.a("ndpr-form-section",r==null?void 0:r.sectionList,x),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsxRuntime.jsx("h3",{id:`${P}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),F.map(l=>{let c=`${P}-section-${l.id}`,a=l.description?`${P}-section-desc-${l.id}`:void 0;return jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,x),children:jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":a,className:chunkAME4HJR4_js.a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",r==null?void 0:r.input,x)})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[l.title," ",l.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsxRuntime.jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsxRuntime.jsx("p",{id:a,className:"ndpr-text-muted mt-1",children:l.description})]})]})},l.id)}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return o.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",r==null?void 0:r.form,x),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:Object.entries(l).map(([c,a])=>{let f=F.find(e=>e.id===c);return f&&!f.included?null:jsxRuntime.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsx("h4",{className:"font-medium text-lg mb-3",children:f?f.title:"General Information"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:a.map(e=>{let u=`${P}-var-${e.id}`,b=e.description?`${P}-var-desc-${e.id}`:void 0,z=h[e.id]?`${P}-var-err-${e.id}`:void 0,O=[b,z].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:u,className:"ndpr-form-field__label",children:[e.name," ",e.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsxRuntime.jsx("p",{id:b,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsxRuntime.jsx("textarea",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),rows:4,className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxRuntime.jsxs("select",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(_=>jsxRuntime.jsx("option",{value:_,children:_},_))]}):jsxRuntime.jsx("input",{id:u,type:e.inputType,value:e.value,onChange:_=>W(e.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}),h[e.id]&&jsxRuntime.jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:h[e.id]})]},e.id)})})]},c)})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Sections"}),jsxRuntime.jsx("button",{onClick:ee,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),N?jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:l,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsxRuntime.jsx("textarea",{id:l,value:A,onChange:c=>R(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsxRuntime.jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsxRuntime.jsx("div",{className:"prose dark:prose-invert max-w-none",children:S.split(`
6
- `).map((c,a)=>c.startsWith("## ")?jsxRuntime.jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},a):c.startsWith("### ")?jsxRuntime.jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},a):c===""?jsxRuntime.jsx("br",{},a):jsxRuntime.jsx("p",{className:"mb-2",children:c},a))})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Variables"}),jsxRuntime.jsx("button",{onClick:y,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${K}`,r==null?void 0:r.root,x),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",r==null?void 0:r.header,x),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",r==null?void 0:r.description,x),children:V})]}),jsxRuntime.jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxRuntime.jsxs("ol",{className:"flex items-center w-full",children:[jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="sections"?"step":void 0,children:"1"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="sections"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="variables"?"step":void 0,children:"2"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="variables"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex items-center ${m==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="preview"?"step":void 0,children:"3"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="preview"?" (current step)":""})]})]})}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",r==null?void 0:r.complianceNotice,x),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),q()]})};var Ee=({content:E,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:F,lastUpdated:n,classNames:o,unstyled:s=false})=>{let m=react.useId(),[$,S]=react.useState("preview"),X=`${m}-tab-preview`,A=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,h=(()=>{let y=E.split(`
7
- `),g=[];return y.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=y=>{if(M)M(y);else if(y==="markdown"){let g=document.createElement("a"),w=new Blob([E],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||h.length===0?null:jsxRuntime.jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsxRuntime.jsx("ul",{className:"space-y-1",children:h.map((y,g)=>jsxRuntime.jsx("li",{style:{marginLeft:`${(y.level-2)*1.5}rem`},children:jsxRuntime.jsx("a",{href:`#${y.id}`,className:"ndpr-text-primary hover:underline",children:y.title})},g))})]}),W=()=>P?jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsxRuntime.jsx("h1",{className:"ndpr-card__title",children:F?`${F} Privacy Policy`:"Privacy Policy"}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",n?n.toLocaleDateString():"N/A"]})]}):null,j=()=>jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("prose dark:prose-invert max-w-none",o==null?void 0:o.sectionContent,s),children:E.split(`
8
- `).map((y,g)=>{if(y.startsWith("## ")){let w=y.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h3",{id:C,className:chunkAME4HJR4_js.a("text-xl font-bold mt-6 mb-3",o==null?void 0:o.sectionTitle,s),children:w},g)}else if(y.startsWith("### ")){let w=y.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h4",{id:C,className:chunkAME4HJR4_js.a("text-lg font-bold mt-4 mb-2",o==null?void 0:o.sectionTitle,s),children:w},g)}else return y===""?jsxRuntime.jsx("br",{},g):jsxRuntime.jsx("p",{className:"mb-2",children:y},g)})}),ee=()=>N?jsxRuntime.jsxs("div",{className:"mt-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[jsxRuntime.jsx("button",{onClick:()=>I("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as PDF"}),jsxRuntime.jsx("button",{onClick:()=>I("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as DOCX"}),jsxRuntime.jsx("button",{onClick:()=>I("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as HTML"}),jsxRuntime.jsx("button",{onClick:()=>I("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as Markdown"})]})]}):null;return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o==null?void 0:o.root,s),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-start mb-6",o==null?void 0:o.header,s),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",o==null?void 0:o.title,s),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",o==null?void 0:o.description,s),children:T})]}),r&&V&&jsxRuntime.jsx("button",{onClick:V,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${B}`,children:"Edit Policy"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",o==null?void 0:o.complianceNotice,s),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsxRuntime.jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxRuntime.jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:X,"aria-selected":$==="preview","aria-controls":R,onClick:()=>S("preview"),className:`inline-block p-4 ${$==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:A,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-white dark:bg-gray-800 p-4 rounded-md",o==null?void 0:o.content,s),children:$==="preview"?jsxRuntime.jsxs("div",{role:"tabpanel",id:R,"aria-labelledby":X,"aria-live":"polite",children:[W(),G(),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",o==null?void 0:o.section,s),children:j()})]}):jsxRuntime.jsx("div",{role:"tabpanel",id:J,"aria-labelledby":A,children:jsxRuntime.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:E})})}),ee()]})};var Fe=({content:E,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:F,classNames:n,unstyled:o=false})=>{let s=react.useId(),[m,$]=react.useState([]),[S,X]=react.useState("pdf"),[A,R]=react.useState(false),[J,Z]=react.useState(null),[h,I]=react.useState(""),[G,W]=react.useState(""),[j,ee]=react.useState(""),[y,g]=react.useState(false),w=e=>{let u=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${u}.${e.toLowerCase()}`},C=e=>h?h.endsWith(`.${e.toLowerCase()}`)?h:`${h}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,u=M?M.toLocaleDateString():"N/A",b=`<!DOCTYPE html>
9
- <html lang="en">
10
- <head>
11
- <meta charset="UTF-8">
12
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
13
- <title>${e}</title>
14
- <style>
15
- body {
16
- font-family: Arial, sans-serif;
17
- line-height: 1.6;
18
- color: #333;
19
- max-width: 800px;
20
- margin: 0 auto;
21
- padding: 20px;
22
- }
23
- h1 {
24
- font-size: 24px;
25
- margin-bottom: 10px;
26
- }
27
- h2 {
28
- font-size: 20px;
29
- margin-top: 30px;
30
- margin-bottom: 10px;
31
- border-bottom: 1px solid #eee;
32
- padding-bottom: 5px;
33
- }
34
- h3 {
35
- font-size: 18px;
36
- margin-top: 20px;
37
- margin-bottom: 10px;
38
- }
39
- p {
40
- margin-bottom: 15px;
41
- }
42
- .header {
43
- text-align: center;
44
- margin-bottom: 30px;
45
- }
46
- .footer {
47
- margin-top: 50px;
48
- text-align: center;
49
- font-size: 12px;
50
- color: #666;
51
- border-top: 1px solid #eee;
52
- padding-top: 20px;
53
- }
54
- .logo {
55
- max-width: 200px;
56
- margin-bottom: 20px;
57
- }
58
- .last-updated {
59
- font-size: 12px;
60
- color: #666;
61
- margin-bottom: 30px;
62
- }
63
- .compliance-notice {
64
- background-color: #f8f9fa;
65
- border: 1px solid #e9ecef;
66
- padding: 15px;
67
- margin-bottom: 30px;
68
- font-size: 14px;
69
- }
70
- ${F||""}
71
- </style>
72
- </head>
73
- <body>
74
- <div class="header">
75
- ${x&&P?`<img src="${P}" alt="${L||"Company"} Logo" class="logo">`:""}
76
- ${G?`<div class="custom-header">${G}</div>`:""}
77
- <h1>${e}</h1>
78
- <div class="last-updated">Last Updated: ${u}</div>
79
- </div>`;r&&(b+=`
80
- <div class="compliance-notice">
81
- <strong>NDPA Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Act (NDPA) 2023.
82
- It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPA requirements.
83
- </div>`);let z=E.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return b+=`
84
- <div class="content">
85
- <p>${z}</p>
86
- </div>
87
-
88
- <div class="footer">
89
- ${j?`<div class="custom-footer">${j}</div>`:""}
90
- <p>&copy; ${new Date().getFullYear()} ${L||"Company"}. All rights reserved.</p>
91
- </div>
92
- </body>
93
- </html>`,b},l=()=>chunkRFPLZDIO_js.d(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),u="",b;switch(e){case "pdf":let te=q();b=new Blob([te],{type:"text/html"}),u=URL.createObjectURL(b);break;case "docx":b=new Blob([E],{type:"text/plain"}),u=URL.createObjectURL(b);break;case "html":let pe=q();b=new Blob([pe],{type:"text/html"}),u=URL.createObjectURL(b);break;default:b=new Blob([E],{type:"text/markdown"}),u=URL.createObjectURL(b);break}let z=C(e),O=document.createElement("a");O.href=u,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let _={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:u,filename:z};$(te=>[_,...te]),V&&V(e,u);}catch(e){console.error("[ndpr-toolkit/policy] Export failed:",e);let u=e instanceof Error&&e.message?e.message.length>200?`${e.message.slice(0,200)}\u2026`:e.message:null;Z(u?`[ndpr-toolkit/policy] Export failed: ${u}`:"[ndpr-toolkit/policy] Export failed \u2014 see the browser console for the underlying error.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],u=`${s}-export-format`;return jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-exporter",className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.formatSelector,o),children:[jsxRuntime.jsx("label",{htmlFor:u,className:"ndpr-form-field__label",children:"Export Format"}),jsxRuntime.jsx("select",{id:u,value:S,onChange:b=>X(b.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",n==null?void 0:n.formatOption,o),children:e.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})]})},a=()=>y?jsxRuntime.jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsxRuntime.jsx("input",{type:"text",id:`${s}-custom-filename`,value:h,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsxRuntime.jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsxRuntime.jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),f=()=>!N||m.length===0?null:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mt-6",n==null?void 0:n.preview,o),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsxRuntime.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsxRuntime.jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsxRuntime.jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,o),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.header,o),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",n==null?void 0:n.title,o),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",n==null?void 0:n.description,o),children:T})]}),c(),a(),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("button",{onClick:l,disabled:A,className:chunkAME4HJR4_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${B} ${A?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),o),children:A?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsxRuntime.jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,o),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxRuntime.jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsxRuntime.jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsxRuntime.jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsxRuntime.jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsxRuntime.jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),f()]})};exports.a=ye;exports.b=Ee;exports.c=Fe;
@@ -1 +0,0 @@
1
- import {a}from'./chunk-SFGW37LE.mjs';import {jsxs,jsx}from'react/jsx-runtime';var R=({sections:v,answers:y,onAnswerChange:u,currentSectionIndex:o,onNextSection:$,onPrevSection:B,validationErrors:P={},readOnly:s=false,className:A="",buttonClassName:_="",nextButtonText:C="Next",prevButtonText:w="Previous",submitButtonText:I="Submit",showProgress:D=true,progress:c,classNames:f={},unstyled:Q=false})=>{let m=v[o],S=o===v.length-1,t=(e,a$1)=>{let d=a$1?f[a$1]:void 0;return !d&&a$1==="nextButton"&&(d=f.primaryButton),!d&&a$1==="prevButton"&&(d=f.secondaryButton),a(e,d,Q)},L=e=>e.showWhen?e.showWhen.every(a=>{let d=y[a.questionId];switch(a.operator){case "equals":return d===a.value;case "contains":return Array.isArray(d)?d.includes(String(a.value)):false;case "greaterThan":return typeof d=="number"&&typeof a.value=="number"?d>a.value:false;case "lessThan":return typeof d=="number"&&typeof a.value=="number"?d<a.value:false;default:return true}}):true,b=e=>t("ndpr-form-field__input","input"),T=e=>{if(!L(e))return null;let a=P[e.id],d=y[e.id],l=typeof d=="boolean"?String(d):d,h=e.guidance?`${e.id}-guidance`:void 0,N=a?`${e.id}-error`:void 0,p=[h,N].filter(Boolean).join(" ")||void 0;return jsxs("div",{className:t("ndpr-form-field","question"),children:[jsxs("label",{htmlFor:e.id,className:t("ndpr-form-field__label","questionText"),children:[e.text,e.required&&jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),e.guidance&&jsx("p",{id:h,className:t("ndpr-form-field__hint","guidance"),children:e.guidance}),e.type==="text"&&jsx("input",{type:"text",id:e.id,value:l||"",onChange:r=>u(e.id,r.target.value),disabled:s,className:b(),"aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":a?true:void 0}),e.type==="textarea"&&jsx("textarea",{id:e.id,value:l||"",onChange:r=>u(e.id,r.target.value),disabled:s,rows:4,className:b(),"aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":a?true:void 0}),e.type==="select"&&e.options&&jsxs("select",{id:e.id,value:l||"",onChange:r=>u(e.id,r.target.value),disabled:s,className:b(),"aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":a?true:void 0,children:[jsx("option",{value:"",children:"Select an option"}),e.options.map(r=>jsx("option",{value:r.value,children:r.label},r.value))]}),e.type==="radio"&&e.options&&jsx("div",{className:t("ndpr-form-field__option-group","radioGroup"),role:"radiogroup","aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":a?true:void 0,children:e.options.map(r=>jsxs("div",{className:t("ndpr-form-field__checkbox-row","radioOption"),children:[jsx("input",{type:"radio",id:`${e.id}_${r.value}`,name:e.id,value:r.value,checked:l===r.value,onChange:()=>u(e.id,r.value),disabled:s,className:"ndpr-form-field__radio"}),jsxs("label",{htmlFor:`${e.id}_${r.value}`,className:"ndpr-form-field__label",children:[r.label,r.riskLevel&&jsxs("span",{className:r.riskLevel==="low"?"ndpr-badge ndpr-badge--success":r.riskLevel==="medium"?"ndpr-badge ndpr-badge--warning":"ndpr-badge ndpr-badge--destructive",children:[r.riskLevel.charAt(0).toUpperCase()+r.riskLevel.slice(1)," Risk"]})]})]},r.value))}),e.type==="checkbox"&&e.options&&jsx("div",{className:"ndpr-form-field__option-group",role:"group","aria-label":e.text,"aria-describedby":p,"aria-invalid":a?true:void 0,children:e.options.map(r=>jsxs("div",{className:"ndpr-form-field__checkbox-row",children:[jsx("input",{type:"checkbox",id:`${e.id}_${r.value}`,value:r.value,checked:Array.isArray(l)?l.includes(r.value):false,onChange:g=>{let x=Array.isArray(l)?[...l]:[];g.target.checked?u(e.id,[...x,r.value]):u(e.id,x.filter(V=>V!==r.value));},disabled:s,className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:`${e.id}_${r.value}`,className:"ndpr-form-field__label",children:r.label})]},r.value))}),e.type==="scale"&&jsxs("div",{className:"ndpr-form-field",children:[jsx("div",{className:"ndpr-form-field__hint",style:{display:"flex",justifyContent:"space-between"},children:e.scaleLabels&&Object.entries(e.scaleLabels).map(([r,g])=>jsx("span",{style:{width:`${100/Object.keys(e.scaleLabels||{}).length}%`,textAlign:"center"},children:g},r))}),jsx("input",{type:"range",id:e.id,min:e.minValue||1,max:e.maxValue||5,value:typeof l=="number"?l:e.minValue||1,onChange:r=>u(e.id,parseInt(r.target.value,10)),disabled:s,className:"ndpr-form-field__range","aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":a?true:void 0}),jsxs("div",{className:"ndpr-form-field__hint",style:{textAlign:"center"},children:["Selected value: ",l||e.minValue||1]})]}),a&&jsx("p",{id:N,className:"ndpr-form-field__error",role:"alert",children:a})]},e.id)};return m?jsxs("div",{"data-ndpr-component":"dpia-questionnaire",className:`${t("ndpr-card","root")} ${A}`,children:[D&&jsxs("div",{className:t("ndpr-card__header","header"),style:{flexDirection:"column",alignItems:"stretch",gap:"var(--ndpr-space-2)"},children:[jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"var(--ndpr-font-size-sm)",color:"rgb(var(--ndpr-muted-foreground))"},children:[jsxs("span",{children:["Section ",o+1," of ",v.length]}),jsx("span",{children:c!==void 0?`${c}% Complete`:""})]}),jsx("div",{className:t("ndpr-progress","progressBar"),role:"progressbar","aria-valuenow":c!==void 0?c:Math.round((o+1)/v.length*100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Questionnaire progress",children:jsx("div",{className:"ndpr-progress__bar",style:{width:`${c!==void 0?c:(o+1)/v.length*100}%`}})})]}),jsx("h2",{className:t("ndpr-card__title","title"),children:m.title}),m.description&&jsx("p",{className:t("ndpr-card__subtitle","sectionTitle"),children:m.description}),jsx("div",{className:t("ndpr-card__body","section"),children:m.questions.map(e=>T(e))}),jsxs("div",{className:t("ndpr-card__footer","navigation"),style:{justifyContent:"space-between"},children:[jsx("button",{type:"button",onClick:B,disabled:o===0||s,className:`${t("ndpr-button ndpr-button--secondary","prevButton")} ${_}`,children:w}),jsx("button",{type:"button",onClick:$,disabled:s,className:`${t("ndpr-button ndpr-button--primary","nextButton")} ${_}`,children:S?I:C})]})]}):jsx("div",{children:"No section found."})};export{R as a};