@tantainnovative/ndpr-toolkit 3.11.0 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/breach.js +1 -1
- package/dist/breach.mjs +1 -1
- package/dist/{chunk-EZCGTHQV.js → chunk-4GIMXUMI.js} +3 -3
- package/dist/chunk-67KA345Q.mjs +1 -0
- package/dist/chunk-6OWCUDTN.mjs +1 -0
- package/dist/chunk-CAFCRCTZ.mjs +1 -0
- package/dist/chunk-JYZOKO2W.mjs +103 -0
- package/dist/chunk-NX5MOBRI.js +1 -0
- package/dist/chunk-O2WEABB3.js +1 -0
- package/dist/chunk-ROC64RLP.js +1 -0
- package/dist/{chunk-O45PKBZA.mjs → chunk-RR3KXNET.mjs} +3 -3
- package/dist/{chunk-KY6WYHWB.mjs → chunk-TN4TH3CT.mjs} +1 -1
- package/dist/{chunk-O2RDZGM2.js → chunk-VUFTRKKC.js} +1 -1
- package/dist/chunk-WKUC65HL.mjs +1 -0
- package/dist/chunk-WXUXCRAJ.js +1 -0
- package/dist/chunk-YK22SYCT.js +103 -0
- package/dist/chunk-YSD2DFBR.js +6 -0
- package/dist/chunk-ZHX62QAL.mjs +6 -0
- package/dist/cross-border.js +1 -1
- package/dist/cross-border.mjs +1 -1
- package/dist/dpia.js +1 -1
- package/dist/dpia.mjs +1 -1
- package/dist/headless.d.mts +24 -3
- package/dist/headless.d.ts +24 -3
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/hooks.d.mts +24 -3
- package/dist/hooks.d.ts +24 -3
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.d.mts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lawful-basis.js +1 -1
- package/dist/lawful-basis.mjs +1 -1
- package/dist/presets.js +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/ropa.d.mts +24 -3
- package/dist/ropa.d.ts +24 -3
- package/dist/ropa.js +1 -1
- package/dist/ropa.mjs +1 -1
- package/dist/styles.css +2 -0
- package/package.json +1 -1
- package/dist/chunk-3JPDTXGC.js +0 -1
- package/dist/chunk-43OQNS2J.mjs +0 -6
- package/dist/chunk-5GVMKUMP.js +0 -1
- package/dist/chunk-COD3RMTL.mjs +0 -1
- package/dist/chunk-EXEXUAF6.mjs +0 -1
- package/dist/chunk-PGI2LM6P.js +0 -103
- package/dist/chunk-PZRQWPWD.js +0 -1
- package/dist/chunk-RPXRPGHL.mjs +0 -1
- package/dist/chunk-SSH4U4TJ.js +0 -6
- package/dist/chunk-WDDCKYWA.js +0 -1
- package/dist/chunk-X3GCGC3H.mjs +0 -103
- package/dist/chunk-ZQZJNKVB.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.12.0](https://github.com/mr-tanta/ndpr-toolkit/compare/v3.11.0...v3.12.0) (2026-05-27)
|
|
6
|
+
|
|
7
|
+
Release 4 of 6 on the post-audit roadmap. Accessibility + performance + test coverage. No public API changes — everything is additive or behaviour-preserving internal work. Existing consumers see no breakage; users of assistive tech and consumers of large managers see real improvements.
|
|
8
|
+
|
|
9
|
+
### Accessibility — 6 WCAG 2.2 fixes
|
|
10
|
+
|
|
11
|
+
- **`BreachNotificationManager`** (`components/breach/BreachNotificationManager.tsx`) — the breach list row was a clickable `<div>` without `role`/`tabIndex`/keyboard handler. Now `role="button"`, `tabIndex={0}`, `aria-selected`, `aria-label`, and Enter/Space activation (matching the existing DSRDashboard pattern). Keyboard users can finally drill into a breach row.
|
|
12
|
+
- **`dpia/StepIndicator`** — the step wedge had `onClick` without button semantics. Now conditionally adds `role="button"` / `tabIndex` / keydown when interactive (`clickable && onStepClick`); when display-only, those attributes are `undefined` so it stays a non-interactive progress marker.
|
|
13
|
+
- **`CrossBorderTransferManager`** — 8 form fields had `<label>` without `htmlFor` and the matching `<input>`/`<select>` had no `id`. Screen readers announced "edit text, blank" for all 8. Added stable `cb-transfer-<field>` id pairs: `riskLevel`, `estimatedDataSubjects`, `recipientContactPhone`, `recipientContactAddress`, `frequency`, `status`, `ndpcApprovalReference`, `tiaReference`.
|
|
14
|
+
- **`BreachReportForm` file upload** — `<label>` had no `htmlFor`, `<input type="file">` had no `id`. Added `htmlFor="breach-attachments"` + matching id. Decorative paperclip SVG got `aria-hidden="true" focusable="false"`.
|
|
15
|
+
- **Touch targets** — `.ndpr-consent-banner__button` and `.ndpr-button` were ~33px tall (`padding: 0.5rem 1rem`). Added `min-height: 44px` to both — matches iOS HIG and WCAG 2.2 enhanced target. Existing padding is unchanged so visual layout doesn't shift.
|
|
16
|
+
- **`DPIAQuestionnaire`** — section title heading now has `aria-live="polite"` so screen readers announce the new section title when the user clicks Next.
|
|
17
|
+
|
|
18
|
+
### Performance — 3 hot-path improvements
|
|
19
|
+
|
|
20
|
+
- **`useROPA`** (`hooks/useROPA.ts`) — derivers `getSummary` / `exportCSV` / `getComplianceGaps` previously recomputed on every call. Hook now also returns `summary` / `csv` / `complianceGaps` as `useMemo`-cached values keyed on `ropa`. The existing callable functions still work (marked `@deprecated` in JSDoc, points at the cached fields). Pure additive — no break.
|
|
21
|
+
- **`CrossBorderTransferManager`** — `summaryData` collapsed from 4× `transfers.filter(...)` calls (O(4n)) to a single `for` loop (O(n)) that accumulates `totalActiveTransfers`, `pendingApproval`, `highRiskTransfers`, `missingTIA` in one pass. Same output shape; meaningfully faster with many transfers.
|
|
22
|
+
- **Hoisted lookup tables** — `STATUS_BADGE_CLASSES` / `STATUS_BADGE_LABELS` / `BASIS_BADGE_CLASSES` / `BASIS_BADGE_LABELS` (LawfulBasisTracker), `RISK_BADGE_CLASSES` / `CB_STATUS_BADGE_*` (CrossBorderTransferManager), `ROPA_STATUS_BADGE_*` / `ROPA_BASIS_BADGE_LABELS` (ROPAManager) moved from inside `useCallback` bodies to module scope. Eliminates per-row object allocation on every render.
|
|
23
|
+
|
|
24
|
+
Two perf items from the audit were **inspected and intentionally skipped** with documented reasons:
|
|
25
|
+
|
|
26
|
+
- `useDefaultPrivacyPolicy` was already cached via a `useRef`-gated init (not a typical `useMemo` shape, but functionally equivalent — the comment at line 167 calls out the intentional semantics).
|
|
27
|
+
- `ROPAManager` inline onChange closures were already paired with `useCallback`-stable `updateEditingField` / `updateControllerField` refs, so the existing setup doesn't pay the per-keystroke closure-allocation cost we'd hoped to remove. Extracting a `<FormField>` component would touch >400 lines and risk subtle behavioural change for marginal gain.
|
|
28
|
+
|
|
29
|
+
### Test coverage — +25 cases
|
|
30
|
+
|
|
31
|
+
Suite jumped from 1212 to **1237 / 1237 passing**. New cases target gaps the audit's B4 report flagged as critical:
|
|
32
|
+
|
|
33
|
+
- **`useFocusTrap`** (7 cases, new file) — restore-focus-on-deactivation, Tab cycling forward, Shift+Tab cycling backward, onEscape, listener cleanup, `autoFocus: false`. Previously zero dedicated tests for 128 LOC of WCAG-critical focus-trap logic.
|
|
34
|
+
- **`useComplianceScore`** (2 cases, new file) — memoisation by deep equality, recompute on inner-field change.
|
|
35
|
+
- **`NDPRDashboard` preset** (2 cases, new file) — `ComplianceInput` → score ring; degraded input lowers score.
|
|
36
|
+
- **`NDPRThemeProvider`** (2 added cases) — `mode: 'light'` sets `data-theme="light"`; empty `theme={{}}` produces no style attribute.
|
|
37
|
+
- **`assessDPIARisk`** (2 added cases) — empty-risks array → low-level; all-mitigated high-risk → `canProceed: true`.
|
|
38
|
+
- **`NDPRProvider`** (3 cases, new file) — `useNDPRConfig` returns provided config; `useNDPRLocale` merges partial overrides with English defaults; nested-provider innermost-wins.
|
|
39
|
+
- **`preset-callbacks`** (7 cases, new file) — submit / save / complete callbacks across `NDPRConsent`, `NDPRBreachReport` (with adapter), `NDPRDPIA`, `NDPRLawfulBasis`, `NDPRCrossBorder`, `NDPRROPA`. (One preset deferred: `NDPRPrivacyPolicy.onComplete` only fires after a multi-step wizard flow with valid data — would duplicate `useAdaptivePolicyWizard`'s own tests.)
|
|
40
|
+
|
|
41
|
+
### Deferred from the original 3.12.0 plan
|
|
42
|
+
|
|
43
|
+
- **`/server` split into `/server/utils`, `/server/policy`, `/server/locales`.** Inspected: the 261-line `/server` re-exports translate to ~40 chunks pulled by tsup, but consumers already have narrower subpaths (`/dsr`, `/policy`, etc.) for the same use cases. The split adds 3 entry points + 3 PROBES + 3 docs entries for marginal benefit. Slated for re-evaluation in the 4.x roadmap discussion alongside the B20 strategic items.
|
|
44
|
+
|
|
45
|
+
### Verification
|
|
46
|
+
|
|
47
|
+
- Jest: **1237 / 1237 passing** (was 1212; +25 new tests)
|
|
48
|
+
- `tsc --noEmit -p tsconfig.json` clean
|
|
49
|
+
- `pnpm verify:tarball --skip-ts` clean across all 22 subpaths
|
|
50
|
+
|
|
5
51
|
## [3.11.0](https://github.com/mr-tanta/ndpr-toolkit/compare/v3.10.6...v3.11.0) (2026-05-27)
|
|
6
52
|
|
|
7
53
|
Release 3 of 6 on the post-audit roadmap. Strictly additive — every change here adds to the public surface or fixes a docs lie. Existing consumers keep working without changes.
|
package/dist/breach.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var chunkYK22SYCT_js=require('./chunk-YK22SYCT.js'),chunkVUFTRKKC_js=require('./chunk-VUFTRKKC.js'),chunkEHQVTFYO_js=require('./chunk-EHQVTFYO.js'),chunk3YTAOT5O_js=require('./chunk-3YTAOT5O.js');require('./chunk-UXUMYP4L.js'),require('./chunk-NDKDKDDX.js'),require('./chunk-WKTKTLMF.js'),require('./chunk-ZVOIR4QH.js'),require('./chunk-AME4HJR4.js'),require('./chunk-VWED6UTN.js');var chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var c=react.createContext(null);function P(){let e=react.useContext(c);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 p=({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u,children:d})=>{let y=chunkEHQVTFYO_js.a({categories:e,adapter:m,storageKey:h,useLocalStorage:B,initialReports:f,onReport:R,onAssessment:x,onNotification:u}),l=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},y),{categories:e});return jsxRuntime.jsx(c.Provider,{value:l,children:d})};var A={Provider:p,ReportForm:chunkVUFTRKKC_js.a,RiskAssessment:chunkYK22SYCT_js.a,NotificationManager:chunkYK22SYCT_js.b,ReportGenerator:chunkYK22SYCT_js.c};Object.defineProperty(exports,"BreachNotificationManager",{enumerable:true,get:function(){return chunkYK22SYCT_js.b}});Object.defineProperty(exports,"BreachRiskAssessment",{enumerable:true,get:function(){return chunkYK22SYCT_js.a}});Object.defineProperty(exports,"RegulatoryReportGenerator",{enumerable:true,get:function(){return chunkYK22SYCT_js.c}});Object.defineProperty(exports,"BreachReportForm",{enumerable:true,get:function(){return chunkVUFTRKKC_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkEHQVTFYO_js.a}});Object.defineProperty(exports,"calculateBreachSeverity",{enumerable:true,get:function(){return chunk3YTAOT5O_js.a}});exports.Breach=A;exports.BreachProvider=p;exports.useBreachCompound=P;
|
package/dist/breach.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {c as c$1,b,a}from'./chunk-
|
|
2
|
+
import {c as c$1,b,a}from'./chunk-JYZOKO2W.mjs';export{b as BreachNotificationManager,a as BreachRiskAssessment,c as RegulatoryReportGenerator}from'./chunk-JYZOKO2W.mjs';import {a as a$1}from'./chunk-TN4TH3CT.mjs';export{a as BreachReportForm}from'./chunk-TN4TH3CT.mjs';import {a as a$2}from'./chunk-RFXGD5NE.mjs';export{a as useBreach}from'./chunk-RFXGD5NE.mjs';export{a as calculateBreachSeverity}from'./chunk-WTGKZX7J.mjs';import'./chunk-EWVK45Z3.mjs';import'./chunk-25TNTLHJ.mjs';import'./chunk-RBMLGRDN.mjs';import'./chunk-ITCY2Z66.mjs';import'./chunk-SFGW37LE.mjs';import'./chunk-DBZSN4WP.mjs';import {b as b$1,a as a$3}from'./chunk-ZJYULEER.mjs';import {createContext,useContext}from'react';import {jsx}from'react/jsx-runtime';var c=createContext(null);function P(){let e=useContext(c);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 p=({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(c.Provider,{value:l,children:d})};var A={Provider:p,ReportForm:a$1,RiskAssessment:a,NotificationManager:b,ReportGenerator:c$1};export{A as Breach,p as BreachProvider,P as useBreachCompound};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
'use strict';var chunkZVOIR4QH_js=require('./chunk-ZVOIR4QH.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.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:a,sections:m,showFullReport:g=true,allowPrint:u=true,allowExport:v=true,onExport:f,className:N="",buttonClassName:x="",classNames:b={},unstyled:y=false})=>{let o=S.useMemo(()=>new Date().toLocaleDateString(),[]),d=(r,s)=>{let i=s?b[s]:void 0;return !i&&s==="printButton"&&(i=b.primaryButton),chunkAME4HJR4_js.a(r,i,y)},l=r=>new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),w=r=>{let s=a.answers[r];return s==null?"Not answered":typeof s=="boolean"?s?"Yes":"No":Array.isArray(s)?s.join(", "):String(s)},k=()=>{window.print();},C=r=>{f&&f(r);},R=r=>jsxRuntime.jsx("span",{className:d(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[r]}`,"riskBadge"),children:r.charAt(0).toUpperCase()+r.slice(1)});return jsxRuntime.jsxs("div",{"data-ndpr-component":"dpia-report",className:`${d("bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 print:shadow-none print:p-0","root")} ${N}`,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("ndpr-card__title","title"),children:"Data Protection Impact Assessment Report"}),jsxRuntime.jsx("h2",{className:"text-xl ndpr-text-muted mb-4",children:a.title})]}),(u||v)&&jsxRuntime.jsxs("div",{className:"flex space-x-2 print:hidden",children:[u&&jsxRuntime.jsx("button",{onClick:k,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")} ${x}`,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"]})}),v&&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))] ${x}`,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:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Assessor:"})," ",a.assessor.name,", ",a.assessor.role]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Contact:"})," ",a.assessor.email]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Started:"})," ",l(a.startedAt)]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Completed:"})," ",a.completedAt?l(a.completedAt):"In progress"]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Next review:"})," ",a.reviewDate?l(a.reviewDate):"Not scheduled"]})]})]})]}),jsxRuntime.jsxs("div",{className:d("mb-8","summary"),children:[jsxRuntime.jsx("h2",{className:"ndpr-section-heading",children:"Executive Summary"}),jsxRuntime.jsxs("div",{className:"ndpr-panel",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:"}),R(a.overallRiskLevel)]}),jsxRuntime.jsxs("div",{className:d("mb-2","conclusion"),children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Conclusion:"})," ",a.conclusion]}),jsxRuntime.jsxs("div",{role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Can Proceed:"})," ",a.canProceed?"Yes":"No"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium ndpr-text-foreground mb-2",children:"Processing Activity Description"}),jsxRuntime.jsx("p",{className:"ndpr-text-muted mb-4",children:a.processingDescription}),a.recommendations&&a.recommendations.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium ndpr-text-foreground mb-2",children:"Key Recommendations"}),jsxRuntime.jsx("ul",{className:"list-disc pl-5 ndpr-text-muted",children:a.recommendations.map((r,s)=>jsxRuntime.jsx("li",{className:d("","recommendation"),children:r},s))})]})]})]}),jsxRuntime.jsxs("div",{className:"mb-8",children:[jsxRuntime.jsx("h2",{className:"ndpr-section-heading",children:"Identified Risks"}),a.risks.length===0?jsxRuntime.jsx("p",{className:"ndpr-text-muted",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:"ndpr-panel",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Risk"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Likelihood"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Impact"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Risk Level"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Mitigated"})]})}),jsxRuntime.jsx("tbody",{className:"ndpr-table",children:a.risks.map(r=>jsxRuntime.jsxs("tr",{className:d("","riskRow"),children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:r.description}),jsxRuntime.jsxs("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:[r.likelihood," / 5"]}),jsxRuntime.jsxs("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:[r.impact," / 5"]}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:R(r.level)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:r.mitigated?jsxRuntime.jsx("span",{className:"ndpr-text-success",children:"Yes"}):jsxRuntime.jsx("span",{className:"ndpr-text-destructive",children:"No"})})]},r.id))})]})})]}),g&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"ndpr-section-heading",children:"Full Assessment Details"}),m.map(r=>{let s=r.questions.filter(i=>a.answers[i.id]!==void 0);return s.length===0?null:jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium ndpr-text-foreground mb-2",children:r.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:"ndpr-panel",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Question"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Answer"})]})}),jsxRuntime.jsx("tbody",{className:"ndpr-table",children:s.map(i=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:i.text}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-normal text-sm ndpr-text-muted",children:w(i.id)})]},i.id))})]})})]},r.id)})]}),jsxRuntime.jsxs("div",{className:"mt-8 pt-4 border-t border-gray-200 dark:border-gray-700 text-sm ndpr-text-muted",children:[jsxRuntime.jsx("p",{children:"This DPIA was conducted in accordance with NDPA 2023 Section 28."}),jsxRuntime.jsxs("p",{children:["DPIA Report Version: ",a.version]}),jsxRuntime.jsxs("p",{children:["Generated on: ",o]}),jsxRuntime.jsx("p",{className:"mt-2 italic",role:"note",children:chunkZVOIR4QH_js.a})]})]})};var H=({steps:a,onStepClick:m,clickable:g=true,orientation:u="horizontal",className:v="",activeStepClassName:f="",completedStepClassName:N="",incompleteStepClassName:x="",classNames:b={},unstyled:y=false})=>{let o=(n,p)=>chunkAME4HJR4_js.a(n,p?b[p]:void 0,y),d=n=>{g&&m&&m(n);},l=u==="vertical";return jsxRuntime.jsx("div",{"data-ndpr-component":"dpia-step-indicator",role:"navigation","aria-label":"Step progress",className:`${o(l?"flex flex-col space-y-4":"flex items-center justify-between","root")} ${v}`,children:a.map((n,p)=>{let w=p===a.length-1,k=n.active?o(`font-medium ${f||"ndpr-text-primary"}`,"label"):n.completed?o(N||"ndpr-text-success","label"):o(x||"ndpr-card__subtitle","label"),C=n.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)] ndpr-text-primary border-2 border-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]","stepActive"):n.completed?o("flex items-center justify-center w-8 h-8 rounded-full bg-green-100 dark:bg-green-900 ndpr-text-success 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 ndpr-text-muted 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"} ${g?"cursor-pointer":""}`,"step"),onClick:()=>d(n.id),"aria-current":n.active?"step":void 0,children:[jsxRuntime.jsx("div",{className:`
|
|
1
|
+
'use strict';var chunkZVOIR4QH_js=require('./chunk-ZVOIR4QH.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.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:a,sections:p,showFullReport:u=true,allowPrint:v=true,allowExport:f=true,onExport:b,className:y="",buttonClassName:x="",classNames:h={},unstyled:w=false})=>{let o=S.useMemo(()=>new Date().toLocaleDateString(),[]),i=(r,s)=>{let d=s?h[s]:void 0;return !d&&s==="printButton"&&(d=h.primaryButton),chunkAME4HJR4_js.a(r,d,w)},l=r=>new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),k=r=>{let s=a.answers[r];return s==null?"Not answered":typeof s=="boolean"?s?"Yes":"No":Array.isArray(s)?s.join(", "):String(s)},_=()=>{window.print();},C=r=>{b&&b(r);},m=r=>jsxRuntime.jsx("span",{className:i(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[r]}`,"riskBadge"),children:r.charAt(0).toUpperCase()+r.slice(1)});return jsxRuntime.jsxs("div",{"data-ndpr-component":"dpia-report",className:`${i("bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 print:shadow-none print:p-0","root")} ${y}`,children:[jsxRuntime.jsxs("div",{className:i("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:i("ndpr-card__title","title"),children:"Data Protection Impact Assessment Report"}),jsxRuntime.jsx("h2",{className:"text-xl ndpr-text-muted mb-4",children:a.title})]}),(v||f)&&jsxRuntime.jsxs("div",{className:"flex space-x-2 print:hidden",children:[v&&jsxRuntime.jsx("button",{onClick:_,className:`${i("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")} ${x}`,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"]})}),f&&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))] ${x}`,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:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Assessor:"})," ",a.assessor.name,", ",a.assessor.role]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Contact:"})," ",a.assessor.email]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Started:"})," ",l(a.startedAt)]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Completed:"})," ",a.completedAt?l(a.completedAt):"In progress"]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Next review:"})," ",a.reviewDate?l(a.reviewDate):"Not scheduled"]})]})]})]}),jsxRuntime.jsxs("div",{className:i("mb-8","summary"),children:[jsxRuntime.jsx("h2",{className:"ndpr-section-heading",children:"Executive Summary"}),jsxRuntime.jsxs("div",{className:"ndpr-panel",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:"}),m(a.overallRiskLevel)]}),jsxRuntime.jsxs("div",{className:i("mb-2","conclusion"),children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Conclusion:"})," ",a.conclusion]}),jsxRuntime.jsxs("div",{role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Can Proceed:"})," ",a.canProceed?"Yes":"No"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium ndpr-text-foreground mb-2",children:"Processing Activity Description"}),jsxRuntime.jsx("p",{className:"ndpr-text-muted mb-4",children:a.processingDescription}),a.recommendations&&a.recommendations.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium ndpr-text-foreground mb-2",children:"Key Recommendations"}),jsxRuntime.jsx("ul",{className:"list-disc pl-5 ndpr-text-muted",children:a.recommendations.map((r,s)=>jsxRuntime.jsx("li",{className:i("","recommendation"),children:r},s))})]})]})]}),jsxRuntime.jsxs("div",{className:"mb-8",children:[jsxRuntime.jsx("h2",{className:"ndpr-section-heading",children:"Identified Risks"}),a.risks.length===0?jsxRuntime.jsx("p",{className:"ndpr-text-muted",children:"No risks identified."}):jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:i("min-w-full divide-y divide-gray-200 dark:divide-gray-700","riskTable"),children:[jsxRuntime.jsx("thead",{className:"ndpr-panel",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Risk"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Likelihood"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Impact"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Risk Level"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Mitigated"})]})}),jsxRuntime.jsx("tbody",{className:"ndpr-table",children:a.risks.map(r=>jsxRuntime.jsxs("tr",{className:i("","riskRow"),children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:r.description}),jsxRuntime.jsxs("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:[r.likelihood," / 5"]}),jsxRuntime.jsxs("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:[r.impact," / 5"]}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:m(r.level)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:r.mitigated?jsxRuntime.jsx("span",{className:"ndpr-text-success",children:"Yes"}):jsxRuntime.jsx("span",{className:"ndpr-text-destructive",children:"No"})})]},r.id))})]})})]}),u&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"ndpr-section-heading",children:"Full Assessment Details"}),p.map(r=>{let s=r.questions.filter(d=>a.answers[d.id]!==void 0);return s.length===0?null:jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium ndpr-text-foreground mb-2",children:r.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:"ndpr-panel",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Question"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Answer"})]})}),jsxRuntime.jsx("tbody",{className:"ndpr-table",children:s.map(d=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:d.text}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-normal text-sm ndpr-text-muted",children:k(d.id)})]},d.id))})]})})]},r.id)})]}),jsxRuntime.jsxs("div",{className:"mt-8 pt-4 border-t border-gray-200 dark:border-gray-700 text-sm ndpr-text-muted",children:[jsxRuntime.jsx("p",{children:"This DPIA was conducted in accordance with NDPA 2023 Section 28."}),jsxRuntime.jsxs("p",{children:["DPIA Report Version: ",a.version]}),jsxRuntime.jsxs("p",{children:["Generated on: ",o]}),jsxRuntime.jsx("p",{className:"mt-2 italic",role:"note",children:chunkZVOIR4QH_js.a})]})]})};var G=({steps:a,onStepClick:p,clickable:u=true,orientation:v="horizontal",className:f="",activeStepClassName:b="",completedStepClassName:y="",incompleteStepClassName:x="",classNames:h={},unstyled:w=false})=>{let o=(n,g)=>chunkAME4HJR4_js.a(n,g?h[g]:void 0,w),i=n=>{u&&p&&p(n);},l=v==="vertical";return jsxRuntime.jsx("div",{"data-ndpr-component":"dpia-step-indicator",role:"navigation","aria-label":"Step progress",className:`${o(l?"flex flex-col space-y-4":"flex items-center justify-between","root")} ${f}`,children:a.map((n,g)=>{let k=g===a.length-1,_=n.active?o(`font-medium ${b||"ndpr-text-primary"}`,"label"):n.completed?o(y||"ndpr-text-success","label"):o(x||"ndpr-card__subtitle","label"),C=n.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)] ndpr-text-primary border-2 border-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]","stepActive"):n.completed?o("flex items-center justify-center w-8 h-8 rounded-full bg-green-100 dark:bg-green-900 ndpr-text-success 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 ndpr-text-muted border-2 border-gray-300 dark:border-gray-600","stepPending"),m=u&&!!p;return jsxRuntime.jsxs(S__default.default.Fragment,{children:[jsxRuntime.jsxs("div",{className:o(`${l?"flex items-start":"flex flex-col items-center"} ${u?"cursor-pointer":""}`,"step"),role:m?"button":void 0,tabIndex:m?0:void 0,"aria-label":m?`Go to step ${g+1}: ${n.label}`:void 0,onClick:m?()=>i(n.id):void 0,onKeyDown:m?r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),i(n.id));}:void 0,"aria-current":n.active?"step":void 0,children:[jsxRuntime.jsx("div",{className:`
|
|
2
2
|
flex items-center justify-center
|
|
3
3
|
${l?"mr-4":""}
|
|
4
|
-
`,children:jsxRuntime.jsx("div",{className:C,children:n.icon?n.icon:n.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:
|
|
4
|
+
`,children:jsxRuntime.jsx("div",{className:C,children:n.icon?n.icon:n.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
5
|
${l?"flex-1":"mt-2 text-center"}
|
|
6
|
-
`,children:[jsxRuntime.jsx("div",{className:`text-sm font-medium ${
|
|
6
|
+
`,children:[jsxRuntime.jsx("div",{className:`text-sm font-medium ${_}`,children:n.label}),n.description&&jsxRuntime.jsx("div",{className:"ndpr-form-field__hint",children:n.description})]})]}),!k&&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")})]},n.id)})})};exports.a=j;exports.b=G;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {d,c,a as a$1,b as b$1}from'./chunk-LWIKDDSU.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {b,a}from'./chunk-ZJYULEER.mjs';import {useState,useMemo,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var G={name:"",description:"",lawfulBasis:"consent",lawfulBasisJustification:"",dataCategories:"",involvesSensitiveData:false,sensitiveDataCondition:"",dataSubjectCategories:"",purposes:"",retentionPeriod:"",retentionJustification:"",recipients:"",crossBorderTransfer:false,reviewDate:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""},Q=[{value:"consent",label:"Consent"},{value:"contract",label:"Contract"},{value:"legal_obligation",label:"Legal Obligation"},{value:"vital_interests",label:"Vital Interests"},{value:"public_interest",label:"Public Interest"},{value:"legitimate_interests",label:"Legitimate Interests"}],X=[{value:"explicit_consent",label:"Explicit Consent"},{value:"employment_law",label:"Employment Law"},{value:"vital_interests_incapable",label:"Vital Interests (Incapable)"},{value:"nonprofit_legitimate",label:"Nonprofit Legitimate Activities"},{value:"publicly_available",label:"Publicly Available Data"},{value:"legal_claims",label:"Legal Claims"},{value:"substantial_public_interest",label:"Substantial Public Interest"},{value:"health_purposes",label:"Health Purposes"},{value:"public_health",label:"Public Health"},{value:"archiving_research",label:"Archiving / Research"}],he={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--neutral",under_review:"ndpr-badge ndpr-badge--warning",archived:"ndpr-badge ndpr-badge--destructive"},_e={active:"Active",inactive:"Inactive",under_review:"Under Review",archived:"Archived"},xe={consent:"ndpr-badge ndpr-badge--info",contract:"ndpr-badge ndpr-badge--info",legal_obligation:"ndpr-badge ndpr-badge--info",vital_interests:"ndpr-badge ndpr-badge--destructive",public_interest:"ndpr-badge ndpr-badge--warning",legitimate_interests:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},we={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"},De=({activities:g,onAddActivity:T,onUpdateActivity:F,onArchiveActivity:I,title:Z="Lawful Basis Tracker",description:ee="Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25.",className:te="",buttonClassName:m="",showSummary:ie=true,showComplianceGaps:re=true,classNames:i,unstyled:d$1})=>{let[x,f]=useState("list"),[a$3,w]=useState(G),[b$2,j]=useState(null),[E,ae]=useState(null),[S,ne]=useState("all"),[B,de]=useState("all"),[D,oe]=useState(""),[c$1,C]=useState([]),q=useMemo(()=>{let e=[...g];if(S!=="all"&&(e=e.filter(l=>l.status===S)),B!=="all"&&(e=e.filter(l=>l.lawfulBasis===B)),D){let l=D.toLowerCase();e=e.filter(p=>p.name.toLowerCase().includes(l)||p.description.toLowerCase().includes(l)||p.purposes.some(N=>N.toLowerCase().includes(l)));}return e.sort((l,p)=>p.updatedAt-l.updatedAt),e},[g,S,B,D]),y=useCallback(e=>new Date(e).toLocaleDateString(),[]),P=useMemo(()=>d(g),[g]),h=useMemo(()=>c(g),[g]),A=useCallback(e=>e.split(",").map(l=>l.trim()).filter(l=>l.length>0),[]),le=useCallback(()=>{w(G),j(null),C([]),f("form");},[]),V=useCallback(e=>{w({name:e.name,description:e.description,lawfulBasis:e.lawfulBasis,lawfulBasisJustification:e.lawfulBasisJustification,dataCategories:e.dataCategories.join(", "),involvesSensitiveData:e.involvesSensitiveData,sensitiveDataCondition:e.sensitiveDataCondition||"",dataSubjectCategories:e.dataSubjectCategories.join(", "),purposes:e.purposes.join(", "),retentionPeriod:e.retentionPeriod,retentionJustification:e.retentionJustification||"",recipients:(e.recipients||[]).join(", "),crossBorderTransfer:e.crossBorderTransfer,reviewDate:e.reviewDate?new Date(e.reviewDate).toISOString().split("T")[0]:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""}),j(e.id),C([]),f("form");},[]),se=useCallback(()=>{let e={name:a$3.name,description:a$3.description,lawfulBasis:a$3.lawfulBasis,lawfulBasisJustification:a$3.lawfulBasisJustification,dataCategories:A(a$3.dataCategories),involvesSensitiveData:a$3.involvesSensitiveData,sensitiveDataCondition:a$3.sensitiveDataCondition||void 0,dataSubjectCategories:A(a$3.dataSubjectCategories),purposes:A(a$3.purposes),retentionPeriod:a$3.retentionPeriod,retentionJustification:a$3.retentionJustification||void 0,recipients:a$3.recipients?A(a$3.recipients):void 0,crossBorderTransfer:a$3.crossBorderTransfer,reviewDate:a$3.reviewDate?new Date(a$3.reviewDate).getTime():void 0,status:"active"},l=b(a({},e),{id:b$2||"temp",createdAt:Date.now(),updatedAt:Date.now()}),p=a$1(l);if(!p.isValid){C(p.errors);return}b$2&&F?F(b$2,e):T&&T(e),w(G),j(null),C([]),f("list");},[a$3,b$2,F,T,A]),M=useCallback(e=>{I&&I(e);},[I]),pe=useCallback(e=>{ae(e),f("detail");},[]),n=useMemo(()=>E?g.find(e=>e.id===E):null,[g,E]),U=useCallback(e=>jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${he[e]}`,i==null?void 0:i.statusBadge,d$1),children:_e[e]}),[i==null?void 0:i.statusBadge,d$1]),H=useCallback(e=>jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${xe[e]}`,children:we[e]}),[]),Y=useCallback(e=>e.dpoApproval?e.dpoApproval.approved?jsx("span",{className:"ndpr-badge ndpr-badge--success",children:"Approved"}):jsx("span",{className:"ndpr-badge ndpr-badge--warning",children:"Pending Approval"}):jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400",children:"No DPO Review"}),[]),ue=()=>jsxs("div",{"data-ndpr-component":"lawful-basis-tracker",className:a$2("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.summary,d$1),role:"status","aria-label":"Compliance summary",children:[jsxs("div",{className:a$2("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,d$1),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:P.totalActivities}),jsx("p",{className:"text-sm ndpr-text-info",children:"Total Activities"})]}),jsxs("div",{className:a$2("bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg",i==null?void 0:i.summaryCard,d$1),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:P.sensitiveDataActivities}),jsx("p",{className:"text-sm ndpr-text-warning",children:"Sensitive Data"})]}),jsxs("div",{className:a$2("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,d$1),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:P.crossBorderActivities}),jsx("p",{className:"text-sm ndpr-text-info",children:"Cross-Border Transfers"})]}),jsxs("div",{className:a$2("ndpr-alert ndpr-alert--destructive",i==null?void 0:i.summaryCard,d$1),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:P.activitiesWithoutApproval.length}),jsx("p",{className:"text-sm ndpr-text-destructive",children:"Pending Approval"})]})]}),J=useMemo(()=>h.filter(e=>e.severity==="high"),[h]),R=useMemo(()=>h.filter(e=>e.severity==="medium"),[h]),ce=()=>h.length===0?jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg mb-6",role:"status","aria-label":"No compliance gaps",children:[jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"No compliance gaps detected."}),jsx("p",{className:"text-xs ndpr-text-success mt-1",children:"All processing activities appear to be properly documented."})]}):jsxs("div",{className:"mb-6",role:"status","aria-label":`${h.length} compliance gaps detected`,children:[J.length>0&&jsxs("div",{className:a$2("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-3",i==null?void 0:i.gapAlert,d$1),children:[jsxs("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:["High Priority (",J.length,")"]}),jsx("ul",{className:"space-y-1",children:J.map((e,l)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:e.description},l))})]}),R.length>0&&jsxs("div",{className:a$2("ndpr-alert ndpr-alert--warning",i==null?void 0:i.gapAlert,d$1),children:[jsxs("p",{className:"text-sm ndpr-text-warning font-medium mb-2",children:["Medium Priority (",R.length,")"]}),jsx("ul",{className:"space-y-1",children:R.map((e,l)=>jsx("li",{className:"text-xs ndpr-text-warning",children:e.description},l))})]})]}),W=useCallback(()=>{f("list"),C([]);},[]),ge=useCallback(()=>{f("list");},[]),s=useCallback((e,l)=>{w(p=>b(a({},p),{[e]:l}));},[]),ve=useCallback(e=>{w(l=>b(a({},l),{involvesSensitiveData:e,sensitiveDataCondition:e?l.sensitiveDataCondition:""}));},[]),me=()=>jsxs("div",{className:a$2("",i==null?void 0:i.form,d$1),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",i==null?void 0:i.header,d$1),children:[jsx("h3",{className:"ndpr-section-heading",children:b$2?"Edit Processing Activity":"New Processing Activity"}),jsx("button",{onClick:W,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"})]}),c$1.length>0&&jsxs("div",{id:"form-errors",className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-4",role:"alert",children:[jsx("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:"Please correct the following errors:"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:c$1.map((e,l)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:e},l))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("label",{htmlFor:"activityName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"activityName",value:a$3.name,onChange:e=>s("name",e.target.value),placeholder:"e.g., Customer Account Management","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"activityDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"activityDescription",value:a$3.description,onChange:e=>s("description",e.target.value),placeholder:"Describe what processing is performed...",rows:3,"aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis (NDPA Section 25) *"}),jsx("select",{id:"lawfulBasis",value:a$3.lawfulBasis,onChange:e=>s("lawfulBasis",e.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,d$1),children:Q.map(e=>jsx("option",{value:e.value,children:e.label},e.value))}),jsx("p",{className:"mt-1 text-xs ndpr-text-muted",children:b$1(a$3.lawfulBasis)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:"Lawful Basis Justification *"}),jsx("textarea",{id:"justification",value:a$3.lawfulBasisJustification,onChange:e=>s("lawfulBasisJustification",e.target.value),placeholder:"Document why this lawful basis applies to this processing activity...",rows:3,"aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),a$3.lawfulBasis==="legitimate_interests"&&jsxs("div",{className:"border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 bg-indigo-50 dark:bg-indigo-900/20",children:[jsx("h4",{className:"text-sm font-semibold text-indigo-800 dark:text-indigo-200 mb-3",children:"Legitimate Interest Assessment (LIA)"}),jsx("p",{className:"text-xs text-indigo-600 dark:text-indigo-300 mb-4",children:"NDPA Section 25(1)(f) requires a balancing test when relying on legitimate interests."}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("label",{htmlFor:"liaPurpose",className:"ndpr-form-field__label",children:"Purpose Test"}),jsx("textarea",{id:"liaPurpose",value:a$3.liaPurposeTest,onChange:e=>s("liaPurposeTest",e.target.value),placeholder:"Describe the legitimate interest being pursued...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaNecessity",className:"ndpr-form-field__label",children:"Necessity Test"}),jsx("textarea",{id:"liaNecessity",value:a$3.liaNecessityTest,onChange:e=>s("liaNecessityTest",e.target.value),placeholder:"Explain why this processing is necessary for the stated purpose...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaBalancing",className:"ndpr-form-field__label",children:"Balancing Test"}),jsx("textarea",{id:"liaBalancing",value:a$3.liaBalancingTest,onChange:e=>s("liaBalancingTest",e.target.value),placeholder:"Assess the impact on data subjects' rights and interests...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaSafeguards",className:"ndpr-form-field__label",children:"Safeguards"}),jsx("input",{type:"text",id:"liaSafeguards",value:a$3.liaSafeguards,onChange:e=>s("liaSafeguards",e.target.value),placeholder:"List safeguards (comma-separated)...",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"liaConclusion",className:"ndpr-form-field__label",children:"Conclusion"}),jsx("textarea",{id:"liaConclusion",value:a$3.liaConclusion,onChange:e=>s("liaConclusion",e.target.value),placeholder:"State your overall conclusion...",rows:2,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories *"}),jsx("input",{type:"text",id:"dataCategories",value:a$3.dataCategories,onChange:e=>s("dataCategories",e.target.value),placeholder:"e.g., Name, Email, Phone Number (comma-separated)","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.involvesSensitiveData,onChange:e=>ve(e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Sensitive Personal Data (NDPA Section 27)"})]})}),a$3.involvesSensitiveData&&jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveCondition",className:"ndpr-form-field__label",children:"Sensitive Data Condition (NDPA Section 27) *"}),jsxs("select",{id:"sensitiveCondition",value:a$3.sensitiveDataCondition,onChange:e=>s("sensitiveDataCondition",e.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,d$1),children:[jsx("option",{value:"",children:"Select a condition..."}),X.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSubjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories *"}),jsx("input",{type:"text",id:"dataSubjectCategories",value:a$3.dataSubjectCategories,onChange:e=>s("dataSubjectCategories",e.target.value),placeholder:"e.g., Customers, Employees, Vendors (comma-separated)","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Processing Purposes *"}),jsx("input",{type:"text",id:"purposes",value:a$3.purposes,onChange:e=>s("purposes",e.target.value),placeholder:"e.g., Account management, Service delivery (comma-separated)","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:a$3.retentionPeriod,onChange:e=>s("retentionPeriod",e.target.value),placeholder:"e.g., 3 years after account closure","aria-required":"true","aria-describedby":c$1.length>0?"form-errors":void 0,className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:a$3.retentionJustification,onChange:e=>s("retentionJustification",e.target.value),placeholder:"Reason for the retention period",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients"}),jsx("input",{type:"text",id:"recipients",value:a$3.recipients,onChange:e=>s("recipients",e.target.value),placeholder:"e.g., Payment processor, Cloud provider (comma-separated)",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsx("div",{children:jsxs("label",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",checked:a$3.crossBorderTransfer,onChange:e=>s("crossBorderTransfer",e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Cross-Border Transfer Outside Nigeria"})]})}),jsxs("div",{children:[jsx("label",{htmlFor:"reviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"reviewDate",value:a$3.reviewDate,onChange:e=>s("reviewDate",e.target.value),className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[jsx("button",{onClick:W,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"}),jsx("button",{onClick:se,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),d$1),children:b$2?"Update Activity":"Create Activity"})]})]})]}),fe=()=>{var l;if(!n)return jsx("div",{className:"ndpr-empty-state",children:jsx("p",{className:"ndpr-card__subtitle",children:"Activity not found."})});let e=a$1(n);return jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxs("div",{children:[jsx("button",{onClick:ge,className:"text-sm ndpr-text-primary hover:underline mb-2","aria-label":"Back to activities list",children:"Back to list"}),jsx("h3",{className:"ndpr-section-heading",children:n.name})]}),jsxs("div",{className:"ndpr-card__footer",children:[H(n.lawfulBasis),U(n.status),Y(n)]})]}),e.warnings.length>0&&jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md mb-4",children:[jsx("p",{className:"text-sm ndpr-text-warning font-medium mb-1",children:"Warnings"}),jsx("ul",{className:"list-disc list-inside space-y-1",children:e.warnings.map((p,N)=>jsx("li",{className:"text-xs ndpr-text-warning",children:p},N))})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Description:"})," ",n.description]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Lawful Basis:"})," ",b$1(n.lawfulBasis)]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Justification:"})," ",n.lawfulBasisJustification]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Categories:"})," ",n.dataCategories.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Data Subject Categories:"})," ",n.dataSubjectCategories.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Purposes:"})," ",n.purposes.join(", ")]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Retention Period:"})," ",n.retentionPeriod,n.retentionJustification&&jsxs("span",{className:"ndpr-card__subtitle",children:[" ","(",n.retentionJustification,")"]})]})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",n.involvesSensitiveData?"Yes":"No",n.sensitiveDataCondition&&jsxs("span",{children:[" ","(Condition:"," ",((l=X.find(p=>p.value===n.sensitiveDataCondition))==null?void 0:l.label)||n.sensitiveDataCondition,")"]})]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Cross-Border Transfer:"})," ",n.crossBorderTransfer?"Yes":"No"]}),n.recipients&&n.recipients.length>0&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Recipients:"})," ",n.recipients.join(", ")]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Created:"})," ",y(n.createdAt)]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Last Updated:"})," ",y(n.updatedAt)]}),n.reviewDate&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Next Review:"})," ",y(n.reviewDate),n.reviewDate<Date.now()&&jsx("span",{className:"ndpr-text-destructive font-medium",children:" (Overdue)"})]})]})]}),n.dpoApproval&&jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-6",children:[jsx("h4",{className:"ndpr-section-heading",children:"DPO Approval"}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",n.dpoApproval.approved?"Approved":"Not Approved"]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Approved By:"})," ",n.dpoApproval.approvedBy]}),jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Date:"})," ",y(n.dpoApproval.approvedAt)]}),n.dpoApproval.notes&&jsxs("p",{className:"ndpr-form-field__hint",children:[jsx("span",{className:"font-medium",children:"Notes:"})," ",n.dpoApproval.notes]})]}),jsxs("div",{className:"flex space-x-3",children:[jsx("button",{onClick:()=>V(n),"aria-label":`Edit ${n.name}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,children:"Edit"}),n.status!=="archived"&&jsx("button",{onClick:()=>M(n.id),"aria-label":`Archive ${n.name}`,className:`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 ${m}`,children:"Archive"})]})]})},be=()=>jsxs("div",{children:[jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"basisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"basisFilter",value:B,onChange:e=>de(e.target.value),"aria-label":"Filter by lawful basis",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,d$1),children:[jsx("option",{value:"all",children:"All Bases"}),Q.map(e=>jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"statusFilterSelect",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"statusFilterSelect",value:S,onChange:e=>ne(e.target.value),"aria-label":"Filter by status",className:a$2("ndpr-form-field__input",i==null?void 0:i.select,d$1),children:[jsx("option",{value:"all",children:"All Statuses"}),jsx("option",{value:"active",children:"Active"}),jsx("option",{value:"inactive",children:"Inactive"}),jsx("option",{value:"under_review",children:"Under Review"}),jsx("option",{value:"archived",children:"Archived"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchInput",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"searchInput",value:D,onChange:e=>oe(e.target.value),placeholder:"Search activities...",className:a$2("ndpr-form-field__input",i==null?void 0:i.input,d$1)})]}),jsx("div",{className:"flex items-end",children:jsx("button",{onClick:le,className:a$2(`w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),d$1),children:"Add Activity"})})]}),q.length===0?jsx("div",{className:"flex items-center justify-center h-32 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsx("p",{className:"ndpr-card__subtitle",children:"No processing activities found."})}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",i==null?void 0:i.table,d$1),children:[jsx("thead",{className:a$2("ndpr-table__head",i==null?void 0:i.tableHeader,d$1),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Activity"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"DPO Approval"}),jsx("th",{className:"ndpr-table__cell",children:"Sensitive Data"}),jsx("th",{className:"ndpr-table__cell",children:"Last Updated"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:q.map(e=>jsxs("tr",{className:a$2("border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",i==null?void 0:i.tableRow,d$1),children:[jsxs("td",{className:"ndpr-table__cell",children:[jsx("button",{onClick:()=>pe(e.id),className:"font-medium ndpr-text-primary hover:underline text-left",children:e.name}),jsx("p",{className:"text-xs ndpr-text-muted mt-1 truncate max-w-xs",children:e.description})]}),jsx("td",{className:"ndpr-table__cell",children:H(e.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:U(e.status)}),jsx("td",{className:"ndpr-table__cell",children:Y(e)}),jsx("td",{className:"ndpr-table__cell",children:jsx("span",{className:`text-xs ${e.involvesSensitiveData?"ndpr-text-warning font-medium":"ndpr-card__subtitle"}`,children:e.involvesSensitiveData?"Yes":"No"})}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:y(e.updatedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>V(e),"aria-label":`Edit ${e.name}`,className:"text-xs ndpr-text-primary hover:underline",children:"Edit"}),e.status!=="archived"&&jsx("button",{onClick:()=>M(e.id),"aria-label":`Archive ${e.name}`,className:"text-xs ndpr-text-muted hover:underline",children:"Archive"})]})})]},e.id))})]})})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${te}`,i==null?void 0:i.root,d$1),children:[jsx("h2",{className:a$2("ndpr-section-heading",i==null?void 0:i.title,d$1),children:Z}),jsx("p",{className:"ndpr-card__subtitle",children:ee}),ie&&x==="list"&&ue(),re&&x==="list"&&ce(),x==="list"&&be(),x==="form"&&me(),x==="detail"&&fe()]})};export{De as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-SFGW37LE.mjs';import {jsxs,jsx}from'react/jsx-runtime';var R=({sections:v,answers:y,onAnswerChange:u,currentSectionIndex:o,onNextSection:$,onPrevSection:B,validationErrors:P={},readOnly:s=false,className:A="",buttonClassName:_="",nextButtonText:C="Next",prevButtonText:w="Previous",submitButtonText:I="Submit",showProgress:D=true,progress:c,classNames:f={},unstyled:Q=false})=>{let m=v[o],S=o===v.length-1,t=(e,r)=>{let d=r?f[r]:void 0;return !d&&r==="nextButton"&&(d=f.primaryButton),!d&&r==="prevButton"&&(d=f.secondaryButton),a(e,d,Q)},L=e=>e.showWhen?e.showWhen.every(r=>{let d=y[r.questionId];switch(r.operator){case "equals":return d===r.value;case "contains":return Array.isArray(d)?d.includes(String(r.value)):false;case "greaterThan":return typeof d=="number"&&typeof r.value=="number"?d>r.value:false;case "lessThan":return typeof d=="number"&&typeof r.value=="number"?d<r.value:false;default:return true}}):true,b=e=>t("ndpr-form-field__input","input"),T=e=>{if(!L(e))return null;let r=P[e.id],d=y[e.id],l=typeof d=="boolean"?String(d):d,h=e.guidance?`${e.id}-guidance`:void 0,N=r?`${e.id}-error`:void 0,p=[h,N].filter(Boolean).join(" ")||void 0;return jsxs("div",{className:t("ndpr-form-field","question"),children:[jsxs("label",{htmlFor:e.id,className:t("ndpr-form-field__label","questionText"),children:[e.text,e.required&&jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),e.guidance&&jsx("p",{id:h,className:t("ndpr-form-field__hint","guidance"),children:e.guidance}),e.type==="text"&&jsx("input",{type:"text",id:e.id,value:l||"",onChange:a=>u(e.id,a.target.value),disabled:s,className:b(),"aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0}),e.type==="textarea"&&jsx("textarea",{id:e.id,value:l||"",onChange:a=>u(e.id,a.target.value),disabled:s,rows:4,className:b(),"aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0}),e.type==="select"&&e.options&&jsxs("select",{id:e.id,value:l||"",onChange:a=>u(e.id,a.target.value),disabled:s,className:b(),"aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0,children:[jsx("option",{value:"",children:"Select an option"}),e.options.map(a=>jsx("option",{value:a.value,children:a.label},a.value))]}),e.type==="radio"&&e.options&&jsx("div",{className:t("ndpr-form-field__option-group","radioGroup"),role:"radiogroup","aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0,children:e.options.map(a=>jsxs("div",{className:t("ndpr-form-field__checkbox-row","radioOption"),children:[jsx("input",{type:"radio",id:`${e.id}_${a.value}`,name:e.id,value:a.value,checked:l===a.value,onChange:()=>u(e.id,a.value),disabled:s,className:"ndpr-form-field__radio"}),jsxs("label",{htmlFor:`${e.id}_${a.value}`,className:"ndpr-form-field__label",children:[a.label,a.riskLevel&&jsxs("span",{className:a.riskLevel==="low"?"ndpr-badge ndpr-badge--success":a.riskLevel==="medium"?"ndpr-badge ndpr-badge--warning":"ndpr-badge ndpr-badge--destructive",children:[a.riskLevel.charAt(0).toUpperCase()+a.riskLevel.slice(1)," Risk"]})]})]},a.value))}),e.type==="checkbox"&&e.options&&jsx("div",{className:"ndpr-form-field__option-group",role:"group","aria-label":e.text,"aria-describedby":p,"aria-invalid":r?true:void 0,children:e.options.map(a=>jsxs("div",{className:"ndpr-form-field__checkbox-row",children:[jsx("input",{type:"checkbox",id:`${e.id}_${a.value}`,value:a.value,checked:Array.isArray(l)?l.includes(a.value):false,onChange:g=>{let x=Array.isArray(l)?[...l]:[];g.target.checked?u(e.id,[...x,a.value]):u(e.id,x.filter(V=>V!==a.value));},disabled:s,className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:`${e.id}_${a.value}`,className:"ndpr-form-field__label",children:a.label})]},a.value))}),e.type==="scale"&&jsxs("div",{className:"ndpr-form-field",children:[jsx("div",{className:"ndpr-form-field__hint",style:{display:"flex",justifyContent:"space-between"},children:e.scaleLabels&&Object.entries(e.scaleLabels).map(([a,g])=>jsx("span",{style:{width:`${100/Object.keys(e.scaleLabels||{}).length}%`,textAlign:"center"},children:g},a))}),jsx("input",{type:"range",id:e.id,min:e.minValue||1,max:e.maxValue||5,value:typeof l=="number"?l:e.minValue||1,onChange:a=>u(e.id,parseInt(a.target.value,10)),disabled:s,className:"ndpr-form-field__range","aria-required":e.required||void 0,"aria-describedby":p,"aria-invalid":r?true:void 0}),jsxs("div",{className:"ndpr-form-field__hint",style:{textAlign:"center"},children:["Selected value: ",l||e.minValue||1]})]}),r&&jsx("p",{id:N,className:"ndpr-form-field__error",role:"alert",children:r})]},e.id)};return m?jsxs("div",{"data-ndpr-component":"dpia-questionnaire",className:`${t("ndpr-card","root")} ${A}`,children:[D&&jsxs("div",{className:t("ndpr-card__header","header"),style:{flexDirection:"column",alignItems:"stretch",gap:"var(--ndpr-space-2)"},children:[jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"var(--ndpr-font-size-sm)",color:"rgb(var(--ndpr-muted-foreground))"},children:[jsxs("span",{children:["Section ",o+1," of ",v.length]}),jsx("span",{children:c!==void 0?`${c}% Complete`:""})]}),jsx("div",{className:t("ndpr-progress","progressBar"),role:"progressbar","aria-valuenow":c!==void 0?c:Math.round((o+1)/v.length*100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Questionnaire progress",children:jsx("div",{className:"ndpr-progress__bar",style:{width:`${c!==void 0?c:(o+1)/v.length*100}%`}})})]}),jsx("h2",{className:t("ndpr-card__title","title"),"aria-live":"polite",children:m.title}),m.description&&jsx("p",{className:t("ndpr-card__subtitle","sectionTitle"),children:m.description}),jsx("div",{className:t("ndpr-card__body","section"),children:m.questions.map(e=>T(e))}),jsxs("div",{className:t("ndpr-card__footer","navigation"),style:{justifyContent:"space-between"},children:[jsx("button",{type:"button",onClick:B,disabled:o===0||s,className:`${t("ndpr-button ndpr-button--secondary","prevButton")} ${_}`,children:w}),jsx("button",{type:"button",onClick:$,disabled:s,className:`${t("ndpr-button ndpr-button--primary","nextButton")} ${_}`,children:S?I:C})]})]}):jsx("div",{children:"No section found."})};export{R as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b,d,a as a$1,c}from'./chunk-XP5PL6K7.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {a,b as b$1}from'./chunk-ZJYULEER.mjs';import {useState,useMemo,useEffect,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var q=[{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"}],Me=[{value:"data_subject",label:"Directly from Data Subject"},{value:"third_party",label:"Third Party"},{value:"public_source",label:"Public Source"},{value:"other",label:"Other"}],Oe={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--warning",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},Te={active:"Active",inactive:"Inactive",archived:"Archived"},je={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"};function qe(){let o=Date.now();return {id:`proc_${o}_${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:o,updatedAt:o}}function te(o){return o?new Date(o).toLocaleDateString():"N/A"}var Ge=({ropa:o,onAddRecord:y,onUpdateRecord:D,onArchiveRecord:S,title:re="Record of Processing Activities (ROPA)",description:ie="Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",className:ae="",buttonClassName:B="",classNames:e,unstyled:n})=>{let[f,b$2]=useState("list"),[w,ne]=useState(""),[P,de]=useState("all"),[k,oe]=useState("all"),[l,h]=useState(null),[U,C]=useState([]),[I,$]=useState(""),[F,H]=useState(""),[E,V]=useState(""),[L,G]=useState(""),[M,J]=useState(""),[O,z]=useState(""),[T,W]=useState(""),g=useMemo(()=>b(o),[o]),_=useMemo(()=>d(o),[o]),K=useMemo(()=>{let r=[...o.records];if(P!=="all"&&(r=r.filter(a=>a.status===P)),k!=="all"&&(r=r.filter(a=>a.lawfulBasis===k)),w){let a=w.toLowerCase();r=r.filter(p=>p.name.toLowerCase().includes(a)||p.description.toLowerCase().includes(a)||p.dataCategories.some(m=>m.toLowerCase().includes(a))||p.department&&p.department.toLowerCase().includes(a));}return r},[o.records,P,k,w]);useEffect(()=>{l&&($(l.purposes.join(", ")),H(l.dataCategories.join(", ")),V((l.sensitiveDataCategories||[]).join(", ")),G(l.dataSubjectCategories.join(", ")),J(l.recipients.join(", ")),z(l.securityMeasures.join(", ")),W((l.systemsUsed||[]).join(", ")));},[l==null?void 0:l.id]);let le=useCallback(()=>{let r=qe();r.controllerDetails.name=o.organizationName,r.controllerDetails.contact=o.organizationContact,r.controllerDetails.address=o.organizationAddress,o.ndpcRegistrationNumber&&(r.controllerDetails.registrationNumber=o.ndpcRegistrationNumber),o.dpoDetails&&(r.controllerDetails.dpoContact=o.dpoDetails.email),h(r),C([]),b$2("form");},[o.organizationName,o.organizationContact,o.organizationAddress,o.ndpcRegistrationNumber,o.dpoDetails]),pe=useCallback(r=>{h(a({},r)),C([]),b$2("form");},[]),v=r=>r.split(",").map(a=>a.trim()).filter(a=>a.length>0),ue=useCallback(()=>{if(!l)return;let r=b$1(a({},l),{purposes:v(I),dataCategories:v(F),sensitiveDataCategories:v(E),dataSubjectCategories:v(L),recipients:v(M),securityMeasures:v(O),systemsUsed:v(T),updatedAt:Date.now()});r.sensitiveDataCategories&&r.sensitiveDataCategories.length===0&&(r.sensitiveDataCategories=void 0),r.systemsUsed&&r.systemsUsed.length===0&&(r.systemsUsed=void 0);let a$2=a$1(r);if(!a$2.valid){C(a$2.errors);return}o.records.find(m=>m.id===r.id)?D==null||D(r.id,r):y==null||y(r),h(null),C([]),b$2("list");},[l,I,F,E,L,M,O,T,o.records,D,y]),ce=useCallback(r=>{S==null||S(r);},[S]),se=useCallback(()=>{let r=c(o),a=new Blob([r],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(a),m=document.createElement("a");m.href=p,m.download=`ropa_${o.organizationName.replace(/\s+/g,"_").toLowerCase()}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),setTimeout(()=>URL.revokeObjectURL(p),100);},[o]),Q=useCallback(()=>{h(null),C([]),b$2("list");},[]),c$1=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{[r]:a$1}));},[]),j=useCallback((r,a$1)=>{h(p=>p&&b$1(a({},p),{controllerDetails:b$1(a({},p.controllerDetails),{[r]:a$1})}));},[]),ge=useCallback(r=>!!r.nextReviewDate&&r.nextReviewDate<=Date.now(),[]),me=useCallback(r=>{ne(r.target.value);},[]),ve=useCallback(r=>{de(r.target.value);},[]),fe=useCallback(r=>{oe(r.target.value);},[]),be=useCallback(r=>{$(r.target.value);},[]),he=useCallback(r=>{H(r.target.value);},[]),_e=useCallback(r=>{V(r.target.value);},[]),xe=useCallback(r=>{G(r.target.value);},[]),Ce=useCallback(r=>{J(r.target.value);},[]),Re=useCallback(r=>{z(r.target.value);},[]),ye=useCallback(r=>{W(r.target.value);},[]),De=useCallback(()=>b$2("list"),[]),Se=useCallback(()=>b$2("summary"),[]),we=useCallback(r=>jsx("span",{className:a$2(`px-2 py-1 rounded text-xs font-medium ${Oe[r]}`,e==null?void 0:e.statusBadge,n),children:Te[r]}),[e==null?void 0:e.statusBadge,n]),Pe=useCallback(r=>jsx("span",{className:"ndpr-badge ndpr-badge--info",children:je[r]}),[]),ke=()=>jsxs("div",{className:a$2("mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",e==null?void 0:e.orgInfo,n),children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Organization"}),jsx("p",{className:"ndpr-section-heading",children:o.organizationName})]}),o.dpoDetails&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"Data Protection Officer"}),jsx("p",{className:"ndpr-section-heading",children:o.dpoDetails.name}),jsx("p",{className:"ndpr-form-field__hint",children:o.dpoDetails.email})]}),o.ndpcRegistrationNumber&&jsxs("div",{children:[jsx("p",{className:"text-sm font-medium ndpr-text-muted",children:"NDPC Registration No."}),jsx("p",{className:"ndpr-section-heading",children:o.ndpcRegistrationNumber})]})]}),jsxs("div",{className:"mt-2 text-xs ndpr-text-muted",children:["Version ",o.version," | Last Updated: ",te(o.lastUpdated)]})]}),Ae=()=>jsxs("div",{className:a$2("mb-6",e==null?void 0:e.summary,n),children:[jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[jsxs("div",{className:a$2("p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.totalRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Total Records"})]}),jsxs("div",{className:a$2("p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-success",children:g.activeRecords}),jsx("p",{className:"text-xs ndpr-text-success",children:"Active"})]}),jsxs("div",{className:a$2("p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:g.crossBorderRecords}),jsx("p",{className:"text-xs ndpr-text-info",children:"Cross-Border"})]}),jsxs("div",{className:a$2("p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center",e==null?void 0:e.summaryCard,n),children:[jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:_.length}),jsx("p",{className:"text-xs ndpr-text-warning",children:"Records with Gaps"})]})]}),jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"By Lawful Basis"}),q.map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.label.split(" (")[0]}),jsx("span",{className:"font-medium",children:g.byLawfulBasis[r.value]||0})]},r.value))]}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Sensitive Data"}),jsx("span",{className:"font-medium",children:g.sensitiveDataRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"DPIA Required"}),jsx("span",{className:"font-medium",children:g.dpiaRequiredRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Automated Decisions"}),jsx("span",{className:"font-medium",children:g.automatedDecisionRecords})]}),jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:"Due for Review"}),jsx("span",{className:`font-medium ${g.recordsDueForReview.length>0?"ndpr-text-destructive":""}`,children:g.recordsDueForReview.length})]})]}),g.topDepartments.length>0&&jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),g.topDepartments.slice(0,5).map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.department}),jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]}),_.length>0&&jsxs("div",{className:a$2("p-3 bg-red-50 dark:bg-red-900/20 rounded-md",e==null?void 0:e.complianceGap,n),role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),_.slice(0,5).map(r=>jsxs("div",{className:"mb-2",children:[jsx("p",{className:"text-xs font-medium ndpr-text-destructive",children:r.recordName}),jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]},r.recordId)),_.length>5&&jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",_.length-5," more record(s) with gaps."]})]})]}),Be=()=>jsxs("div",{children:[jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"ropaSearch",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"ropaSearch",value:w,onChange:me,placeholder:"Search records...",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaStatusFilter",className:"ndpr-form-field__label",children:"Status"}),jsxs("select",{id:"ropaStatusFilter",value:P,onChange:ve,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Statuses"}),ee.map(r=>jsx("option",{value:r.value,children:r.label},r.value))]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"ropaBasisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxs("select",{id:"ropaBasisFilter",value:k,onChange:fe,className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:[jsx("option",{value:"all",children:"All Bases"}),q.map(r=>jsx("option",{value:r.value,children:r.label.split(" (")[0]},r.value))]})]}),jsxs("div",{className:"flex items-end space-x-2",children:[jsx("button",{onClick:le,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${B}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:"Add Record"}),jsx("button",{onClick:se,"aria-label":"Export ROPA records as CSV",className:a$2(`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 text-sm ${B}`,(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.exportButton),n),children:"Export CSV"})]})]}),K.length===0?jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a$2("w-full text-sm text-left",e==null?void 0:e.table,n),children:[jsx("thead",{className:a$2("ndpr-table__head",e==null?void 0:e.tableHeader,n),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Name"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Data Categories"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"}),jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsx("tbody",{children:K.map(r=>{let a=ge(r),p=_.some(m=>m.recordId===r.id);return jsxs("tr",{className:a$2(`border-b dark:border-gray-600 ${a?"bg-red-50 dark:bg-red-900/10":p?"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,n),children:[jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{children:[jsx("p",{className:"font-medium",children:r.name}),r.department&&jsx("p",{className:"ndpr-form-field__hint",children:r.department}),a&&jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"ndpr-table__cell",children:Pe(r.lawfulBasis)}),jsx("td",{className:"ndpr-table__cell",children:jsx("p",{className:"text-xs ndpr-text-muted max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsx("td",{className:"ndpr-table__cell",children:we(r.status)}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:te(r.lastReviewedAt)}),jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>pe(r),"aria-label":`Edit record: ${r.name}`,className:"ndpr-text-primary hover:underline text-xs",children:"Edit"}),r.status!=="archived"&&jsx("button",{onClick:()=>ce(r.id),"aria-label":`Archive record: ${r.name}`,className:"ndpr-text-muted hover:underline text-xs",children:"Archive"})]})})]},r.id)})})]})})]}),Ie=useMemo(()=>l?!o.records.find(r=>r.id===l.id):true,[l,o.records]),Fe=()=>{if(!l)return null;let r=Ie;return jsxs("div",{"data-ndpr-component":"ropa-manager",className:a$2("",e==null?void 0:e.form,n),children:[jsxs("div",{className:a$2("flex justify-between items-center mb-4",e==null?void 0:e.header,n),children:[jsx("h3",{className:"ndpr-section-heading",children:r?"Add Processing Record":"Edit Processing Record"}),jsx("button",{onClick:Q,className:"ndpr-button ndpr-button--ghost ndpr-button--sm",children:"Cancel"})]}),U.length>0&&jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-1",children:"Please fix the following errors:"}),jsx("ul",{className:"list-disc list-inside",children:U.map((a,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:a},p))})]}),jsxs("div",{className:"ndpr-form-section",children:[jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Basic Information"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"recordName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsx("input",{type:"text",id:"recordName",value:l.name,onChange:a=>c$1("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customer Account Management"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordDepartment",className:"ndpr-form-field__label",children:"Department"}),jsx("input",{type:"text",id:"recordDepartment",value:l.department||"",onChange:a=>c$1("department",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Marketing"})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"recordDescription",className:"ndpr-form-field__label",children:"Description *"}),jsx("textarea",{id:"recordDescription",value:l.description,onChange:a=>c$1("description",a.target.value),rows:3,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe what personal data processing is performed..."})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recordStatus",className:"ndpr-form-field__label",children:"Status *"}),jsx("select",{id:"recordStatus",value:l.status,onChange:a=>c$1("status",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:ee.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Controller Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"controllerName",className:"ndpr-form-field__label",children:"Controller Name *"}),jsx("input",{type:"text",id:"controllerName",value:l.controllerDetails.name,onChange:a=>j("name",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{children:[jsx("label",{htmlFor:"controllerContact",className:"ndpr-form-field__label",children:"Controller Contact *"}),jsx("input",{type:"text",id:"controllerContact",value:l.controllerDetails.contact,onChange:a=>j("contact",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"controllerAddress",className:"ndpr-form-field__label",children:"Controller Address *"}),jsx("input",{type:"text",id:"controllerAddress",value:l.controllerDetails.address,onChange:a=>j("address",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Lawful Basis (NDPA Section 25)"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis *"}),jsx("select",{id:"lawfulBasis",value:l.lawfulBasis,onChange:a=>c$1("lawfulBasis",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:q.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{children:[jsx("label",{htmlFor:"lawfulBasisJustification",className:"ndpr-form-field__label",children:"Justification *"}),jsx("textarea",{id:"lawfulBasisJustification",value:l.lawfulBasisJustification,onChange:a=>c$1("lawfulBasisJustification",a.target.value),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Explain why this lawful basis applies..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Data Details"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Purposes * (comma-separated)"}),jsx("input",{type:"text",id:"purposes",value:I,onChange:be,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Account management, Service delivery"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories * (comma-separated)"}),jsx("input",{type:"text",id:"dataCategories",value:F,onChange:he,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Name, Email, Phone number"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sensitiveData",className:"ndpr-form-field__label",children:"Sensitive Data Categories (comma-separated)"}),jsx("input",{type:"text",id:"sensitiveData",value:E,onChange:_e,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Health data, Biometric data"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"subjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories * (comma-separated)"}),jsx("input",{type:"text",id:"subjectCategories",value:L,onChange:xe,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Customers, Employees"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients * (comma-separated)"}),jsx("input",{type:"text",id:"recipients",value:M,onChange:Ce,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Payment processors, Cloud service providers"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"dataSource",className:"ndpr-form-field__label",children:"Data Source *"}),jsx("select",{id:"dataSource",value:l.dataSource,onChange:a=>c$1("dataSource",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.select,n),children:Me.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),l.dataSource==="third_party"&&jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"thirdPartyDetails",className:"ndpr-form-field__label",children:"Third-Party Source Details *"}),jsx("input",{type:"text",id:"thirdPartyDetails",value:l.thirdPartySourceDetails||"",onChange:a=>c$1("thirdPartySourceDetails",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the third-party data source..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Retention and Security"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsx("input",{type:"text",id:"retentionPeriod",value:l.retentionPeriod,onChange:a=>c$1("retentionPeriod",a.target.value),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., 5 years after account closure"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsx("input",{type:"text",id:"retentionJustification",value:l.retentionJustification||"",onChange:a=>c$1("retentionJustification",a.target.value||void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Why this retention period is necessary..."})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"securityMeasures",className:"ndpr-form-field__label",children:"Security Measures * (comma-separated)"}),jsx("input",{type:"text",id:"securityMeasures",value:O,onChange:Re,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., Encryption at rest, Access controls, Audit logging"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"systemsUsed",className:"ndpr-form-field__label",children:"Systems Used (comma-separated)"}),jsx("input",{type:"text",id:"systemsUsed",value:T,onChange:ye,className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"e.g., CRM, ERP, Cloud Storage"})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Risk Indicators"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"dpiaRequired",checked:l.dpiaRequired,onChange:a=>c$1("dpiaRequired",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"dpiaRequired",className:"ndpr-text-sm ndpr-font-medium",children:"DPIA Required"})]}),l.dpiaRequired&&jsxs("div",{children:[jsx("label",{htmlFor:"dpiaReference",className:"ndpr-form-field__label",children:"DPIA Reference *"}),jsx("input",{type:"text",id:"dpiaReference",value:l.dpiaReference||"",onChange:a=>c$1("dpiaReference",a.target.value||void 0),"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Reference to the completed DPIA"})]}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:"automatedDecisionMaking",checked:l.automatedDecisionMaking,onChange:a=>c$1("automatedDecisionMaking",a.target.checked),className:"ndpr-form-field__checkbox"}),jsx("label",{htmlFor:"automatedDecisionMaking",className:"ndpr-text-sm ndpr-font-medium",children:"Automated Decision-Making"})]}),l.automatedDecisionMaking&&jsxs("div",{children:[jsx("label",{htmlFor:"automatedDecisionMakingDetails",className:"ndpr-form-field__label",children:"Automated Decision-Making Details *"}),jsx("textarea",{id:"automatedDecisionMakingDetails",value:l.automatedDecisionMakingDetails||"",onChange:a=>c$1("automatedDecisionMakingDetails",a.target.value||void 0),rows:2,"aria-required":"true",className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n),placeholder:"Describe the automated decision-making process..."})]})]})]}),jsxs("fieldset",{className:"ndpr-card ndpr-card--compact ndpr-card--flat",children:[jsx("legend",{className:"ndpr-badge",children:"Review Schedule"}),jsx("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:jsxs("div",{children:[jsx("label",{htmlFor:"nextReviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsx("input",{type:"date",id:"nextReviewDate",value:l.nextReviewDate?new Date(l.nextReviewDate).toISOString().slice(0,10):"",onChange:a=>c$1("nextReviewDate",a.target.value?new Date(a.target.value).getTime():void 0),className:a$2("ndpr-form-field__input",e==null?void 0:e.input,n)})]})})]}),jsxs("div",{className:"flex justify-end space-x-3",children:[jsx("button",{onClick:Q,className:"ndpr-button ndpr-button--secondary ndpr-button--sm",children:"Cancel"}),jsx("button",{onClick:ue,className:a$2(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm ${B}`,(e==null?void 0:e.primaryButton)||(e==null?void 0:e.submitButton),n),children:r?"Add Record":"Save Changes"})]})]})]})},Ee=()=>jsxs("div",{className:"ndpr-section-divider ndpr-text-sm",children:[jsx("button",{onClick:De,className:`pb-2 text-sm font-medium ${f==="list"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Processing Records"}),jsx("button",{onClick:Se,className:`pb-2 text-sm font-medium ${f==="summary"?"border-b-2 border-[rgb(var(--ndpr-primary))] ndpr-text-primary":"ndpr-text-muted hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Compliance Summary"})]});return jsxs("div",{className:a$2(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ae}`,e==null?void 0:e.root,n),children:[jsx("h2",{className:a$2("ndpr-section-heading",e==null?void 0:e.title,n),children:re}),jsx("p",{className:"ndpr-card__subtitle",children:ie}),ke(),f!=="form"&&Ee(),f==="list"&&Be(),f==="summary"&&Ae(),f==="form"&&Fe()]})};export{Ge as a};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-WTGKZX7J.mjs';import {b,a as a$2}from'./chunk-ITCY2Z66.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {useState,useEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var ye=({breachData:l,initialAssessment:f={},onComplete:A,title:J="Breach Risk Assessment",description:K="Assess the risk level of this data breach to determine notification requirements under NDPA Section 40.",submitButtonText:Q="Complete Assessment",className:ae="",buttonClassName:Z="",classNames:b={},unstyled:d=false,showBreachSummary:c=true,showNotificationRequirements:D=true})=>{let[L,ie]=useState(f.confidentialityImpact||3),[B,h]=useState(f.integrityImpact||3),[I,P]=useState(f.availabilityImpact||3),[E,T]=useState(f.harmLikelihood||3),[O,F]=useState(f.harmSeverity||3),[U,j]=useState(f.risksToRightsAndFreedoms!==void 0?f.risksToRightsAndFreedoms:false),[H,M]=useState(f.highRisksToRightsAndFreedoms!==void 0?f.highRisksToRightsAndFreedoms:false),[X,z]=useState(f.justification||""),[W,re]=useState(0),[k,v]=useState("low"),[x,g]=useState(false),[R,ee]=useState(0),[q,te]=useState(0),[u,y]=useState(false),[$]=useState(()=>Date.now());useEffect(()=>{let V=L*.2+B*.1+I*.1+E*.3+O*.3;re(Number(V.toFixed(1)));let Y;V<2?Y="low":V<3?Y="medium":V<4?Y="high":Y="critical",v(Y),g(U||Y==="high"||Y==="critical");let de=l.discoveredAt+4320*60*1e3;ee(de);let fe=Date.now(),Ne=(de-fe)/(3600*1e3);te(Number(Ne.toFixed(1)));},[L,B,I,E,O,U,l.discoveredAt]);let _=r=>new Date(r).toLocaleString(),t=r=>{r.preventDefault();let C={id:f.id||`assessment_${Date.now()}`,breachId:l.id,assessedAt:Date.now(),assessor:f.assessor||{name:"Assessment User",role:"Data Protection Officer",email:"dpo@example.com"},confidentialityImpact:L,integrityImpact:B,availabilityImpact:I,harmLikelihood:E,harmSeverity:O,overallRiskScore:W,riskLevel:k,risksToRightsAndFreedoms:U,highRisksToRightsAndFreedoms:H,justification:X};A(C),y(true);},m=r=>{switch(r){case 1:return "Minimal";case 2:return "Low";case 3:return "Moderate";case 4:return "High";case 5:return "Severe";default:return "Unknown"}},N=r=>jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[r]}`,b.riskBadge,d),children:r.charAt(0).toUpperCase()+r.slice(1)});return jsxs("div",{"data-ndpr-component":"breach-risk-assessment",className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ae}`,b.root,d),children:[jsx("h2",{className:a("ndpr-section-heading",b.title,d),children:J}),jsx("p",{className:"ndpr-card__subtitle",children:K}),c&&jsxs("div",{className:"ndpr-panel",children:[jsx("h3",{className:"text-lg font-medium mb-2",children:"Breach Summary"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Title:"})," ",l.title]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Discovered:"})," ",_(l.discoveredAt)]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Status:"})," ",l.status.charAt(0).toUpperCase()+l.status.slice(1)]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Types:"})," ",l.dataTypes.join(", ")]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",l.affectedSystems.join(", ")]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",l.estimatedAffectedSubjects||"Unknown"]})]})]})]}),u?jsxs("div",{children:[jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Assessment Results"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Overall Risk Level:"})," ",N(k)]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Risk Score:"})," ",W," / 5"]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Assessed On:"})," ",_($)]})]}),jsxs("div",{children:[jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",U?"Yes":"No"]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",H?"Yes":"No"]})]})]}),jsxs("div",{className:"mt-3",children:[jsx("p",{className:"text-sm mb-1",children:jsx("span",{className:"font-medium",children:"Justification:"})}),jsx("p",{className:"text-sm bg-white dark:bg-gray-800 p-2 rounded",children:X})]})]}),D&&jsxs("div",{className:a(`mb-6 p-4 rounded-md ${x?q>24?"ndpr-alert ndpr-alert--warning":"ndpr-alert ndpr-alert--destructive":"ndpr-alert ndpr-alert--success"}`,b.notificationStatus,d),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Requirements"}),x?jsxs("div",{children:[jsx("p",{className:`text-sm font-bold mb-2 ${q>24?"ndpr-text-warning":"ndpr-text-destructive"}`,children:"NDPC Notification Required"}),jsx("p",{className:"text-sm mb-2",children:"Under the NDPA (Section 40), this breach must be reported to the NDPC within 72 hours of discovery."}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Notification Deadline:"})," ",_(R)]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Time Remaining:"})," ",jsx("span",{className:q<24?"ndpr-text-destructive font-bold":"",children:q>0?`${q} hours`:"Deadline passed"})]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Data Subject Notification:"})," ",H?"Required (NDPA Section 40(4))":"Not required unless directed by NDPC"]})]}):jsxs("div",{children:[jsx("p",{className:"text-sm font-bold mb-2 ndpr-text-success",children:"NDPC Notification Not Required"}),jsx("p",{className:"text-sm mb-2",children:"Based on this assessment, this breach does not need to be reported to the NDPC."}),jsx("p",{className:"text-sm mb-2",children:"However, the breach should still be documented internally for compliance purposes."})]}),jsxs("div",{className:"mt-3 text-sm",children:[jsx("p",{className:"font-medium",children:"Next Steps:"}),jsx("ul",{className:"list-disc pl-5 mt-1",children:x?jsxs(Fragment,{children:[jsx("li",{children:"Prepare a notification report for the NDPC"}),jsx("li",{children:"Document all aspects of the breach and your response"}),H&&jsx("li",{children:"Prepare communications for affected data subjects"}),jsx("li",{children:"Implement measures to mitigate the impact of the breach"})]}):jsxs(Fragment,{children:[jsx("li",{children:"Document the breach and this assessment in your internal records"}),jsx("li",{children:"Implement measures to prevent similar breaches in the future"}),jsx("li",{children:"Review and update security measures as needed"})]})})]})]}),jsx("button",{onClick:()=>y(false),className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${Z}`,b.primaryButton||b.submitButton,d),children:"Edit Assessment"})]}):jsx("form",{onSubmit:t,children:jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Impact Assessment"}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"confidentialityImpact",className:"ndpr-form-field__label",children:["Confidentiality Impact (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the confidentiality of data been compromised?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"confidentialityImpact",min:"1",max:"5",step:"1",value:L,onChange:r=>ie(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(L)," (",L,")"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"integrityImpact",className:"ndpr-form-field__label",children:["Integrity Impact (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the integrity of data been compromised?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"integrityImpact",min:"1",max:"5",step:"1",value:B,onChange:r=>h(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(B)," (",B,")"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"availabilityImpact",className:"ndpr-form-field__label",children:["Availability Impact (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How much has the availability of data or systems been compromised?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"availabilityImpact",min:"1",max:"5",step:"1",value:I,onChange:r=>P(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(I)," (",I,")"]})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Risk to Data Subjects"}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"harmLikelihood",className:"ndpr-form-field__label",children:["Likelihood of Harm (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How likely is it that data subjects will experience harm?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"harmLikelihood",min:"1",max:"5",step:"1",value:E,onChange:r=>T(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(E)," (",E,")"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"harmSeverity",className:"ndpr-form-field__label",children:["Severity of Harm (1-5)",jsx("span",{className:"ml-2 text-sm ndpr-text-muted",children:"How severe would the harm be to affected data subjects?"})]}),jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"range",id:"harmSeverity",min:"1",max:"5",step:"1",value:O,onChange:r=>F(parseInt(r.target.value)),className:a("ndpr-form-field__range",b.slider,d)}),jsxs("span",{className:"ml-3 w-24 text-sm",children:[m(O)," (",O,")"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("div",{className:"flex items-center mb-2",children:[jsx("input",{type:"checkbox",id:"risksToRightsAndFreedoms",checked:U,onChange:r=>j(r.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"risksToRightsAndFreedoms",className:"ml-2 text-sm font-medium",children:"This breach poses a risk to the rights and freedoms of data subjects"})]}),jsx("p",{className:"text-xs ndpr-text-muted ml-6",children:"Under the NDPA (Section 40), breaches that pose a risk to rights and freedoms must be reported to the NDPC within 72 hours."})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("div",{className:"flex items-center mb-2",children:[jsx("input",{type:"checkbox",id:"highRisksToRightsAndFreedoms",checked:H,onChange:r=>M(r.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:"highRisksToRightsAndFreedoms",className:"ml-2 text-sm font-medium",children:"This breach poses a high risk to the rights and freedoms of data subjects"})]}),jsx("p",{className:"text-xs ndpr-text-muted ml-6",children:"Under the NDPA (Section 40(4)), breaches that pose a high risk to rights and freedoms also require notification to affected data subjects without undue delay."})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Overall Assessment"}),jsxs("div",{className:"ndpr-panel",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"font-medium",children:"Overall Risk Score:"}),jsxs("span",{className:a("",b.riskScore,d),children:[W," / 5"]})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"font-medium",children:"Risk Level:"}),N(k)]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsxs("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:["Justification for Assessment ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"justification",value:X,onChange:r=>z(r.target.value),rows:4,placeholder:"Explain the reasoning behind your assessment, including any factors that influenced your decision.",className:"ndpr-form-field__input",required:true})]})]}),jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsx("p",{className:"ndpr-text-info text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. This assessment will determine if notification is required for this breach."})]}),jsx("div",{className:"mt-6",children:jsx("button",{type:"submit",className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${Z}`,b.primaryButton||b.submitButton,d),children:Q})})]})})]})};var Pe=({breachReports:l,riskAssessments:f,regulatoryNotifications:A,onSelectBreach:J,onRequestAssessment:K,onRequestNotification:Q,title:ae="Breach Notification Manager",description:Z="Manage data breach notifications and track compliance with NDPA Section 40 requirements.",className:b="",buttonClassName:d="",classNames:c={},unstyled:D=false,showBreachDetails:L=true,showNotificationTimeline:ie=true,showDeadlineAlerts:B=true})=>{var _;let[h,I]=useState(null),[P,E]=useState(l),[T,O]=useState("all"),[F,U]=useState(""),[j,H]=useState("discoveredAt"),[M,X]=useState("desc");useEffect(()=>{let t=[...l];if(T!=="all"&&(t=t.filter(m=>m.status===T)),F){let m=F.toLowerCase();t=t.filter(N=>N.title.toLowerCase().includes(m)||N.description.toLowerCase().includes(m)||N.affectedSystems.some(r=>r.toLowerCase().includes(m))||N.dataTypes.some(r=>r.toLowerCase().includes(m)));}t.sort((m,N)=>{let r=0;switch(j){case "title":r=m.title.localeCompare(N.title);break;case "discoveredAt":r=m.discoveredAt-N.discoveredAt;break;case "status":r=m.status.localeCompare(N.status);break;case "riskLevel":let C=f.find(V=>V.breachId===m.id),w=f.find(V=>V.breachId===N.id),ne=(C==null?void 0:C.riskLevel)||"unknown",oe=(w==null?void 0:w.riskLevel)||"unknown";r=ne.localeCompare(oe);break;default:r=m.discoveredAt-N.discoveredAt;}return M==="asc"?r:-r}),E(t);},[l,T,F,j,M,f]),useEffect(()=>{P.length>0&&(h&&P.some(m=>m.id===h)||I(P[0].id));},[P,h]);let z=t=>{I(t),J&&J(t);},W=()=>{h&&K&&K(h);},re=()=>{h&&Q&&Q(h);},k=t=>new Date(t).toLocaleString(),v=h?l.find(t=>t.id===h):null,x=h?f.find(t=>t.breachId===h):null,g=h?A.find(t=>t.breachId===h):null,R=v?ee(v,x):null;function ee(t,m){let N=a$1(t,m||void 0),r=t.discoveredAt+N.timeframeHours*60*60*1e3;return {ndpcNotificationRequired:N.notificationRequired,ndpcNotificationDeadline:r,dataSubjectNotificationRequired:(m==null?void 0:m.highRisksToRightsAndFreedoms)||false,justification:N.justification}}function q(t){let m=Date.now(),N=(t-m)/(3600*1e3);return Number(N.toFixed(1))}let te=t=>t?jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{low:"ndpr-badge ndpr-badge--success",medium:"ndpr-badge ndpr-badge--warning",high:"ndpr-badge ndpr-badge--warning",critical:"ndpr-badge ndpr-badge--destructive"}[t]}`,c.statusBadge,D),children:t.charAt(0).toUpperCase()+t.slice(1)}):null,u=t=>jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${{ongoing:"ndpr-badge ndpr-badge--destructive",contained:"ndpr-badge ndpr-badge--warning",resolved:"ndpr-badge ndpr-badge--success"}[t]||"ndpr-badge ndpr-badge--neutral"}`,c.statusBadge,D),children:t.charAt(0).toUpperCase()+t.slice(1)}),y=()=>{if(!v||!R)return null;if(!R.ndpcNotificationRequired)return jsxs("div",{"data-ndpr-component":"breach-notification-manager",className:"ndpr-alert ndpr-alert--success",children:[jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"Notification Not Required"}),jsx("p",{className:"text-xs ndpr-text-success mt-1",children:"Based on the risk assessment, NDPC notification is not required for this breach."})]});if(g)return jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"Notification Sent"}),jsxs("p",{className:"text-xs ndpr-text-success mt-1",children:["Notification was sent to the NDPC on ",k(g.sentAt),"."]})]});let t=q(R.ndpcNotificationDeadline);return t<=0?jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsx("p",{className:"text-sm ndpr-text-destructive font-medium",children:"Notification Deadline Passed"}),jsx("p",{className:"text-xs ndpr-text-destructive mt-1",children:"The 72-hour deadline for NDPC notification has passed. Notification should be sent immediately."})]}):t<=24?jsxs("div",{className:"ndpr-alert ndpr-alert--destructive",children:[jsx("p",{className:"text-sm ndpr-text-destructive font-medium",children:"Urgent: Notification Due Soon"}),jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["Only ",t," hours remaining until the NDPC notification deadline."]})]}):jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm ndpr-text-warning font-medium",children:"Notification Required"}),jsxs("p",{className:"text-xs ndpr-text-warning mt-1",children:["NDPC notification is required by ",k(R.ndpcNotificationDeadline)," (",t," hours remaining)."]})]})},$=()=>{if(!v)return null;let t=[{title:"Breach Discovered",date:v.discoveredAt,completed:true,description:`Breach was discovered on ${k(v.discoveredAt)}.`},{title:"Risk Assessment",date:x==null?void 0:x.assessedAt,completed:!!x,description:x?`Risk assessment completed on ${k(x.assessedAt)}.`:"Risk assessment has not been completed yet."}];return R!=null&&R.ndpcNotificationRequired&&t.push({title:"NDPC Notification",date:g==null?void 0:g.sentAt,completed:!!g,description:g?`Notification sent to the NDPC on ${k(g.sentAt)}.`:`Notification must be sent to the NDPC by ${k(R.ndpcNotificationDeadline)}.`}),R!=null&&R.dataSubjectNotificationRequired&&t.push({title:"Data Subject Notification",date:void 0,completed:false,description:"Notification to affected data subjects is required but has not been sent yet."}),jsxs("div",{className:a("mt-6",c.timeline,D),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Notification Timeline"}),jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:t.map((m,N)=>jsxs("li",{className:a("mb-6 ml-4",c.timelineStep,D),children:[jsx("div",{className:`absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ${m.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700"}`}),jsx("time",{className:"mb-1 text-sm font-normal leading-none ndpr-text-muted",children:m.date?k(m.date):"Pending"}),jsx("h4",{className:"ndpr-section-heading",children:m.title}),jsx("p",{className:"ndpr-form-field__hint",children:m.description})]},N))})]})};return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${b}`,c.root,D),children:[jsxs("div",{className:a("",c.header,D),children:[jsx("h2",{className:a("ndpr-section-heading",c.title,D),children:ae}),jsx("p",{className:"ndpr-card__subtitle",children:Z})]}),jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{children:[jsx("label",{htmlFor:"statusFilter",className:"ndpr-form-field__label",children:"Status Filter"}),jsxs("select",{id:"statusFilter",value:T,onChange:t=>O(t.target.value),className:"ndpr-form-field__input",children:[jsx("option",{value:"all",children:"All Statuses"}),jsx("option",{value:"ongoing",children:"Ongoing"}),jsx("option",{value:"contained",children:"Contained"}),jsx("option",{value:"resolved",children:"Resolved"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"sortBy",className:"ndpr-form-field__label",children:"Sort By"}),jsxs("select",{id:"sortBy",value:j,onChange:t=>H(t.target.value),className:"ndpr-form-field__input",children:[jsx("option",{value:"discoveredAt",children:"Discovery Date"}),jsx("option",{value:"title",children:"Title"}),jsx("option",{value:"status",children:"Status"}),jsx("option",{value:"riskLevel",children:"Risk Level"})]})]}),jsxs("div",{children:[jsx("label",{htmlFor:"searchTerm",className:"ndpr-form-field__label",children:"Search"}),jsx("input",{type:"text",id:"searchTerm",value:F,onChange:t=>U(t.target.value),placeholder:"Search breaches...",className:"ndpr-form-field__input"})]})]}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxs("div",{className:"md:col-span-1",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Breach Reports"}),P.length===0?jsx("p",{className:"ndpr-card__subtitle",children:"No breach reports found."}):jsx("div",{className:a("space-y-2 max-h-96 overflow-y-auto pr-2",c.breachList,D),children:P.map(t=>{let m=f.find(w=>w.breachId===t.id),N=A.find(w=>w.breachId===t.id),r=ee(t,m),C=null;if(r!=null&&r.ndpcNotificationRequired)if(N)C=jsx("span",{className:"text-xs ndpr-text-success",children:"Notified"});else {let w=q(r.ndpcNotificationDeadline);w<=0?C=jsx("span",{className:"text-xs ndpr-text-destructive font-bold",children:"Overdue"}):w<=24?C=jsx("span",{className:"text-xs ndpr-text-destructive",children:"Urgent"}):C=jsx("span",{className:"text-xs ndpr-text-warning",children:"Required"});}else C=jsx("span",{className:"text-xs ndpr-text-success",children:"Not Required"});return jsxs("div",{role:"button",tabIndex:0,"aria-label":`View breach ${t.title}`,"aria-selected":h===t.id,className:a(`p-3 rounded-md cursor-pointer ${h===t.id?"ndpr-alert ndpr-alert--info":"ndpr-panel"}`,c.breachItem,D),onClick:()=>z(t.id),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),z(t.id));},children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx("h4",{className:"font-medium text-sm",children:t.title}),u(t.status)]}),jsxs("p",{className:"text-xs ndpr-text-muted mb-1",children:["Discovered: ",new Date(t.discoveredAt).toLocaleDateString()]}),jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsx("div",{children:m&&te(m.riskLevel)}),jsx("div",{children:C})]})]},t.id)})})]}),jsx("div",{className:a("md:col-span-2",c.detailPanel,D),children:v?jsxs("div",{children:[jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsx("h3",{className:"ndpr-section-heading",children:v.title}),u(v.status)]}),B&&jsx("div",{className:"ndpr-form-field",children:y()}),L&&jsxs("div",{className:"mb-6",children:[jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Discovered:"})," ",k(v.discoveredAt)]}),v.occurredAt&&jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Occurred:"})," ",k(v.occurredAt)]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Reporter:"})," ",v.reporter.name]})]}),jsxs("div",{children:[jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Affected Systems:"})," ",v.affectedSystems.join(", ")]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Data Types:"})," ",v.dataTypes.join(", ")]}),jsxs("p",{className:"ndpr-text-sm",children:[jsx("span",{className:"font-medium",children:"Affected Subjects:"})," ",v.estimatedAffectedSubjects||"Unknown"]})]})]}),jsxs("div",{className:"ndpr-form-field",children:[jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Description:"}),jsx("p",{className:"ndpr-panel",children:v.description})]}),v.initialActions&&jsxs("div",{children:[jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Initial Actions Taken:"}),jsx("p",{className:"ndpr-panel",children:v.initialActions})]})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Risk Assessment"}),x?jsxs("div",{className:"ndpr-panel",children:[jsxs("div",{className:"flex justify-between items-center mb-2",children:[jsx("p",{className:"ndpr-text-sm ndpr-font-medium",children:"Risk Level:"}),te(x.riskLevel)]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Risk Score:"})," ",x.overallRiskScore," / 5"]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Risks to Rights and Freedoms:"})," ",x.risksToRightsAndFreedoms?"Yes":"No"]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"High Risks to Rights and Freedoms:"})," ",x.highRisksToRightsAndFreedoms?"Yes":"No"]}),jsx("p",{className:"text-sm mb-1",children:jsx("span",{className:"font-medium",children:"Justification:"})}),jsx("p",{className:"text-xs ndpr-text-muted bg-white dark:bg-gray-800 p-2 rounded-md",children:x.justification})]}):jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm ndpr-text-warning",children:"Risk assessment has not been conducted yet."}),jsx("button",{onClick:W,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${d}`,children:"Conduct Risk Assessment"})]})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Notification Status"}),g?jsxs("div",{className:"ndpr-panel",children:[jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Notification Sent:"})," ",k(g.sentAt)]}),jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Method:"})," ",g.method.charAt(0).toUpperCase()+g.method.slice(1)]}),g.referenceNumber&&jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"Reference Number:"})," ",g.referenceNumber]}),(g.ndpcContact||g.nitdaContact)&&jsxs("p",{className:"text-sm mb-2",children:[jsx("span",{className:"font-medium",children:"NDPC Contact:"})," ",(_=g.ndpcContact||g.nitdaContact)==null?void 0:_.name]})]}):jsx("div",{children:R!=null&&R.ndpcNotificationRequired?jsxs("div",{className:"ndpr-alert ndpr-alert--warning",children:[jsx("p",{className:"text-sm ndpr-text-warning",children:"NDPC notification is required but has not been sent yet."}),jsx("button",{onClick:re,className:`mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ${d}`,children:"Generate Notification"})]}):jsx("div",{className:"ndpr-alert ndpr-alert--success",children:jsx("p",{className:"text-sm ndpr-text-success",children:"NDPC notification is not required for this breach."})})})]}),ie&&$()]}):jsx("div",{className:"ndpr-empty-state",children:jsx("p",{className:"ndpr-card__subtitle",children:"Select a breach to view details"})})})]})]})};var Le=({breachData:l,assessmentData:f,organizationInfo:A,onGenerate:J,title:K="Generate NDPC Notification Report",description:Q="Generate a report for submission to the NDPC in compliance with NDPA Section 40 breach notification requirements.",generateButtonText:ae="Generate Report",className:Z="",buttonClassName:b$1="",classNames:d={},unstyled:c=false,showPreview:D=true,allowEditing:L=true,allowDownload:ie=true,downloadFormat:B="pdf"})=>{let[h,I]=useState(""),[P,E]=useState(""),[T,O]=useState(""),[F,U]=useState(""),[j,H]=useState("email"),[M,X]=useState(""),[z,W]=useState(""),[re,k]=useState(false),[v,x]=useState(false);useEffect(()=>{let u=R();I(u),k(true);},[l,f,A]);let g=u=>new Date(u).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),R=()=>{var m,N,r,C,w,ne;let y=new Date().toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),$=((m=l.dpoContact)==null?void 0:m.name)||A.dpoName,_=((N=l.dpoContact)==null?void 0:N.email)||A.dpoEmail,t=((r=l.dpoContact)==null?void 0:r.phone)||A.dpoPhone;return `
|
|
2
|
+
NDPC DATA BREACH NOTIFICATION
|
|
3
|
+
|
|
4
|
+
Date: ${y}
|
|
5
|
+
${l.isPhasedReport?"Report Type: PHASED / INTERIM REPORT":"Report Type: Full Report"}
|
|
6
|
+
${l.supplementsReportId?`Supplements Report ID: ${l.supplementsReportId}`:""}
|
|
7
|
+
|
|
8
|
+
Reference: NDPA Section 40 - Personal Data Breaches
|
|
9
|
+
|
|
10
|
+
ORGANIZATION DETAILS
|
|
11
|
+
-------------------
|
|
12
|
+
Organization Name: ${A.name}
|
|
13
|
+
${A.registrationNumber?`Registration Number: ${A.registrationNumber}`:""}
|
|
14
|
+
Address: ${A.address}
|
|
15
|
+
${A.website?`Website: ${A.website}`:""}
|
|
16
|
+
|
|
17
|
+
DATA PROTECTION OFFICER (Section 32 contact point)
|
|
18
|
+
----------------------
|
|
19
|
+
Name: ${$}
|
|
20
|
+
Email: ${_}
|
|
21
|
+
${t?`Phone: ${t}`:""}
|
|
22
|
+
|
|
23
|
+
BREACH DETAILS
|
|
24
|
+
-------------
|
|
25
|
+
Breach Title: ${l.title}
|
|
26
|
+
Date Discovered: ${g(l.discoveredAt)}
|
|
27
|
+
${l.occurredAt?`Date Occurred: ${g(l.occurredAt)}`:"Date Occurred: Unknown"}
|
|
28
|
+
Status: ${l.status.charAt(0).toUpperCase()+l.status.slice(1)}
|
|
29
|
+
|
|
30
|
+
Nature of the Personal Data Breach (Section 40(2)):
|
|
31
|
+
${l.description}
|
|
32
|
+
|
|
33
|
+
Affected Systems/Applications:
|
|
34
|
+
${l.affectedSystems.join(", ")}
|
|
35
|
+
|
|
36
|
+
Types of Personal Data Involved:
|
|
37
|
+
${l.dataTypes.join(", ")}
|
|
38
|
+
${l.involvesSensitiveData?"Sensitive personal data (Section 30) involved: YES":""}
|
|
39
|
+
|
|
40
|
+
Categories of Data Subjects Affected (Section 40(2)):
|
|
41
|
+
${((C=l.dataSubjectCategories)==null?void 0:C.join(", "))||"[Not specified \u2014 required by NDPC]"}
|
|
42
|
+
|
|
43
|
+
Approximate Number of Data Subjects Affected:
|
|
44
|
+
${(w=l.estimatedAffectedSubjects)!=null?w:"Unknown"}
|
|
45
|
+
|
|
46
|
+
Approximate Number of Personal Data Records Concerned (Section 40(2)):
|
|
47
|
+
${(ne=l.approximateRecordCount)!=null?ne:"Unknown"}
|
|
48
|
+
|
|
49
|
+
RISK ASSESSMENT
|
|
50
|
+
--------------
|
|
51
|
+
${f?`
|
|
52
|
+
Overall Risk Level: ${f.riskLevel.charAt(0).toUpperCase()+f.riskLevel.slice(1)}
|
|
53
|
+
Risk to Rights and Freedoms of Data Subjects: ${f.risksToRightsAndFreedoms?"Yes":"No"}
|
|
54
|
+
High Risk to Rights and Freedoms of Data Subjects: ${f.highRisksToRightsAndFreedoms?"Yes":"No"}
|
|
55
|
+
|
|
56
|
+
Justification for Risk Assessment:
|
|
57
|
+
${f.justification}
|
|
58
|
+
`:"Risk assessment has not been conducted yet."}
|
|
59
|
+
|
|
60
|
+
LIKELY CONSEQUENCES OF THE BREACH (Section 40(3))
|
|
61
|
+
--------------------------------
|
|
62
|
+
${l.likelyConsequences||"[Please describe likely consequences for affected data subjects \u2014 identity theft, financial loss, discrimination, etc.]"}
|
|
63
|
+
|
|
64
|
+
MEASURES TAKEN OR PROPOSED
|
|
65
|
+
-------------
|
|
66
|
+
Measures taken to address the breach:
|
|
67
|
+
${l.initialActions||"To be determined"}
|
|
68
|
+
|
|
69
|
+
Measures taken or proposed to mitigate possible adverse effects (Section 40(3)):
|
|
70
|
+
${l.mitigationMeasures||"[Please specify mitigation measures]"}
|
|
71
|
+
|
|
72
|
+
NOTIFICATION TO DATA SUBJECTS (Section 40(3))
|
|
73
|
+
----------------------------
|
|
74
|
+
Have data subjects been notified: [Yes/No]
|
|
75
|
+
If yes, date of notification: [Date]
|
|
76
|
+
If no, planned date of notification: [Date]
|
|
77
|
+
Reason for delay (if applicable): [Reason]
|
|
78
|
+
|
|
79
|
+
${l.isPhasedReport?`PHASED REPORT NOTE
|
|
80
|
+
---------------------
|
|
81
|
+
This report is submitted in phases under NDPA Section 40(2) because complete
|
|
82
|
+
information was not available within 72 hours of discovery. A supplementary
|
|
83
|
+
report will be filed once additional facts are confirmed.
|
|
84
|
+
`:""}
|
|
85
|
+
ADDITIONAL INFORMATION
|
|
86
|
+
---------------------
|
|
87
|
+
[Any additional information relevant to the breach]
|
|
88
|
+
|
|
89
|
+
This notification is made in compliance with the Nigeria Data Protection Act (NDPA), Section 40.
|
|
90
|
+
|
|
91
|
+
IMPORTANT NOTICE
|
|
92
|
+
---------------------
|
|
93
|
+
${b}
|
|
94
|
+
`},ee=u=>{u.preventDefault();let y={id:`notification_${Date.now()}`,breachId:l.id,sentAt:Date.now(),method:j,referenceNumber:M||void 0,ndpcContact:P?{name:P,email:T,phone:F||void 0}:void 0,content:h,attachments:[]};J(y),x(true);},q=()=>{let u,y,$;switch(B){case "html":{u="text/html",y="html",$=`<!DOCTYPE html>
|
|
95
|
+
<html lang="en">
|
|
96
|
+
<head>
|
|
97
|
+
<meta charset="UTF-8">
|
|
98
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
99
|
+
<title>NDPC Breach Notification Report</title>
|
|
100
|
+
<style>body{font-family:monospace;white-space:pre-wrap;max-width:800px;margin:2rem auto;padding:0 1rem;}</style>
|
|
101
|
+
</head>
|
|
102
|
+
<body>${h.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</body>
|
|
103
|
+
</html>`;break}case "pdf":u="text/plain",y="pdf.txt",$=h;break;case "docx":u="text/plain",y="docx.txt",$=h;break;default:u="text/plain",y="txt",$=h;}let _=document.createElement("a"),t=new Blob([$],{type:u});_.href=URL.createObjectURL(t),_.download=`NDPC_Breach_Notification_${new Date().toISOString().split("T")[0]}.${y}`,document.body.appendChild(_),_.click(),document.body.removeChild(_);},te=()=>[{value:"email",label:"Email"},{value:"portal",label:"NDPC Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map(y=>jsx("option",{value:y.value,children:y.label},y.value));return jsxs("div",{"data-ndpr-component":"regulatory-report-generator",className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Z}`,d.root,c),children:[jsxs("div",{className:a("",d.header,c),children:[jsx("h2",{className:a("ndpr-section-heading",d.title,c),children:K}),jsx("p",{className:"ndpr-card__subtitle",children:Q})]}),v?jsxs("div",{children:[jsxs("div",{className:"ndpr-alert ndpr-alert--success",children:[jsx("h3",{className:"text-lg font-bold ndpr-text-success mb-2",children:"Report Generated Successfully"}),jsx("p",{className:"ndpr-text-success",children:"Your NDPC notification report has been generated and is ready for submission. Please review the report carefully before submitting it to the NDPC."})]}),jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"ndpr-section-heading",children:"Submission Details"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[jsxs("div",{children:[jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Method:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:j.charAt(0).toUpperCase()+j.slice(1)})]}),P&&jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Contact Name:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:P})]}),T&&jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Contact Email:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:T})]}),F&&jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Contact Phone:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:F})]})]}),jsxs("div",{children:[jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Date Generated:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:g(Date.now())})]}),jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Breach ID:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:l.id})]}),M&&jsxs("p",{className:a("ndpr-text-sm",d.field,c),children:[jsx("span",{className:a("font-medium",d.fieldLabel,c),children:"Reference Number:"})," ",jsx("span",{className:a("",d.fieldValue,c),children:M})]})]})]})]}),D&&jsxs("div",{className:"mb-6",children:[jsx("h3",{className:"ndpr-section-heading",children:"Report Preview"}),jsx("div",{className:a("ndpr-panel",d.reportPreview,c),children:jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:h})})]}),jsxs("div",{className:"ndpr-card__footer",children:[ie&&jsxs("button",{onClick:q,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${b$1}`,d.secondaryButton||d.downloadButton,c),children:["Download Report (",B.toUpperCase(),")"]}),jsx("button",{onClick:()=>x(false),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${b$1}`,children:"Edit Report"})]})]}):jsx("form",{onSubmit:ee,children:jsxs("div",{className:"ndpr-form-section",children:[jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Notification Method"}),jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"method",className:"ndpr-form-field__label",children:["Method of Submission ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("select",{id:"method",value:j,onChange:u=>H(u.target.value),className:"ndpr-form-field__input",required:true,children:te()})]}),jsxs("div",{children:[jsx("label",{htmlFor:"referenceNumber",className:"ndpr-form-field__label",children:"Reference Number (if available)"}),jsx("input",{type:"text",id:"referenceNumber",value:M,onChange:u=>X(u.target.value),placeholder:"e.g. NDPC/BR/2024/001",className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"NDPC Contact (if known)"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxs("div",{children:[jsx("label",{htmlFor:"contactName",className:"ndpr-form-field__label",children:"Contact Name"}),jsx("input",{type:"text",id:"contactName",value:P,onChange:u=>E(u.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"contactEmail",className:"ndpr-form-field__label",children:"Contact Email"}),jsx("input",{type:"email",id:"contactEmail",value:T,onChange:u=>O(u.target.value),className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:"contactPhone",className:"ndpr-form-field__label",children:"Contact Phone"}),jsx("input",{type:"tel",id:"contactPhone",value:F,onChange:u=>U(u.target.value),className:"ndpr-form-field__input"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Additional Information"}),jsxs("div",{children:[jsx("label",{htmlFor:"additionalInfo",className:"ndpr-form-field__label",children:"Additional Information to Include"}),jsx("textarea",{id:"additionalInfo",value:z,onChange:u=>W(u.target.value),rows:3,placeholder:"Any additional information you want to include in the report",className:"ndpr-form-field__input"})]})]}),L&&jsxs("div",{children:[jsx("h3",{className:"ndpr-section-heading",children:"Report Content"}),jsxs("div",{children:[jsxs("label",{htmlFor:"reportContent",className:"ndpr-form-field__label",children:["Edit Report Content ",jsx("span",{className:"ndpr-form-field__required",children:"*"})]}),jsx("textarea",{id:"reportContent",value:h,onChange:u=>I(u.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono",required:true})]})]}),jsxs("div",{className:"ndpr-alert ndpr-alert--info",children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Breach Notification Requirements"}),jsx("p",{className:"ndpr-text-info text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. This report will help you comply with this requirement."}),jsx("p",{className:"ndpr-text-muted text-xs mt-2 italic",role:"note",children:a$2})]}),jsx("div",{className:"mt-6",children:jsx("button",{type:"submit",className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${b$1}`,d.primaryButton||d.generateButton,c),children:ae})})]})})]})};export{ye as a,Pe as b,Le as c};
|