@tantainnovative/ndpr-toolkit 1.0.10 → 2.1.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 (218) hide show
  1. package/README.md +289 -136
  2. package/dist/breach-BpSBPrdk.d.mts +185 -0
  3. package/dist/breach-BpSBPrdk.d.ts +185 -0
  4. package/dist/breach-D5zJYNph.d.mts +17 -0
  5. package/dist/breach-D7NgrdMX.d.ts +17 -0
  6. package/dist/breach.d.mts +275 -0
  7. package/dist/breach.d.ts +275 -0
  8. package/dist/breach.js +2 -0
  9. package/dist/breach.js.map +1 -0
  10. package/dist/breach.mjs +2 -0
  11. package/dist/breach.mjs.map +1 -0
  12. package/dist/chunk-2SYNHRP6.mjs +2 -0
  13. package/dist/chunk-2SYNHRP6.mjs.map +1 -0
  14. package/dist/chunk-2XHD22J7.mjs +7 -0
  15. package/dist/chunk-2XHD22J7.mjs.map +1 -0
  16. package/dist/chunk-4A354HL3.js +2 -0
  17. package/dist/chunk-4A354HL3.js.map +1 -0
  18. package/dist/chunk-4DKT6IB6.js +94 -0
  19. package/dist/chunk-4DKT6IB6.js.map +1 -0
  20. package/dist/chunk-5ZBO2UPH.js +2 -0
  21. package/dist/chunk-5ZBO2UPH.js.map +1 -0
  22. package/dist/chunk-6JFTAYXV.mjs +2 -0
  23. package/dist/chunk-6JFTAYXV.mjs.map +1 -0
  24. package/dist/chunk-6JVYYLS7.js +2 -0
  25. package/dist/chunk-6JVYYLS7.js.map +1 -0
  26. package/dist/chunk-6SGG6WPA.mjs +2 -0
  27. package/dist/chunk-6SGG6WPA.mjs.map +1 -0
  28. package/dist/chunk-AQEGDEQM.js +7 -0
  29. package/dist/chunk-AQEGDEQM.js.map +1 -0
  30. package/dist/chunk-C2IJWCZQ.mjs +2 -0
  31. package/dist/chunk-C2IJWCZQ.mjs.map +1 -0
  32. package/dist/chunk-CMZTI7SG.js +2 -0
  33. package/dist/chunk-CMZTI7SG.js.map +1 -0
  34. package/dist/chunk-DB3JH4DS.mjs +2 -0
  35. package/dist/chunk-DB3JH4DS.mjs.map +1 -0
  36. package/dist/chunk-EWOZKYLY.mjs +2 -0
  37. package/dist/chunk-EWOZKYLY.mjs.map +1 -0
  38. package/dist/chunk-FFW7RUAG.mjs +94 -0
  39. package/dist/chunk-FFW7RUAG.mjs.map +1 -0
  40. package/dist/chunk-FK3CSFLJ.js +2 -0
  41. package/dist/chunk-FK3CSFLJ.js.map +1 -0
  42. package/dist/chunk-GIV2OHE6.mjs +2 -0
  43. package/dist/chunk-GIV2OHE6.mjs.map +1 -0
  44. package/dist/chunk-GMLNWS2N.mjs +2 -0
  45. package/dist/chunk-GMLNWS2N.mjs.map +1 -0
  46. package/dist/chunk-IQF726GS.js +2 -0
  47. package/dist/chunk-IQF726GS.js.map +1 -0
  48. package/dist/chunk-IWUUVRLJ.js +2 -0
  49. package/dist/chunk-IWUUVRLJ.js.map +1 -0
  50. package/dist/chunk-JUN6YPLL.mjs +72 -0
  51. package/dist/chunk-JUN6YPLL.mjs.map +1 -0
  52. package/dist/chunk-L3FKTBGV.js +72 -0
  53. package/dist/chunk-L3FKTBGV.js.map +1 -0
  54. package/dist/chunk-L52PDW6O.mjs +2 -0
  55. package/dist/chunk-L52PDW6O.mjs.map +1 -0
  56. package/dist/chunk-LI6WJ3LZ.js +2 -0
  57. package/dist/chunk-LI6WJ3LZ.js.map +1 -0
  58. package/dist/chunk-LXRXDTPI.js +2 -0
  59. package/dist/chunk-LXRXDTPI.js.map +1 -0
  60. package/dist/chunk-MQFZHA2D.js +2 -0
  61. package/dist/chunk-MQFZHA2D.js.map +1 -0
  62. package/dist/chunk-OITITR6K.mjs +2 -0
  63. package/dist/chunk-OITITR6K.mjs.map +1 -0
  64. package/dist/chunk-PDJGTQMY.mjs +2 -0
  65. package/dist/chunk-PDJGTQMY.mjs.map +1 -0
  66. package/dist/chunk-PGSA2O5P.mjs +2 -0
  67. package/dist/chunk-PGSA2O5P.mjs.map +1 -0
  68. package/dist/chunk-PM7CMTMB.js +4 -0
  69. package/dist/chunk-PM7CMTMB.js.map +1 -0
  70. package/dist/chunk-PYEX7DFR.mjs +4 -0
  71. package/dist/chunk-PYEX7DFR.mjs.map +1 -0
  72. package/dist/chunk-QKK5S54L.mjs +2 -0
  73. package/dist/chunk-QKK5S54L.mjs.map +1 -0
  74. package/dist/chunk-RB26MIRI.js +2 -0
  75. package/dist/chunk-RB26MIRI.js.map +1 -0
  76. package/dist/chunk-RGYK4VAY.mjs +2 -0
  77. package/dist/chunk-RGYK4VAY.mjs.map +1 -0
  78. package/dist/chunk-RHWW5FDP.js +16 -0
  79. package/dist/chunk-RHWW5FDP.js.map +1 -0
  80. package/dist/chunk-RYZEIDNR.js +2 -0
  81. package/dist/chunk-RYZEIDNR.js.map +1 -0
  82. package/dist/chunk-SLNMKGQ2.mjs +2 -0
  83. package/dist/chunk-SLNMKGQ2.mjs.map +1 -0
  84. package/dist/chunk-SSGJREE3.js +2 -0
  85. package/dist/chunk-SSGJREE3.js.map +1 -0
  86. package/dist/chunk-SWF3YVE5.js +4 -0
  87. package/dist/chunk-SWF3YVE5.js.map +1 -0
  88. package/dist/chunk-T44JQT2O.mjs +2 -0
  89. package/dist/chunk-T44JQT2O.mjs.map +1 -0
  90. package/dist/chunk-TDDAYVKK.js +2 -0
  91. package/dist/chunk-TDDAYVKK.js.map +1 -0
  92. package/dist/chunk-TXBZPCGF.mjs +2 -0
  93. package/dist/chunk-TXBZPCGF.mjs.map +1 -0
  94. package/dist/chunk-U2CGMEWB.js +2 -0
  95. package/dist/chunk-U2CGMEWB.js.map +1 -0
  96. package/dist/chunk-UUWVBENC.js +2 -0
  97. package/dist/chunk-UUWVBENC.js.map +1 -0
  98. package/dist/chunk-UYP64PV7.mjs +4 -0
  99. package/dist/chunk-UYP64PV7.mjs.map +1 -0
  100. package/dist/chunk-VMJBW3EF.mjs +2 -0
  101. package/dist/chunk-VMJBW3EF.mjs.map +1 -0
  102. package/dist/chunk-WW3X3ELF.js +2 -0
  103. package/dist/chunk-WW3X3ELF.js.map +1 -0
  104. package/dist/chunk-WWT2ZSNU.mjs +2 -0
  105. package/dist/chunk-WWT2ZSNU.mjs.map +1 -0
  106. package/dist/chunk-XMKA6GVK.mjs +16 -0
  107. package/dist/chunk-XMKA6GVK.mjs.map +1 -0
  108. package/dist/chunk-Y34DQYS7.js +2 -0
  109. package/dist/chunk-Y34DQYS7.js.map +1 -0
  110. package/dist/chunk-ZU73VG3X.js +2 -0
  111. package/dist/chunk-ZU73VG3X.js.map +1 -0
  112. package/dist/consent-CmVzqZUk.d.mts +99 -0
  113. package/dist/consent-CmVzqZUk.d.ts +99 -0
  114. package/dist/consent-DCc5zjXI.d.mts +24 -0
  115. package/dist/consent-DLWb5ota.d.ts +24 -0
  116. package/dist/consent.d.mts +197 -0
  117. package/dist/consent.d.ts +197 -0
  118. package/dist/consent.js +2 -0
  119. package/dist/consent.js.map +1 -0
  120. package/dist/consent.mjs +2 -0
  121. package/dist/consent.mjs.map +1 -0
  122. package/dist/core.d.mts +14 -0
  123. package/dist/core.d.ts +14 -0
  124. package/dist/core.js +2 -0
  125. package/dist/core.js.map +1 -0
  126. package/dist/core.mjs +2 -0
  127. package/dist/core.mjs.map +1 -0
  128. package/dist/cross-border-BrIy1ieh.d.mts +192 -0
  129. package/dist/cross-border-BrIy1ieh.d.ts +192 -0
  130. package/dist/cross-border.d.mts +58 -0
  131. package/dist/cross-border.d.ts +58 -0
  132. package/dist/cross-border.js +2 -0
  133. package/dist/cross-border.js.map +1 -0
  134. package/dist/cross-border.mjs +2 -0
  135. package/dist/cross-border.mjs.map +1 -0
  136. package/dist/dpia-B9ZZJG5a.d.mts +15 -0
  137. package/dist/dpia-fdtTd2DI.d.ts +15 -0
  138. package/dist/dpia-vWfE_9bO.d.mts +137 -0
  139. package/dist/dpia-vWfE_9bO.d.ts +137 -0
  140. package/dist/dpia.d.mts +179 -0
  141. package/dist/dpia.d.ts +179 -0
  142. package/dist/dpia.js +2 -0
  143. package/dist/dpia.js.map +1 -0
  144. package/dist/dpia.mjs +2 -0
  145. package/dist/dpia.mjs.map +1 -0
  146. package/dist/dsr-jq5NUEdz.d.ts +14 -0
  147. package/dist/dsr-pQzQ3H1O.d.mts +128 -0
  148. package/dist/dsr-pQzQ3H1O.d.ts +128 -0
  149. package/dist/dsr-whPkiI0_.d.mts +14 -0
  150. package/dist/dsr.d.mts +192 -0
  151. package/dist/dsr.d.ts +192 -0
  152. package/dist/dsr.js +2 -0
  153. package/dist/dsr.js.map +1 -0
  154. package/dist/dsr.mjs +2 -0
  155. package/dist/dsr.mjs.map +1 -0
  156. package/dist/hooks.d.mts +17 -0
  157. package/dist/hooks.d.ts +17 -0
  158. package/dist/hooks.js +2 -0
  159. package/dist/hooks.js.map +1 -0
  160. package/dist/hooks.mjs +2 -0
  161. package/dist/hooks.mjs.map +1 -0
  162. package/dist/index.d.mts +31 -448
  163. package/dist/index.d.ts +31 -448
  164. package/dist/index.js +1 -190
  165. package/dist/index.js.map +1 -1
  166. package/dist/index.mjs +1 -190
  167. package/dist/index.mjs.map +1 -1
  168. package/dist/lawful-basis-CWtvDG1x.d.mts +112 -0
  169. package/dist/lawful-basis-CWtvDG1x.d.ts +112 -0
  170. package/dist/lawful-basis-D-oXFizg.d.mts +57 -0
  171. package/dist/lawful-basis-v04AhbK2.d.ts +57 -0
  172. package/dist/lawful-basis.d.mts +55 -0
  173. package/dist/lawful-basis.d.ts +55 -0
  174. package/dist/lawful-basis.js +2 -0
  175. package/dist/lawful-basis.js.map +1 -0
  176. package/dist/lawful-basis.mjs +2 -0
  177. package/dist/lawful-basis.mjs.map +1 -0
  178. package/dist/policy.d.mts +195 -0
  179. package/dist/policy.d.ts +195 -0
  180. package/dist/policy.js +2 -0
  181. package/dist/policy.js.map +1 -0
  182. package/dist/policy.mjs +2 -0
  183. package/dist/policy.mjs.map +1 -0
  184. package/dist/privacy-9FcJceMr.d.mts +15 -0
  185. package/dist/privacy-BXz7O2ej.d.ts +15 -0
  186. package/dist/privacy-Ca6te9Ir.d.mts +138 -0
  187. package/dist/privacy-Ca6te9Ir.d.ts +138 -0
  188. package/dist/ropa-BebGfqKQ.d.ts +200 -0
  189. package/dist/ropa-Rb4dsFSz.d.mts +200 -0
  190. package/dist/ropa.d.mts +45 -0
  191. package/dist/ropa.d.ts +45 -0
  192. package/dist/ropa.js +2 -0
  193. package/dist/ropa.js.map +1 -0
  194. package/dist/ropa.mjs +2 -0
  195. package/dist/ropa.mjs.map +1 -0
  196. package/dist/unstyled.d.mts +4 -4
  197. package/dist/unstyled.d.ts +4 -4
  198. package/dist/unstyled.js +1 -1
  199. package/dist/unstyled.js.map +1 -1
  200. package/dist/unstyled.mjs +1 -1
  201. package/dist/unstyled.mjs.map +1 -1
  202. package/dist/useBreach-DRKnexsk.d.mts +99 -0
  203. package/dist/useBreach-DuT0N0K1.d.ts +99 -0
  204. package/dist/useConsent-D0pAfTlb.d.ts +65 -0
  205. package/dist/useConsent-DOt2Njst.d.mts +65 -0
  206. package/dist/useCrossBorderTransfer-D4FQYfFt.d.ts +66 -0
  207. package/dist/useCrossBorderTransfer-TVnY8_UX.d.mts +66 -0
  208. package/dist/useDPIA-DFDHBLSa.d.ts +94 -0
  209. package/dist/useDPIA-FqPofFaV.d.mts +94 -0
  210. package/dist/useDSR-DAqqOBXb.d.ts +74 -0
  211. package/dist/useDSR-OXM5Q9rf.d.mts +74 -0
  212. package/dist/useLawfulBasis-DNQ8YszQ.d.mts +68 -0
  213. package/dist/useLawfulBasis-RILM_xsx.d.ts +68 -0
  214. package/dist/usePrivacyPolicy-CfySfBLS.d.ts +89 -0
  215. package/dist/usePrivacyPolicy-Dit2sFuV.d.mts +89 -0
  216. package/dist/useROPA-Bcs6cRdi.d.ts +64 -0
  217. package/dist/useROPA-nmcSiUYv.d.mts +64 -0
  218. package/package.json +144 -20
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/ndpr-toolkit/src/hooks/useBreach.ts"],"names":["useBreach","categories","initialReports","storageKey","useLocalStorage","onReport","onAssessment","onNotification","reports","setReports","useState","assessments","setAssessments","notifications","setNotifications","useEffect","savedData","error","generateId","prefix","reportBreach","reportData","newReport","__spreadValues","prevReports","updateReport","id","updates","updatedReport","index","report","newReports","getReport","assessRisk","breachId","assessmentData","existingAssessment","assessment","updatedAssessment","__spreadProps","prevAssessments","newAssessment","getAssessment","calculateNotificationRequirements","severityLevel","notificationRequired","timeframeHours","justification","calculateBreachSeverity","deadline","notificationData","existingNotification","notification","updatedNotification","prevNotifications","newNotification","hoursThreshold","now","result","requirements","hoursRemaining","a","b"],"mappings":"0HAsHO,SAASA,CAAAA,CAAU,CACxB,UAAA,CAAAC,CAAAA,CACA,eAAAC,CAAAA,CAAiB,EAAC,CAClB,UAAA,CAAAC,EAAa,kBAAA,CACb,eAAA,CAAAC,CAAAA,CAAkB,IAAA,CAClB,SAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CACF,CAAA,CAAsC,CACpC,GAAM,CAACC,EAASC,CAAU,CAAA,CAAIC,QAAAA,CAAyBR,CAAc,EAC/D,CAACS,CAAAA,CAAaC,CAAc,CAAA,CAAIF,SAA2B,EAAE,CAAA,CAC7D,CAACG,IAAeC,CAAgB,CAAA,CAAIJ,QAAAA,CAAmC,EAAE,CAAA,CAG/EK,SAAAA,CAAU,IAAM,CACd,GAAIX,CAAAA,EAAmB,OAAO,MAAA,EAAW,WAAA,CACvC,GAAI,CACF,IAAMY,CAAAA,CAAY,YAAA,CAAa,QAAQb,CAAU,CAAA,CACjD,GAAIa,CAAAA,CAAW,CACb,GAAM,CAAE,OAAA,CAAAR,CAAAA,CAAS,YAAAG,CAAAA,CAAa,aAAA,CAAAE,CAAc,CAAA,CAAI,KAAK,KAAA,CAAMG,CAAS,CAAA,CACpEP,CAAAA,CAAWD,GAAW,EAAE,CAAA,CACxBI,CAAAA,CAAeD,GAAe,EAAE,CAAA,CAChCG,CAAAA,CAAiBD,GAAiB,EAAE,E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cZ,CAAAA,CAAO,EAAE,EAC1C,GAAI,CAACO,CAAAA,CACH,OAGF,IAAMsB,CAAAA,CAAehB,CAAAA,CAAkCb,CAAAA,CAAO,EAAE,EAChE,GAAI,CAAC6B,CAAAA,EAAgB,CAACA,EAAa,wBAAA,CACjC,OAIF,IAAMC,CAAAA,CAAAA,CADgBD,EAAa,wBAAA,CAA2BF,CAAAA,GACtB,IAAA,CAAU,GAAA,CAAA,CAE9CG,GAAkBJ,CAAAA,EACpBE,CAAAA,CAAO,IAAA,CAAK,CACV,OAAA5B,CAAAA,CACA,UAAA,CAAAO,CAAAA,CACA,YAAA,CAAAsB,EACA,cAAA,CAAAC,CACF,CAAC,EAEL,CAAC,CAAA,CAGMF,CAAAA,CAAO,IAAA,CAAK,CAACG,EAAGC,CAAAA,GAAMD,CAAAA,CAAE,cAAA,CAAiBC,CAAAA,CAAE,cAAc,CAClE,CAAA,CA0BE,eAAA,CAvBsB,IAAM,CAC5BrD,CAAAA,CAAW,EAAE,CAAA,CACbG,EAAe,EAAE,CAAA,CACjBE,CAAAA,CAAiB,EAAE,CAAA,CAEfV,CAAAA,EAAmB,OAAO,QAAW,WAAA,EACvC,YAAA,CAAa,WAAWD,CAAU,EAEtC,CAgBA,CACF","file":"chunk-OITITR6K.mjs","sourcesContent":["import { useState, useEffect } from 'react';\nimport { BreachReport, BreachCategory, RiskAssessment, NotificationRequirement, RegulatoryNotification } from '../types/breach';\nimport { calculateBreachSeverity } from '../utils/breach';\n\ninterface UseBreachOptions {\n /**\n * Available breach categories\n */\n categories: BreachCategory[];\n \n /**\n * Initial breach reports\n */\n initialReports?: BreachReport[];\n \n /**\n * Storage key for breach data\n * @default \"ndpr_breach_data\"\n */\n storageKey?: string;\n \n /**\n * Whether to use local storage to persist breach data\n * @default true\n */\n useLocalStorage?: boolean;\n \n /**\n * Callback function called when a breach is reported\n */\n onReport?: (report: BreachReport) => void;\n \n /**\n * Callback function called when a risk assessment is completed\n */\n onAssessment?: (assessment: RiskAssessment) => void;\n \n /**\n * Callback function called when a notification is sent\n */\n onNotification?: (notification: RegulatoryNotification) => void;\n}\n\ninterface UseBreachReturn {\n /**\n * All breach reports\n */\n reports: BreachReport[];\n \n /**\n * All risk assessments\n */\n assessments: RiskAssessment[];\n \n /**\n * All regulatory notifications\n */\n notifications: RegulatoryNotification[];\n \n /**\n * Submit a new breach report\n */\n reportBreach: (reportData: Omit<BreachReport, 'id' | 'reportedAt'>) => BreachReport;\n \n /**\n * Update an existing breach report\n */\n updateReport: (id: string, updates: Partial<BreachReport>) => BreachReport | null;\n \n /**\n * Get a breach report by ID\n */\n getReport: (id: string) => BreachReport | null;\n \n /**\n * Conduct a risk assessment for a breach\n */\n assessRisk: (breachId: string, assessmentData: Omit<RiskAssessment, 'id' | 'breachId' | 'assessedAt'>) => RiskAssessment;\n \n /**\n * Get a risk assessment for a breach\n */\n getAssessment: (breachId: string) => RiskAssessment | null;\n \n /**\n * Calculate notification requirements based on a risk assessment\n */\n calculateNotificationRequirements: (breachId: string) => NotificationRequirement | null;\n \n /**\n * Send a regulatory notification\n */\n sendNotification: (breachId: string, notificationData: Omit<RegulatoryNotification, 'id' | 'breachId' | 'sentAt'>) => RegulatoryNotification;\n \n /**\n * Get a regulatory notification for a breach\n */\n getNotification: (breachId: string) => RegulatoryNotification | null;\n \n /**\n * Get breaches that require notification within the next X hours\n */\n getBreachesRequiringNotification: (hoursThreshold?: number) => Array<{\n report: BreachReport;\n assessment: RiskAssessment;\n requirements: NotificationRequirement;\n hoursRemaining: number;\n }>;\n \n /**\n * Clear all breach data\n */\n clearBreachData: () => void;\n}\n\n/**\n * Hook for managing data breach notifications in compliance with the NDPA (Section 40)\n */\nexport function useBreach({\n categories,\n initialReports = [],\n storageKey = \"ndpr_breach_data\",\n useLocalStorage = true,\n onReport,\n onAssessment,\n onNotification\n}: UseBreachOptions): UseBreachReturn {\n const [reports, setReports] = useState<BreachReport[]>(initialReports);\n const [assessments, setAssessments] = useState<RiskAssessment[]>([]);\n const [notifications, setNotifications] = useState<RegulatoryNotification[]>([]);\n \n // Load breach data from storage on mount\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n const savedData = localStorage.getItem(storageKey);\n if (savedData) {\n const { reports, assessments, notifications } = JSON.parse(savedData);\n setReports(reports || []);\n setAssessments(assessments || []);\n setNotifications(notifications || []);\n }\n } catch (error) {\n console.error('Error loading breach data:', error);\n }\n }\n }, [storageKey, useLocalStorage]);\n \n // Save breach data to storage when it changes\n useEffect(() => {\n if (useLocalStorage && typeof window !== 'undefined') {\n try {\n localStorage.setItem(storageKey, JSON.stringify({\n reports,\n assessments,\n notifications\n }));\n } catch (error) {\n console.error('Error saving breach data:', error);\n }\n }\n }, [reports, assessments, notifications, storageKey, useLocalStorage]);\n \n // Generate a unique ID\n const generateId = (prefix: string): string => {\n return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n };\n \n // Submit a new breach report\n const reportBreach = (reportData: Omit<BreachReport, 'id' | 'reportedAt'>): BreachReport => {\n const newReport: BreachReport = {\n id: generateId('breach'),\n reportedAt: Date.now(),\n ...reportData\n };\n \n setReports(prevReports => [...prevReports, newReport]);\n \n if (onReport) {\n onReport(newReport);\n }\n \n return newReport;\n };\n \n // Update an existing breach report\n const updateReport = (id: string, updates: Partial<BreachReport>): BreachReport | null => {\n let updatedReport: BreachReport | null = null;\n \n setReports(prevReports => {\n const index = prevReports.findIndex(report => report.id === id);\n \n if (index === -1) {\n return prevReports;\n }\n \n const report = prevReports[index];\n updatedReport = {\n ...report,\n ...updates\n };\n \n const newReports = [...prevReports];\n newReports[index] = updatedReport as BreachReport;\n \n return newReports;\n });\n \n return updatedReport;\n };\n \n // Get a breach report by ID\n const getReport = (id: string): BreachReport | null => {\n return reports.find(report => report.id === id) || null;\n };\n \n // Conduct a risk assessment for a breach\n const assessRisk = (breachId: string, assessmentData: Omit<RiskAssessment, 'id' | 'breachId' | 'assessedAt'>): RiskAssessment => {\n // Check if an assessment already exists for this breach\n const existingAssessment = assessments.find(assessment => assessment.breachId === breachId);\n \n if (existingAssessment) {\n // Update the existing assessment\n const updatedAssessment: RiskAssessment = {\n ...existingAssessment,\n ...assessmentData,\n assessedAt: Date.now()\n };\n \n setAssessments(prevAssessments => \n prevAssessments.map(assessment => \n assessment.id === existingAssessment.id ? updatedAssessment : assessment\n )\n );\n \n if (onAssessment) {\n onAssessment(updatedAssessment);\n }\n \n return updatedAssessment;\n } else {\n // Create a new assessment\n const newAssessment: RiskAssessment = {\n id: generateId('assessment'),\n breachId,\n assessedAt: Date.now(),\n ...assessmentData\n };\n \n setAssessments(prevAssessments => [...prevAssessments, newAssessment]);\n \n if (onAssessment) {\n onAssessment(newAssessment);\n }\n \n return newAssessment;\n }\n };\n \n // Get a risk assessment for a breach\n const getAssessment = (breachId: string): RiskAssessment | null => {\n return assessments.find(assessment => assessment.breachId === breachId) || null;\n };\n \n // Calculate notification requirements based on a risk assessment\n const calculateNotificationRequirements = (breachId: string): NotificationRequirement | null => {\n const report = getReport(breachId);\n const assessment = getAssessment(breachId);\n \n if (!report) {\n return null;\n }\n \n const { severityLevel, notificationRequired, timeframeHours, justification } = calculateBreachSeverity(report, assessment || undefined);\n \n // Calculate the deadline (72 hours from discovery under NDPA Section 40)\n const deadline = report.discoveredAt + (timeframeHours * 60 * 60 * 1000);\n\n return {\n ndpcNotificationRequired: notificationRequired,\n ndpcNotificationDeadline: deadline,\n dataSubjectNotificationRequired: severityLevel === 'high' || severityLevel === 'critical',\n justification\n };\n };\n \n // Send a regulatory notification\n const sendNotification = (breachId: string, notificationData: Omit<RegulatoryNotification, 'id' | 'breachId' | 'sentAt'>): RegulatoryNotification => {\n // Check if a notification already exists for this breach\n const existingNotification = notifications.find(notification => notification.breachId === breachId);\n \n if (existingNotification) {\n // Update the existing notification\n const updatedNotification: RegulatoryNotification = {\n ...existingNotification,\n ...notificationData,\n sentAt: Date.now()\n };\n \n setNotifications(prevNotifications => \n prevNotifications.map(notification => \n notification.id === existingNotification.id ? updatedNotification : notification\n )\n );\n \n if (onNotification) {\n onNotification(updatedNotification);\n }\n \n return updatedNotification;\n } else {\n // Create a new notification\n const newNotification: RegulatoryNotification = {\n id: generateId('notification'),\n breachId,\n sentAt: Date.now(),\n ...notificationData\n };\n \n setNotifications(prevNotifications => [...prevNotifications, newNotification]);\n \n if (onNotification) {\n onNotification(newNotification);\n }\n \n return newNotification;\n }\n };\n \n // Get a regulatory notification for a breach\n const getNotification = (breachId: string): RegulatoryNotification | null => {\n return notifications.find(notification => notification.breachId === breachId) || null;\n };\n \n // Get breaches that require notification within the next X hours\n const getBreachesRequiringNotification = (hoursThreshold = 24): Array<{\n report: BreachReport;\n assessment: RiskAssessment;\n requirements: NotificationRequirement;\n hoursRemaining: number;\n }> => {\n const now = Date.now();\n const result: Array<{\n report: BreachReport;\n assessment: RiskAssessment;\n requirements: NotificationRequirement;\n hoursRemaining: number;\n }> = [];\n \n reports.forEach(report => {\n // Skip if a notification has already been sent\n if (notifications.some(notification => notification.breachId === report.id)) {\n return;\n }\n \n const assessment = getAssessment(report.id);\n if (!assessment) {\n return;\n }\n \n const requirements = calculateNotificationRequirements(report.id);\n if (!requirements || !requirements.ndpcNotificationRequired) {\n return;\n }\n\n const timeRemaining = requirements.ndpcNotificationDeadline - now;\n const hoursRemaining = timeRemaining / (60 * 60 * 1000);\n \n if (hoursRemaining <= hoursThreshold) {\n result.push({\n report,\n assessment,\n requirements,\n hoursRemaining\n });\n }\n });\n \n // Sort by hours remaining (ascending)\n return result.sort((a, b) => a.hoursRemaining - b.hoursRemaining);\n };\n \n // Clear all breach data\n const clearBreachData = () => {\n setReports([]);\n setAssessments([]);\n setNotifications([]);\n \n if (useLocalStorage && typeof window !== 'undefined') {\n localStorage.removeItem(storageKey);\n }\n };\n \n return {\n reports,\n assessments,\n notifications,\n reportBreach,\n updateReport,\n getReport,\n assessRisk,\n getAssessment,\n calculateNotificationRequirements,\n sendNotification,\n getNotification,\n getBreachesRequiringNotification,\n clearBreachData\n };\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import {a}from'./chunk-GIV2OHE6.mjs';import {useState,useEffect}from'react';function T({options:h,storageOptions:d={},version:f="1.0",onChange:v}){let{storageKey:o="ndpr_consent",storageType:n="localStorage"}=d,[r,g]=useState(null),[y,a$1]=useState(true),[k,u]=useState(false),[I,p]=useState([]);useEffect(()=>{let t=null;try{if(n==="localStorage"&&typeof window!="undefined"){let e=localStorage.getItem(o);e&&(t=JSON.parse(e));}else if(n==="sessionStorage"&&typeof window!="undefined"){let e=sessionStorage.getItem(o);e&&(t=JSON.parse(e));}else if(n==="cookie"&&typeof document!="undefined"){let s=document.cookie.split(";").find(i=>i.trim().startsWith(`${o}=`));if(s){let i=s.split("=")[1];t=JSON.parse(decodeURIComponent(i));}}}catch(e){console.error("Error loading consent settings:",e);}if(t){g(t);let{valid:e,errors:s}=a(t);u(e),p(s),a$1(!(e&&t.version===f));}else a$1(true);},[o,n,f]);let O=t=>{try{let e=JSON.stringify(t);if(n==="localStorage"&&typeof window!="undefined")localStorage.setItem(o,e);else if(n==="sessionStorage"&&typeof window!="undefined")sessionStorage.setItem(o,e);else if(n==="cookie"&&typeof document!="undefined"){let{cookieOptions:b={}}=d,{domain:w,path:$="/",expires:E=365,secure:R=!0,sameSite:x="Lax"}=b,m=new Date;m.setDate(m.getDate()+E);let c=`${o}=${encodeURIComponent(e)}; path=${$}; expires=${m.toUTCString()}`;w&&(c+=`; domain=${w}`),R&&(c+="; secure"),c+=`; samesite=${x}`,document.cookie=c;}let{valid:s,errors:i}=a(t);u(s),p(i),v&&v(t);}catch(e){console.error("Error saving consent settings:",e);}},S=t=>{let e={consents:t,timestamp:Date.now(),version:f,method:"explicit",hasInteracted:true};g(e),O(e),a$1(false);};return {settings:r,hasConsent:t=>!!(r!=null&&r.consents[t]),updateConsent:S,acceptAll:()=>{let t={};h.forEach(e=>{t[e.id]=true;}),S(t);},rejectAll:()=>{let t={};h.forEach(e=>{t[e.id]=e.required||false;}),S(t);},shouldShowBanner:y,isValid:k,validationErrors:I,resetConsent:()=>{if(n==="localStorage"&&typeof window!="undefined")localStorage.removeItem(o);else if(n==="sessionStorage"&&typeof window!="undefined")sessionStorage.removeItem(o);else if(n==="cookie"&&typeof document!="undefined"){let{cookieOptions:t={}}=d,{domain:e,path:s="/"}=t,i=`${o}=; path=${s}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;e&&(i+=`; domain=${e}`),document.cookie=i;}g(null),a$1(true),u(false),p([]);}}}export{T as a};//# sourceMappingURL=chunk-PDJGTQMY.mjs.map
2
+ //# sourceMappingURL=chunk-PDJGTQMY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/ndpr-toolkit/src/hooks/useConsent.ts"],"names":["useConsent","options","storageOptions","version","onChange","storageKey","storageType","settings","setSettings","useState","shouldShowBanner","setShouldShowBanner","isValid","setIsValid","validationErrors","setValidationErrors","useEffect","savedSettings","savedData","consentCookie","cookie","cookieValue","error","valid","errors","validateConsent","saveSettings","newSettings","settingsString","cookieOptions","domain","path","expires","secure","sameSite","expiryDate","cookieString","updateConsent","consents","optionId","allConsents","option","rejectedConsents"],"mappings":"4EA6EO,SAASA,CAAAA,CAAW,CACzB,OAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CAAAA,CAAiB,EAAC,CAClB,OAAA,CAAAC,CAAAA,CAAU,KAAA,CACV,QAAA,CAAAC,CACF,CAAA,CAAwC,CACtC,GAAM,CACJ,UAAA,CAAAC,CAAAA,CAAa,cAAA,CACb,WAAA,CAAAC,CAAAA,CAAc,cAChB,CAAA,CAAIJ,CAAAA,CAEE,CAACK,CAAAA,CAAUC,CAAW,CAAA,CAAIC,QAAAA,CAAiC,IAAI,CAAA,CAC/D,CAACC,CAAAA,CAAkBC,GAAmB,CAAA,CAAIF,QAAAA,CAAkB,IAAI,CAAA,CAChE,CAACG,CAAAA,CAASC,CAAU,CAAA,CAAIJ,QAAAA,CAAkB,KAAK,CAAA,CAC/C,CAACK,CA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G,GAAAA,CAAoB,IAAI,CAAA,CACxBE,CAAAA,CAAW,KAAK,CAAA,CAChBE,CAAAA,CAAoB,EAAE,EACxB,CAYA,CACF","file":"chunk-PDJGTQMY.mjs","sourcesContent":["import { useState, useEffect } from 'react';\nimport { ConsentOption, ConsentSettings, ConsentStorageOptions } from '../types/consent';\nimport { validateConsent } from '../utils/consent';\n\ninterface UseConsentOptions {\n /**\n * Consent options to present to the user\n */\n options: ConsentOption[];\n \n /**\n * Storage options for consent settings\n */\n storageOptions?: ConsentStorageOptions;\n \n /**\n * Version of the consent form\n * @default \"1.0\"\n */\n version?: string;\n \n /**\n * Callback function called when consent settings change\n */\n onChange?: (settings: ConsentSettings) => void;\n}\n\ninterface UseConsentReturn {\n /**\n * Current consent settings\n */\n settings: ConsentSettings | null;\n \n /**\n * Whether consent has been given for a specific option\n */\n hasConsent: (optionId: string) => boolean;\n \n /**\n * Update consent settings\n */\n updateConsent: (consents: Record<string, boolean>) => void;\n \n /**\n * Accept all consent options\n */\n acceptAll: () => void;\n \n /**\n * Reject all non-required consent options\n */\n rejectAll: () => void;\n \n /**\n * Whether the consent banner should be shown\n */\n shouldShowBanner: boolean;\n \n /**\n * Whether consent settings are valid\n */\n isValid: boolean;\n \n /**\n * Validation errors (if any)\n */\n validationErrors: string[];\n \n /**\n * Reset consent settings (clear from storage)\n */\n resetConsent: () => void;\n}\n\n/**\n * Hook for managing user consent in compliance with NDPA\n */\nexport function useConsent({\n options,\n storageOptions = {},\n version = \"1.0\",\n onChange\n}: UseConsentOptions): UseConsentReturn {\n const {\n storageKey = \"ndpr_consent\",\n storageType = \"localStorage\"\n } = storageOptions;\n \n const [settings, setSettings] = useState<ConsentSettings | null>(null);\n const [shouldShowBanner, setShouldShowBanner] = useState<boolean>(true);\n const [isValid, setIsValid] = useState<boolean>(false);\n const [validationErrors, setValidationErrors] = useState<string[]>([]);\n \n // Load consent settings from storage on mount\n useEffect(() => {\n let savedSettings: ConsentSettings | null = null;\n \n try {\n if (storageType === 'localStorage' && typeof window !== 'undefined') {\n const savedData = localStorage.getItem(storageKey);\n if (savedData) {\n savedSettings = JSON.parse(savedData);\n }\n } else if (storageType === 'sessionStorage' && typeof window !== 'undefined') {\n const savedData = sessionStorage.getItem(storageKey);\n if (savedData) {\n savedSettings = JSON.parse(savedData);\n }\n } else if (storageType === 'cookie' && typeof document !== 'undefined') {\n const cookies = document.cookie.split(';');\n const consentCookie = cookies.find(cookie => cookie.trim().startsWith(`${storageKey}=`));\n if (consentCookie) {\n const cookieValue = consentCookie.split('=')[1];\n savedSettings = JSON.parse(decodeURIComponent(cookieValue));\n }\n }\n } catch (error) {\n console.error('Error loading consent settings:', error);\n }\n \n if (savedSettings) {\n setSettings(savedSettings);\n \n // Validate the saved settings\n const { valid, errors } = validateConsent(savedSettings);\n setIsValid(valid);\n setValidationErrors(errors);\n \n // Only hide banner if settings are valid and for the current version\n setShouldShowBanner(!(valid && savedSettings.version === version));\n } else {\n setShouldShowBanner(true);\n }\n }, [storageKey, storageType, version]);\n \n // Save settings to storage\n const saveSettings = (newSettings: ConsentSettings) => {\n try {\n const settingsString = JSON.stringify(newSettings);\n \n if (storageType === 'localStorage' && typeof window !== 'undefined') {\n localStorage.setItem(storageKey, settingsString);\n } else if (storageType === 'sessionStorage' && typeof window !== 'undefined') {\n sessionStorage.setItem(storageKey, settingsString);\n } else if (storageType === 'cookie' && typeof document !== 'undefined') {\n const { cookieOptions = {} } = storageOptions;\n const {\n domain,\n path = '/',\n expires = 365,\n secure = true,\n sameSite = 'Lax'\n } = cookieOptions;\n \n const expiryDate = new Date();\n expiryDate.setDate(expiryDate.getDate() + expires);\n \n let cookieString = `${storageKey}=${encodeURIComponent(settingsString)}; path=${path}; expires=${expiryDate.toUTCString()}`;\n \n if (domain) {\n cookieString += `; domain=${domain}`;\n }\n \n if (secure) {\n cookieString += '; secure';\n }\n \n cookieString += `; samesite=${sameSite}`;\n \n document.cookie = cookieString;\n }\n \n // Validate the new settings\n const { valid, errors } = validateConsent(newSettings);\n setIsValid(valid);\n setValidationErrors(errors);\n \n // Call onChange callback if provided\n if (onChange) {\n onChange(newSettings);\n }\n } catch (error) {\n console.error('Error saving consent settings:', error);\n }\n };\n \n // Update consent settings\n const updateConsent = (consents: Record<string, boolean>) => {\n const newSettings: ConsentSettings = {\n consents,\n timestamp: Date.now(),\n version,\n method: 'explicit',\n hasInteracted: true\n };\n \n setSettings(newSettings);\n saveSettings(newSettings);\n setShouldShowBanner(false);\n };\n \n // Accept all consent options\n const acceptAll = () => {\n const allConsents: Record<string, boolean> = {};\n options.forEach(option => {\n allConsents[option.id] = true;\n });\n \n updateConsent(allConsents);\n };\n \n // Reject all non-required consent options\n const rejectAll = () => {\n const rejectedConsents: Record<string, boolean> = {};\n options.forEach(option => {\n rejectedConsents[option.id] = option.required || false;\n });\n \n updateConsent(rejectedConsents);\n };\n \n // Check if consent has been given for a specific option\n const hasConsent = (optionId: string): boolean => {\n return !!settings?.consents[optionId];\n };\n \n // Reset consent settings\n const resetConsent = () => {\n if (storageType === 'localStorage' && typeof window !== 'undefined') {\n localStorage.removeItem(storageKey);\n } else if (storageType === 'sessionStorage' && typeof window !== 'undefined') {\n sessionStorage.removeItem(storageKey);\n } else if (storageType === 'cookie' && typeof document !== 'undefined') {\n const { cookieOptions = {} } = storageOptions;\n const { domain, path = '/' } = cookieOptions;\n \n let cookieString = `${storageKey}=; path=${path}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n \n if (domain) {\n cookieString += `; domain=${domain}`;\n }\n \n document.cookie = cookieString;\n }\n \n setSettings(null);\n setShouldShowBanner(true);\n setIsValid(false);\n setValidationErrors([]);\n };\n \n return {\n settings,\n hasConsent,\n updateConsent,\n acceptAll,\n rejectAll,\n shouldShowBanner,\n isValid,\n validationErrors,\n resetConsent\n };\n}\n"]}
@@ -0,0 +1,2 @@
1
+ function a(c){let i={low:0,medium:0,high:0,critical:0},l=0,o=[];c.risks.forEach(e=>{i[e.level]++,e.score>l&&(l=e.score),(e.level==="high"||e.level==="critical")&&!e.mitigated&&o.push(e);});let s;i.critical>0?s="critical":i.high>2||i.high>0&&i.medium>3?s="high":i.high>0||i.medium>1?s="medium":s="low";let r=s==="high"||s==="critical",n=o.length===0,t=[];return o.length>0&&t.push(`Mitigate the following high/critical risks before proceeding: ${o.map(e=>e.description).join(", ")}`),r&&t.push("Consult with the NDPC (Nigeria Data Protection Commission) before proceeding with this processing activity, as required by NDPA Section 39."),i.medium>0&&t.push("Implement additional safeguards to reduce medium-level risks where possible."),s!=="low"?t.push("Schedule a review of this DPIA in 6 months to reassess risks and effectiveness of mitigation measures."):t.push("Schedule a review of this DPIA in 12 months as part of regular compliance activities."),{overallRiskLevel:s,requiresConsultation:r,canProceed:n,recommendations:t}}export{a};//# sourceMappingURL=chunk-PGSA2O5P.mjs.map
2
+ //# sourceMappingURL=chunk-PGSA2O5P.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/ndpr-toolkit/src/utils/dpia.ts"],"names":["assessDPIARisk","dpiaResult","riskCounts","highestRiskScore","unmitigatedHighRisks","risk","overallRiskLevel","requiresConsultation","canProceed","recommendations"],"mappings":"AAOO,SAASA,CAAAA,CAAeC,CAAAA,CAK7B,CAEA,IAAMC,EAAa,CACjB,GAAA,CAAK,CAAA,CACL,MAAA,CAAQ,CAAA,CACR,IAAA,CAAM,CAAA,CACN,QAAA,CAAU,CACZ,CAAA,CAGIC,CAAAA,CAAmB,CAAA,CAGjBC,CAAAA,CAAmC,EAAC,CAG1CH,CAAAA,CAAW,KAAA,CAAM,QAAQI,CAAAA,EAAQ,CAE/BH,CAAAA,CAAWG,CAAAA,CAAK,KAAK,CAAA,EAAA,CAGjBA,CAAAA,CAAK,KAAA,CAAQF,IACfA,CAAAA,CAAmBE,CAAAA,CAAK,KAAA,CAAA,CAAA,CAIrBA,CAAAA,CAAK,KAAA,GAAU,MAAA,EAAUA,CAAAA,CAAK,KAAA,GAAU,aAAe,CAACA,CAAAA,CAAK,SAAA,EAChED,CAAAA,CAAqB,IAAA,CAAKC,CAAI,EAElC,CAAC,EAGD,IAAIC,CAAAA,CAEAJ,CAAAA,CAAW,QAAA,CAAW,CAAA,CACxBI,CAAAA,CAAmB,UAAA,CACVJ,CAAAA,CAAW,KAAO,CAAA,EAAMA,CAAAA,CAAW,IAAA,CAAO,CAAA,EAAKA,CAAAA,CAAW,MAAA,CAAS,CAAA,CAC5EI,CAAAA,CAAmB,OACVJ,CAAAA,CAAW,IAAA,CAAO,CAAA,EAAKA,CAAAA,CAAW,MAAA,CAAS,CAAA,CACpDI,CAAAA,CAAmB,QAAA,CAEnBA,EAAmB,KAAA,CAKrB,IAAMC,CAAAA,CAAuBD,CAAAA,GAAqB,MAAA,EAAUA,CAAAA,GAAqB,UAAA,CAI3EE,CAAAA,CAAaJ,EAAqB,MAAA,GAAW,CAAA,CAG7CK,CAAAA,CAA4B,EAAC,CAEnC,OAAIL,CAAAA,CAAqB,MAAA,CAAS,GAChCK,CAAAA,CAAgB,IAAA,CACd,CAAA,8DAAA,EACEL,CAAAA,CAAqB,GAAA,CAAIC,CAAAA,EAAQA,CAAAA,CAAK,WAAW,EAAE,IAAA,CAAK,IAAI,CAC9D,CAAA,CACF,CAAA,CAGEE,CAAAA,EACFE,CAAAA,CAAgB,IAAA,CACd,6IACF,CAAA,CAGEP,CAAAA,CAAW,MAAA,CAAS,CAAA,EACtBO,CAAAA,CAAgB,IAAA,CACd,8EACF,CAAA,CAGEH,IAAqB,KAAA,CACvBG,CAAAA,CAAgB,IAAA,CACd,wGACF,CAAA,CAEAA,CAAAA,CAAgB,IAAA,CACd,uFACF,EAGK,CACL,gBAAA,CAAAH,CAAAA,CACA,oBAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CACF,CACF","file":"chunk-PGSA2O5P.mjs","sourcesContent":["import { DPIAResult, DPIARisk } from '../types/dpia';\n\n/**\n * Assesses the risk level of a DPIA based on the identified risks\n * @param dpiaResult The DPIA result containing risks to assess\n * @returns Assessment result with overall risk level and recommendations\n */\nexport function assessDPIARisk(dpiaResult: DPIAResult): {\n overallRiskLevel: 'low' | 'medium' | 'high' | 'critical';\n requiresConsultation: boolean;\n canProceed: boolean;\n recommendations: string[];\n} {\n // Count risks by level\n const riskCounts = {\n low: 0,\n medium: 0,\n high: 0,\n critical: 0\n };\n \n // Calculate the highest risk score\n let highestRiskScore = 0;\n \n // Track unmitigated high/critical risks\n const unmitigatedHighRisks: DPIARisk[] = [];\n \n // Analyze each risk\n dpiaResult.risks.forEach(risk => {\n // Count by level\n riskCounts[risk.level]++;\n \n // Track highest score\n if (risk.score > highestRiskScore) {\n highestRiskScore = risk.score;\n }\n \n // Track unmitigated high/critical risks\n if ((risk.level === 'high' || risk.level === 'critical') && !risk.mitigated) {\n unmitigatedHighRisks.push(risk);\n }\n });\n \n // Determine overall risk level\n let overallRiskLevel: 'low' | 'medium' | 'high' | 'critical';\n \n if (riskCounts.critical > 0) {\n overallRiskLevel = 'critical';\n } else if (riskCounts.high > 2 || (riskCounts.high > 0 && riskCounts.medium > 3)) {\n overallRiskLevel = 'high';\n } else if (riskCounts.high > 0 || riskCounts.medium > 1) {\n overallRiskLevel = 'medium';\n } else {\n overallRiskLevel = 'low';\n }\n \n // Determine if NDPC consultation is required\n // Under NDPA Section 39, prior consultation with the NDPC is required when residual risk is high\n const requiresConsultation = overallRiskLevel === 'high' || overallRiskLevel === 'critical';\n \n // Determine if processing can proceed\n // Processing can proceed if all high/critical risks are mitigated\n const canProceed = unmitigatedHighRisks.length === 0;\n \n // Generate recommendations\n const recommendations: string[] = [];\n \n if (unmitigatedHighRisks.length > 0) {\n recommendations.push(\n `Mitigate the following high/critical risks before proceeding: ${\n unmitigatedHighRisks.map(risk => risk.description).join(', ')\n }`\n );\n }\n \n if (requiresConsultation) {\n recommendations.push(\n 'Consult with the NDPC (Nigeria Data Protection Commission) before proceeding with this processing activity, as required by NDPA Section 39.'\n );\n }\n \n if (riskCounts.medium > 0) {\n recommendations.push(\n 'Implement additional safeguards to reduce medium-level risks where possible.'\n );\n }\n \n if (overallRiskLevel !== 'low') {\n recommendations.push(\n 'Schedule a review of this DPIA in 6 months to reassess risks and effectiveness of mitigation measures.'\n );\n } else {\n recommendations.push(\n 'Schedule a review of this DPIA in 12 months as part of regular compliance activities.'\n );\n }\n \n return {\n overallRiskLevel,\n requiresConsultation,\n canProceed,\n recommendations\n };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ 'use strict';function x(c,g){if(typeof c=="string"){let i=c,r=g,n=i,s=/\{\{([^}]+)\}\}/g,l;for(;(l=s.exec(i))!==null;){let t=l[1].trim(),e=r[t]||"";n=n.replace(new RegExp(`\\{\\{\\s*${t}\\s*\\}\\}`,"g"),e);}return n}else {let i=c,r=g,n={},s=[];return i.filter(t=>t.included).sort((t,e)=>(t.order||0)-(e.order||0)).forEach(t=>{let e=t.template||t.customContent||t.defaultContent||"",m=/\{\{([^}]+)\}\}/g,f,u=[];for(;(f=m.exec(e))!==null;)u.push(f[1].trim());u.forEach(o=>{let a="";o in r&&(a=r[o]||""),a||s.push(o),e=e.replace(new RegExp(`\\{\\{\\s*${o}\\s*\\}\\}`,"g"),a);}),n[t.id]=e;}),{fullText:Object.values(n).join(`
2
+
3
+ `),sectionTexts:n,missingVariables:Array.from(new Set(s))}}}exports.a=x;//# sourceMappingURL=chunk-PM7CMTMB.js.map
4
+ //# sourceMappingURL=chunk-PM7CMTMB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/ndpr-toolkit/src/utils/privacy.ts"],"names":["generatePolicyText","sectionsOrTemplate","organizationInfoOrVariables","template","variableMap","result","variableRegex","match","variable","replacement","sections","organizationInfo","sectionTexts","missingVariables","section","a","b","content","contentVariables"],"mappings":"aAQO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CAKA,CAEA,GAAI,OAAOD,CAAAA,EAAuB,QAAA,CAAU,CAC1C,IAAME,EAAWF,CAAAA,CACXG,CAAAA,CAAcF,EAGh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CAAAA,EACHI,CAAAA,CAAiB,IAAA,CAAKL,CAAQ,EAIhCS,CAAAA,CAAUA,CAAAA,CAAQ,QAChB,IAAI,MAAA,CAAO,aAAaT,CAAQ,CAAA,UAAA,CAAA,CAAc,GAAG,CAAA,CACjDC,CACF,EACF,CAAC,CAAA,CAGDG,CAAAA,CAAaE,EAAQ,EAAE,CAAA,CAAIG,EAC7B,CAAC,EAKI,CACL,QAAA,CAHe,OAAO,MAAA,CAAOL,CAAY,EAAE,IAAA,CAAK;;AAAA,CAAM,CAAA,CAItD,YAAA,CAAAA,CAAAA,CACA,gBAAA,CAAkB,KAAA,CAAM,IAAA,CAAK,IAAI,GAAA,CAAIC,CAAgB,CAAC,CACxD,CACF,CACF","file":"chunk-PM7CMTMB.js","sourcesContent":["import { PolicySection, OrganizationInfo, PolicyVariable } from '../types/privacy';\n\n/**\n * Generates policy text by replacing variables in a template with organization-specific values\n * @param sectionsOrTemplate The policy sections or template string to generate text for\n * @param organizationInfoOrVariables The organization information or variable map to use for replacement\n * @returns The generated policy text or an object with the generated text and metadata\n */\nexport function generatePolicyText(\n sectionsOrTemplate: PolicySection[] | string,\n organizationInfoOrVariables: OrganizationInfo | Record<string, string>\n): string | {\n fullText: string;\n sectionTexts: Record<string, string>;\n missingVariables: string[];\n} {\n // Check if we're using the new API (template string and variable map)\n if (typeof sectionsOrTemplate === 'string') {\n const template = sectionsOrTemplate;\n const variableMap = organizationInfoOrVariables as Record<string, string>;\n \n // Replace variables in the template\n let result = template;\n const variableRegex = /\\{\\{([^}]+)\\}\\}/g;\n let match;\n \n // Find and replace all variables in the content\n while ((match = variableRegex.exec(template)) !== null) {\n const variable = match[1].trim();\n const replacement = variableMap[variable] || '';\n \n // Replace the variable in the content\n result = result.replace(\n new RegExp(`\\\\{\\\\{\\\\s*${variable}\\\\s*\\\\}\\\\}`, 'g'), \n replacement\n );\n }\n \n return result;\n } \n // Otherwise use the original API (sections array and organization info)\n else {\n const sections = sectionsOrTemplate;\n const organizationInfo = organizationInfoOrVariables as OrganizationInfo;\n const sectionTexts: Record<string, string> = {};\n const missingVariables: string[] = [];\n \n // Process each section\n sections\n .filter(section => section.included)\n .sort((a, b) => (a.order || 0) - (b.order || 0))\n .forEach(section => {\n // Use template if available, otherwise fall back to custom/default content\n let content = section.template || section.customContent || section.defaultContent || '';\n \n // Replace variables in the content\n const variableRegex = /\\{\\{([^}]+)\\}\\}/g;\n let match;\n \n // Find all variables in the content\n const contentVariables: string[] = [];\n while ((match = variableRegex.exec(content)) !== null) {\n contentVariables.push(match[1].trim());\n }\n \n // Replace each variable with its value\n contentVariables.forEach(variable => {\n let replacement = '';\n \n // Check if the variable exists in organizationInfo\n if (variable in organizationInfo) {\n replacement = organizationInfo[variable as keyof OrganizationInfo] as string || '';\n }\n \n // If replacement is empty, add to missing variables\n if (!replacement) {\n missingVariables.push(variable);\n }\n \n // Replace the variable in the content\n content = content.replace(\n new RegExp(`\\\\{\\\\{\\\\s*${variable}\\\\s*\\\\}\\\\}`, 'g'), \n replacement\n );\n });\n \n // Store the processed section text\n sectionTexts[section.id] = content;\n });\n \n // Combine all sections into full text\n const fullText = Object.values(sectionTexts).join('\\n\\n');\n \n return {\n fullText,\n sectionTexts,\n missingVariables: Array.from(new Set(missingVariables)) // Remove duplicates\n };\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ var l=["consent","contract","legal_obligation","vital_interests","public_interest","legitimate_interests"];function h(e){let s=[];return (!e.id||e.id.trim()==="")&&s.push("Record ID is required."),(!e.name||e.name.trim()==="")&&s.push("Processing activity name is required."),(!e.description||e.description.trim()==="")&&s.push("Processing description is required."),e.controllerDetails?((!e.controllerDetails.name||e.controllerDetails.name.trim()==="")&&s.push("Controller name is required."),(!e.controllerDetails.contact||e.controllerDetails.contact.trim()==="")&&s.push("Controller contact is required."),(!e.controllerDetails.address||e.controllerDetails.address.trim()==="")&&s.push("Controller address is required.")):s.push("Controller details are required."),(!e.lawfulBasis||!l.includes(e.lawfulBasis))&&s.push("A valid lawful basis must be specified (NDPA Section 25)."),(!e.lawfulBasisJustification||e.lawfulBasisJustification.trim()==="")&&s.push("Lawful basis justification is required to demonstrate compliance."),(!e.purposes||e.purposes.length===0)&&s.push("At least one processing purpose must be specified."),(!e.dataCategories||e.dataCategories.length===0)&&s.push("At least one data category must be specified."),(!e.dataSubjectCategories||e.dataSubjectCategories.length===0)&&s.push("At least one data subject category must be specified."),(!e.recipients||e.recipients.length===0)&&s.push("At least one recipient or category of recipients must be specified."),(!e.retentionPeriod||e.retentionPeriod.trim()==="")&&s.push("Retention period must be specified."),(!e.securityMeasures||e.securityMeasures.length===0)&&s.push("At least one security measure must be documented."),e.dataSource||s.push("Data source must be specified."),e.dataSource==="third_party"&&(!e.thirdPartySourceDetails||e.thirdPartySourceDetails.trim()==="")&&s.push('Third-party source details are required when data source is "third_party".'),e.automatedDecisionMaking&&(!e.automatedDecisionMakingDetails||e.automatedDecisionMakingDetails.trim()==="")&&s.push("Automated decision-making details are required when automated decision-making is involved."),e.dpiaRequired&&(!e.dpiaReference||e.dpiaReference.trim()==="")&&s.push("DPIA reference is required when DPIA is marked as required."),{valid:s.length===0,errors:s}}function D(e){let s=l.reduce((a,u)=>(a[u]=0,a),{}),o=0,t=0,i=0,n=0,r=0,p=[],d={},m=Date.now();for(let a of e.records)a.lawfulBasis&&l.includes(a.lawfulBasis)&&s[a.lawfulBasis]++,a.status==="active"&&o++,a.sensitiveDataCategories&&a.sensitiveDataCategories.length>0&&t++,a.crossBorderTransfers&&a.crossBorderTransfers.length>0&&i++,a.dpiaRequired&&n++,a.automatedDecisionMaking&&r++,a.nextReviewDate&&a.nextReviewDate<=m&&p.push(a),a.department&&(d[a.department]=(d[a.department]||0)+1);let g=Object.entries(d).map(([a,u])=>({department:a,count:u})).sort((a,u)=>u.count-a.count).slice(0,10);return {totalRecords:e.records.length,activeRecords:o,byLawfulBasis:s,sensitiveDataRecords:t,crossBorderRecords:i,dpiaRequiredRecords:n,automatedDecisionRecords:r,recordsDueForReview:p,topDepartments:g,lastUpdated:e.lastUpdated}}function f(e){return e.includes(",")||e.includes('"')||e.includes(`
2
+ `)||e.includes("\r")?`"${e.replace(/"/g,'""')}"`:e}function c(e){return e?new Date(e).toISOString():""}function R(e){let s=["ID","Name","Description","Controller Name","Controller Contact","Lawful Basis","Lawful Basis Justification","Purposes","Data Categories","Sensitive Data Categories","Data Subject Categories","Recipients","Cross-Border Transfers","Retention Period","Security Measures","Data Source","DPIA Required","DPIA Reference","Automated Decision-Making","Status","Department","Systems Used","Created At","Updated At","Last Reviewed At","Next Review Date"],o=e.records.map(i=>{let n=i.crossBorderTransfers?i.crossBorderTransfers.map(r=>`${r.destinationCountry} (${r.transferMechanism}: ${r.safeguards})`).join("; "):"";return [i.id,i.name,i.description,i.controllerDetails.name,i.controllerDetails.contact,i.lawfulBasis,i.lawfulBasisJustification,i.purposes.join("; "),i.dataCategories.join("; "),(i.sensitiveDataCategories||[]).join("; "),i.dataSubjectCategories.join("; "),i.recipients.join("; "),n,i.retentionPeriod,i.securityMeasures.join("; "),i.dataSource,i.dpiaRequired?"Yes":"No",i.dpiaReference||"",i.automatedDecisionMaking?"Yes":"No",i.status,i.department||"",(i.systemsUsed||[]).join("; "),c(i.createdAt),c(i.updatedAt),c(i.lastReviewedAt),c(i.nextReviewDate)].map(r=>f(String(r)))});return [s.map(i=>f(i)).join(","),...o.map(i=>i.join(","))].join(`
3
+ `)}function w(e){let s=[],o=Date.now();for(let t of e.records){let i=[];if((!t.lawfulBasisJustification||t.lawfulBasisJustification.trim()==="")&&i.push("Missing lawful basis justification (NDPA Section 25 requires documented justification)."),(!t.retentionPeriod||t.retentionPeriod.trim()==="")&&i.push("Missing retention period (data must not be kept longer than necessary)."),(!t.securityMeasures||t.securityMeasures.length===0)&&i.push("No security measures documented (NDPA requires appropriate technical and organizational measures)."),t.nextReviewDate&&t.nextReviewDate<=o){let n=Math.ceil((o-t.nextReviewDate)/864e5);i.push(`Review is overdue by ${n} day${n!==1?"s":""}.`);}if(t.dpiaRequired&&(!t.dpiaReference||t.dpiaReference.trim()==="")&&i.push("DPIA is required but no reference to a completed DPIA was provided."),t.automatedDecisionMaking&&(!t.automatedDecisionMakingDetails||t.automatedDecisionMakingDetails.trim()==="")&&i.push("Automated decision-making is flagged but no details are documented."),t.crossBorderTransfers)for(let n of t.crossBorderTransfers)(!n.safeguards||n.safeguards.trim()==="")&&i.push(`Cross-border transfer to ${n.destinationCountry} is missing safeguard documentation.`),(!n.transferMechanism||n.transferMechanism.trim()==="")&&i.push(`Cross-border transfer to ${n.destinationCountry} is missing transfer mechanism.`);t.dataSource==="third_party"&&(!t.thirdPartySourceDetails||t.thirdPartySourceDetails.trim()==="")&&i.push('Data source is "third_party" but no source details are provided.'),(!t.purposes||t.purposes.length===0)&&i.push("No processing purposes specified."),(!t.recipients||t.recipients.length===0)&&i.push("No recipients or categories of recipients specified."),i.length>0&&s.push({recordId:t.id,recordName:t.name,gaps:i});}return s}export{h as a,D as b,R as c,w as d};//# sourceMappingURL=chunk-PYEX7DFR.mjs.map
4
+ //# sourceMappingURL=chunk-PYEX7DFR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/ndpr-toolkit/src/utils/ropa.ts"],"names":["ALL_LAWFUL_BASES","validateProcessingRecord","record","errors","generateROPASummary","ropa","byLawfulBasis","acc","basis","activeRecords","sensitiveDataRecords","crossBorderRecords","dpiaRequiredRecords","automatedDecisionRecords","recordsDueForReview","departmentCounts","now","topDepartments","department","count","b","escapeCSVField","value","formatTimestamp","timestamp","exportROPAToCSV","headers","rows","crossBorderSummary","t","field","h","row","identifyComplianceGaps","gaps","recordGaps","overdueBy","transfer"],"mappings":"AAwBA,IAAMA,CAAAA,CAAkC,CACtC,SAAA,CACA,UAAA,CACA,mBACA,iBAAA,CACA,iBAAA,CACA,sBACF,CAAA,CASO,SAASC,CAAAA,CACdC,EACsB,CACtB,IAAMC,EAAmB,EAAC,CAE1B,QAAI,CAACD,CAAAA,CAAO,EAAA,E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AAA,CAIE,CAACjC,CAAAA,CAAO,UAAYA,CAAAA,CAAO,QAAA,CAAS,SAAW,CAAA,GACjDiC,CAAAA,CAAW,KAAK,mCAAmC,CAAA,CAAA,CAIjD,CAACjC,CAAAA,CAAO,UAAA,EAAcA,CAAAA,CAAO,WAAW,MAAA,GAAW,CAAA,GACrDiC,EAAW,IAAA,CAAK,sDAAsD,EAGpEA,CAAAA,CAAW,MAAA,CAAS,CAAA,EACtBD,CAAAA,CAAK,IAAA,CAAK,CACR,SAAUhC,CAAAA,CAAO,EAAA,CACjB,UAAA,CAAYA,CAAAA,CAAO,IAAA,CACnB,IAAA,CAAMiC,CACR,CAAC,EAEL,CAEA,OAAOD,CACT","file":"chunk-PYEX7DFR.mjs","sourcesContent":["import type { LawfulBasis } from '../types/lawful-basis';\nimport type {\n ProcessingRecord,\n RecordOfProcessingActivities,\n ROPASummary,\n} from '../types/ropa';\n\n/**\n * Compliance gap found in a processing record\n */\nexport interface ROPAComplianceGap {\n recordId: string;\n recordName: string;\n gaps: string[];\n}\n\n/**\n * Validation result for a processing record\n */\nexport interface ROPAValidationResult {\n valid: boolean;\n errors: string[];\n}\n\nconst ALL_LAWFUL_BASES: LawfulBasis[] = [\n 'consent',\n 'contract',\n 'legal_obligation',\n 'vital_interests',\n 'public_interest',\n 'legitimate_interests',\n];\n\n/**\n * Validates a processing record to ensure all required fields are present\n * and properly filled per NDPA 2023 requirements.\n *\n * @param record - The processing record to validate\n * @returns Validation result with any errors found\n */\nexport function validateProcessingRecord(\n record: ProcessingRecord\n): ROPAValidationResult {\n const errors: string[] = [];\n\n if (!record.id || record.id.trim() === '') {\n errors.push('Record ID is required.');\n }\n\n if (!record.name || record.name.trim() === '') {\n errors.push('Processing activity name is required.');\n }\n\n if (!record.description || record.description.trim() === '') {\n errors.push('Processing description is required.');\n }\n\n if (!record.controllerDetails) {\n errors.push('Controller details are required.');\n } else {\n if (!record.controllerDetails.name || record.controllerDetails.name.trim() === '') {\n errors.push('Controller name is required.');\n }\n if (!record.controllerDetails.contact || record.controllerDetails.contact.trim() === '') {\n errors.push('Controller contact is required.');\n }\n if (!record.controllerDetails.address || record.controllerDetails.address.trim() === '') {\n errors.push('Controller address is required.');\n }\n }\n\n if (!record.lawfulBasis || !ALL_LAWFUL_BASES.includes(record.lawfulBasis)) {\n errors.push('A valid lawful basis must be specified (NDPA Section 25).');\n }\n\n if (!record.lawfulBasisJustification || record.lawfulBasisJustification.trim() === '') {\n errors.push('Lawful basis justification is required to demonstrate compliance.');\n }\n\n if (!record.purposes || record.purposes.length === 0) {\n errors.push('At least one processing purpose must be specified.');\n }\n\n if (!record.dataCategories || record.dataCategories.length === 0) {\n errors.push('At least one data category must be specified.');\n }\n\n if (!record.dataSubjectCategories || record.dataSubjectCategories.length === 0) {\n errors.push('At least one data subject category must be specified.');\n }\n\n if (!record.recipients || record.recipients.length === 0) {\n errors.push('At least one recipient or category of recipients must be specified.');\n }\n\n if (!record.retentionPeriod || record.retentionPeriod.trim() === '') {\n errors.push('Retention period must be specified.');\n }\n\n if (!record.securityMeasures || record.securityMeasures.length === 0) {\n errors.push('At least one security measure must be documented.');\n }\n\n if (!record.dataSource) {\n errors.push('Data source must be specified.');\n }\n\n if (\n record.dataSource === 'third_party' &&\n (!record.thirdPartySourceDetails || record.thirdPartySourceDetails.trim() === '')\n ) {\n errors.push('Third-party source details are required when data source is \"third_party\".');\n }\n\n if (\n record.automatedDecisionMaking &&\n (!record.automatedDecisionMakingDetails || record.automatedDecisionMakingDetails.trim() === '')\n ) {\n errors.push(\n 'Automated decision-making details are required when automated decision-making is involved.'\n );\n }\n\n if (\n record.dpiaRequired &&\n (!record.dpiaReference || record.dpiaReference.trim() === '')\n ) {\n errors.push('DPIA reference is required when DPIA is marked as required.');\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n\n/**\n * Generates a summary of the Record of Processing Activities.\n * Provides statistics and identifies records that are due for review.\n *\n * @param ropa - The full Record of Processing Activities\n * @returns Summary statistics for the ROPA\n */\nexport function generateROPASummary(\n ropa: RecordOfProcessingActivities\n): ROPASummary {\n const byLawfulBasis = ALL_LAWFUL_BASES.reduce(\n (acc, basis) => {\n acc[basis] = 0;\n return acc;\n },\n {} as Record<LawfulBasis, number>\n );\n\n let activeRecords = 0;\n let sensitiveDataRecords = 0;\n let crossBorderRecords = 0;\n let dpiaRequiredRecords = 0;\n let automatedDecisionRecords = 0;\n const recordsDueForReview: ProcessingRecord[] = [];\n const departmentCounts: Record<string, number> = {};\n\n const now = Date.now();\n\n for (const record of ropa.records) {\n // Count by lawful basis\n if (record.lawfulBasis && ALL_LAWFUL_BASES.includes(record.lawfulBasis)) {\n byLawfulBasis[record.lawfulBasis]++;\n }\n\n // Count active records\n if (record.status === 'active') {\n activeRecords++;\n }\n\n // Count sensitive data records\n if (\n record.sensitiveDataCategories &&\n record.sensitiveDataCategories.length > 0\n ) {\n sensitiveDataRecords++;\n }\n\n // Count cross-border transfer records\n if (record.crossBorderTransfers && record.crossBorderTransfers.length > 0) {\n crossBorderRecords++;\n }\n\n // Count DPIA-required records\n if (record.dpiaRequired) {\n dpiaRequiredRecords++;\n }\n\n // Count automated decision-making records\n if (record.automatedDecisionMaking) {\n automatedDecisionRecords++;\n }\n\n // Identify records due for review\n if (record.nextReviewDate && record.nextReviewDate <= now) {\n recordsDueForReview.push(record);\n }\n\n // Track department counts\n if (record.department) {\n departmentCounts[record.department] =\n (departmentCounts[record.department] || 0) + 1;\n }\n }\n\n // Sort departments by count and take the top ones\n const topDepartments = Object.entries(departmentCounts)\n .map(([department, count]) => ({ department, count }))\n .sort((a, b) => b.count - a.count)\n .slice(0, 10);\n\n return {\n totalRecords: ropa.records.length,\n activeRecords,\n byLawfulBasis,\n sensitiveDataRecords,\n crossBorderRecords,\n dpiaRequiredRecords,\n automatedDecisionRecords,\n recordsDueForReview,\n topDepartments,\n lastUpdated: ropa.lastUpdated,\n };\n}\n\n/**\n * Escapes a string value for safe inclusion in CSV output\n */\nfunction escapeCSVField(value: string): string {\n if (\n value.includes(',') ||\n value.includes('\"') ||\n value.includes('\\n') ||\n value.includes('\\r')\n ) {\n return `\"${value.replace(/\"/g, '\"\"')}\"`;\n }\n return value;\n}\n\n/**\n * Formats a timestamp as an ISO date string for CSV export\n */\nfunction formatTimestamp(timestamp: number | undefined): string {\n if (!timestamp) return '';\n return new Date(timestamp).toISOString();\n}\n\n/**\n * Exports the Record of Processing Activities to a CSV string.\n * The CSV includes all key fields from each processing record.\n *\n * @param ropa - The full Record of Processing Activities\n * @returns CSV-formatted string\n */\nexport function exportROPAToCSV(ropa: RecordOfProcessingActivities): string {\n const headers = [\n 'ID',\n 'Name',\n 'Description',\n 'Controller Name',\n 'Controller Contact',\n 'Lawful Basis',\n 'Lawful Basis Justification',\n 'Purposes',\n 'Data Categories',\n 'Sensitive Data Categories',\n 'Data Subject Categories',\n 'Recipients',\n 'Cross-Border Transfers',\n 'Retention Period',\n 'Security Measures',\n 'Data Source',\n 'DPIA Required',\n 'DPIA Reference',\n 'Automated Decision-Making',\n 'Status',\n 'Department',\n 'Systems Used',\n 'Created At',\n 'Updated At',\n 'Last Reviewed At',\n 'Next Review Date',\n ];\n\n const rows = ropa.records.map((record) => {\n const crossBorderSummary = record.crossBorderTransfers\n ? record.crossBorderTransfers\n .map(\n (t) =>\n `${t.destinationCountry} (${t.transferMechanism}: ${t.safeguards})`\n )\n .join('; ')\n : '';\n\n return [\n record.id,\n record.name,\n record.description,\n record.controllerDetails.name,\n record.controllerDetails.contact,\n record.lawfulBasis,\n record.lawfulBasisJustification,\n record.purposes.join('; '),\n record.dataCategories.join('; '),\n (record.sensitiveDataCategories || []).join('; '),\n record.dataSubjectCategories.join('; '),\n record.recipients.join('; '),\n crossBorderSummary,\n record.retentionPeriod,\n record.securityMeasures.join('; '),\n record.dataSource,\n record.dpiaRequired ? 'Yes' : 'No',\n record.dpiaReference || '',\n record.automatedDecisionMaking ? 'Yes' : 'No',\n record.status,\n record.department || '',\n (record.systemsUsed || []).join('; '),\n formatTimestamp(record.createdAt),\n formatTimestamp(record.updatedAt),\n formatTimestamp(record.lastReviewedAt),\n formatTimestamp(record.nextReviewDate),\n ].map((field) => escapeCSVField(String(field)));\n });\n\n const csvLines = [\n headers.map((h) => escapeCSVField(h)).join(','),\n ...rows.map((row) => row.join(',')),\n ];\n\n return csvLines.join('\\n');\n}\n\n/**\n * Identifies compliance gaps in the Record of Processing Activities.\n * Finds records that are missing required information per NDPA 2023.\n *\n * @param ropa - The full Record of Processing Activities\n * @returns Array of compliance gaps grouped by record\n */\nexport function identifyComplianceGaps(\n ropa: RecordOfProcessingActivities\n): ROPAComplianceGap[] {\n const gaps: ROPAComplianceGap[] = [];\n const now = Date.now();\n\n for (const record of ropa.records) {\n const recordGaps: string[] = [];\n\n // Check lawful basis justification\n if (\n !record.lawfulBasisJustification ||\n record.lawfulBasisJustification.trim() === ''\n ) {\n recordGaps.push(\n 'Missing lawful basis justification (NDPA Section 25 requires documented justification).'\n );\n }\n\n // Check retention period\n if (!record.retentionPeriod || record.retentionPeriod.trim() === '') {\n recordGaps.push(\n 'Missing retention period (data must not be kept longer than necessary).'\n );\n }\n\n // Check security measures\n if (!record.securityMeasures || record.securityMeasures.length === 0) {\n recordGaps.push(\n 'No security measures documented (NDPA requires appropriate technical and organizational measures).'\n );\n }\n\n // Check for overdue review\n if (record.nextReviewDate && record.nextReviewDate <= now) {\n const overdueBy = Math.ceil(\n (now - record.nextReviewDate) / (24 * 60 * 60 * 1000)\n );\n recordGaps.push(\n `Review is overdue by ${overdueBy} day${overdueBy !== 1 ? 's' : ''}.`\n );\n }\n\n // Check DPIA reference when required\n if (\n record.dpiaRequired &&\n (!record.dpiaReference || record.dpiaReference.trim() === '')\n ) {\n recordGaps.push(\n 'DPIA is required but no reference to a completed DPIA was provided.'\n );\n }\n\n // Check automated decision-making documentation\n if (\n record.automatedDecisionMaking &&\n (!record.automatedDecisionMakingDetails ||\n record.automatedDecisionMakingDetails.trim() === '')\n ) {\n recordGaps.push(\n 'Automated decision-making is flagged but no details are documented.'\n );\n }\n\n // Check cross-border transfer safeguards\n if (record.crossBorderTransfers) {\n for (const transfer of record.crossBorderTransfers) {\n if (!transfer.safeguards || transfer.safeguards.trim() === '') {\n recordGaps.push(\n `Cross-border transfer to ${transfer.destinationCountry} is missing safeguard documentation.`\n );\n }\n if (\n !transfer.transferMechanism ||\n transfer.transferMechanism.trim() === ''\n ) {\n recordGaps.push(\n `Cross-border transfer to ${transfer.destinationCountry} is missing transfer mechanism.`\n );\n }\n }\n }\n\n // Check third-party source details\n if (\n record.dataSource === 'third_party' &&\n (!record.thirdPartySourceDetails ||\n record.thirdPartySourceDetails.trim() === '')\n ) {\n recordGaps.push(\n 'Data source is \"third_party\" but no source details are provided.'\n );\n }\n\n // Check missing purposes\n if (!record.purposes || record.purposes.length === 0) {\n recordGaps.push('No processing purposes specified.');\n }\n\n // Check missing recipients\n if (!record.recipients || record.recipients.length === 0) {\n recordGaps.push('No recipients or categories of recipients specified.');\n }\n\n if (recordGaps.length > 0) {\n gaps.push({\n recordId: record.id,\n recordName: record.name,\n gaps: recordGaps,\n });\n }\n }\n\n return gaps;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ function u(e){return e==="standard_clauses"||e==="binding_corporate_rules"||e==="ndpc_authorization"}function h(e){return {adequacy_decision:"Adequacy Decision (NDPA Section 41) \u2014 Transfer to a country or territory that the NDPC has determined provides an adequate level of data protection.",standard_clauses:"Standard Contractual Clauses (NDPA Section 42) \u2014 Transfer based on standard contractual clauses approved by the NDPC between the controller/processor and the recipient.",binding_corporate_rules:"Binding Corporate Rules (NDPA Section 43) \u2014 Transfer within a group of undertakings based on binding corporate rules approved by the NDPC.",ndpc_authorization:"NDPC Authorization (NDPA Section 44) \u2014 Transfer authorized by the Nigeria Data Protection Commission under specific conditions.",explicit_consent:"Explicit Consent (NDPA Section 45(a)) \u2014 Transfer based on the explicit and informed consent of the data subject after being informed of the risks.",contract_performance:"Contract Performance (NDPA Section 45(b)) \u2014 Transfer necessary for the performance of a contract between the data subject and the controller.",public_interest:"Public Interest (NDPA Section 45(c)) \u2014 Transfer necessary for important reasons of public interest.",legal_claims:"Legal Claims (NDPA Section 45(d)) \u2014 Transfer necessary for the establishment, exercise, or defense of legal claims.",vital_interests:"Vital Interests (NDPA Section 45(e)) \u2014 Transfer necessary to protect the vital interests of the data subject or other persons."}[e]}function m(e){var s,n;let t=[],a=[];return e.id||t.push("Transfer ID is required."),(!e.destinationCountry||e.destinationCountry.trim()==="")&&t.push("Destination country is required."),(!e.recipientOrganization||e.recipientOrganization.trim()==="")&&t.push("Recipient organization is required."),(!((s=e.recipientContact)!=null&&s.name)||e.recipientContact.name.trim()==="")&&t.push("Recipient contact name is required."),(!((n=e.recipientContact)!=null&&n.email)||e.recipientContact.email.trim()==="")&&t.push("Recipient contact email is required."),(!e.purpose||e.purpose.trim()==="")&&t.push("Purpose of the transfer is required."),e.transferMechanism||t.push("Transfer mechanism is required."),(!e.dataCategories||e.dataCategories.length===0)&&t.push("At least one data category must be specified."),(!e.riskAssessment||e.riskAssessment.trim()==="")&&t.push("Risk assessment summary is required."),(!e.safeguards||e.safeguards.length===0)&&t.push("At least one safeguard must be documented for the transfer."),u(e.transferMechanism)&&(e.ndpcApproval?(e.ndpcApproval.required||a.push("NDPC approval is marked as not required, but the selected transfer mechanism requires NDPC approval."),e.ndpcApproval.required&&!e.ndpcApproval.applied&&t.push("NDPC approval is required but an application has not been submitted."),e.ndpcApproval.applied&&!e.ndpcApproval.approved&&e.status==="active"&&t.push('Transfer is marked as active but NDPC approval has not been granted. Status should be "pending_approval".')):t.push(`NDPC approval documentation is required for transfers using ${d(e.transferMechanism)}.`)),e.tiaCompleted||a.push("A Transfer Impact Assessment (TIA) has not been completed for this transfer."),e.adequacyStatus==="inadequate"&&e.transferMechanism==="adequacy_decision"&&t.push("Cannot rely on adequacy decision (Section 41) when the destination country is marked as inadequate."),e.endDate&&e.startDate>e.endDate&&t.push("Start date must be before end date."),e.includesSensitiveData&&e.riskLevel!=="high"&&a.push("Transfer includes sensitive personal data but the risk level is not set to high. Consider reviewing the risk assessment."),e.reviewDate||a.push("No review date has been set for this transfer. Periodic reviews are recommended."),{isValid:t.length===0,errors:t,warnings:a}}function f(e){var o,c;let t=[],a=[],s=0,p={adequate:0,pending_review:2,unknown:3,inadequate:4}[e.adequacyStatus];s+=p,e.adequacyStatus==="inadequate"?(t.push("Destination country does not have an adequate level of data protection."),a.push("Implement supplementary technical and organizational measures.")):e.adequacyStatus==="unknown"?(t.push("Data protection adequacy of the destination country has not been assessed."),a.push("Conduct an adequacy assessment of the destination country.")):e.adequacyStatus==="pending_review"&&(t.push("Destination country adequacy is currently under review."),a.push("Monitor the adequacy review outcome and plan for contingencies."));let r={adequacy_decision:0,standard_clauses:1,binding_corporate_rules:1,ndpc_authorization:1,contract_performance:2,explicit_consent:2,legal_claims:2,public_interest:2,vital_interests:3}[e.transferMechanism];s+=r,r>=2&&(t.push(`Transfer relies on a derogation mechanism (${d(e.transferMechanism)}), which provides fewer structural safeguards.`),a.push("Consider whether a stronger transfer mechanism (adequacy decision, standard clauses, or BCRs) could be used instead.")),e.includesSensitiveData&&(s+=3,t.push("Transfer includes sensitive personal data, increasing the potential impact of unauthorized access."),a.push("Ensure encryption in transit and at rest, and apply strict access controls.")),e.estimatedDataSubjects&&e.estimatedDataSubjects>1e4?(s+=2,t.push("Large number of data subjects involved increases the scope of potential harm."),a.push("Consider data minimization strategies and ensure robust incident response procedures.")):e.estimatedDataSubjects&&e.estimatedDataSubjects>1e3&&(s+=1,t.push("Moderate number of data subjects involved.")),e.tiaCompleted||(s+=2,t.push("Transfer Impact Assessment has not been completed."),a.push("Complete a Transfer Impact Assessment before proceeding with the transfer.")),u(e.transferMechanism)&&((o=e.ndpcApproval)!=null&&o.approved||(s+=2,t.push("NDPC approval is required but has not been granted."),a.push("Obtain NDPC approval before activating the transfer."))),(((c=e.safeguards)==null?void 0:c.length)||0)<3&&(s+=1,t.push("Limited number of safeguards documented."),a.push("Document additional technical, organizational, and contractual safeguards.")),e.frequency==="continuous"&&(s+=1,t.push("Continuous data transfer increases exposure window."),a.push("Implement real-time monitoring and anomaly detection for the transfer."));let i;return s<=4?i="low":s<=9?i="medium":i="high",{riskLevel:i,riskScore:s,factors:t,recommendations:a}}function d(e){return {adequacy_decision:"Adequacy Decision",standard_clauses:"Standard Contractual Clauses",binding_corporate_rules:"Binding Corporate Rules",ndpc_authorization:"NDPC Authorization",explicit_consent:"Explicit Consent",contract_performance:"Contract Performance",public_interest:"Public Interest",legal_claims:"Legal Claims",vital_interests:"Vital Interests"}[e]}export{u as a,h as b,m as c,f as d};//# sourceMappingURL=chunk-QKK5S54L.mjs.map
2
+ //# sourceMappingURL=chunk-QKK5S54L.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../packages/ndpr-toolkit/src/utils/cross-border.ts"],"names":["isNDPCApprovalRequired","mechanism","getTransferMechanismDescription","validateTransfer","transfer","_a","_b","errors","warnings","getTransferMechanismLabel","assessTransferRisk","factors","recommendations","riskScore","adequacyScore","mechanismScore","riskLevel"],"mappings":"AAiCO,SAASA,CAAAA,CAAuBC,CAAAA,CAAuC,CAC5E,OACEA,CAAAA,GAAc,kBAAA,EACdA,CAAAA,GAAc,yBAAA,EACdA,CAAAA,GAAc,oBAElB,CAQO,SAASC,CAAAA,CAAgCD,CAAAA,CAAsC,CAsBpF,OArBwD,CACtD,iBAAA,CACE,2JAAA,CACF,gBAAA,CACE,+KAAA,CACF,uBAAA,CACE,iJAAA,CACF,kBAAA,CACE,sIAAA,CACF,gBAAA,CACE,yJAAA,CACF,oBAAA,CACE,qJACF,eAAA,CACE,0GAAA,CACF,YAAA,CACE,0HAAA,CACF,eAAA,CACE,qIACJ,CAAA,CAEoBA,CAAS,CAC/B,CAUO,SAASE,CAAAA,CAAiBC,CAAAA,CAAyD,CAhF1F,IAAAC,CAAAA,CAAAC,CAAAA,CAiFE,IAAMC,CAAAA,CAAmB,EAAC,CACpBC,CAAAA,CAAqB,E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A,GACvCO,CAAAA,EAAa,CAAA,CACbF,CAAAA,CAAQ,IAAA,CAAK,0CAA0C,EACvDC,CAAAA,CAAgB,IAAA,CAAK,4EAA4E,CAAA,CAAA,CAI/FR,CAAAA,CAAS,SAAA,GAAc,YAAA,GACzBS,CAAAA,EAAa,CAAA,CACbF,CAAAA,CAAQ,IAAA,CAAK,qDAAqD,CAAA,CAClEC,CAAAA,CAAgB,IAAA,CAAK,wEAAwE,CAAA,CAAA,CAI/F,IAAII,CAAAA,CACJ,OAAIH,CAAAA,EAAa,CAAA,CACfG,CAAAA,CAAY,KAAA,CACHH,CAAAA,EAAa,CAAA,CACtBG,CAAAA,CAAY,QAAA,CAEZA,CAAAA,CAAY,MAAA,CAGP,CACL,SAAA,CAAAA,EACA,SAAA,CAAAH,CAAAA,CACA,OAAA,CAAAF,CAAAA,CACA,eAAA,CAAAC,CACF,CACF,CAQA,SAASH,CAAAA,CAA0BR,CAAAA,CAAsC,CAavE,OAZkD,CAChD,iBAAA,CAAmB,mBAAA,CACnB,iBAAkB,8BAAA,CAClB,uBAAA,CAAyB,yBAAA,CACzB,kBAAA,CAAoB,oBAAA,CACpB,gBAAA,CAAkB,kBAAA,CAClB,oBAAA,CAAsB,sBAAA,CACtB,eAAA,CAAiB,iBAAA,CACjB,YAAA,CAAc,cAAA,CACd,eAAA,CAAiB,iBACnB,CAAA,CAEcA,CAAS,CACzB","file":"chunk-QKK5S54L.mjs","sourcesContent":["import {\n CrossBorderTransfer,\n TransferMechanism,\n AdequacyStatus,\n} from '../types/cross-border';\n\n/**\n * Validation result for a cross-border transfer\n */\nexport interface TransferValidationResult {\n isValid: boolean;\n errors: string[];\n warnings: string[];\n}\n\n/**\n * Risk assessment result for a cross-border transfer\n */\nexport interface TransferRiskResult {\n riskLevel: 'low' | 'medium' | 'high';\n riskScore: number;\n factors: string[];\n recommendations: string[];\n}\n\n/**\n * Returns whether NDPC approval is required for a given transfer mechanism.\n * Approval is required for standard contractual clauses (Section 42),\n * binding corporate rules (Section 43), and specific NDPC authorization (Section 44).\n *\n * @param mechanism The transfer mechanism\n * @returns Whether NDPC approval is required\n */\nexport function isNDPCApprovalRequired(mechanism: TransferMechanism): boolean {\n return (\n mechanism === 'standard_clauses' ||\n mechanism === 'binding_corporate_rules' ||\n mechanism === 'ndpc_authorization'\n );\n}\n\n/**\n * Returns a human-readable description of a transfer mechanism with its NDPA section reference.\n *\n * @param mechanism The transfer mechanism\n * @returns Description including the relevant NDPA section\n */\nexport function getTransferMechanismDescription(mechanism: TransferMechanism): string {\n const descriptions: Record<TransferMechanism, string> = {\n adequacy_decision:\n 'Adequacy Decision (NDPA Section 41) — Transfer to a country or territory that the NDPC has determined provides an adequate level of data protection.',\n standard_clauses:\n 'Standard Contractual Clauses (NDPA Section 42) — Transfer based on standard contractual clauses approved by the NDPC between the controller/processor and the recipient.',\n binding_corporate_rules:\n 'Binding Corporate Rules (NDPA Section 43) — Transfer within a group of undertakings based on binding corporate rules approved by the NDPC.',\n ndpc_authorization:\n 'NDPC Authorization (NDPA Section 44) — Transfer authorized by the Nigeria Data Protection Commission under specific conditions.',\n explicit_consent:\n 'Explicit Consent (NDPA Section 45(a)) — Transfer based on the explicit and informed consent of the data subject after being informed of the risks.',\n contract_performance:\n 'Contract Performance (NDPA Section 45(b)) — Transfer necessary for the performance of a contract between the data subject and the controller.',\n public_interest:\n 'Public Interest (NDPA Section 45(c)) — Transfer necessary for important reasons of public interest.',\n legal_claims:\n 'Legal Claims (NDPA Section 45(d)) — Transfer necessary for the establishment, exercise, or defense of legal claims.',\n vital_interests:\n 'Vital Interests (NDPA Section 45(e)) — Transfer necessary to protect the vital interests of the data subject or other persons.',\n };\n\n return descriptions[mechanism];\n}\n\n/**\n * Validates a cross-border transfer record for completeness and compliance.\n * Checks required fields, verifies that NDPC approval is documented when required,\n * and ensures safeguards are in place.\n *\n * @param transfer The cross-border transfer to validate\n * @returns Validation result with errors and warnings\n */\nexport function validateTransfer(transfer: CrossBorderTransfer): TransferValidationResult {\n const errors: string[] = [];\n const warnings: string[] = [];\n\n // Validate required fields\n if (!transfer.id) {\n errors.push('Transfer ID is required.');\n }\n\n if (!transfer.destinationCountry || transfer.destinationCountry.trim() === '') {\n errors.push('Destination country is required.');\n }\n\n if (!transfer.recipientOrganization || transfer.recipientOrganization.trim() === '') {\n errors.push('Recipient organization is required.');\n }\n\n if (!transfer.recipientContact?.name || transfer.recipientContact.name.trim() === '') {\n errors.push('Recipient contact name is required.');\n }\n\n if (!transfer.recipientContact?.email || transfer.recipientContact.email.trim() === '') {\n errors.push('Recipient contact email is required.');\n }\n\n if (!transfer.purpose || transfer.purpose.trim() === '') {\n errors.push('Purpose of the transfer is required.');\n }\n\n if (!transfer.transferMechanism) {\n errors.push('Transfer mechanism is required.');\n }\n\n if (!transfer.dataCategories || transfer.dataCategories.length === 0) {\n errors.push('At least one data category must be specified.');\n }\n\n if (!transfer.riskAssessment || transfer.riskAssessment.trim() === '') {\n errors.push('Risk assessment summary is required.');\n }\n\n // Validate safeguards\n if (!transfer.safeguards || transfer.safeguards.length === 0) {\n errors.push('At least one safeguard must be documented for the transfer.');\n }\n\n // Validate NDPC approval when required\n if (isNDPCApprovalRequired(transfer.transferMechanism)) {\n if (!transfer.ndpcApproval) {\n errors.push(\n `NDPC approval documentation is required for transfers using ${getTransferMechanismLabel(transfer.transferMechanism)}.`\n );\n } else {\n if (!transfer.ndpcApproval.required) {\n warnings.push(\n 'NDPC approval is marked as not required, but the selected transfer mechanism requires NDPC approval.'\n );\n }\n if (transfer.ndpcApproval.required && !transfer.ndpcApproval.applied) {\n errors.push('NDPC approval is required but an application has not been submitted.');\n }\n if (transfer.ndpcApproval.applied && !transfer.ndpcApproval.approved && transfer.status === 'active') {\n errors.push(\n 'Transfer is marked as active but NDPC approval has not been granted. Status should be \"pending_approval\".'\n );\n }\n }\n }\n\n // Validate TIA\n if (!transfer.tiaCompleted) {\n warnings.push('A Transfer Impact Assessment (TIA) has not been completed for this transfer.');\n }\n\n // Validate adequacy status alignment\n if (transfer.adequacyStatus === 'inadequate' && transfer.transferMechanism === 'adequacy_decision') {\n errors.push(\n 'Cannot rely on adequacy decision (Section 41) when the destination country is marked as inadequate.'\n );\n }\n\n // Validate dates\n if (transfer.endDate && transfer.startDate > transfer.endDate) {\n errors.push('Start date must be before end date.');\n }\n\n // Sensitive data warnings\n if (transfer.includesSensitiveData && transfer.riskLevel !== 'high') {\n warnings.push(\n 'Transfer includes sensitive personal data but the risk level is not set to high. Consider reviewing the risk assessment.'\n );\n }\n\n // Review date warning\n if (!transfer.reviewDate) {\n warnings.push('No review date has been set for this transfer. Periodic reviews are recommended.');\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n warnings,\n };\n}\n\n/**\n * Performs a basic risk assessment of a cross-border transfer based on adequacy status,\n * transfer mechanism, and data sensitivity.\n *\n * @param transfer The cross-border transfer to assess\n * @returns Risk assessment result with score, factors, and recommendations\n */\nexport function assessTransferRisk(transfer: CrossBorderTransfer): TransferRiskResult {\n const factors: string[] = [];\n const recommendations: string[] = [];\n let riskScore = 0;\n\n // Factor 1: Adequacy status\n const adequacyScores: Record<AdequacyStatus, number> = {\n adequate: 0,\n pending_review: 2,\n unknown: 3,\n inadequate: 4,\n };\n const adequacyScore = adequacyScores[transfer.adequacyStatus];\n riskScore += adequacyScore;\n\n if (transfer.adequacyStatus === 'inadequate') {\n factors.push('Destination country does not have an adequate level of data protection.');\n recommendations.push('Implement supplementary technical and organizational measures.');\n } else if (transfer.adequacyStatus === 'unknown') {\n factors.push('Data protection adequacy of the destination country has not been assessed.');\n recommendations.push('Conduct an adequacy assessment of the destination country.');\n } else if (transfer.adequacyStatus === 'pending_review') {\n factors.push('Destination country adequacy is currently under review.');\n recommendations.push('Monitor the adequacy review outcome and plan for contingencies.');\n }\n\n // Factor 2: Transfer mechanism strength\n const mechanismScores: Record<TransferMechanism, number> = {\n adequacy_decision: 0,\n standard_clauses: 1,\n binding_corporate_rules: 1,\n ndpc_authorization: 1,\n contract_performance: 2,\n explicit_consent: 2,\n legal_claims: 2,\n public_interest: 2,\n vital_interests: 3,\n };\n const mechanismScore = mechanismScores[transfer.transferMechanism];\n riskScore += mechanismScore;\n\n if (mechanismScore >= 2) {\n factors.push(\n `Transfer relies on a derogation mechanism (${getTransferMechanismLabel(transfer.transferMechanism)}), which provides fewer structural safeguards.`\n );\n recommendations.push(\n 'Consider whether a stronger transfer mechanism (adequacy decision, standard clauses, or BCRs) could be used instead.'\n );\n }\n\n // Factor 3: Sensitive data\n if (transfer.includesSensitiveData) {\n riskScore += 3;\n factors.push('Transfer includes sensitive personal data, increasing the potential impact of unauthorized access.');\n recommendations.push('Ensure encryption in transit and at rest, and apply strict access controls.');\n }\n\n // Factor 4: Scale of transfer\n if (transfer.estimatedDataSubjects && transfer.estimatedDataSubjects > 10000) {\n riskScore += 2;\n factors.push('Large number of data subjects involved increases the scope of potential harm.');\n recommendations.push('Consider data minimization strategies and ensure robust incident response procedures.');\n } else if (transfer.estimatedDataSubjects && transfer.estimatedDataSubjects > 1000) {\n riskScore += 1;\n factors.push('Moderate number of data subjects involved.');\n }\n\n // Factor 5: Missing TIA\n if (!transfer.tiaCompleted) {\n riskScore += 2;\n factors.push('Transfer Impact Assessment has not been completed.');\n recommendations.push('Complete a Transfer Impact Assessment before proceeding with the transfer.');\n }\n\n // Factor 6: NDPC approval pending\n if (isNDPCApprovalRequired(transfer.transferMechanism)) {\n if (!transfer.ndpcApproval?.approved) {\n riskScore += 2;\n factors.push('NDPC approval is required but has not been granted.');\n recommendations.push('Obtain NDPC approval before activating the transfer.');\n }\n }\n\n // Factor 7: Safeguards count\n if ((transfer.safeguards?.length || 0) < 3) {\n riskScore += 1;\n factors.push('Limited number of safeguards documented.');\n recommendations.push('Document additional technical, organizational, and contractual safeguards.');\n }\n\n // Factor 8: Continuous transfers\n if (transfer.frequency === 'continuous') {\n riskScore += 1;\n factors.push('Continuous data transfer increases exposure window.');\n recommendations.push('Implement real-time monitoring and anomaly detection for the transfer.');\n }\n\n // Determine risk level\n let riskLevel: 'low' | 'medium' | 'high';\n if (riskScore <= 4) {\n riskLevel = 'low';\n } else if (riskScore <= 9) {\n riskLevel = 'medium';\n } else {\n riskLevel = 'high';\n }\n\n return {\n riskLevel,\n riskScore,\n factors,\n recommendations,\n };\n}\n\n/**\n * Returns a short label for a transfer mechanism (without the full description).\n *\n * @param mechanism The transfer mechanism\n * @returns Short label\n */\nfunction getTransferMechanismLabel(mechanism: TransferMechanism): string {\n const labels: Record<TransferMechanism, string> = {\n adequacy_decision: 'Adequacy Decision',\n standard_clauses: 'Standard Contractual Clauses',\n binding_corporate_rules: 'Binding Corporate Rules',\n ndpc_authorization: 'NDPC Authorization',\n explicit_consent: 'Explicit Consent',\n contract_performance: 'Contract Performance',\n public_interest: 'Public Interest',\n legal_claims: 'Legal Claims',\n vital_interests: 'Vital Interests',\n };\n\n return labels[mechanism];\n}\n"]}
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkTDDAYVKK_js=require('./chunk-TDDAYVKK.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),e=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var e__default=/*#__PURE__*/_interopDefault(e);var S={name:"",description:"",lawfulBasis:"consent",lawfulBasisJustification:"",dataCategories:"",involvesSensitiveData:false,sensitiveDataCondition:"",dataSubjectCategories:"",purposes:"",retentionPeriod:"",retentionJustification:"",recipients:"",crossBorderTransfer:false,reviewDate:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""},M=[{value:"consent",label:"Consent"},{value:"contract",label:"Contract"},{value:"legal_obligation",label:"Legal Obligation"},{value:"vital_interests",label:"Vital Interests"},{value:"public_interest",label:"Public Interest"},{value:"legitimate_interests",label:"Legitimate Interests"}],G=[{value:"explicit_consent",label:"Explicit Consent"},{value:"employment_law",label:"Employment Law"},{value:"vital_interests_incapable",label:"Vital Interests (Incapable)"},{value:"nonprofit_legitimate",label:"Nonprofit Legitimate Activities"},{value:"publicly_available",label:"Publicly Available Data"},{value:"legal_claims",label:"Legal Claims"},{value:"substantial_public_interest",label:"Substantial Public Interest"},{value:"health_purposes",label:"Health Purposes"},{value:"public_health",label:"Public Health"},{value:"archiving_research",label:"Archiving / Research"}],me=({activities:p,onAddActivity:B,onUpdateActivity:P,onArchiveActivity:T,title:U="Lawful Basis Tracker",description:Y="Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25.",className:H="",buttonClassName:g="",showSummary:W=true,showComplianceGaps:q=true})=>{let[b,u]=e.useState("list"),[s,l]=e.useState(S),[v,k]=e.useState(null),[L,z]=e.useState(null),[x,K]=e.useState("all"),[y,Q]=e.useState("all"),[N,X]=e.useState(""),[F,c]=e.useState([]),[_,Z]=e.useState(p);e.useEffect(()=>{let t=[...p];if(x!=="all"&&(t=t.filter(i=>i.status===x)),y!=="all"&&(t=t.filter(i=>i.lawfulBasis===y)),N){let i=N.toLowerCase();t=t.filter(r=>r.name.toLowerCase().includes(i)||r.description.toLowerCase().includes(i)||r.purposes.some(m=>m.toLowerCase().includes(i)));}t.sort((i,r)=>r.updatedAt-i.updatedAt),Z(t);},[p,x,y,N]);let f=t=>new Date(t).toLocaleDateString(),h=chunkTDDAYVKK_js.d(p),C=chunkTDDAYVKK_js.c(p),w=t=>t.split(",").map(i=>i.trim()).filter(i=>i.length>0),R=()=>{l(S),k(null),c([]),u("form");},j=t=>{l({name:t.name,description:t.description,lawfulBasis:t.lawfulBasis,lawfulBasisJustification:t.lawfulBasisJustification,dataCategories:t.dataCategories.join(", "),involvesSensitiveData:t.involvesSensitiveData,sensitiveDataCondition:t.sensitiveDataCondition||"",dataSubjectCategories:t.dataSubjectCategories.join(", "),purposes:t.purposes.join(", "),retentionPeriod:t.retentionPeriod,retentionJustification:t.retentionJustification||"",recipients:(t.recipients||[]).join(", "),crossBorderTransfer:t.crossBorderTransfer,reviewDate:t.reviewDate?new Date(t.reviewDate).toISOString().split("T")[0]:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""}),k(t.id),c([]),u("form");},ee=()=>{let t={name:s.name,description:s.description,lawfulBasis:s.lawfulBasis,lawfulBasisJustification:s.lawfulBasisJustification,dataCategories:w(s.dataCategories),involvesSensitiveData:s.involvesSensitiveData,sensitiveDataCondition:s.sensitiveDataCondition||void 0,dataSubjectCategories:w(s.dataSubjectCategories),purposes:w(s.purposes),retentionPeriod:s.retentionPeriod,retentionJustification:s.retentionJustification||void 0,recipients:s.recipients?w(s.recipients):void 0,crossBorderTransfer:s.crossBorderTransfer,reviewDate:s.reviewDate?new Date(s.reviewDate).getTime():void 0,status:"active"},i=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{id:v||"temp",createdAt:Date.now(),updatedAt:Date.now()}),r=chunkTDDAYVKK_js.a(i);if(!r.isValid){c(r.errors);return}v&&P?P(v,t):B&&B(t),l(S),k(null),c([]),u("list");},I=t=>{T&&T(t);},te=t=>{z(t),u("detail");},a=L?p.find(t=>t.id===L):null,J=t=>{let i={active:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",inactive:"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",under_review:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",archived:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"},r={active:"Active",inactive:"Inactive",under_review:"Under Review",archived:"Archived"};return e__default.default.createElement("span",{className:`px-2 py-1 rounded text-xs font-medium ${i[t]}`},r[t])},E=t=>{let i={consent:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",contract:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",legal_obligation:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",vital_interests:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",public_interest:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",legitimate_interests:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},r={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"};return e__default.default.createElement("span",{className:`px-2 py-1 rounded text-xs font-medium ${i[t]}`},r[t])},O=t=>t.dpoApproval?t.dpoApproval.approved?e__default.default.createElement("span",{className:"px-2 py-1 rounded text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},"Approved"):e__default.default.createElement("span",{className:"px-2 py-1 rounded text-xs font-medium bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200"},"Pending Approval"):e__default.default.createElement("span",{className:"px-2 py-1 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400"},"No DPO Review"),se=()=>e__default.default.createElement("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6"},e__default.default.createElement("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg"},e__default.default.createElement("p",{className:"text-2xl font-bold text-blue-800 dark:text-blue-200"},h.totalActivities),e__default.default.createElement("p",{className:"text-sm text-blue-600 dark:text-blue-300"},"Total Activities")),e__default.default.createElement("div",{className:"bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg"},e__default.default.createElement("p",{className:"text-2xl font-bold text-orange-800 dark:text-orange-200"},h.sensitiveDataActivities),e__default.default.createElement("p",{className:"text-sm text-orange-600 dark:text-orange-300"},"Sensitive Data")),e__default.default.createElement("div",{className:"bg-purple-50 dark:bg-purple-900/20 p-4 rounded-lg"},e__default.default.createElement("p",{className:"text-2xl font-bold text-purple-800 dark:text-purple-200"},h.crossBorderActivities),e__default.default.createElement("p",{className:"text-sm text-purple-600 dark:text-purple-300"},"Cross-Border Transfers")),e__default.default.createElement("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg"},e__default.default.createElement("p",{className:"text-2xl font-bold text-red-800 dark:text-red-200"},h.activitiesWithoutApproval.length),e__default.default.createElement("p",{className:"text-sm text-red-600 dark:text-red-300"},"Pending Approval"))),ae=()=>{if(C.length===0)return e__default.default.createElement("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg mb-6"},e__default.default.createElement("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium"},"No compliance gaps detected."),e__default.default.createElement("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1"},"All processing activities appear to be properly documented."));let t=C.filter(r=>r.severity==="high"),i=C.filter(r=>r.severity==="medium");return e__default.default.createElement("div",{className:"mb-6"},t.length>0&&e__default.default.createElement("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-3"},e__default.default.createElement("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-2"},"High Priority (",t.length,")"),e__default.default.createElement("ul",{className:"space-y-1"},t.map((r,m)=>e__default.default.createElement("li",{key:m,className:"text-xs text-red-700 dark:text-red-300"},r.description)))),i.length>0&&e__default.default.createElement("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-4 rounded-lg"},e__default.default.createElement("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-2"},"Medium Priority (",i.length,")"),e__default.default.createElement("ul",{className:"space-y-1"},i.map((r,m)=>e__default.default.createElement("li",{key:m,className:"text-xs text-yellow-700 dark:text-yellow-300"},r.description)))))},ie=()=>e__default.default.createElement("div",null,e__default.default.createElement("div",{className:"flex justify-between items-center mb-4"},e__default.default.createElement("h3",{className:"text-lg font-medium"},v?"Edit Processing Activity":"New Processing Activity"),e__default.default.createElement("button",{onClick:()=>{u("list"),c([]);},className:`px-4 py-2 text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${g}`},"Cancel")),F.length>0&&e__default.default.createElement("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-4"},e__default.default.createElement("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-2"},"Please correct the following errors:"),e__default.default.createElement("ul",{className:"list-disc list-inside space-y-1"},F.map((t,i)=>e__default.default.createElement("li",{key:i,className:"text-xs text-red-700 dark:text-red-300"},t)))),e__default.default.createElement("div",{className:"space-y-4"},e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"activityName",className:"block text-sm font-medium mb-1"},"Activity Name *"),e__default.default.createElement("input",{type:"text",id:"activityName",value:s.name,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{name:t.target.value})),placeholder:"e.g., Customer Account Management",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"activityDescription",className:"block text-sm font-medium mb-1"},"Description *"),e__default.default.createElement("textarea",{id:"activityDescription",value:s.description,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{description:t.target.value})),placeholder:"Describe what processing is performed...",rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"lawfulBasis",className:"block text-sm font-medium mb-1"},"Lawful Basis (NDPA Section 25) *"),e__default.default.createElement("select",{id:"lawfulBasis",value:s.lawfulBasis,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{lawfulBasis:t.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},M.map(t=>e__default.default.createElement("option",{key:t.value,value:t.value},t.label))),e__default.default.createElement("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400"},chunkTDDAYVKK_js.b(s.lawfulBasis))),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"justification",className:"block text-sm font-medium mb-1"},"Lawful Basis Justification *"),e__default.default.createElement("textarea",{id:"justification",value:s.lawfulBasisJustification,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{lawfulBasisJustification:t.target.value})),placeholder:"Document why this lawful basis applies to this processing activity...",rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),s.lawfulBasis==="legitimate_interests"&&e__default.default.createElement("div",{className:"border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 bg-indigo-50 dark:bg-indigo-900/20"},e__default.default.createElement("h4",{className:"text-sm font-semibold text-indigo-800 dark:text-indigo-200 mb-3"},"Legitimate Interest Assessment (LIA)"),e__default.default.createElement("p",{className:"text-xs text-indigo-600 dark:text-indigo-300 mb-4"},"NDPA Section 25(1)(f) requires a balancing test when relying on legitimate interests."),e__default.default.createElement("div",{className:"space-y-3"},e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"liaPurpose",className:"block text-sm font-medium mb-1"},"Purpose Test"),e__default.default.createElement("textarea",{id:"liaPurpose",value:s.liaPurposeTest,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{liaPurposeTest:t.target.value})),placeholder:"Describe the legitimate interest being pursued...",rows:2,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"liaNecessity",className:"block text-sm font-medium mb-1"},"Necessity Test"),e__default.default.createElement("textarea",{id:"liaNecessity",value:s.liaNecessityTest,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{liaNecessityTest:t.target.value})),placeholder:"Explain why this processing is necessary for the stated purpose...",rows:2,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"liaBalancing",className:"block text-sm font-medium mb-1"},"Balancing Test"),e__default.default.createElement("textarea",{id:"liaBalancing",value:s.liaBalancingTest,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{liaBalancingTest:t.target.value})),placeholder:"Assess the impact on data subjects' rights and interests...",rows:2,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"liaSafeguards",className:"block text-sm font-medium mb-1"},"Safeguards"),e__default.default.createElement("input",{type:"text",id:"liaSafeguards",value:s.liaSafeguards,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{liaSafeguards:t.target.value})),placeholder:"List safeguards (comma-separated)...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"liaConclusion",className:"block text-sm font-medium mb-1"},"Conclusion"),e__default.default.createElement("textarea",{id:"liaConclusion",value:s.liaConclusion,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{liaConclusion:t.target.value})),placeholder:"State your overall conclusion...",rows:2,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})))),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"dataCategories",className:"block text-sm font-medium mb-1"},"Data Categories *"),e__default.default.createElement("input",{type:"text",id:"dataCategories",value:s.dataCategories,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{dataCategories:t.target.value})),placeholder:"e.g., Name, Email, Phone Number (comma-separated)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{className:"flex items-center space-x-2"},e__default.default.createElement("input",{type:"checkbox",checked:s.involvesSensitiveData,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{involvesSensitiveData:t.target.checked,sensitiveDataCondition:t.target.checked?s.sensitiveDataCondition:""})),className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),e__default.default.createElement("span",{className:"text-sm font-medium"},"Involves Sensitive Personal Data (NDPA Section 27)"))),s.involvesSensitiveData&&e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"sensitiveCondition",className:"block text-sm font-medium mb-1"},"Sensitive Data Condition (NDPA Section 27) *"),e__default.default.createElement("select",{id:"sensitiveCondition",value:s.sensitiveDataCondition,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{sensitiveDataCondition:t.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},e__default.default.createElement("option",{value:""},"Select a condition..."),G.map(t=>e__default.default.createElement("option",{key:t.value,value:t.value},t.label)))),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"dataSubjectCategories",className:"block text-sm font-medium mb-1"},"Data Subject Categories *"),e__default.default.createElement("input",{type:"text",id:"dataSubjectCategories",value:s.dataSubjectCategories,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{dataSubjectCategories:t.target.value})),placeholder:"e.g., Customers, Employees, Vendors (comma-separated)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"purposes",className:"block text-sm font-medium mb-1"},"Processing Purposes *"),e__default.default.createElement("input",{type:"text",id:"purposes",value:s.purposes,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{purposes:t.target.value})),placeholder:"e.g., Account management, Service delivery (comma-separated)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4"},e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"retentionPeriod",className:"block text-sm font-medium mb-1"},"Retention Period *"),e__default.default.createElement("input",{type:"text",id:"retentionPeriod",value:s.retentionPeriod,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{retentionPeriod:t.target.value})),placeholder:"e.g., 3 years after account closure",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"retentionJustification",className:"block text-sm font-medium mb-1"},"Retention Justification"),e__default.default.createElement("input",{type:"text",id:"retentionJustification",value:s.retentionJustification,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{retentionJustification:t.target.value})),placeholder:"Reason for the retention period",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}))),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"recipients",className:"block text-sm font-medium mb-1"},"Recipients"),e__default.default.createElement("input",{type:"text",id:"recipients",value:s.recipients,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{recipients:t.target.value})),placeholder:"e.g., Payment processor, Cloud provider (comma-separated)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",null,e__default.default.createElement("label",{className:"flex items-center space-x-2"},e__default.default.createElement("input",{type:"checkbox",checked:s.crossBorderTransfer,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{crossBorderTransfer:t.target.checked})),className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),e__default.default.createElement("span",{className:"text-sm font-medium"},"Involves Cross-Border Transfer Outside Nigeria"))),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"reviewDate",className:"block text-sm font-medium mb-1"},"Next Review Date"),e__default.default.createElement("input",{type:"date",id:"reviewDate",value:s.reviewDate,onChange:t=>l(chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},s),{reviewDate:t.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",{className:"flex justify-end space-x-3 pt-4"},e__default.default.createElement("button",{onClick:()=>{u("list"),c([]);},className:`px-4 py-2 text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${g}`},"Cancel"),e__default.default.createElement("button",{onClick:ee,className:`px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ${g}`},v?"Update Activity":"Create Activity")))),re=()=>{var i;if(!a)return e__default.default.createElement("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md"},e__default.default.createElement("p",{className:"text-gray-500 dark:text-gray-400"},"Activity not found."));let t=chunkTDDAYVKK_js.a(a);return e__default.default.createElement("div",null,e__default.default.createElement("div",{className:"flex justify-between items-start mb-4"},e__default.default.createElement("div",null,e__default.default.createElement("button",{onClick:()=>u("list"),className:"text-sm text-blue-600 dark:text-blue-400 hover:underline mb-2"},"Back to list"),e__default.default.createElement("h3",{className:"text-lg font-medium"},a.name)),e__default.default.createElement("div",{className:"flex space-x-2"},E(a.lawfulBasis),J(a.status),O(a))),t.warnings.length>0&&e__default.default.createElement("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md mb-4"},e__default.default.createElement("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium mb-1"},"Warnings"),e__default.default.createElement("ul",{className:"list-disc list-inside space-y-1"},t.warnings.map((r,m)=>e__default.default.createElement("li",{key:m,className:"text-xs text-yellow-700 dark:text-yellow-300"},r)))),e__default.default.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"},e__default.default.createElement("div",null,e__default.default.createElement("p",{className:"text-sm"},e__default.default.createElement("span",{className:"font-medium"},"Description:")," ",a.description),e__default.default.createElement("p",{className:"text-sm mt-2"},e__default.default.createElement("span",{className:"font-medium"},"Lawful Basis:")," ",chunkTDDAYVKK_js.b(a.lawfulBasis)),e__default.default.createElement("p",{className:"text-sm mt-2"},e__default.default.createElement("span",{className:"font-medium"},"Justification:")," ",a.lawfulBasisJustification)),e__default.default.createElement("div",null,e__default.default.createElement("p",{className:"text-sm"},e__default.default.createElement("span",{className:"font-medium"},"Data Categories:")," ",a.dataCategories.join(", ")),e__default.default.createElement("p",{className:"text-sm mt-2"},e__default.default.createElement("span",{className:"font-medium"},"Data Subject Categories:")," ",a.dataSubjectCategories.join(", ")),e__default.default.createElement("p",{className:"text-sm mt-2"},e__default.default.createElement("span",{className:"font-medium"},"Purposes:")," ",a.purposes.join(", ")),e__default.default.createElement("p",{className:"text-sm mt-2"},e__default.default.createElement("span",{className:"font-medium"},"Retention Period:")," ",a.retentionPeriod,a.retentionJustification&&e__default.default.createElement("span",{className:"text-gray-500 dark:text-gray-400"}," ","(",a.retentionJustification,")")))),e__default.default.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"},e__default.default.createElement("div",null,e__default.default.createElement("p",{className:"text-sm"},e__default.default.createElement("span",{className:"font-medium"},"Sensitive Data:")," ",a.involvesSensitiveData?"Yes":"No",a.sensitiveDataCondition&&e__default.default.createElement("span",null," ","(Condition:"," ",((i=G.find(r=>r.value===a.sensitiveDataCondition))==null?void 0:i.label)||a.sensitiveDataCondition,")")),e__default.default.createElement("p",{className:"text-sm mt-2"},e__default.default.createElement("span",{className:"font-medium"},"Cross-Border Transfer:")," ",a.crossBorderTransfer?"Yes":"No"),a.recipients&&a.recipients.length>0&&e__default.default.createElement("p",{className:"text-sm mt-2"},e__default.default.createElement("span",{className:"font-medium"},"Recipients:")," ",a.recipients.join(", "))),e__default.default.createElement("div",null,e__default.default.createElement("p",{className:"text-sm"},e__default.default.createElement("span",{className:"font-medium"},"Created:")," ",f(a.createdAt)),e__default.default.createElement("p",{className:"text-sm mt-2"},e__default.default.createElement("span",{className:"font-medium"},"Last Updated:")," ",f(a.updatedAt)),a.reviewDate&&e__default.default.createElement("p",{className:"text-sm mt-2"},e__default.default.createElement("span",{className:"font-medium"},"Next Review:")," ",f(a.reviewDate),a.reviewDate<Date.now()&&e__default.default.createElement("span",{className:"text-red-600 dark:text-red-400 font-medium"}," (Overdue)")))),a.dpoApproval&&e__default.default.createElement("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-6"},e__default.default.createElement("h4",{className:"text-sm font-semibold mb-2"},"DPO Approval"),e__default.default.createElement("p",{className:"text-sm"},e__default.default.createElement("span",{className:"font-medium"},"Status:")," ",a.dpoApproval.approved?"Approved":"Not Approved"),e__default.default.createElement("p",{className:"text-sm mt-1"},e__default.default.createElement("span",{className:"font-medium"},"Approved By:")," ",a.dpoApproval.approvedBy),e__default.default.createElement("p",{className:"text-sm mt-1"},e__default.default.createElement("span",{className:"font-medium"},"Date:")," ",f(a.dpoApproval.approvedAt)),a.dpoApproval.notes&&e__default.default.createElement("p",{className:"text-sm mt-1"},e__default.default.createElement("span",{className:"font-medium"},"Notes:")," ",a.dpoApproval.notes)),e__default.default.createElement("div",{className:"flex space-x-3"},e__default.default.createElement("button",{onClick:()=>j(a),className:`px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ${g}`},"Edit"),a.status!=="archived"&&e__default.default.createElement("button",{onClick:()=>I(a.id),className:`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 ${g}`},"Archive")))},le=()=>e__default.default.createElement("div",null,e__default.default.createElement("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4"},e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"basisFilter",className:"block text-sm font-medium mb-1"},"Lawful Basis"),e__default.default.createElement("select",{id:"basisFilter",value:y,onChange:t=>Q(t.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},e__default.default.createElement("option",{value:"all"},"All Bases"),M.map(t=>e__default.default.createElement("option",{key:t.value,value:t.value},t.label)))),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"statusFilterSelect",className:"block text-sm font-medium mb-1"},"Status"),e__default.default.createElement("select",{id:"statusFilterSelect",value:x,onChange:t=>K(t.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},e__default.default.createElement("option",{value:"all"},"All Statuses"),e__default.default.createElement("option",{value:"active"},"Active"),e__default.default.createElement("option",{value:"inactive"},"Inactive"),e__default.default.createElement("option",{value:"under_review"},"Under Review"),e__default.default.createElement("option",{value:"archived"},"Archived"))),e__default.default.createElement("div",null,e__default.default.createElement("label",{htmlFor:"searchInput",className:"block text-sm font-medium mb-1"},"Search"),e__default.default.createElement("input",{type:"text",id:"searchInput",value:N,onChange:t=>X(t.target.value),placeholder:"Search activities...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})),e__default.default.createElement("div",{className:"flex items-end"},e__default.default.createElement("button",{onClick:R,className:`w-full px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ${g}`},"Add Activity"))),_.length===0?e__default.default.createElement("div",{className:"flex items-center justify-center h-32 bg-gray-50 dark:bg-gray-700 rounded-md"},e__default.default.createElement("p",{className:"text-gray-500 dark:text-gray-400 text-sm"},"No processing activities found.")):e__default.default.createElement("div",{className:"overflow-x-auto"},e__default.default.createElement("table",{className:"w-full text-sm text-left"},e__default.default.createElement("thead",{className:"text-xs uppercase bg-gray-50 dark:bg-gray-700"},e__default.default.createElement("tr",null,e__default.default.createElement("th",{className:"px-4 py-3"},"Activity"),e__default.default.createElement("th",{className:"px-4 py-3"},"Lawful Basis"),e__default.default.createElement("th",{className:"px-4 py-3"},"Status"),e__default.default.createElement("th",{className:"px-4 py-3"},"DPO Approval"),e__default.default.createElement("th",{className:"px-4 py-3"},"Sensitive Data"),e__default.default.createElement("th",{className:"px-4 py-3"},"Last Updated"),e__default.default.createElement("th",{className:"px-4 py-3"},"Actions"))),e__default.default.createElement("tbody",null,_.map(t=>e__default.default.createElement("tr",{key:t.id,className:"border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700"},e__default.default.createElement("td",{className:"px-4 py-3"},e__default.default.createElement("button",{onClick:()=>te(t.id),className:"font-medium text-blue-600 dark:text-blue-400 hover:underline text-left"},t.name),e__default.default.createElement("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 truncate max-w-xs"},t.description)),e__default.default.createElement("td",{className:"px-4 py-3"},E(t.lawfulBasis)),e__default.default.createElement("td",{className:"px-4 py-3"},J(t.status)),e__default.default.createElement("td",{className:"px-4 py-3"},O(t)),e__default.default.createElement("td",{className:"px-4 py-3"},e__default.default.createElement("span",{className:`text-xs ${t.involvesSensitiveData?"text-orange-600 dark:text-orange-400 font-medium":"text-gray-500 dark:text-gray-400"}`},t.involvesSensitiveData?"Yes":"No")),e__default.default.createElement("td",{className:"px-4 py-3 text-xs text-gray-500 dark:text-gray-400"},f(t.updatedAt)),e__default.default.createElement("td",{className:"px-4 py-3"},e__default.default.createElement("div",{className:"flex space-x-2"},e__default.default.createElement("button",{onClick:()=>j(t),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline"},"Edit"),t.status!=="archived"&&e__default.default.createElement("button",{onClick:()=>I(t.id),className:"text-xs text-gray-600 dark:text-gray-400 hover:underline"},"Archive")))))))));return e__default.default.createElement("div",{className:`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${H}`},e__default.default.createElement("h2",{className:"text-xl font-bold mb-2"},U),e__default.default.createElement("p",{className:"mb-6 text-gray-600 dark:text-gray-300"},Y),W&&b==="list"&&se(),q&&b==="list"&&ae(),b==="list"&&le(),b==="form"&&ie(),b==="detail"&&re())};exports.a=me;//# sourceMappingURL=chunk-RB26MIRI.js.map
2
+ //# sourceMappingURL=chunk-RB26MIRI.js.map