@tantainnovative/ndpr-toolkit 3.5.0 → 3.5.5

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 (177) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/README.md +12 -7
  3. package/dist/adapters.js +1 -2
  4. package/dist/adapters.mjs +1 -2
  5. package/dist/breach.d.mts +80 -1
  6. package/dist/breach.d.ts +80 -1
  7. package/dist/breach.js +1 -2
  8. package/dist/breach.mjs +1 -2
  9. package/dist/{chunk-PATONNTZ.mjs → chunk-3HOXQNCH.mjs} +1 -2
  10. package/dist/{chunk-MJGOLP5M.js → chunk-3IA3KDII.js} +1 -2
  11. package/dist/{chunk-M2TPT5GB.js → chunk-3JPDTXGC.js} +1 -2
  12. package/dist/{chunk-BKRETVJ6.js → chunk-3YTAOT5O.js} +1 -2
  13. package/dist/{chunk-GOU6FU6Y.js → chunk-4CVBQC66.js} +1 -2
  14. package/dist/{chunk-E4NCJ7RD.mjs → chunk-4G3SRVRI.mjs} +1 -2
  15. package/dist/{chunk-6QPRDQZF.js → chunk-4QXTB3L6.js} +1 -2
  16. package/dist/{chunk-XNSZ7KUH.js → chunk-5GVMKUMP.js} +1 -2
  17. package/dist/chunk-66NQ5CVY.mjs +1 -0
  18. package/dist/{chunk-JBSCER34.js → chunk-6NXXQYQL.js} +1 -2
  19. package/dist/chunk-732C2EVN.js +1 -0
  20. package/dist/chunk-7BJXI2HI.mjs +1 -0
  21. package/dist/{chunk-C5QO3SX4.js → chunk-7IFSWCQP.js} +1 -2
  22. package/dist/{chunk-A4PK7JB2.js → chunk-7ZZO7GVB.js} +1 -2
  23. package/dist/chunk-AME4HJR4.js +1 -0
  24. package/dist/chunk-AOHKVFAS.mjs +322 -0
  25. package/dist/{chunk-HO5M7M4M.js → chunk-B46SJB5V.js} +1 -2
  26. package/dist/chunk-BFAX7JQA.mjs +1 -0
  27. package/dist/{chunk-ID2NYIVE.mjs → chunk-BNHQFZHL.mjs} +2 -3
  28. package/dist/{chunk-RLYTX3MM.js → chunk-BRS52EDT.js} +1 -2
  29. package/dist/{chunk-OPYQIJKY.js → chunk-C7IDR2IV.js} +1 -2
  30. package/dist/{chunk-CISJAQ6W.mjs → chunk-COD3RMTL.mjs} +1 -2
  31. package/dist/chunk-CR2QZTGW.js +1 -0
  32. package/dist/{chunk-6WIP33TW.mjs → chunk-DBZSN4WP.mjs} +1 -2
  33. package/dist/{chunk-74Z23WUA.mjs → chunk-EEQALYOY.mjs} +1 -2
  34. package/dist/chunk-EFIBHKQE.mjs +1 -0
  35. package/dist/{chunk-GKKAK6ES.mjs → chunk-EWVK45Z3.mjs} +1 -2
  36. package/dist/{chunk-QSVVAZVT.mjs → chunk-EXEXUAF6.mjs} +1 -2
  37. package/dist/chunk-EZCGTHQV.js +6 -0
  38. package/dist/{chunk-SYMQJO2W.mjs → chunk-GTYXVAJX.mjs} +2 -3
  39. package/dist/{chunk-6FGCGLH5.mjs → chunk-H3XJV2IR.mjs} +1 -2
  40. package/dist/chunk-HBLGN4SD.js +1 -0
  41. package/dist/{chunk-MCWV7S2G.js → chunk-HHK5LHEG.js} +1 -2
  42. package/dist/{chunk-XHROISIF.mjs → chunk-HWHBINVN.mjs} +1 -2
  43. package/dist/{chunk-3EGQWLJ6.js → chunk-I2LMQWK3.js} +2 -3
  44. package/dist/{chunk-NQNFS3QI.js → chunk-I3Y4LOSL.js} +4 -5
  45. package/dist/chunk-ITCY2Z66.mjs +4 -0
  46. package/dist/{chunk-Z6IIMLZU.mjs → chunk-KDAZQO3N.mjs} +1 -2
  47. package/dist/{chunk-J5WCPZLW.js → chunk-L2BRFMVS.js} +1 -2
  48. package/dist/chunk-L2VO3MEJ.js +1 -0
  49. package/dist/{chunk-R5FW5XUQ.mjs → chunk-LQTARVPU.mjs} +1 -2
  50. package/dist/{chunk-6TA2MVTU.mjs → chunk-LRRENTT5.mjs} +1 -2
  51. package/dist/{chunk-LIM64IV2.js → chunk-LVGT3DLT.js} +2 -3
  52. package/dist/{chunk-TXBZPCGF.mjs → chunk-LWIKDDSU.mjs} +1 -2
  53. package/dist/chunk-MPBPAEZC.mjs +1 -0
  54. package/dist/{chunk-Z73T6MWY.js → chunk-N3MQQUQP.js} +39 -35
  55. package/dist/{chunk-RY3PGVLZ.mjs → chunk-NBZUZYTB.mjs} +1 -2
  56. package/dist/{chunk-HGGLW5TE.js → chunk-NUWVPRNI.js} +1 -2
  57. package/dist/chunk-O45PKBZA.mjs +6 -0
  58. package/dist/chunk-O6CUBNXK.mjs +3 -0
  59. package/dist/{chunk-7SMLHZ4B.js → chunk-P4LNLCSF.js} +1 -2
  60. package/dist/{chunk-VWPGIES4.mjs → chunk-PCU6GKBE.mjs} +1 -2
  61. package/dist/chunk-PGI2LM6P.js +103 -0
  62. package/dist/{chunk-U62QYKVG.mjs → chunk-PJNKQPQP.mjs} +1 -2
  63. package/dist/{chunk-LSNL4XR5.js → chunk-PZRQWPWD.js} +1 -2
  64. package/dist/chunk-Q64735OC.js +144 -0
  65. package/dist/chunk-QPRYXVH2.js +1 -0
  66. package/dist/{chunk-MQFZHA2D.js → chunk-RFPLZDIO.js} +1 -2
  67. package/dist/chunk-RMQ7OLNY.mjs +144 -0
  68. package/dist/{chunk-2AW7KAZO.mjs → chunk-RPXRPGHL.mjs} +1 -2
  69. package/dist/chunk-RYREGZVQ.js +1 -0
  70. package/dist/{chunk-B4Z5MBUC.mjs → chunk-RZ6GC6WN.mjs} +1 -2
  71. package/dist/chunk-S6COXIZA.js +2 -0
  72. package/dist/chunk-SFGW37LE.mjs +1 -0
  73. package/dist/{chunk-3NQQSU4P.js → chunk-SJDDNB6M.js} +1 -2
  74. package/dist/{chunk-H3EYBSVP.mjs → chunk-TMXK4QKK.mjs} +2 -3
  75. package/dist/{chunk-P42Z5CFE.js → chunk-TQZWJGJ2.js} +1 -2
  76. package/dist/{chunk-EPT2K355.mjs → chunk-U5RWJRGA.mjs} +1 -2
  77. package/dist/{chunk-R3OYAJI6.mjs → chunk-UASG46LP.mjs} +1 -2
  78. package/dist/{chunk-RXL6CZAI.js → chunk-UAV7V4EM.js} +1 -2
  79. package/dist/chunk-UI536RU2.js +3 -0
  80. package/dist/{chunk-7AVN424U.js → chunk-UTFBKL73.js} +1 -2
  81. package/dist/{chunk-I54CDQGN.js → chunk-UXUMYP4L.js} +1 -2
  82. package/dist/{chunk-P3PULLYP.mjs → chunk-V7UFP6QU.mjs} +1 -2
  83. package/dist/{chunk-I4M2AA3N.js → chunk-VJTQXVAF.js} +1 -2
  84. package/dist/{chunk-ELKB2AFZ.js → chunk-VWED6UTN.js} +1 -2
  85. package/dist/{chunk-LU7PKE7Y.mjs → chunk-VYAL2TGT.mjs} +1 -2
  86. package/dist/chunk-W47OSMT6.js +2 -0
  87. package/dist/chunk-W65ZWTLD.mjs +1 -0
  88. package/dist/{chunk-5HL4UBFV.js → chunk-WDDCKYWA.js} +1 -2
  89. package/dist/{chunk-DJGS7SSN.mjs → chunk-WTGKZX7J.mjs} +1 -2
  90. package/dist/{chunk-TDDAYVKK.js → chunk-WZYCBW2R.js} +1 -2
  91. package/dist/chunk-X3GCGC3H.mjs +103 -0
  92. package/dist/chunk-XJO4DH3L.mjs +2 -0
  93. package/dist/{chunk-LWXZMKC2.js → chunk-XO3VQYTL.js} +7 -8
  94. package/dist/{chunk-IZCWCE7W.mjs → chunk-XOH4WXOZ.mjs} +1 -2
  95. package/dist/{chunk-SHMJNRHO.mjs → chunk-XP5PL6K7.mjs} +1 -2
  96. package/dist/{chunk-CKGJK4D7.mjs → chunk-Y3MKMAFQ.mjs} +2 -3
  97. package/dist/chunk-YFBDJ4FH.js +1 -0
  98. package/dist/chunk-YTU4FNM2.mjs +1 -0
  99. package/dist/{chunk-TV4U6AIS.js → chunk-Z763UI5U.js} +1 -2
  100. package/dist/chunk-ZHFLBL63.mjs +2 -0
  101. package/dist/{chunk-RRVKUCFR.mjs → chunk-ZIZL37BG.mjs} +1 -2
  102. package/dist/{chunk-WWT2ZSNU.mjs → chunk-ZJYULEER.mjs} +1 -2
  103. package/dist/{chunk-LJNNPAFU.mjs → chunk-ZQZJNKVB.mjs} +1 -2
  104. package/dist/chunk-ZVOIR4QH.js +4 -0
  105. package/dist/consent.js +1 -2
  106. package/dist/consent.mjs +1 -2
  107. package/dist/core.d.mts +98 -19
  108. package/dist/core.d.ts +98 -19
  109. package/dist/core.js +1 -2
  110. package/dist/core.mjs +1 -2
  111. package/dist/cross-border.d.mts +36 -14
  112. package/dist/cross-border.d.ts +36 -14
  113. package/dist/cross-border.js +1 -2
  114. package/dist/cross-border.mjs +1 -2
  115. package/dist/dpia.d.mts +4 -4
  116. package/dist/dpia.d.ts +4 -4
  117. package/dist/dpia.js +1 -2
  118. package/dist/dpia.mjs +1 -2
  119. package/dist/dsr.d.mts +30 -17
  120. package/dist/dsr.d.ts +30 -17
  121. package/dist/dsr.js +1 -2
  122. package/dist/dsr.mjs +1 -2
  123. package/dist/hooks.d.mts +113 -20
  124. package/dist/hooks.d.ts +113 -20
  125. package/dist/hooks.js +1 -2
  126. package/dist/hooks.mjs +1 -2
  127. package/dist/index.d.mts +422 -26
  128. package/dist/index.d.ts +422 -26
  129. package/dist/index.js +1 -2
  130. package/dist/index.mjs +1 -2
  131. package/dist/lawful-basis.js +1 -2
  132. package/dist/lawful-basis.mjs +1 -2
  133. package/dist/policy.js +1 -2
  134. package/dist/policy.mjs +1 -2
  135. package/dist/presets.d.mts +54 -5
  136. package/dist/presets.d.ts +54 -5
  137. package/dist/presets.js +1 -2
  138. package/dist/presets.mjs +1 -2
  139. package/dist/ropa.js +1 -2
  140. package/dist/ropa.mjs +1 -2
  141. package/dist/server.d.mts +89 -19
  142. package/dist/server.d.ts +89 -19
  143. package/dist/server.js +1 -2
  144. package/dist/server.mjs +1 -2
  145. package/dist/styles.css +34 -0
  146. package/dist/unstyled.d.mts +3 -1
  147. package/dist/unstyled.d.ts +3 -1
  148. package/dist/unstyled.js +1 -2
  149. package/dist/unstyled.mjs +1 -2
  150. package/package.json +59 -20
  151. package/dist/chunk-3VQAYQR7.js +0 -7
  152. package/dist/chunk-6HZL2WDU.mjs +0 -2
  153. package/dist/chunk-75TJPK2N.mjs +0 -2
  154. package/dist/chunk-ABDB7LEV.mjs +0 -2
  155. package/dist/chunk-AYKLAEOU.mjs +0 -2
  156. package/dist/chunk-C4YM4UMI.js +0 -2
  157. package/dist/chunk-CKJAECGV.js +0 -2
  158. package/dist/chunk-CPK5D5FY.js +0 -132
  159. package/dist/chunk-CWHBCQGT.mjs +0 -2
  160. package/dist/chunk-E64TU6IU.js +0 -2
  161. package/dist/chunk-F5TXUA4O.mjs +0 -4
  162. package/dist/chunk-GN5C32JB.mjs +0 -2
  163. package/dist/chunk-GRLIPT5V.mjs +0 -132
  164. package/dist/chunk-I557S566.mjs +0 -15
  165. package/dist/chunk-JFFOPHU3.mjs +0 -318
  166. package/dist/chunk-KF3EFJEF.mjs +0 -3
  167. package/dist/chunk-ORFC66EA.js +0 -4
  168. package/dist/chunk-S4GRSNB4.js +0 -2
  169. package/dist/chunk-SCWNM4PC.mjs +0 -2
  170. package/dist/chunk-SKKOMFXH.js +0 -81
  171. package/dist/chunk-TCN22KYP.mjs +0 -7
  172. package/dist/chunk-TUNQUVHU.mjs +0 -81
  173. package/dist/chunk-VIQUXWJC.js +0 -2
  174. package/dist/chunk-WTJGLNTB.js +0 -3
  175. package/dist/chunk-XIM7KMD6.js +0 -2
  176. package/dist/chunk-YPKUHSK4.js +0 -15
  177. package/dist/chunk-ZPKVLTSX.js +0 -2
