@tantainnovative/ndpr-toolkit 3.2.1 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +37 -4
  2. package/dist/{DPIAQuestionnaire-BkejviPj.d.mts → DPIAQuestionnaire-VXBoWFMC.d.ts} +3 -3
  3. package/dist/{DPIAQuestionnaire-DdSqXG3x.d.ts → DPIAQuestionnaire-jkt1Veb6.d.mts} +3 -3
  4. package/dist/{DSRRequestForm-BY8PogCU.d.mts → DSRRequestForm-D8rPTNmU.d.ts} +2 -2
  5. package/dist/{DSRRequestForm-CHUg9cZh.d.ts → DSRRequestForm-DRouEr9j.d.mts} +2 -2
  6. package/dist/{DSRTracker-Dr_aT0pg.d.ts → DSRTracker-Bl__d4df.d.ts} +1 -1
  7. package/dist/{DSRTracker-C6u_jAaK.d.mts → DSRTracker-CSVDfgQQ.d.mts} +1 -1
  8. package/dist/{StepIndicator-D9ZATz_O.d.ts → StepIndicator-CgrlokSV.d.ts} +1 -1
  9. package/dist/{StepIndicator-D-nwRTyo.d.mts → StepIndicator-W8S_QjgO.d.mts} +1 -1
  10. package/dist/breach.js +1 -1
  11. package/dist/breach.mjs +1 -1
  12. package/dist/chunk-25OOUES4.js +2 -0
  13. package/dist/chunk-2AW7KAZO.mjs +2 -0
  14. package/dist/chunk-4JKTIR33.mjs +2 -0
  15. package/dist/chunk-5BUS6AI7.js +2 -0
  16. package/dist/chunk-5ECDPRSZ.js +7 -0
  17. package/dist/chunk-5X32J5IA.mjs +2 -0
  18. package/dist/chunk-6FGCGLH5.mjs +2 -0
  19. package/dist/chunk-6YN73KR7.mjs +2 -0
  20. package/dist/chunk-75TJPK2N.mjs +2 -0
  21. package/dist/{chunk-NXQMU36Z.mjs → chunk-7D2OIPHH.mjs} +2 -2
  22. package/dist/chunk-C4YM4UMI.js +2 -0
  23. package/dist/{chunk-EH2I4L7M.mjs → chunk-CDZDT2OS.mjs} +14 -10
  24. package/dist/chunk-CYU6YUJQ.mjs +81 -0
  25. package/dist/chunk-DCJK5OZT.mjs +2 -0
  26. package/dist/chunk-EKHBORAH.js +81 -0
  27. package/dist/chunk-ENIMJ6SQ.js +2 -0
  28. package/dist/chunk-FLKJSGR7.mjs +94 -0
  29. package/dist/chunk-FWLPJ5YI.js +94 -0
  30. package/dist/chunk-GMLCWGNJ.js +7 -0
  31. package/dist/chunk-GXLSOZCH.mjs +2 -0
  32. package/dist/{chunk-NRQELKAE.js → chunk-JKKRPS4P.js} +2 -2
  33. package/dist/chunk-LETEUS5X.mjs +2 -0
  34. package/dist/chunk-M2TPT5GB.js +2 -0
  35. package/dist/chunk-MCWV7S2G.js +2 -0
  36. package/dist/chunk-NBSVFQ5G.js +2 -0
  37. package/dist/chunk-OPYQIJKY.js +2 -0
  38. package/dist/chunk-OYR3L4XS.mjs +7 -0
  39. package/dist/chunk-QF6XNKU6.mjs +2 -0
  40. package/dist/{chunk-256APOQM.js → chunk-QJ3JNHO7.js} +2 -2
  41. package/dist/{chunk-Q7VHB64E.mjs → chunk-QNCGRCAX.mjs} +2 -2
  42. package/dist/chunk-TI2M7H6R.mjs +7 -0
  43. package/dist/{chunk-KVOGOLIR.js → chunk-TXXWCB5O.js} +14 -10
  44. package/dist/{chunk-44W4H2EY.js → chunk-UGY5ZYUG.js} +2 -2
  45. package/dist/chunk-UO6QPJLH.js +2 -0
  46. package/dist/chunk-UX6ZZNEM.mjs +3 -0
  47. package/dist/chunk-XFUEZ3MP.mjs +2 -0
  48. package/dist/chunk-XHSHPB74.js +2 -0
  49. package/dist/chunk-XSEZDQLB.js +2 -0
  50. package/dist/chunk-YCX6BFOQ.js +2 -0
  51. package/dist/chunk-YURSF2YO.mjs +2 -0
  52. package/dist/chunk-YZXUAIYN.js +3 -0
  53. package/dist/chunk-Z6IIMLZU.mjs +2 -0
  54. package/dist/chunk-ZT7KNFAU.mjs +2 -0
  55. package/dist/chunk-ZYLDLGFL.js +2 -0
  56. package/dist/consent.js +1 -1
  57. package/dist/consent.mjs +1 -1
  58. package/dist/core.d.mts +25 -9
  59. package/dist/core.d.ts +25 -9
  60. package/dist/core.js +1 -1
  61. package/dist/core.mjs +1 -1
  62. package/dist/cross-border.d.mts +70 -3
  63. package/dist/cross-border.d.ts +70 -3
  64. package/dist/cross-border.js +1 -1
  65. package/dist/cross-border.mjs +1 -1
  66. package/dist/{dpia-B0Pok5us.d.ts → dpia-D82hUrJe.d.ts} +1 -1
  67. package/dist/{dpia-CUfOmzvX.d.mts → dpia-DQDFw2_l.d.mts} +1 -1
  68. package/dist/{dpia-5OQVA1R_.d.mts → dpia-c9GiiOq0.d.mts} +2 -2
  69. package/dist/{dpia-5OQVA1R_.d.ts → dpia-c9GiiOq0.d.ts} +2 -2
  70. package/dist/dpia.d.mts +9 -9
  71. package/dist/dpia.d.ts +9 -9
  72. package/dist/dpia.js +1 -1
  73. package/dist/dpia.mjs +1 -1
  74. package/dist/{dsr-D_eTNc4S.d.mts → dsr-CIx5sd7e.d.ts} +2 -2
  75. package/dist/{dsr-pNtVb1BK.d.ts → dsr-XZ_HqTlA.d.mts} +2 -2
  76. package/dist/{dsr-Cm9lzWG7.d.mts → dsr-yKbqX531.d.mts} +1 -1
  77. package/dist/{dsr-Cm9lzWG7.d.ts → dsr-yKbqX531.d.ts} +1 -1
  78. package/dist/dsr.d.mts +9 -9
  79. package/dist/dsr.d.ts +9 -9
  80. package/dist/dsr.js +1 -1
  81. package/dist/dsr.mjs +1 -1
  82. package/dist/hooks.d.mts +8 -8
  83. package/dist/hooks.d.ts +8 -8
  84. package/dist/hooks.js +1 -1
  85. package/dist/hooks.mjs +1 -1
  86. package/dist/index.d.mts +13 -13
  87. package/dist/index.d.ts +13 -13
  88. package/dist/index.js +1 -1
  89. package/dist/index.mjs +1 -1
  90. package/dist/lawful-basis.js +1 -1
  91. package/dist/lawful-basis.mjs +1 -1
  92. package/dist/{policy-engine-DSQpT55_.d.ts → policy-engine-C6nC2t3a.d.ts} +1 -1
  93. package/dist/{policy-engine-C-tShzZH.d.mts → policy-engine-DefZcX3R.d.mts} +1 -1
  94. package/dist/{policy-sections-CfNVBLCh.d.mts → policy-sections-Bylm31kZ.d.mts} +1 -1
  95. package/dist/{policy-sections-DqH0iZRf.d.ts → policy-sections-DFDPVCCg.d.ts} +1 -1
  96. package/dist/policy.d.mts +6 -6
  97. package/dist/policy.d.ts +6 -6
  98. package/dist/policy.js +1 -1
  99. package/dist/policy.mjs +1 -1
  100. package/dist/presets.d.mts +5 -5
  101. package/dist/presets.d.ts +5 -5
  102. package/dist/presets.js +1 -1
  103. package/dist/presets.mjs +1 -1
  104. package/dist/ropa.js +1 -1
  105. package/dist/ropa.mjs +1 -1
  106. package/dist/{sanitize-9mOO_cJW.d.mts → sanitize-B0AzEm1D.d.mts} +14 -1
  107. package/dist/{sanitize-9mOO_cJW.d.ts → sanitize-B0AzEm1D.d.ts} +14 -1
  108. package/dist/{useAdaptivePolicyWizard-N4eUM4Tj.d.mts → useAdaptivePolicyWizard-A1PyOy6P.d.mts} +1 -1
  109. package/dist/{useAdaptivePolicyWizard-B9Op2gYM.d.ts → useAdaptivePolicyWizard-LVIKhAxw.d.ts} +1 -1
  110. package/dist/{useCrossBorderTransfer-BGNZt2lk.d.mts → useCrossBorderTransfer-DixjLjN1.d.mts} +1 -1
  111. package/dist/{useCrossBorderTransfer-COqjgjsu.d.ts → useCrossBorderTransfer-DvSq06lv.d.ts} +1 -1
  112. package/dist/{useDPIA-DzWye8JB.d.mts → useDPIA-B6180UQn.d.mts} +9 -5
  113. package/dist/{useDPIA-Dl16Te3r.d.ts → useDPIA-CTqbNbww.d.ts} +9 -5
  114. package/dist/{useDSR-C1LksCfP.d.mts → useDSR-WvHk8_iu.d.mts} +2 -2
  115. package/dist/{useDSR-DZel52O1.d.ts → useDSR-wH4H6hSM.d.ts} +2 -2
  116. package/dist/{useDefaultPrivacyPolicy-C-mG-A5S.d.ts → useDefaultPrivacyPolicy-DvCbeEl1.d.ts} +5 -1
  117. package/dist/{useDefaultPrivacyPolicy-BsYttRey.d.mts → useDefaultPrivacyPolicy-ySWU7nc-.d.mts} +5 -1
  118. package/package.json +7 -5
  119. package/dist/chunk-2FWCVWKN.js +0 -2
  120. package/dist/chunk-3DJGO6WG.js +0 -2
  121. package/dist/chunk-3UWT64FI.mjs +0 -2
  122. package/dist/chunk-4JUDKBA2.mjs +0 -7
  123. package/dist/chunk-4XCL62MJ.mjs +0 -2
  124. package/dist/chunk-555WWZ3W.js +0 -2
  125. package/dist/chunk-6BXUVS6E.js +0 -81
  126. package/dist/chunk-6RQGQZT2.js +0 -2
  127. package/dist/chunk-CL53OI3I.js +0 -7
  128. package/dist/chunk-E63VPR7U.js +0 -2
  129. package/dist/chunk-ELKEZEV5.mjs +0 -2
  130. package/dist/chunk-ER7X6E36.js +0 -2
  131. package/dist/chunk-FDDI426Y.mjs +0 -2
  132. package/dist/chunk-FOXZRRMW.mjs +0 -2
  133. package/dist/chunk-FY5G6DGZ.js +0 -7
  134. package/dist/chunk-GOD4LA2J.mjs +0 -2
  135. package/dist/chunk-I23WPZNQ.mjs +0 -94
  136. package/dist/chunk-IQF726GS.js +0 -2
  137. package/dist/chunk-IR7VCBWV.mjs +0 -2
  138. package/dist/chunk-K45S6YQV.mjs +0 -2
  139. package/dist/chunk-KBAFOVE3.js +0 -2
  140. package/dist/chunk-KBP26GLC.js +0 -2
  141. package/dist/chunk-MDWG2KDA.mjs +0 -2
  142. package/dist/chunk-NN233SGA.mjs +0 -3
  143. package/dist/chunk-NPI5T6NH.mjs +0 -7
  144. package/dist/chunk-NUDVUAD4.mjs +0 -81
  145. package/dist/chunk-PM7O5IGE.mjs +0 -2
  146. package/dist/chunk-QH6YUVJS.js +0 -2
  147. package/dist/chunk-QKK5S54L.mjs +0 -2
  148. package/dist/chunk-QY7PD5XB.js +0 -94
  149. package/dist/chunk-TVW6KBVV.mjs +0 -2
  150. package/dist/chunk-UDNRAQLE.js +0 -3
  151. package/dist/chunk-UNKXYVXY.js +0 -2
  152. package/dist/chunk-V37BM2LF.js +0 -2
  153. package/dist/chunk-V3MXWGXU.mjs +0 -2
  154. package/dist/chunk-VK27WVV3.js +0 -2
  155. package/dist/chunk-XQ4M5FHC.mjs +0 -2
