@tantainnovative/ndpr-toolkit 3.12.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +1 -1
  3. package/dist/breach.d.mts +3 -2
  4. package/dist/breach.d.ts +3 -2
  5. package/dist/breach.js +1 -1
  6. package/dist/breach.mjs +1 -1
  7. package/dist/chunk-37VFK5SR.js +6 -0
  8. package/dist/chunk-3E4IH7CE.js +1 -0
  9. package/dist/chunk-3H6FYU3Z.mjs +93 -0
  10. package/dist/chunk-3I6FYA5C.js +103 -0
  11. package/dist/chunk-3SIYRGJF.js +93 -0
  12. package/dist/chunk-3XU6FL2I.js +1 -0
  13. package/dist/chunk-42JPSNVV.mjs +6 -0
  14. package/dist/chunk-42UJFTII.js +1 -0
  15. package/dist/chunk-5F2IAUWJ.js +1 -0
  16. package/dist/chunk-63WM5PHZ.js +1 -0
  17. package/dist/chunk-6A6VI7ZP.mjs +1 -0
  18. package/dist/chunk-7FXNGGMO.js +1 -0
  19. package/dist/chunk-B2EXRSYG.mjs +1 -0
  20. package/dist/chunk-BGV2AKT7.mjs +1 -0
  21. package/dist/chunk-BL5W472Q.js +1 -0
  22. package/dist/chunk-BPMVJOHH.mjs +1 -0
  23. package/dist/chunk-D2UWB5OI.js +2 -0
  24. package/dist/chunk-DK7P5JEG.mjs +2 -0
  25. package/dist/chunk-ELK6VFKC.mjs +2 -0
  26. package/dist/chunk-F5MGMNQF.js +2 -0
  27. package/dist/chunk-FRQFU44F.mjs +1 -0
  28. package/dist/chunk-GUERZD4O.mjs +1 -0
  29. package/dist/{chunk-WYH3OA5L.mjs → chunk-I2ZBMR7F.mjs} +1 -1
  30. package/dist/chunk-J7BIJ45O.mjs +103 -0
  31. package/dist/{chunk-US2VGJ7I.js → chunk-KH3EQJQE.js} +1 -1
  32. package/dist/{chunk-IPWX5I5P.mjs → chunk-L3FR4PQE.mjs} +1 -1
  33. package/dist/chunk-N72RNTGP.mjs +6 -0
  34. package/dist/chunk-NB6SKG76.mjs +1 -0
  35. package/dist/chunk-RBKFNCGO.mjs +1 -0
  36. package/dist/chunk-TTMGFC6C.js +1 -0
  37. package/dist/{chunk-TWJHEIQH.js → chunk-UZNWXJ2W.js} +1 -1
  38. package/dist/chunk-V5TZJJWU.mjs +1 -0
  39. package/dist/chunk-WCTFED27.js +1 -0
  40. package/dist/chunk-WMISQDSV.js +1 -0
  41. package/dist/{chunk-MTSZ7GL6.mjs → chunk-WVHMY2BV.mjs} +1 -1
  42. package/dist/chunk-XYGGUGTO.js +6 -0
  43. package/dist/chunk-YDKWD6MQ.js +1 -0
  44. package/dist/chunk-Z2M5VJX2.mjs +1 -0
  45. package/dist/{chunk-D3DVVJCT.js → chunk-ZD2W3YU2.js} +1 -1
  46. package/dist/chunk-ZQHGIOYP.mjs +1 -0
  47. package/dist/consent.js +1 -1
  48. package/dist/consent.mjs +1 -1
  49. package/dist/core.d.mts +62 -0
  50. package/dist/core.d.ts +62 -0
  51. package/dist/core.js +1 -1
  52. package/dist/core.mjs +1 -1
  53. package/dist/cross-border-lite.js +1 -1
  54. package/dist/cross-border-lite.mjs +1 -1
  55. package/dist/cross-border.js +1 -1
  56. package/dist/cross-border.mjs +1 -1
  57. package/dist/dpia.js +1 -1
  58. package/dist/dpia.mjs +1 -1
  59. package/dist/dsr.d.mts +12 -3
  60. package/dist/dsr.d.ts +12 -3
  61. package/dist/dsr.js +1 -1
  62. package/dist/dsr.mjs +1 -1
  63. package/dist/headless.d.mts +12 -3
  64. package/dist/headless.d.ts +12 -3
  65. package/dist/headless.js +1 -1
  66. package/dist/headless.mjs +1 -1
  67. package/dist/hooks.d.mts +12 -3
  68. package/dist/hooks.d.ts +12 -3
  69. package/dist/hooks.js +1 -1
  70. package/dist/hooks.mjs +1 -1
  71. package/dist/index.d.mts +77 -5
  72. package/dist/index.d.ts +77 -5
  73. package/dist/index.js +1 -1
  74. package/dist/index.mjs +1 -1
  75. package/dist/lawful-basis-lite.js +1 -1
  76. package/dist/lawful-basis-lite.mjs +1 -1
  77. package/dist/lawful-basis.js +1 -1
  78. package/dist/lawful-basis.mjs +1 -1
  79. package/dist/policy.js +1 -1
  80. package/dist/policy.mjs +1 -1
  81. package/dist/presets-consent.d.mts +5 -1
  82. package/dist/presets-consent.d.ts +5 -1
  83. package/dist/presets-consent.js +1 -1
  84. package/dist/presets-consent.mjs +1 -1
  85. package/dist/presets-dsr.js +1 -1
  86. package/dist/presets-dsr.mjs +1 -1
  87. package/dist/presets-policy.d.mts +23 -0
  88. package/dist/presets-policy.d.ts +23 -0
  89. package/dist/presets-policy.js +1 -1
  90. package/dist/presets-policy.mjs +1 -1
  91. package/dist/presets.d.mts +221 -4
  92. package/dist/presets.d.ts +221 -4
  93. package/dist/presets.js +1 -1
  94. package/dist/presets.mjs +1 -1
  95. package/dist/ropa-lite.js +1 -1
  96. package/dist/ropa-lite.mjs +1 -1
  97. package/dist/ropa.js +1 -1
  98. package/dist/ropa.mjs +1 -1
  99. package/dist/server.d.mts +62 -0
  100. package/dist/server.d.ts +62 -0
  101. package/dist/server.js +1 -1
  102. package/dist/server.mjs +1 -1
  103. package/dist/unstyled.js +1 -1
  104. package/dist/unstyled.mjs +1 -1
  105. package/package.json +3 -3
  106. package/dist/chunk-25TNTLHJ.mjs +0 -1
  107. package/dist/chunk-4GIMXUMI.js +0 -6
  108. package/dist/chunk-5AECGMEB.js +0 -1
  109. package/dist/chunk-5EKQX6GM.mjs +0 -1
  110. package/dist/chunk-67KA345Q.mjs +0 -1
  111. package/dist/chunk-6GM2PBTF.js +0 -2
  112. package/dist/chunk-6OWCUDTN.mjs +0 -1
  113. package/dist/chunk-73BMSK67.js +0 -1
  114. package/dist/chunk-CAFCRCTZ.mjs +0 -1
  115. package/dist/chunk-EKNWO4DK.js +0 -1
  116. package/dist/chunk-FMJ6ICLJ.js +0 -1
  117. package/dist/chunk-G7JKRYM5.mjs +0 -1
  118. package/dist/chunk-GEP52QFH.mjs +0 -1
  119. package/dist/chunk-IB3KSUPZ.mjs +0 -1
  120. package/dist/chunk-JWAN5J4Y.js +0 -1
  121. package/dist/chunk-JYZOKO2W.mjs +0 -103
  122. package/dist/chunk-NDKDKDDX.js +0 -1
  123. package/dist/chunk-NX5MOBRI.js +0 -1
  124. package/dist/chunk-OLEUIYE2.mjs +0 -1
  125. package/dist/chunk-Q4CSVWSS.mjs +0 -1
  126. package/dist/chunk-QMAVEHOR.js +0 -1
  127. package/dist/chunk-RBMLGRDN.mjs +0 -1
  128. package/dist/chunk-ROC64RLP.js +0 -1
  129. package/dist/chunk-RR3KXNET.mjs +0 -6
  130. package/dist/chunk-TDHH7GS2.mjs +0 -2
  131. package/dist/chunk-TN4TH3CT.mjs +0 -2
  132. package/dist/chunk-VUFTRKKC.js +0 -2
  133. package/dist/chunk-WKTKTLMF.js +0 -1
  134. package/dist/chunk-WXUXCRAJ.js +0 -1
  135. package/dist/chunk-XN2UYZXH.mjs +0 -93
  136. package/dist/chunk-YK22SYCT.js +0 -103
  137. package/dist/chunk-YSD2DFBR.js +0 -6
  138. package/dist/chunk-YWCBI7SI.js +0 -93
  139. package/dist/chunk-ZHX62QAL.mjs +0 -6