@@ -1,2 +1 @@
1
- import {b as b$1,e}from'./chunk-CKGJK4D7.mjs';import {a as a$1}from'./chunk-6WIP33TW.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect,useCallback}from'react';function W(e,s){return s?a$1(e):{load:()=>null,save:()=>{},remove:()=>{}}}function A({templates:e,initialPolicy:s,adapter:y,storageKey:l="ndpr_privacy_policy",persist:f,useLocalStorage:D,onGenerate:T}){var V;let O=(V=f!=null?f:D)!=null?V:true,w=y!=null?y:W(l,O),c=useRef(w);c.current=w;let[n,p]=useState(s||null),[o,g]=useState(null),[u,S]=useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[C,E]=useState(true),R=useRef(e);R.current=e,useEffect(()=>{if(s){E(false);return}let t=false;try{let r=c.current.load(),i=a=>{if(a){if(p(a),a.templateId){let P=R.current.find(b=>b.id===a.templateId);P&&g(P);}a.organizationInfo&&S(a.organizationInfo);}E(!1);};r instanceof Promise?r.then(a=>{t||i(a);},()=>{t||E(!1);}):i(r);}catch(r){t||E(false);}return ()=>{t=true;}},[s]);let k=t=>{Promise.resolve(c.current.save(t)).catch(r=>{console.warn("[ndpr-toolkit] Failed to save policy:",r);});},j=useCallback(t=>{let r=e.find(b=>b.id===t);if(!r)return false;g(r);let i=r.sections.map(b$1=>b(a({},b$1),{customContent:void 0})),a$1={};Object.keys(r.variables).forEach(b=>{a$1[b]=r.variables[b].defaultValue||"";});let P=Date.now();return p({id:"policy_"+P+"_"+Math.random().toString(36).substr(2,9),title:"",templateId:r.id,organizationInfo:u,sections:i,variableValues:a$1,effectiveDate:P,lastUpdated:P,version:"1.0"}),true},[e,u]),I=useCallback(t=>{S(r=>a(a({},r),t));},[]),F=useCallback((t,r)=>{o&&(n?p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:r}):a$1)})):g(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:r}):a$1)})));},[o,n]),M=useCallback((t,r)=>{o&&(n?p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:r}):a$1)})):g(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:r}):a$1)})));},[o,n]),$=useCallback((t,r)=>{n&&p(i=>i&&b(a({},i),{variableValues:b(a({},i.variableValues),{[t]:r})}));},[n]),B=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),G=useCallback(()=>{if(!o)return null;let t=Date.now(),r={id:(n==null?void 0:n.id)||B(),title:`Privacy Policy for ${u.name}`,templateId:o.id,organizationInfo:u,sections:o.sections.map(i=>{var a$1;return b(a({},i),{customContent:(a$1=n==null?void 0:n.sections.find(P=>P.id===i.id))==null?void 0:a$1.customContent})}),variableValues:(n==null?void 0:n.variableValues)||{},effectiveDate:t,lastUpdated:t,version:"1.0"};return p(r),k(r),T&&T(r),r},[o,n,u,T]),K=useCallback(()=>{if(!n)return {fullText:"",sectionTexts:{},missingVariables:[]};let t=b$1(n.sections,n.organizationInfo);return typeof t=="string"?{fullText:t,sectionTexts:{full:t},missingVariables:[]}:t},[n]),H=useCallback(()=>{p(null),g(null),S({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(c.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove policy:",t);});},[]),J=useCallback(()=>{let t=[];if(o||t.push("No template selected"),u.name||t.push("Organization name is required"),u.website||t.push("Organization website is required"),u.privacyEmail||t.push("Privacy contact email is required"),o){let r=o.sections.filter(a=>a.required),i=(n==null?void 0:n.sections.filter(a=>a.included))||[];r.forEach(a=>{i.some(P=>P.id===a.id)||t.push(`Required section "${a.title}" must be included`);});}return o&&n&&Object.entries(o.variables).forEach(([r,i])=>{i.required&&!n.variableValues[r]&&t.push(`Required variable "${i.name}" must have a value`);}),{valid:t.length===0,errors:t}},[o,u,n]);return {policy:n,selectedTemplate:o,organizationInfo:u,selectTemplate:j,updateOrganizationInfo:I,toggleSection:F,updateSectionContent:M,updateVariableValue:$,generatePolicy:G,getPolicyText:K,resetPolicy:H,isValid:J,isLoading:C}}var _="default-business";function X(e){return e.toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"})}function Y(e$1){let{sections:s,variables:y}=e(),l={};return e$1&&(e$1.name&&(l.orgName=e$1.name),e$1.email&&(l.privacyEmail=e$1.email),e$1.website&&(l.website=e$1.website),e$1.address&&(l.address=e$1.address),e$1.industry&&(l.industry=e$1.industry),e$1.dpoName&&(l.dpoName=e$1.dpoName),e$1.dpoEmail&&(l.dpoEmail=e$1.dpoEmail)),l.effectiveDate||(l.effectiveDate=X(new Date)),{id:_,name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:s,variables:Object.fromEntries(y.map(f=>[f.name,{name:f.name,description:f.description,required:f.required,defaultValue:l[f.name]||f.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true}}function Z(e){if(!e)return {};let s={};return e.name&&(s.name=e.name),e.email&&(s.privacyEmail=e.email),e.website&&(s.website=e.website),e.address&&(s.address=e.address),e.industry&&(s.industry=e.industry),e.dpoName&&(s.dpoName=e.dpoName),e.dpoEmail&&(s.dpoEmail=e.dpoEmail),s}function ce(e={}){var o;let{orgInfo:s,autoGenerate:y=true,storageKey:l,persist:f,useLocalStorage:D,adapter:T}=e,O=(o=f!=null?f:D)!=null?o:true,w=useRef(null);w.current===null&&(w.current=Y(s));let c=A({templates:[w.current],adapter:T,storageKey:l,persist:O}),n=useRef(false),p=useRef(false);return useEffect(()=>{if(!y||c.isLoading||n.current)return;if(!T&&O!==false&&typeof window!="undefined"&&typeof window.localStorage!="undefined")try{if(window.localStorage.getItem(l!=null?l:"ndpr_privacy_policy")){n.current=!0,p.current=!0;return}}catch(S){}if(c.policy){n.current=true,p.current=true;return}n.current=true;let u=Z(s);Object.keys(u).length>0&&c.updateOrganizationInfo(u),c.selectedTemplate||c.selectTemplate(_);},[y,c.isLoading]),useEffect(()=>{var u;if(!y||p.current||!n.current||!c.selectedTemplate)return;let g=(u=s==null?void 0:s.name)!=null?u:"";g&&c.organizationInfo.name!==g||(p.current=true,c.generatePolicy());},[y,c.selectedTemplate,c.organizationInfo]),c}export{A as a,ce as b};//# sourceMappingURL=chunk-LU7PKE7Y.mjs.map
2
- //# sourceMappingURL=chunk-LU7PKE7Y.mjs.map
1
+ import {b as b$1,e}from'./chunk-Y3MKMAFQ.mjs';import {a as a$1}from'./chunk-DBZSN4WP.mjs';import {b,a}from'./chunk-ZJYULEER.mjs';import {useRef,useState,useEffect,useCallback}from'react';function W(e,s){return s?a$1(e):{load:()=>null,save:()=>{},remove:()=>{}}}function A({templates:e,initialPolicy:s,adapter:y,storageKey:l="ndpr_privacy_policy",persist:f,useLocalStorage:D,onGenerate:T}){var V;let O=(V=f!=null?f:D)!=null?V:true,w=y!=null?y:W(l,O),c=useRef(w);c.current=w;let[n,p]=useState(s||null),[o,g]=useState(null),[u,S]=useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[C,E]=useState(true),R=useRef(e);R.current=e,useEffect(()=>{if(s){E(false);return}let t=false;try{let r=c.current.load(),i=a=>{if(a){if(p(a),a.templateId){let P=R.current.find(b=>b.id===a.templateId);P&&g(P);}a.organizationInfo&&S(a.organizationInfo);}E(!1);};r instanceof Promise?r.then(a=>{t||i(a);},()=>{t||E(!1);}):i(r);}catch(r){t||E(false);}return ()=>{t=true;}},[s]);let k=t=>{Promise.resolve(c.current.save(t)).catch(r=>{console.warn("[ndpr-toolkit] Failed to save policy:",r);});},j=useCallback(t=>{let r=e.find(b=>b.id===t);if(!r)return false;g(r);let i=r.sections.map(b$1=>b(a({},b$1),{customContent:void 0})),a$1={};Object.keys(r.variables).forEach(b=>{a$1[b]=r.variables[b].defaultValue||"";});let P=Date.now();return p({id:"policy_"+P+"_"+Math.random().toString(36).substr(2,9),title:"",templateId:r.id,organizationInfo:u,sections:i,variableValues:a$1,effectiveDate:P,lastUpdated:P,version:"1.0"}),true},[e,u]),I=useCallback(t=>{S(r=>a(a({},r),t));},[]),F=useCallback((t,r)=>{o&&(n?p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:r}):a$1)})):g(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{included:r}):a$1)})));},[o,n]),M=useCallback((t,r)=>{o&&(n?p(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:r}):a$1)})):g(i=>i&&b(a({},i),{sections:i.sections.map(a$1=>a$1.id===t?b(a({},a$1),{customContent:r}):a$1)})));},[o,n]),$=useCallback((t,r)=>{n&&p(i=>i&&b(a({},i),{variableValues:b(a({},i.variableValues),{[t]:r})}));},[n]),B=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),G=useCallback(()=>{if(!o)return null;let t=Date.now(),r={id:(n==null?void 0:n.id)||B(),title:`Privacy Policy for ${u.name}`,templateId:o.id,organizationInfo:u,sections:o.sections.map(i=>{var a$1;return b(a({},i),{customContent:(a$1=n==null?void 0:n.sections.find(P=>P.id===i.id))==null?void 0:a$1.customContent})}),variableValues:(n==null?void 0:n.variableValues)||{},effectiveDate:t,lastUpdated:t,version:"1.0"};return p(r),k(r),T&&T(r),r},[o,n,u,T]),K=useCallback(()=>{if(!n)return {fullText:"",sectionTexts:{},missingVariables:[]};let t=b$1(n.sections,n.organizationInfo);return typeof t=="string"?{fullText:t,sectionTexts:{full:t},missingVariables:[]}:t},[n]),H=useCallback(()=>{p(null),g(null),S({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(c.current.remove()).catch(t=>{console.warn("[ndpr-toolkit] Failed to remove policy:",t);});},[]),J=useCallback(()=>{let t=[];if(o||t.push("No template selected"),u.name||t.push("Organization name is required"),u.website||t.push("Organization website is required"),u.privacyEmail||t.push("Privacy contact email is required"),o){let r=o.sections.filter(a=>a.required),i=(n==null?void 0:n.sections.filter(a=>a.included))||[];r.forEach(a=>{i.some(P=>P.id===a.id)||t.push(`Required section "${a.title}" must be included`);});}return o&&n&&Object.entries(o.variables).forEach(([r,i])=>{i.required&&!n.variableValues[r]&&t.push(`Required variable "${i.name}" must have a value`);}),{valid:t.length===0,errors:t}},[o,u,n]);return {policy:n,selectedTemplate:o,organizationInfo:u,selectTemplate:j,updateOrganizationInfo:I,toggleSection:F,updateSectionContent:M,updateVariableValue:$,generatePolicy:G,getPolicyText:K,resetPolicy:H,isValid:J,isLoading:C}}var _="default-business";function X(e){return e.toLocaleDateString("en-NG",{day:"numeric",month:"long",year:"numeric"})}function Y(e$1){let{sections:s,variables:y}=e(),l={};return e$1&&(e$1.name&&(l.orgName=e$1.name),e$1.email&&(l.privacyEmail=e$1.email),e$1.website&&(l.website=e$1.website),e$1.address&&(l.address=e$1.address),e$1.industry&&(l.industry=e$1.industry),e$1.dpoName&&(l.dpoName=e$1.dpoName),e$1.dpoEmail&&(l.dpoEmail=e$1.dpoEmail)),l.effectiveDate||(l.effectiveDate=X(new Date)),{id:_,name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:s,variables:Object.fromEntries(y.map(f=>[f.name,{name:f.name,description:f.description,required:f.required,defaultValue:l[f.name]||f.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true}}function Z(e){if(!e)return {};let s={};return e.name&&(s.name=e.name),e.email&&(s.privacyEmail=e.email),e.website&&(s.website=e.website),e.address&&(s.address=e.address),e.industry&&(s.industry=e.industry),e.dpoName&&(s.dpoName=e.dpoName),e.dpoEmail&&(s.dpoEmail=e.dpoEmail),s}function ce(e={}){var o;let{orgInfo:s,autoGenerate:y=true,storageKey:l,persist:f,useLocalStorage:D,adapter:T}=e,O=(o=f!=null?f:D)!=null?o:true,w=useRef(null);w.current===null&&(w.current=Y(s));let c=A({templates:[w.current],adapter:T,storageKey:l,persist:O}),n=useRef(false),p=useRef(false);return useEffect(()=>{if(!y||c.isLoading||n.current)return;if(!T&&O!==false&&typeof window!="undefined"&&typeof window.localStorage!="undefined")try{if(window.localStorage.getItem(l!=null?l:"ndpr_privacy_policy")){n.current=!0,p.current=!0;return}}catch(S){}if(c.policy){n.current=true,p.current=true;return}n.current=true;let u=Z(s);Object.keys(u).length>0&&c.updateOrganizationInfo(u),c.selectedTemplate||c.selectTemplate(_);},[y,c.isLoading]),useEffect(()=>{var u;if(!y||p.current||!n.current||!c.selectedTemplate)return;let g=(u=s==null?void 0:s.name)!=null?u:"";g&&c.organizationInfo.name!==g||(p.current=true,c.generatePolicy());},[y,c.selectedTemplate,c.organizationInfo]),c}export{A as a,ce as b};
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkUXUMYP4L_js=require('./chunk-UXUMYP4L.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var gr=({requestTypes:y,onSubmit:V,onValidationError:F,title:N="Submit a Data Subject Request",description:s="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI.",submitButtonText:rr="Submit Request",className:q="",buttonClassName:ir="",showConfirmation:er=true,confirmationMessage:tr="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:P=true,identifierTypes:T=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:or=true,labels:v={},classNames:r,unstyled:e=false,isSubmitting:C=false,defaultValues:p,onReset:$})=>{var Y,H,L,U,W,J;if(!Array.isArray(y))throw new Error("[ndpr-toolkit] <DSRRequestForm requestTypes={...} /> requires an array of RequestType[]. See https://ndprtoolkit.com.ng/docs/components/dsr#requesttypes \u2014 or use the `<NDPRSubjectRights />` preset which ships sensible defaults.");let[c,w]=react.useState((p==null?void 0:p.requestType)||""),[A,j]=react.useState(((Y=p==null?void 0:p.dataSubject)==null?void 0:Y.fullName)||""),[S,E]=react.useState(((H=p==null?void 0:p.dataSubject)==null?void 0:H.email)||""),[I,B]=react.useState(((L=p==null?void 0:p.dataSubject)==null?void 0:L.phone)||""),[O,z]=react.useState(((U=p==null?void 0:p.dataSubject)==null?void 0:U.identifierType)||((W=T[0])==null?void 0:W.id)||""),[x,M]=react.useState(((J=p==null?void 0:p.dataSubject)==null?void 0:J.identifierValue)||""),[l,D]=react.useState((p==null?void 0:p.additionalInfo)||{}),[nr,k]=react.useState(false),[d,Z]=react.useState({}),dr=()=>{var i;w(""),j(""),E(""),B(""),z(((i=T[0])==null?void 0:i.id)||""),M(""),D({}),k(false),Z({}),$==null||$();},a=y.find(i=>i.id===c),pr=i=>{w(i.target.value),D({});},h=(i,b)=>{D(_=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},_),{[i]:b}));},ar=()=>{let i={};return A.trim()||(i.fullName="Full name is required"),S.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S)||(i.email="Email is invalid"):i.email="Email is required",c||(i.requestType="Please select a request type"),P&&!x.trim()&&(i.identifierValue="Identifier value is required"),a!=null&&a.requiresAdditionalInfo&&a.additionalFields&&a.additionalFields.forEach(b=>{b.required&&!l[b.id]&&(i[`additional_${b.id}`]=`${b.label} is required`);}),Z(i),i},ur=i=>{i.preventDefault();let b=ar();if(Object.keys(b).length>0){F==null||F(b);return}let _=Object.keys(l).length>0?Object.fromEntries(Object.entries(l).map(([u,m])=>[u,typeof m=="string"?chunkUXUMYP4L_js.a(m):m])):void 0,R={requestType:c,dataSubject:{fullName:chunkUXUMYP4L_js.a(A),email:chunkUXUMYP4L_js.a(S),phone:I?chunkUXUMYP4L_js.a(I):void 0,identifierType:O,identifierValue:chunkUXUMYP4L_js.a(x)},additionalInfo:_,submittedAt:Date.now()};V(R),er&&k(true);},G=`ndpr-dsr-form__button ndpr-dsr-form__button--primary ${ir}`.trim(),br="ndpr-dsr-form__button ndpr-dsr-form__button--secondary";return nr?jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form","data-ndpr-state":"submitted",className:chunkAME4HJR4_js.a(`ndpr-dsr-form__success${q?` ${q}`:""}`,r==null?void 0:r.successMessage,e),"aria-live":"polite",children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-title",r==null?void 0:r.title,e),children:"Request Submitted"}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-body",r==null?void 0:r.description,e),children:tr}),jsxRuntime.jsx("button",{onClick:()=>k(false),className:chunkAME4HJR4_js.a(G,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:"Submit Another Request"})]}):jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form",className:chunkAME4HJR4_js.a(`ndpr-dsr-form${q?` ${q}`:""}`,r==null?void 0:r.root,e),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__title",r==null?void 0:r.title,e),children:N}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__description",r==null?void 0:r.description,e),children:s}),jsxRuntime.jsx("form",{onSubmit:ur,className:chunkAME4HJR4_js.a("",r==null?void 0:r.form,e),children:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__sections",r==null?void 0:r.fieldGroup,e),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Personal Information"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"fullName",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.name||"Full Name"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"fullName",value:A,onChange:i=>j(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsxRuntime.jsx("p",{id:"fullName-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.fullName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"email",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.email||"Email Address"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"email",value:S,onChange:i=>E(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsxRuntime.jsx("p",{id:"email-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.email})]}),or&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"phone",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:"Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"phone",value:I,onChange:i=>B(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e)})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Request Details"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"requestType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.requestType||"Request Type"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsxs("select",{id:"requestType",value:c,onChange:pr,className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true","aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a request type"}),y.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.name},i.id))]}),d.requestType&&jsxRuntime.jsx("p",{id:"requestType-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.requestType})]}),a&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__type-info",children:[jsxRuntime.jsx("p",{children:a.description}),jsxRuntime.jsxs("p",{children:["Estimated completion time: ",a.estimatedCompletionTime," ",a.estimatedCompletionTime===1?"day":"days"]})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:v.description||"Additional Information"}),jsxRuntime.jsx("textarea",{id:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),P&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Identity Verification"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-form-section__hint",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Type ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"identifierType",value:O,onChange:i=>z(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true",children:T.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.label},i.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierValue",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Value ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"identifierValue",value:x,onChange:i=>M(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsxRuntime.jsx("p",{id:"identifierValue-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.identifierValue})]})]})]}),(a==null?void 0:a.requiresAdditionalInfo)&&a.additionalFields&&a.additionalFields.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Additional Information"}),jsxRuntime.jsx("div",{className:e?"":"ndpr-form-section",children:a.additionalFields.map(i=>{var b,_,R;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[i.label," ",i.required&&jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),i.type==="text"&&jsxRuntime.jsx("input",{type:"text",id:i.id,value:String((b=l[i.id])!=null?b:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="textarea"&&jsxRuntime.jsx("textarea",{id:i.id,value:String((_=l[i.id])!=null?_:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="select"&&i.options&&jsxRuntime.jsxs("select",{id:i.id,value:String((R=l[i.id])!=null?R:""),onChange:u=>h(i.id,u.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0,children:[jsxRuntime.jsx("option",{value:"",children:i.placeholder||"Select an option"}),i.options.map(u=>jsxRuntime.jsx("option",{value:u,children:u},u))]}),i.type==="checkbox"&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",id:i.id,checked:!!l[i.id],onChange:u=>h(i.id,u.target.checked),className:e?"":"ndpr-form-field__checkbox",required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),jsxRuntime.jsx("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:i.placeholder||i.label})]}),i.type==="file"&&jsxRuntime.jsx("input",{type:"file",id:i.id,onChange:u=>{var K;let m=(K=u.target.files)==null?void 0:K[0];m&&h(i.id,m.name);},className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),d[`additional_${i.id}`]&&jsxRuntime.jsx("p",{id:`additional-${i.id}-error`,role:"alert",className:e?"":"ndpr-form-field__error",children:d[`additional_${i.id}`]})]},i.id)})})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__notice",children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-dsr-form__notice-title",children:"Privacy Notice"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-dsr-form__notice-body",children:"The information you provide in this form will be used solely for the purpose of processing your data subject request. We will retain this information for as long as necessary to fulfill your request and to comply with our legal obligations. For more information, please refer to our Privacy Policy."})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__actions",children:[C&&(r==null?void 0:r.loadingOverlay)&&jsxRuntime.jsx("div",{className:r.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:C,className:chunkAME4HJR4_js.a(G,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:C?"Submitting...":v.submit||rr}),jsxRuntime.jsx("button",{type:"button",onClick:dr,className:chunkAME4HJR4_js.a(br,void 0,e),children:"Reset"})]})]})})]})};
2
+ exports.a=gr;
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-EFIBHKQE.mjs';import {useMemo}from'react';function c({input:e}){let p=JSON.stringify(e);return useMemo(()=>a(e),[p])}export{c as a};
@@ -1,2 +1 @@
1
- 'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),jsxRuntime=require('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)=>{let d=a?f[a]:void 0;return !d&&a==="nextButton"&&(d=f.primaryButton),!d&&a==="prevButton"&&(d=f.secondaryButton),chunkE64TU6IU_js.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 jsxRuntime.jsxs("div",{className:t("ndpr-form-field","question"),children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:t("ndpr-form-field__label","questionText"),children:[e.text,e.required&&jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),e.guidance&&jsxRuntime.jsx("p",{id:h,className:t("ndpr-form-field__hint","guidance"),children:e.guidance}),e.type==="text"&&jsxRuntime.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"&&jsxRuntime.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&&jsxRuntime.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:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(r=>jsxRuntime.jsx("option",{value:r.value,children:r.label},r.value))]}),e.type==="radio"&&e.options&&jsxRuntime.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=>jsxRuntime.jsxs("div",{className:t("ndpr-form-field__checkbox-row","radioOption"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("label",{htmlFor:`${e.id}_${r.value}`,className:"ndpr-form-field__label",children:[r.label,r.riskLevel&&jsxRuntime.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&&jsxRuntime.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=>jsxRuntime.jsxs("div",{className:"ndpr-form-field__checkbox-row",children:[jsxRuntime.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"}),jsxRuntime.jsx("label",{htmlFor:`${e.id}_${r.value}`,className:"ndpr-form-field__label",children:r.label})]},r.value))}),e.type==="scale"&&jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("div",{className:"ndpr-form-field__hint",style:{display:"flex",justifyContent:"space-between"},children:e.scaleLabels&&Object.entries(e.scaleLabels).map(([r,g])=>jsxRuntime.jsx("span",{style:{width:`${100/Object.keys(e.scaleLabels||{}).length}%`,textAlign:"center"},children:g},r))}),jsxRuntime.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}),jsxRuntime.jsxs("div",{className:"ndpr-form-field__hint",style:{textAlign:"center"},children:["Selected value: ",l||e.minValue||1]})]}),a&&jsxRuntime.jsx("p",{id:N,className:"ndpr-form-field__error",role:"alert",children:a})]},e.id)};return m?jsxRuntime.jsxs("div",{"data-ndpr-component":"dpia-questionnaire",className:`${t("ndpr-card","root")} ${A}`,children:[D&&jsxRuntime.jsxs("div",{className:t("ndpr-card__header","header"),style:{flexDirection:"column",alignItems:"stretch",gap:"var(--ndpr-space-2)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"var(--ndpr-font-size-sm)",color:"rgb(var(--ndpr-muted-foreground))"},children:[jsxRuntime.jsxs("span",{children:["Section ",o+1," of ",v.length]}),jsxRuntime.jsx("span",{children:c!==void 0?`${c}% Complete`:""})]}),jsxRuntime.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:jsxRuntime.jsx("div",{className:"ndpr-progress__bar",style:{width:`${c!==void 0?c:(o+1)/v.length*100}%`}})})]}),jsxRuntime.jsx("h2",{className:t("ndpr-card__title","title"),children:m.title}),m.description&&jsxRuntime.jsx("p",{className:t("ndpr-card__subtitle","sectionTitle"),children:m.description}),jsxRuntime.jsx("div",{className:t("ndpr-card__body","section"),children:m.questions.map(e=>T(e))}),jsxRuntime.jsxs("div",{className:t("ndpr-card__footer","navigation"),style:{justifyContent:"space-between"},children:[jsxRuntime.jsx("button",{type:"button",onClick:B,disabled:o===0||s,className:`${t("ndpr-button ndpr-button--secondary","prevButton")} ${_}`,children:w}),jsxRuntime.jsx("button",{type:"button",onClick:$,disabled:s,className:`${t("ndpr-button ndpr-button--primary","nextButton")} ${_}`,children:S?I:C})]})]}):jsxRuntime.jsx("div",{children:"No section found."})};exports.a=R;//# sourceMappingURL=chunk-5HL4UBFV.js.map
2
- //# sourceMappingURL=chunk-5HL4UBFV.js.map
1
+ 'use strict';var chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),jsxRuntime=require('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)=>{let d=a?f[a]:void 0;return !d&&a==="nextButton"&&(d=f.primaryButton),!d&&a==="prevButton"&&(d=f.secondaryButton),chunkAME4HJR4_js.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 jsxRuntime.jsxs("div",{className:t("ndpr-form-field","question"),children:[jsxRuntime.jsxs("label",{htmlFor:e.id,className:t("ndpr-form-field__label","questionText"),children:[e.text,e.required&&jsxRuntime.jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),e.guidance&&jsxRuntime.jsx("p",{id:h,className:t("ndpr-form-field__hint","guidance"),children:e.guidance}),e.type==="text"&&jsxRuntime.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"&&jsxRuntime.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&&jsxRuntime.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:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(r=>jsxRuntime.jsx("option",{value:r.value,children:r.label},r.value))]}),e.type==="radio"&&e.options&&jsxRuntime.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=>jsxRuntime.jsxs("div",{className:t("ndpr-form-field__checkbox-row","radioOption"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("label",{htmlFor:`${e.id}_${r.value}`,className:"ndpr-form-field__label",children:[r.label,r.riskLevel&&jsxRuntime.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&&jsxRuntime.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=>jsxRuntime.jsxs("div",{className:"ndpr-form-field__checkbox-row",children:[jsxRuntime.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"}),jsxRuntime.jsx("label",{htmlFor:`${e.id}_${r.value}`,className:"ndpr-form-field__label",children:r.label})]},r.value))}),e.type==="scale"&&jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("div",{className:"ndpr-form-field__hint",style:{display:"flex",justifyContent:"space-between"},children:e.scaleLabels&&Object.entries(e.scaleLabels).map(([r,g])=>jsxRuntime.jsx("span",{style:{width:`${100/Object.keys(e.scaleLabels||{}).length}%`,textAlign:"center"},children:g},r))}),jsxRuntime.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}),jsxRuntime.jsxs("div",{className:"ndpr-form-field__hint",style:{textAlign:"center"},children:["Selected value: ",l||e.minValue||1]})]}),a&&jsxRuntime.jsx("p",{id:N,className:"ndpr-form-field__error",role:"alert",children:a})]},e.id)};return m?jsxRuntime.jsxs("div",{"data-ndpr-component":"dpia-questionnaire",className:`${t("ndpr-card","root")} ${A}`,children:[D&&jsxRuntime.jsxs("div",{className:t("ndpr-card__header","header"),style:{flexDirection:"column",alignItems:"stretch",gap:"var(--ndpr-space-2)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"var(--ndpr-font-size-sm)",color:"rgb(var(--ndpr-muted-foreground))"},children:[jsxRuntime.jsxs("span",{children:["Section ",o+1," of ",v.length]}),jsxRuntime.jsx("span",{children:c!==void 0?`${c}% Complete`:""})]}),jsxRuntime.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:jsxRuntime.jsx("div",{className:"ndpr-progress__bar",style:{width:`${c!==void 0?c:(o+1)/v.length*100}%`}})})]}),jsxRuntime.jsx("h2",{className:t("ndpr-card__title","title"),children:m.title}),m.description&&jsxRuntime.jsx("p",{className:t("ndpr-card__subtitle","sectionTitle"),children:m.description}),jsxRuntime.jsx("div",{className:t("ndpr-card__body","section"),children:m.questions.map(e=>T(e))}),jsxRuntime.jsxs("div",{className:t("ndpr-card__footer","navigation"),style:{justifyContent:"space-between"},children:[jsxRuntime.jsx("button",{type:"button",onClick:B,disabled:o===0||s,className:`${t("ndpr-button ndpr-button--secondary","prevButton")} ${_}`,children:w}),jsxRuntime.jsx("button",{type:"button",onClick:$,disabled:s,className:`${t("ndpr-button ndpr-button--primary","nextButton")} ${_}`,children:S?I:C})]})]}):jsxRuntime.jsx("div",{children:"No section found."})};exports.a=R;
@@ -1,2 +1 @@
1
- function R(e,s){if(s){let{riskLevel:t,risksToRightsAndFreedoms:o,highRisksToRightsAndFreedoms:d}=s;return {severityLevel:t,notificationRequired:o,urgentNotificationRequired:d,timeframeHours:72,justification:s.justification||"Based on risk assessment results"}}let r={ongoing:e.status==="ongoing",sensitiveData:["health","financial","biometric","children","location","religious","political","ethnic"].some(t=>e.dataTypes.includes(t)),largeScale:(e.estimatedAffectedSubjects||0)>1e3,delayedDiscovery:e.occurredAt&&e.discoveredAt-e.occurredAt>10080*60*1e3},c=Object.values(r).filter(Boolean).length,i;c===0?i="low":c===1?i="medium":c===2?i="high":i="critical";let a=i!=="low",l=i==="high"||i==="critical",u=72,n=Object.entries(r).filter(([t,o])=>o).map(([t,o])=>t).join(", "),f=n?`${i.charAt(0).toUpperCase()+i.slice(1)} risk (factors: ${n})`:`${i.charAt(0).toUpperCase()+i.slice(1)} risk`;return {severityLevel:i,notificationRequired:a,urgentNotificationRequired:l,timeframeHours:u,justification:f}}export{R as a};//# sourceMappingURL=chunk-DJGS7SSN.mjs.map
2
- //# sourceMappingURL=chunk-DJGS7SSN.mjs.map
1
+ function R(e,s){if(s){let{riskLevel:t,risksToRightsAndFreedoms:o,highRisksToRightsAndFreedoms:d}=s;return {severityLevel:t,notificationRequired:o,urgentNotificationRequired:d,timeframeHours:72,justification:s.justification||"Based on risk assessment results"}}let r={ongoing:e.status==="ongoing",sensitiveData:["health","financial","biometric","children","location","religious","political","ethnic"].some(t=>e.dataTypes.includes(t)),largeScale:(e.estimatedAffectedSubjects||0)>1e3,delayedDiscovery:e.occurredAt&&e.discoveredAt-e.occurredAt>10080*60*1e3},c=Object.values(r).filter(Boolean).length,i;c===0?i="low":c===1?i="medium":c===2?i="high":i="critical";let a=i!=="low",l=i==="high"||i==="critical",u=72,n=Object.entries(r).filter(([t,o])=>o).map(([t,o])=>t).join(", "),f=n?`${i.charAt(0).toUpperCase()+i.slice(1)} risk (factors: ${n})`:`${i.charAt(0).toUpperCase()+i.slice(1)} risk`;return {severityLevel:i,notificationRequired:a,urgentNotificationRequired:l,timeframeHours:u,justification:f}}export{R as a};
@@ -1,2 +1 @@
1
- 'use strict';function o(i){let t=[],e=[];return i.id||t.push("Activity ID is required."),(!i.name||i.name.trim()==="")&&t.push("Activity name is required."),(!i.description||i.description.trim()==="")&&t.push("Activity description is required."),i.lawfulBasis||t.push("Lawful basis is required per NDPA Section 25."),(!i.lawfulBasisJustification||i.lawfulBasisJustification.trim()==="")&&t.push("Justification for the lawful basis is required."),(!i.dataCategories||i.dataCategories.length===0)&&t.push("At least one data category must be specified."),(!i.dataSubjectCategories||i.dataSubjectCategories.length===0)&&t.push("At least one data subject category must be specified."),(!i.purposes||i.purposes.length===0)&&t.push("At least one processing purpose must be specified."),(!i.retentionPeriod||i.retentionPeriod.trim()==="")&&t.push("Data retention period is required."),i.lawfulBasis==="legitimate_interests"&&(!i.lawfulBasisJustification||i.lawfulBasisJustification.trim().length<20)&&t.push("Legitimate interests requires a detailed Legitimate Interest Assessment (LIA) justification (NDPA Section 25(1)(f))."),i.involvesSensitiveData&&!i.sensitiveDataCondition&&t.push("Processing sensitive personal data requires specifying a condition under NDPA Section 27."),i.dpoApproval?i.dpoApproval.approved||e.push("Activity has a DPO review but has not been approved."):e.push("Activity has not been approved by the DPO."),i.reviewDate?i.reviewDate<Date.now()&&e.push("Activity is overdue for review."):e.push("No review date has been set. Regular reviews are recommended."),i.retentionJustification||e.push("Consider documenting the justification for the retention period."),i.crossBorderTransfer&&(!i.recipients||i.recipients.length===0)&&e.push("Cross-border transfer is indicated but no recipients are listed. Document the recipients or categories of recipients."),{isValid:t.length===0,errors:t,warnings:e}}function c(i){return {consent:"Consent (NDPA Section 25(1)(a)) - The data subject has given consent to the processing of their personal data for one or more specific purposes.",contract:"Contract (NDPA Section 25(1)(b)) - Processing is necessary for the performance of a contract to which the data subject is a party, or in order to take steps at the request of the data subject prior to entering into a contract.",legal_obligation:"Legal Obligation (NDPA Section 25(1)(c)) - Processing is necessary for compliance with a legal obligation to which the data controller is subject.",vital_interests:"Vital Interests (NDPA Section 25(1)(d)) - Processing is necessary to protect the vital interests of the data subject or another natural person.",public_interest:"Public Interest (NDPA Section 25(1)(e)) - Processing is necessary for the performance of a task carried out in the public interest or in the exercise of official authority vested in the data controller.",legitimate_interests:"Legitimate Interests (NDPA Section 25(1)(f)) - Processing is necessary for the purposes of the legitimate interests pursued by the data controller or a third party, except where such interests are overridden by the interests, rights, or freedoms of the data subject."}[i]}function p(i){let t=[];for(let e of i)e.status!=="archived"&&((!e.dpoApproval||!e.dpoApproval.approved)&&t.push({activityId:e.id,activityName:e.name,type:"missing_approval",severity:"high",description:`Processing activity "${e.name}" has not been approved by the DPO.`}),e.reviewDate&&e.reviewDate<Date.now()&&t.push({activityId:e.id,activityName:e.name,type:"overdue_review",severity:"medium",description:`Processing activity "${e.name}" was due for review on ${new Date(e.reviewDate).toLocaleDateString()}.`}),(!e.lawfulBasisJustification||e.lawfulBasisJustification.trim()==="")&&t.push({activityId:e.id,activityName:e.name,type:"missing_justification",severity:"high",description:`Processing activity "${e.name}" is missing the lawful basis justification.`}),e.lawfulBasis==="legitimate_interests"&&(!e.lawfulBasisJustification||e.lawfulBasisJustification.trim().length<20)&&t.push({activityId:e.id,activityName:e.name,type:"missing_lia",severity:"high",description:`Processing activity "${e.name}" relies on legitimate interests but lacks a detailed Legitimate Interest Assessment (NDPA Section 25(1)(f)).`}),e.involvesSensitiveData&&!e.sensitiveDataCondition&&t.push({activityId:e.id,activityName:e.name,type:"missing_sensitive_condition",severity:"high",description:`Processing activity "${e.name}" involves sensitive data but no condition under NDPA Section 27 has been specified.`}),(!e.retentionPeriod||e.retentionPeriod.trim()==="")&&t.push({activityId:e.id,activityName:e.name,type:"missing_retention",severity:"medium",description:`Processing activity "${e.name}" is missing a documented retention period.`}),(!e.dataCategories||e.dataCategories.length===0)&&t.push({activityId:e.id,activityName:e.name,type:"missing_data_categories",severity:"medium",description:`Processing activity "${e.name}" has no documented data categories.`}),(!e.purposes||e.purposes.length===0)&&t.push({activityId:e.id,activityName:e.name,type:"missing_purposes",severity:"medium",description:`Processing activity "${e.name}" has no documented processing purposes.`}));return t}function u(i){let t={consent:0,contract:0,legal_obligation:0,vital_interests:0,public_interest:0,legitimate_interests:0},e=0,a=0,n=[],r=[];for(let s of i)s.status!=="archived"&&(s.lawfulBasis in t&&t[s.lawfulBasis]++,s.involvesSensitiveData&&e++,s.crossBorderTransfer&&a++,s.reviewDate&&s.reviewDate<Date.now()&&n.push(s),(!s.dpoApproval||!s.dpoApproval.approved)&&r.push(s));return {totalActivities:i.filter(s=>s.status!=="archived").length,byBasis:t,sensitiveDataActivities:e,crossBorderActivities:a,activitiesDueForReview:n,activitiesWithoutApproval:r,lastUpdated:Date.now()}}exports.a=o;exports.b=c;exports.c=p;exports.d=u;//# sourceMappingURL=chunk-TDDAYVKK.js.map
2
- //# sourceMappingURL=chunk-TDDAYVKK.js.map
1
+ 'use strict';function o(i){let t=[],e=[];return i.id||t.push("Activity ID is required."),(!i.name||i.name.trim()==="")&&t.push("Activity name is required."),(!i.description||i.description.trim()==="")&&t.push("Activity description is required."),i.lawfulBasis||t.push("Lawful basis is required per NDPA Section 25."),(!i.lawfulBasisJustification||i.lawfulBasisJustification.trim()==="")&&t.push("Justification for the lawful basis is required."),(!i.dataCategories||i.dataCategories.length===0)&&t.push("At least one data category must be specified."),(!i.dataSubjectCategories||i.dataSubjectCategories.length===0)&&t.push("At least one data subject category must be specified."),(!i.purposes||i.purposes.length===0)&&t.push("At least one processing purpose must be specified."),(!i.retentionPeriod||i.retentionPeriod.trim()==="")&&t.push("Data retention period is required."),i.lawfulBasis==="legitimate_interests"&&(!i.lawfulBasisJustification||i.lawfulBasisJustification.trim().length<20)&&t.push("Legitimate interests requires a detailed Legitimate Interest Assessment (LIA) justification (NDPA Section 25(1)(f))."),i.involvesSensitiveData&&!i.sensitiveDataCondition&&t.push("Processing sensitive personal data requires specifying a condition under NDPA Section 30."),i.dpoApproval?i.dpoApproval.approved||e.push("Activity has a DPO review but has not been approved."):e.push("Activity has not been approved by the DPO."),i.reviewDate?i.reviewDate<Date.now()&&e.push("Activity is overdue for review."):e.push("No review date has been set. Regular reviews are recommended."),i.retentionJustification||e.push("Consider documenting the justification for the retention period."),i.crossBorderTransfer&&(!i.recipients||i.recipients.length===0)&&e.push("Cross-border transfer is indicated but no recipients are listed. Document the recipients or categories of recipients."),{isValid:t.length===0,errors:t,warnings:e}}function c(i){return {consent:"Consent (NDPA Section 25(1)(a)) - The data subject has given consent to the processing of their personal data for one or more specific purposes.",contract:"Contract (NDPA Section 25(1)(b)) - Processing is necessary for the performance of a contract to which the data subject is a party, or in order to take steps at the request of the data subject prior to entering into a contract.",legal_obligation:"Legal Obligation (NDPA Section 25(1)(c)) - Processing is necessary for compliance with a legal obligation to which the data controller is subject.",vital_interests:"Vital Interests (NDPA Section 25(1)(d)) - Processing is necessary to protect the vital interests of the data subject or another natural person.",public_interest:"Public Interest (NDPA Section 25(1)(e)) - Processing is necessary for the performance of a task carried out in the public interest or in the exercise of official authority vested in the data controller.",legitimate_interests:"Legitimate Interests (NDPA Section 25(1)(f)) - Processing is necessary for the purposes of the legitimate interests pursued by the data controller or a third party, except where such interests are overridden by the interests, rights, or freedoms of the data subject."}[i]}function p(i){let t=[];for(let e of i)e.status!=="archived"&&((!e.dpoApproval||!e.dpoApproval.approved)&&t.push({activityId:e.id,activityName:e.name,type:"missing_approval",severity:"high",description:`Processing activity "${e.name}" has not been approved by the DPO.`}),e.reviewDate&&e.reviewDate<Date.now()&&t.push({activityId:e.id,activityName:e.name,type:"overdue_review",severity:"medium",description:`Processing activity "${e.name}" was due for review on ${new Date(e.reviewDate).toLocaleDateString()}.`}),(!e.lawfulBasisJustification||e.lawfulBasisJustification.trim()==="")&&t.push({activityId:e.id,activityName:e.name,type:"missing_justification",severity:"high",description:`Processing activity "${e.name}" is missing the lawful basis justification.`}),e.lawfulBasis==="legitimate_interests"&&(!e.lawfulBasisJustification||e.lawfulBasisJustification.trim().length<20)&&t.push({activityId:e.id,activityName:e.name,type:"missing_lia",severity:"high",description:`Processing activity "${e.name}" relies on legitimate interests but lacks a detailed Legitimate Interest Assessment (NDPA Section 25(1)(f)).`}),e.involvesSensitiveData&&!e.sensitiveDataCondition&&t.push({activityId:e.id,activityName:e.name,type:"missing_sensitive_condition",severity:"high",description:`Processing activity "${e.name}" involves sensitive data but no condition under NDPA Section 30 has been specified.`}),(!e.retentionPeriod||e.retentionPeriod.trim()==="")&&t.push({activityId:e.id,activityName:e.name,type:"missing_retention",severity:"medium",description:`Processing activity "${e.name}" is missing a documented retention period.`}),(!e.dataCategories||e.dataCategories.length===0)&&t.push({activityId:e.id,activityName:e.name,type:"missing_data_categories",severity:"medium",description:`Processing activity "${e.name}" has no documented data categories.`}),(!e.purposes||e.purposes.length===0)&&t.push({activityId:e.id,activityName:e.name,type:"missing_purposes",severity:"medium",description:`Processing activity "${e.name}" has no documented processing purposes.`}));return t}function u(i){let t={consent:0,contract:0,legal_obligation:0,vital_interests:0,public_interest:0,legitimate_interests:0},e=0,a=0,n=[],r=[];for(let s of i)s.status!=="archived"&&(s.lawfulBasis in t&&t[s.lawfulBasis]++,s.involvesSensitiveData&&e++,s.crossBorderTransfer&&a++,s.reviewDate&&s.reviewDate<Date.now()&&n.push(s),(!s.dpoApproval||!s.dpoApproval.approved)&&r.push(s));return {totalActivities:i.filter(s=>s.status!=="archived").length,byBasis:t,sensitiveDataActivities:e,crossBorderActivities:a,activitiesDueForReview:n,activitiesWithoutApproval:r,lastUpdated:Date.now()}}exports.a=o;exports.b=c;exports.c=p;exports.d=u;
@@ -0,0 +1,103 @@
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};
@@ -0,0 +1,2 @@
1
+ import {a as a$2}from'./chunk-EWVK45Z3.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {b,a as a$1}from'./chunk-ZJYULEER.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var gr=({requestTypes:y,onSubmit:V,onValidationError:F,title:N="Submit a Data Subject Request",description:s="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI.",submitButtonText:rr="Submit Request",className:q="",buttonClassName:ir="",showConfirmation:er=true,confirmationMessage:tr="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:P=true,identifierTypes:T=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:or=true,labels:v={},classNames:r,unstyled:e=false,isSubmitting:C=false,defaultValues:p,onReset:$})=>{var Y,H,L,U,W,J;if(!Array.isArray(y))throw new Error("[ndpr-toolkit] <DSRRequestForm requestTypes={...} /> requires an array of RequestType[]. See https://ndprtoolkit.com.ng/docs/components/dsr#requesttypes \u2014 or use the `<NDPRSubjectRights />` preset which ships sensible defaults.");let[c,w]=useState((p==null?void 0:p.requestType)||""),[A,j]=useState(((Y=p==null?void 0:p.dataSubject)==null?void 0:Y.fullName)||""),[S,E]=useState(((H=p==null?void 0:p.dataSubject)==null?void 0:H.email)||""),[I,B]=useState(((L=p==null?void 0:p.dataSubject)==null?void 0:L.phone)||""),[O,z]=useState(((U=p==null?void 0:p.dataSubject)==null?void 0:U.identifierType)||((W=T[0])==null?void 0:W.id)||""),[x,M]=useState(((J=p==null?void 0:p.dataSubject)==null?void 0:J.identifierValue)||""),[l,D]=useState((p==null?void 0:p.additionalInfo)||{}),[nr,k]=useState(false),[d,Z]=useState({}),dr=()=>{var i;w(""),j(""),E(""),B(""),z(((i=T[0])==null?void 0:i.id)||""),M(""),D({}),k(false),Z({}),$==null||$();},a$3=y.find(i=>i.id===c),pr=i=>{w(i.target.value),D({});},h=(i,b$1)=>{D(_=>b(a$1({},_),{[i]:b$1}));},ar=()=>{let i={};return A.trim()||(i.fullName="Full name is required"),S.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S)||(i.email="Email is invalid"):i.email="Email is required",c||(i.requestType="Please select a request type"),P&&!x.trim()&&(i.identifierValue="Identifier value is required"),a$3!=null&&a$3.requiresAdditionalInfo&&a$3.additionalFields&&a$3.additionalFields.forEach(b=>{b.required&&!l[b.id]&&(i[`additional_${b.id}`]=`${b.label} is required`);}),Z(i),i},ur=i=>{i.preventDefault();let b=ar();if(Object.keys(b).length>0){F==null||F(b);return}let _=Object.keys(l).length>0?Object.fromEntries(Object.entries(l).map(([u,m])=>[u,typeof m=="string"?a$2(m):m])):void 0,R={requestType:c,dataSubject:{fullName:a$2(A),email:a$2(S),phone:I?a$2(I):void 0,identifierType:O,identifierValue:a$2(x)},additionalInfo:_,submittedAt:Date.now()};V(R),er&&k(true);},G=`ndpr-dsr-form__button ndpr-dsr-form__button--primary ${ir}`.trim(),br="ndpr-dsr-form__button ndpr-dsr-form__button--secondary";return nr?jsxs("div",{"data-ndpr-component":"dsr-request-form","data-ndpr-state":"submitted",className:a(`ndpr-dsr-form__success${q?` ${q}`:""}`,r==null?void 0:r.successMessage,e),"aria-live":"polite",children:[jsx("h2",{className:a("ndpr-dsr-form__success-title",r==null?void 0:r.title,e),children:"Request Submitted"}),jsx("p",{className:a("ndpr-dsr-form__success-body",r==null?void 0:r.description,e),children:tr}),jsx("button",{onClick:()=>k(false),className:a(G,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:"Submit Another Request"})]}):jsxs("div",{"data-ndpr-component":"dsr-request-form",className:a(`ndpr-dsr-form${q?` ${q}`:""}`,r==null?void 0:r.root,e),children:[jsx("h2",{className:a("ndpr-dsr-form__title",r==null?void 0:r.title,e),children:N}),jsx("p",{className:a("ndpr-dsr-form__description",r==null?void 0:r.description,e),children:s}),jsx("form",{onSubmit:ur,className:a("",r==null?void 0:r.form,e),children:jsxs("div",{className:a("ndpr-dsr-form__sections",r==null?void 0:r.fieldGroup,e),children:[jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Personal Information"}),jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"fullName",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.name||"Full Name"," ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:A,onChange:i=>j(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.email||"Email Address"," ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"email",id:"email",value:S,onChange:i=>E(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsx("p",{id:"email-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.email})]}),or&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:I,onChange:i=>B(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e)})]})]})]}),jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Request Details"}),jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxs("label",{htmlFor:"requestType",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.requestType||"Request Type"," ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxs("select",{id:"requestType",value:c,onChange:pr,className:a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true","aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),y.map(i=>jsx("option",{value:i.id,children:i.name},i.id))]}),d.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.requestType})]}),a$3&&jsxs("div",{className:e?"":"ndpr-dsr-form__type-info",children:[jsx("p",{children:a$3.description}),jsxs("p",{children:["Estimated completion time: ",a$3.estimatedCompletionTime," ",a$3.estimatedCompletionTime===1?"day":"days"]})]}),jsxs("div",{className:e?"":"ndpr-form-field",children:[jsx("label",{htmlFor:"requestDescription",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:v.description||"Additional Information"}),jsx("textarea",{id:"requestDescription",className:a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),P&&jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Identity Verification"}),jsx("p",{className:e?"":"ndpr-form-section__hint",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"identifierType",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Type ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("select",{id:"identifierType",value:O,onChange:i=>z(i.target.value),className:a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true",children:T.map(i=>jsx("option",{value:i.id,children:i.label},i.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Value ",jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:x,onChange:i=>M(i.target.value),className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.identifierValue})]})]})]}),(a$3==null?void 0:a$3.requiresAdditionalInfo)&&a$3.additionalFields&&a$3.additionalFields.length>0&&jsxs("div",{children:[jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Additional Information"}),jsx("div",{className:e?"":"ndpr-form-section",children:a$3.additionalFields.map(i=>{var b,_,R;return jsxs("div",{children:[jsxs("label",{htmlFor:i.id,className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[i.label," ",i.required&&jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),i.type==="text"&&jsx("input",{type:"text",id:i.id,value:String((b=l[i.id])!=null?b:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="textarea"&&jsx("textarea",{id:i.id,value:String((_=l[i.id])!=null?_:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="select"&&i.options&&jsxs("select",{id:i.id,value:String((R=l[i.id])!=null?R:""),onChange:u=>h(i.id,u.target.value),className:a("ndpr-form-field__select",r==null?void 0:r.select,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0,children:[jsx("option",{value:"",children:i.placeholder||"Select an option"}),i.options.map(u=>jsx("option",{value:u,children:u},u))]}),i.type==="checkbox"&&jsxs("div",{className:e?"":"ndpr-form-field__checkbox-row",children:[jsx("input",{type:"checkbox",id:i.id,checked:!!l[i.id],onChange:u=>h(i.id,u.target.checked),className:e?"":"ndpr-form-field__checkbox",required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),jsx("label",{htmlFor:i.id,className:a("ndpr-form-field__label",r==null?void 0:r.label,e),children:i.placeholder||i.label})]}),i.type==="file"&&jsx("input",{type:"file",id:i.id,onChange:u=>{var K;let m=(K=u.target.files)==null?void 0:K[0];m&&h(i.id,m.name);},className:a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),d[`additional_${i.id}`]&&jsx("p",{id:`additional-${i.id}-error`,role:"alert",className:e?"":"ndpr-form-field__error",children:d[`additional_${i.id}`]})]},i.id)})})]}),jsxs("div",{className:e?"":"ndpr-dsr-form__notice",children:[jsx("h3",{className:e?"":"ndpr-dsr-form__notice-title",children:"Privacy Notice"}),jsx("p",{className:e?"":"ndpr-dsr-form__notice-body",children:"The information you provide in this form will be used solely for the purpose of processing your data subject request. We will retain this information for as long as necessary to fulfill your request and to comply with our legal obligations. For more information, please refer to our Privacy Policy."})]}),jsxs("div",{className:e?"":"ndpr-dsr-form__actions",children:[C&&(r==null?void 0:r.loadingOverlay)&&jsx("div",{className:r.loadingOverlay}),jsx("button",{type:"submit",disabled:C,className:a(G,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:C?"Submitting...":v.submit||rr}),jsx("button",{type:"button",onClick:dr,className:a(br,void 0,e),children:"Reset"})]})]})})]})};
2
+ export{gr as a};
@@ -1,11 +1,11 @@
1
- 'use strict';var chunkLIM64IV2_js=require('./chunk-LIM64IV2.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ye=({sections:_=chunkLIM64IV2_js.c,variables:U=chunkLIM64IV2_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(),[A,n]=react.useState(_),[i,s]=react.useState(U),[m,$]=react.useState("sections"),[S,X]=react.useState(""),[F,R]=react.useState(""),[J,Z]=react.useState(false),[v,I]=react.useState({});react.useEffect(()=>{n(_);},[_]),react.useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(b=>b.id===l?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},b),{value:c}):b)),v[l]&&I(a=>{let b=chunkMQFZHA2D_js.a({},a);return delete b[l],b});},j=()=>{let l={},c=true;return i.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=A.filter(b=>b.included),c=Object.fromEntries(i.map(b=>[b.name,b.value])),a="";l.forEach(b=>{a+=`## ${b.title}
1
+ 'use strict';var chunkLVGT3DLT_js=require('./chunk-LVGT3DLT.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ye=({sections:_=chunkLVGT3DLT_js.c,variables:U=chunkLVGT3DLT_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(),[A,n]=react.useState(_),[i,s]=react.useState(U),[m,$]=react.useState("sections"),[S,X]=react.useState(""),[F,R]=react.useState(""),[J,Z]=react.useState(false),[v,I]=react.useState({});react.useEffect(()=>{n(_);},[_]),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(b=>b.id===l?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},b),{value:c}):b)),v[l]&&I(a=>{let b=chunkRFPLZDIO_js.a({},a);return delete b[l],b});},j=()=>{let l={},c=true;return i.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=A.filter(b=>b.included),c=Object.fromEntries(i.map(b=>[b.name,b.value])),a="";l.forEach(b=>{a+=`## ${b.title}
2
2
 
3
- `,a+=chunkLIM64IV2_js.b(b.template,c),a+=`
3
+ `,a+=chunkLVGT3DLT_js.b(b.template,c),a+=`
4
4
 
5
- `;}),X(a),R(a),Z(true),$("preview");},h=()=>{L({sections:A,variables:i,content:N?F:S});},g=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-generator",className:chunkE64TU6IU_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"}),A.map(l=>{let c=`${P}-section-${l.id}`,a=l.description?`${P}-section-desc-${l.id}`:void 0;return jsxRuntime.jsx("div",{className:chunkE64TU6IU_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:chunkE64TU6IU_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:chunkE64TU6IU_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 i.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_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 b=A.find(e=>e.id===c);return b&&!b.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:b?b.title:"General Information"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:a.map(e=>{let y=`${P}-var-${e.id}`,u=e.description?`${P}-var-desc-${e.id}`:void 0,z=v[e.id]?`${P}-var-err-${e.id}`:void 0,O=[u,z].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:y,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:u,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsxRuntime.jsx("textarea",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),rows:4,className:chunkE64TU6IU_js.a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxRuntime.jsxs("select",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),className:chunkE64TU6IU_js.a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]}):jsxRuntime.jsx("input",{id:y,type:e.inputType,value:e.value,onChange:E=>W(e.id,E.target.value),className:chunkE64TU6IU_js.a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}),v[e.id]&&jsxRuntime.jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:v[e.id]})]},e.id)})})]},c)})}),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:chunkE64TU6IU_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:F,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:h,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_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:chunkE64TU6IU_js.a("mb-6",r==null?void 0:r.header,x),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_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:chunkE64TU6IU_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 _e=({content:_,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:A,lastUpdated:n,classNames:i,unstyled:s=false})=>{let m=react.useId(),[$,S]=react.useState("preview"),X=`${m}-tab-preview`,F=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,v=(()=>{let h=_.split(`
7
- `),g=[];return h.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=h=>{if(M)M(h);else if(h==="markdown"){let g=document.createElement("a"),w=new Blob([_],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||v.length===0?null: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:v.map((h,g)=>jsxRuntime.jsx("li",{style:{marginLeft:`${(h.level-2)*1.5}rem`},children:jsxRuntime.jsx("a",{href:`#${h.id}`,className:"ndpr-text-primary hover:underline",children:h.title})},g))})]}),W=()=>P?jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsxRuntime.jsx("h1",{className:"ndpr-card__title",children:A?`${A} 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:chunkE64TU6IU_js.a("prose dark:prose-invert max-w-none",i==null?void 0:i.sectionContent,s),children:_.split(`
8
- `).map((h,g)=>{if(h.startsWith("## ")){let w=h.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h3",{id:C,className:chunkE64TU6IU_js.a("text-xl font-bold mt-6 mb-3",i==null?void 0:i.sectionTitle,s),children:w},g)}else if(h.startsWith("### ")){let w=h.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h4",{id:C,className:chunkE64TU6IU_js.a("text-lg font-bold mt-4 mb-2",i==null?void 0:i.sectionTitle,s),children:w},g)}else return h===""?jsxRuntime.jsx("br",{},g):jsxRuntime.jsx("p",{className:"mb-2",children:h},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:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,i==null?void 0:i.root,s),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex justify-between items-start mb-6",i==null?void 0:i.header,s),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",i==null?void 0:i.title,s),children:K}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("ndpr-card__subtitle",i==null?void 0:i.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:chunkE64TU6IU_js.a("ndpr-alert ndpr-alert--info",i==null?void 0:i.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:F,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-800 p-4 rounded-md",i==null?void 0:i.content,s),children:$==="preview"?jsxRuntime.jsxs("div",{role:"tabpanel",id:R,"aria-labelledby":X,"aria-live":"polite",children:[W(),G(),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",i==null?void 0:i.section,s),children:j()})]}):jsxRuntime.jsx("div",{role:"tabpanel",id:J,"aria-labelledby":F,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:_})})}),ee()]})};var Ae=({content:_,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:A,classNames:n,unstyled:i=false})=>{let s=react.useId(),[m,$]=react.useState([]),[S,X]=react.useState("pdf"),[F,R]=react.useState(false),[J,Z]=react.useState(null),[v,I]=react.useState(""),[G,W]=react.useState(""),[j,ee]=react.useState(""),[h,g]=react.useState(false),w=e=>{let y=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${y}.${e.toLowerCase()}`},C=e=>v?v.endsWith(`.${e.toLowerCase()}`)?v:`${v}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,y=M?M.toLocaleDateString():"N/A",u=`<!DOCTYPE html>
5
+ `;}),X(a),R(a),Z(true),$("preview");},h=()=>{L({sections:A,variables:i,content:N?F: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"}),A.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 i.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 b=A.find(e=>e.id===c);return b&&!b.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:b?b.title:"General Information"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:a.map(e=>{let y=`${P}-var-${e.id}`,u=e.description?`${P}-var-desc-${e.id}`:void 0,z=v[e.id]?`${P}-var-err-${e.id}`:void 0,O=[u,z].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:y,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:u,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsxRuntime.jsx("textarea",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),rows:4,className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxRuntime.jsxs("select",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]}):jsxRuntime.jsx("input",{id:y,type:e.inputType,value:e.value,onChange:E=>W(e.id,E.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}),v[e.id]&&jsxRuntime.jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:v[e.id]})]},e.id)})})]},c)})}),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:F,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:h,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return 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 _e=({content:_,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:A,lastUpdated:n,classNames:i,unstyled:s=false})=>{let m=react.useId(),[$,S]=react.useState("preview"),X=`${m}-tab-preview`,F=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,v=(()=>{let h=_.split(`
7
+ `),g=[];return h.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=h=>{if(M)M(h);else if(h==="markdown"){let g=document.createElement("a"),w=new Blob([_],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||v.length===0?null: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:v.map((h,g)=>jsxRuntime.jsx("li",{style:{marginLeft:`${(h.level-2)*1.5}rem`},children:jsxRuntime.jsx("a",{href:`#${h.id}`,className:"ndpr-text-primary hover:underline",children:h.title})},g))})]}),W=()=>P?jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsxRuntime.jsx("h1",{className:"ndpr-card__title",children:A?`${A} 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",i==null?void 0:i.sectionContent,s),children:_.split(`
8
+ `).map((h,g)=>{if(h.startsWith("## ")){let w=h.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h3",{id:C,className:chunkAME4HJR4_js.a("text-xl font-bold mt-6 mb-3",i==null?void 0:i.sectionTitle,s),children:w},g)}else if(h.startsWith("### ")){let w=h.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h4",{id:C,className:chunkAME4HJR4_js.a("text-lg font-bold mt-4 mb-2",i==null?void 0:i.sectionTitle,s),children:w},g)}else return h===""?jsxRuntime.jsx("br",{},g):jsxRuntime.jsx("p",{className:"mb-2",children:h},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}`,i==null?void 0:i.root,s),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-start mb-6",i==null?void 0:i.header,s),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",i==null?void 0:i.title,s),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",i==null?void 0:i.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",i==null?void 0:i.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:F,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-white dark:bg-gray-800 p-4 rounded-md",i==null?void 0:i.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",i==null?void 0:i.section,s),children:j()})]}):jsxRuntime.jsx("div",{role:"tabpanel",id:J,"aria-labelledby":F,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:_})})}),ee()]})};var Ae=({content:_,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:A,classNames:n,unstyled:i=false})=>{let s=react.useId(),[m,$]=react.useState([]),[S,X]=react.useState("pdf"),[F,R]=react.useState(false),[J,Z]=react.useState(null),[v,I]=react.useState(""),[G,W]=react.useState(""),[j,ee]=react.useState(""),[h,g]=react.useState(false),w=e=>{let y=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${y}.${e.toLowerCase()}`},C=e=>v?v.endsWith(`.${e.toLowerCase()}`)?v:`${v}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,y=M?M.toLocaleDateString():"N/A",u=`<!DOCTYPE html>
9
9
  <html lang="en">
10
10
  <head>
11
11
  <meta charset="UTF-8">
@@ -90,5 +90,4 @@
90
90
  <p>&copy; ${new Date().getFullYear()} ${L||"Company"}. All rights reserved.</p>
91
91
  </div>
92
92
  </body>
93
- </html>`,u},l=()=>chunkMQFZHA2D_js.d(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),y="",u;switch(e){case "pdf":let te=q();u=new Blob([te],{type:"text/html"}),y=URL.createObjectURL(u);break;case "docx":u=new Blob([_],{type:"text/plain"}),y=URL.createObjectURL(u);break;case "html":let pe=q();u=new Blob([pe],{type:"text/html"}),y=URL.createObjectURL(u);break;default:u=new Blob([_],{type:"text/markdown"}),y=URL.createObjectURL(u);break}let z=C(e),O=document.createElement("a");O.href=y,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let E={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:y,filename:z};$(te=>[E,...te]),V&&V(e,y);}catch(e){console.error("[ndpr-toolkit] Export error:",e),Z("An error occurred during export. Please try again.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],y=`${s}-export-format`;return jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-exporter",className:chunkE64TU6IU_js.a("mb-6",n==null?void 0:n.formatSelector,i),children:[jsxRuntime.jsx("label",{htmlFor:y,className:"ndpr-form-field__label",children:"Export Format"}),jsxRuntime.jsx("select",{id:y,value:S,onChange:u=>X(u.target.value),className:chunkE64TU6IU_js.a("ndpr-form-field__input",n==null?void 0:n.formatOption,i),children:e.map(u=>jsxRuntime.jsx("option",{value:u.value,children:u.label},u.value))})]})},a=()=>h?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:v,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"}),b=()=>!N||m.length===0?null:jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-6",n==null?void 0:n.preview,i),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:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,i),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6",n==null?void 0:n.header,i),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("ndpr-section-heading",n==null?void 0:n.title,i),children:K}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("ndpr-card__subtitle",n==null?void 0:n.description,i),children:T})]}),c(),a(),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("button",{onClick:l,disabled:F,className:chunkE64TU6IU_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${B} ${F?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),i),children:F?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsxRuntime.jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,i),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."})]})]}),b()]})};exports.a=ye;exports.b=_e;exports.c=Ae;//# sourceMappingURL=chunk-LWXZMKC2.js.map
94
- //# sourceMappingURL=chunk-LWXZMKC2.js.map
93
+ </html>`,u},l=()=>chunkRFPLZDIO_js.d(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),y="",u;switch(e){case "pdf":let te=q();u=new Blob([te],{type:"text/html"}),y=URL.createObjectURL(u);break;case "docx":u=new Blob([_],{type:"text/plain"}),y=URL.createObjectURL(u);break;case "html":let pe=q();u=new Blob([pe],{type:"text/html"}),y=URL.createObjectURL(u);break;default:u=new Blob([_],{type:"text/markdown"}),y=URL.createObjectURL(u);break}let z=C(e),O=document.createElement("a");O.href=y,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let E={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:y,filename:z};$(te=>[E,...te]),V&&V(e,y);}catch(e){console.error("[ndpr-toolkit] Export error:",e),Z("An error occurred during export. Please try again.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],y=`${s}-export-format`;return jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-exporter",className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.formatSelector,i),children:[jsxRuntime.jsx("label",{htmlFor:y,className:"ndpr-form-field__label",children:"Export Format"}),jsxRuntime.jsx("select",{id:y,value:S,onChange:u=>X(u.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",n==null?void 0:n.formatOption,i),children:e.map(u=>jsxRuntime.jsx("option",{value:u.value,children:u.label},u.value))})]})},a=()=>h?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:v,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"}),b=()=>!N||m.length===0?null:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mt-6",n==null?void 0:n.preview,i),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,i),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.header,i),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",n==null?void 0:n.title,i),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",n==null?void 0:n.description,i),children:T})]}),c(),a(),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("button",{onClick:l,disabled:F,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} ${F?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),i),children:F?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&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,i),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."})]})]}),b()]})};exports.a=ye;exports.b=_e;exports.c=Ae;