package/README.md CHANGED
@@ -3,13 +3,19 @@
3
3
  **Compliance infrastructure for the Nigeria Data Protection Act (NDPA) 2023**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@tantainnovative/ndpr-toolkit.svg)](https://www.npmjs.com/package/@tantainnovative/ndpr-toolkit)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@tantainnovative/ndpr-toolkit.svg)](https://www.npmjs.com/package/@tantainnovative/ndpr-toolkit)
6
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-3178C6.svg)](https://www.typescriptlang.org/)
9
+ [![Tests](https://img.shields.io/badge/tests-788%20passing-brightgreen.svg)](#)
8
10
  [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@tantainnovative/ndpr-toolkit)](https://bundlephobia.com/package/@tantainnovative/ndpr-toolkit)
9
11
 
10
12
  v3 ships **zero-config presets**, **pluggable storage adapters**, **compound components**, and a **compliance score engine** — eight production-ready modules covering consent, data subject rights, DPIA, breach notification, privacy policies, lawful basis, cross-border transfers, and ROPA.
11
13
 
12
- **[Documentation](https://ndprtoolkit.com.ng)** | **[Live Demos](https://ndprtoolkit.com.ng/ndpr-demos)** | **[npm](https://www.npmjs.com/package/@tantainnovative/ndpr-toolkit)**
14
+ **[Documentation](https://ndprtoolkit.com.ng)** | **[Live Demos](https://ndprtoolkit.com.ng/ndpr-demos)** | **[npm](https://www.npmjs.com/package/@tantainnovative/ndpr-toolkit)** | **[Blog](https://ndprtoolkit.com.ng/blog)**
15
+
16
+ <p align="center">
17
+ <img src="public/screenshots/hero.png" alt="NDPA Toolkit — NDPA Compliance Made Beautiful" width="800" />
18
+ </p>
13
19
 
14
20
  ---
15
21
 
@@ -56,6 +62,12 @@ import { apiAdapter } from '@tantainnovative/ndpr-toolkit/adapters';
56
62
 
57
63
  That's it. NDPA-compliant consent with server-side persistence in under 20 lines.
58
64
 
65
+ <p align="center">
66
+ <img src="public/screenshots/consent-demo.png" alt="Consent Management Demo — interactive consent banner with state inspector" width="800" />
67
+ <br />
68
+ <em>Interactive consent demo with configurable position, theme, storage, and real-time state inspector</em>
69
+ </p>
70
+
59
71
  ---
60
72
 
61
73
  ## Install
@@ -182,7 +194,7 @@ import { composeAdapters, apiAdapter, localStorageAdapter } from '@tantainnovati
182
194
 
183
195
  **Cookie (server-readable, for SSR consent gating):**
184
196
  ```tsx
185
- <NDPRConsent adapter={cookieAdapter({ name: 'ndpr_consent', maxAge: 365 * 24 * 60 * 60 })} />
197
+ <NDPRConsent adapter={cookieAdapter('ndpr_consent', { expires: 365 })} />
186
198
  ```
187
199
 
188
200
  ---
@@ -209,7 +221,7 @@ const report = getComplianceScore({
209
221
  supportsErasure: false,
210
222
  supportsPortability: false,
211
223
  supportsObjection: false,
212
- maxResponseDays: 30,
224
+ responseTimelineDays: 30,
213
225
  },
214
226
  // ... other modules
215
227
  });
@@ -262,6 +274,27 @@ Copy the files you need into your project. [Browse the recipes →](https://gith
262
274
 
263
275
  ---
264
276
 
277
+ ## Live Demos
278
+
279
+ Every module has an interactive demo. No signup, no setup — try them instantly.
280
+
281
+ <p align="center">
282
+ <a href="https://ndprtoolkit.com.ng/ndpr-demos">
283
+ <img src="public/screenshots/demos-overview.png" alt="8 interactive live demos — zero setup required" width="800" />
284
+ </a>
285
+ </p>
286
+
287
+ <p align="center">
288
+ <img src="public/screenshots/dsr-demo.png" alt="Data Subject Rights — 8 rights with request tracking" width="400" />
289
+ <img src="public/screenshots/breach-demo.png" alt="Breach Notification — 72-hour countdown with step-by-step workflow" width="400" />
290
+ </p>
291
+
292
+ <p align="center">
293
+ <em>Left: Data Subject Rights portal with 8 NDPA rights. Right: Breach notification with 72-hour NDPC deadline countdown.</em>
294
+ </p>
295
+
296
+ ---
297
+
265
298
  ## All 8 Modules
266
299
 
267
300
  | Module | Import path | NDPA reference | Key exports |
@@ -311,7 +344,7 @@ Every component supports three modes:
311
344
  />
312
345
  ```
313
346
 
314
- Each component exports its `ClassNames` TypeScript interface for autocomplete. Full reference in the [docs](https://ndprtoolkit.com.ng/docs/styling).
347
+ Each component exports its `ClassNames` TypeScript interface for autocomplete. Full reference in the [docs](https://ndprtoolkit.com.ng/docs/guides/styling-customization).
315
348
 
316
349
  ---
317
350
 
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { c as DPIASection } from './dpia-5OQVA1R_.mjs';
2
+ import { c as DPIASection } from './dpia-c9GiiOq0.js';
3
3
 
4
4
  interface DPIAQuestionnaireClassNames {
5
5
  /** Outermost wrapper */
@@ -45,11 +45,11 @@ interface DPIAQuestionnaireProps {
45
45
  /**
46
46
  * Current answers to the questionnaire
47
47
  */
48
- answers: Record<string, any>;
48
+ answers: Record<string, string | number | boolean | string[]>;
49
49
  /**
50
50
  * Callback function called when an answer is updated
51
51
  */
52
- onAnswerChange: (questionId: string, value: any) => void;
52
+ onAnswerChange: (questionId: string, value: string | number | boolean | string[]) => void;
53
53
  /**
54
54
  * Current section index
55
55
  */
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { c as DPIASection } from './dpia-5OQVA1R_.js';
2
+ import { c as DPIASection } from './dpia-c9GiiOq0.mjs';
3
3
 
4
4
  interface DPIAQuestionnaireClassNames {
5
5
  /** Outermost wrapper */
@@ -45,11 +45,11 @@ interface DPIAQuestionnaireProps {
45
45
  /**
46
46
  * Current answers to the questionnaire
47
47
  */
48
- answers: Record<string, any>;
48
+ answers: Record<string, string | number | boolean | string[]>;
49
49
  /**
50
50
  * Callback function called when an answer is updated
51
51
  */
52
- onAnswerChange: (questionId: string, value: any) => void;
52
+ onAnswerChange: (questionId: string, value: string | number | boolean | string[]) => void;
53
53
  /**
54
54
  * Current section index
55
55
  */
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { c as RequestType } from './dsr-Cm9lzWG7.mjs';
2
+ import { c as RequestType } from './dsr-yKbqX531.js';
3
3
 
4
4
  /**
5
5
  * Represents the data submitted by the DSR request form.
@@ -16,7 +16,7 @@ interface DSRFormSubmission {
16
16
  identifierValue: string;
17
17
  };
18
18
  /** Additional information provided for the selected request type */
19
- additionalInfo?: Record<string, any>;
19
+ additionalInfo?: Record<string, string | number | boolean | null>;
20
20
  /** Timestamp (ms) when the form was submitted */
21
21
  submittedAt: number;
22
22
  }
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { c as RequestType } from './dsr-Cm9lzWG7.js';
2
+ import { c as RequestType } from './dsr-yKbqX531.mjs';
3
3
 
4
4
  /**
5
5
  * Represents the data submitted by the DSR request form.
@@ -16,7 +16,7 @@ interface DSRFormSubmission {
16
16
  identifierValue: string;
17
17
  };
18
18
  /** Additional information provided for the selected request type */
19
- additionalInfo?: Record<string, any>;
19
+ additionalInfo?: Record<string, string | number | boolean | null>;
20
20
  /** Timestamp (ms) when the form was submitted */
21
21
  submittedAt: number;
22
22
  }
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { D as DSRRequest, a as DSRStatus } from './dsr-Cm9lzWG7.js';
2
+ import { D as DSRRequest, a as DSRStatus } from './dsr-yKbqX531.js';
3
3
 
4
4
  interface DSRDashboardClassNames {
5
5
  root?: string;
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { D as DSRRequest, a as DSRStatus } from './dsr-Cm9lzWG7.mjs';
2
+ import { D as DSRRequest, a as DSRStatus } from './dsr-yKbqX531.mjs';
3
3
 
4
4
  interface DSRDashboardClassNames {
5
5
  root?: string;
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { a as DPIAResult, c as DPIASection } from './dpia-5OQVA1R_.js';
2
+ import { a as DPIAResult, c as DPIASection } from './dpia-c9GiiOq0.js';
3
3
 
4
4
  interface DPIAReportClassNames {
5
5
  /** Outermost wrapper */
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { a as DPIAResult, c as DPIASection } from './dpia-5OQVA1R_.mjs';
2
+ import { a as DPIAResult, c as DPIASection } from './dpia-c9GiiOq0.mjs';
3
3
 
4
4
  interface DPIAReportClassNames {
5
5
  /** Outermost wrapper */
package/dist/breach.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk6BXUVS6E_js=require('./chunk-6BXUVS6E.js'),chunkSAA7UVI2_js=require('./chunk-SAA7UVI2.js'),chunkI4M2AA3N_js=require('./chunk-I4M2AA3N.js'),chunkBKRETVJ6_js=require('./chunk-BKRETVJ6.js');require('./chunk-I54CDQGN.js'),require('./chunk-E64TU6IU.js'),require('./chunk-ELKB2AFZ.js');var chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var p=react.createContext(null);function P(){let e=react.useContext(p);if(!e)throw new Error("Breach compound components must be wrapped in <Breach.Provider>. Example: <Breach.Provider categories={...}><Breach.ReportForm /></Breach.Provider>");return e}var s=({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u,children:d})=>{let y=chunkI4M2AA3N_js.a({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u}),l=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},y),{categories:e});return jsxRuntime.jsx(p.Provider,{value:l,children:d})};var A={Provider:s,ReportForm:chunkSAA7UVI2_js.a,RiskAssessment:chunk6BXUVS6E_js.a,NotificationManager:chunk6BXUVS6E_js.b,ReportGenerator:chunk6BXUVS6E_js.c};Object.defineProperty(exports,"BreachNotificationManager",{enumerable:true,get:function(){return chunk6BXUVS6E_js.b}});Object.defineProperty(exports,"BreachRiskAssessment",{enumerable:true,get:function(){return chunk6BXUVS6E_js.a}});Object.defineProperty(exports,"RegulatoryReportGenerator",{enumerable:true,get:function(){return chunk6BXUVS6E_js.c}});Object.defineProperty(exports,"BreachReportForm",{enumerable:true,get:function(){return chunkSAA7UVI2_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkI4M2AA3N_js.a}});Object.defineProperty(exports,"calculateBreachSeverity",{enumerable:true,get:function(){return chunkBKRETVJ6_js.a}});exports.Breach=A;exports.BreachProvider=s;exports.useBreachCompound=P;//# sourceMappingURL=breach.js.map
1
+ 'use strict';var chunkEKHBORAH_js=require('./chunk-EKHBORAH.js'),chunkSAA7UVI2_js=require('./chunk-SAA7UVI2.js'),chunkI4M2AA3N_js=require('./chunk-I4M2AA3N.js'),chunkBKRETVJ6_js=require('./chunk-BKRETVJ6.js');require('./chunk-I54CDQGN.js'),require('./chunk-E64TU6IU.js'),require('./chunk-ELKB2AFZ.js');var chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var p=react.createContext(null);function P(){let e=react.useContext(p);if(!e)throw new Error("Breach compound components must be wrapped in <Breach.Provider>. Example: <Breach.Provider categories={...}><Breach.ReportForm /></Breach.Provider>");return e}var s=({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u,children:d})=>{let y=chunkI4M2AA3N_js.a({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u}),l=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},y),{categories:e});return jsxRuntime.jsx(p.Provider,{value:l,children:d})};var A={Provider:s,ReportForm:chunkSAA7UVI2_js.a,RiskAssessment:chunkEKHBORAH_js.a,NotificationManager:chunkEKHBORAH_js.b,ReportGenerator:chunkEKHBORAH_js.c};Object.defineProperty(exports,"BreachNotificationManager",{enumerable:true,get:function(){return chunkEKHBORAH_js.b}});Object.defineProperty(exports,"BreachRiskAssessment",{enumerable:true,get:function(){return chunkEKHBORAH_js.a}});Object.defineProperty(exports,"RegulatoryReportGenerator",{enumerable:true,get:function(){return chunkEKHBORAH_js.c}});Object.defineProperty(exports,"BreachReportForm",{enumerable:true,get:function(){return chunkSAA7UVI2_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkI4M2AA3N_js.a}});Object.defineProperty(exports,"calculateBreachSeverity",{enumerable:true,get:function(){return chunkBKRETVJ6_js.a}});exports.Breach=A;exports.BreachProvider=s;exports.useBreachCompound=P;//# sourceMappingURL=breach.js.map
2
2
  //# sourceMappingURL=breach.js.map
package/dist/breach.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {c,b,a}from'./chunk-NUDVUAD4.mjs';export{b as BreachNotificationManager,a as BreachRiskAssessment,c as RegulatoryReportGenerator}from'./chunk-NUDVUAD4.mjs';import {a as a$1}from'./chunk-CWUPGY3M.mjs';export{a as BreachReportForm}from'./chunk-CWUPGY3M.mjs';import {a as a$2}from'./chunk-PATONNTZ.mjs';export{a as useBreach}from'./chunk-PATONNTZ.mjs';export{a as calculateBreachSeverity}from'./chunk-DJGS7SSN.mjs';import'./chunk-GKKAK6ES.mjs';import'./chunk-AYKLAEOU.mjs';import'./chunk-6WIP33TW.mjs';import {b as b$1,a as a$3}from'./chunk-WWT2ZSNU.mjs';import {createContext,useContext}from'react';import {jsx}from'react/jsx-runtime';var p=createContext(null);function P(){let e=useContext(p);if(!e)throw new Error("Breach compound components must be wrapped in <Breach.Provider>. Example: <Breach.Provider categories={...}><Breach.ReportForm /></Breach.Provider>");return e}var s=({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u,children:d})=>{let y=a$2({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u}),l=b$1(a$3({},y),{categories:e});return jsx(p.Provider,{value:l,children:d})};var A={Provider:s,ReportForm:a$1,RiskAssessment:a,NotificationManager:b,ReportGenerator:c};export{A as Breach,s as BreachProvider,P as useBreachCompound};//# sourceMappingURL=breach.mjs.map
1
+ import {c,b,a}from'./chunk-CYU6YUJQ.mjs';export{b as BreachNotificationManager,a as BreachRiskAssessment,c as RegulatoryReportGenerator}from'./chunk-CYU6YUJQ.mjs';import {a as a$1}from'./chunk-CWUPGY3M.mjs';export{a as BreachReportForm}from'./chunk-CWUPGY3M.mjs';import {a as a$2}from'./chunk-PATONNTZ.mjs';export{a as useBreach}from'./chunk-PATONNTZ.mjs';export{a as calculateBreachSeverity}from'./chunk-DJGS7SSN.mjs';import'./chunk-GKKAK6ES.mjs';import'./chunk-AYKLAEOU.mjs';import'./chunk-6WIP33TW.mjs';import {b as b$1,a as a$3}from'./chunk-WWT2ZSNU.mjs';import {createContext,useContext}from'react';import {jsx}from'react/jsx-runtime';var p=createContext(null);function P(){let e=useContext(p);if(!e)throw new Error("Breach compound components must be wrapped in <Breach.Provider>. Example: <Breach.Provider categories={...}><Breach.ReportForm /></Breach.Provider>");return e}var s=({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u,children:d})=>{let y=a$2({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u}),l=b$1(a$3({},y),{categories:e});return jsx(p.Provider,{value:l,children:d})};var A={Provider:s,ReportForm:a$1,RiskAssessment:a,NotificationManager:b,ReportGenerator:c};export{A as Breach,s as BreachProvider,P as useBreachCompound};//# sourceMappingURL=breach.mjs.map
2
2
  //# sourceMappingURL=breach.mjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),jsxRuntime=require('react/jsx-runtime');var x={consent:"Consent",dsr:"Data Subject Rights",dpia:"DPIA",breach:"Breach Notification",policy:"Privacy Policy",lawfulBasis:"Lawful Basis",crossBorder:"Cross-Border",ropa:"ROPA"},p={critical:"rgb(var(--ndpr-destructive))","needs-work":"rgb(var(--ndpr-warning))",good:"rgb(var(--ndpr-primary))",excellent:"rgb(var(--ndpr-success))"},m={critical:"Critical","needs-work":"Needs Work",good:"Good",excellent:"Excellent"},f={critical:"Critical",high:"High",medium:"Medium",low:"Low"},C=({score:t,rating:o,classNames:e,unstyled:a})=>{let r=p[o],i=2*Math.PI*40,c=i*(1-t/100);return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("relative inline-flex items-center justify-center",e==null?void 0:e.scoreCircle,a),role:"img","aria-label":`Compliance score: ${t} out of 100, rated ${m[o]}`,children:[jsxRuntime.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 100 100","aria-hidden":"true",children:[jsxRuntime.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:"rgba(0,0,0,0.08)",strokeWidth:"8"}),jsxRuntime.jsx("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:r,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:c,transform:"rotate(-90 50 50)",style:{transition:"stroke-dashoffset 0.4s ease"}})]}),jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("absolute text-2xl font-bold tabular-nums",e==null?void 0:e.scoreValue,a),style:{color:r},children:t})]})},y=({rating:t,className:o,unstyled:e})=>{let a=p[t];return jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("inline-block px-3 py-1 rounded-full text-sm font-semibold",o,e),style:{backgroundColor:`${a.replace("rgb(","rgba(").replace(")",", 0.12)")}`,color:a,border:`1px solid ${a.replace("rgb(","rgba(").replace(")",", 0.3)")}`},role:"status","aria-live":"polite",children:m[t]})},h=({moduleKey:t,module:o,classNames:e,unstyled:a})=>{var b;let r=o.score>=90?"excellent":o.score>=70?"good":o.score>=40?"needs-work":"critical",i=p[r];Math.round(o.score/100*(o.gaps.length+Math.round(o.score/100*5)));let u=o.gaps.length,g=(b=x[t])!=null?b:t;return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("rounded-lg border p-4 flex flex-col gap-2",e==null?void 0:e.moduleCard,a),style:{borderColor:`${i.replace("rgb(","rgba(").replace(")",", 0.25)")}`,backgroundColor:`${i.replace("rgb(","rgba(").replace(")",", 0.04)")}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("text-sm font-semibold truncate",e==null?void 0:e.moduleTitle,a),children:g}),jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("text-lg font-bold tabular-nums",e==null?void 0:e.moduleScore,a),style:{color:i},role:"status","aria-label":`${g} score: ${o.score}`,children:o.score})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{backgroundColor:"rgba(0,0,0,0.08)"},role:"progressbar","aria-valuenow":o.score,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${g} compliance score: ${o.score}%`,children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${o.score}%`,backgroundColor:i}})}),u>0&&jsxRuntime.jsxs("p",{className:chunkE64TU6IU_js.a("text-xs text-gray-500 dark:text-gray-400",e==null?void 0:e.moduleGaps,a),children:[u," gap",u!==1?"s":""," to address"]})]})},R=({rec:t,classNames:o,unstyled:e})=>{var i,c;let r=(i={critical:p.critical,high:p["needs-work"],medium:p.good,low:p.excellent}[t.priority])!=null?i:p.good;return jsxRuntime.jsxs("div",{"data-testid":"recommendation-item",className:chunkE64TU6IU_js.a("flex gap-3 p-3 rounded-lg border border-gray-100 dark:border-gray-700 bg-white dark:bg-gray-800",o==null?void 0:o.recommendationItem,e),children:[jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a("mt-0.5 shrink-0 inline-block px-2 py-0.5 rounded text-xs font-bold uppercase tracking-wide",o==null?void 0:o.recommendationPriority,e),style:{backgroundColor:`${r.replace("rgb(","rgba(").replace(")",", 0.12)")}`,color:r},children:(c=f[t.priority])!=null?c:t.priority}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("text-sm font-medium text-gray-900 dark:text-gray-100",o==null?void 0:o.recommendationTitle,e),children:t.label}),jsxRuntime.jsx("p",{className:"mt-0.5 text-xs text-gray-500 dark:text-gray-400 leading-relaxed",children:t.recommendation}),jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:[t.ndpaSection," \u2022 Effort: ",t.effort]})]})]})},k=({report:t,title:o="NDPA Compliance Dashboard",showRecommendations:e=true,maxRecommendations:a=5,classNames:r,unstyled:i=false})=>{let c=t.recommendations.slice(0,a),u=Object.entries(t.modules);return jsxRuntime.jsxs("div",{"data-ndpr-component":"compliance-dashboard",className:chunkE64TU6IU_js.a("w-full rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm p-6 flex flex-col gap-8",r==null?void 0:r.root,i),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex flex-col sm:flex-row items-start sm:items-center gap-6",r==null?void 0:r.header,i),children:[jsxRuntime.jsx(C,{score:t.score,rating:t.rating,classNames:{scoreCircle:r==null?void 0:r.scoreCircle,scoreValue:r==null?void 0:r.scoreValue},unstyled:i}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 leading-tight",children:o}),jsxRuntime.jsx(y,{rating:t.rating,className:r==null?void 0:r.ratingBadge,unstyled:i}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Generated on"," ",new Date(t.generatedAt).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})]})]})]}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 gap-3",r==null?void 0:r.modulesGrid,i),children:u.map(([g,b])=>jsxRuntime.jsx(h,{moduleKey:g,module:b,classNames:{moduleCard:r==null?void 0:r.moduleCard,moduleTitle:r==null?void 0:r.moduleTitle,moduleScore:r==null?void 0:r.moduleScore,moduleGaps:r==null?void 0:r.moduleGaps},unstyled:i},g))}),e&&c.length>0&&jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex flex-col gap-3",r==null?void 0:r.recommendationsSection,i),children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"Recommendations"}),c.map(g=>jsxRuntime.jsx(R,{rec:g,classNames:{recommendationItem:r==null?void 0:r.recommendationItem,recommendationPriority:r==null?void 0:r.recommendationPriority,recommendationTitle:r==null?void 0:r.recommendationTitle},unstyled:i},`${g.module}-${g.key}`))]})]})};exports.a=k;//# sourceMappingURL=chunk-25OOUES4.js.map