@@ -1,93 +0,0 @@
1
- 'use strict';var chunkD2ZKDQVL_js=require('./chunk-D2ZKDQVL.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ye=({sections:E=chunkD2ZKDQVL_js.c,variables:U=chunkD2ZKDQVL_js.d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=react.useId(),[F,n]=react.useState(E),[o,s]=react.useState(U),[m,$]=react.useState("sections"),[S,X]=react.useState(""),[A,R]=react.useState(""),[J,Z]=react.useState(false),[h,I]=react.useState({});react.useEffect(()=>{n(E);},[E]),react.useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(f=>f.id===l?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},f),{value:c}):f)),h[l]&&I(a=>{let f=chunkRFPLZDIO_js.a({},a);return delete f[l],f});},j=()=>{let l={},c=true;return o.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=F.filter(f=>f.included),c=Object.fromEntries(o.map(f=>[f.name,f.value])),a="";l.forEach(f=>{a+=`## ${f.title}
2
-
3
- `,a+=chunkD2ZKDQVL_js.b(f.template,c),a+=`
4
-
5
- `;}),X(a),R(a),Z(true),$("preview");},y=()=>{L({sections:F,variables:o,content:N?A:S});},g=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-generator",className:chunkAME4HJR4_js.a("ndpr-form-section",r==null?void 0:r.sectionList,x),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsxRuntime.jsx("h3",{id:`${P}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),F.map(l=>{let c=`${P}-section-${l.id}`,a=l.description?`${P}-section-desc-${l.id}`:void 0;return jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,x),children:jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":a,className:chunkAME4HJR4_js.a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",r==null?void 0:r.input,x)})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[l.title," ",l.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsxRuntime.jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsxRuntime.jsx("p",{id:a,className:"ndpr-text-muted mt-1",children:l.description})]})]})},l.id)}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return o.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",r==null?void 0:r.form,x),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:Object.entries(l).map(([c,a])=>{let f=F.find(e=>e.id===c);return f&&!f.included?null:jsxRuntime.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsx("h4",{className:"font-medium text-lg mb-3",children:f?f.title:"General Information"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:a.map(e=>{let u=`${P}-var-${e.id}`,b=e.description?`${P}-var-desc-${e.id}`:void 0,z=h[e.id]?`${P}-var-err-${e.id}`:void 0,O=[b,z].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:u,className:"ndpr-form-field__label",children:[e.name," ",e.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsxRuntime.jsx("p",{id:b,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsxRuntime.jsx("textarea",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),rows:4,className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxRuntime.jsxs("select",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(_=>jsxRuntime.jsx("option",{value:_,children:_},_))]}):jsxRuntime.jsx("input",{id:u,type:e.inputType,value:e.value,onChange:_=>W(e.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}),h[e.id]&&jsxRuntime.jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:h[e.id]})]},e.id)})})]},c)})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Sections"}),jsxRuntime.jsx("button",{onClick:ee,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),N?jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:l,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsxRuntime.jsx("textarea",{id:l,value:A,onChange:c=>R(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsxRuntime.jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsxRuntime.jsx("div",{className:"prose dark:prose-invert max-w-none",children:S.split(`
6
- `).map((c,a)=>c.startsWith("## ")?jsxRuntime.jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},a):c.startsWith("### ")?jsxRuntime.jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},a):c===""?jsxRuntime.jsx("br",{},a):jsxRuntime.jsx("p",{className:"mb-2",children:c},a))})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Variables"}),jsxRuntime.jsx("button",{onClick:y,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${K}`,r==null?void 0:r.root,x),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",r==null?void 0:r.header,x),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",r==null?void 0:r.description,x),children:V})]}),jsxRuntime.jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxRuntime.jsxs("ol",{className:"flex items-center w-full",children:[jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="sections"?"step":void 0,children:"1"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="sections"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="variables"?"step":void 0,children:"2"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="variables"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex items-center ${m==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="preview"?"step":void 0,children:"3"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="preview"?" (current step)":""})]})]})}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",r==null?void 0:r.complianceNotice,x),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),q()]})};var Ee=({content:E,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:F,lastUpdated:n,classNames:o,unstyled:s=false})=>{let m=react.useId(),[$,S]=react.useState("preview"),X=`${m}-tab-preview`,A=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,h=(()=>{let y=E.split(`
7
- `),g=[];return y.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=y=>{if(M)M(y);else if(y==="markdown"){let g=document.createElement("a"),w=new Blob([E],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||h.length===0?null:jsxRuntime.jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsxRuntime.jsx("ul",{className:"space-y-1",children:h.map((y,g)=>jsxRuntime.jsx("li",{style:{marginLeft:`${(y.level-2)*1.5}rem`},children:jsxRuntime.jsx("a",{href:`#${y.id}`,className:"ndpr-text-primary hover:underline",children:y.title})},g))})]}),W=()=>P?jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsxRuntime.jsx("h1",{className:"ndpr-card__title",children:F?`${F} Privacy Policy`:"Privacy Policy"}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",n?n.toLocaleDateString():"N/A"]})]}):null,j=()=>jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("prose dark:prose-invert max-w-none",o==null?void 0:o.sectionContent,s),children:E.split(`
8
- `).map((y,g)=>{if(y.startsWith("## ")){let w=y.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h3",{id:C,className:chunkAME4HJR4_js.a("text-xl font-bold mt-6 mb-3",o==null?void 0:o.sectionTitle,s),children:w},g)}else if(y.startsWith("### ")){let w=y.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h4",{id:C,className:chunkAME4HJR4_js.a("text-lg font-bold mt-4 mb-2",o==null?void 0:o.sectionTitle,s),children:w},g)}else return y===""?jsxRuntime.jsx("br",{},g):jsxRuntime.jsx("p",{className:"mb-2",children:y},g)})}),ee=()=>N?jsxRuntime.jsxs("div",{className:"mt-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[jsxRuntime.jsx("button",{onClick:()=>I("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as PDF"}),jsxRuntime.jsx("button",{onClick:()=>I("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as DOCX"}),jsxRuntime.jsx("button",{onClick:()=>I("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as HTML"}),jsxRuntime.jsx("button",{onClick:()=>I("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as Markdown"})]})]}):null;return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o==null?void 0:o.root,s),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-start mb-6",o==null?void 0:o.header,s),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",o==null?void 0:o.title,s),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",o==null?void 0:o.description,s),children:T})]}),r&&V&&jsxRuntime.jsx("button",{onClick:V,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${B}`,children:"Edit Policy"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",o==null?void 0:o.complianceNotice,s),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsxRuntime.jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxRuntime.jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:X,"aria-selected":$==="preview","aria-controls":R,onClick:()=>S("preview"),className:`inline-block p-4 ${$==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:A,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-white dark:bg-gray-800 p-4 rounded-md",o==null?void 0:o.content,s),children:$==="preview"?jsxRuntime.jsxs("div",{role:"tabpanel",id:R,"aria-labelledby":X,"aria-live":"polite",children:[W(),G(),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",o==null?void 0:o.section,s),children:j()})]}):jsxRuntime.jsx("div",{role:"tabpanel",id:J,"aria-labelledby":A,children:jsxRuntime.jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:E})})}),ee()]})};var Fe=({content:E,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:F,classNames:n,unstyled:o=false})=>{let s=react.useId(),[m,$]=react.useState([]),[S,X]=react.useState("pdf"),[A,R]=react.useState(false),[J,Z]=react.useState(null),[h,I]=react.useState(""),[G,W]=react.useState(""),[j,ee]=react.useState(""),[y,g]=react.useState(false),w=e=>{let u=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${u}.${e.toLowerCase()}`},C=e=>h?h.endsWith(`.${e.toLowerCase()}`)?h:`${h}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,u=M?M.toLocaleDateString():"N/A",b=`<!DOCTYPE html>
9
- <html lang="en">
10
- <head>
11
- <meta charset="UTF-8">
12
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
13
- <title>${e}</title>
14
- <style>
15
- body {
16
- font-family: Arial, sans-serif;
17
- line-height: 1.6;
18
- color: #333;
19
- max-width: 800px;
20
- margin: 0 auto;
21
- padding: 20px;
22
- }
23
- h1 {
24
- font-size: 24px;
25
- margin-bottom: 10px;
26
- }
27
- h2 {
28
- font-size: 20px;
29
- margin-top: 30px;
30
- margin-bottom: 10px;
31
- border-bottom: 1px solid #eee;
32
- padding-bottom: 5px;
33
- }
34
- h3 {
35
- font-size: 18px;
36
- margin-top: 20px;
37
- margin-bottom: 10px;
38
- }
39
- p {
40
- margin-bottom: 15px;
41
- }
42
- .header {
43
- text-align: center;
44
- margin-bottom: 30px;
45
- }
46
- .footer {
47
- margin-top: 50px;
48
- text-align: center;
49
- font-size: 12px;
50
- color: #666;
51
- border-top: 1px solid #eee;
52
- padding-top: 20px;
53
- }
54
- .logo {
55
- max-width: 200px;
56
- margin-bottom: 20px;
57
- }
58
- .last-updated {
59
- font-size: 12px;
60
- color: #666;
61
- margin-bottom: 30px;
62
- }
63
- .compliance-notice {
64
- background-color: #f8f9fa;
65
- border: 1px solid #e9ecef;
66
- padding: 15px;
67
- margin-bottom: 30px;
68
- font-size: 14px;
69
- }
70
- ${F||""}
71
- </style>
72
- </head>
73
- <body>
74
- <div class="header">
75
- ${x&&P?`<img src="${P}" alt="${L||"Company"} Logo" class="logo">`:""}
76
- ${G?`<div class="custom-header">${G}</div>`:""}
77
- <h1>${e}</h1>
78
- <div class="last-updated">Last Updated: ${u}</div>
79
- </div>`;r&&(b+=`
80
- <div class="compliance-notice">
81
- <strong>NDPA Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Act (NDPA) 2023.
82
- It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPA requirements.
83
- </div>`);let z=E.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return b+=`
84
- <div class="content">
85
- <p>${z}</p>
86
- </div>
87
-
88
- <div class="footer">
89
- ${j?`<div class="custom-footer">${j}</div>`:""}
90
- <p>&copy; ${new Date().getFullYear()} ${L||"Company"}. All rights reserved.</p>
91
- </div>
92
- </body>
93
- </html>`,b},l=()=>chunkRFPLZDIO_js.d(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),u="",b;switch(e){case "pdf":let te=q();b=new Blob([te],{type:"text/html"}),u=URL.createObjectURL(b);break;case "docx":b=new Blob([E],{type:"text/plain"}),u=URL.createObjectURL(b);break;case "html":let pe=q();b=new Blob([pe],{type:"text/html"}),u=URL.createObjectURL(b);break;default:b=new Blob([E],{type:"text/markdown"}),u=URL.createObjectURL(b);break}let z=C(e),O=document.createElement("a");O.href=u,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let _={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:u,filename:z};$(te=>[_,...te]),V&&V(e,u);}catch(e){console.error("[ndpr-toolkit/policy] Export failed:",e);let u=e instanceof Error&&e.message?e.message.length>200?`${e.message.slice(0,200)}\u2026`:e.message:null;Z(u?`[ndpr-toolkit/policy] Export failed: ${u}`:"[ndpr-toolkit/policy] Export failed \u2014 see the browser console for the underlying error.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],u=`${s}-export-format`;return jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-exporter",className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.formatSelector,o),children:[jsxRuntime.jsx("label",{htmlFor:u,className:"ndpr-form-field__label",children:"Export Format"}),jsxRuntime.jsx("select",{id:u,value:S,onChange:b=>X(b.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",n==null?void 0:n.formatOption,o),children:e.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})]})},a=()=>y?jsxRuntime.jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsxRuntime.jsx("input",{type:"text",id:`${s}-custom-filename`,value:h,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsxRuntime.jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsxRuntime.jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),f=()=>!N||m.length===0?null:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mt-6",n==null?void 0:n.preview,o),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsxRuntime.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsxRuntime.jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsxRuntime.jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,o),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.header,o),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",n==null?void 0:n.title,o),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",n==null?void 0:n.description,o),children:T})]}),c(),a(),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("button",{onClick:l,disabled:A,className:chunkAME4HJR4_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${B} ${A?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),o),children:A?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsxRuntime.jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,o),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxRuntime.jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsxRuntime.jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsxRuntime.jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsxRuntime.jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsxRuntime.jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),f()]})};exports.a=ye;exports.b=Ee;exports.c=Fe;
@@ -1,6 +0,0 @@
1
- import {e,g,h,f}from'./chunk-7BJXI2HI.mjs';import {a as a$1}from'./chunk-SFGW37LE.mjs';import {b,a}from'./chunk-ZJYULEER.mjs';import {useState,useMemo,useEffect,useCallback}from'react';import {jsxs,jsx}from'react/jsx-runtime';var L=[{value:"adequacy_decision",label:"Adequacy Decision (Section 41)"},{value:"standard_clauses",label:"Standard Contractual Clauses (Section 42)"},{value:"binding_corporate_rules",label:"Binding Corporate Rules (Section 43)"},{value:"ndpc_authorization",label:"NDPC Authorization (Section 44)"},{value:"explicit_consent",label:"Explicit Consent (Section 45(a))"},{value:"contract_performance",label:"Contract Performance (Section 45(b))"},{value:"public_interest",label:"Public Interest (Section 45(c))"},{value:"legal_claims",label:"Legal Claims (Section 45(d))"},{value:"vital_interests",label:"Vital Interests (Section 45(e))"}],J=[{value:"adequate",label:"Adequate"},{value:"inadequate",label:"Inadequate"},{value:"pending_review",label:"Pending Review"},{value:"unknown",label:"Unknown"}],X=[{value:"one_time",label:"One-Time"},{value:"periodic",label:"Periodic"},{value:"continuous",label:"Continuous"}],Z=[{value:"active",label:"Active"},{value:"suspended",label:"Suspended"},{value:"terminated",label:"Terminated"},{value:"pending_approval",label:"Pending Approval"}],ge={low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--destructive"},he={active:"ndpr-badge ndpr-badge--success",suspended:"ndpr-badge ndpr-badge--warning",terminated:"ndpr-badge ndpr-badge--neutral",pending_approval:"ndpr-badge ndpr-badge--info"},Ce={active:"Active",suspended:"Suspended",terminated:"Terminated",pending_approval:"Pending Approval"},ee={destinationCountry:"",destinationCountryCode:"",adequacyStatus:"unknown",transferMechanism:"adequacy_decision",dataCategories:"",includesSensitiveData:false,estimatedDataSubjects:"",recipientOrganization:"",recipientContactName:"",recipientContactEmail:"",recipientContactPhone:"",recipientContactAddress:"",purpose:"",safeguards:"",riskAssessment:"",riskLevel:"medium",frequency:"one_time",status:"active",tiaCompleted:false,tiaReference:"",ndpcApprovalApplied:false,ndpcApprovalApproved:false,ndpcApprovalReference:""},ke=({transfers:g$1,onAddTransfer:q,onUpdateTransfer:w,onRemoveTransfer:F,summary:B,title:te="Cross-Border Data Transfer Manager",description:re="Manage and document cross-border personal data transfers in compliance with NDPA 2023 Part VIII (Sections 41-43).",className:ae="",buttonClassName:M="",showSummary:ie=true,showTIA:ne=true,classNames:r,unstyled:d})=>{let[f$1,y]=useState(null),[j,S]=useState(false),[h$1,z]=useState(null),[n,P]=useState(ee),[C,$]=useState(null),[k,de]=useState("all"),[T,pe]=useState("all"),A=useMemo(()=>{let t=[...g$1];return k!=="all"&&(t=t.filter(a=>a.status===k)),T!=="all"&&(t=t.filter(a=>a.transferMechanism===T)),t.sort((a,o)=>o.updatedAt-a.updatedAt),t},[g$1,k,T]);useEffect(()=>{A.length>0&&!f$1&&y(A[0].id);},[A,f$1]);let U=useMemo(()=>{var t;return f$1&&(t=g$1.find(a=>a.id===f$1))!=null?t:null},[g$1,f$1]),x=useCallback(t=>new Date(t).toLocaleDateString(),[]),_=useCallback(()=>{P(ee),z(null),$(null);},[]),oe=useCallback(()=>{_(),S(true);},[_]),le=useCallback(t=>{var a,o,u,v;z(t.id),P({destinationCountry:t.destinationCountry,destinationCountryCode:t.destinationCountryCode||"",adequacyStatus:t.adequacyStatus,transferMechanism:t.transferMechanism,dataCategories:t.dataCategories.join(", "),includesSensitiveData:t.includesSensitiveData,estimatedDataSubjects:((a=t.estimatedDataSubjects)==null?void 0:a.toString())||"",recipientOrganization:t.recipientOrganization,recipientContactName:t.recipientContact.name,recipientContactEmail:t.recipientContact.email,recipientContactPhone:t.recipientContact.phone||"",recipientContactAddress:t.recipientContact.address||"",purpose:t.purpose,safeguards:t.safeguards.join(`
2
- `),riskAssessment:t.riskAssessment,riskLevel:t.riskLevel,frequency:t.frequency,status:t.status,tiaCompleted:t.tiaCompleted,tiaReference:t.tiaReference||"",ndpcApprovalApplied:((o=t.ndpcApproval)==null?void 0:o.applied)||false,ndpcApprovalApproved:((u=t.ndpcApproval)==null?void 0:u.approved)||false,ndpcApprovalReference:((v=t.ndpcApproval)==null?void 0:v.referenceNumber)||""}),S(true);},[]),l=useCallback((t,a$1)=>{P(o=>b(a({},o),{[t]:a$1}));},[]),V=useCallback(()=>{let t=e(n.transferMechanism),a=Date.now();return {destinationCountry:n.destinationCountry.trim(),destinationCountryCode:n.destinationCountryCode.trim()||void 0,adequacyStatus:n.adequacyStatus,transferMechanism:n.transferMechanism,dataCategories:n.dataCategories.split(",").map(o=>o.trim()).filter(Boolean),includesSensitiveData:n.includesSensitiveData,estimatedDataSubjects:n.estimatedDataSubjects?parseInt(n.estimatedDataSubjects,10):void 0,recipientOrganization:n.recipientOrganization.trim(),recipientContact:{name:n.recipientContactName.trim(),email:n.recipientContactEmail.trim(),phone:n.recipientContactPhone.trim()||void 0,address:n.recipientContactAddress.trim()||void 0},purpose:n.purpose.trim(),safeguards:n.safeguards.split(`
3
- `).map(o=>o.trim()).filter(Boolean),riskAssessment:n.riskAssessment.trim(),riskLevel:n.riskLevel,frequency:n.frequency,status:t&&!n.ndpcApprovalApproved?"pending_approval":n.status,tiaCompleted:n.tiaCompleted,tiaReference:n.tiaReference.trim()||void 0,ndpcApproval:t?{required:true,applied:n.ndpcApprovalApplied,approved:n.ndpcApprovalApproved||void 0,referenceNumber:n.ndpcApprovalReference.trim()||void 0,appliedAt:n.ndpcApprovalApplied?a:void 0,approvedAt:n.ndpcApprovalApproved?a:void 0}:void 0,startDate:a,reviewDate:a+365*24*60*60*1e3}},[n]),se=useCallback(()=>{let t=V(),a$1=a({id:h$1||"temp",createdAt:Date.now(),updatedAt:Date.now()},t),o=g(a$1);$(o),o.isValid&&(h$1?w&&w(h$1,t):q&&q(t),_(),S(false));},[V,h$1,w,q,_]),G=useCallback(()=>{_(),S(false);},[_]),ce=useCallback(t=>{F&&F(t),f$1===t&&y(null);},[F,f$1]),H=useCallback(t=>jsxs("span",{className:a$1(`px-2 py-1 rounded text-xs font-medium ${ge[t]}`,r==null?void 0:r.riskBadge,d),children:[t.charAt(0).toUpperCase()+t.slice(1)," Risk"]}),[r==null?void 0:r.riskBadge,d]),K=useCallback(t=>jsx("span",{className:a$1(`px-2 py-1 rounded text-xs font-medium ${he[t]}`,r==null?void 0:r.statusBadge,d),children:Ce[t]}),[r==null?void 0:r.statusBadge,d]),ue=useCallback(t=>{var u;e(t);let o=((u=L.find(v=>v.value===t))==null?void 0:u.label)||t;return jsx("span",{className:"px-2 py-1 rounded text-xs font-medium ndpr-badge ndpr-badge--info",children:o})},[]),D=useMemo(()=>{var v,c;if(B)return B;let t=0,a=[],o=[],u=[];for(let s of g$1){let I=s.status==="active";I&&t++,(s.status==="pending_approval"||(v=s.ndpcApproval)!=null&&v.required&&!((c=s.ndpcApproval)!=null&&c.approved))&&a.push(s),s.riskLevel==="high"&&I&&o.push(s),!s.tiaCompleted&&I&&u.push(s);}return {totalActiveTransfers:t,pendingApproval:a,highRiskTransfers:o,missingTIA:u,byMechanism:{},byAdequacy:{},dueForReview:[],lastUpdated:Date.now()}},[B,g$1]),me=()=>jsxs("div",{"data-ndpr-component":"cross-border-transfer-manager",role:"status","aria-label":"Transfer compliance summary",className:a$1("mb-6 grid grid-cols-2 md:grid-cols-4 gap-4",r==null?void 0:r.summary,d),children:[jsxs("div",{className:a$1("ndpr-alert ndpr-alert--info",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:D.totalActiveTransfers}),jsx("p",{className:"text-sm ndpr-text-info",children:"Active Transfers"})]}),jsxs("div",{className:a$1("ndpr-alert ndpr-alert--info",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:D.pendingApproval.length}),jsx("p",{className:"text-sm ndpr-text-info",children:"Pending Approval"})]}),jsxs("div",{className:a$1("ndpr-alert ndpr-alert--destructive",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:D.highRiskTransfers.length}),jsx("p",{className:"text-sm ndpr-text-destructive",children:"High Risk"})]}),jsxs("div",{className:a$1("ndpr-alert ndpr-alert--warning",r==null?void 0:r.summaryCard,d),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:D.missingTIA.length}),jsx("p",{className:"text-sm ndpr-text-warning",children:"Missing TIA"})]})]}),ve=()=>{let t=e(n.transferMechanism);return jsxs("div",{className:a$1("bg-gray-50 dark:bg-gray-700 p-6 rounded-lg mb-6",r==null?void 0:r.form,d),children:[jsxs("div",{className:a$1("flex justify-between items-center mb-4",r==null?void 0:r.header,d),children:[jsx("h3",{className:"ndpr-section-heading",children:h$1?"Edit Transfer":"Add New Transfer"}),jsx("button",{onClick:G,"aria-label":"Cancel form",className:"text-gray-600 hover:ndpr-text-muted dark:hover:text-gray-200",children:"Cancel"})]}),C&&!C.isValid&&jsxs("div",{id:"cb-form-errors",role:"alert",className:"ndpr-alert ndpr-alert--destructive",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-destructive",children:C.errors.map((a,o)=>jsx("li",{children:a},o))})]}),C&&C.warnings.length>0&&jsxs("div",{id:"cb-form-warnings",role:"alert",className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm font-medium ndpr-text-warning mb-1",children:"Warnings:"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-warning",children:C.warnings.map((a,o)=>jsx("li",{children:a},o))})]}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"cb-destinationCountry",className:"ndpr-form-field__label",children:["Destination Country ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-destinationCountry",type:"text",value:n.destinationCountry,onChange:a=>l("destinationCountry",a.target.value),placeholder:"e.g. United Kingdom","aria-required":"true","aria-describedby":"cb-form-errors","aria-label":"Destination country",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-destinationCountryCode",className:"ndpr-form-field__label",children:"Country Code (ISO)"}),jsx("input",{id:"cb-destinationCountryCode",type:"text",value:n.destinationCountryCode,onChange:a=>l("destinationCountryCode",a.target.value),placeholder:"e.g. GB",maxLength:3,"aria-label":"Country code in ISO format",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-recipientOrganization",className:"ndpr-form-field__label",children:["Recipient Organization ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-recipientOrganization",type:"text",value:n.recipientOrganization,onChange:a=>l("recipientOrganization",a.target.value),placeholder:"Organization name","aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-transferMechanism",className:"ndpr-form-field__label",children:["Transfer Mechanism ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("select",{id:"cb-transferMechanism",value:n.transferMechanism,onChange:a=>l("transferMechanism",a.target.value),"aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:L.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-adequacyStatus",className:"ndpr-form-field__label",children:"Adequacy Status"}),jsx("select",{id:"cb-adequacyStatus",value:n.adequacyStatus,onChange:a=>l("adequacyStatus",a.target.value),"aria-label":"Select adequacy status of destination country",className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:J.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-riskLevel",className:"ndpr-form-field__label",children:"Risk Level"}),jsxs("select",{id:"cb-transfer-riskLevel",value:n.riskLevel,onChange:a=>l("riskLevel",a.target.value),className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsx("option",{value:"low",children:"Low"}),jsx("option",{value:"medium",children:"Medium"}),jsx("option",{value:"high",children:"High"})]})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-dataCategories",className:"ndpr-form-field__label",children:["Data Categories ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-dataCategories",type:"text",value:n.dataCategories,onChange:a=>l("dataCategories",a.target.value),placeholder:"Comma-separated, e.g. Names, Email addresses, Phone numbers","aria-required":"true","aria-describedby":"cb-dataCategories-help",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)}),jsx("p",{id:"cb-dataCategories-help",className:"text-xs text-gray-500 mt-1",children:"Separate categories with commas"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"includesSensitiveData",checked:n.includesSensitiveData,onChange:a=>l("includesSensitiveData",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"includesSensitiveData",className:"ndpr-text-sm ndpr-font-medium",children:"Includes sensitive personal data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-estimatedDataSubjects",className:"ndpr-form-field__label",children:"Estimated Data Subjects"}),jsx("input",{id:"cb-transfer-estimatedDataSubjects",type:"number",value:n.estimatedDataSubjects,onChange:a=>l("estimatedDataSubjects",a.target.value),placeholder:"Number of data subjects",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-recipientContactName",className:"ndpr-form-field__label",children:["Recipient Contact Name ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-recipientContactName",type:"text",value:n.recipientContactName,onChange:a=>l("recipientContactName",a.target.value),placeholder:"Contact person name","aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"cb-recipientContactEmail",className:"ndpr-form-field__label",children:["Recipient Contact Email ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("input",{id:"cb-recipientContactEmail",type:"email",value:n.recipientContactEmail,onChange:a=>l("recipientContactEmail",a.target.value),placeholder:"contact@example.com","aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-recipientContactPhone",className:"ndpr-form-field__label",children:"Recipient Contact Phone"}),jsx("input",{id:"cb-transfer-recipientContactPhone",type:"text",value:n.recipientContactPhone,onChange:a=>l("recipientContactPhone",a.target.value),placeholder:"Phone number",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-recipientContactAddress",className:"ndpr-form-field__label",children:"Recipient Contact Address"}),jsx("input",{id:"cb-transfer-recipientContactAddress",type:"text",value:n.recipientContactAddress,onChange:a=>l("recipientContactAddress",a.target.value),placeholder:"Address",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-purpose",className:"ndpr-form-field__label",children:["Purpose of Transfer ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"cb-purpose",value:n.purpose,onChange:a=>l("purpose",a.target.value),placeholder:"Describe the purpose of this data transfer",rows:2,"aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-safeguards",className:"ndpr-form-field__label",children:["Safeguards ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"cb-safeguards",value:n.safeguards,onChange:a=>l("safeguards",a.target.value),placeholder:`One safeguard per line, e.g.
4
- End-to-end encryption
5
- Access control policies
6
- Regular security audits`,rows:3,"aria-required":"true","aria-describedby":"cb-safeguards-help",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)}),jsx("p",{id:"cb-safeguards-help",className:"text-xs text-gray-500 mt-1",children:"Enter one safeguard per line"})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"cb-riskAssessment",className:"ndpr-form-field__label",children:["Risk Assessment Summary ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"cb-riskAssessment",value:n.riskAssessment,onChange:a=>l("riskAssessment",a.target.value),placeholder:"Summarize the risk assessment for this transfer",rows:2,"aria-required":"true","aria-describedby":"cb-form-errors",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-frequency",className:"ndpr-form-field__label",children:"Transfer Frequency"}),jsx("select",{id:"cb-transfer-frequency",value:n.frequency,onChange:a=>l("frequency",a.target.value),className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:X.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-status",className:"ndpr-form-field__label",children:"Status"}),jsx("select",{id:"cb-transfer-status",value:n.status,onChange:a=>l("status",a.target.value),className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:Z.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]})]}),t&&jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",children:[jsx("h4",{className:"text-sm font-medium ndpr-text-info mb-3",children:"NDPC Approval Required"}),jsx("p",{className:"text-xs ndpr-text-info mb-3",children:"The selected transfer mechanism requires approval from the Nigeria Data Protection Commission."}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"ndpcApprovalApplied",checked:n.ndpcApprovalApplied,onChange:a=>l("ndpcApprovalApplied",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"ndpcApprovalApplied",className:"ndpr-text-sm",children:"Application submitted"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"ndpcApprovalApproved",checked:n.ndpcApprovalApproved,onChange:a=>l("ndpcApprovalApproved",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"ndpcApprovalApproved",className:"ndpr-text-sm",children:"Approval granted"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"cb-transfer-ndpcApprovalReference",className:"ndpr-form-field__label",children:"NDPC Reference Number"}),jsx("input",{id:"cb-transfer-ndpcApprovalReference",type:"text",value:n.ndpcApprovalReference,onChange:a=>l("ndpcApprovalReference",a.target.value),placeholder:"Reference number (if available)",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]})]})]}),ne&&jsxs("div",{className:"mt-4 p-4 bg-gray-100 dark:bg-gray-600 rounded-md",children:[jsx("h4",{className:"text-sm font-medium mb-3",children:"Transfer Impact Assessment"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"checkbox",id:"tiaCompleted",checked:n.tiaCompleted,onChange:a=>l("tiaCompleted",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"tiaCompleted",className:"ndpr-text-sm",children:"TIA completed"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cb-transfer-tiaReference",className:"ndpr-form-field__label",children:"TIA Reference"}),jsx("input",{id:"cb-transfer-tiaReference",type:"text",value:n.tiaReference,onChange:a=>l("tiaReference",a.target.value),placeholder:"Document reference",className:a$1("ndpr-form-field__input",r==null?void 0:r.input,d)})]})]})]}),jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[jsx("button",{onClick:G,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600",children:"Cancel"}),jsx("button",{onClick:se,className:a$1(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${M}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),d),children:h$1?"Update Transfer":"Add Transfer"})]})]})},fe=t=>{var u,v;let a=h(t),o=g(t);return jsxs("div",{role:"status","aria-label":"Transfer details",className:a$1("",r==null?void 0:r.detailPanel,d),children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxs("h3",{className:"ndpr-section-heading",children:[t.destinationCountry," \u2014 ",t.recipientOrganization]}),jsxs("div",{className:"flex gap-2",children:[K(t.status),H(t.riskLevel)]})]}),!o.isValid&&jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Compliance Issues"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-destructive",children:o.errors.map((c,s)=>jsx("li",{children:c},s))})]}),o.warnings.length>0&&jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm font-medium ndpr-text-warning mb-1",children:"Warnings"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-warning",children:o.warnings.map((c,s)=>jsx("li",{children:c},s))})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Destination:"})," ",t.destinationCountry,t.destinationCountryCode?` (${t.destinationCountryCode})`:""]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Adequacy:"})," ",(u=J.find(c=>c.value===t.adequacyStatus))==null?void 0:u.label]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Frequency:"})," ",(v=X.find(c=>c.value===t.frequency))==null?void 0:v.label]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Start Date:"})," ",x(t.startDate)]}),t.endDate&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"End Date:"})," ",x(t.endDate)]}),t.reviewDate&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Next Review:"})," ",x(t.reviewDate)]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Recipient:"})," ",t.recipientOrganization]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Contact:"})," ",t.recipientContact.name," (",t.recipientContact.email,")"]}),t.estimatedDataSubjects&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Subjects:"})," ",t.estimatedDataSubjects.toLocaleString()]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",t.includesSensitiveData?"Yes":"No"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Transfer Mechanism"}),jsx("div",{className:"ndpr-panel",children:jsx("p",{className:"text-sm text-gray-700 dark:text-gray-200",children:f(t.transferMechanism)})})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Purpose"}),jsx("p",{className:"text-sm ndpr-text-muted bg-gray-50 dark:bg-gray-700 p-2 rounded-md",children:t.purpose})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Data Categories"}),jsx("div",{className:"flex flex-wrap gap-1",children:t.dataCategories.map((c,s)=>jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-600 rounded text-xs",children:c},s))})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Safeguards"}),jsx("ul",{className:"list-disc list-inside text-sm ndpr-text-muted",children:t.safeguards.map((c,s)=>jsx("li",{children:c},s))})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Assessment"}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"text-sm text-gray-700 dark:text-gray-200 mb-2",children:t.riskAssessment}),jsxs("div",{className:"mt-2",role:"status","aria-label":"Automated risk assessment result",children:[jsxs("p",{className:"text-xs font-medium ndpr-text-muted mb-1",children:["Automated Assessment (Score: ",a.riskScore,")"]}),a.factors.length>0&&jsx("ul",{className:"list-disc list-inside text-xs ndpr-text-muted",children:a.factors.map((c,s)=>jsx("li",{children:c},s))}),a.recommendations.length>0&&jsxs("div",{className:"mt-2",children:[jsx("p",{className:"text-xs font-medium ndpr-text-muted mb-1",children:"Recommendations:"}),jsx("ul",{className:"list-disc list-inside text-xs ndpr-text-muted",children:a.recommendations.map((c,s)=>jsx("li",{children:c},s))})]})]})]})]}),t.ndpcApproval&&jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"NDPC Approval"}),jsxs("div",{className:a$1(`p-3 rounded-md ${t.ndpcApproval.approved?"ndpr-alert ndpr-alert--success":t.ndpcApproval.applied?"ndpr-alert ndpr-alert--warning":"ndpr-alert ndpr-alert--destructive"}`,r==null?void 0:r.approvalStatus,d),children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",t.ndpcApproval.approved?"Approved":t.ndpcApproval.applied?"Application Submitted":"Not Applied"]}),t.ndpcApproval.referenceNumber&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Reference:"})," ",t.ndpcApproval.referenceNumber]}),t.ndpcApproval.appliedAt&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Applied:"})," ",x(t.ndpcApproval.appliedAt)]}),t.ndpcApproval.approvedAt&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Approved:"})," ",x(t.ndpcApproval.approvedAt)]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-form-field__label",children:"Transfer Impact Assessment"}),jsxs("div",{className:`p-3 rounded-md ${t.tiaCompleted?"ndpr-alert ndpr-alert--success":"ndpr-alert ndpr-alert--warning"}`,children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",t.tiaCompleted?"Completed":"Not Completed"]}),t.tiaReference&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Reference:"})," ",t.tiaReference]})]})]}),jsxs("div",{className:"flex gap-3 mt-6",children:[jsx("button",{onClick:()=>le(t),"aria-label":`Edit transfer to ${t.destinationCountry}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${M}`,children:"Edit"}),jsx("button",{onClick:()=>ce(t.id),"aria-label":`Remove transfer to ${t.destinationCountry}`,className:"px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700",children:"Remove"})]})]})};return jsxs("div",{className:a$1(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ae}`,r==null?void 0:r.root,d),children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.title,d),children:te}),jsx("p",{className:"ndpr-card__subtitle",children:re}),ie&&me(),!j&&jsx("div",{className:"mb-6",children:jsx("button",{onClick:oe,className:a$1(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] ${M}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),d),children:"Add Transfer"})}),j&&ve(),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"cbStatusFilter",className:"ndpr-form-field__label",children:"Status Filter"}),jsxs("select",{id:"cbStatusFilter",value:k,onChange:t=>de(t.target.value),"aria-label":"Filter transfers by status",className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsx("option",{value:"all",children:"All Statuses"}),Z.map(t=>jsx("option",{value:t.value,children:t.label},t.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"cbMechanismFilter",className:"ndpr-form-field__label",children:"Mechanism Filter"}),jsxs("select",{id:"cbMechanismFilter",value:T,onChange:t=>pe(t.target.value),"aria-label":"Filter transfers by mechanism",className:a$1("ndpr-form-field__input",r==null?void 0:r.select,d),children:[jsx("option",{value:"all",children:"All Mechanisms"}),L.map(t=>jsx("option",{value:t.value,children:t.label},t.value))]})]})]}),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:"Transfers"}),A.length===0?jsx("p",{className:"ndpr-card__subtitle",children:"No cross-border transfers found."}):jsx("div",{className:a$1("space-y-2 max-h-96 overflow-y-auto pr-2",r==null?void 0:r.transferList,d),children:A.map(t=>{var a,o;return jsxs("div",{className:a$1(`p-3 rounded-md cursor-pointer ${f$1===t.id?"ndpr-alert ndpr-alert--info":"ndpr-panel"}`,r==null?void 0:r.transferItem,d),role:"button",tabIndex:0,"aria-label":`View transfer to ${t.destinationCountry}`,onClick:()=>y(t.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),y(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.destinationCountry}),H(t.riskLevel)]}),jsx("p",{className:"text-xs ndpr-text-muted mb-1",children:t.recipientOrganization}),jsx("p",{className:"text-xs ndpr-text-muted mb-1",children:ue(t.transferMechanism)}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[K(t.status),((a=t.ndpcApproval)==null?void 0:a.required)&&!((o=t.ndpcApproval)!=null&&o.approved)&&jsx("span",{className:"text-xs ndpr-text-info",children:"NDPC Pending"})]})]},t.id)})})]}),jsx("div",{className:"md:col-span-2",children:U?fe(U):jsx("div",{className:"ndpr-empty-state",children:jsx("p",{className:"ndpr-card__subtitle",children:"Select a transfer to view details"})})})]})]})};export{ke as a};