2
+ //# sourceMappingURL=chunk-25OOUES4.js.map
@@ -0,0 +1,2 @@
1
+ import {b as b$1,c,d}from'./chunk-SHMJNRHO.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect,useCallback}from'react';function E({initialData:S,adapter:R,onRecordAdd:g,onRecordUpdate:f,onRecordArchive:P}){let d$1=useRef(R);d$1.current=R;let[s,u]=useState(S),[v,p]=useState(true);useEffect(()=>{if(!d$1.current){p(false);return}let t=false;try{let e=d$1.current.load();e instanceof Promise?e.then(r=>{t||(r&&u(r),p(!1));},()=>{t||p(!1);}):(e&&u(e),p(!1));}catch(e){t||p(false);}return ()=>{t=true;}},[]);let a$1=useCallback(t=>{d$1.current&&Promise.resolve(d$1.current.save(t)).catch(e=>{console.warn("[ndpr-toolkit] Failed to save ROPA:",e);});},[]),C=useCallback(t=>{u(e=>{let r=b(a({},e),{records:[...e.records,t],lastUpdated:Date.now()});return a$1(r),r}),g==null||g(t);},[g,a$1]),w=useCallback((t,e)=>{u(r=>{let n=b(a({},r),{records:r.records.map(l=>l.id===t?b(a(a({},l),e),{updatedAt:Date.now()}):l),lastUpdated:Date.now()});return a$1(n),n}),f==null||f(t,e);},[f,a$1]),x=useCallback(t=>{u(e=>{let r=b(a({},e),{records:e.records.map(n=>n.id===t?b(a({},n),{status:"archived",updatedAt:Date.now()}):n),lastUpdated:Date.now()});return a$1(r),r}),P==null||P(t);},[P,a$1]),D=useCallback(t=>s.records.find(e=>e.id===t),[s.records]),G=useCallback(()=>b$1(s),[s]),b$2=useCallback(()=>c(s),[s]),L=useCallback(()=>d(s),[s]);return {ropa:s,addRecord:C,updateRecord:w,archiveRecord:x,getRecord:D,getSummary:G,exportCSV:b$2,getComplianceGaps:L,isLoading:v}}export{E as a};//# sourceMappingURL=chunk-2AW7KAZO.mjs.map
2
+ //# sourceMappingURL=chunk-2AW7KAZO.mjs.map
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'./chunk-AYKLAEOU.mjs';import {a,b}from'./chunk-WWT2ZSNU.mjs';import {useState,useRef,useEffect,useCallback}from'react';import {createPortal}from'react-dom';import {jsx,jsxs}from'react/jsx-runtime';var yt=({options:d,onSave:U,title:Q="We Value Your Privacy",description:X="We use cookies and similar technologies to provide our services and enhance your experience. Your consent is collected in accordance with NDPA Sections 25-26.",acceptAllButtonText:Z="Accept All",rejectAllButtonText:s="Reject All",customizeButtonText:N="Customize",saveButtonText:tt="Save Preferences",position:L="bottom",zIndex:q=9999,version:a$2="1.0",show:x,manageStorage:z=true,storageKey:D="ndpr_consent",className:et="",buttonClassName:B="",primaryButtonClassName:H="",secondaryButtonClassName:nt="",classNames:t,unstyled:o,onAnalytics:k})=>{let[u,c]=useState(false),[g,m]=useState(false),[w,E]=useState({}),[F,rt]=useState(false),f=useRef(null),T=useRef(null),$=useRef(false);useEffect(()=>{rt(true);},[]);let b$1=useCallback((e,n)=>{k==null||k(a({action:e,timestamp:Date.now(),version:a$2},n!==void 0?{categories:n}:{}));},[k,a$2]);useEffect(()=>{let e={};if(d.forEach(n=>{e[n.id]=n.defaultValue||false;}),E(e),x===void 0)if(!z)c(true);else {let n=localStorage.getItem(D);if(n)try{JSON.parse(n).version!==a$2?c(!0):c(!1);}catch(C){c(true);}else c(true);}else c(x);},[d,D,a$2,z]),useEffect(()=>{x!==void 0&&c(x);},[x]);let ot=()=>{let e={};d.forEach(n=>{e[n.id]=true;}),b$1("accepted_all",e),j(e);},M=()=>{let e={};d.forEach(n=>{e[n.id]=n.required||false;}),b$1("rejected_all",e),j(e);},it=(e,n)=>{E(C=>b(a({},C),{[e]:n}));},dt=()=>{let e={};d.forEach(n=>{e[n.id]=true;}),E(e);},ut=()=>{let e={};d.forEach(n=>{e[n.id]=n.required||false;}),E(e);},_=d.length>0&&d.every(e=>w[e.id]),ct=()=>{b$1("customized",w),j(w);},j=e=>{let n={consents:e,timestamp:Date.now(),version:a$2,method:g?"customize":"banner",hasInteracted:true};z&&localStorage.setItem(D,JSON.stringify(n)),U(n),c(false),m(false);};if(useEffect(()=>{if(!u)return;let e=n=>{n.key==="Escape"&&(b$1("dismissed"),M());};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u,b$1,d,g]),useEffect(()=>{u&&!$.current&&($.current=true,b$1("shown")),u||($.current=false);},[u,b$1]),useEffect(()=>{if(!u||!f.current)return;let e='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',C=setTimeout(()=>{if(!f.current)return;let p=f.current.querySelectorAll(e);p.length>0?p[0].focus():f.current.focus();},0),G=p=>{if(p.key!=="Tab"||!f.current)return;let A=f.current.querySelectorAll(e);if(A.length===0)return;let V=A[0],J=A[A.length-1];p.shiftKey?document.activeElement===V&&(p.preventDefault(),J.focus()):document.activeElement===J&&(p.preventDefault(),V.focus());};return document.addEventListener("keydown",G),()=>{clearTimeout(C),document.removeEventListener("keydown",G);}},[u,g]),useEffect(()=>{if(g&&T.current){let e=T.current;e.style.maxHeight="0px",e.style.opacity="0",e.offsetHeight,e.style.maxHeight=`${e.scrollHeight}px`,e.style.opacity="1";}},[g]),!u)return null;let lt=(t==null?void 0:t.primaryButton)||(t==null?void 0:t.acceptButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B} ${H}`,K=(t==null?void 0:t.secondaryButton)||(t==null?void 0:t.rejectButton)||`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${B} ${nt}`,gt=(t==null?void 0:t.customizeButton)||`px-4 py-2 bg-transparent text-gray-800 dark:text-white hover:underline ${B}`,ft=(t==null?void 0:t.saveButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B} ${H}`,S=L==="inline",y=L==="center",h;S||y?h="":L==="top"?h="fixed inset-x-0 top-0":h="fixed inset-x-0 bottom-0";let P=jsx("div",{ref:f,tabIndex:-1,"data-ndpr-component":"consent-banner",className:a$1(`${S?"":h} bg-white dark:bg-gray-800 shadow-lg p-3 sm:p-4 border border-gray-200 dark:border-gray-700 ${y?"max-w-lg w-full":""} ${et}`,t==null?void 0:t.root,o),style:!S&&!y?{zIndex:q}:void 0,role:"dialog","aria-modal":y||void 0,"aria-labelledby":"consent-banner-title","aria-describedby":"consent-banner-description",children:jsxs("div",{className:a$1("max-w-6xl mx-auto",t==null?void 0:t.container,o),children:[jsx("h2",{id:"consent-banner-title",className:a$1("text-lg font-bold mb-2",t==null?void 0:t.title,o),children:Q}),jsx("p",{id:"consent-banner-description",className:a$1("text-sm sm:text-base mb-4",t==null?void 0:t.description,o),children:X}),g&&jsxs("div",{ref:T,className:a$1("mb-4 p-3 sm:p-4 rounded-md border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50",t==null?void 0:t.customizePanel,o),style:{overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out"},children:[jsx("div",{className:"mb-3 flex items-center justify-end",children:jsx("button",{type:"button",onClick:_?ut:dt,className:a$1("text-sm font-medium text-[rgb(var(--ndpr-primary))] hover:underline",t==null?void 0:t.selectAllButton,o),children:_?"Deselect All":"Select All"})}),jsx("div",{className:a$1("space-y-3",t==null?void 0:t.optionsList,o),children:d.map(e=>jsxs("div",{className:a$1("flex items-start",t==null?void 0:t.optionItem,o),children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`consent-${e.id}`,type:"checkbox",checked:w[e.id]||false,onChange:n=>it(e.id,n.target.checked),disabled:e.required,className:a$1("h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",t==null?void 0:t.optionCheckbox,o)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:`consent-${e.id}`,className:a$1("font-medium",t==null?void 0:t.optionLabel,o),children:[e.label," ",e.required&&jsx("span",{className:"text-red-500",children:"*"})]}),jsx("p",{className:a$1("text-gray-600 dark:text-gray-400",t==null?void 0:t.optionDescription,o),children:e.description})]})]},e.id))}),jsxs("div",{className:a$1("mt-4 flex flex-col sm:flex-row flex-wrap gap-2",t==null?void 0:t.buttonGroup,o),children:[jsx("button",{onClick:ct,className:a$1(ft,t==null?void 0:t.saveButton,o),children:tt}),jsx("button",{onClick:()=>m(false),className:a$1(K,t==null?void 0:t.rejectButton,o),children:"Back"})]})]}),!g&&jsxs("div",{className:a$1("flex flex-col sm:flex-row flex-wrap gap-2",t==null?void 0:t.buttonGroup,o),children:[jsx("button",{onClick:ot,className:a$1(lt,t==null?void 0:t.acceptButton,o),children:Z}),jsx("button",{onClick:M,className:a$1(K,t==null?void 0:t.rejectButton,o),children:s}),jsx("button",{onClick:()=>m(true),className:a$1(gt,t==null?void 0:t.customizeButton,o),children:N})]}),jsx("div",{className:a$1("mt-2 text-xs text-gray-600 dark:text-gray-400",void 0,o),children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'})]})});if(S)return P;if(y){let e=jsxs("div",{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:q},children:[jsx("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),jsx("div",{className:"relative",children:P})]});return F?createPortal(e,document.body):null}return F?createPortal(P,document.body):null};export{yt as a};//# sourceMappingURL=chunk-4JKTIR33.mjs.map
2
+ //# sourceMappingURL=chunk-4JKTIR33.mjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkGOU6FU6Y_js=require('./chunk-GOU6FU6Y.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var _=[{value:"consent",label:"Consent (Section 25(1)(a))"},{value:"contract",label:"Contract (Section 25(1)(b))"},{value:"legal_obligation",label:"Legal Obligation (Section 25(1)(c))"},{value:"vital_interests",label:"Vital Interests (Section 25(1)(d))"},{value:"public_interest",label:"Public Interest (Section 25(1)(e))"},{value:"legitimate_interests",label:"Legitimate Interests (Section 25(1)(f))"}],ee=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"archived",label:"Archived"}],Oe=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}];function je(){let d=Date.now();return {id:`proc_${d}_${Math.random().toString(36).substring(2,11)}`,name:"",description:"",controllerDetails:{name:"",contact:"",address:""},lawfulBasis:"consent",lawfulBasisJustification:"",purposes:[],dataCategories:[],dataSubjectCategories:[],recipients:[],retentionPeriod:"",securityMeasures:[],dataSource:"data_subject",dpiaRequired:false,automatedDecisionMaking:false,status:"active",createdAt:d,updatedAt:d}}function te(d){return d?new Date(d).toLocaleDateString():"N/A"}var $e=({ropa:d,onAddRecord:w,onUpdateRecord:R,onArchiveRecord:D,title:re="Record of Processing Activities (ROPA)",description:ae="Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",className:ie="",buttonClassName:F="",classNames:e,unstyled:o})=>{let[v,x]=react.useState("list"),[S,oe]=react.useState(""),[P,ne]=react.useState("all"),[A,de]=react.useState("all"),[l,f]=react.useState(null),[U,k]=react.useState([]),[I,$]=react.useState(""),[M,H]=react.useState(""),[L,V]=react.useState(""),[E,J]=react.useState(""),[O,z]=react.useState(""),[j,G]=react.useState(""),[q,W]=react.useState(""),p=react.useMemo(()=>chunkGOU6FU6Y_js.b(d),[d]),y=react.useMemo(()=>chunkGOU6FU6Y_js.d(d),[d]),K=react.useMemo(()=>{let r=[...d.records];if(P!=="all"&&(r=r.filter(i=>i.status===P)),A!=="all"&&(r=r.filter(i=>i.lawfulBasis===A)),S){let i=S.toLowerCase();r=r.filter(u=>u.name.toLowerCase().includes(i)||u.description.toLowerCase().includes(i)||u.dataCategories.some(m=>m.toLowerCase().includes(i))||u.department&&u.department.toLowerCase().includes(i));}return r},[d.records,P,A,S]);react.useEffect(()=>{l&&($(l.purposes.join(", ")),H(l.dataCategories.join(", ")),V((l.sensitiveDataCategories||[]).join(", ")),J(l.dataSubjectCategories.join(", ")),z(l.recipients.join(", ")),G(l.securityMeasures.join(", ")),W((l.systemsUsed||[]).join(", ")));},[l==null?void 0:l.id]);let le=react.useCallback(()=>{let r=je();r.controllerDetails.name=d.organizationName,r.controllerDetails.contact=d.organizationContact,r.controllerDetails.address=d.organizationAddress,d.ndpcRegistrationNumber&&(r.controllerDetails.registrationNumber=d.ndpcRegistrationNumber),d.dpoDetails&&(r.controllerDetails.dpoContact=d.dpoDetails.email),f(r),k([]),x("form");},[d.organizationName,d.organizationContact,d.organizationAddress,d.ndpcRegistrationNumber,d.dpoDetails]),ue=react.useCallback(r=>{f(chunkMQFZHA2D_js.a({},r)),k([]),x("form");},[]),b=r=>r.split(",").map(i=>i.trim()).filter(i=>i.length>0),ge=react.useCallback(()=>{if(!l)return;let r=chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},l),{purposes:b(I),dataCategories:b(M),sensitiveDataCategories:b(L),dataSubjectCategories:b(E),recipients:b(O),securityMeasures:b(j),systemsUsed:b(q),updatedAt:Date.now()});r.sensitiveDataCategories&&r.sensitiveDataCategories.length===0&&(r.sensitiveDataCategories=void 0),r.systemsUsed&&r.systemsUsed.length===0&&(r.systemsUsed=void 0);let i=chunkGOU6FU6Y_js.a(r);if(!i.valid){k(i.errors);return}d.records.find(m=>m.id===r.id)?R==null||R(r.id,r):w==null||w(r),f(null),k([]),x("list");},[l,I,M,L,E,O,j,q,d.records,R,w]),se=react.useCallback(r=>{D==null||D(r);},[D]),ce=react.useCallback(()=>{let r=chunkGOU6FU6Y_js.c(d),i=new Blob([r],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(i),m=document.createElement("a");m.href=u,m.download=`ropa_${d.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),setTimeout(()=>URL.revokeObjectURL(u),100);},[d]),Q=react.useCallback(()=>{f(null),k([]),x("list");},[]),s=react.useCallback((r,i)=>{f(u=>u&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},u),{[r]:i}));},[]),T=react.useCallback((r,i)=>{f(u=>u&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},u),{controllerDetails:chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},u.controllerDetails),{[r]:i})}));},[]),pe=react.useCallback(r=>!!r.nextReviewDate&&r.nextReviewDate<=Date.now(),[]),me=react.useCallback(r=>{oe(r.target.value);},[]),be=react.useCallback(r=>{ne(r.target.value);},[]),ve=react.useCallback(r=>{de(r.target.value);},[]),xe=react.useCallback(r=>{$(r.target.value);},[]),fe=react.useCallback(r=>{H(r.target.value);},[]),ye=react.useCallback(r=>{V(r.target.value);},[]),he=react.useCallback(r=>{J(r.target.value);},[]),ke=react.useCallback(r=>{z(r.target.value);},[]),Ce=react.useCallback(r=>{G(r.target.value);},[]),we=react.useCallback(r=>{W(r.target.value);},[]),Re=react.useCallback(()=>x("list"),[]),De=react.useCallback(()=>x("summary"),[]),Se=react.useCallback(r=>{let i={active:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",inactive:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},u={active:"Active",inactive:"Inactive",archived:"Archived"};return jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.a(`px-2 py-1 rounded text-xs font-medium ${i[r]}`,e==null?void 0:e.statusBadge,o),children:u[r]})},[e==null?void 0:e.statusBadge,o]),Pe=react.useCallback(r=>jsxRuntime.jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:{consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"}[r]}),[]),Ae=()=>jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,o),children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Organization"}),jsxRuntime.jsx("p",{className:"text-sm font-semibold",children:d.organizationName})]}),d.dpoDetails&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"Data Protection Officer"}),jsxRuntime.jsx("p",{className:"text-sm font-semibold",children:d.dpoDetails.name}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:d.dpoDetails.email})]}),d.ndpcRegistrationNumber&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:"NDPC Registration No."}),jsxRuntime.jsx("p",{className:"text-sm font-semibold",children:d.ndpcRegistrationNumber})]})]}),jsxRuntime.jsxs("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:["Version ",d.version," | Last Updated: ",te(d.lastUpdated)]})]}),Be=()=>jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6",e==null?void 0:e.summary,o),children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,o),children:[jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-700 dark:text-blue-300",children:p.totalRecords}),jsxRuntime.jsx("p",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Total Records"})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,o),children:[jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-700 dark:text-green-300",children:p.activeRecords}),jsxRuntime.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"Active"})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,o),children:[jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-700 dark:text-purple-300",children:p.crossBorderRecords}),jsxRuntime.jsx("p",{className:"text-xs text-purple-600 dark:text-purple-400",children:"Cross-Border"})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,o),children:[jsxRuntime.jsx("p",{className:"text-2xl font-bold text-orange-700 dark:text-orange-300",children:y.length}),jsxRuntime.jsx("p",{className:"text-xs text-orange-600 dark:text-orange-400",children:"Records with Gaps"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxRuntime.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium mb-2",children:"By Lawful Basis"}),_.map(r=>jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r.label.split(" (")[0]}),jsxRuntime.jsx("span",{className:"font-medium",children:p.byLawfulBasis[r.value]||0})]},r.value))]}),jsxRuntime.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium mb-2",children:"Risk Indicators"}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Sensitive Data"}),jsxRuntime.jsx("span",{className:"font-medium",children:p.sensitiveDataRecords})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"DPIA Required"}),jsxRuntime.jsx("span",{className:"font-medium",children:p.dpiaRequiredRecords})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Automated Decisions"}),jsxRuntime.jsx("span",{className:"font-medium",children:p.automatedDecisionRecords})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Due for Review"}),jsxRuntime.jsx("span",{className:`font-medium ${p.recordsDueForReview.length>0?"text-red-600 dark:text-red-400":""}`,children:p.recordsDueForReview.length})]})]}),p.topDepartments.length>0&&jsxRuntime.jsxs("div",{className:"p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium mb-2",children:"Top Departments"}),p.topDepartments.slice(0,5).map(r=>jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:r.department}),jsxRuntime.jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]}),y.length>0&&jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,o),role:"status","aria-live":"polite",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-2",children:"Compliance Gaps Detected"}),y.slice(0,5).map(r=>jsxRuntime.jsxs("div",{className:"mb-2",children:[jsxRuntime.jsx("p",{className:"text-xs font-medium text-red-700 dark:text-red-300",children:r.recordName}),jsxRuntime.jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((i,u)=>jsxRuntime.jsx("li",{className:"text-xs text-red-600 dark:text-red-400",children:i},u))})]},r.recordId)),y.length>5&&jsxRuntime.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:["...and ",y.length-5," more record(s) with gaps."]})]})]}),Fe=()=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"ropaSearch",className:"block text-sm font-medium mb-1",children:"Search"}),jsxRuntime.jsx("input",{type:"text",id:"ropaSearch",value:S,onChange:me,placeholder:"Search records...",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"ropaStatusFilter",className:"block text-sm font-medium mb-1",children:"Status"}),jsxRuntime.jsxs("select",{id:"ropaStatusFilter",value:P,onChange:be,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,o),children:[jsxRuntime.jsx("option",{value:"all",children:"All Statuses"}),ee.map(r=>jsxRuntime.jsx("option",{value:r.value,children:r.label},r.value))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"ropaBasisFilter",className:"block text-sm font-medium mb-1",children:"Lawful Basis"}),jsxRuntime.jsxs("select",{id:"ropaBasisFilter",value:A,onChange:ve,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,o),children:[jsxRuntime.jsx("option",{value:"all",children:"All Bases"}),_.map(r=>jsxRuntime.jsx("option",{value:r.value,children:r.label.split(" (")[0]},r.value))]})]}),jsxRuntime.jsxs("div",{className:"flex items-end space-x-2",children:[jsxRuntime.jsx("button",{onClick:le,className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${F}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),o),children:"Add Record"}),jsxRuntime.jsx("button",{onClick:ce,"aria-label":"Export ROPA records as CSV",className:chunkE64TU6IU_js.a(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${F}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),o),children:"Export CSV"})]})]}),K.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm text-center py-8",children:"No processing records found."}):jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:chunkE64TU6IU_js.a("w-full text-sm text-left",e==null?void 0:e.table,o),children:[jsxRuntime.jsx("thead",{className:chunkE64TU6IU_js.a("text-xs uppercase bg-gray-50 dark:bg-gray-700",e==null?void 0:e.tableHeader,o),children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Name"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Lawful Basis"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Data Categories"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Status"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Last Reviewed"}),jsxRuntime.jsx("th",{className:"px-4 py-3",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{children:K.map(r=>{let i=pe(r),u=y.some(m=>m.recordId===r.id);return jsxRuntime.jsxs("tr",{className:chunkE64TU6IU_js.a(`border-b dark:border-gray-600 ${i?"bg-red-50 dark:bg-red-900/10":u?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} hover:bg-gray-50 dark:hover:bg-gray-700`,e==null?void 0:e.tableRow,o),children:[jsxRuntime.jsx("td",{className:"px-4 py-3",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"font-medium",children:r.name}),r.department&&jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:r.department}),i&&jsxRuntime.jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-medium",children:"Review Overdue"})]})}),jsxRuntime.jsx("td",{className:"px-4 py-3",children:Pe(r.lawfulBasis)}),jsxRuntime.jsx("td",{className:"px-4 py-3",children:jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300 max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsxRuntime.jsx("td",{className:"px-4 py-3",children:Se(r.status)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-xs text-gray-600 dark:text-gray-400",children:te(r.lastReviewedAt)}),jsxRuntime.jsx("td",{className:"px-4 py-3",children:jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("button",{onClick:()=>ue(r),"aria-label":`Edit record: ${r.name}`,className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline text-xs",children:"Edit"}),r.status!=="archived"&&jsxRuntime.jsx("button",{onClick:()=>se(r.id),"aria-label":`Archive record: ${r.name}`,className:"text-gray-600 dark:text-gray-400 hover:underline text-xs",children:"Archive"})]})})]},r.id)})})]})})]}),Ie=react.useMemo(()=>l?!d.records.find(r=>r.id===l.id):true,[l,d.records]),Me=()=>{if(!l)return null;let r=Ie;return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",e==null?void 0:e.form,o),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex justify-between items-center mb-4",e==null?void 0:e.header,o),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium",children:r?"Add Processing Record":"Edit Processing Record"}),jsxRuntime.jsx("button",{onClick:Q,className:"text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 text-sm",children:"Cancel"})]}),U.length>0&&jsxRuntime.jsxs("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-md",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Please fix the following errors:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside",children:U.map((i,u)=>jsxRuntime.jsx("li",{className:"text-xs text-red-600 dark:text-red-400",children:i},u))})]}),jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsxRuntime.jsx("legend",{className:"text-sm font-medium px-2",children:"Basic Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recordName",className:"block text-sm font-medium mb-1",children:"Activity Name *"}),jsxRuntime.jsx("input",{type:"text",id:"recordName",value:l.name,onChange:i=>s("name",i.target.value),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., Customer Account Management"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recordDepartment",className:"block text-sm font-medium mb-1",children:"Department"}),jsxRuntime.jsx("input",{type:"text",id:"recordDepartment",value:l.department||"",onChange:i=>s("department",i.target.value||void 0),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., Marketing"})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"recordDescription",className:"block text-sm font-medium mb-1",children:"Description *"}),jsxRuntime.jsx("textarea",{id:"recordDescription",value:l.description,onChange:i=>s("description",i.target.value),rows:3,"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"Describe what personal data processing is performed..."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recordStatus",className:"block text-sm font-medium mb-1",children:"Status *"}),jsxRuntime.jsx("select",{id:"recordStatus",value:l.status,onChange:i=>s("status",i.target.value),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,o),children:ee.map(i=>jsxRuntime.jsx("option",{value:i.value,children:i.label},i.value))})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsxRuntime.jsx("legend",{className:"text-sm font-medium px-2",children:"Controller Details"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"controllerName",className:"block text-sm font-medium mb-1",children:"Controller Name *"}),jsxRuntime.jsx("input",{type:"text",id:"controllerName",value:l.controllerDetails.name,onChange:i=>T("name",i.target.value),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"controllerContact",className:"block text-sm font-medium mb-1",children:"Controller Contact *"}),jsxRuntime.jsx("input",{type:"text",id:"controllerContact",value:l.controllerDetails.contact,onChange:i=>T("contact",i.target.value),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o)})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"controllerAddress",className:"block text-sm font-medium mb-1",children:"Controller Address *"}),jsxRuntime.jsx("input",{type:"text",id:"controllerAddress",value:l.controllerDetails.address,onChange:i=>T("address",i.target.value),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o)})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsxRuntime.jsx("legend",{className:"text-sm font-medium px-2",children:"Lawful Basis (NDPA Section 25)"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"lawfulBasis",className:"block text-sm font-medium mb-1",children:"Lawful Basis *"}),jsxRuntime.jsx("select",{id:"lawfulBasis",value:l.lawfulBasis,onChange:i=>s("lawfulBasis",i.target.value),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,o),children:_.map(i=>jsxRuntime.jsx("option",{value:i.value,children:i.label},i.value))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"lawfulBasisJustification",className:"block text-sm font-medium mb-1",children:"Justification *"}),jsxRuntime.jsx("textarea",{id:"lawfulBasisJustification",value:l.lawfulBasisJustification,onChange:i=>s("lawfulBasisJustification",i.target.value),rows:2,"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsxRuntime.jsx("legend",{className:"text-sm font-medium px-2",children:"Data Details"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"purposes",className:"block text-sm font-medium mb-1",children:"Purposes * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"purposes",value:I,onChange:xe,"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., Account management, Service delivery"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataCategories",className:"block text-sm font-medium mb-1",children:"Data Categories * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"dataCategories",value:M,onChange:fe,"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., Name, Email, Phone number"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sensitiveData",className:"block text-sm font-medium mb-1",children:"Sensitive Data Categories (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"sensitiveData",value:L,onChange:ye,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., Health data, Biometric data"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"subjectCategories",className:"block text-sm font-medium mb-1",children:"Data Subject Categories * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"subjectCategories",value:E,onChange:he,"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., Customers, Employees"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recipients",className:"block text-sm font-medium mb-1",children:"Recipients * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"recipients",value:O,onChange:ke,"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataSource",className:"block text-sm font-medium mb-1",children:"Data Source *"}),jsxRuntime.jsx("select",{id:"dataSource",value:l.dataSource,onChange:i=>s("dataSource",i.target.value),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.select,o),children:Oe.map(i=>jsxRuntime.jsx("option",{value:i.value,children:i.label},i.value))})]}),l.dataSource==="third_party"&&jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"thirdPartyDetails",className:"block text-sm font-medium mb-1",children:"Third-Party Source Details *"}),jsxRuntime.jsx("input",{type:"text",id:"thirdPartyDetails",value:l.thirdPartySourceDetails||"",onChange:i=>s("thirdPartySourceDetails",i.target.value||void 0),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"Describe the third-party data source..."})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsxRuntime.jsx("legend",{className:"text-sm font-medium px-2",children:"Retention and Security"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionPeriod",className:"block text-sm font-medium mb-1",children:"Retention Period *"}),jsxRuntime.jsx("input",{type:"text",id:"retentionPeriod",value:l.retentionPeriod,onChange:i=>s("retentionPeriod",i.target.value),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., 5 years after account closure"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionJustification",className:"block text-sm font-medium mb-1",children:"Retention Justification"}),jsxRuntime.jsx("input",{type:"text",id:"retentionJustification",value:l.retentionJustification||"",onChange:i=>s("retentionJustification",i.target.value||void 0),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"Why this retention period is necessary..."})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"securityMeasures",className:"block text-sm font-medium mb-1",children:"Security Measures * (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"securityMeasures",value:j,onChange:Ce,"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"systemsUsed",className:"block text-sm font-medium mb-1",children:"Systems Used (comma-separated)"}),jsxRuntime.jsx("input",{type:"text",id:"systemsUsed",value:q,onChange:we,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsxRuntime.jsx("legend",{className:"text-sm font-medium px-2",children:"Risk Indicators"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"dpiaRequired",checked:l.dpiaRequired,onChange:i=>s("dpiaRequired",i.target.checked),className:"rounded border-gray-300 dark:border-gray-600"}),jsxRuntime.jsx("label",{htmlFor:"dpiaRequired",className:"text-sm font-medium",children:"DPIA Required"})]}),l.dpiaRequired&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dpiaReference",className:"block text-sm font-medium mb-1",children:"DPIA Reference *"}),jsxRuntime.jsx("input",{type:"text",id:"dpiaReference",value:l.dpiaReference||"",onChange:i=>s("dpiaReference",i.target.value||void 0),"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"Reference to the completed DPIA"})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:l.automatedDecisionMaking,onChange:i=>s("automatedDecisionMaking",i.target.checked),className:"rounded border-gray-300 dark:border-gray-600"}),jsxRuntime.jsx("label",{htmlFor:"automatedDecisionMaking",className:"text-sm font-medium",children:"Automated Decision-Making"})]}),l.automatedDecisionMaking&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"block text-sm font-medium mb-1",children:"Automated Decision-Making Details *"}),jsxRuntime.jsx("textarea",{id:"automatedDecisionMakingDetails",value:l.automatedDecisionMakingDetails||"",onChange:i=>s("automatedDecisionMakingDetails",i.target.value||void 0),rows:2,"aria-required":"true",className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"border border-gray-200 dark:border-gray-600 rounded-md p-4",children:[jsxRuntime.jsx("legend",{className:"text-sm font-medium px-2",children:"Review Schedule"}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"nextReviewDate",className:"block text-sm font-medium mb-1",children:"Next Review Date"}),jsxRuntime.jsx("input",{type:"date",id:"nextReviewDate",value:l.nextReviewDate?new Date(l.nextReviewDate).toISOString().slice(0,10):"",onChange:i=>s("nextReviewDate",i.target.value?new Date(i.target.value).getTime():void 0),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",e==null?void 0:e.input,o)})]})})]}),jsxRuntime.jsxs("div",{className:"flex justify-end space-x-3",children:[jsxRuntime.jsx("button",{onClick:Q,className:"px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-sm",children:"Cancel"}),jsxRuntime.jsx("button",{onClick:ge,className:chunkE64TU6IU_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${F}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),o),children:r?"Add Record":"Save Changes"})]})]})]})},Le=()=>jsxRuntime.jsxs("div",{className:"flex space-x-4 mb-6 border-b border-gray-200 dark:border-gray-600",children:[jsxRuntime.jsx("button",{onClick:Re,className:`pb-2 text-sm font-medium ${v==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsxRuntime.jsx("button",{onClick:De,className:`pb-2 text-sm font-medium ${v==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]":"text-gray-600 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ie}`,e==null?void 0:e.root,o),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",e==null?void 0:e.title,o),children:re}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:ae}),Ae(),v!=="form"&&Le(),v==="list"&&Fe(),v==="summary"&&Be(),v==="form"&&Me()]})};exports.a=$e;//# sourceMappingURL=chunk-5BUS6AI7.js.map
2
+ //# sourceMappingURL=chunk-5BUS6AI7.js.map
@@ -0,0 +1,7 @@
1
+ 'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),S=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var S__default=/*#__PURE__*/_interopDefault(S);var j=({result:r,sections:c,showFullReport:p=true,allowPrint:x=true,allowExport:y=true,onExport:v,className:u="",buttonClassName:b="",classNames:k={},unstyled:f=false})=>{let o=S.useMemo(()=>new Date().toLocaleDateString(),[]),d=(a,s)=>{let n=s?k[s]:void 0;return !n&&s==="printButton"&&(n=k.primaryButton),chunkE64TU6IU_js.a(a,n,f)},l=a=>new Date(a).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),N=a=>{let s=r.answers[a];return s==null?"Not answered":typeof s=="boolean"?s?"Yes":"No":Array.isArray(s)?s.join(", "):String(s)},w=()=>{window.print();},C=a=>{v&&v(a);},A=a=>jsxRuntime.jsx("span",{className:d(`px-2 py-1 rounded text-xs font-medium ${{low:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",medium:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",high:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",critical:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}[a]}`,"riskBadge"),children:a.charAt(0).toUpperCase()+a.slice(1)});return jsxRuntime.jsxs("div",{className:`${d("bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 print:shadow-none print:p-0","root")} ${u}`,children:[jsxRuntime.jsxs("div",{className:d("mb-8 border-b border-gray-200 dark:border-gray-700 pb-6 print:pb-4","header"),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h1",{className:d("text-2xl font-bold text-gray-900 dark:text-white mb-2","title"),children:"Data Protection Impact Assessment Report"}),jsxRuntime.jsx("h2",{className:"text-xl text-gray-700 dark:text-gray-300 mb-4",children:r.title})]}),(x||y)&&jsxRuntime.jsxs("div",{className:"flex space-x-2 print:hidden",children:[x&&jsxRuntime.jsx("button",{onClick:w,className:`${d("px-3 py-1 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600","printButton")} ${b}`,children:jsxRuntime.jsxs("span",{className:"flex items-center",children:[jsxRuntime.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})}),"Print"]})}),y&&jsxRuntime.jsx("div",{className:"relative inline-block",children:jsxRuntime.jsx("button",{onClick:()=>C("pdf"),className:`px-3 py-1 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${b}`,children:jsxRuntime.jsxs("span",{className:"flex items-center",children:[jsxRuntime.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Export PDF"]})})})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Assessor:"})," ",r.assessor.name,", ",r.assessor.role]}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Contact:"})," ",r.assessor.email]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Started:"})," ",l(r.startedAt)]}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Completed:"})," ",r.completedAt?l(r.completedAt):"In progress"]}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Next review:"})," ",r.reviewDate?l(r.reviewDate):"Not scheduled"]})]})]})]}),jsxRuntime.jsxs("div",{className:d("mb-8","summary"),children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"Executive Summary"}),jsxRuntime.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-2",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"font-medium mr-2",children:"Overall Risk Level:"}),A(r.overallRiskLevel)]}),jsxRuntime.jsxs("div",{className:d("mb-2","conclusion"),children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Conclusion:"})," ",r.conclusion]}),jsxRuntime.jsxs("div",{role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Can Proceed:"})," ",r.canProceed?"Yes":"No"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Processing Activity Description"}),jsxRuntime.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-4",children:r.processingDescription}),r.recommendations&&r.recommendations.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Key Recommendations"}),jsxRuntime.jsx("ul",{className:"list-disc pl-5 text-gray-700 dark:text-gray-300",children:r.recommendations.map((a,s)=>jsxRuntime.jsx("li",{className:d("","recommendation"),children:a},s))})]})]})]}),jsxRuntime.jsxs("div",{className:"mb-8",children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"Identified Risks"}),r.risks.length===0?jsxRuntime.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"No risks identified."}):jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:d("min-w-full divide-y divide-gray-200 dark:divide-gray-700","riskTable"),children:[jsxRuntime.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Risk"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Likelihood"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Impact"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Risk Level"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Mitigated"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:r.risks.map(a=>jsxRuntime.jsxs("tr",{className:d("","riskRow"),children:[jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-normal text-sm text-gray-900 dark:text-gray-100",children:a.description}),jsxRuntime.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-400",children:[a.likelihood," / 5"]}),jsxRuntime.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-400",children:[a.impact," / 5"]}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:A(a.level)}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-400",children:a.mitigated?jsxRuntime.jsx("span",{className:"text-green-600 dark:text-green-400",children:"Yes"}):jsxRuntime.jsx("span",{className:"text-red-600 dark:text-red-400",children:"No"})})]},a.id))})]})})]}),p&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"Full Assessment Details"}),c.map(a=>{let s=a.questions.filter(n=>r.answers[n.id]!==void 0);return s.length===0?null:jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:a.title}),jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[jsxRuntime.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Question"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Answer"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:s.map(n=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-normal text-sm text-gray-900 dark:text-gray-100",children:n.text}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-normal text-sm text-gray-600 dark:text-gray-400",children:N(n.id)})]},n.id))})]})})]},a.id)})]}),jsxRuntime.jsxs("div",{className:"mt-8 pt-4 border-t border-gray-200 dark:border-gray-700 text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("p",{children:"This DPIA was conducted in accordance with the Nigeria Data Protection Act (NDPA) 2023."}),jsxRuntime.jsxs("p",{children:["DPIA Report Version: ",r.version]}),jsxRuntime.jsxs("p",{children:["Generated on: ",o]})]})]})};var E=({steps:r,onStepClick:c,clickable:p=true,orientation:x="horizontal",className:y="",activeStepClassName:v="",completedStepClassName:u="",incompleteStepClassName:b="",classNames:k={},unstyled:f=false})=>{let o=(i,g)=>chunkE64TU6IU_js.a(i,g?k[g]:void 0,f),d=i=>{p&&c&&c(i);},l=x==="vertical";return jsxRuntime.jsx("div",{role:"navigation","aria-label":"Step progress",className:`${o(l?"flex flex-col space-y-4":"flex items-center justify-between","root")} ${y}`,children:r.map((i,g)=>{let N=g===r.length-1,w=i.active?o(`font-medium ${v||"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]"}`,"label"):i.completed?o(u||"text-green-600 dark:text-green-400","label"):o(b||"text-gray-600 dark:text-gray-400","label"),C=i.active?o("flex items-center justify-center w-8 h-8 rounded-full bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)] text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] border-2 border-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]","stepActive"):i.completed?o("flex items-center justify-center w-8 h-8 rounded-full bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-400 border-2 border-green-600 dark:border-green-400","stepCompleted"):o("flex items-center justify-center w-8 h-8 rounded-full bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 border-2 border-gray-300 dark:border-gray-600","stepPending");return jsxRuntime.jsxs(S__default.default.Fragment,{children:[jsxRuntime.jsxs("div",{className:o(`${l?"flex items-start":"flex flex-col items-center"} ${p?"cursor-pointer":""}`,"step"),onClick:()=>d(i.id),"aria-current":i.active?"step":void 0,children:[jsxRuntime.jsx("div",{className:`
2
+ flex items-center justify-center
3
+ ${l?"mr-4":""}
4
+ `,children:jsxRuntime.jsx("div",{className:C,children:i.icon?i.icon:i.completed?jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):jsxRuntime.jsx("span",{children:g+1})})}),jsxRuntime.jsxs("div",{className:`
5
+ ${l?"flex-1":"mt-2 text-center"}
6
+ `,children:[jsxRuntime.jsx("div",{className:`text-sm font-medium ${w}`,children:i.label}),i.description&&jsxRuntime.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:i.description})]})]}),!N&&jsxRuntime.jsx("div",{className:o(l?"ml-4 h-8 border-l-2 border-gray-300 dark:border-gray-600":"w-full border-t-2 border-gray-300 dark:border-gray-600 hidden sm:block","connector")})]},i.id)})})};exports.a=j;exports.b=E;//# sourceMappingURL=chunk-5ECDPRSZ.js.map
7
+ //# sourceMappingURL=chunk-5ECDPRSZ.js.map
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'./chunk-7D2OIPHH.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var oe=({requests:w,onSelectRequest:P,onUpdateStatus:I,onAssignRequest:V,title:H="Data Subject Request Dashboard",description:X="Track and manage data subject requests in compliance with NDPA Part IV requirements.",className:J="",buttonClassName:F="",showRequestDetails:Y=true,showRequestTimeline:z=true,showDeadlineAlerts:B=true,assignees:i=[],classNames:l,unstyled:k=false})=>{let[y,f]=useState(null),[D,O]=useState(w),[j,M]=useState("all"),[C,T]=useState("all"),[A,_]=useState(""),[$,G]=useState("createdAt"),[U,Z]=useState("desc"),[S,Q]=useState("");useEffect(()=>{let e=[...w];if(j!=="all"&&(e=e.filter(r=>r.status===j)),C!=="all"&&(e=e.filter(r=>r.type===C)),A){let r=A.toLowerCase();e=e.filter(p=>p.subject.name.toLowerCase().includes(r)||p.subject.email.toLowerCase().includes(r)||p.description&&p.description.toLowerCase().includes(r));}e.sort((r,p)=>{let h=0;switch($){case "createdAt":h=r.createdAt-p.createdAt;break;case "dueDate":h=(r.dueDate||0)-(p.dueDate||0);break;case "type":h=r.type.localeCompare(p.type);break;case "status":h=r.status.localeCompare(p.status);break;default:h=r.createdAt-p.createdAt;}return U==="asc"?h:-h}),O(e);},[w,j,C,A,$,U]),useEffect(()=>{D.length>0&&(y&&D.some(r=>r.id===y)||f(D[0].id));},[D,y]);let E=e=>{f(e),P&&P(e);},L=e=>{y&&I&&I(y,e);},W=()=>{y&&S&&V&&(V(y,S),Q(""));},R=e=>new Date(e).toLocaleDateString(),q=e=>{let r=Date.now(),p=(e-r)/(1440*60*1e3);return Math.ceil(p)},m=y?w.find(e=>e.id===y):null,t=e=>{let r={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},p={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${r[e]}`,children:p[e]})},s=e=>jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",inProgress:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",rejected:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",awaitingVerification:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200"}[e]}`,l==null?void 0:l.statusBadge,k),children:e==="inProgress"?"In Progress":e==="awaitingVerification"?"Awaiting Verification":e.charAt(0).toUpperCase()+e.slice(1)}),g=e=>{if(!e.dueDate)return null;let r=q(e.dueDate);return r<=0?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",role:"alert","aria-live":"polite",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Deadline Passed"}),jsx("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:"The response deadline has passed. Immediate action is required."})]}):r<=3?jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",role:"alert","aria-live":"polite",children:[jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Urgent: Deadline Approaching"}),jsxs("p",{className:"text-xs text-red-700 dark:text-red-300 mt-1",children:["Only ",r," day",r!==1?"s":""," remaining until the response deadline."]})]}):r<=7?jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md","aria-live":"polite",children:[jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium",children:"Deadline Approaching"}),jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:[r," days remaining until the response deadline."]})]}):jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md","aria-live":"polite",children:[jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"Deadline Tracking"}),jsxs("p",{className:"text-xs text-green-700 dark:text-green-300 mt-1",children:[r," days remaining until the response deadline."]})]})},x=e=>{let r=[{title:"Request Received",date:e.createdAt,completed:true,description:`Request was received on ${R(e.createdAt)}.`}];return e.verifiedAt?r.push({title:"Identity Verified",date:e.verifiedAt,completed:true,description:`Data subject's identity was verified on ${R(e.verifiedAt)}.`}):e.status==="awaitingVerification"&&r.push({title:"Identity Verification",date:Date.now(),completed:false,description:"Awaiting verification of data subject's identity."}),(e.status==="inProgress"||e.status==="completed"||e.status==="rejected")&&r.push({title:"Processing Started",date:e.updatedAt,completed:true,description:`Request processing started on ${R(e.updatedAt)}.`}),e.status==="completed"?r.push({title:"Request Completed",date:e.completedAt||Date.now(),completed:true,description:`Request was completed on ${R(e.completedAt||Date.now())}.`}):e.status==="rejected"&&r.push({title:"Request Rejected",date:e.completedAt||Date.now(),completed:true,description:`Request was rejected on ${R(e.completedAt||Date.now())}.${e.rejectionReason?` Reason: ${e.rejectionReason}`:""}`}),e.dueDate&&r.push({title:"Response Deadline",date:e.dueDate,completed:Date.now()>e.dueDate,description:`Response is due by ${R(e.dueDate)}.`}),jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:r.map((p,h)=>jsxs("li",{className:"mb-6 ml-4",children:[jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${p.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700"}`}),jsx("time",{className:"mb-1 text-sm font-normal leading-none text-gray-600 dark:text-gray-500",children:p.date?R(p.date):"Pending"}),jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:p.title}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:p.description})]},h))})]})},o=()=>[{value:"all",label:"All Types"},{value:"information",label:"Information (NDPA Section 29)"},{value:"access",label:"Access (NDPA Section 30)"},{value:"rectification",label:"Rectification (NDPA Section 31)"},{value:"erasure",label:"Erasure (NDPA Section 32)"},{value:"restriction",label:"Restriction (NDPA Section 33)"},{value:"portability",label:"Portability (NDPA Section 34)"},{value:"objection",label:"Objection (NDPA Section 35)"},{value:"automated_decision_making",label:"Automated Decision-Making (NDPA Section 36)"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value)),u=()=>[{value:"all",label:"All Statuses"},{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value)),v=()=>[{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map(r=>jsx("option",{value:r.value,children:r.label},r.value));return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${J}`,l==null?void 0:l.root,k),children:[jsxs("div",{className:a("",l==null?void 0:l.header,k),children:[jsx("h2",{className:a("text-xl font-bold mb-2",l==null?void 0:l.title,k),children:H}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:X})]}),jsxs("div",{className:a("mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",l==null?void 0:l.filters,k),children:[jsxs("div",{children:[jsx("label",{htmlFor:"statusFilter",className:"block text-sm font-medium mb-1",children:"Status Filter"}),jsx("select",{id:"statusFilter",value:j,onChange:e=>M(e.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-[rgb(var(--ndpr-ring))]",children:u()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"typeFilter",className:"block text-sm font-medium mb-1",children:"Request Type Filter"}),jsx("select",{id:"typeFilter",value:C,onChange:e=>T(e.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-[rgb(var(--ndpr-ring))]",children:o()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sortBy",className:"block text-sm font-medium mb-1",children:"Sort By"}),jsxs("select",{id:"sortBy",value:$,onChange:e=>G(e.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-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"createdAt",children:"Date Received"}),jsx("option",{value:"dueDate",children:"Due Date"}),jsx("option",{value:"type",children:"Request Type"}),jsx("option",{value:"status",children:"Status"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchTerm",className:"block text-sm font-medium mb-1",children:"Search"}),jsx("input",{type:"text",id:"searchTerm",value:A,onChange:e=>_(e.target.value),placeholder:"Search requests...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxs("div",{className:"md:col-span-1",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"DSR Requests"}),D.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data subject requests found."}):jsx("div",{className:a("space-y-2 max-h-96 overflow-y-auto pr-2",l==null?void 0:l.requestList,k),children:D.map(e=>{let r=e.dueDate?q(e.dueDate):null,p=null;return r!==null&&(r<=0?p=jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-bold",children:"Overdue"}):r<=3?p=jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:"Urgent"}):r<=7&&(p=jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Soon"}))),jsxs("div",{role:"button",tabIndex:0,"aria-label":`View request from ${e.subject.name}`,"aria-selected":y===e.id,className:a(`p-3 rounded-md cursor-pointer ${y===e.id?"bg-[rgb(var(--ndpr-primary)/0.05)] dark:bg-[rgb(var(--ndpr-primary)/0.1)] border border-[rgb(var(--ndpr-primary)/0.2)] dark:border-[rgb(var(--ndpr-primary)/0.3)]":"bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"}`,l==null?void 0:l.requestItem,k),onClick:()=>E(e.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),E(e.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:e.subject.name}),t(e.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:e.subject.email}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:["Received: ",R(e.createdAt)]}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsx("div",{children:s(e.status)}),jsx("div",{children:p})]})]},e.id)})})]}),jsx("div",{className:a("md:col-span-2",l==null?void 0:l.detailPanel,k),children:m?jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsx("h3",{className:"text-lg font-medium",children:m.subject.name}),jsxs("div",{className:"flex space-x-2",children:[t(m.type),s(m.status)]})]}),B&&m.dueDate&&jsx("div",{className:"mb-4",children:g(m)}),Y&&jsxs("div",{className:"mb-6",children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Email:"})," ",m.subject.email]}),m.subject.phone&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Phone:"})," ",m.subject.phone]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Received:"})," ",R(m.createdAt)]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Request Type:"})," ",{information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"}[m.type]||m.type]}),jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",m.status==="inProgress"?"In Progress":m.status==="awaitingVerification"?"Awaiting Verification":m.status.charAt(0).toUpperCase()+m.status.slice(1)]}),m.dueDate&&jsxs("p",{className:"text-sm",children:[jsx("span",{className:"font-medium",children:"Due Date:"})," ",R(m.dueDate)]})]})]}),m.description&&jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-medium",children:"Request Details:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:m.description})]}),m.additionalInfo&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium",children:"Additional Information:"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1",children:typeof m.additionalInfo=="object"?JSON.stringify(m.additionalInfo,null,2):String(m.additionalInfo||"No additional information provided")})]})]}),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("h3",{id:"update-status-heading",className:"text-md font-medium mb-2",children:"Update Status"}),jsxs("div",{className:"flex space-x-2",children:[jsx("select",{"aria-label":"Update request status",value:m.status,onChange:e=>L(e.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:v()}),jsx("button",{onClick:()=>L(m.status),"aria-label":"Apply status update",className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${F}`,children:"Update"})]})]}),i.length>0&&jsxs("div",{children:[jsx("h3",{id:"assign-request-heading",className:"text-md font-medium mb-2",children:"Assign Request"}),jsxs("div",{className:"flex space-x-2",children:[jsxs("select",{"aria-label":"Select assignee",value:S,onChange:e=>Q(e.target.value),className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"",children:"Select Assignee"}),i.map(e=>jsx("option",{value:e,children:e},e))]}),jsx("button",{onClick:W,disabled:!S,"aria-label":"Assign request to selected person",className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] disabled:bg-gray-300 disabled:text-gray-500 ${F}`,children:"Assign"})]})]})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Request Summary"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:jsx("pre",{children:JSON.stringify(a$1(m),null,2)})})})]}),z&&x(m)]}):jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Select a request to view details"})})})]})]})};var ue=({requests:w,onSelectRequest:P,title:I="DSR Request Tracker",description:V="Track the status and progress of data subject requests as required by NDPA Part IV.",className:H="",buttonClassName:X="",showSummaryStats:J=true,showTypeBreakdown:F=true,showStatusBreakdown:Y=true,showTimelineChart:z=true,showOverdueRequests:B=true,classNames:i,unstyled:l=false})=>{let[k,y]=useState("30days"),[f,D]=useState(w),[O,j]=useState([]),[M,C]=useState([]);useEffect(()=>{let t=Date.now(),s;switch(k){case "7days":s=w.filter(o=>t-o.createdAt<=10080*60*1e3);break;case "30days":s=w.filter(o=>t-o.createdAt<=720*60*60*1e3);break;case "90days":s=w.filter(o=>t-o.createdAt<=2160*60*60*1e3);break;default:s=[...w];}D(s);let g=s.filter(o=>o.dueDate&&t>o.dueDate&&o.status!=="completed"&&o.status!=="rejected");j(g);let x=s.filter(o=>o.dueDate&&t<o.dueDate&&o.dueDate-t<=10080*60*1e3&&o.status!=="completed"&&o.status!=="rejected");C(x);},[w,k]);let T=t=>{P&&P(t);},A=t=>new Date(t).toLocaleDateString(),_=t=>{let s=Date.now(),g=(t-s)/(1440*60*1e3);return Math.ceil(g)},$=()=>{let t=f.filter(g=>g.status==="completed"&&g.completedAt&&g.createdAt);if(t.length===0)return null;let s=t.reduce((g,x)=>{let o=((x.completedAt||0)-x.createdAt)/864e5;return g+o},0);return Number((s/t.length).toFixed(1))},G=()=>{let t=f.filter(g=>(g.status==="completed"||g.status==="rejected")&&g.completedAt&&g.dueDate);if(t.length===0)return null;let s=t.filter(g=>(g.completedAt||0)<=(g.dueDate||0));return Math.round(s.length/t.length*100)},U=()=>{let t={};return f.forEach(s=>{t[s.type]=(t[s.type]||0)+1;}),{information:t.information||0,access:t.access||0,rectification:t.rectification||0,erasure:t.erasure||0,restriction:t.restriction||0,portability:t.portability||0,objection:t.objection||0,automated_decision_making:t.automated_decision_making||0}},Z=()=>{let t={};return f.forEach(s=>{t[s.status]=(t[s.status]||0)+1;}),{pending:t.pending||0,awaitingVerification:t.awaitingVerification||0,inProgress:t.inProgress||0,completed:t.completed||0,rejected:t.rejected||0}},S=t=>{let s={information:"bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-200",access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",automated_decision_making:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},g={information:"Information",access:"Access",rectification:"Rectification",erasure:"Erasure",restriction:"Restriction",portability:"Portability",objection:"Objection",automated_decision_making:"Automated Decision-Making"};return jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${s[t]}`,children:g[t]})},E=()=>{let t=f.length,s=f.filter(u=>u.status!=="completed"&&u.status!=="rejected").length;f.filter(u=>u.status==="completed"||u.status==="rejected").length;let x=$(),o=G();return jsxs("div",{className:a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.stats,l),children:[jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Total Requests"}),jsx("p",{className:"text-2xl font-bold",children:t})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Pending Requests"}),jsx("p",{className:"text-2xl font-bold",children:s})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Avg. Response Time"}),jsx("p",{className:"text-2xl font-bold",children:x!==null?`${x} days`:"N/A"})]}),jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,l),children:[jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Compliance Rate"}),jsx("p",{className:"text-2xl font-bold",children:o!==null?`${o}%`:"N/A"})]})]})},L=()=>{let t=U(),s=f.length,g=Object.entries(t).sort(([,x],[,o])=>o-x).map(([x])=>x);return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,l),children:[jsx("h3",{className:a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,l),children:"Request Types"}),s===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsx("div",{className:"space-y-4",children:g.map(x=>{let o=t[x],u=Math.round(o/s*100);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-center mb-1",children:[jsxs("div",{className:"flex items-center",children:[S(x),jsxs("span",{className:"ml-2 text-sm",children:[o," requests"]})]}),jsxs("span",{className:"text-sm font-medium",children:[u,"%"]})]}),jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5",children:jsx("div",{className:"bg-[rgb(var(--ndpr-primary))] h-2.5 rounded-full",style:{width:`${u}%`}})})]},x)})})]})},W=()=>{let t=Z(),s=f.length,g=["pending","awaitingVerification","inProgress","completed","rejected"],x={pending:"bg-yellow-500",awaitingVerification:"bg-purple-500",inProgress:"bg-blue-500",completed:"bg-green-500",rejected:"bg-red-500"};return jsxs("div",{className:a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,l),children:[jsx("h3",{className:a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,l),children:"Request Status"}),s===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{children:[jsx("div",{className:"flex h-4 mb-2",children:g.map(o=>{let u=t[o],v=u/s*100;return v>0?jsx("div",{className:`${x[o]} first:rounded-l-full last:rounded-r-full`,style:{width:`${v}%`},title:`${o}: ${u} (${Math.round(v)}%)`},o):null})}),jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 mt-4",children:g.map(o=>{let u=t[o],v=Math.round(u/s*100);return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:`w-3 h-3 rounded-full ${x[o]} mr-2`}),jsxs("div",{children:[jsx("p",{className:"text-xs font-medium",children:o==="inProgress"?"In Progress":o==="awaitingVerification"?"Awaiting Verification":o.charAt(0).toUpperCase()+o.slice(1)}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:[u," (",v,"%)"]})]})]},o)})})]})]})},R=()=>{let t={};f.forEach(u=>{let v=new Date(u.createdAt),e=`${v.getFullYear()}-${String(v.getMonth()+1).padStart(2,"0")}`;t[e]=(t[e]||0)+1;});let g=Object.keys(t).sort().slice(-6),x=Math.max(...Object.values(t).filter(u=>u>0),1),o=u=>{let[v,e]=u.split("-");return `${e}/${v.slice(2)}`};return jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),g.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxs("div",{className:"h-40",children:[jsx("div",{className:"flex h-32 items-end justify-between space-x-2",children:g.map(u=>{let v=t[u],e=`${v/x*100}%`;return jsx("div",{className:"flex flex-col items-center flex-1",children:jsx("div",{className:"w-full bg-[rgb(var(--ndpr-primary))] rounded-t",style:{height:e},title:`${o(u)}: ${v} requests`})},u)})}),jsx("div",{className:"flex justify-between mt-2",children:g.map(u=>jsx("div",{className:"text-xs text-center",children:o(u)},u))})]})]})},q=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6","aria-live":"polite",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Overdue Requests"}),O.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No overdue requests."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:O.map(t=>jsxs("div",{role:"button",tabIndex:0,"aria-label":`View overdue request from ${t.subject.name}`,className:a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md cursor-pointer hover:bg-red-100 dark:hover:bg-red-900/30",i==null?void 0:i.tableRow,l),onClick:()=>T(t.id),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),T(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),S(t.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxs("p",{className:"text-xs font-bold text-red-600 dark:text-red-400",children:["Overdue by ",Math.abs(_(t.dueDate||0))," days"]})]})]},t.id))})]}),m=()=>jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6","aria-live":"polite",children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Upcoming Deadlines"}),M.length===0?jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No upcoming deadlines in the next 7 days."}):jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:M.map(t=>{let s=_(t.dueDate||0);return jsxs("div",{role:"button",tabIndex:0,"aria-label":`View upcoming deadline for ${t.subject.name}`,className:a("p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md cursor-pointer hover:bg-yellow-100 dark:hover:bg-yellow-900/30",i==null?void 0:i.tableRow,l),onClick:()=>T(t.id),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),T(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),S(t.type)]}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxs("div",{className:"flex justify-between items-center",children:[jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxs("p",{className:`text-xs font-bold ${s<=3?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`,children:["Due in ",s," days"]})]})]},t.id)})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${H}`,i==null?void 0:i.root,l),children:[jsxs("div",{className:a("flex flex-col md:flex-row md:justify-between md:items-center mb-6",i==null?void 0:i.header,l),children:[jsxs("div",{children:[jsx("h2",{className:a("text-xl font-bold mb-2",i==null?void 0:i.title,l),children:I}),jsx("p",{className:"text-gray-600 dark:text-gray-300",children:V})]}),jsxs("div",{className:"mt-4 md:mt-0",children:[jsx("label",{htmlFor:"timeframe",className:"block text-sm font-medium mb-1",children:"Timeframe"}),jsxs("select",{id:"timeframe",value:k,onChange:t=>y(t.target.value),className:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",children:[jsx("option",{value:"7days",children:"Last 7 Days"}),jsx("option",{value:"30days",children:"Last 30 Days"}),jsx("option",{value:"90days",children:"Last 90 Days"}),jsx("option",{value:"all",children:"All Time"})]})]})]}),J&&E(),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxs("div",{children:[F&&L(),Y&&W()]}),jsxs("div",{children:[z&&R(),B&&q(),B&&m()]})]})]})};export{oe as a,ue as b};//# sourceMappingURL=chunk-5X32J5IA.mjs.map
2
+ //# sourceMappingURL=chunk-5X32J5IA.mjs.map
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'./chunk-6TA2MVTU.mjs';import {a as a$2}from'./chunk-6WIP33TW.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect,useCallback}from'react';function J(a,h){return h?a$2(a):{load:()=>null,save:()=>{},remove:()=>{}}}function Z({sections:a$2,initialAnswers:h={},adapter:P,storageKey:V="ndpr_dpia_data",useLocalStorage:T=true,onComplete:w}){let y=P!=null?P:J(V,T),g=useRef(y);g.current=y;let[f,m]=useState(0),[o,v]=useState(h),[_,I]=useState(true);useEffect(()=>{let r=false;try{let t=g.current.load();t instanceof Promise?t.then(e=>{r||(e&&v(e),I(!1));},()=>{r||I(!1);}):(t&&v(t),I(!1));}catch(t){r||I(false);}return ()=>{r=true;}},[]);let u=a$2[f]||null,S=useCallback(r=>{Promise.resolve(g.current.save(r)).catch(t=>{console.warn("[ndpr-toolkit] Failed to save DPIA answers:",t);});},[]),$=useCallback((r,t)=>{v(e=>{let s=b(a({},e),{[r]:t});return S(s),s});},[S]),A=useCallback(r=>r.showWhen?r.showWhen.every(t=>{let e=o[t.questionId];switch(t.operator){case "equals":return e===t.value;case "contains":return Array.isArray(e)?e.includes(String(t.value)):false;case "greaterThan":return typeof e=="number"&&typeof t.value=="number"?e>t.value:false;case "lessThan":return typeof e=="number"&&typeof t.value=="number"?e<t.value:false;default:return true}}):true,[o]),p=useCallback(()=>u?u.questions.filter(A):[],[u,A]),D=useCallback(()=>u?p().every(t=>{if(!t.required)return true;let e=o[t.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,[o,u,p]),O=useCallback(()=>{let r={};return u&&p().forEach(e=>{if(!e.required)return;let s=o[e.id];s==null||typeof s=="string"&&s.trim()===""?r[e.id]="This question is required":Array.isArray(s)&&s.length===0&&(r[e.id]="At least one option must be selected");}),r},[o,u,p]),U=useCallback(()=>D()&&f<a$2.length-1?(m(r=>r+1),true):false,[f,a$2.length,D]),B=useCallback(()=>f>0?(m(r=>r-1),true):false,[f]),F=useCallback(r=>r>=0&&r<a$2.length?(m(r),true):false,[a$2.length]),W=useCallback(()=>a$2.every(r=>r.questions.filter(A).every(e=>{if(!e.required)return true;let s=o[e.id];return !(s==null||typeof s=="string"&&s.trim()===""||Array.isArray(s)&&s.length===0)})),[o,a$2,A]),k=useCallback(()=>{let r=[];return a$2.forEach(t=>{t.questions.forEach(e=>{let s=o[e.id];if(s!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(s)?s:[s]).forEach(l=>{var R;let c=(R=e.options)==null?void 0:R.find(d=>d.value===l);if(c!=null&&c.riskLevel){let d=c.riskLevel,Q=d==="low"?1:d==="medium"?3:5,L=d==="low"?1:d==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${c.label}`,likelihood:Q,impact:L,score:Q*L,level:d,mitigated:false,relatedQuestionIds:[e.id]});}});else {let n=e.riskLevel,l=n==="low"?1:n==="medium"?3:5,c=n==="low"?1:n==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:l,impact:c,score:l*c,level:n,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},[o,a$2]),K=useCallback((r,t,e)=>{let s=k(),n={id:`dpia_${Date.now()}`,title:t,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:o,risks:s,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},l=a$1(n);return n.overallRiskLevel=l.overallRiskLevel,n.canProceed=l.canProceed,n.conclusion=l.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",n.recommendations=l.recommendations,w&&w(n),n},[o,k,w]),j=useCallback(()=>{v({}),m(0),Promise.resolve(g.current.remove()).catch(r=>{console.warn("[ndpr-toolkit] Failed to remove DPIA data:",r);});},[]),z=(()=>{let r=0,t=0;return a$2.forEach(e=>{e.questions.forEach(s=>{if(s.required&&A(s)){t++;let n=o[s.id];n!=null&&!(typeof n=="string"&&n.trim()==="")&&!(Array.isArray(n)&&n.length===0)&&r++;}});}),t>0?Math.round(r/t*100):0})();return {currentSectionIndex:f,currentSection:u,answers:o,updateAnswer:$,nextSection:U,prevSection:B,goToSection:F,isCurrentSectionValid:D,getCurrentSectionErrors:O,isComplete:W,completeDPIA:K,getVisibleQuestions:p,resetDPIA:j,progress:z,isLoading:_}}export{Z as a};//# sourceMappingURL=chunk-6FGCGLH5.mjs.map
2
+ //# sourceMappingURL=chunk-6FGCGLH5.mjs.map
@@ -0,0 +1,2 @@
1
+ import {a as a$2}from'./chunk-GKKAK6ES.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var mr=({requestTypes:A,onSubmit:V,onValidationError:S,title:s="Submit a Data Subject Request",description:N="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part IV, Sections 29-36.",submitButtonText:rr="Submit Request",className:D="",buttonClassName:_="",showConfirmation:er=true,confirmationMessage:ir="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:P=true,identifierTypes:R=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:tr=true,labels:f={},classNames:r,unstyled:o=false,isSubmitting:x=false,defaultValues:a$3,onReset:F})=>{var Y,H,L,U,W,J;let[h,j]=useState((a$3==null?void 0:a$3.requestType)||""),[T,E]=useState(((Y=a$3==null?void 0:a$3.dataSubject)==null?void 0:Y.fullName)||""),[q,O]=useState(((H=a$3==null?void 0:a$3.dataSubject)==null?void 0:H.email)||""),[w,B]=useState(((L=a$3==null?void 0:a$3.dataSubject)==null?void 0:L.phone)||""),[z,M]=useState(((U=a$3==null?void 0:a$3.dataSubject)==null?void 0:U.identifierType)||((W=R[0])==null?void 0:W.id)||""),[$,Z]=useState(((J=a$3==null?void 0:a$3.dataSubject)==null?void 0:J.identifierValue)||""),[l,C]=useState((a$3==null?void 0:a$3.additionalInfo)||{}),[or,I]=useState(false),[d,G]=useState({}),nr=()=>{var e;j(""),E(""),O(""),B(""),M(((e=R[0])==null?void 0:e.id)||""),Z(""),C({}),I(false),G({}),F==null||F();},u=A.find(e=>e.id===h),dr=e=>{j(e.target.value),C({});},c=(e,b$1)=>{C(m=>b(a$1({},m),{[e]:b$1}));},ar=()=>{let e={};return T.trim()||(e.fullName="Full name is required"),q.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q)||(e.email="Email is invalid"):e.email="Email is required",h||(e.requestType="Please select a request type"),P&&!$.trim()&&(e.identifierValue="Identifier value is required"),u!=null&&u.requiresAdditionalInfo&&u.additionalFields&&u.additionalFields.forEach(b=>{b.required&&!l[b.id]&&(e[`additional_${b.id}`]=`${b.label} is required`);}),G(e),e},ur=e=>{e.preventDefault();let b=ar();if(Object.keys(b).length>0){S==null||S(b);return}let m=Object.keys(l).length>0?Object.fromEntries(Object.entries(l).map(([g,v])=>[g,typeof v=="string"?a$2(v):v])):void 0,k={requestType:h,dataSubject:{fullName:a$2(T),email:a$2(q),phone:w?a$2(w):void 0,identifierType:z,identifierValue:a$2($)},additionalInfo:m,submittedAt:Date.now()};V(k),er&&I(true);};return or?jsxs("div",{className:a(`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${D}`,r==null?void 0:r.successMessage,o),"aria-live":"polite",children:[jsx("h2",{className:a("text-lg font-bold text-green-800 dark:text-green-200 mb-2",r==null?void 0:r.title,o),children:"Request Submitted"}),jsx("p",{className:a("text-green-700 dark:text-green-300",r==null?void 0:r.description,o),children:ir}),jsx("button",{onClick:()=>I(false),className:a(`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${_}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:"Submit Another Request"})]}):jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${D}`,r==null?void 0:r.root,o),children:[jsx("h2",{className:a("text-xl font-bold mb-2",r==null?void 0:r.title,o),children:s}),jsx("p",{className:a("mb-6 text-gray-600 dark:text-gray-300",r==null?void 0:r.description,o),children:N}),jsx("form",{onSubmit:ur,className:a("",r==null?void 0:r.form,o),children:jsxs("div",{className:a("space-y-4",r==null?void 0:r.fieldGroup,o),children:[jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Personal Information"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"fullName",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[f.name||"Full Name"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:T,onChange:e=>E(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-required":"true","aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[f.email||"Email Address"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"email",id:"email",value:q,onChange:e=>O(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-required":"true","aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsx("p",{id:"email-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.email})]}),tr&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:w,onChange:e=>B(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Request Details"}),jsxs("div",{className:"mb-4",children:[jsxs("label",{htmlFor:"requestType",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[f.requestType||"Request Type"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsxs("select",{id:"requestType",value:h,onChange:dr,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:true,"aria-required":"true","aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),A.map(e=>jsx("option",{value:e.id,children:e.name},e.id))]}),d.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.requestType})]}),u&&jsxs("div",{className:"mb-4 p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-2",children:u.description}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Estimated completion time: ",u.estimatedCompletionTime," ",u.estimatedCompletionTime===1?"day":"days"]})]}),jsxs("div",{className:"mb-4",children:[jsx("label",{htmlFor:"requestDescription",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:f.description||"Additional Information"}),jsx("textarea",{id:"requestDescription",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.textarea,o),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),P&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Identity Verification"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"identifierType",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Type ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("select",{id:"identifierType",value:z,onChange:e=>M(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:true,"aria-required":"true",children:R.map(e=>jsx("option",{value:e.id,children:e.label},e.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Value ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:$,onChange:e=>Z(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-required":"true","aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.identifierValue})]})]})]}),(u==null?void 0:u.requiresAdditionalInfo)&&u.additionalFields&&u.additionalFields.length>0&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Additional Information"}),jsx("div",{className:"space-y-4",children:u.additionalFields.map(e=>{var b,m,k;return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[e.label," ",e.required&&jsx("span",{className:"text-red-500",children:"*"})]}),e.type==="text"&&jsx("input",{type:"text",id:e.id,value:String((b=l[e.id])!=null?b:""),onChange:g=>c(e.id,g.target.value),placeholder:e.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:e.required,"aria-required":e.required||void 0,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="textarea"&&jsx("textarea",{id:e.id,value:String((m=l[e.id])!=null?m:""),onChange:g=>c(e.id,g.target.value),placeholder:e.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.textarea,o),rows:4,required:e.required,"aria-required":e.required||void 0,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="select"&&e.options&&jsxs("select",{id:e.id,value:String((k=l[e.id])!=null?k:""),onChange:g=>c(e.id,g.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:e.required,"aria-required":e.required||void 0,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0,children:[jsx("option",{value:"",children:e.placeholder||"Select an option"}),e.options.map(g=>jsx("option",{value:g,children:g},g))]}),e.type==="checkbox"&&jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{type:"checkbox",id:e.id,checked:!!l[e.id],onChange:g=>c(e.id,g.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",required:e.required,"aria-required":e.required||void 0,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0})}),jsx("div",{className:"ml-3 text-sm",children:jsx("label",{htmlFor:e.id,className:"text-gray-700 dark:text-gray-300",children:e.placeholder||e.label})})]}),e.type==="file"&&jsx("input",{type:"file",id:e.id,onChange:g=>{var K;let v=(K=g.target.files)==null?void 0:K[0];v&&c(e.id,v.name);},className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:e.required,"aria-required":e.required||void 0,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),d[`additional_${e.id}`]&&jsx("p",{id:`additional-${e.id}-error`,role:"alert",className:"mt-1 text-sm text-red-500",children:d[`additional_${e.id}`]})]},e.id)})})]}),jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("h3",{className:"text-sm font-semibold mb-2",children:"Privacy Notice"}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:"The information you provide in this form will be used solely for the purpose of processing your data subject request. We will retain this information for as long as necessary to fulfill your request and to comply with our legal obligations. For more information, please refer to our Privacy Policy."})]}),jsxs("div",{className:"mt-6 flex gap-3 relative",children:[x&&(r==null?void 0:r.loadingOverlay)&&jsx("div",{className:r.loadingOverlay}),jsx("button",{type:"submit",disabled:x,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${_} ${x?"opacity-50 cursor-not-allowed":""}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:x?"Submitting...":f.submit||rr}),jsx("button",{type:"button",onClick:nr,className:a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,o),children:"Reset"})]})]})})]})};export{mr as a};//# sourceMappingURL=chunk-6YN73KR7.mjs.map
2
+ //# sourceMappingURL=chunk-6YN73KR7.mjs.map